diff --git a/DEPS b/DEPS
index 4b9eb10..a96095e 100644
--- a/DEPS
+++ b/DEPS
@@ -39,11 +39,11 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': 'cbf4fba43933302a846872e4c5ce8f1adb8b325e',
+  'skia_revision': '4ca2e6034365ad280ec64473f7f1d72ebd8335e4',
   # 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': '9ac4a7402201283527c49026ce31e232b325227d',
+  'v8_revision': '8b8ba9031542c64295ab11f8985f9a9c9f5f170a',
   # 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.
@@ -187,7 +187,7 @@
    Var('chromium_git') + '/webm/libvpx.git' + '@' +  '0941ff72a00732cea6750477edfe649348e699de',
 
   'src/third_party/ffmpeg':
-   Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'd435476f9456ced37c4f7c1d6221fe04c0d6b63d',
+   Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '4b95e276f3891020fd3560c973dcc70dd50403c6',
 
   'src/third_party/libjingle/source/talk':
     Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '3ecea8a7f856b250a0c86d26f7a7d0f284ca5afb', # commit position 10671
@@ -214,7 +214,7 @@
    Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067',
 
   'src/third_party/webrtc':
-    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '2f4c471df7c34092e17fbe8ad39c7120d0d8ea2f', # commit position 10679
+    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '82cc96fa7a18819123cc171b19ca880c48b3406f', # commit position 10685
 
   'src/third_party/openmax_dl':
     Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' +  Var('openmax_dl_revision'),
diff --git a/WATCHLISTS b/WATCHLISTS
index 4f2e178c..51ea770 100644
--- a/WATCHLISTS
+++ b/WATCHLISTS
@@ -713,6 +713,9 @@
     'streams': {
       'filepath': 'content/browser/streams/',
     },
+    'styleguide': {
+      'filepath': '^styleguide/',
+    },
     'supervised_users': {
       'filepath': 'chrome/browser/.*managed_mode'\
                   '|chrome/browser/.*managed_user'\
@@ -1457,6 +1460,7 @@
                    'rlp+watch@chromium.org',
                    'rouslan+spell@chromium.org'],
     'streams': ['zork+watch@chromium.org'],
+    'styleguide': ['vmpstr+watch@chromium.org'],
     'sync': ['tim+watch@chromium.org',
              'maxbogue+watch@chromium.org',
              'plaree+watch@chromium.org',
diff --git a/android_webview/browser/net/android_stream_reader_url_request_job.cc b/android_webview/browser/net/android_stream_reader_url_request_job.cc
index 173bdbb..dc288faa5 100644
--- a/android_webview/browser/net/android_stream_reader_url_request_job.cc
+++ b/android_webview/browser/net/android_stream_reader_url_request_job.cc
@@ -21,7 +21,6 @@
 #include "content/public/browser/browser_thread.h"
 #include "net/base/io_buffer.h"
 #include "net/base/mime_util.h"
-#include "net/base/net_errors.h"
 #include "net/base/net_util.h"
 #include "net/http/http_response_headers.h"
 #include "net/http/http_response_info.h"
@@ -90,6 +89,7 @@
     net::NetworkDelegate* network_delegate,
     scoped_ptr<Delegate> delegate)
     : URLRequestJob(request, network_delegate),
+      range_parse_result_(net::OK),
       delegate_(delegate.Pass()),
       weak_factory_(this) {
   DCHECK(delegate_);
@@ -101,6 +101,7 @@
     scoped_ptr<DelegateObtainer> delegate_obtainer,
     bool)
     : URLRequestJob(request, network_delegate),
+      range_parse_result_(net::OK),
       delegate_obtainer_(delegate_obtainer.Pass()),
       weak_factory_(this) {
   DCHECK(delegate_obtainer_);
@@ -141,7 +142,10 @@
         base::Bind(&AndroidStreamReaderURLRequestJob::DelegateObtained,
                    weak_factory_.GetWeakPtr()));
   } else {
-    DoStart();
+    // Run DoStart asynchronously to avoid re-entering the delegate.
+    base::ThreadTaskRunnerHandle::Get()->PostTask(
+        FROM_HERE, base::Bind(&AndroidStreamReaderURLRequestJob::DoStart,
+                              weak_factory_.GetWeakPtr()));
   }
 }
 
@@ -202,45 +206,29 @@
     set_expected_content_size(result);
     HeadersComplete(kHTTPOk, kHTTPOkText);
   } else {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
+    NotifyStartError(
+        net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
   }
 }
 
 void AndroidStreamReaderURLRequestJob::OnReaderReadCompleted(int result) {
   DCHECK(thread_checker_.CalledOnValidThread());
-  // The URLRequest API contract requires that:
-  // * NotifyDone be called once, to set the status code, indicate the job is
-  //   finished (there will be no further IO),
-  // * NotifyReadComplete be called if false is returned from ReadRawData to
-  //   indicate that the IOBuffer will not be used by the job anymore.
-  // There might be multiple calls to ReadRawData (and thus multiple calls to
-  // NotifyReadComplete), which is why NotifyDone is called only on errors
-  // (result < 0) and end of data (result == 0).
-  if (result == 0) {
-    NotifyDone(net::URLRequestStatus());
-  } else if (result < 0) {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
-  } else {
-    // Clear the IO_PENDING status.
-    SetStatus(net::URLRequestStatus());
-  }
-  NotifyReadComplete(result);
+
+  ReadRawDataComplete(result);
 }
 
 base::TaskRunner* AndroidStreamReaderURLRequestJob::GetWorkerThreadRunner() {
   return static_cast<base::TaskRunner*>(BrowserThread::GetBlockingPool());
 }
 
-bool AndroidStreamReaderURLRequestJob::ReadRawData(net::IOBuffer* dest,
-                                                   int dest_size,
-                                                   int* bytes_read) {
+int AndroidStreamReaderURLRequestJob::ReadRawData(net::IOBuffer* dest,
+                                                  int dest_size) {
   DCHECK(thread_checker_.CalledOnValidThread());
   if (!input_stream_reader_wrapper_.get()) {
     // This will happen if opening the InputStream fails in which case the
     // error is communicated by setting the HTTP response status header rather
     // than failing the request during the header fetch phase.
-    *bytes_read = 0;
-    return true;
+    return 0;
   }
 
   PostTaskAndReplyWithResult(
@@ -251,9 +239,7 @@
       base::Bind(&AndroidStreamReaderURLRequestJob::OnReaderReadCompleted,
                  weak_factory_.GetWeakPtr()));
 
-  SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING,
-                                  net::ERR_IO_PENDING));
-  return false;
+  return net::ERR_IO_PENDING;
 }
 
 bool AndroidStreamReaderURLRequestJob::GetMimeType(
@@ -303,6 +289,11 @@
 
 void AndroidStreamReaderURLRequestJob::DoStart() {
   DCHECK(thread_checker_.CalledOnValidThread());
+  if (range_parse_result_ != net::OK) {
+    NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                           range_parse_result_));
+    return;
+  }
   // Start reading asynchronously so that all error reporting and data
   // callbacks happen as they would for network requests.
   SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING,
@@ -383,19 +374,18 @@
     const net::HttpRequestHeaders& headers) {
   std::string range_header;
   if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) {
-    // We only extract the "Range" header so that we know how many bytes in the
-    // stream to skip and how many to read after that.
+    // This job only cares about the Range header so that we know how many bytes
+    // in the stream to skip and how many to read after that. Note that
+    // validation is deferred to DoStart(), because NotifyStartError() is not
+    // legal to call since the job has not started.
     std::vector<net::HttpByteRange> ranges;
     if (net::HttpUtil::ParseRangeHeader(range_header, &ranges)) {
-      if (ranges.size() == 1) {
+      if (ranges.size() == 1)
         byte_range_ = ranges[0];
-      } else {
-        // We don't support multiple range requests in one single URL request,
-        // because we need to do multipart encoding here.
-        NotifyDone(
-            net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                  net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
-      }
+    } else {
+      // We don't support multiple range requests in one single URL request,
+      // because we need to do multipart encoding here.
+      range_parse_result_ = net::ERR_REQUEST_RANGE_NOT_SATISFIABLE;
     }
   }
 }
diff --git a/android_webview/browser/net/android_stream_reader_url_request_job.h b/android_webview/browser/net/android_stream_reader_url_request_job.h
index e21d7655..645be13 100644
--- a/android_webview/browser/net/android_stream_reader_url_request_job.h
+++ b/android_webview/browser/net/android_stream_reader_url_request_job.h
@@ -15,6 +15,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
+#include "net/base/net_errors.h"
 #include "net/http/http_byte_range.h"
 #include "net/url_request/url_request_job.h"
 
@@ -96,7 +97,7 @@
   // URLRequestJob:
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
   bool GetMimeType(std::string* mime_type) const override;
   bool GetCharset(std::string* charset) override;
@@ -131,6 +132,7 @@
   void OnReaderReadCompleted(int bytes_read);
 
   net::HttpByteRange byte_range_;
+  net::Error range_parse_result_;
   scoped_ptr<net::HttpResponseInfo> response_info_;
   scoped_ptr<Delegate> delegate_;
   scoped_ptr<DelegateObtainer> delegate_obtainer_;
diff --git a/base/bind_internal.h b/base/bind_internal.h
index e053218..1cb1684d 100644
--- a/base/bind_internal.h
+++ b/base/bind_internal.h
@@ -5,6 +5,8 @@
 #ifndef BASE_BIND_INTERNAL_H_
 #define BASE_BIND_INTERNAL_H_
 
+#include <type_traits>
+
 #include "base/bind_helpers.h"
 #include "base/callback_internal.h"
 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
@@ -77,9 +79,9 @@
 // recursively.
 template <typename R, typename T, typename... Args>
 struct HasNonConstReferenceParam<R(T, Args...)>
-    : SelectType<is_non_const_reference<T>::value,
-                 true_type,
-                 HasNonConstReferenceParam<R(Args...)>>::Type {};
+    : std::conditional<is_non_const_reference<T>::value,
+                       true_type,
+                       HasNonConstReferenceParam<R(Args...)>>::type {};
 
 // HasRefCountedTypeAsRawPtr selects true_type when any of the |Args| is a raw
 // pointer to a RefCounted type.
@@ -93,9 +95,9 @@
 // parameters recursively.
 template <typename T, typename... Args>
 struct HasRefCountedTypeAsRawPtr<T, Args...>
-    : SelectType<NeedsScopedRefptrButGetsRawPtr<T>::value,
-                 true_type,
-                 HasRefCountedTypeAsRawPtr<Args...>>::Type {};
+    : std::conditional<NeedsScopedRefptrButGetsRawPtr<T>::value,
+                       true_type,
+                       HasRefCountedTypeAsRawPtr<Args...>>::type {};
 
 // BindsArrayToFirstArg selects true_type when |is_method| is true and the first
 // item of |Args| is an array type.
diff --git a/base/callback_internal.h b/base/callback_internal.h
index b6353dc..4b47bc7 100644
--- a/base/callback_internal.h
+++ b/base/callback_internal.h
@@ -9,6 +9,7 @@
 #define BASE_CALLBACK_INTERNAL_H_
 
 #include <stddef.h>
+#include <type_traits>
 
 #include "base/atomic_ref_count.h"
 #include "base/base_export.h"
@@ -105,18 +106,6 @@
                             !is_const<T>::value;
 };
 
-// Returns |Then| as SelectType::Type if |condition| is true. Otherwise returns
-// |Else|.
-template <bool condition, typename Then, typename Else>
-struct SelectType {
-  typedef Then Type;
-};
-
-template <typename Then, typename Else>
-struct SelectType<false, Then, Else> {
-  typedef Else Type;
-};
-
 template <typename>
 struct CallbackParamTraitsForMoveOnlyType;
 
@@ -140,9 +129,9 @@
 // break passing of C-string literals.
 template <typename T>
 struct CallbackParamTraits
-    : SelectType<IsMoveOnlyType<T>::value,
+    : std::conditional<IsMoveOnlyType<T>::value,
          CallbackParamTraitsForMoveOnlyType<T>,
-         CallbackParamTraitsForNonMoveOnlyType<T> >::Type {
+         CallbackParamTraitsForNonMoveOnlyType<T>>::type {
 };
 
 template <typename T>
diff --git a/base/threading/worker_pool.h b/base/threading/worker_pool.h
index f8c6235..a52a414 100644
--- a/base/threading/worker_pool.h
+++ b/base/threading/worker_pool.h
@@ -22,11 +22,11 @@
 // This is a facility that runs tasks that don't require a specific thread or
 // a message loop.
 //
-// WARNING: This shouldn't be used unless absolutely necessary. Typically
-// (without calling ShutDownCleanly()), we don't wait for the worker pool
-// threads to finish on shutdown, so the tasks running inside the pool must be
-// extremely careful about other objects they access (MessageLoops, Singletons,
-// etc). During shutdown these object may no longer exist.
+// WARNING: This shouldn't be used unless absolutely necessary. We don't wait
+// for the worker pool threads to finish on shutdown, so the tasks running
+// inside the pool must be extremely careful about other objects they access
+// (MessageLoops, Singletons, etc). During shutdown these object may no longer
+// exist.
 class BASE_EXPORT WorkerPool {
  public:
   // This function posts |task| to run on a worker thread.  |task_is_slow|
@@ -53,13 +53,6 @@
   // Get a TaskRunner wrapper which posts to the WorkerPool using the given
   // |task_is_slow| behavior.
   static const scoped_refptr<TaskRunner>& GetTaskRunner(bool task_is_slow);
-
-  // Blocks until all worker threads quit cleanly. Please note that it ensures
-  // that no worker threads are running after the method returns, but it doesn't
-  // guarantee to process all queued pending tasks. This method may take a long
-  // time. Please don't use it unless absolutely necessary, e.g., when we want
-  // to unload the library containing the worker pool before process shutdown.
-  static void ShutDownCleanly();
 };
 
 }  // namespace base
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 231aa68..ea9ece4 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -22,10 +22,10 @@
 
 namespace {
 
-LazyInstance<ThreadLocalBoolean>::Leaky g_worker_pool_running_on_this_thread =
-    LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<ThreadLocalBoolean>::Leaky
+    g_worker_pool_running_on_this_thread = LAZY_INSTANCE_INITIALIZER;
 
-const int64 kIdleSecondsBeforeExit = 10 * 60;
+const int kIdleSecondsBeforeExit = 10 * 60;
 
 class WorkerPoolImpl {
  public:
@@ -33,55 +33,49 @@
   ~WorkerPoolImpl();
 
   void PostTask(const tracked_objects::Location& from_here,
-                const Closure& task,
+                const base::Closure& task,
                 bool task_is_slow);
 
-  void ShutDownCleanly();
-
  private:
-  scoped_refptr<PosixDynamicThreadPool> pool_;
+  scoped_refptr<base::PosixDynamicThreadPool> pool_;
 };
 
 WorkerPoolImpl::WorkerPoolImpl()
-    : pool_(new PosixDynamicThreadPool(
-          "WorkerPool",
-          TimeDelta::FromSeconds(kIdleSecondsBeforeExit))) {
-}
+    : pool_(new base::PosixDynamicThreadPool("WorkerPool",
+                                             kIdleSecondsBeforeExit)) {}
 
 WorkerPoolImpl::~WorkerPoolImpl() {
-  pool_->Terminate(false);
+  pool_->Terminate();
 }
 
 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here,
-                              const Closure& task,
+                              const base::Closure& task,
                               bool task_is_slow) {
   pool_->PostTask(from_here, task);
 }
 
-void WorkerPoolImpl::ShutDownCleanly() {
-  pool_->Terminate(true);
-}
-
-LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool =
+    LAZY_INSTANCE_INITIALIZER;
 
 class WorkerThread : public PlatformThread::Delegate {
  public:
-  WorkerThread(const std::string& name_prefix, PosixDynamicThreadPool* pool)
+  WorkerThread(const std::string& name_prefix,
+               base::PosixDynamicThreadPool* pool)
       : name_prefix_(name_prefix), pool_(pool) {}
 
   void ThreadMain() override;
 
  private:
   const std::string name_prefix_;
-  scoped_refptr<PosixDynamicThreadPool> pool_;
+  scoped_refptr<base::PosixDynamicThreadPool> pool_;
 
   DISALLOW_COPY_AND_ASSIGN(WorkerThread);
 };
 
 void WorkerThread::ThreadMain() {
   g_worker_pool_running_on_this_thread.Get().Set(true);
-  const std::string name =
-      StringPrintf("%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
+  const std::string name = base::StringPrintf("%s/%d", name_prefix_.c_str(),
+                                              PlatformThread::CurrentId());
   // Note |name.c_str()| must remain valid for for the whole life of the thread.
   PlatformThread::SetName(name);
 
@@ -102,7 +96,7 @@
         pending_task.birth_tally, pending_task.time_posted, stopwatch);
   }
 
-  pool_->NotifyWorkerIsGoingAway(PlatformThread::CurrentHandle());
+  // The WorkerThread is non-joinable, so it deletes itself.
   delete this;
 }
 
@@ -110,7 +104,7 @@
 
 // static
 bool WorkerPool::PostTask(const tracked_objects::Location& from_here,
-                          const Closure& task,
+                          const base::Closure& task,
                           bool task_is_slow) {
   g_lazy_worker_pool.Pointer()->PostTask(from_here, task, task_is_slow);
   return true;
@@ -121,82 +115,73 @@
   return g_worker_pool_running_on_this_thread.Get().Get();
 }
 
-// static
-void WorkerPool::ShutDownCleanly() {
-  g_lazy_worker_pool.Pointer()->ShutDownCleanly();
-}
-
 PosixDynamicThreadPool::PosixDynamicThreadPool(const std::string& name_prefix,
-                                               TimeDelta idle_time_before_exit)
+                                               int idle_seconds_before_exit)
     : name_prefix_(name_prefix),
-      idle_time_before_exit_(idle_time_before_exit),
+      idle_seconds_before_exit_(idle_seconds_before_exit),
       pending_tasks_available_cv_(&lock_),
       num_idle_threads_(0),
-      has_pending_cleanup_task_(false),
-      terminated_(false) {
-}
+      terminated_(false) {}
 
 PosixDynamicThreadPool::~PosixDynamicThreadPool() {
   while (!pending_tasks_.empty())
     pending_tasks_.pop();
 }
 
-void PosixDynamicThreadPool::Terminate(bool blocking) {
-  std::vector<PlatformThreadHandle> threads_to_cleanup;
-  std::vector<PlatformThreadHandle> worker_threads;
+void PosixDynamicThreadPool::Terminate() {
   {
     AutoLock locked(lock_);
-    if (terminated_)
-      return;
+    DCHECK(!terminated_) << "Thread pool is already terminated.";
     terminated_ = true;
-
-    threads_to_cleanup.swap(threads_to_cleanup_);
-    worker_threads.swap(worker_threads_);
   }
   pending_tasks_available_cv_.Broadcast();
-
-  if (blocking) {
-    for (const auto& item : threads_to_cleanup)
-      PlatformThread::Join(item);
-
-    for (const auto& item : worker_threads)
-      PlatformThread::Join(item);
-
-    // No need to take the lock. No one else should be accessing these members.
-    DCHECK_EQ(0u, num_idle_threads_);
-    // The following members should not have new elements added after
-    // |terminated_| is set to true.
-    DCHECK(threads_to_cleanup_.empty());
-    DCHECK(worker_threads_.empty());
-  }
 }
 
 void PosixDynamicThreadPool::PostTask(
     const tracked_objects::Location& from_here,
-    const Closure& task) {
+    const base::Closure& task) {
   PendingTask pending_task(from_here, task);
+  AddTask(&pending_task);
+}
+
+void PosixDynamicThreadPool::AddTask(PendingTask* pending_task) {
   AutoLock locked(lock_);
-  AddTaskNoLock(&pending_task);
+  DCHECK(!terminated_)
+      << "This thread pool is already terminated.  Do not post new tasks.";
+
+  pending_tasks_.push(*pending_task);
+  pending_task->task.Reset();
+
+  // We have enough worker threads.
+  if (static_cast<size_t>(num_idle_threads_) >= pending_tasks_.size()) {
+    pending_tasks_available_cv_.Signal();
+  } else {
+    // The new PlatformThread will take ownership of the WorkerThread object,
+    // which will delete itself on exit.
+    WorkerThread* worker = new WorkerThread(name_prefix_, this);
+    PlatformThread::CreateNonJoinable(0, worker);
+  }
 }
 
 PendingTask PosixDynamicThreadPool::WaitForTask() {
   AutoLock locked(lock_);
 
   if (terminated_)
-    return PendingTask(FROM_HERE, Closure());
+    return PendingTask(FROM_HERE, base::Closure());
 
   if (pending_tasks_.empty()) {  // No work available, wait for work.
     num_idle_threads_++;
-    if (num_threads_cv_)
-      num_threads_cv_->Broadcast();
-    pending_tasks_available_cv_.TimedWait(idle_time_before_exit_);
+    if (num_idle_threads_cv_.get())
+      num_idle_threads_cv_->Signal();
+    pending_tasks_available_cv_.TimedWait(
+        TimeDelta::FromSeconds(idle_seconds_before_exit_));
     num_idle_threads_--;
-    if (num_threads_cv_)
-      num_threads_cv_->Broadcast();
+    if (num_idle_threads_cv_.get())
+      num_idle_threads_cv_->Signal();
     if (pending_tasks_.empty()) {
-      // We waited for work, but there's still no work.  Return an empty task to
-      // signal the thread to terminate.
-      return PendingTask(FROM_HERE, Closure());
+      // We waited for work, but there's still no work.  Return NULL to signal
+      // the thread to terminate.
+      return PendingTask(FROM_HERE, base::Closure());
     }
   }
 
@@ -205,72 +190,4 @@
   return pending_task;
 }
 
-void PosixDynamicThreadPool::NotifyWorkerIsGoingAway(
-    PlatformThreadHandle worker) {
-  AutoLock locked(lock_);
-  if (terminated_)
-    return;
-
-  auto new_end = std::remove_if(worker_threads_.begin(), worker_threads_.end(),
-                                [worker](PlatformThreadHandle handle) {
-                                  return handle.is_equal(worker);
-                                });
-  DCHECK_EQ(1, worker_threads_.end() - new_end);
-  worker_threads_.erase(new_end, worker_threads_.end());
-
-  threads_to_cleanup_.push_back(worker);
-
-  if (num_threads_cv_)
-    num_threads_cv_->Broadcast();
-
-  if (!has_pending_cleanup_task_) {
-    has_pending_cleanup_task_ = true;
-    PendingTask pending_task(
-        FROM_HERE,
-        base::Bind(&PosixDynamicThreadPool::CleanUpThreads, Unretained(this)));
-    AddTaskNoLock(&pending_task);
-  }
-}
-
-void PosixDynamicThreadPool::AddTaskNoLock(PendingTask* pending_task) {
-  lock_.AssertAcquired();
-
-  if (terminated_) {
-    LOG(WARNING)
-        << "This thread pool is already terminated.  Do not post new tasks.";
-    return;
-  }
-
-  pending_tasks_.push(*pending_task);
-  pending_task->task.Reset();
-
-  // We have enough worker threads.
-  if (num_idle_threads_ >=
-      pending_tasks_.size() - (has_pending_cleanup_task_ ? 1 : 0)) {
-    pending_tasks_available_cv_.Signal();
-  } else {
-    // The new PlatformThread will take ownership of the WorkerThread object,
-    // which will delete itself on exit.
-    WorkerThread* worker = new WorkerThread(name_prefix_, this);
-    PlatformThreadHandle handle;
-    PlatformThread::Create(0, worker, &handle);
-    worker_threads_.push_back(handle);
-
-    if (num_threads_cv_)
-      num_threads_cv_->Broadcast();
-  }
-}
-
-void PosixDynamicThreadPool::CleanUpThreads() {
-  std::vector<PlatformThreadHandle> threads_to_cleanup;
-  {
-    AutoLock locked(lock_);
-    DCHECK(has_pending_cleanup_task_);
-    has_pending_cleanup_task_ = false;
-    threads_to_cleanup.swap(threads_to_cleanup_);
-  }
-  for (const auto& item : threads_to_cleanup)
-    PlatformThread::Join(item);
-}
-
 }  // namespace base
diff --git a/base/threading/worker_pool_posix.h b/base/threading/worker_pool_posix.h
index d3c4a8f..dd0ffb65 100644
--- a/base/threading/worker_pool_posix.h
+++ b/base/threading/worker_pool_posix.h
@@ -5,12 +5,12 @@
 // The thread pool used in the POSIX implementation of WorkerPool dynamically
 // adds threads as necessary to handle all tasks.  It keeps old threads around
 // for a period of time to allow them to be reused.  After this waiting period,
-// the threads exit.  Unless blocking termination is requested, worker threads
-// are not joined during process shutdown.  This means that potentially long
-// running tasks (such as DNS lookup) do not block process shutdown, but also
-// means that process shutdown may "leak" objects.  Note that although
-// PosixDynamicThreadPool spawns the worker threads and manages the task queue,
-// it does not own the worker threads.  The worker threads ask the
+// the threads exit.  This thread pool uses non-joinable threads, therefore
+// worker threads are not joined during process shutdown.  This means that
+// potentially long running tasks (such as DNS lookup) do not block process
+// shutdown, but also means that process shutdown may "leak" objects.  Note that
+// although PosixDynamicThreadPool spawns the worker threads and manages the
+// task queue, it does not own the worker threads.  The worker threads ask the
 // PosixDynamicThreadPool for work and eventually clean themselves up.  The
 // worker threads all maintain scoped_refptrs to the PosixDynamicThreadPool
 // instance, which prevents PosixDynamicThreadPool from disappearing before all
@@ -26,7 +26,6 @@
 
 #include <queue>
 #include <string>
-#include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback_forward.h"
@@ -37,7 +36,6 @@
 #include "base/synchronization/condition_variable.h"
 #include "base/synchronization/lock.h"
 #include "base/threading/platform_thread.h"
-#include "base/time/time.h"
 #include "base/tracked_objects.h"
 
 class Task;
@@ -50,44 +48,34 @@
   class PosixDynamicThreadPoolPeer;
 
   // All worker threads will share the same |name_prefix|.  They will exit after
-  // |idle_time_before_exit|.
+  // |idle_seconds_before_exit|.
   PosixDynamicThreadPool(const std::string& name_prefix,
-                         TimeDelta idle_time_before_exit);
+                         int idle_seconds_before_exit);
 
   // Indicates that the thread pool is going away.  Stops handing out tasks to
-  // worker threads.  Wakes up all the idle threads to let them exit.  If
-  // |blocking| is set to true, the call returns after all worker threads have
-  // quit.
-  // The second and subsequent calls to this method are ignored, regardless of
-  // the value of |blocking|.
-  void Terminate(bool blocking);
+  // worker threads.  Wakes up all the idle threads to let them exit.
+  void Terminate();
 
   // Adds |task| to the thread pool.
   void PostTask(const tracked_objects::Location& from_here,
                 const Closure& task);
 
-  // Worker thread method to wait for up to |idle_time_before_exit| for more
-  // work from the thread pool.  Returns an empty task if no work is available.
+  // Worker thread method to wait for up to |idle_seconds_before_exit| for more
+  // work from the thread pool.  Returns NULL if no work is available.
   PendingTask WaitForTask();
 
-  // Marks |worker| as dead and enqueues a cleanup task to join dead worker
-  // threads. Unlike tasks enqueued by PostTask(), cleanup tasks never cause new
-  // worker threads to be created.
-  void NotifyWorkerIsGoingAway(PlatformThreadHandle worker);
-
  private:
   friend class RefCountedThreadSafe<PosixDynamicThreadPool>;
+  friend class PosixDynamicThreadPoolPeer;
 
   ~PosixDynamicThreadPool();
 
   // Adds pending_task to the thread pool.  This function will clear
   // |pending_task->task|.
-  void AddTaskNoLock(PendingTask* pending_task);
-
-  void CleanUpThreads();
+  void AddTask(PendingTask* pending_task);
 
   const std::string name_prefix_;
-  const TimeDelta idle_time_before_exit_;
+  const int idle_seconds_before_exit_;
 
   Lock lock_;  // Protects all the variables below.
 
@@ -95,20 +83,12 @@
   // Also used for Broadcast()'ing to worker threads to let them know the pool
   // is being deleted and they can exit.
   ConditionVariable pending_tasks_available_cv_;
-  size_t num_idle_threads_;
-  bool has_pending_cleanup_task_;
-  std::queue<PendingTask> pending_tasks_;
+  int num_idle_threads_;
+  TaskQueue pending_tasks_;
   bool terminated_;
-
-  std::vector<PlatformThreadHandle> threads_to_cleanup_;
-  std::vector<PlatformThreadHandle> worker_threads_;
-
-  // Signaled when idle thread count or living thread count is changed. Please
-  // note that it won't be signaled when Terminate() is called.
-  //
-  // Only used for tests to ensure correct thread ordering. It will always be
+  // Only used for tests to ensure correct thread ordering.  It will always be
   // NULL in non-test code.
-  scoped_ptr<ConditionVariable> num_threads_cv_;
+  scoped_ptr<ConditionVariable> num_idle_threads_cv_;
 
   DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPool);
 };
diff --git a/base/threading/worker_pool_posix_unittest.cc b/base/threading/worker_pool_posix_unittest.cc
index 8d2368f..364f07d 100644
--- a/base/threading/worker_pool_posix_unittest.cc
+++ b/base/threading/worker_pool_posix_unittest.cc
@@ -12,7 +12,6 @@
 #include "base/synchronization/lock.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/platform_thread.h"
-#include "base/time/time.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace base {
@@ -27,17 +26,15 @@
   ConditionVariable* pending_tasks_available_cv() {
     return &pool_->pending_tasks_available_cv_;
   }
-  size_t num_pending_tasks() const { return pool_->pending_tasks_.size(); }
-  size_t num_idle_threads() const { return pool_->num_idle_threads_; }
-  ConditionVariable* num_threads_cv() { return pool_->num_threads_cv_.get(); }
-  void set_num_threads_cv(ConditionVariable* cv) {
-    pool_->num_threads_cv_.reset(cv);
+  const std::queue<PendingTask>& pending_tasks() const {
+    return pool_->pending_tasks_;
   }
-  const std::vector<PlatformThreadHandle>& threads_to_cleanup() const {
-    return pool_->threads_to_cleanup_;
+  int num_idle_threads() const { return pool_->num_idle_threads_; }
+  ConditionVariable* num_idle_threads_cv() {
+    return pool_->num_idle_threads_cv_.get();
   }
-  const std::vector<PlatformThreadHandle>& worker_threads() const {
-    return pool_->worker_threads_;
+  void set_num_idle_threads_cv(ConditionVariable* cv) {
+    pool_->num_idle_threads_cv_.reset(cv);
   }
 
  private:
@@ -48,8 +45,6 @@
 
 namespace {
 
-const int64 kDefaultIdleSecondsBeforeExit = 60 * 60;
-
 // IncrementingTask's main purpose is to increment a counter.  It also updates a
 // set of unique thread ids, and signals a ConditionVariable on completion.
 // Note that since it does not block, there is no way to control the number of
@@ -61,10 +56,10 @@
                       Lock* unique_threads_lock,
                       std::set<PlatformThreadId>* unique_threads) {
   {
-    AutoLock locked(*unique_threads_lock);
+    base::AutoLock locked(*unique_threads_lock);
     unique_threads->insert(PlatformThread::CurrentId());
   }
-  AutoLock locked(*counter_lock);
+  base::AutoLock locked(*counter_lock);
   (*counter)++;
 }
 
@@ -78,12 +73,12 @@
   Lock* num_waiting_to_start_lock;
   int* num_waiting_to_start;
   ConditionVariable* num_waiting_to_start_cv;
-  WaitableEvent* start;
+  base::WaitableEvent* start;
 };
 
 void BlockingIncrementingTask(const BlockingIncrementingTaskArgs& args) {
   {
-    AutoLock num_waiting_to_start_locked(*args.num_waiting_to_start_lock);
+    base::AutoLock num_waiting_to_start_locked(*args.num_waiting_to_start_lock);
     (*args.num_waiting_to_start)++;
   }
   args.num_waiting_to_start_cv->Signal();
@@ -95,62 +90,53 @@
 class PosixDynamicThreadPoolTest : public testing::Test {
  protected:
   PosixDynamicThreadPoolTest()
-      : counter_(0),
+      : pool_(new base::PosixDynamicThreadPool("dynamic_pool", 60 * 60)),
+        peer_(pool_.get()),
+        counter_(0),
         num_waiting_to_start_(0),
         num_waiting_to_start_cv_(&num_waiting_to_start_lock_),
         start_(true, false) {}
 
+  void SetUp() override {
+    peer_.set_num_idle_threads_cv(new ConditionVariable(peer_.lock()));
+  }
+
   void TearDown() override {
     // Wake up the idle threads so they can terminate.
     if (pool_.get())
-      pool_->Terminate(false);
-  }
-
-  void Initialize(TimeDelta idle_time_before_exit) {
-    pool_ = new PosixDynamicThreadPool("dynamic_pool", idle_time_before_exit);
-    peer_.reset(
-        new PosixDynamicThreadPool::PosixDynamicThreadPoolPeer(pool_.get()));
-    peer_->set_num_threads_cv(new ConditionVariable(peer_->lock()));
+      pool_->Terminate();
   }
 
   void WaitForTasksToStart(int num_tasks) {
-    AutoLock num_waiting_to_start_locked(num_waiting_to_start_lock_);
+    base::AutoLock num_waiting_to_start_locked(num_waiting_to_start_lock_);
     while (num_waiting_to_start_ < num_tasks) {
       num_waiting_to_start_cv_.Wait();
     }
   }
 
-  void WaitForIdleThreads(size_t num_idle_threads) {
-    AutoLock pool_locked(*peer_->lock());
-    while (peer_->num_idle_threads() != num_idle_threads) {
-      peer_->num_threads_cv()->Wait();
+  void WaitForIdleThreads(int num_idle_threads) {
+    base::AutoLock pool_locked(*peer_.lock());
+    while (peer_.num_idle_threads() < num_idle_threads) {
+      peer_.num_idle_threads_cv()->Wait();
     }
   }
 
-  void WaitForLivingThreads(int num_living_threads) {
-    AutoLock pool_locked(*peer_->lock());
-    while (static_cast<int>(peer_->worker_threads().size()) !=
-           num_living_threads) {
-      peer_->num_threads_cv()->Wait();
-    }
+  base::Closure CreateNewIncrementingTaskCallback() {
+    return base::Bind(&IncrementingTask, &counter_lock_, &counter_,
+                      &unique_threads_lock_, &unique_threads_);
   }
 
-  Closure CreateNewIncrementingTaskCallback() {
-    return Bind(&IncrementingTask, &counter_lock_, &counter_,
-                &unique_threads_lock_, &unique_threads_);
-  }
-
-  Closure CreateNewBlockingIncrementingTaskCallback() {
+  base::Closure CreateNewBlockingIncrementingTaskCallback() {
     BlockingIncrementingTaskArgs args = {
         &counter_lock_, &counter_, &unique_threads_lock_, &unique_threads_,
         &num_waiting_to_start_lock_, &num_waiting_to_start_,
         &num_waiting_to_start_cv_, &start_
     };
-    return Bind(&BlockingIncrementingTask, args);
+    return base::Bind(&BlockingIncrementingTask, args);
   }
 
-  scoped_refptr<PosixDynamicThreadPool> pool_;
-  scoped_ptr<PosixDynamicThreadPool::PosixDynamicThreadPoolPeer> peer_;
+  scoped_refptr<base::PosixDynamicThreadPool> pool_;
+  base::PosixDynamicThreadPool::PosixDynamicThreadPoolPeer peer_;
   Lock counter_lock_;
   int counter_;
   Lock unique_threads_lock_;
@@ -158,17 +144,15 @@
   Lock num_waiting_to_start_lock_;
   int num_waiting_to_start_;
   ConditionVariable num_waiting_to_start_cv_;
-  WaitableEvent start_;
+  base::WaitableEvent start_;
 };
 
 }  // namespace
 
 TEST_F(PosixDynamicThreadPoolTest, Basic) {
-  Initialize(TimeDelta::FromSeconds(kDefaultIdleSecondsBeforeExit));
-
-  EXPECT_EQ(0U, peer_->num_idle_threads());
+  EXPECT_EQ(0, peer_.num_idle_threads());
   EXPECT_EQ(0U, unique_threads_.size());
-  EXPECT_EQ(0U, peer_->num_pending_tasks());
+  EXPECT_EQ(0U, peer_.pending_tasks().size());
 
   // Add one task and wait for it to be completed.
   pool_->PostTask(FROM_HERE, CreateNewIncrementingTaskCallback());
@@ -181,8 +165,6 @@
 }
 
 TEST_F(PosixDynamicThreadPoolTest, ReuseIdle) {
-  Initialize(TimeDelta::FromSeconds(kDefaultIdleSecondsBeforeExit));
-
   // Add one task and wait for it to be completed.
   pool_->PostTask(FROM_HERE, CreateNewIncrementingTaskCallback());
 
@@ -197,13 +179,11 @@
   WaitForIdleThreads(2);
 
   EXPECT_EQ(2U, unique_threads_.size());
-  EXPECT_EQ(2U, peer_->num_idle_threads());
+  EXPECT_EQ(2, peer_.num_idle_threads());
   EXPECT_EQ(3, counter_);
 }
 
 TEST_F(PosixDynamicThreadPoolTest, TwoActiveTasks) {
-  Initialize(TimeDelta::FromSeconds(kDefaultIdleSecondsBeforeExit));
-
   // Add two blocking tasks.
   pool_->PostTask(FROM_HERE, CreateNewBlockingIncrementingTaskCallback());
   pool_->PostTask(FROM_HERE, CreateNewBlockingIncrementingTaskCallback());
@@ -215,14 +195,12 @@
   WaitForIdleThreads(2);
 
   EXPECT_EQ(2U, unique_threads_.size());
-  EXPECT_EQ(2U, peer_->num_idle_threads()) << "Existing threads are now idle.";
+  EXPECT_EQ(2, peer_.num_idle_threads()) << "Existing threads are now idle.";
   EXPECT_EQ(2, counter_);
 }
 
 TEST_F(PosixDynamicThreadPoolTest, Complex) {
-  Initialize(TimeDelta::FromSeconds(kDefaultIdleSecondsBeforeExit));
-
-  // Add one non blocking tasks and wait for it to finish.
+  // Add two non blocking tasks and wait for them to finish.
   pool_->PostTask(FROM_HERE, CreateNewIncrementingTaskCallback());
 
   WaitForIdleThreads(1);
@@ -237,15 +215,15 @@
   WaitForIdleThreads(2);
 
   EXPECT_EQ(3, counter_);
-  EXPECT_EQ(2U, peer_->num_idle_threads());
+  EXPECT_EQ(2, peer_.num_idle_threads());
   EXPECT_EQ(2U, unique_threads_.size());
 
   // Wake up all idle threads so they can exit.
   {
-    AutoLock locked(*peer_->lock());
-    while (peer_->worker_threads().size() > 0) {
-      peer_->pending_tasks_available_cv()->Signal();
-      peer_->num_threads_cv()->Wait();
+    base::AutoLock locked(*peer_.lock());
+    while (peer_.num_idle_threads() > 0) {
+      peer_.pending_tasks_available_cv()->Signal();
+      peer_.num_idle_threads_cv()->Wait();
     }
   }
 
@@ -269,77 +247,8 @@
   // be either 2 or 3 unique thread IDs in the set at this stage in the test.
   EXPECT_TRUE(unique_threads_.size() >= 2 && unique_threads_.size() <= 3)
       << "unique_threads_.size() = " << unique_threads_.size();
-  EXPECT_EQ(1U, peer_->num_idle_threads());
+  EXPECT_EQ(1, peer_.num_idle_threads());
   EXPECT_EQ(4, counter_);
 }
 
-TEST_F(PosixDynamicThreadPoolTest, NoNewThreadForCleanup) {
-  // Let worker threads quit quickly after they are idle.
-  Initialize(TimeDelta::FromMilliseconds(1));
-
-  for (size_t i = 0; i < 2; ++i) {
-    // This will create a worker thread.
-    pool_->PostTask(FROM_HERE, CreateNewBlockingIncrementingTaskCallback());
-
-    WaitForTasksToStart(1);
-
-    PlatformThreadHandle worker;
-    {
-      AutoLock locked(*peer_->lock());
-      ASSERT_EQ(1u, peer_->worker_threads().size());
-      worker = peer_->worker_threads()[0];
-    }
-
-    start_.Signal();
-
-    // Wait for the worker thread to quit.
-    WaitForLivingThreads(0);
-
-    {
-      AutoLock locked(*peer_->lock());
-      // The thread that just quit is recorded for cleanup. But we don't create
-      // a worker thread just for doing that.
-      ASSERT_EQ(1u, peer_->threads_to_cleanup().size());
-      EXPECT_TRUE(worker.is_equal(peer_->threads_to_cleanup()[0]));
-      EXPECT_TRUE(peer_->worker_threads().empty());
-    }
-  }
-
-  pool_->Terminate(true);
-
-  {
-    AutoLock locked(*peer_->lock());
-    EXPECT_TRUE(peer_->threads_to_cleanup().empty());
-    EXPECT_TRUE(peer_->worker_threads().empty());
-  }
-}
-
-TEST_F(PosixDynamicThreadPoolTest, BlockingTerminate) {
-  // Let worker threads quit quickly after they are idle.
-  Initialize(TimeDelta::FromMilliseconds(3));
-
-  for (size_t i = 0; i < 5; ++i) {
-    PlatformThread::Sleep(TimeDelta::FromMilliseconds(i));
-    for (size_t j = 0; j < 50; ++j)
-      pool_->PostTask(FROM_HERE, CreateNewIncrementingTaskCallback());
-  }
-
-  pool_->Terminate(true);
-
-  {
-    AutoLock locked(*peer_->lock());
-    EXPECT_TRUE(peer_->threads_to_cleanup().empty());
-    EXPECT_TRUE(peer_->worker_threads().empty());
-  }
-
-  int counter = counter_;
-  EXPECT_GE(5 * 50, counter);
-  EXPECT_GE(5 * 50u, unique_threads_.size());
-
-  // Make sure that no threads are still running and trying to modify
-  // |counter_|.
-  PlatformThread::Sleep(TimeDelta::FromMilliseconds(10));
-  EXPECT_EQ(counter, counter_);
-}
-
 }  // namespace base
diff --git a/base/threading/worker_pool_win.cc b/base/threading/worker_pool_win.cc
index 563702b..1b0ade5 100644
--- a/base/threading/worker_pool_win.cc
+++ b/base/threading/worker_pool_win.cc
@@ -70,10 +70,4 @@
   return g_worker_pool_running_on_this_thread.Get().Get();
 }
 
-// static
-void WorkerPool::ShutDownCleanly() {
-  // TODO(yzshen): implement it.
-  NOTIMPLEMENTED();
-}
-
 }  // namespace base
diff --git a/base/trace_event/trace_event_argument.cc b/base/trace_event/trace_event_argument.cc
index 81b6ce03..e370fcb2 100644
--- a/base/trace_event/trace_event_argument.cc
+++ b/base/trace_event/trace_event_argument.cc
@@ -42,7 +42,7 @@
   pickle.WriteUInt64(static_cast<uint64>(reinterpret_cast<uintptr_t>(ptr)));
 }
 
-inline void WriteKeyNameAsStdString(Pickle& pickle, const std::string& str) {
+inline void WriteKeyNameWithCopy(Pickle& pickle, base::StringPiece str) {
   pickle.WriteBytes(&kTypeString, 1);
   pickle.WriteString(str);
 }
@@ -85,11 +85,11 @@
   WriteKeyNameAsRawPtr(pickle_, name);
 }
 
-void TracedValue::SetIntegerWithCopiedName(const std::string& name, int value) {
+void TracedValue::SetIntegerWithCopiedName(base::StringPiece name, int value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   pickle_.WriteBytes(&kTypeInt, 1);
   pickle_.WriteInt(value);
-  WriteKeyNameAsStdString(pickle_, name);
+  WriteKeyNameWithCopy(pickle_, name);
 }
 
 void TracedValue::SetDouble(const char* name, double value) {
@@ -99,12 +99,12 @@
   WriteKeyNameAsRawPtr(pickle_, name);
 }
 
-void TracedValue::SetDoubleWithCopiedName(const std::string& name,
+void TracedValue::SetDoubleWithCopiedName(base::StringPiece name,
                                           double value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   pickle_.WriteBytes(&kTypeDouble, 1);
   pickle_.WriteDouble(value);
-  WriteKeyNameAsStdString(pickle_, name);
+  WriteKeyNameWithCopy(pickle_, name);
 }
 
 void TracedValue::SetBoolean(const char* name, bool value) {
@@ -114,27 +114,27 @@
   WriteKeyNameAsRawPtr(pickle_, name);
 }
 
-void TracedValue::SetBooleanWithCopiedName(const std::string& name,
+void TracedValue::SetBooleanWithCopiedName(base::StringPiece name,
                                            bool value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   pickle_.WriteBytes(&kTypeBool, 1);
   pickle_.WriteBool(value);
-  WriteKeyNameAsStdString(pickle_, name);
+  WriteKeyNameWithCopy(pickle_, name);
 }
 
-void TracedValue::SetString(const char* name, const std::string& value) {
+void TracedValue::SetString(const char* name, base::StringPiece value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   pickle_.WriteBytes(&kTypeString, 1);
   pickle_.WriteString(value);
   WriteKeyNameAsRawPtr(pickle_, name);
 }
 
-void TracedValue::SetStringWithCopiedName(const std::string& name,
-                                          const std::string& value) {
+void TracedValue::SetStringWithCopiedName(base::StringPiece name,
+                                          base::StringPiece value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   pickle_.WriteBytes(&kTypeString, 1);
   pickle_.WriteString(value);
-  WriteKeyNameAsStdString(pickle_, name);
+  WriteKeyNameWithCopy(pickle_, name);
 }
 
 void TracedValue::SetValue(const char* name, const TracedValue& value) {
@@ -145,7 +145,7 @@
   EndDictionary();
 }
 
-void TracedValue::SetValueWithCopiedName(const std::string& name,
+void TracedValue::SetValueWithCopiedName(base::StringPiece name,
                                          const TracedValue& value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   BeginDictionaryWithCopiedName(name);
@@ -161,11 +161,11 @@
   WriteKeyNameAsRawPtr(pickle_, name);
 }
 
-void TracedValue::BeginDictionaryWithCopiedName(const std::string& name) {
+void TracedValue::BeginDictionaryWithCopiedName(base::StringPiece name) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   DEBUG_PUSH_CONTAINER(kStackTypeDict);
   pickle_.WriteBytes(&kTypeStartDict, 1);
-  WriteKeyNameAsStdString(pickle_, name);
+  WriteKeyNameWithCopy(pickle_, name);
 }
 
 void TracedValue::BeginArray(const char* name) {
@@ -175,11 +175,11 @@
   WriteKeyNameAsRawPtr(pickle_, name);
 }
 
-void TracedValue::BeginArrayWithCopiedName(const std::string& name) {
+void TracedValue::BeginArrayWithCopiedName(base::StringPiece name) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   DEBUG_PUSH_CONTAINER(kStackTypeArray);
   pickle_.WriteBytes(&kTypeStartArray, 1);
-  WriteKeyNameAsStdString(pickle_, name);
+  WriteKeyNameWithCopy(pickle_, name);
 }
 
 void TracedValue::EndDictionary() {
@@ -206,7 +206,7 @@
   pickle_.WriteBool(value);
 }
 
-void TracedValue::AppendString(const std::string& value) {
+void TracedValue::AppendString(base::StringPiece value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeArray);
   pickle_.WriteBytes(&kTypeString, 1);
   pickle_.WriteString(value);
@@ -234,7 +234,7 @@
   SetBaseValueWithCopiedName(name, *value);
 }
 
-void TracedValue::SetBaseValueWithCopiedName(const std::string& name,
+void TracedValue::SetBaseValueWithCopiedName(base::StringPiece name,
                                              const base::Value& value) {
   DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
   switch (value.GetType()) {
diff --git a/base/trace_event/trace_event_argument.h b/base/trace_event/trace_event_argument.h
index 55d5ca33..dbdd67f 100644
--- a/base/trace_event/trace_event_argument.h
+++ b/base/trace_event/trace_event_argument.h
@@ -10,6 +10,7 @@
 
 #include "base/memory/scoped_ptr.h"
 #include "base/pickle.h"
+#include "base/strings/string_piece.h"
 #include "base/trace_event/trace_event_impl.h"
 
 namespace base {
@@ -30,26 +31,26 @@
   void SetInteger(const char* name, int value);
   void SetDouble(const char* name, double value);
   void SetBoolean(const char* name, bool value);
-  void SetString(const char* name, const std::string& value);
+  void SetString(const char* name, base::StringPiece value);
   void SetValue(const char* name, const TracedValue& value);
   void BeginDictionary(const char* name);
   void BeginArray(const char* name);
 
   // These, instead, can be safely passed a temporary string.
-  void SetIntegerWithCopiedName(const std::string& name, int value);
-  void SetDoubleWithCopiedName(const std::string& name, double value);
-  void SetBooleanWithCopiedName(const std::string& name, bool value);
-  void SetStringWithCopiedName(const std::string& name,
-                               const std::string& value);
-  void SetValueWithCopiedName(const std::string& name,
+  void SetIntegerWithCopiedName(base::StringPiece name, int value);
+  void SetDoubleWithCopiedName(base::StringPiece name, double value);
+  void SetBooleanWithCopiedName(base::StringPiece name, bool value);
+  void SetStringWithCopiedName(base::StringPiece name,
+                               base::StringPiece value);
+  void SetValueWithCopiedName(base::StringPiece name,
                               const TracedValue& value);
-  void BeginDictionaryWithCopiedName(const std::string& name);
-  void BeginArrayWithCopiedName(const std::string& name);
+  void BeginDictionaryWithCopiedName(base::StringPiece name);
+  void BeginArrayWithCopiedName(base::StringPiece name);
 
   void AppendInteger(int);
   void AppendDouble(double);
   void AppendBoolean(bool);
-  void AppendString(const std::string&);
+  void AppendString(base::StringPiece);
   void BeginArray();
   void BeginDictionary();
 
@@ -63,7 +64,7 @@
   // TODO(primiano): migrate the (three) existing clients to the cheaper
   // SetValue(TracedValue) API. crbug.com/495628.
   void SetValue(const char* name, scoped_ptr<base::Value> value);
-  void SetBaseValueWithCopiedName(const std::string& name,
+  void SetBaseValueWithCopiedName(base::StringPiece name,
                                   const base::Value& value);
   void AppendBaseValue(const base::Value& value);
 
diff --git a/blimp/client/compositor/blimp_output_surface.cc b/blimp/client/compositor/blimp_output_surface.cc
index dd4b89a..7c2836e 100644
--- a/blimp/client/compositor/blimp_output_surface.cc
+++ b/blimp/client/compositor/blimp_output_surface.cc
@@ -14,7 +14,6 @@
 BlimpOutputSurface::BlimpOutputSurface(
     const scoped_refptr<cc::ContextProvider>& context_provider)
     : cc::OutputSurface(context_provider) {
-  capabilities_.max_frames_pending = 2;
 }
 
 BlimpOutputSurface::~BlimpOutputSurface() {}
diff --git a/build/android/emma_instr_action.gypi b/build/android/emma_instr_action.gypi
index 5d22c26..0505eab 100644
--- a/build/android/emma_instr_action.gypi
+++ b/build/android/emma_instr_action.gypi
@@ -11,14 +11,14 @@
     'output_path%': '',
     'stamp_path%': '',
     'extra_instr_args': [
-      '--coverage-file=<(_target_name).em',
-      '--sources-file=<(_target_name)_sources.txt',
+      '--coverage-file=<(coverage_file)',
+      '--sources-list-file=<(sources_list_file)',
     ],
     'emma_jar': '<(android_sdk_root)/tools/lib/emma.jar',
     'conditions': [
       ['emma_instrument != 0', {
         'extra_instr_args': [
-          '--sources=<(java_in_dir)/src >(additional_src_dirs) >(generated_src_dirs)',
+          '--source-dirs=<(java_in_dir)/src >(additional_src_dirs) >(generated_src_dirs)',
           '--src-root=<(DEPTH)',
           '--emma-jar=<(emma_jar)',
           '--filter-string=<(emma_filter)',
diff --git a/build/android/gyp/emma_instr.py b/build/android/gyp/emma_instr.py
index b6fd2b4..c6ef618 100755
--- a/build/android/gyp/emma_instr.py
+++ b/build/android/gyp/emma_instr.py
@@ -32,6 +32,7 @@
 
 def _AddCommonOptions(option_parser):
   """Adds common options to |option_parser|."""
+  build_utils.AddDepfileOption(option_parser)
   option_parser.add_option('--input-path',
                            help=('Path to input file(s). Either the classes '
                                  'directory, or the path to a jar.'))
@@ -42,15 +43,21 @@
   option_parser.add_option('--stamp', help='Path to touch when done.')
   option_parser.add_option('--coverage-file',
                            help='File to create with coverage metadata.')
-  option_parser.add_option('--sources-file',
+  option_parser.add_option('--sources-list-file',
                            help='File to create with the list of sources.')
 
 
 def _AddInstrumentOptions(option_parser):
   """Adds options related to instrumentation to |option_parser|."""
   _AddCommonOptions(option_parser)
-  option_parser.add_option('--sources',
-                           help='Space separated list of sources.')
+  option_parser.add_option('--source-dirs',
+                           help='Space separated list of source directories. '
+                                'source-files should not be specified if '
+                                'source-dirs is specified')
+  option_parser.add_option('--source-files',
+                           help='Space separated list of source files. '
+                                'source-dirs should not be specified if '
+                                'source-files is specified')
   option_parser.add_option('--src-root',
                            help='Root of the src repository.')
   option_parser.add_option('--emma-jar',
@@ -77,39 +84,52 @@
     An exit code.
   """
   if not (options.input_path and options.output_path and
-          options.coverage_file and options.sources_file):
+          options.coverage_file and options.sources_list_file):
     option_parser.error('All arguments are required.')
 
-  coverage_file = os.path.join(os.path.dirname(options.output_path),
-                               options.coverage_file)
-  sources_file = os.path.join(os.path.dirname(options.output_path),
-                              options.sources_file)
-  if os.path.exists(coverage_file):
-    os.remove(coverage_file)
-  if os.path.exists(sources_file):
-    os.remove(sources_file)
+  if os.path.exists(options.coverage_file):
+    os.remove(options.coverage_file)
+  if os.path.exists(options.sources_list_file):
+    os.remove(options.sources_list_file)
 
   shutil.copy(options.input_path, options.output_path)
 
   if options.stamp:
     build_utils.Touch(options.stamp)
 
+  if options.depfile:
+    build_utils.WriteDepfile(options.depfile,
+                             build_utils.GetPythonDependencies())
 
-def _CreateSourcesFile(sources_string, sources_file, src_root):
-  """Adds all normalized source directories to |sources_file|.
+
+def _GetSourceDirsFromSourceFiles(source_files_string):
+  """Returns list of directories for the files in |source_files_string|.
 
   Args:
-    sources_string: String generated from gyp containing the list of sources.
-    sources_file: File into which to write the JSON list of sources.
+    source_files_string: String generated from GN or GYP containing the list
+      of source files.
+
+  Returns:
+    List of source directories.
+  """
+  source_files = build_utils.ParseGypList(source_files_string)
+  return list(set(os.path.dirname(source_file) for source_file in source_files))
+
+
+def _CreateSourcesListFile(source_dirs, sources_list_file, src_root):
+  """Adds all normalized source directories to |sources_list_file|.
+
+  Args:
+    source_dirs: List of source directories.
+    sources_list_file: File into which to write the JSON list of sources.
     src_root: Root which sources added to the file should be relative to.
 
   Returns:
     An exit code.
   """
   src_root = os.path.abspath(src_root)
-  sources = build_utils.ParseGypList(sources_string)
   relative_sources = []
-  for s in sources:
+  for s in source_dirs:
     abs_source = os.path.abspath(s)
     if abs_source[:len(src_root)] != src_root:
       print ('Error: found source directory not under repository root: %s %s'
@@ -119,7 +139,7 @@
 
     relative_sources.append(rel_source)
 
-  with open(sources_file, 'w') as f:
+  with open(sources_list_file, 'w') as f:
     json.dump(relative_sources, f)
 
 
@@ -137,16 +157,13 @@
     An exit code.
   """
   if not (options.input_path and options.output_path and
-          options.coverage_file and options.sources_file and options.sources and
+          options.coverage_file and options.sources_list_file and
+          (options.source_files or options.source_dirs) and
           options.src_root and options.emma_jar):
     option_parser.error('All arguments are required.')
 
-  coverage_file = os.path.join(os.path.dirname(options.output_path),
-                               options.coverage_file)
-  sources_file = os.path.join(os.path.dirname(options.output_path),
-                              options.sources_file)
-  if os.path.exists(coverage_file):
-    os.remove(coverage_file)
+  if os.path.exists(options.coverage_file):
+    os.remove(options.coverage_file)
   temp_dir = tempfile.mkdtemp()
   try:
     cmd = ['java', '-cp', options.emma_jar,
@@ -154,21 +171,34 @@
            '-ip', options.input_path,
            '-ix', options.filter_string,
            '-d', temp_dir,
-           '-out', coverage_file,
+           '-out', options.coverage_file,
            '-m', 'fullcopy']
     build_utils.CheckOutput(cmd)
 
-    for jar in os.listdir(os.path.join(temp_dir, 'lib')):
-      shutil.copy(os.path.join(temp_dir, 'lib', jar),
-                    options.output_path)
+    temp_jar_dir = os.path.join(temp_dir, 'lib')
+    jars = os.listdir(temp_jar_dir)
+    if len(jars) != 1:
+      print('Error: multiple output files in: %s' % (temp_jar_dir))
+      return 1
+
+    shutil.copy(os.path.join(temp_jar_dir, jars[0]), options.output_path)
   finally:
     shutil.rmtree(temp_dir)
 
-  _CreateSourcesFile(options.sources, sources_file, options.src_root)
+  if options.source_dirs:
+    source_dirs = build_utils.ParseGypList(options.source_dirs)
+  else:
+    source_dirs = _GetSourceDirsFromSourceFiles(options.source_files)
+  _CreateSourcesListFile(source_dirs, options.sources_list_file,
+                         options.src_root)
 
   if options.stamp:
     build_utils.Touch(options.stamp)
 
+  if options.depfile:
+    build_utils.WriteDepfile(options.depfile,
+                             build_utils.GetPythonDependencies())
+
   return 0
 
 
diff --git a/build/java.gypi b/build/java.gypi
index f182e8cf..ab6687f3 100644
--- a/build/java.gypi
+++ b/build/java.gypi
@@ -330,6 +330,8 @@
       'variables': {
         'input_path': '<(jar_path)',
         'output_path': '<(jar_final_path)',
+        'coverage_file': '<(jar_dir)/<(_target_name).em',
+        'sources_list_file': '<(jar_dir)/<(_target_name)_sources.txt',
         'stamp_path': '<(emma_instr_stamp)',
       },
       'outputs': [
diff --git a/build/java_apk.gypi b/build/java_apk.gypi
index 6c5e7bbf..44a25f3 100644
--- a/build/java_apk.gypi
+++ b/build/java_apk.gypi
@@ -972,6 +972,8 @@
       'variables': {
         'input_path': '<(javac_jar_path)',
         'output_path': '<(jar_path)',
+        'coverage_file': '<(PRODUCT_DIR)/lib.java/<(_target_name).em',
+        'sources_list_file': '<(PRODUCT_DIR)/lib.java/<(_target_name)_sources.txt',
         'stamp_path': '<(emma_instr_stamp)',
       },
       'outputs': [
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 8be7afcf..39d3f7a7 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -735,7 +735,6 @@
     "base/region_unittest.cc",
     "base/rolling_time_delta_history_unittest.cc",
     "base/rtree_unittest.cc",
-    "base/scoped_ptr_vector_unittest.cc",
     "base/simple_enclosed_region_unittest.cc",
     "base/tiling_data_unittest.cc",
     "base/unique_notifier_unittest.cc",
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py
index c850618..f044943 100644
--- a/cc/PRESUBMIT.py
+++ b/cc/PRESUBMIT.py
@@ -247,9 +247,7 @@
     contents = input_api.ReadFile(f, 'rb')
     match = re.search(r'namespace\s*cc\s*{', contents)
     if match:
-      whitelist = [
-        r"cc::remove_if\b",
-        ]
+      whitelist = []
       if FindNamespaceInBlock(match.end(), 'cc', contents, whitelist=whitelist):
         errors.append(f.LocalPath())
 
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc
index 0c3801189..86a29efe 100644
--- a/cc/animation/animation_player.cc
+++ b/cc/animation/animation_player.cc
@@ -105,9 +105,10 @@
   DCHECK(element_animations_);
 
   // Pass all accumulated animations to LAC.
-  for (auto it = animations_.begin(); it != animations_.end(); ++it)
+  for (auto& animation : animations_) {
     element_animations_->layer_animation_controller()->AddAnimation(
-        animations_.take(it));
+        std::move(animation));
+  }
   if (!animations_.empty())
     SetNeedsCommit();
   animations_.clear();
@@ -144,8 +145,11 @@
         animation_id);
     SetNeedsCommit();
   } else {
-    auto animations_to_remove = animations_.remove_if([animation_id](
-        Animation* animation) { return animation->id() == animation_id; });
+    auto animations_to_remove =
+        std::remove_if(animations_.begin(), animations_.end(),
+                       [animation_id](const scoped_ptr<Animation>& animation) {
+                         return animation->id() == animation_id;
+                       });
     animations_.erase(animations_to_remove, animations_.end());
   }
 }
diff --git a/cc/animation/animation_player.h b/cc/animation/animation_player.h
index afb819d..3665a2381 100644
--- a/cc/animation/animation_player.h
+++ b/cc/animation/animation_player.h
@@ -5,12 +5,13 @@
 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_
 #define CC_ANIMATION_ANIMATION_PLAYER_H_
 
+#include <vector>
+
 #include "base/containers/linked_list.h"
 #include "base/memory/ref_counted.h"
 #include "base/time/time.h"
 #include "cc/animation/animation.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 
 namespace cc {
 
@@ -94,8 +95,7 @@
   // We accumulate added animations in animations_ container
   // if element_animations_ is a nullptr. It allows us to add/remove animations
   // to non-attached AnimationPlayers.
-  typedef ScopedPtrVector<Animation> AnimationList;
-  AnimationList animations_;
+  std::vector<scoped_ptr<Animation>> animations_;
 
   AnimationHost* animation_host_;
   AnimationTimeline* animation_timeline_;
diff --git a/cc/animation/keyframed_animation_curve.cc b/cc/animation/keyframed_animation_curve.cc
index f8f6021..7e62a4f 100644
--- a/cc/animation/keyframed_animation_curve.cc
+++ b/cc/animation/keyframed_animation_curve.cc
@@ -15,7 +15,7 @@
 
 template <class KeyframeType>
 void InsertKeyframe(scoped_ptr<KeyframeType> keyframe,
-                    ScopedPtrVector<KeyframeType>* keyframes) {
+                    std::vector<scoped_ptr<KeyframeType>>* keyframes) {
   // Usually, the keyframes will be added in order, so this loop would be
   // unnecessary and we should skip it if possible.
   if (!keyframes->empty() && keyframe->Time() < keyframes->back()->Time()) {
@@ -32,7 +32,7 @@
 
 template <typename KeyframeType>
 base::TimeDelta TransformedAnimationTime(
-    const ScopedPtrVector<KeyframeType>& keyframes,
+    const std::vector<scoped_ptr<KeyframeType>>& keyframes,
     const scoped_ptr<TimingFunction>& timing_function,
     base::TimeDelta time) {
   if (timing_function) {
@@ -49,7 +49,7 @@
 }
 
 template <typename KeyframeType>
-size_t GetActiveKeyframe(const ScopedPtrVector<KeyframeType>& keyframes,
+size_t GetActiveKeyframe(const std::vector<scoped_ptr<KeyframeType>>& keyframes,
                          base::TimeDelta time) {
   DCHECK_GE(keyframes.size(), 2ul);
   size_t i = 0;
@@ -63,7 +63,7 @@
 
 template <typename KeyframeType>
 double TransformedKeyframeProgress(
-    const ScopedPtrVector<KeyframeType>& keyframes,
+    const std::vector<scoped_ptr<KeyframeType>>& keyframes,
     base::TimeDelta time,
     size_t i) {
   double progress =
diff --git a/cc/animation/keyframed_animation_curve.h b/cc/animation/keyframed_animation_curve.h
index b5dfb14..ddaaaf7 100644
--- a/cc/animation/keyframed_animation_curve.h
+++ b/cc/animation/keyframed_animation_curve.h
@@ -5,12 +5,13 @@
 #ifndef CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
 
+#include <vector>
+
 #include "base/time/time.h"
 #include "cc/animation/animation_curve.h"
 #include "cc/animation/timing_function.h"
 #include "cc/animation/transform_operations.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 
 namespace cc {
 
@@ -136,7 +137,7 @@
 
   // Always sorted in order of increasing time. No two keyframes have the
   // same time.
-  ScopedPtrVector<ColorKeyframe> keyframes_;
+  std::vector<scoped_ptr<ColorKeyframe>> keyframes_;
   scoped_ptr<TimingFunction> timing_function_;
 
   DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve);
@@ -166,7 +167,7 @@
 
   // Always sorted in order of increasing time. No two keyframes have the
   // same time.
-  ScopedPtrVector<FloatKeyframe> keyframes_;
+  std::vector<scoped_ptr<FloatKeyframe>> keyframes_;
   scoped_ptr<TimingFunction> timing_function_;
 
   DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve);
@@ -206,7 +207,7 @@
 
   // Always sorted in order of increasing time. No two keyframes have the
   // same time.
-  ScopedPtrVector<TransformKeyframe> keyframes_;
+  std::vector<scoped_ptr<TransformKeyframe>> keyframes_;
   scoped_ptr<TimingFunction> timing_function_;
 
   DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve);
@@ -238,7 +239,7 @@
 
   // Always sorted in order of increasing time. No two keyframes have the
   // same time.
-  ScopedPtrVector<FilterKeyframe> keyframes_;
+  std::vector<scoped_ptr<FilterKeyframe>> keyframes_;
   scoped_ptr<TimingFunction> timing_function_;
 
   DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve);
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index d649ac7..9c66fabc 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -14,7 +14,6 @@
 #include "cc/animation/layer_animation_value_observer.h"
 #include "cc/animation/layer_animation_value_provider.h"
 #include "cc/animation/scroll_offset_animation_curve.h"
-#include "cc/base/scoped_ptr_algorithm.h"
 #include "cc/output/filter_operations.h"
 #include "ui/gfx/geometry/box_f.h"
 #include "ui/gfx/transform.h"
@@ -53,16 +52,6 @@
   }
 }
 
-struct HasAnimationId {
-  explicit HasAnimationId(int id) : id_(id) {}
-  bool operator()(Animation* animation) const {
-    return animation->id() == id_;
-  }
-
- private:
-  int id_;
-};
-
 void LayerAnimationController::UpdatePotentiallyAnimatingTransform() {
   bool was_potentially_animating_transform_for_active_observers =
       potentially_animating_transform_for_active_observers_;
@@ -72,7 +61,7 @@
   potentially_animating_transform_for_active_observers_ = false;
   potentially_animating_transform_for_pending_observers_ = false;
 
-  for (Animation* animation : animations_) {
+  for (const auto& animation : animations_) {
     if (!animation->is_finished() &&
         animation->target_property() == Animation::TRANSFORM) {
       potentially_animating_transform_for_active_observers_ |=
@@ -98,8 +87,14 @@
 
 void LayerAnimationController::RemoveAnimation(int animation_id) {
   bool removed_transform_animation = false;
-  auto animations_to_remove =
-      animations_.remove_if(HasAnimationId(animation_id));
+  // Since we want to use the animations that we're going to remove, we need to
+  // use a stable_parition here instead of remove_if. Remove_if leaves the
+  // removed items in an unspecified state.
+  auto animations_to_remove = std::stable_partition(
+      animations_.begin(), animations_.end(),
+      [animation_id](const scoped_ptr<Animation>& animation) {
+        return animation->id() != animation_id;
+      });
   for (auto it = animations_to_remove; it != animations_.end(); ++it) {
     if ((*it)->target_property() == Animation::SCROLL_OFFSET) {
       scroll_offset_animation_was_interrupted_ = true;
@@ -115,25 +110,20 @@
     UpdatePotentiallyAnimatingTransform();
 }
 
-struct HasAnimationIdAndProperty {
-  HasAnimationIdAndProperty(int id, Animation::TargetProperty target_property)
-      : id_(id), target_property_(target_property) {}
-  bool operator()(Animation* animation) const {
-    return animation->id() == id_ &&
-        animation->target_property() == target_property_;
-  }
-
- private:
-  int id_;
-  Animation::TargetProperty target_property_;
-};
-
 void LayerAnimationController::RemoveAnimation(
     int animation_id,
     Animation::TargetProperty target_property) {
   bool removed_transform_animation = false;
-  auto animations_to_remove = animations_.remove_if(
-      HasAnimationIdAndProperty(animation_id, target_property));
+  auto does_not_have_id_or_property = [animation_id, target_property](
+      const scoped_ptr<Animation>& animation) {
+    return animation->id() != animation_id ||
+           animation->target_property() != target_property;
+  };
+  // Since we want to use the animations that we're going to remove, we need to
+  // use a stable_parition here instead of remove_if. Remove_if leaves the
+  // removed items in an unspecified state.
+  auto animations_to_remove = std::stable_partition(
+      animations_.begin(), animations_.end(), does_not_have_id_or_property);
   if (animations_to_remove == animations_.end())
     return;
 
@@ -202,7 +192,7 @@
     return;
 
   for (size_t i = 0; i < animations_.size(); ++i) {
-    Animation* animation = animations_[i];
+    Animation* animation = animations_[i].get();
     if (!animation->is_impl_only())
       continue;
 
@@ -288,13 +278,6 @@
   UpdateActivation(NORMAL_ACTIVATION);
 }
 
-struct AffectsNoObservers {
-  bool operator()(Animation* animation) const {
-    return !animation->affects_active_observers() &&
-           !animation->affects_pending_observers();
-  }
-};
-
 void LayerAnimationController::ActivateAnimations() {
   bool changed_transform_animation = false;
   for (size_t i = 0; i < animations_.size(); ++i) {
@@ -305,10 +288,12 @@
     animations_[i]->set_affects_active_observers(
         animations_[i]->affects_pending_observers());
   }
-  animations_.erase(cc::remove_if(&animations_,
-                                  animations_.begin(),
-                                  animations_.end(),
-                                  AffectsNoObservers()),
+  auto affects_no_observers = [](const scoped_ptr<Animation>& animation) {
+    return !animation->affects_active_observers() &&
+           !animation->affects_pending_observers();
+  };
+  animations_.erase(std::remove_if(animations_.begin(), animations_.end(),
+                                   affects_no_observers),
                     animations_.end());
   scroll_offset_animation_was_interrupted_ = false;
   UpdateActivation(NORMAL_ACTIVATION);
@@ -331,15 +316,15 @@
   for (size_t i = 0; i < animations_.size(); ++i) {
     size_t index = animations_.size() - i - 1;
     if (animations_[index]->target_property() == target_property)
-      return animations_[index];
+      return animations_[index].get();
   }
-  return 0;
+  return nullptr;
 }
 
 Animation* LayerAnimationController::GetAnimationById(int animation_id) const {
   for (size_t i = 0; i < animations_.size(); ++i)
     if (animations_[i]->id() == animation_id)
-      return animations_[i];
+      return animations_[i].get();
   return nullptr;
 }
 
@@ -737,11 +722,6 @@
   }
 }
 
-static bool AffectsActiveOnlyAndIsWaitingForDeletion(Animation* animation) {
-  return animation->run_state() == Animation::WAITING_FOR_DELETION &&
-         !animation->affects_pending_observers();
-}
-
 void LayerAnimationController::RemoveAnimationsCompletedOnMainThread(
     LayerAnimationController* controller_impl) const {
   bool removed_transform_animation = false;
@@ -749,19 +729,23 @@
   // observers, and should stop affecting active observers after the next call
   // to ActivateAnimations. If already WAITING_FOR_DELETION, they can be removed
   // immediately.
-  ScopedPtrVector<Animation>& animations = controller_impl->animations_;
-  for (size_t i = 0; i < animations.size(); ++i) {
-    if (IsCompleted(animations[i], this)) {
-      animations[i]->set_affects_pending_observers(false);
-      if (animations[i]->target_property() == Animation::TRANSFORM)
+  auto& animations = controller_impl->animations_;
+  for (const auto& animation : animations) {
+    if (IsCompleted(animation.get(), this)) {
+      animation->set_affects_pending_observers(false);
+      if (animation->target_property() == Animation::TRANSFORM)
         removed_transform_animation = true;
     }
   }
-  animations.erase(cc::remove_if(&animations,
-                                 animations.begin(),
-                                 animations.end(),
-                                 AffectsActiveOnlyAndIsWaitingForDeletion),
-                   animations.end());
+  auto affects_active_only_and_is_waiting_for_deletion = [](
+      const scoped_ptr<Animation>& animation) {
+    return animation->run_state() == Animation::WAITING_FOR_DELETION &&
+           !animation->affects_pending_observers();
+  };
+  animations.erase(
+      std::remove_if(animations.begin(), animations.end(),
+                     affects_active_only_and_is_waiting_for_deletion),
+      animations.end());
 
   if (removed_transform_animation)
     controller_impl->UpdatePotentiallyAnimatingTransform();
@@ -810,7 +794,8 @@
       // Collect all properties for animations with the same group id (they
       // should all also be in the list of animations).
     size_t animation_index = animations_waiting_for_target[i];
-    Animation* animation_waiting_for_target = animations_[animation_index];
+    Animation* animation_waiting_for_target =
+        animations_[animation_index].get();
     // Check for the run state again even though the animation was waiting
     // for target because it might have changed the run state while handling
     // previous animation in this loop (if they belong to same group).
@@ -1009,15 +994,12 @@
     NotifyObserversAnimationWaitingForDeletion();
 }
 
-static bool IsWaitingForDeletion(Animation* animation) {
-  return animation->run_state() == Animation::WAITING_FOR_DELETION;
-}
-
 void LayerAnimationController::PurgeAnimationsMarkedForDeletion() {
-  animations_.erase(cc::remove_if(&animations_,
-                                  animations_.begin(),
-                                  animations_.end(),
-                                  IsWaitingForDeletion),
+  animations_.erase(std::remove_if(animations_.begin(), animations_.end(),
+                                   [](const scoped_ptr<Animation>& animation) {
+                                     return animation->run_state() ==
+                                            Animation::WAITING_FOR_DELETION;
+                                   }),
                     animations_.end());
 }
 
diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h
index 307e8992..60b70a3 100644
--- a/cc/animation/layer_animation_controller.h
+++ b/cc/animation/layer_animation_controller.h
@@ -5,6 +5,8 @@
 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
 
+#include <vector>
+
 #include "base/basictypes.h"
 #include "base/containers/hash_tables.h"
 #include "base/memory/ref_counted.h"
@@ -14,7 +16,6 @@
 #include "cc/animation/animation_events.h"
 #include "cc/animation/layer_animation_event_observer.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "ui/gfx/geometry/scroll_offset.h"
 #include "ui/gfx/transform.h"
 
@@ -224,7 +225,7 @@
 
   AnimationRegistrar* registrar_;
   int id_;
-  ScopedPtrVector<Animation> animations_;
+  std::vector<scoped_ptr<Animation>> animations_;
 
   // This is used to ensure that we don't spam the registrar.
   bool is_active_;
diff --git a/cc/base/BUILD.gn b/cc/base/BUILD.gn
index 6898aa1f..44a917b 100644
--- a/cc/base/BUILD.gn
+++ b/cc/base/BUILD.gn
@@ -27,8 +27,6 @@
     "rolling_time_delta_history.h",
     "rtree.cc",
     "rtree.h",
-    "scoped_ptr_algorithm.h",
-    "scoped_ptr_vector.h",
     "simple_enclosed_region.cc",
     "simple_enclosed_region.h",
     "switches.cc",
diff --git a/cc/base/list_container_helper.cc b/cc/base/list_container_helper.cc
index 65be43a..3bfc4b2 100644
--- a/cc/base/list_container_helper.cc
+++ b/cc/base/list_container_helper.cc
@@ -7,7 +7,7 @@
 #include <algorithm>
 #include <vector>
 
-#include "cc/base/scoped_ptr_vector.h"
+#include "base/logging.h"
 
 namespace {
 const size_t kDefaultNumElementTypesToReserve = 32;
@@ -103,19 +103,19 @@
       : element_size_(element_size),
         size_(0),
         last_list_index_(0),
-        last_list_(NULL) {
+        last_list_(nullptr) {
     AllocateNewList(kDefaultNumElementTypesToReserve);
-    last_list_ = storage_[last_list_index_];
+    last_list_ = storage_[last_list_index_].get();
   }
 
   CharAllocator(size_t element_size, size_t element_count)
       : element_size_(element_size),
         size_(0),
         last_list_index_(0),
-        last_list_(NULL) {
+        last_list_(nullptr) {
     AllocateNewList(element_count > 0 ? element_count
                                       : kDefaultNumElementTypesToReserve);
-    last_list_ = storage_[last_list_index_];
+    last_list_ = storage_[last_list_index_].get();
   }
 
   ~CharAllocator() {}
@@ -128,7 +128,7 @@
         AllocateNewList(last_list_->capacity * 2);
 
       ++last_list_index_;
-      last_list_ = storage_[last_list_index_];
+      last_list_ = storage_[last_list_index_].get();
     }
 
     ++size_;
@@ -152,7 +152,7 @@
     DCHECK(!storage_.empty());
     storage_.erase(storage_.begin() + 1, storage_.end());
     last_list_index_ = 0;
-    last_list_ = storage_[0];
+    last_list_ = storage_[0].get();
     last_list_->size = 0;
     size_ = 0;
   }
@@ -162,7 +162,7 @@
     last_list_->RemoveLast();
     if (last_list_->IsEmpty() && last_list_index_ > 0) {
       --last_list_index_;
-      last_list_ = storage_[last_list_index_];
+      last_list_ = storage_[last_list_index_].get();
 
       // If there are now two empty inner lists, free one of them.
       if (last_list_index_ + 2 < storage_.size())
@@ -175,7 +175,7 @@
     DCHECK_EQ(this, position->ptr_to_container);
 
     // Update |position| to point to the element after the erased element.
-    InnerList* list = storage_[position->vector_index];
+    InnerList* list = storage_[position->vector_index].get();
     char* item_iterator = position->item_iterator;
     if (item_iterator == list->LastElement())
       position->Increment();
@@ -208,7 +208,7 @@
 
   InnerList* InnerListById(size_t id) const {
     DCHECK_LT(id, storage_.size());
-    return storage_[id];
+    return storage_[id].get();
   }
 
   size_t FirstInnerListId() const {
@@ -245,7 +245,7 @@
     storage_.push_back(new_list.Pass());
   }
 
-  ScopedPtrVector<InnerList> storage_;
+  std::vector<scoped_ptr<InnerList>> storage_;
   const size_t element_size_;
 
   // The number of elements in the list.
diff --git a/cc/base/scoped_ptr_algorithm.h b/cc/base/scoped_ptr_algorithm.h
deleted file mode 100644
index 79f4eee4..0000000
--- a/cc/base/scoped_ptr_algorithm.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_BASE_SCOPED_PTR_ALGORITHM_H_
-#define CC_BASE_SCOPED_PTR_ALGORITHM_H_
-
-namespace cc {
-
-// ScopedContainers need to implement a swap() method since they do not allow
-// assignment to their iterators.
-template <class ForwardIterator, class Predicate, class ScopedContainer>
-ForwardIterator remove_if(
-    ScopedContainer* container,
-    ForwardIterator first,
-    ForwardIterator last,
-    Predicate predicate) {
-  ForwardIterator result = first;
-  for (; first != last; ++first) {
-    if (!predicate(*first)) {
-      container->swap(first, result);
-      ++result;
-    }
-  }
-  return result;
-}
-
-}  // namespace cc
-
-#endif  // CC_BASE_SCOPED_PTR_ALGORITHM_H_
diff --git a/cc/base/scoped_ptr_vector.h b/cc/base/scoped_ptr_vector.h
deleted file mode 100644
index b552d73..0000000
--- a/cc/base/scoped_ptr_vector.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_BASE_SCOPED_PTR_VECTOR_H_
-#define CC_BASE_SCOPED_PTR_VECTOR_H_
-
-#include <algorithm>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/stl_util.h"
-
-namespace cc {
-
-// This type acts like a vector<scoped_ptr> based on top of std::vector. The
-// ScopedPtrVector has ownership of all elements in the vector.
-template <typename T>
-class ScopedPtrVector {
- public:
-  typedef typename std::vector<T*>::const_iterator const_iterator;
-  typedef typename std::vector<T*>::reverse_iterator reverse_iterator;
-  typedef typename std::vector<T*>::const_reverse_iterator
-      const_reverse_iterator;
-
-#if defined(OS_ANDROID)
-  // On Android the iterator is not a class, so we can't block assignment.
-  typedef typename std::vector<T*>::iterator iterator;
-#else
-  // Ban setting values on the iterator directly. New pointers must be passed
-  // to methods on the ScopedPtrVector class to appear in the vector.
-  class iterator : public std::vector<T*>::iterator {
-   public:
-    iterator(const typename std::vector<T*>::iterator& other) // NOLINT
-        : std::vector<T*>::iterator(other) {}
-    T* const& operator*() { return std::vector<T*>::iterator::operator*(); }
-  };
-#endif
-
-  ScopedPtrVector() {}
-
-  ~ScopedPtrVector() { clear(); }
-
-  size_t size() const {
-    return data_.size();
-  }
-
-  T* at(size_t index) const {
-    DCHECK(index < size());
-    return data_[index];
-  }
-
-  T* operator[](size_t index) const {
-    return at(index);
-  }
-
-  T* front() const {
-    DCHECK(!empty());
-    return at(0);
-  }
-
-  T* back() const {
-    DCHECK(!empty());
-    return at(size() - 1);
-  }
-
-  bool empty() const {
-    return data_.empty();
-  }
-
-  scoped_ptr<T> take(iterator position) {
-    if (position == end())
-      return nullptr;
-    DCHECK(position < end());
-
-    typename std::vector<T*>::iterator writable_position = position;
-    scoped_ptr<T> ret(*writable_position);
-    *writable_position = nullptr;
-    return ret.Pass();
-  }
-
-  scoped_ptr<T> take_back() {
-    DCHECK(!empty());
-    if (empty())
-      return nullptr;
-    return take(end() - 1);
-  }
-
-  void erase(iterator position) {
-    if (position == end())
-      return;
-    typename std::vector<T*>::iterator writable_position = position;
-    delete *writable_position;
-    data_.erase(position);
-  }
-
-  void erase(iterator first, iterator last) {
-    DCHECK(first <= last);
-    for (iterator it = first; it != last; ++it) {
-      DCHECK(it < end());
-
-      typename std::vector<T*>::iterator writable_it = it;
-      delete *writable_it;
-    }
-    data_.erase(first, last);
-  }
-
-  void reserve(size_t size) {
-    data_.reserve(size);
-  }
-
-  void clear() {
-    STLDeleteElements(&data_);
-  }
-
-  void push_back(scoped_ptr<T> item) {
-    data_.push_back(item.release());
-  }
-
-  void pop_back() {
-    delete data_.back();
-    data_.pop_back();
-  }
-
-  void insert(iterator position, scoped_ptr<T> item) {
-    DCHECK(position <= end());
-    data_.insert(position, item.release());
-  }
-
-  void insert_and_take(iterator position, ScopedPtrVector<T>* other) {
-    std::vector<T*> tmp_data;
-    for (ScopedPtrVector<T>::iterator it = other->begin(); it != other->end();
-         ++it) {
-      tmp_data.push_back(other->take(it).release());
-    }
-    data_.insert(position, tmp_data.begin(), tmp_data.end());
-  }
-
-  template <typename Predicate>
-  iterator partition(Predicate predicate) {
-    typename std::vector<T*>::iterator first = begin();
-    typename std::vector<T*>::iterator last = end();
-    return static_cast<iterator>(std::partition(first, last, predicate));
-  }
-
-  void swap(ScopedPtrVector<T>& other) {
-    data_.swap(other.data_);
-  }
-
-  void swap(iterator a, iterator b) {
-    DCHECK(a < end());
-    DCHECK(b < end());
-    if (a == end() || b == end() || a == b)
-      return;
-    typename std::vector<T*>::iterator writable_a = a;
-    typename std::vector<T*>::iterator writable_b = b;
-    std::swap(*writable_a, *writable_b);
-  }
-
-  // This acts like std::remove_if but with one key difference. The values to be
-  // removed to will each appear exactly once at or after the returned iterator,
-  // so that erase(foo.remove_if(P), foo.end()) will not leak or double-free the
-  // pointers in the vector.
-  template <typename Predicate>
-  iterator remove_if(Predicate predicate) {
-    typename std::vector<T*>::iterator it =
-        std::find_if(data_.begin(), data_.end(), predicate);
-    typename std::vector<T*>::iterator end = data_.end();
-    if (it == end)
-      return it;
-    typename std::vector<T*>::iterator result = it;
-    ++it;
-    for (; it != end; ++it) {
-      if (!static_cast<bool>(predicate(*it))) {
-        // Swap here instead of just assign to |result| so that all the
-        // pointers are preserved to be deleted afterward.
-        std::swap(*result, *it);
-        ++result;
-      }
-    }
-    return result;
-  }
-
-  template<class Compare>
-  inline void sort(Compare comp) {
-    std::sort(data_.begin(), data_.end(), comp);
-  }
-
-  template <class Compare>
-  inline void make_heap(Compare comp) {
-    std::make_heap(data_.begin(), data_.end(), comp);
-  }
-
-  template <class Compare>
-  inline void push_heap(Compare comp) {
-    std::push_heap(data_.begin(), data_.end(), comp);
-  }
-
-  template <class Compare>
-  inline void pop_heap(Compare comp) {
-    std::pop_heap(data_.begin(), data_.end(), comp);
-  }
-
-  iterator begin() { return static_cast<iterator>(data_.begin()); }
-  const_iterator begin() const { return data_.begin(); }
-  iterator end() { return static_cast<iterator>(data_.end()); }
-  const_iterator end() const { return data_.end(); }
-
-  reverse_iterator rbegin() { return data_.rbegin(); }
-  const_reverse_iterator rbegin() const { return data_.rbegin(); }
-  reverse_iterator rend() { return data_.rend(); }
-  const_reverse_iterator rend() const { return data_.rend(); }
-
- private:
-  std::vector<T*> data_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScopedPtrVector);
-};
-
-}  // namespace cc
-
-#endif  // CC_BASE_SCOPED_PTR_VECTOR_H_
diff --git a/cc/base/scoped_ptr_vector_unittest.cc b/cc/base/scoped_ptr_vector_unittest.cc
deleted file mode 100644
index 7b9a86bd..0000000
--- a/cc/base/scoped_ptr_vector_unittest.cc
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <set>
-
-#include "cc/base/scoped_ptr_vector.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-namespace cc {
-namespace {
-
-class Data {
- public:
-  static scoped_ptr<Data> Create(int i) { return make_scoped_ptr(new Data(i)); }
-  int data() const { return data_; }
- private:
-  explicit Data(int i) : data_(i) {}
-  int data_;
-};
-
-class IsOddPredicate {
- public:
-  bool operator()(const Data* data) { return (data->data() % 2) == 1; }
-};
-
-TEST(ScopedPtrVectorTest, PushBack) {
-  ScopedPtrVector<Data> v;
-
-  // Insert 5 things into the vector.
-  v.push_back(Data::Create(1));
-  v.push_back(Data::Create(2));
-  v.push_back(Data::Create(3));
-  v.push_back(Data::Create(4));
-  v.push_back(Data::Create(5));
-
-  EXPECT_EQ(5u, v.size());
-  EXPECT_EQ(1, v[0]->data());
-  EXPECT_EQ(2, v[1]->data());
-  EXPECT_EQ(3, v[2]->data());
-  EXPECT_EQ(4, v[3]->data());
-  EXPECT_EQ(5, v[4]->data());
-}
-
-TEST(ScopedPtrVectorTest, InsertAndTake) {
-  // Insert 3 things into each vector.
-  ScopedPtrVector<Data> v;
-  v.push_back(Data::Create(1));
-  v.push_back(Data::Create(2));
-  v.push_back(Data::Create(6));
-
-  ScopedPtrVector<Data> v2;
-  v2.push_back(Data::Create(3));
-  v2.push_back(Data::Create(4));
-  v2.push_back(Data::Create(5));
-
-  ScopedPtrVector<Data>::iterator it = v.begin();
-  ++it;
-  ++it;
-  EXPECT_EQ(6, (*it)->data());
-
-  v.insert_and_take(it, &v2);
-
-  EXPECT_EQ(6u, v.size());
-  EXPECT_EQ(1, v[0]->data());
-  EXPECT_EQ(2, v[1]->data());
-  EXPECT_EQ(3, v[2]->data());
-  EXPECT_EQ(4, v[3]->data());
-  EXPECT_EQ(5, v[4]->data());
-  EXPECT_EQ(6, v[5]->data());
-
-  EXPECT_EQ(3u, v2.size());
-  EXPECT_EQ(nullptr, v2[0]);
-  EXPECT_EQ(nullptr, v2[1]);
-  EXPECT_EQ(nullptr, v2[2]);
-}
-
-TEST(ScopedPtrVectorTest, Partition) {
-  ScopedPtrVector<Data> v;
-  v.push_back(Data::Create(1));
-  v.push_back(Data::Create(2));
-  v.push_back(Data::Create(3));
-  v.push_back(Data::Create(4));
-  v.push_back(Data::Create(5));
-
-  ScopedPtrVector<Data>::iterator it = v.partition(IsOddPredicate());
-  std::set<int> odd_numbers;
-  for (ScopedPtrVector<Data>::iterator second_it = v.begin();
-       second_it != it;
-       ++second_it) {
-    EXPECT_EQ(1, (*second_it)->data() % 2);
-    odd_numbers.insert((*second_it)->data());
-  }
-  EXPECT_EQ(3u, odd_numbers.size());
-
-  std::set<int> even_numbers;
-  for (; it != v.end(); ++it) {
-    EXPECT_EQ(0, (*it)->data() % 2);
-    even_numbers.insert((*it)->data());
-  }
-  EXPECT_EQ(2u, even_numbers.size());
-}
-
-class DataWithDestruction {
- public:
-  static scoped_ptr<DataWithDestruction> Create(int i, int* destroy_count) {
-    return make_scoped_ptr(new DataWithDestruction(i, destroy_count));
-  }
-  int data() const { return data_; }
-  ~DataWithDestruction() { ++(*destroy_count_); }
-
- private:
-  explicit DataWithDestruction(int i, int* destroy_count)
-      : data_(i), destroy_count_(destroy_count) {}
-  int data_;
-  int* destroy_count_;
-};
-
-TEST(ScopedPtrVectorTest, RemoveIf) {
-  ScopedPtrVector<DataWithDestruction> v;
-  int destroyed[6] = {0};
-  v.push_back(DataWithDestruction::Create(1, &destroyed[0]));
-  v.push_back(DataWithDestruction::Create(2, &destroyed[1]));
-  v.push_back(DataWithDestruction::Create(3, &destroyed[2]));
-  v.push_back(DataWithDestruction::Create(3, &destroyed[3]));
-  v.push_back(DataWithDestruction::Create(4, &destroyed[4]));
-  v.push_back(DataWithDestruction::Create(5, &destroyed[5]));
-
-  int expect_destroyed[6] = {0};
-
-  // Removing more than one thing that matches.
-  auto is_three = [](DataWithDestruction* d) { return d->data() == 3; };
-  v.erase(v.remove_if(is_three), v.end());
-  EXPECT_EQ(4u, v.size());
-  expect_destroyed[2]++;
-  expect_destroyed[3]++;
-  for (size_t i = 0; i < arraysize(destroyed); ++i)
-    EXPECT_EQ(expect_destroyed[i], destroyed[i]) << i;
-  {
-    int expect_data[4] = {1, 2, 4, 5};
-    for (size_t i = 0; i < arraysize(expect_data); ++i)
-      EXPECT_EQ(expect_data[i], v[i]->data()) << i;
-  }
-
-  // Removing from the back of the vector.
-  auto is_five = [](DataWithDestruction* d) { return d->data() == 5; };
-  v.erase(v.remove_if(is_five), v.end());
-  EXPECT_EQ(3u, v.size());
-  expect_destroyed[5]++;
-  for (size_t i = 0; i < arraysize(destroyed); ++i)
-    EXPECT_EQ(expect_destroyed[i], destroyed[i]) << i;
-  {
-    int expect_data[3] = {1, 2, 4};
-    for (size_t i = 0; i < arraysize(expect_data); ++i)
-      EXPECT_EQ(expect_data[i], v[i]->data()) << i;
-  }
-
-  // Removing from the front of the vector.
-  auto is_one = [](DataWithDestruction* d) { return d->data() == 1; };
-  v.erase(v.remove_if(is_one), v.end());
-  EXPECT_EQ(2u, v.size());
-  expect_destroyed[0]++;
-  for (size_t i = 0; i < arraysize(destroyed); ++i)
-    EXPECT_EQ(expect_destroyed[i], destroyed[i]) << i;
-  {
-    int expect_data[2] = {2, 4};
-    for (size_t i = 0; i < arraysize(expect_data); ++i)
-      EXPECT_EQ(expect_data[i], v[i]->data()) << i;
-  }
-
-  // Removing things that aren't in the vector does nothing.
-  v.erase(v.remove_if(is_one), v.end());
-  EXPECT_EQ(2u, v.size());
-  for (size_t i = 0; i < arraysize(destroyed); ++i)
-    EXPECT_EQ(expect_destroyed[i], destroyed[i]) << i;
-  {
-    int expect_data[2] = {2, 4};
-    for (size_t i = 0; i < arraysize(expect_data); ++i)
-      EXPECT_EQ(expect_data[i], v[i]->data()) << i;
-  }
-}
-
-}  // namespace
-}  // namespace cc
diff --git a/cc/blink/web_compositor_support_impl.cc b/cc/blink/web_compositor_support_impl.cc
index 74c5491..9e26cd15 100644
--- a/cc/blink/web_compositor_support_impl.cc
+++ b/cc/blink/web_compositor_support_impl.cc
@@ -110,8 +110,10 @@
 WebScrollOffsetAnimationCurve*
 WebCompositorSupportImpl::createScrollOffsetAnimationCurve(
     blink::WebFloatPoint target_value,
-    blink::WebCompositorAnimationCurve::TimingFunctionType timing_function) {
-  return new WebScrollOffsetAnimationCurveImpl(target_value, timing_function);
+    WebCompositorAnimationCurve::TimingFunctionType timing_function,
+    WebScrollOffsetAnimationCurve::ScrollDurationBehavior duration_behavior) {
+  return new WebScrollOffsetAnimationCurveImpl(target_value, timing_function,
+                                               duration_behavior);
 }
 
 WebTransformAnimationCurve*
diff --git a/cc/blink/web_compositor_support_impl.h b/cc/blink/web_compositor_support_impl.h
index 0547a14..faf0c56 100644
--- a/cc/blink/web_compositor_support_impl.h
+++ b/cc/blink/web_compositor_support_impl.h
@@ -49,8 +49,9 @@
   blink::WebFloatAnimationCurve* createFloatAnimationCurve() override;
   blink::WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(
       blink::WebFloatPoint target_value,
-      blink::WebCompositorAnimationCurve::TimingFunctionType timing_function)
-      override;
+      blink::WebCompositorAnimationCurve::TimingFunctionType timing_function,
+      blink::WebScrollOffsetAnimationCurve::ScrollDurationBehavior
+          duration_behavior) override;
   blink::WebTransformAnimationCurve* createTransformAnimationCurve() override;
   blink::WebTransformOperations* createTransformOperations() override;
   blink::WebFilterOperations* createFilterOperations() override;
diff --git a/cc/blink/web_scroll_offset_animation_curve_impl.cc b/cc/blink/web_scroll_offset_animation_curve_impl.cc
index d79b6d94..d9c535b 100644
--- a/cc/blink/web_scroll_offset_animation_curve_impl.cc
+++ b/cc/blink/web_scroll_offset_animation_curve_impl.cc
@@ -9,16 +9,32 @@
 #include "cc/blink/web_animation_curve_common.h"
 
 using blink::WebFloatPoint;
+using blink::WebScrollOffsetAnimationCurve;
+using DurationBehavior = cc::ScrollOffsetAnimationCurve::DurationBehavior;
 
 namespace cc_blink {
 
+static DurationBehavior GetDurationBehavior(
+    WebScrollOffsetAnimationCurve::ScrollDurationBehavior webDurationBehavior) {
+  switch (webDurationBehavior) {
+    case WebScrollOffsetAnimationCurve::ScrollDurationDeltaBased:
+      return DurationBehavior::DELTA_BASED;
+
+    case WebScrollOffsetAnimationCurve::ScrollDurationConstant:
+      return DurationBehavior::CONSTANT;
+  }
+  NOTREACHED();
+  return DurationBehavior::DELTA_BASED;
+}
+
 WebScrollOffsetAnimationCurveImpl::WebScrollOffsetAnimationCurveImpl(
     WebFloatPoint target_value,
-    TimingFunctionType timing_function)
+    TimingFunctionType timing_function,
+    ScrollDurationBehavior duration_behavior)
     : curve_(cc::ScrollOffsetAnimationCurve::Create(
           gfx::ScrollOffset(target_value.x, target_value.y),
-          CreateTimingFunction(timing_function))) {
-}
+          CreateTimingFunction(timing_function),
+          GetDurationBehavior(duration_behavior))) {}
 
 WebScrollOffsetAnimationCurveImpl::~WebScrollOffsetAnimationCurveImpl() {
 }
diff --git a/cc/blink/web_scroll_offset_animation_curve_impl.h b/cc/blink/web_scroll_offset_animation_curve_impl.h
index 11a1635b..32c6fb90 100644
--- a/cc/blink/web_scroll_offset_animation_curve_impl.h
+++ b/cc/blink/web_scroll_offset_animation_curve_impl.h
@@ -21,7 +21,8 @@
  public:
   CC_BLINK_EXPORT WebScrollOffsetAnimationCurveImpl(
       blink::WebFloatPoint target_value,
-      TimingFunctionType timing_function);
+      TimingFunctionType timing_function,
+      ScrollDurationBehavior duration_behavior);
   ~WebScrollOffsetAnimationCurveImpl() override;
 
   // blink::WebCompositorAnimationCurve implementation.
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 92f8616..ed1ffa9 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -96,8 +96,6 @@
         'base/rolling_time_delta_history.h',
         'base/rtree.cc',
         'base/rtree.h',
-        'base/scoped_ptr_algorithm.h',
-        'base/scoped_ptr_vector.h',
         'base/simple_enclosed_region.cc',
         'base/simple_enclosed_region.h',
         'base/switches.cc',
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 222b202576..8c45b8df 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -26,7 +26,6 @@
       'base/region_unittest.cc',
       'base/rolling_time_delta_history_unittest.cc',
       'base/rtree_unittest.cc',
-      'base/scoped_ptr_vector_unittest.cc',
       'base/simple_enclosed_region_unittest.cc',
       'base/tiling_data_unittest.cc',
       'base/unique_notifier_unittest.cc',
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc
index 9fa90a5b..fc57e84 100644
--- a/cc/debug/debug_rect_history.cc
+++ b/cc/debug/debug_rect_history.cc
@@ -78,7 +78,7 @@
   }
 
   for (unsigned i = 0; i < layer->children().size(); ++i)
-    SavePaintRects(layer->children()[i]);
+    SavePaintRects(layer->children()[i].get());
 }
 
 void DebugRectHistory::SavePropertyChangedRects(
diff --git a/cc/debug/micro_benchmark_controller.cc b/cc/debug/micro_benchmark_controller.cc
index a0dc306..5aace9b 100644
--- a/cc/debug/micro_benchmark_controller.cc
+++ b/cc/debug/micro_benchmark_controller.cc
@@ -37,16 +37,6 @@
   return nullptr;
 }
 
-class IsDonePredicate {
- public:
-  typedef const MicroBenchmark* argument_type;
-  typedef bool result_type;
-
-  result_type operator()(argument_type benchmark) const {
-    return benchmark->IsDone();
-  }
-};
-
 }  // namespace
 
 MicroBenchmarkController::MicroBenchmarkController(LayerTreeHost* host)
@@ -85,23 +75,22 @@
 
 bool MicroBenchmarkController::SendMessage(int id,
                                            scoped_ptr<base::Value> value) {
-  for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin();
-       it != benchmarks_.end();
-       ++it) {
-    if ((*it)->id() == id)
-      return (*it)->ProcessMessage(value.Pass());
-  }
-  return false;
+  auto it = std::find_if(benchmarks_.begin(), benchmarks_.end(),
+                         [id](const scoped_ptr<MicroBenchmark>& benchmark) {
+                           return benchmark->id() == id;
+                         });
+  if (it == benchmarks_.end())
+    return false;
+  return (*it)->ProcessMessage(std::move(value));
 }
 
 void MicroBenchmarkController::ScheduleImplBenchmarks(
     LayerTreeHostImpl* host_impl) {
-  for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin();
-       it != benchmarks_.end();
-       ++it) {
+  for (const auto& benchmark : benchmarks_) {
     scoped_ptr<MicroBenchmarkImpl> benchmark_impl;
-    if (!(*it)->ProcessedForBenchmarkImpl()) {
-      benchmark_impl = (*it)->GetBenchmarkImpl(main_controller_task_runner_);
+    if (!benchmark->ProcessedForBenchmarkImpl()) {
+      benchmark_impl =
+          benchmark->GetBenchmarkImpl(main_controller_task_runner_);
     }
 
     if (benchmark_impl.get())
@@ -110,11 +99,9 @@
 }
 
 void MicroBenchmarkController::DidUpdateLayers() {
-  for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin();
-       it != benchmarks_.end();
-       ++it) {
-    if (!(*it)->IsDone())
-      (*it)->DidUpdateLayers(host_);
+  for (const auto& benchmark : benchmarks_) {
+    if (!benchmark->IsDone())
+      benchmark->DidUpdateLayers(host_);
   }
 
   CleanUpFinishedBenchmarks();
@@ -122,7 +109,10 @@
 
 void MicroBenchmarkController::CleanUpFinishedBenchmarks() {
   benchmarks_.erase(
-      benchmarks_.partition(std::not1(IsDonePredicate())),
+      std::remove_if(benchmarks_.begin(), benchmarks_.end(),
+                     [](const scoped_ptr<MicroBenchmark>& benchmark) {
+                       return benchmark->IsDone();
+                     }),
       benchmarks_.end());
 }
 
diff --git a/cc/debug/micro_benchmark_controller.h b/cc/debug/micro_benchmark_controller.h
index 198e203..8f1cdfc 100644
--- a/cc/debug/micro_benchmark_controller.h
+++ b/cc/debug/micro_benchmark_controller.h
@@ -6,10 +6,10 @@
 #define CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_
 
 #include <string>
+#include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/debug/micro_benchmark.h"
 
 namespace base {
@@ -42,7 +42,7 @@
   int GetNextIdAndIncrement();
 
   LayerTreeHost* host_;
-  ScopedPtrVector<MicroBenchmark> benchmarks_;
+  std::vector<scoped_ptr<MicroBenchmark>> benchmarks_;
   static int next_id_;
   scoped_refptr<base::SingleThreadTaskRunner> main_controller_task_runner_;
 
diff --git a/cc/debug/micro_benchmark_controller_impl.cc b/cc/debug/micro_benchmark_controller_impl.cc
index 821ba5f8..31ff2c0 100644
--- a/cc/debug/micro_benchmark_controller_impl.cc
+++ b/cc/debug/micro_benchmark_controller_impl.cc
@@ -12,20 +12,6 @@
 
 namespace cc {
 
-namespace {
-
-class IsDonePredicate {
- public:
-  typedef const MicroBenchmarkImpl* argument_type;
-  typedef bool result_type;
-
-  result_type operator()(argument_type benchmark) const {
-    return benchmark->IsDone();
-  }
-};
-
-}  // namespace
-
 MicroBenchmarkControllerImpl::MicroBenchmarkControllerImpl(
     LayerTreeHostImpl* host)
     : host_(host) {
@@ -40,11 +26,9 @@
 }
 
 void MicroBenchmarkControllerImpl::DidCompleteCommit() {
-  for (ScopedPtrVector<MicroBenchmarkImpl>::iterator it = benchmarks_.begin();
-       it != benchmarks_.end();
-       ++it) {
-    DCHECK(!(*it)->IsDone());
-    (*it)->DidCompleteCommit(host_);
+  for (const auto& benchmark : benchmarks_) {
+    DCHECK(!benchmark->IsDone());
+    benchmark->DidCompleteCommit(host_);
   }
 
   CleanUpFinishedBenchmarks();
@@ -52,7 +36,10 @@
 
 void MicroBenchmarkControllerImpl::CleanUpFinishedBenchmarks() {
   benchmarks_.erase(
-      benchmarks_.partition(std::not1(IsDonePredicate())),
+      std::remove_if(benchmarks_.begin(), benchmarks_.end(),
+                     [](const scoped_ptr<MicroBenchmarkImpl>& benchmark) {
+                       return benchmark->IsDone();
+                     }),
       benchmarks_.end());
 }
 
diff --git a/cc/debug/micro_benchmark_controller_impl.h b/cc/debug/micro_benchmark_controller_impl.h
index 734bf63..6fdf043 100644
--- a/cc/debug/micro_benchmark_controller_impl.h
+++ b/cc/debug/micro_benchmark_controller_impl.h
@@ -6,9 +6,9 @@
 #define CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_IMPL_H_
 
 #include <string>
+#include <vector>
 
 #include "base/basictypes.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/debug/micro_benchmark_impl.h"
 
 namespace cc {
@@ -27,7 +27,7 @@
   void CleanUpFinishedBenchmarks();
 
   LayerTreeHostImpl* host_;
-  ScopedPtrVector<MicroBenchmarkImpl> benchmarks_;
+  std::vector<scoped_ptr<MicroBenchmarkImpl>> benchmarks_;
 
   DISALLOW_COPY_AND_ASSIGN(MicroBenchmarkControllerImpl);
 };
diff --git a/cc/layers/delegated_frame_provider.cc b/cc/layers/delegated_frame_provider.cc
index 5e016eb..5d07cc4e 100644
--- a/cc/layers/delegated_frame_provider.cc
+++ b/cc/layers/delegated_frame_provider.cc
@@ -15,7 +15,7 @@
     const scoped_refptr<DelegatedFrameResourceCollection>& resource_collection,
     scoped_ptr<DelegatedFrameData> frame)
     : resource_collection_(resource_collection) {
-  RenderPass* root_pass = frame->render_pass_list.back();
+  RenderPass* root_pass = frame->render_pass_list.back().get();
   frame_size_ = root_pass->output_rect.size();
   DCHECK(!frame_size_.IsEmpty());
   SetFrameData(frame.Pass());
@@ -66,7 +66,7 @@
   resource_collection_->ReceivedResources(frame_->resource_list);
   resource_collection_->RefResources(frame_->resource_list);
 
-  RenderPass* root_pass = frame_->render_pass_list.back();
+  RenderPass* root_pass = frame_->render_pass_list.back().get();
   DCHECK_EQ(frame_size_.ToString(), root_pass->output_rect.size().ToString())
       << "All frames in a single DelegatedFrameProvider must have the same "
       << "size. Use a new frame provider for frames of a different size.";
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
index 9b3a5132..7a5b622c 100644
--- a/cc/layers/delegated_renderer_layer_impl.cc
+++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -151,7 +151,7 @@
   // Display size is already set so we can compute what the damage rect
   // will be in layer space. The damage may exceed the visible portion of
   // the frame, so intersect the damage to the layer's bounds.
-  RenderPass* new_root_pass = render_pass_list.back();
+  RenderPass* new_root_pass = render_pass_list.back().get();
   gfx::Size frame_size = new_root_pass->output_rect.size();
   gfx::Rect damage_in_layer =
       gfx::ScaleToEnclosingRect(damage_in_frame, inverse_device_scale_factor_);
@@ -180,9 +180,7 @@
         render_passes_in_draw_order->begin() + i;
     render_passes_index_by_id_.insert(
         RenderPassToIndexMap::value_type((*to_take)->id, i));
-    scoped_ptr<RenderPass> taken_render_pass =
-        render_passes_in_draw_order->take(to_take);
-    render_passes_in_draw_order_.push_back(taken_render_pass.Pass());
+    render_passes_in_draw_order_.push_back(to_take->Pass());
   }
 
   // Give back an empty array instead of nulls.
@@ -246,7 +244,7 @@
   DCHECK(HasContributingDelegatedRenderPasses());
 
   const RenderPass* root_delegated_render_pass =
-      render_passes_in_draw_order_.back();
+      render_passes_in_draw_order_.back().get();
   gfx::Size frame_size = root_delegated_render_pass->output_rect.size();
   gfx::Transform delegated_frame_to_root_transform = screen_space_transform();
   delegated_frame_to_root_transform.Scale(inverse_device_scale_factor_,
@@ -290,7 +288,7 @@
   RenderPassId target_render_pass_id = render_pass->id;
 
   const RenderPass* root_delegated_render_pass =
-      render_passes_in_draw_order_.back();
+      render_passes_in_draw_order_.back().get();
 
   DCHECK(root_delegated_render_pass->output_rect.origin().IsOrigin());
   gfx::Size frame_size = root_delegated_render_pass->output_rect.size();
@@ -314,7 +312,7 @@
 
     size_t render_pass_index = IdToIndex(target_render_pass_id.index);
     const RenderPass* delegated_render_pass =
-        render_passes_in_draw_order_[render_pass_index];
+        render_passes_in_draw_order_[render_pass_index].get();
     AppendRenderPassQuads(render_pass,
                           delegated_render_pass,
                           frame_size);
@@ -420,7 +418,7 @@
   delegated_frame_to_target_transform.Scale(inverse_device_scale_factor_,
                                             inverse_device_scale_factor_);
   bool is_root_delegated_render_pass =
-      delegated_render_pass == render_passes_in_draw_order_.back();
+      delegated_render_pass == render_passes_in_draw_order_.back().get();
   for (const auto& delegated_quad : delegated_render_pass->quad_list) {
     if (delegated_quad->shared_quad_state != delegated_shared_quad_state) {
       delegated_shared_quad_state = delegated_quad->shared_quad_state;
diff --git a/cc/layers/delegated_renderer_layer_impl.h b/cc/layers/delegated_renderer_layer_impl.h
index e59c3ac8..5c9b46a 100644
--- a/cc/layers/delegated_renderer_layer_impl.h
+++ b/cc/layers/delegated_renderer_layer_impl.h
@@ -8,7 +8,6 @@
 #include "base/containers/hash_tables.h"
 #include "base/memory/scoped_ptr.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/layers/layer_impl.h"
 
 namespace cc {
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index 1c1149d..e14d2a48 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -4,7 +4,6 @@
 
 #include "cc/layers/delegated_renderer_layer_impl.h"
 
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/layers/solid_color_layer_impl.h"
 #include "cc/quads/render_pass_draw_quad.h"
 #include "cc/quads/solid_color_draw_quad.h"
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index 4624e64c..964cbf4 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -91,11 +91,9 @@
 
 void HeadsUpDisplayLayerImpl::AcquireResource(
     ResourceProvider* resource_provider) {
-  for (ScopedPtrVector<ScopedResource>::iterator it = resources_.begin();
-       it != resources_.end();
-       ++it) {
-    if (!resource_provider->InUseByConsumer((*it)->id())) {
-      resources_.swap(it, resources_.end() - 1);
+  for (auto& resource : resources_) {
+    if (!resource_provider->InUseByConsumer(resource->id())) {
+      resource.swap(resources_.back());
       return;
     }
   }
@@ -108,23 +106,13 @@
   resources_.push_back(resource.Pass());
 }
 
-class ResourceSizeIsEqualTo {
- public:
-  explicit ResourceSizeIsEqualTo(const gfx::Size& size_)
-      : compare_size_(size_) {}
-
-  bool operator()(const ScopedResource* resource) {
-    return resource->size() == compare_size_;
-  }
-
- private:
-  const gfx::Size compare_size_;
-};
-
 void HeadsUpDisplayLayerImpl::ReleaseUnmatchedSizeResources(
     ResourceProvider* resource_provider) {
-  ScopedPtrVector<ScopedResource>::iterator it_erase =
-      resources_.partition(ResourceSizeIsEqualTo(internal_content_bounds_));
+  auto it_erase =
+      std::remove_if(resources_.begin(), resources_.end(),
+                     [this](const scoped_ptr<ScopedResource>& resource) {
+                       return internal_content_bounds_ != resource->size();
+                     });
   resources_.erase(it_erase, resources_.end());
 }
 
diff --git a/cc/layers/heads_up_display_layer_impl.h b/cc/layers/heads_up_display_layer_impl.h
index 0663b82..e5880c4 100644
--- a/cc/layers/heads_up_display_layer_impl.h
+++ b/cc/layers/heads_up_display_layer_impl.h
@@ -123,7 +123,7 @@
   void AcquireResource(ResourceProvider* resource_provider);
   void ReleaseUnmatchedSizeResources(ResourceProvider* resource_provider);
 
-  ScopedPtrVector<ScopedResource> resources_;
+  std::vector<scoped_ptr<ScopedResource>> resources_;
   skia::RefPtr<SkSurface> hud_surface_;
 
   skia::RefPtr<SkTypeface> typeface_;
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 4796f73..1c6d8997 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -413,9 +413,10 @@
   DCHECK(IsPropertyChangeAllowed());
   bool had_no_copy_requests = copy_requests_.empty();
   if (void* source = request->source()) {
-    auto it = std::find_if(
-        copy_requests_.begin(), copy_requests_.end(),
-        [source](const CopyOutputRequest* x) { return x->source() == source; });
+    auto it = std::find_if(copy_requests_.begin(), copy_requests_.end(),
+                           [source](const scoped_ptr<CopyOutputRequest>& x) {
+                             return x->source() == source;
+                           });
     if (it != copy_requests_.end())
       copy_requests_.erase(it);
   }
@@ -1296,13 +1297,11 @@
 
   // Wrap the copy_requests_ in a PostTask to the main thread.
   bool had_copy_requests = !copy_requests_.empty();
-  ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests;
-  for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin();
-       it != copy_requests_.end();
-       ++it) {
+  std::vector<scoped_ptr<CopyOutputRequest>> main_thread_copy_requests;
+  for (auto it = copy_requests_.begin(); it != copy_requests_.end(); ++it) {
     scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
         layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
-    scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it);
+    scoped_ptr<CopyOutputRequest> original_request = std::move(*it);
     const CopyOutputRequest& original_request_ref = *original_request;
     scoped_ptr<CopyOutputRequest> main_thread_request =
         CopyOutputRequest::CreateRelayRequest(
@@ -1418,6 +1417,56 @@
   }
 }
 
+bool Layer::ToLayerPropertiesProto(proto::LayerUpdate* layer_update) {
+  if (!needs_push_properties_ && num_dependents_need_push_properties_ == 0)
+    return false;
+
+  // Always set properties metadata for serialized layers.
+  proto::LayerProperties* proto = layer_update->add_layers();
+  proto->set_id(layer_id_);
+  proto->set_needs_push_properties(needs_push_properties_);
+  proto->set_num_dependents_need_push_properties(
+      num_dependents_need_push_properties_);
+
+  if (needs_push_properties_)
+    LayerSpecificPropertiesToProto(proto);
+
+  needs_push_properties_ = false;
+
+  bool descendant_needs_push_properties =
+      num_dependents_need_push_properties_ > 0;
+  num_dependents_need_push_properties_ = 0;
+
+  return descendant_needs_push_properties;
+}
+
+void Layer::FromLayerPropertiesProto(const proto::LayerProperties& proto) {
+  DCHECK(proto.has_id());
+  DCHECK_EQ(layer_id_, proto.id());
+  DCHECK(proto.has_needs_push_properties());
+  needs_push_properties_ = proto.needs_push_properties();
+  DCHECK(proto.has_num_dependents_need_push_properties());
+  num_dependents_need_push_properties_ =
+      proto.num_dependents_need_push_properties();
+
+  if (!needs_push_properties_)
+    return;
+
+  FromLayerSpecificPropertiesProto(proto);
+}
+
+void Layer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto) {
+  // TODO(nyquist): Write all required properties to |proto|.
+  // Create an empty proto::LayerProperties::base message.
+  proto->mutable_base();
+}
+
+void Layer::FromLayerSpecificPropertiesProto(
+    const proto::LayerProperties& proto) {
+  DCHECK(proto.has_base());
+  // TODO(nyquist): Read all required properties from |proto|.
+}
+
 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
   return LayerImpl::Create(tree_impl, layer_id_,
                            new LayerImpl::SyncedScrollOffset);
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 5c298f5..2a5e527 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -17,7 +17,6 @@
 #include "cc/animation/layer_animation_value_provider.h"
 #include "cc/base/cc_export.h"
 #include "cc/base/region.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/debug/frame_timing_request.h"
 #include "cc/debug/micro_benchmark.h"
 #include "cc/layers/layer_lists.h"
@@ -69,6 +68,8 @@
 
 namespace proto {
 class LayerNode;
+class LayerProperties;
+class LayerUpdate;
 }  // namespace proto
 
 // Base class for composited layers. Special layer types are derived from
@@ -387,6 +388,22 @@
   void FromLayerNodeProto(const proto::LayerNode& proto,
                           const LayerIdMap& layer_map);
 
+  // This method is similar to PushPropertiesTo, but instead of pushing to
+  // a LayerImpl, it pushes the properties to proto::LayerProperties. It adds
+  // this layer to the proto::LayerUpdate if it or any of its descendants
+  // have changed properties. If this layer contains changed properties, the
+  // properties themselves will also be pushed the proto::LayerProperties.
+  // Similarly to PushPropertiesTo, this method also resets
+  // |needs_push_properties_| and |num_dependents_need_push_properties_|.
+  // Returns whether any of the descendants have changed properties.
+  bool ToLayerPropertiesProto(proto::LayerUpdate* layer_update);
+
+  // Read all property values from the given LayerProperties object and update
+  // the current layer. The values for |needs_push_properties_| and
+  // |num_dependents_need_push_properties_| are always updated, but the rest
+  // of |proto| is only read if |needs_push_properties_| is set.
+  void FromLayerPropertiesProto(const proto::LayerProperties& proto);
+
   LayerTreeHost* layer_tree_host() { return layer_tree_host_; }
   const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; }
 
@@ -589,6 +606,22 @@
 
   bool IsPropertyChangeAllowed() const;
 
+  // Serialize all the necessary properties to be able to reconstruct this Layer
+  // into proto::LayerProperties. This function must not set values for
+  // |needs_push_properties_| or |num_dependents_need_push_properties_| as they
+  // are dealt with at a higher level. This is only called if
+  // |needs_push_properties_| is set. For descendants of Layer, implementations
+  // must first call their parent class.
+  virtual void LayerSpecificPropertiesToProto(proto::LayerProperties* proto);
+
+  // Deserialize all the necessary properties from proto::LayerProperties into
+  // this Layer. This function must not set values for |needs_push_properties_|
+  // or |num_dependents_need_push_properties_| as they are dealt with at a
+  // higher level. This is only called if |needs_push_properties_| is set. For
+  // descendants of Layer, implementations must first call their parent class.
+  virtual void FromLayerSpecificPropertiesProto(
+      const proto::LayerProperties& proto);
+
   // This flag is set when the layer needs to push properties to the impl
   // side.
   bool needs_push_properties_;
@@ -729,7 +762,7 @@
 
   LayerClient* client_;
 
-  ScopedPtrVector<CopyOutputRequest> copy_requests_;
+  std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_;
 
   base::Closure did_scroll_callback_;
 
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 4f611044..e0b7f44 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -135,11 +135,11 @@
   for (OwnedLayerImplList::iterator it = children_.begin();
        it != children_.end();
        ++it) {
-    if (*it == child) {
-      scoped_ptr<LayerImpl> ret = children_.take(it);
+    if (it->get() == child) {
+      scoped_ptr<LayerImpl> ret = it->Pass();
       children_.erase(it);
       layer_tree_impl()->set_needs_update_draw_properties();
-      return ret.Pass();
+      return ret;
     }
   }
   return nullptr;
@@ -260,7 +260,8 @@
   SetNeedsPushProperties();
 }
 
-void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) {
+void LayerImpl::PassCopyRequests(
+    std::vector<scoped_ptr<CopyOutputRequest>>* requests) {
   // In the case that a layer still has a copy request, this means that there's
   // a commit to the active tree without a draw.  This only happens in some
   // edge cases during lost context or visibility changes, so don't try to
@@ -276,7 +277,8 @@
 
   DCHECK(render_surface());
   bool was_empty = copy_requests_.empty();
-  copy_requests_.insert_and_take(copy_requests_.end(), requests);
+  for (auto& request : *requests)
+    copy_requests_.push_back(std::move(request));
   requests->clear();
 
   if (was_empty && layer_tree_impl()->IsActiveTree())
@@ -285,17 +287,18 @@
 }
 
 void LayerImpl::TakeCopyRequestsAndTransformToTarget(
-    ScopedPtrVector<CopyOutputRequest>* requests) {
+    std::vector<scoped_ptr<CopyOutputRequest>>* requests) {
   DCHECK(!copy_requests_.empty());
   DCHECK(layer_tree_impl()->IsActiveTree());
   DCHECK_EQ(render_target(), this);
 
   size_t first_inserted_request = requests->size();
-  requests->insert_and_take(requests->end(), &copy_requests_);
+  for (auto& request : copy_requests_)
+    requests->push_back(std::move(request));
   copy_requests_.clear();
 
   for (size_t i = first_inserted_request; i < requests->size(); ++i) {
-    CopyOutputRequest* request = requests->at(i);
+    CopyOutputRequest* request = (*requests)[i].get();
     if (!request->has_area())
       continue;
 
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 543691fb..d5669ca 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -19,7 +19,6 @@
 #include "cc/animation/layer_animation_value_provider.h"
 #include "cc/base/cc_export.h"
 #include "cc/base/region.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/base/synced_property.h"
 #include "cc/debug/frame_timing_request.h"
 #include "cc/input/input_handler.h"
@@ -127,7 +126,7 @@
   const LayerImpl* parent() const { return parent_; }
   const OwnedLayerImplList& children() const { return children_; }
   OwnedLayerImplList& children() { return children_; }
-  LayerImpl* child_at(size_t index) const { return children_[index]; }
+  LayerImpl* child_at(size_t index) const { return children_[index].get(); }
   void AddChild(scoped_ptr<LayerImpl> child);
   scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child);
   void SetParent(LayerImpl* parent);
@@ -221,10 +220,10 @@
     return clip_children_.get();
   }
 
-  void PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests);
+  void PassCopyRequests(std::vector<scoped_ptr<CopyOutputRequest>>* requests);
   // Can only be called when the layer has a copy request.
   void TakeCopyRequestsAndTransformToTarget(
-      ScopedPtrVector<CopyOutputRequest>* request);
+      std::vector<scoped_ptr<CopyOutputRequest>>* request);
   bool HasCopyRequest() const { return !copy_requests_.empty(); }
 
   void SetMaskLayer(scoped_ptr<LayerImpl> mask_layer);
@@ -848,7 +847,7 @@
   // Manages animations for this layer.
   scoped_refptr<LayerAnimationController> layer_animation_controller_;
 
-  ScopedPtrVector<CopyOutputRequest> copy_requests_;
+  std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_;
 
   // Group of properties that need to be computed based on the layer tree
   // hierarchy before layers can be drawn.
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 8b93be3..65691b4a 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -116,9 +116,9 @@
   clip_children->insert(root);
 
   root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7));
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
   child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8));
-  LayerImpl* grand_child = child->children()[0];
+  LayerImpl* grand_child = child->children()[0].get();
 
   root->SetScrollClipLayer(root_clip->id());
 
@@ -451,7 +451,7 @@
   }
 
   LayerImpl* layer() {
-    return host_impl_.active_tree()->root_layer()->children()[0];
+    return host_impl_.active_tree()->root_layer()->children()[0].get();
   }
 
   LayerTreeHostImpl& host_impl() { return host_impl_; }
diff --git a/cc/layers/layer_lists.h b/cc/layers/layer_lists.h
index 870785d..264d219a 100644
--- a/cc/layers/layer_lists.h
+++ b/cc/layers/layer_lists.h
@@ -8,15 +8,15 @@
 #include <vector>
 
 #include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 
 namespace cc {
 class Layer;
 class LayerImpl;
 
 typedef std::vector<scoped_refptr<Layer>> LayerList;
-typedef ScopedPtrVector<LayerImpl> OwnedLayerImplList;
+typedef std::vector<scoped_ptr<LayerImpl>> OwnedLayerImplList;
 typedef std::vector<LayerImpl*> LayerImplList;
 
 }  // namespace cc
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index fab65da..ace3b03e 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -155,14 +155,16 @@
       grand_child_impl_->SetScrollDelta(gfx::Vector2dF());
     }
     root_impl_ = layer_tree_host_->CommitAndCreateLayerImplTree();
-    inner_viewport_container_layer_impl_ = root_impl_->children()[0];
-    scroll_layer_impl_ = inner_viewport_container_layer_impl_->children()[0];
-    outer_viewport_container_layer_impl_ = scroll_layer_impl_->children()[0];
+    inner_viewport_container_layer_impl_ = root_impl_->children()[0].get();
+    scroll_layer_impl_ =
+        inner_viewport_container_layer_impl_->children()[0].get();
+    outer_viewport_container_layer_impl_ =
+        scroll_layer_impl_->children()[0].get();
     child_transform_layer_impl_ =
-        outer_viewport_container_layer_impl_->children()[0];
-    child_impl_ = child_transform_layer_impl_->children()[0];
-    grand_child_impl_ = child_impl_->children()[0];
-    great_grand_child_impl_ = grand_child_impl_->children()[0];
+        outer_viewport_container_layer_impl_->children()[0].get();
+    child_impl_ = child_transform_layer_impl_->children()[0].get();
+    grand_child_impl_ = child_impl_->children()[0].get();
+    great_grand_child_impl_ = grand_child_impl_->children()[0].get();
   }
 
  protected:
@@ -564,7 +566,8 @@
   fixed_position_child->SetTransform(rotation_about_z);
 
   CommitAndUpdateImplPointers();
-  LayerImpl* fixed_position_child_impl = great_grand_child_impl_->children()[0];
+  LayerImpl* fixed_position_child_impl =
+      great_grand_child_impl_->children()[0].get();
 
   // Case 1: scroll delta of 0, 0
   child_impl_->SetScrollDelta(gfx::Vector2d(0, 0));
@@ -660,7 +663,7 @@
   // Case 4: Bottom-right fixed-position layer.
   fixed_position_child->SetPositionConstraint(fixed_to_bottom_right_);
   CommitAndUpdateImplPointers();
-  fixed_position_child_impl = great_grand_child_impl_->children()[0];
+  fixed_position_child_impl = great_grand_child_impl_->children()[0].get();
   child_impl_->SetScrollDelta(gfx::Vector2d(10, 30));
   SetFixedContainerSizeDelta(child_impl_, gfx::Vector2d(20, 20));
   ExecuteCalculateDrawProperties(root_impl_);
@@ -721,7 +724,8 @@
   fixed_position_child->SetTransform(rotation_about_z);
 
   CommitAndUpdateImplPointers();
-  LayerImpl* fixed_position_child_impl = great_grand_child_impl_->children()[0];
+  LayerImpl* fixed_position_child_impl =
+      great_grand_child_impl_->children()[0].get();
 
   // Case 1: scroll delta of 0, 0
   child_impl_->SetScrollDelta(gfx::Vector2d(0, 0));
@@ -1040,7 +1044,7 @@
   LayerImpl* container1 = child_impl_;
   LayerImpl* fixed_to_container1 = grand_child_impl_;
   LayerImpl* container2 = great_grand_child_impl_;
-  LayerImpl* fixed_to_container2 = container2->children()[0];
+  LayerImpl* fixed_to_container2 = container2->children()[0].get();
 
   container1->SetScrollDelta(gfx::Vector2d(0, 15));
   container1->SetDrawsContent(true);
diff --git a/cc/layers/layer_proto_converter.cc b/cc/layers/layer_proto_converter.cc
index 2dcc3d9..7644c7e 100644
--- a/cc/layers/layer_proto_converter.cc
+++ b/cc/layers/layer_proto_converter.cc
@@ -42,6 +42,48 @@
 }
 
 // static
+void LayerProtoConverter::SerializeLayerProperties(
+    Layer* root_layer,
+    proto::LayerUpdate* layer_update) {
+  RecursivelySerializeLayerProperties(root_layer, layer_update);
+}
+
+// static
+void LayerProtoConverter::DeserializeLayerProperties(
+    Layer* existing_root,
+    const proto::LayerUpdate& layer_update) {
+  LayerIdMap layer_id_map;
+  RecursivelyFindAllLayers(existing_root, &layer_id_map);
+
+  for (int i = 0; i < layer_update.layers_size(); ++i) {
+    const proto::LayerProperties& layer_properties = layer_update.layers(i);
+
+    Layer::LayerIdMap::const_iterator iter =
+        layer_id_map.find(layer_properties.id());
+    DCHECK(iter != layer_id_map.end());
+
+    iter->second->FromLayerPropertiesProto(layer_properties);
+  }
+}
+
+// static
+void LayerProtoConverter::RecursivelySerializeLayerProperties(
+    Layer* layer,
+    proto::LayerUpdate* layer_update) {
+  bool serialize_descendants = layer->ToLayerPropertiesProto(layer_update);
+  if (!serialize_descendants)
+    return;
+
+  for (const auto& child : layer->children()) {
+    RecursivelySerializeLayerProperties(child.get(), layer_update);
+  }
+  if (layer->mask_layer())
+    RecursivelySerializeLayerProperties(layer->mask_layer(), layer_update);
+  if (layer->replica_layer())
+    RecursivelySerializeLayerProperties(layer->replica_layer(), layer_update);
+}
+
+// static
 void LayerProtoConverter::RecursivelyFindAllLayers(
     const scoped_refptr<Layer>& layer,
     LayerIdMap* layer_id_map) {
diff --git a/cc/layers/layer_proto_converter.h b/cc/layers/layer_proto_converter.h
index 29424a0..7f2742b 100644
--- a/cc/layers/layer_proto_converter.h
+++ b/cc/layers/layer_proto_converter.h
@@ -13,6 +13,7 @@
 
 namespace proto {
 class LayerNode;
+class LayerUpdate;
 }
 
 // A class to faciliate (de)serialization of a Layer tree to protocol buffers.
@@ -28,9 +29,22 @@
   // root Layer after updating the hierarchy (may be the same as
   // |existing_root|).
   static scoped_refptr<Layer> DeserializeLayerHierarchy(
-      scoped_refptr<Layer> existing_root,
+      const scoped_refptr<Layer> existing_root,
       const proto::LayerNode& root_node);
 
+  // Starting at |root_layer|, serializes the properties of all the dirty nodes
+  // in the Layer hierarchy. The proto::LayerUpdate will contain all nodes that
+  // either are dirty or have dirty descendants. Only nodes that are dirty will
+  // contain the list of dirty properties.
+  static void SerializeLayerProperties(Layer* root_layer,
+                                       proto::LayerUpdate* layer_update);
+
+  // Iterate over all updated layers from the LayerUpdate, and update the
+  // local Layers.
+  static void DeserializeLayerProperties(
+      Layer* existing_root,
+      const proto::LayerUpdate& layer_update);
+
   // Returns the Layer with proto.id() as the Layer id, if it exists in
   // |layer_id_map|. Otherwise, a new Layer is constructed of the type given
   // from proto.type().
@@ -42,6 +56,12 @@
   LayerProtoConverter();
   ~LayerProtoConverter();
 
+  // This method is the inner recursive function for SerializeLayerProperties
+  // declared above.
+  static void RecursivelySerializeLayerProperties(
+      Layer* root_layer,
+      proto::LayerUpdate* layer_update);
+
   using LayerIdMap = base::hash_map<int, scoped_refptr<Layer>>;
   // Start at |layer| and recursively add |layer| and all its children and
   // special layers to |layer_id_map|.
diff --git a/cc/layers/layer_proto_converter_unittest.cc b/cc/layers/layer_proto_converter_unittest.cc
index 040be97..83f3fa1 100644
--- a/cc/layers/layer_proto_converter_unittest.cc
+++ b/cc/layers/layer_proto_converter_unittest.cc
@@ -107,4 +107,204 @@
   EXPECT_EQ(child_c_node->id(), child_c->id());
 }
 
+TEST(LayerProtoConverterTest, RecursivePropertiesSerialization) {
+  /* Testing serialization of properties for a tree that looks like this:
+          root+
+          /  \
+         a*   b*+[mask:*,replica]
+        /      \
+       c        d*
+     Layers marked with * have changed properties.
+     Layers marked with + have descendants with changed properties.
+     Layer b also has a mask layer and a replica layer.
+  */
+  scoped_refptr<Layer> layer_src_root = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_a = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b_mask = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b_replica = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_c = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_d = Layer::Create(LayerSettings());
+  layer_src_root->AddChild(layer_src_a);
+  layer_src_root->AddChild(layer_src_b);
+  layer_src_a->AddChild(layer_src_c);
+  layer_src_b->AddChild(layer_src_d);
+  layer_src_b->SetMaskLayer(layer_src_b_mask.get());
+  layer_src_b->SetReplicaLayer(layer_src_b_replica.get());
+
+  layer_src_a->SetNeedsPushProperties();
+  layer_src_b->SetNeedsPushProperties();
+  layer_src_b_mask->SetNeedsPushProperties();
+  layer_src_d->SetNeedsPushProperties();
+
+  proto::LayerUpdate layer_update;
+  LayerProtoConverter::SerializeLayerProperties(layer_src_root.get(),
+                                                &layer_update);
+
+  // All flags for pushing properties should have been cleared.
+  EXPECT_FALSE(layer_src_root->needs_push_properties());
+  EXPECT_FALSE(layer_src_root->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_a->needs_push_properties());
+  EXPECT_FALSE(layer_src_a->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b->needs_push_properties());
+  EXPECT_FALSE(layer_src_b->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b_mask->needs_push_properties());
+  EXPECT_FALSE(layer_src_b_mask->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b_replica->needs_push_properties());
+  EXPECT_FALSE(layer_src_b_replica->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_c->needs_push_properties());
+  EXPECT_FALSE(layer_src_c->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_d->needs_push_properties());
+  EXPECT_FALSE(layer_src_d->descendant_needs_push_properties());
+
+  // Only 5 of the layers should have been serialized.
+  ASSERT_EQ(5, layer_update.layers_size());
+  EXPECT_EQ(layer_src_root->id(), layer_update.layers(0).id());
+  proto::LayerProperties dest_root = layer_update.layers(0);
+  EXPECT_EQ(layer_src_a->id(), layer_update.layers(1).id());
+  proto::LayerProperties dest_a = layer_update.layers(1);
+  EXPECT_EQ(layer_src_b->id(), layer_update.layers(2).id());
+  proto::LayerProperties dest_b = layer_update.layers(2);
+  EXPECT_EQ(layer_src_d->id(), layer_update.layers(3).id());
+  proto::LayerProperties dest_d = layer_update.layers(3);
+  EXPECT_EQ(layer_src_b_mask->id(), layer_update.layers(4).id());
+  proto::LayerProperties dest_b_mask = layer_update.layers(4);
+
+  // Ensure the properties and dependants metadata is correctly serialized.
+  EXPECT_FALSE(dest_root.needs_push_properties());
+  EXPECT_EQ(2, dest_root.num_dependents_need_push_properties());
+  EXPECT_FALSE(dest_root.has_base());
+
+  EXPECT_TRUE(dest_a.needs_push_properties());
+  EXPECT_EQ(0, dest_a.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_a.has_base());
+
+  EXPECT_TRUE(dest_b.needs_push_properties());
+  EXPECT_EQ(2, dest_b.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_b.has_base());
+
+  EXPECT_TRUE(dest_d.needs_push_properties());
+  EXPECT_EQ(0, dest_d.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_d.has_base());
+
+  EXPECT_TRUE(dest_b_mask.needs_push_properties());
+  EXPECT_EQ(0, dest_b_mask.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_b_mask.has_base());
+}
+
+TEST(LayerProtoConverterTest, RecursivePropertiesSerializationSingleChild) {
+  /* Testing serialization of properties for a tree that looks like this:
+          root+
+             \
+              b*+[mask:*]
+               \
+                c
+     Layers marked with * have changed properties.
+     Layers marked with + have descendants with changed properties.
+     Layer b also has a mask layer.
+  */
+  scoped_refptr<Layer> layer_src_root = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b_mask = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_c = Layer::Create(LayerSettings());
+  layer_src_root->AddChild(layer_src_b);
+  layer_src_b->AddChild(layer_src_c);
+  layer_src_b->SetMaskLayer(layer_src_b_mask.get());
+
+  layer_src_b->SetNeedsPushProperties();
+  layer_src_b_mask->SetNeedsPushProperties();
+
+  proto::LayerUpdate layer_update;
+  LayerProtoConverter::SerializeLayerProperties(layer_src_root.get(),
+                                                &layer_update);
+
+  // All flags for pushing properties should have been cleared.
+  EXPECT_FALSE(layer_src_root->needs_push_properties());
+  EXPECT_FALSE(layer_src_root->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b->needs_push_properties());
+  EXPECT_FALSE(layer_src_b->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b_mask->needs_push_properties());
+  EXPECT_FALSE(layer_src_b_mask->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_c->needs_push_properties());
+  EXPECT_FALSE(layer_src_c->descendant_needs_push_properties());
+
+  // Only 3 of the layers should have been serialized.
+  ASSERT_EQ(3, layer_update.layers_size());
+  EXPECT_EQ(layer_src_root->id(), layer_update.layers(0).id());
+  proto::LayerProperties dest_root = layer_update.layers(0);
+  EXPECT_EQ(layer_src_b->id(), layer_update.layers(1).id());
+  proto::LayerProperties dest_b = layer_update.layers(1);
+  EXPECT_EQ(layer_src_b_mask->id(), layer_update.layers(2).id());
+  proto::LayerProperties dest_b_mask = layer_update.layers(2);
+
+  // Ensure the properties and dependants metadata is correctly serialized.
+  EXPECT_FALSE(dest_root.needs_push_properties());
+  EXPECT_EQ(1, dest_root.num_dependents_need_push_properties());
+  EXPECT_FALSE(dest_root.has_base());
+
+  EXPECT_TRUE(dest_b.needs_push_properties());
+  EXPECT_EQ(1, dest_b.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_b.has_base());
+
+  EXPECT_TRUE(dest_b_mask.needs_push_properties());
+  EXPECT_EQ(0, dest_b_mask.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_b_mask.has_base());
+}
+
+TEST(LayerProtoConverterTest, DeserializeLayerProperties) {
+  /* Testing deserialization of properties for a tree that looks like this:
+          root*+
+          /  \
+         a    b+
+               \
+                c*
+     Layers marked with * have changed properties.
+     Layers marked with + have descendants with changed properties.
+  */
+  proto::LayerUpdate updates;
+
+  scoped_refptr<Layer> root = Layer::Create(LayerSettings());
+  proto::LayerProperties* root_props = updates.add_layers();
+  root_props->set_id(root->id());
+  root_props->set_needs_push_properties(true);
+  root_props->set_num_dependents_need_push_properties(1);
+  root_props->mutable_base();
+
+  scoped_refptr<Layer> a = Layer::Create(LayerSettings());
+  proto::LayerProperties* a_props = updates.add_layers();
+  a_props->set_id(a->id());
+  a_props->set_needs_push_properties(false);
+  a_props->set_num_dependents_need_push_properties(0);
+  root->AddChild(a);
+
+  scoped_refptr<Layer> b = Layer::Create(LayerSettings());
+  proto::LayerProperties* b_props = updates.add_layers();
+  b_props->set_id(b->id());
+  b_props->set_needs_push_properties(false);
+  b_props->set_num_dependents_need_push_properties(1);
+  root->AddChild(b);
+
+  scoped_refptr<Layer> c = Layer::Create(LayerSettings());
+  proto::LayerProperties* c_props = updates.add_layers();
+  c_props->set_id(c->id());
+  c_props->set_needs_push_properties(true);
+  c_props->set_num_dependents_need_push_properties(0);
+  c_props->mutable_base();
+  b->AddChild(c);
+
+  LayerProtoConverter::DeserializeLayerProperties(root.get(), updates);
+
+  EXPECT_TRUE(root->needs_push_properties());
+  EXPECT_TRUE(root->descendant_needs_push_properties());
+
+  EXPECT_FALSE(a->needs_push_properties());
+  EXPECT_FALSE(a->descendant_needs_push_properties());
+
+  EXPECT_FALSE(b->needs_push_properties());
+  EXPECT_TRUE(b->descendant_needs_push_properties());
+
+  EXPECT_TRUE(c->needs_push_properties());
+  EXPECT_FALSE(c->descendant_needs_push_properties());
+}
+
 }  // namespace cc
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 12aa514..8117de82 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -1567,5 +1567,140 @@
   EXPECT_EQ(nullptr, layer_dest_root->replica_layer());
 }
 
+TEST_F(LayerTest, SimplePropertiesSerialization) {
+  /* Testing serialization of properties for a tree that looks like this:
+          root+
+          /  \
+         a*   b*+[mask:*,replica]
+        /      \
+       c        d*
+     Layers marked with * have changed properties.
+     Layers marked with + have descendants with changed properties.
+     Layer b also has a mask layer and a replica layer.
+  */
+  scoped_refptr<Layer> layer_src_root = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_a = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b_mask = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_b_replica = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_c = Layer::Create(LayerSettings());
+  scoped_refptr<Layer> layer_src_d = Layer::Create(LayerSettings());
+  layer_src_root->AddChild(layer_src_a);
+  layer_src_root->AddChild(layer_src_b);
+  layer_src_a->AddChild(layer_src_c);
+  layer_src_b->AddChild(layer_src_d);
+  layer_src_b->SetMaskLayer(layer_src_b_mask.get());
+  layer_src_b->SetReplicaLayer(layer_src_b_replica.get());
+
+  layer_src_a->SetNeedsPushProperties();
+  layer_src_b->SetNeedsPushProperties();
+  layer_src_b_mask->SetNeedsPushProperties();
+  layer_src_d->SetNeedsPushProperties();
+
+  // Only layers with descendants that require pushing properties will
+  // return true from ToLayerPropertiesProto.
+  proto::LayerUpdate layer_update_root;
+  EXPECT_TRUE(layer_src_root->ToLayerPropertiesProto(&layer_update_root));
+  proto::LayerUpdate layer_update_a;
+  EXPECT_FALSE(layer_src_a->ToLayerPropertiesProto(&layer_update_a));
+  proto::LayerUpdate layer_update_b;
+  EXPECT_TRUE(layer_src_b->ToLayerPropertiesProto(&layer_update_b));
+  proto::LayerUpdate layer_update_b_mask;
+  EXPECT_FALSE(layer_src_b_mask->ToLayerPropertiesProto(&layer_update_b_mask));
+  proto::LayerUpdate layer_update_b_replica;
+  EXPECT_FALSE(
+      layer_src_b_replica->ToLayerPropertiesProto(&layer_update_b_replica));
+  proto::LayerUpdate layer_update_c;
+  EXPECT_FALSE(layer_src_c->ToLayerPropertiesProto(&layer_update_c));
+  proto::LayerUpdate layer_update_d;
+  EXPECT_FALSE(layer_src_d->ToLayerPropertiesProto(&layer_update_d));
+
+  // All flags for pushing properties should have been cleared.
+  EXPECT_FALSE(layer_src_root->needs_push_properties());
+  EXPECT_FALSE(layer_src_root->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_a->needs_push_properties());
+  EXPECT_FALSE(layer_src_a->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b->needs_push_properties());
+  EXPECT_FALSE(layer_src_b->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b_mask->needs_push_properties());
+  EXPECT_FALSE(layer_src_b_mask->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_b_replica->needs_push_properties());
+  EXPECT_FALSE(layer_src_b_replica->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_c->needs_push_properties());
+  EXPECT_FALSE(layer_src_c->descendant_needs_push_properties());
+  EXPECT_FALSE(layer_src_d->needs_push_properties());
+  EXPECT_FALSE(layer_src_d->descendant_needs_push_properties());
+
+  // Only 5 of the layers should have been serialized.
+  ASSERT_EQ(1, layer_update_root.layers_size());
+  EXPECT_EQ(layer_src_root->id(), layer_update_root.layers(0).id());
+  proto::LayerProperties dest_root = layer_update_root.layers(0);
+  ASSERT_EQ(1, layer_update_a.layers_size());
+  EXPECT_EQ(layer_src_a->id(), layer_update_a.layers(0).id());
+  proto::LayerProperties dest_a = layer_update_a.layers(0);
+  ASSERT_EQ(1, layer_update_b.layers_size());
+  EXPECT_EQ(layer_src_b->id(), layer_update_b.layers(0).id());
+  proto::LayerProperties dest_b = layer_update_b.layers(0);
+  ASSERT_EQ(1, layer_update_b_mask.layers_size());
+  EXPECT_EQ(layer_src_b_mask->id(), layer_update_b_mask.layers(0).id());
+  proto::LayerProperties dest_b_mask = layer_update_b_mask.layers(0);
+  EXPECT_EQ(0, layer_update_b_replica.layers_size());
+  EXPECT_EQ(0, layer_update_c.layers_size());
+  ASSERT_EQ(1, layer_update_d.layers_size());
+  EXPECT_EQ(layer_src_d->id(), layer_update_d.layers(0).id());
+  proto::LayerProperties dest_d = layer_update_d.layers(0);
+
+  // Ensure the properties and dependants metadata is correctly serialized.
+  EXPECT_FALSE(dest_root.needs_push_properties());
+  EXPECT_EQ(2, dest_root.num_dependents_need_push_properties());
+  EXPECT_FALSE(dest_root.has_base());
+
+  EXPECT_TRUE(dest_a.needs_push_properties());
+  EXPECT_EQ(0, dest_a.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_a.has_base());
+
+  EXPECT_TRUE(dest_b.needs_push_properties());
+  EXPECT_EQ(2, dest_b.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_b.has_base());
+
+  EXPECT_TRUE(dest_d.needs_push_properties());
+  EXPECT_EQ(0, dest_d.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_d.has_base());
+
+  EXPECT_TRUE(dest_b_mask.needs_push_properties());
+  EXPECT_EQ(0, dest_b_mask.num_dependents_need_push_properties());
+  EXPECT_TRUE(dest_b_mask.has_base());
+}
+
+TEST_F(LayerTest, SimplePropertiesDeserialization) {
+  scoped_refptr<Layer> layer = Layer::Create(LayerSettings());
+  proto::LayerProperties properties;
+  properties.set_id(layer->id());
+
+  properties.set_needs_push_properties(true);
+  properties.set_num_dependents_need_push_properties(2);
+  properties.mutable_base();
+  layer->FromLayerPropertiesProto(properties);
+  EXPECT_TRUE(layer->needs_push_properties());
+  EXPECT_TRUE(layer->descendant_needs_push_properties());
+
+  properties.set_needs_push_properties(false);
+  properties.mutable_base()->Clear();
+  layer->FromLayerPropertiesProto(properties);
+  EXPECT_FALSE(layer->needs_push_properties());
+  EXPECT_TRUE(layer->descendant_needs_push_properties());
+
+  properties.set_num_dependents_need_push_properties(0);
+  layer->FromLayerPropertiesProto(properties);
+  EXPECT_FALSE(layer->needs_push_properties());
+  EXPECT_FALSE(layer->descendant_needs_push_properties());
+
+  properties.set_needs_push_properties(true);
+  properties.mutable_base();
+  layer->FromLayerPropertiesProto(properties);
+  EXPECT_TRUE(layer->needs_push_properties());
+  EXPECT_FALSE(layer->descendant_needs_push_properties());
+}
+
 }  // namespace
 }  // namespace cc
diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc
index 842688e..5459921 100644
--- a/cc/layers/layer_utils_unittest.cc
+++ b/cc/layers/layer_utils_unittest.cc
@@ -29,8 +29,8 @@
                    &shared_bitmap_manager_,
                    &task_graph_runner_),
         root_(CreateThreeNodeTree(&host_impl_)),
-        parent_(root_->children()[0]),
-        child_(parent_->children()[0]) {}
+        parent_(root_->children()[0].get()),
+        child_(parent_->children()[0].get()) {}
 
   LayerImpl* root() { return root_.get(); }
   LayerImpl* parent() { return parent_; }
diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h
index 9cd7a21..4b113bc 100644
--- a/cc/layers/picture_layer_impl.h
+++ b/cc/layers/picture_layer_impl.h
@@ -10,7 +10,6 @@
 #include <vector>
 
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/layers/layer_impl.h"
 #include "cc/tiles/picture_layer_tiling.h"
 #include "cc/tiles/picture_layer_tiling_set.h"
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index cb8bc3ac..fc81bb9 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -248,7 +248,8 @@
       pending_layer->SetDrawsContent(true);
     } else {
       pending_layer.reset(static_cast<FakePictureLayerImpl*>(
-          pending_root->RemoveChild(pending_root->children()[0]).release()));
+          pending_root->RemoveChild(pending_root->children()[0].get())
+              .release()));
       if (!tile_size.IsEmpty())
         pending_layer->set_fixed_tile_size(tile_size);
     }
@@ -3974,7 +3975,7 @@
 
   // Partial occlusion.
   pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1));
-  LayerImpl* layer1 = pending_layer_->children()[0];
+  LayerImpl* layer1 = pending_layer_->children()[0].get();
   layer1->SetBounds(layer_bounds);
   layer1->SetDrawsContent(true);
   layer1->SetContentsOpaque(true);
@@ -4068,7 +4069,7 @@
 
   // Partial occlusion.
   pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1));
-  LayerImpl* layer1 = pending_layer_->children()[0];
+  LayerImpl* layer1 = pending_layer_->children()[0].get();
   layer1->SetBounds(layer_bounds);
   layer1->SetDrawsContent(true);
   layer1->SetContentsOpaque(true);
@@ -4164,7 +4165,7 @@
   ASSERT_TRUE(pending_layer_->CanHaveTilings());
 
   pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1));
-  LayerImpl* layer1 = pending_layer_->children()[0];
+  LayerImpl* layer1 = pending_layer_->children()[0].get();
   layer1->SetBounds(layer_bounds);
   layer1->SetDrawsContent(true);
   layer1->SetContentsOpaque(true);
@@ -4239,7 +4240,7 @@
 
   // Partially occlude the active layer.
   pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2));
-  LayerImpl* layer1 = pending_layer_->children()[0];
+  LayerImpl* layer1 = pending_layer_->children()[0].get();
   layer1->SetBounds(layer_bounds);
   layer1->SetDrawsContent(true);
   layer1->SetContentsOpaque(true);
@@ -4332,7 +4333,7 @@
 
   // Partially occlude the active layer.
   pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2));
-  LayerImpl* active_occluding_layer = pending_layer_->children()[0];
+  LayerImpl* active_occluding_layer = pending_layer_->children()[0].get();
   active_occluding_layer->SetBounds(layer_bounds);
   active_occluding_layer->SetDrawsContent(true);
   active_occluding_layer->SetContentsOpaque(true);
@@ -4347,7 +4348,7 @@
 
   // Partially occlude the pending layer in a different way.
   pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 3));
-  LayerImpl* pending_occluding_layer = pending_layer_->children()[0];
+  LayerImpl* pending_occluding_layer = pending_layer_->children()[0].get();
   pending_occluding_layer->SetBounds(layer_bounds);
   pending_occluding_layer->SetDrawsContent(true);
   pending_occluding_layer->SetContentsOpaque(true);
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index f4b9411..b4990b1 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_unittest.cc
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/layers/append_quads_data.h"
 #include "cc/layers/layer_impl.h"
 #include "cc/layers/render_pass_sink.h"
@@ -180,7 +179,7 @@
   render_surface->AppendRenderPasses(&pass_sink);
 
   ASSERT_EQ(1u, pass_sink.RenderPasses().size());
-  RenderPass* pass = pass_sink.RenderPasses()[0];
+  RenderPass* pass = pass_sink.RenderPasses()[0].get();
 
   EXPECT_EQ(RenderPassId(2, 0), pass->id);
   EXPECT_EQ(content_rect, pass->output_rect);
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 53e2714b..3ebf090 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -153,7 +153,7 @@
       0, 0);
   PaintedScrollbarLayerImpl* scrollbar_layer_impl =
       static_cast<PaintedScrollbarLayerImpl*>(
-          layer_impl_tree_root->children()[1]);
+          layer_impl_tree_root->children()[1].get());
 
   // When the scrollbar is not an overlay scrollbar, the scroll should be
   // responded to on the main thread as the compositor does not yet implement
@@ -169,7 +169,7 @@
       layer_settings(), layer_tree_host_.get(), scrollbar.Pass(), false, false,
       0, 0);
   scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>(
-      layer_impl_tree_root->children()[1]);
+      layer_impl_tree_root->children()[1].get());
 
   // The user shouldn't be able to drag an overlay scrollbar and the scroll
   // may be handled in the compositor.
@@ -207,7 +207,7 @@
 
   ScrollbarLayerImplBase* cc_scrollbar_layer =
       static_cast<PaintedScrollbarLayerImpl*>(
-          layer_impl_tree_root->children()[1]);
+          layer_impl_tree_root->children()[1].get());
 
   EXPECT_EQ(10.f, cc_scrollbar_layer->current_pos());
   EXPECT_EQ(30, cc_scrollbar_layer->scroll_layer_length() -
@@ -227,7 +227,7 @@
   EXPECT_EQ(300, cc_scrollbar_layer->scroll_layer_length() -
                      cc_scrollbar_layer->clip_layer_length());
 
-  LayerImpl* scroll_layer_impl = layer_impl_tree_root->children()[0];
+  LayerImpl* scroll_layer_impl = layer_impl_tree_root->children()[0].get();
   scroll_layer_impl->ScrollBy(gfx::Vector2d(12, 34));
 
   EXPECT_EQ(112.f, cc_scrollbar_layer->current_pos());
@@ -240,9 +240,9 @@
     scrollbar_layer->UpdateInternalContentScale();                           \
     scrollbar_layer->UpdateThumbAndTrackGeometry();                          \
     root_clip_layer_impl = layer_tree_host_->CommitAndCreateLayerImplTree(); \
-    root_layer_impl = root_clip_layer_impl->children()[0];                   \
+    root_layer_impl = root_clip_layer_impl->children()[0].get();             \
     scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>(          \
-        root_layer_impl->children()[1]);                                     \
+        root_layer_impl->children()[1].get());                               \
   } while (false)
 
 TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
@@ -375,7 +375,7 @@
       kThumbThickness, kTrackStart);
   ScrollbarLayerImplBase* scrollbar_layer_impl =
       static_cast<SolidColorScrollbarLayerImpl*>(
-          layer_impl_tree_root->children()[1]);
+          layer_impl_tree_root->children()[1].get());
   scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness));
   scrollbar_layer_impl->SetCurrentPos(10.f);
   scrollbar_layer_impl->SetClipLayerLength(200 / 3.f);
@@ -449,10 +449,10 @@
   }
   LayerImpl* layer_impl_tree_root =
       layer_tree_host_->CommitAndCreateLayerImplTree();
-  LayerImpl* scroll_layer_impl = layer_impl_tree_root->children()[0];
+  LayerImpl* scroll_layer_impl = layer_impl_tree_root->children()[0].get();
 
-  auto* scrollbar_layer_impl =
-      static_cast<ScrollbarLayerImplBase*>(scroll_layer_impl->children()[1]);
+  auto* scrollbar_layer_impl = static_cast<ScrollbarLayerImplBase*>(
+      scroll_layer_impl->children()[1].get());
 
   // Choose layer bounds to give max_scroll_offset = (8, 8).
   layer_impl_tree_root->SetBounds(gfx::Size(2, 2));
diff --git a/cc/output/bsp_tree.cc b/cc/output/bsp_tree.cc
index a32c3f49..f24e99bb 100644
--- a/cc/output/bsp_tree.cc
+++ b/cc/output/bsp_tree.cc
@@ -8,7 +8,6 @@
 
 #include "base/memory/scoped_ptr.h"
 #include "cc/base/container_util.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/bsp_compare_result.h"
 #include "cc/quads/draw_polygon.h"
 
diff --git a/cc/output/bsp_tree.h b/cc/output/bsp_tree.h
index 0a0b948..efe4cc51 100644
--- a/cc/output/bsp_tree.h
+++ b/cc/output/bsp_tree.h
@@ -9,7 +9,6 @@
 #include <vector>
 
 #include "base/memory/scoped_ptr.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/bsp_compare_result.h"
 #include "cc/quads/draw_polygon.h"
 
@@ -19,8 +18,8 @@
   // This represents the splitting plane.
   scoped_ptr<DrawPolygon> node_data;
   // This represents any coplanar geometry we found while building the BSP.
-  ScopedPtrVector<DrawPolygon> coplanars_front;
-  ScopedPtrVector<DrawPolygon> coplanars_back;
+  std::vector<scoped_ptr<DrawPolygon>> coplanars_front;
+  std::vector<scoped_ptr<DrawPolygon>> coplanars_back;
 
   scoped_ptr<BspNode> back_child;
   scoped_ptr<BspNode> front_child;
@@ -46,7 +45,7 @@
  private:
   scoped_ptr<BspNode> root_;
 
-  void FromList(ScopedPtrVector<DrawPolygon>* list);
+  void FromList(std::vector<scoped_ptr<DrawPolygon>>* list);
   void BuildTree(BspNode* node, std::deque<scoped_ptr<DrawPolygon>>* data);
 
   template <typename ActionHandlerType>
@@ -61,17 +60,17 @@
       const BspNode* node,
       const BspNode* first_child,
       const BspNode* second_child,
-      const ScopedPtrVector<DrawPolygon>& first_coplanars,
-      const ScopedPtrVector<DrawPolygon>& second_coplanars) const {
+      const std::vector<scoped_ptr<DrawPolygon>>& first_coplanars,
+      const std::vector<scoped_ptr<DrawPolygon>>& second_coplanars) const {
     if (first_child) {
       WalkInOrderRecursion(action_handler, first_child);
     }
     for (size_t i = 0; i < first_coplanars.size(); i++) {
-      WalkInOrderAction(action_handler, first_coplanars[i]);
+      WalkInOrderAction(action_handler, first_coplanars[i].get());
     }
     WalkInOrderAction(action_handler, node->node_data.get());
     for (size_t i = 0; i < second_coplanars.size(); i++) {
-      WalkInOrderAction(action_handler, second_coplanars[i]);
+      WalkInOrderAction(action_handler, second_coplanars[i].get());
     }
     if (second_child) {
       WalkInOrderRecursion(action_handler, second_child);
diff --git a/cc/output/bsp_tree_unittest.cc b/cc/output/bsp_tree_unittest.cc
index 18e65a54..1e34ea14 100644
--- a/cc/output/bsp_tree_unittest.cc
+++ b/cc/output/bsp_tree_unittest.cc
@@ -6,7 +6,6 @@
 
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/bsp_tree.h"
 #include "cc/output/bsp_walk_action.h"
 #include "cc/quads/draw_polygon.h"
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index a1d3a65a..9ec397f 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -151,7 +151,7 @@
   for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i)
     render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>(
         render_passes_in_draw_order[i]->id,
-        RenderPassTextureSize(render_passes_in_draw_order[i])));
+        RenderPassTextureSize(render_passes_in_draw_order[i].get())));
 
   std::vector<RenderPassId> passes_to_delete;
   for (auto pass_iter = render_pass_textures_.begin();
@@ -198,7 +198,8 @@
       "Renderer4.renderPassCount",
       base::saturated_cast<int>(render_passes_in_draw_order->size()));
 
-  const RenderPass* root_render_pass = render_passes_in_draw_order->back();
+  const RenderPass* root_render_pass =
+      render_passes_in_draw_order->back().get();
   DCHECK(root_render_pass);
 
   DrawingFrame frame;
@@ -256,7 +257,7 @@
       // overlays and dont have any copy requests.
       if (frame.root_damage_rect.IsEmpty()) {
         bool handle_copy_requests = false;
-        for (auto* pass : *render_passes_in_draw_order) {
+        for (const auto& pass : *render_passes_in_draw_order) {
           if (!pass->copy_requests.empty()) {
             handle_copy_requests = true;
             break;
@@ -276,20 +277,17 @@
     }
   }
 
-  for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) {
-    RenderPass* pass = render_passes_in_draw_order->at(i);
-    DrawRenderPass(&frame, pass);
+  for (const auto& pass : *render_passes_in_draw_order) {
+    DrawRenderPass(&frame, pass.get());
 
-    for (ScopedPtrVector<CopyOutputRequest>::iterator it =
-             pass->copy_requests.begin();
-         it != pass->copy_requests.end();
-         ++it) {
-      if (it != pass->copy_requests.begin()) {
-        // Doing a readback is destructive of our state on Mac, so make sure
-        // we restore the state between readbacks. http://crbug.com/99393.
-        UseRenderPass(&frame, pass);
-      }
-      CopyCurrentRenderPassToBitmap(&frame, pass->copy_requests.take(it));
+    bool first_request = true;
+    for (auto& copy_request : pass->copy_requests) {
+      // Doing a readback is destructive of our state on Mac, so make sure
+      // we restore the state between readbacks. http://crbug.com/99393.
+      if (!first_request)
+        UseRenderPass(&frame, pass.get());
+      CopyCurrentRenderPassToBitmap(&frame, std::move(copy_request));
+      first_request = false;
     }
   }
   FinishDrawingFrame(&frame);
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 1677de1c..2b1b1f2 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -377,7 +377,8 @@
 
 GLRenderer::~GLRenderer() {
   while (!pending_async_read_pixels_.empty()) {
-    PendingAsyncReadPixels* pending_read = pending_async_read_pixels_.back();
+    PendingAsyncReadPixels* pending_read =
+        pending_async_read_pixels_.back().get();
     pending_read->finished_read_pixels_callback.Cancel();
     pending_async_read_pixels_.pop_back();
   }
@@ -2833,7 +2834,7 @@
     ++iter;
 
   DCHECK(iter != reverse_end);
-  PendingAsyncReadPixels* current_read = *iter;
+  PendingAsyncReadPixels* current_read = iter->get();
 
   uint8* src_pixels = NULL;
   scoped_ptr<SkBitmap> bitmap;
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index 25fae99..93b65b4 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -6,10 +6,10 @@
 #define CC_OUTPUT_GL_RENDERER_H_
 
 #include <deque>
+#include <vector>
 
 #include "base/cancelable_callback.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/direct_renderer.h"
 #include "cc/output/gl_renderer_draw_cache.h"
 #include "cc/output/program_binding.h"
@@ -260,8 +260,8 @@
   void ScheduleCALayers(DrawingFrame* frame);
   void ScheduleOverlays(DrawingFrame* frame);
 
-  typedef ScopedPtrVector<ResourceProvider::ScopedReadLockGL>
-      OverlayResourceLockList;
+  using OverlayResourceLockList =
+      std::vector<scoped_ptr<ResourceProvider::ScopedReadLockGL>>;
   OverlayResourceLockList pending_overlay_resources_;
   OverlayResourceLockList in_use_overlay_resources_;
   OverlayResourceLockList previous_swap_overlay_resources_;
@@ -501,7 +501,7 @@
   int highp_threshold_cache_;
 
   struct PendingAsyncReadPixels;
-  ScopedPtrVector<PendingAsyncReadPixels> pending_async_read_pixels_;
+  std::vector<scoped_ptr<PendingAsyncReadPixels>> pending_async_read_pixels_;
 
   scoped_ptr<ResourceProvider::ScopedWriteLockGL> current_framebuffer_lock_;
 
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index bd9d6b37..2140f54 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -59,7 +59,9 @@
 
 class GLRendererTest : public testing::Test {
  protected:
-  RenderPass* root_render_pass() { return render_passes_in_draw_order_.back(); }
+  RenderPass* root_render_pass() {
+    return render_passes_in_draw_order_.back().get();
+  }
 
   RenderPassList render_passes_in_draw_order_;
 };
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index 26c2ffe..21764552 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -45,10 +45,6 @@
 //      surface (on the compositor thread) and go back to step 1.
 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider {
  public:
-  enum {
-    DEFAULT_MAX_FRAMES_PENDING = 2
-  };
-
   OutputSurface(const scoped_refptr<ContextProvider>& context_provider,
                 const scoped_refptr<ContextProvider>& worker_context_provider,
                 scoped_ptr<SoftwareOutputDevice> software_device);
@@ -67,7 +63,7 @@
   struct Capabilities {
     Capabilities()
         : delegated_rendering(false),
-          max_frames_pending(0),
+          max_frames_pending(1),
           adjust_deadline_for_parent(true),
           uses_default_gl_framebuffer(true),
           flipped_output_surface(false),
diff --git a/cc/output/overlay_processor.cc b/cc/output/overlay_processor.cc
index 2eea63b..43a064fb 100644
--- a/cc/output/overlay_processor.cc
+++ b/cc/output/overlay_processor.cc
@@ -31,7 +31,7 @@
     RenderPassList* render_passes,
     CALayerOverlayList* ca_layer_overlays,
     OverlayCandidateList* overlay_candidates) {
-  RenderPass* root_render_pass = render_passes->back();
+  RenderPass* root_render_pass = render_passes->back().get();
 
   OverlayCandidateValidator* overlay_validator =
       surface_->GetOverlayCandidateValidator();
@@ -55,7 +55,7 @@
                                           RenderPassList* render_passes,
                                           OverlayCandidateList* candidates,
                                           gfx::Rect* damage_rect) {
-  for (auto strategy : strategies_) {
+  for (const auto& strategy : strategies_) {
     if (strategy->Attempt(resource_provider, render_passes, candidates,
                           damage_rect)) {
       return;
diff --git a/cc/output/overlay_processor.h b/cc/output/overlay_processor.h
index fbdfd263..020c3c7 100644
--- a/cc/output/overlay_processor.h
+++ b/cc/output/overlay_processor.h
@@ -32,7 +32,7 @@
                          OverlayCandidateList* candidates,
                          gfx::Rect* damage_rect) = 0;
   };
-  typedef ScopedPtrVector<Strategy> StrategyList;
+  using StrategyList = std::vector<scoped_ptr<Strategy>>;
 
   explicit OverlayProcessor(OutputSurface* surface);
   virtual ~OverlayProcessor();
diff --git a/cc/output/overlay_strategy_sandwich.cc b/cc/output/overlay_strategy_sandwich.cc
index cacb696..6aef45df 100644
--- a/cc/output/overlay_strategy_sandwich.cc
+++ b/cc/output/overlay_strategy_sandwich.cc
@@ -47,10 +47,12 @@
   QuadList& quad_list = render_passes->back()->quad_list;
   for (auto it = quad_list.begin(); it != quad_list.end();) {
     OverlayCandidate candidate;
-    if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate))
-      it = TryOverlay(render_passes->back(), candidate_list, candidate, it);
-    else
+    if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate)) {
+      it = TryOverlay(render_passes->back().get(), candidate_list, candidate,
+                      it);
+    } else {
       ++it;
+    }
   }
 
   return candidate_list->size() > 1;
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc
index 29403ee..444aecf 100644
--- a/cc/output/overlay_unittest.cc
+++ b/cc/output/overlay_unittest.cc
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 #include "cc/base/region.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/compositor_frame_metadata.h"
 #include "cc/output/gl_renderer.h"
 #include "cc/output/output_surface.h"
@@ -310,8 +309,8 @@
                                    const RenderPassList& actual_list) {
   EXPECT_EQ(expected_list.size(), actual_list.size());
   for (size_t i = 0; i < actual_list.size(); ++i) {
-    RenderPass* expected = expected_list[i];
-    RenderPass* actual = actual_list[i];
+    RenderPass* expected = expected_list[i].get();
+    RenderPass* actual = actual_list[i].get();
 
     EXPECT_EQ(expected->id, actual->id);
     EXPECT_EQ(expected->output_rect, actual->output_rect);
@@ -419,7 +418,7 @@
   ASSERT_EQ(1U, pass_list.size());
   ASSERT_EQ(1U, candidate_list.size());
 
-  RenderPass* main_pass = pass_list.back();
+  RenderPass* main_pass = pass_list.back().get();
   // Check that the quad is gone.
   EXPECT_EQ(2U, main_pass->quad_list.size());
   const QuadList& quad_list = main_pass->quad_list;
@@ -558,7 +557,7 @@
   ASSERT_EQ(1U, pass_list.size());
   ASSERT_EQ(2U, candidate_list.size());
 
-  RenderPass* main_pass = pass_list.back();
+  RenderPass* main_pass = pass_list.back().get();
   // Check that the quad is gone.
   EXPECT_EQ(3U, main_pass->quad_list.size());
   const QuadList& quad_list = main_pass->quad_list;
@@ -605,7 +604,7 @@
   pass_list.push_back(pass.Pass());
 
   // Run the overlay strategy on that input.
-  RenderPass* main_pass = pass_list.back();
+  RenderPass* main_pass = pass_list.back().get();
   OverlayCandidateList candidate_list;
   EXPECT_EQ(4U, main_pass->quad_list.size());
   overlay_processor_->ProcessForOverlays(resource_provider_.get(), &pass_list,
@@ -699,7 +698,7 @@
   ASSERT_EQ(1U, pass_list.size());
   ASSERT_EQ(1U, candidate_list.size());
 
-  RenderPass* main_pass = pass_list.back();
+  RenderPass* main_pass = pass_list.back().get();
   // Check that the quad is gone.
   EXPECT_EQ(2U, main_pass->quad_list.size());
   const QuadList& quad_list = main_pass->quad_list;
@@ -1346,7 +1345,8 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
   CALayerOverlayList ca_layer_list;
-  OverlayCandidateList overlay_list(BackbufferOverlayList(pass_list.back()));
+  OverlayCandidateList overlay_list(
+      BackbufferOverlayList(pass_list.back().get()));
   overlay_processor_->ProcessForCALayers(resource_provider_.get(), &pass_list,
                                          &ca_layer_list, &overlay_list);
   ASSERT_EQ(1U, pass_list.size());
@@ -1366,7 +1366,8 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
   CALayerOverlayList ca_layer_list;
-  OverlayCandidateList overlay_list(BackbufferOverlayList(pass_list.back()));
+  OverlayCandidateList overlay_list(
+      BackbufferOverlayList(pass_list.back().get()));
   overlay_processor_->ProcessForCALayers(resource_provider_.get(), &pass_list,
                                          &ca_layer_list, &overlay_list);
   ASSERT_EQ(1U, pass_list.size());
@@ -1386,7 +1387,8 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
   CALayerOverlayList ca_layer_list;
-  OverlayCandidateList overlay_list(BackbufferOverlayList(pass_list.back()));
+  OverlayCandidateList overlay_list(
+      BackbufferOverlayList(pass_list.back().get()));
   overlay_processor_->ProcessForCALayers(resource_provider_.get(), &pass_list,
                                          &ca_layer_list, &overlay_list);
   ASSERT_EQ(1U, pass_list.size());
@@ -1407,7 +1409,8 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
   CALayerOverlayList ca_layer_list;
-  OverlayCandidateList overlay_list(BackbufferOverlayList(pass_list.back()));
+  OverlayCandidateList overlay_list(
+      BackbufferOverlayList(pass_list.back().get()));
   overlay_processor_->ProcessForCALayers(resource_provider_.get(), &pass_list,
                                          &ca_layer_list, &overlay_list);
   ASSERT_EQ(1U, pass_list.size());
@@ -1427,7 +1430,8 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
   CALayerOverlayList ca_layer_list;
-  OverlayCandidateList overlay_list(BackbufferOverlayList(pass_list.back()));
+  OverlayCandidateList overlay_list(
+      BackbufferOverlayList(pass_list.back().get()));
   overlay_processor_->ProcessForCALayers(resource_provider_.get(), &pass_list,
                                          &ca_layer_list, &overlay_list);
 
@@ -1447,7 +1451,8 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
   CALayerOverlayList ca_layer_list;
-  OverlayCandidateList overlay_list(BackbufferOverlayList(pass_list.back()));
+  OverlayCandidateList overlay_list(
+      BackbufferOverlayList(pass_list.back().get()));
   overlay_processor_->ProcessForCALayers(resource_provider_.get(), &pass_list,
                                          &ca_layer_list, &overlay_list);
   ASSERT_EQ(1U, pass_list.size());
diff --git a/cc/output/renderer.h b/cc/output/renderer.h
index 96406a23..82b3ae3 100644
--- a/cc/output/renderer.h
+++ b/cc/output/renderer.h
@@ -7,7 +7,6 @@
 
 #include "base/basictypes.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/renderer_capabilities.h"
 #include "cc/output/renderer_settings.h"
 #include "ui/gfx/geometry/rect.h"
@@ -21,7 +20,7 @@
 class ScopedResource;
 class Task;
 
-typedef ScopedPtrVector<RenderPass> RenderPassList;
+typedef std::vector<scoped_ptr<RenderPass>> RenderPassList;
 
 struct RendererCapabilitiesImpl {
   RendererCapabilitiesImpl();
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index 1bf4da2d..6f337c3 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -2833,8 +2833,7 @@
 
   // Check that the child pass remains unflipped.
   EXPECT_TRUE(this->RunPixelTestWithReadbackTarget(
-      &pass_list,
-      pass_list.front(),
+      &pass_list, pass_list.front().get(),
       base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
       ExactPixelComparator(true)));
 }
@@ -2887,11 +2886,9 @@
                          this->device_viewport_size_.width() / 2,
                          this->device_viewport_size_.height() / 2);
   EXPECT_TRUE(this->RunPixelTestWithReadbackTargetAndArea(
-      &pass_list,
-      pass_list.front(),
+      &pass_list, pass_list.front().get(),
       base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")),
-      ExactPixelComparator(true),
-      &capture_rect));
+      ExactPixelComparator(true), &capture_rect));
 }
 
 TEST_F(GLRendererPixelTest, TextureQuadBatching) {
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index 7cc9960..8e92e8d1 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -219,6 +219,7 @@
 
 bool SoftwareRenderer::IsSoftwareResource(ResourceId resource_id) const {
   switch (resource_provider_->GetResourceType(resource_id)) {
+    case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER:
     case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE:
       return false;
     case ResourceProvider::RESOURCE_TYPE_BITMAP:
diff --git a/cc/output/texture_mailbox_deleter.cc b/cc/output/texture_mailbox_deleter.cc
index 642495f..27154c73 100644
--- a/cc/output/texture_mailbox_deleter.cc
+++ b/cc/output/texture_mailbox_deleter.cc
@@ -63,8 +63,7 @@
   // class is alive. So we guard it with a WeakPtr.
   ReleaseCallback run_impl_callback(
       base::Bind(&TextureMailboxDeleter::RunDeleteTextureOnImplThread,
-                 weak_ptr_factory_.GetWeakPtr(),
-                 impl_callbacks_.back()));
+                 weak_ptr_factory_.GetWeakPtr(), impl_callbacks_.back().get()));
 
   // Provide a callback for the main thread that posts back to the impl
   // thread.
@@ -84,9 +83,9 @@
     const gpu::SyncToken& sync_token,
     bool is_lost) {
   for (size_t i = 0; i < impl_callbacks_.size(); ++i) {
-    if (impl_callbacks_.at(i) == impl_callback) {
+    if (impl_callbacks_[i].get() == impl_callback) {
       // Run the callback, then destroy it here on the impl thread.
-      impl_callbacks_.at(i)->Run(sync_token, is_lost);
+      impl_callbacks_[i]->Run(sync_token, is_lost);
       impl_callbacks_.erase(impl_callbacks_.begin() + i);
       return;
     }
diff --git a/cc/output/texture_mailbox_deleter.h b/cc/output/texture_mailbox_deleter.h
index c065c04..051ad34 100644
--- a/cc/output/texture_mailbox_deleter.h
+++ b/cc/output/texture_mailbox_deleter.h
@@ -5,9 +5,10 @@
 #ifndef CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_
 #define CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_
 
+#include <vector>
+
 #include "base/memory/weak_ptr.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 
 namespace base {
 class SingleThreadTaskRunner;
@@ -48,7 +49,7 @@
                                     bool is_lost);
 
   scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
-  ScopedPtrVector<SingleReleaseCallback> impl_callbacks_;
+  std::vector<scoped_ptr<SingleReleaseCallback>> impl_callbacks_;
   base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_;
 };
 
diff --git a/cc/proto/layer.proto b/cc/proto/layer.proto
index 74a243b4f..914ff8a9 100644
--- a/cc/proto/layer.proto
+++ b/cc/proto/layer.proto
@@ -28,3 +28,27 @@
   optional LayerNode mask_layer = 5;
   optional LayerNode replica_layer = 6;
 }
+
+// A container for a list of dirty layers.
+message LayerUpdate {
+  // A list of dirty layers.
+  repeated LayerProperties layers = 1;
+}
+
+message LayerProperties {
+  // required
+  optional int32 id = 1;
+  // required
+  optional bool needs_push_properties = 3;
+  // required
+  optional int32 num_dependents_need_push_properties = 4;
+
+  // The properties below are only read if |needs_push_properties| is set.
+  // The Layer base class and each descendant have different proto messages
+  // for their specific properties.
+  optional BaseLayerProperties base = 5;
+}
+
+message BaseLayerProperties {
+  // TODO(nyquist): Add all the required properties below. Huzzah!
+}
diff --git a/cc/quads/draw_polygon.cc b/cc/quads/draw_polygon.cc
index 02c12838..fc9876e 100644
--- a/cc/quads/draw_polygon.cc
+++ b/cc/quads/draw_polygon.cc
@@ -10,9 +10,6 @@
 #include "cc/quads/draw_quad.h"
 
 namespace {
-// This allows for some imperfection in the normal comparison when checking if
-// two pieces of geometry are coplanar.
-static const float coplanar_dot_epsilon = 0.001f;
 // This threshold controls how "thick" a plane is. If a point's distance is
 // <= |compare_threshold|, then it is considered on the plane. Only when this
 // boundary is crossed do we consider doing splitting.
@@ -101,44 +98,15 @@
 // Assumes that layers are split and there are no intersecting planes.
 BspCompareResult DrawPolygon::SideCompare(const DrawPolygon& a,
                                           const DrawPolygon& b) {
-  // Let's make sure that both of these are normalized.
-  DCHECK_GE(normalized_threshold, std::abs(a.normal_.LengthSquared() - 1.0f));
+  // Let's make sure that this is normalized.  Without this SignedPointDistance
+  // will not be right, but putting the check in there will validate it
+  // redundantly for each point.
   DCHECK_GE(normalized_threshold, std::abs(b.normal_.LengthSquared() - 1.0f));
-  // Right away let's check if they're coplanar
-  double dot = gfx::DotProduct(a.normal_, b.normal_);
-  float sign = 0.0f;
-  // This check assumes that the normals are normalized.
-  if (std::abs(dot) >= 1.0f - coplanar_dot_epsilon) {
-    // The normals are matching enough that we only have to test one point.
-    sign = b.SignedPointDistance(a.points_[0]);
-    // Is it on either side of the splitter?
-    if (sign < -compare_threshold) {
-      return BSP_BACK;
-    }
-
-    if (sign > compare_threshold) {
-      return BSP_FRONT;
-    }
-
-    // No it wasn't, so the sign of the dot product of the normals
-    // along with document order determines which side it goes on.
-    if (dot >= 0.0f) {
-      if (a.order_index_ < b.order_index_) {
-        return BSP_COPLANAR_FRONT;
-      }
-      return BSP_COPLANAR_BACK;
-    }
-
-    if (a.order_index_ < b.order_index_) {
-      return BSP_COPLANAR_BACK;
-    }
-    return BSP_COPLANAR_FRONT;
-  }
 
   int pos_count = 0;
   int neg_count = 0;
   for (size_t i = 0; i < a.points_.size(); i++) {
-    sign = gfx::DotProduct(a.points_[i] - b.points_[0], b.normal_);
+    float sign = b.SignedPointDistance(a.points_[i]);
 
     if (sign < -compare_threshold) {
       ++neg_count;
@@ -154,7 +122,19 @@
   if (pos_count) {
     return BSP_FRONT;
   }
-  return BSP_BACK;
+  if (neg_count) {
+    return BSP_BACK;
+  }
+
+  double dot = gfx::DotProduct(a.normal_, b.normal_);
+  if ((dot >= 0.0f && a.order_index_ >= b.order_index_) ||
+      (dot <= 0.0f && a.order_index_ <= b.order_index_)) {
+    // The sign of the dot product of the normals along with document order
+    // determine which side it goes on, the vertices are ambiguous.
+    return BSP_COPLANAR_BACK;
+  }
+
+  return BSP_COPLANAR_FRONT;
 }
 
 static bool LineIntersectPlane(const gfx::Point3F& line_start,
diff --git a/cc/quads/draw_polygon_unittest.cc b/cc/quads/draw_polygon_unittest.cc
index caf0f27..0fc25e3 100644
--- a/cc/quads/draw_polygon_unittest.cc
+++ b/cc/quads/draw_polygon_unittest.cc
@@ -54,6 +54,32 @@
 }
 
 // Two quads are definitely not touching and so no split should occur.
+TEST(DrawPolygonSplitTest, NotClearlyInFront) {
+  std::vector<gfx::Point3F> vertices_a;
+  vertices_a.push_back(gfx::Point3F(87.2f, 1185.0f, 0.9f));
+  vertices_a.push_back(gfx::Point3F(288.3f, 1185.0f, -0.7f));
+  vertices_a.push_back(gfx::Point3F(288.3f, 1196.0f, -0.7f));
+  vertices_a.push_back(gfx::Point3F(87.2f, 1196.0f, 0.9f));
+  gfx::Vector3dF normal_a = gfx::CrossProduct(vertices_a[1] - vertices_a[0],
+                                              vertices_a[1] - vertices_a[2]);
+  normal_a.Scale(1.0 / normal_a.Length());
+
+  std::vector<gfx::Point3F> vertices_b;
+  vertices_b.push_back(gfx::Point3F(62.1f, 1034.7f, 1.0f));
+  vertices_b.push_back(gfx::Point3F(313.4f, 1035.3f, -1.0f));
+  vertices_b.push_back(gfx::Point3F(313.4f, 1196.0f, -1.0f));
+  vertices_b.push_back(gfx::Point3F(62.1f, 1196.0f, 1.0f));
+  gfx::Vector3dF normal_b = gfx::CrossProduct(vertices_b[1] - vertices_b[0],
+                                              vertices_b[1] - vertices_b[2]);
+  normal_b.Scale(1.0 / normal_b.Length());
+
+  CREATE_NEW_DRAW_POLYGON(polygon_a, vertices_a, normal_a, 0);
+  CREATE_NEW_DRAW_POLYGON(polygon_b, vertices_b, normal_b, 1);
+
+  EXPECT_EQ(BSP_FRONT, DrawPolygon::SideCompare(polygon_b, polygon_a));
+}
+
+// Two quads are definitely not touching and so no split should occur.
 TEST(DrawPolygonSplitTest, NotTouchingNoSplit) {
   std::vector<gfx::Point3F> vertices_a;
   vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc
index dc79bb8..3737f3c 100644
--- a/cc/quads/render_pass.cc
+++ b/cc/quads/render_pass.cc
@@ -92,11 +92,9 @@
 }
 
 // static
-void RenderPass::CopyAll(const ScopedPtrVector<RenderPass>& in,
-                         ScopedPtrVector<RenderPass>* out) {
-  for (size_t i = 0; i < in.size(); ++i) {
-    RenderPass* source = in[i];
-
+void RenderPass::CopyAll(const std::vector<scoped_ptr<RenderPass>>& in,
+                         std::vector<scoped_ptr<RenderPass>>* out) {
+  for (const auto& source : in) {
     // Since we can't copy these, it's wrong to use CopyAll in a situation where
     // you may have copy_requests present.
     DCHECK_EQ(source->copy_requests.size(), 0u);
diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h
index 14caeba..bc64d74 100644
--- a/cc/quads/render_pass.h
+++ b/cc/quads/render_pass.h
@@ -6,13 +6,13 @@
 #define CC_QUADS_RENDER_PASS_H_
 
 #include <utility>
+#include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
 #include "base/containers/hash_tables.h"
 #include "cc/base/cc_export.h"
 #include "cc/base/list_container.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/quads/render_pass_id.h"
 #include "cc/surfaces/surface_id.h"
 #include "skia/ext/refptr.h"
@@ -64,8 +64,8 @@
   scoped_ptr<RenderPass> Copy(RenderPassId new_id) const;
 
   // A deep copy of the render passes in the list including the quads.
-  static void CopyAll(const ScopedPtrVector<RenderPass>& in,
-                      ScopedPtrVector<RenderPass>* out);
+  static void CopyAll(const std::vector<scoped_ptr<RenderPass>>& in,
+                      std::vector<scoped_ptr<RenderPass>>* out);
 
   void SetNew(RenderPassId id,
               const gfx::Rect& output_rect,
@@ -112,7 +112,7 @@
   // contents as a bitmap, and give a copy of the bitmap to each callback in
   // this list. This property should not be serialized between compositors, as
   // it only makes sense in the root compositor.
-  ScopedPtrVector<CopyOutputRequest> copy_requests;
+  std::vector<scoped_ptr<CopyOutputRequest>> copy_requests;
 
   QuadList quad_list;
   SharedQuadStateList shared_quad_state_list;
@@ -147,7 +147,7 @@
 }  // namespace BASE_HASH_NAMESPACE
 
 namespace cc {
-typedef ScopedPtrVector<RenderPass> RenderPassList;
+typedef std::vector<scoped_ptr<RenderPass>> RenderPassList;
 typedef base::hash_map<RenderPassId, RenderPass*> RenderPassIdHashMap;
 }  // namespace cc
 
diff --git a/cc/quads/render_pass_unittest.cc b/cc/quads/render_pass_unittest.cc
index dea89cc..d4c0bc7 100644
--- a/cc/quads/render_pass_unittest.cc
+++ b/cc/quads/render_pass_unittest.cc
@@ -5,7 +5,6 @@
 #include "cc/quads/render_pass.h"
 
 #include "cc/base/math_util.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/quads/render_pass_draw_quad.h"
 #include "cc/quads/solid_color_draw_quad.h"
@@ -28,15 +27,15 @@
   gfx::Rect damage_rect;
   bool has_transparent_background;
   std::vector<SurfaceId> referenced_surfaces;
-  ScopedPtrVector<CopyOutputRequest> copy_callbacks;
+  std::vector<scoped_ptr<CopyOutputRequest>> copy_callbacks;
 };
 
 static void CompareRenderPassLists(const RenderPassList& expected_list,
                                    const RenderPassList& actual_list) {
   EXPECT_EQ(expected_list.size(), actual_list.size());
   for (size_t i = 0; i < actual_list.size(); ++i) {
-    RenderPass* expected = expected_list[i];
-    RenderPass* actual = actual_list[i];
+    RenderPass* expected = expected_list[i].get();
+    RenderPass* actual = actual_list[i].get();
 
     EXPECT_EQ(expected->id, actual->id);
     EXPECT_EQ(expected->output_rect, actual->output_rect);
diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc
index c6f9cbb..9897b13 100644
--- a/cc/resources/resource_pool.cc
+++ b/cc/resources/resource_pool.cc
@@ -56,9 +56,9 @@
 
 ResourcePool::ResourcePool(ResourceProvider* resource_provider,
                            base::SingleThreadTaskRunner* task_runner,
-                           bool use_image_texture_target)
+                           bool use_gpu_memory_buffers)
     : resource_provider_(resource_provider),
-      use_image_texture_target_(use_image_texture_target),
+      use_gpu_memory_buffers_(use_gpu_memory_buffers),
       max_memory_usage_bytes_(0),
       max_resource_count_(0),
       in_use_memory_usage_bytes_(0),
@@ -116,8 +116,8 @@
   scoped_ptr<PoolResource> pool_resource =
       PoolResource::Create(resource_provider_);
 
-  if (use_image_texture_target_) {
-    pool_resource->AllocateWithImageTextureTarget(size, format);
+  if (use_gpu_memory_buffers_) {
+    pool_resource->AllocateWithGpuMemoryBuffer(size, format);
   } else {
     pool_resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
                             format);
diff --git a/cc/resources/resource_pool.h b/cc/resources/resource_pool.h
index 31653c4d..e5a21669 100644
--- a/cc/resources/resource_pool.h
+++ b/cc/resources/resource_pool.h
@@ -20,7 +20,7 @@
 
 class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider {
  public:
-  static scoped_ptr<ResourcePool> CreateForImageTextureTarget(
+  static scoped_ptr<ResourcePool> CreateForGpuMemoryBufferResources(
       ResourceProvider* resource_provider,
       base::SingleThreadTaskRunner* task_runner) {
     return make_scoped_ptr(
@@ -69,7 +69,7 @@
  protected:
   ResourcePool(ResourceProvider* resource_provider,
                base::SingleThreadTaskRunner* task_runner,
-               bool use_image_texture_target);
+               bool use_gpu_memory_buffers);
 
   bool ResourceUsageTooHigh();
 
@@ -108,7 +108,7 @@
   base::TimeTicks GetUsageTimeForLRUResource() const;
 
   ResourceProvider* resource_provider_;
-  bool use_image_texture_target_;
+  bool use_gpu_memory_buffers_;
   size_t max_memory_usage_bytes_;
   size_t max_resource_count_;
   size_t in_use_memory_usage_bytes_;
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 1cc6538..97d9344 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -65,6 +65,10 @@
 
 namespace {
 
+bool IsGpuResourceType(ResourceProvider::ResourceType type) {
+  return type != ResourceProvider::RESOURCE_TYPE_BITMAP;
+}
+
 GLenum TextureToStorageFormat(ResourceFormat format) {
   GLenum storage_format = GL_RGBA8_OES;
   switch (format) {
@@ -202,6 +206,7 @@
                                      GLenum target,
                                      GLenum filter,
                                      TextureHint hint,
+                                     ResourceType type,
                                      ResourceFormat format)
     : child_id(0),
       gl_id(texture_id),
@@ -229,11 +234,10 @@
       image_id(0),
       bound_image_id(0),
       hint(hint),
-      type(RESOURCE_TYPE_GL_TEXTURE),
+      type(type),
       format(format),
       shared_bitmap(NULL),
-      gpu_memory_buffer(NULL) {
-}
+      gpu_memory_buffer(NULL) {}
 
 ResourceProvider::Resource::Resource(uint8_t* pixels,
                                      SharedBitmap* bitmap,
@@ -344,7 +348,7 @@
     DeleteResourceInternal(resources_.begin(), FOR_SHUTDOWN);
 
   GLES2Interface* gl = ContextGL();
-  if (default_resource_type_ != RESOURCE_TYPE_GL_TEXTURE) {
+  if (!IsGpuResourceType(default_resource_type_)) {
     // We are not in GL mode, but double check before returning.
     DCHECK(!gl);
     return;
@@ -355,7 +359,7 @@
   // Check that all GL resources has been deleted.
   for (ResourceMap::const_iterator itr = resources_.begin();
        itr != resources_.end(); ++itr) {
-    DCHECK_NE(RESOURCE_TYPE_GL_TEXTURE, itr->second.type);
+    DCHECK(!IsGpuResourceType(itr->second.type));
   }
 #endif  // DCHECK_IS_ON()
 
@@ -386,11 +390,9 @@
                                             ResourceFormat format) {
   DCHECK(!size.IsEmpty());
   switch (default_resource_type_) {
+    case RESOURCE_TYPE_GPU_MEMORY_BUFFER:
     case RESOURCE_TYPE_GL_TEXTURE:
-      return CreateGLTexture(size, use_gpu_memory_buffer_resources_
-                                       ? GetImageTextureTarget(format)
-                                       : GL_TEXTURE_2D,
-                             hint, format);
+      return CreateGLTexture(size, hint, default_resource_type_, format);
     case RESOURCE_TYPE_BITMAP:
       DCHECK_EQ(RGBA_8888, format);
       return CreateBitmap(size);
@@ -400,14 +402,16 @@
   return 0;
 }
 
-ResourceId ResourceProvider::CreateResourceWithImageTextureTarget(
+ResourceId ResourceProvider::CreateGpuMemoryBufferResource(
     const gfx::Size& size,
     TextureHint hint,
     ResourceFormat format) {
   DCHECK(!size.IsEmpty());
   switch (default_resource_type_) {
+    case RESOURCE_TYPE_GPU_MEMORY_BUFFER:
     case RESOURCE_TYPE_GL_TEXTURE: {
-      return CreateGLTexture(size, GetImageTextureTarget(format), hint, format);
+      return CreateGLTexture(size, hint, RESOURCE_TYPE_GPU_MEMORY_BUFFER,
+                             format);
     }
     case RESOURCE_TYPE_BITMAP:
       DCHECK_EQ(RGBA_8888, format);
@@ -419,17 +423,21 @@
 }
 
 ResourceId ResourceProvider::CreateGLTexture(const gfx::Size& size,
-                                             GLenum target,
                                              TextureHint hint,
+                                             ResourceType type,
                                              ResourceFormat format) {
   DCHECK_LE(size.width(), max_texture_size_);
   DCHECK_LE(size.height(), max_texture_size_);
   DCHECK(thread_checker_.CalledOnValidThread());
 
+  GLenum target = type == RESOURCE_TYPE_GPU_MEMORY_BUFFER
+                      ? GetImageTextureTarget(format)
+                      : GL_TEXTURE_2D;
+
   ResourceId id = next_id_++;
-  Resource* resource = InsertResource(
-      id,
-      Resource(0, size, Resource::INTERNAL, target, GL_LINEAR, hint, format));
+  Resource* resource =
+      InsertResource(id, Resource(0, size, Resource::INTERNAL, target,
+                                  GL_LINEAR, hint, type, format));
   resource->allocated = false;
   return id;
 }
@@ -458,7 +466,8 @@
   ResourceId id = next_id_++;
   Resource* resource = InsertResource(
       id, Resource(0, gfx::Size(), Resource::INTERNAL, GL_TEXTURE_RECTANGLE_ARB,
-                   GL_LINEAR, TEXTURE_HINT_IMMUTABLE, RGBA_8888));
+                   GL_LINEAR, TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE,
+                   RGBA_8888));
   LazyCreate(resource);
   GLES2Interface* gl = ContextGL();
   DCHECK(gl);
@@ -480,9 +489,10 @@
   Resource* resource = nullptr;
   if (mailbox.IsTexture()) {
     resource = InsertResource(
-        id, Resource(0, gfx::Size(), Resource::EXTERNAL, mailbox.target(),
-                     mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR,
-                     TEXTURE_HINT_IMMUTABLE, RGBA_8888));
+        id,
+        Resource(0, gfx::Size(), Resource::EXTERNAL, mailbox.target(),
+                 mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR,
+                 TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE, RGBA_8888));
   } else {
     DCHECK(mailbox.IsSharedMemory());
     SharedBitmap* shared_bitmap = mailbox.shared_bitmap();
@@ -564,7 +574,7 @@
   if (resource->origin == Resource::EXTERNAL) {
     DCHECK(resource->mailbox.IsValid());
     gpu::SyncToken sync_token = resource->mailbox.sync_token();
-    if (resource->type == RESOURCE_TYPE_GL_TEXTURE) {
+    if (IsGpuResourceType(resource->type)) {
       DCHECK(resource->mailbox.IsTexture());
       lost_resource |= lost_output_surface_;
       GLES2Interface* gl = ContextGL();
@@ -688,7 +698,7 @@
 
   LazyCreate(resource);
 
-  if (resource->type == RESOURCE_TYPE_GL_TEXTURE && !resource->gl_id) {
+  if (IsGpuResourceType(resource->type) && !resource->gl_id) {
     DCHECK(resource->origin != Resource::INTERNAL);
     DCHECK(resource->mailbox.IsTexture());
 
@@ -868,7 +878,7 @@
                                    ResourceId resource_id)
     : resource_provider_(resource_provider),
       resource_(resource_provider->LockForWrite(resource_id)) {
-  DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, resource_->type);
+  DCHECK(IsGpuResourceType(resource_->type));
   gpu_memory_buffer_.reset(resource_->gpu_memory_buffer);
   resource_->gpu_memory_buffer = nullptr;
 }
@@ -1001,8 +1011,9 @@
       highp_threshold_min_(highp_threshold_min),
       next_id_(1),
       next_child_(1),
-      default_resource_type_(RESOURCE_TYPE_BITMAP),
-      use_gpu_memory_buffer_resources_(use_gpu_memory_buffer_resources),
+      default_resource_type_(use_gpu_memory_buffer_resources
+                                 ? RESOURCE_TYPE_GPU_MEMORY_BUFFER
+                                 : RESOURCE_TYPE_GL_TEXTURE),
       use_texture_storage_ext_(false),
       use_texture_format_bgra_(false),
       use_texture_usage_hint_(false),
@@ -1045,7 +1056,7 @@
   const ContextProvider::Capabilities& caps =
       output_surface_->context_provider()->ContextCapabilities();
 
-  default_resource_type_ = RESOURCE_TYPE_GL_TEXTURE;
+  DCHECK(IsGpuResourceType(default_resource_type_));
   use_texture_storage_ext_ = caps.gpu.texture_storage;
   use_texture_format_bgra_ = caps.gpu.texture_format_bgra8888;
   use_texture_usage_hint_ = caps.gpu.texture_usage;
@@ -1185,7 +1196,8 @@
       resource = InsertResource(
           local_id, Resource(0, it->size, Resource::DELEGATED,
                              it->mailbox_holder.texture_target, it->filter,
-                             TEXTURE_HINT_IMMUTABLE, it->format));
+                             TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE,
+                             it->format));
       resource->mailbox = TextureMailbox(it->mailbox_holder.mailbox,
                                          it->mailbox_holder.sync_token,
                                          it->mailbox_holder.texture_target);
@@ -1354,9 +1366,8 @@
     ResourceId child_id = child_info->parent_to_child_map[local_id];
     DCHECK(child_info->child_to_parent_map.count(child_id));
 
-    bool is_lost =
-        resource.lost ||
-        (resource.type == RESOURCE_TYPE_GL_TEXTURE && lost_output_surface_);
+    bool is_lost = resource.lost ||
+                   (IsGpuResourceType(resource.type) && lost_output_surface_);
     if (resource.exported_count > 0 || resource.lock_for_read_count > 0) {
       if (style != FOR_SHUTDOWN) {
         // Defer this resource deletion.
@@ -1391,8 +1402,8 @@
     ReturnedResource returned;
     returned.id = child_id;
     returned.sync_token = resource.mailbox.sync_token();
-    need_sync_token |= (!returned.sync_token.HasData() &&
-                        resource.type == RESOURCE_TYPE_GL_TEXTURE);
+    need_sync_token |=
+        (!returned.sync_token.HasData() && IsGpuResourceType(resource.type));
     returned.count = resource.imported_count;
     returned.lost = is_lost;
     to_return.push_back(returned);
@@ -1453,7 +1464,7 @@
 }
 
 void ResourceProvider::LazyCreate(Resource* resource) {
-  if (resource->type != RESOURCE_TYPE_GL_TEXTURE ||
+  if (!IsGpuResourceType(resource->type) ||
       resource->origin != Resource::INTERNAL)
     return;
 
@@ -1497,7 +1508,7 @@
   gfx::Size& size = resource->size;
   ResourceFormat format = resource->format;
   gl->BindTexture(resource->target, resource->gl_id);
-  if (use_gpu_memory_buffer_resources_) {
+  if (resource->type == RESOURCE_TYPE_GPU_MEMORY_BUFFER) {
     resource->gpu_memory_buffer =
         gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
                                       size, BufferFormat(format),
@@ -1561,7 +1572,7 @@
   Resource* resource = GetResource(id);
   DCHECK_EQ(resource->exported_count, 0);
   DCHECK(resource->allocated);
-  if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id)
+  if (!IsGpuResourceType(resource->type) || resource->gl_id)
     return;
   if (resource->mailbox.sync_token().HasData()) {
     DCHECK(resource->mailbox.IsValid());
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index 926647a..5a03cda 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -76,6 +76,7 @@
         TEXTURE_HINT_IMMUTABLE | TEXTURE_HINT_FRAMEBUFFER
   };
   enum ResourceType {
+    RESOURCE_TYPE_GPU_MEMORY_BUFFER,
     RESOURCE_TYPE_GL_TEXTURE,
     RESOURCE_TYPE_BITMAP,
   };
@@ -126,9 +127,9 @@
 
   // Creates a resource for a particular texture target (the distinction between
   // texture targets has no effect in software mode).
-  ResourceId CreateResourceWithImageTextureTarget(const gfx::Size& size,
-                                                  TextureHint hint,
-                                                  ResourceFormat format);
+  ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size,
+                                           TextureHint hint,
+                                           ResourceFormat format);
 
   // Wraps an IOSurface into a GL resource.
   ResourceId CreateResourceFromIOSurface(const gfx::Size& size,
@@ -447,6 +448,7 @@
              GLenum target,
              GLenum filter,
              TextureHint hint,
+             ResourceType type,
              ResourceFormat format);
     Resource(uint8_t* pixels,
              SharedBitmap* bitmap,
@@ -516,8 +518,8 @@
   }
 
   ResourceId CreateGLTexture(const gfx::Size& size,
-                             GLenum target,
                              TextureHint hint,
+                             ResourceType type,
                              ResourceFormat format);
   ResourceId CreateBitmap(const gfx::Size& size);
   Resource* InsertResource(ResourceId id, const Resource& resource);
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index 86b6025..77d0ed2 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -369,6 +369,7 @@
                        uint8_t* pixels) {
   resource_provider->WaitSyncTokenIfNeeded(id);
   switch (resource_provider->default_resource_type()) {
+    case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER:
     case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
       ResourceProvider::ScopedReadLockGL lock_gl(resource_provider, id);
       ASSERT_NE(0U, lock_gl.texture_id());
@@ -396,6 +397,7 @@
         child_context_(NULL),
         main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) {
     switch (GetParam()) {
+      case ResourceProvider::RESOURCE_TYPE_GPU_MEMORY_BUFFER:
       case ResourceProvider::RESOURCE_TYPE_GL_TEXTURE: {
         scoped_ptr<ResourceProviderContext> context3d(
             ResourceProviderContext::Create(shared_data_.get()));
diff --git a/cc/resources/scoped_resource.cc b/cc/resources/scoped_resource.cc
index 3e975e1..b6a58c9 100644
--- a/cc/resources/scoped_resource.cc
+++ b/cc/resources/scoped_resource.cc
@@ -29,13 +29,13 @@
 #endif
 }
 
-void ScopedResource::AllocateWithImageTextureTarget(const gfx::Size& size,
-                                                    ResourceFormat format) {
+void ScopedResource::AllocateWithGpuMemoryBuffer(const gfx::Size& size,
+                                                 ResourceFormat format) {
   DCHECK(!id());
   DCHECK(!size.IsEmpty());
 
   set_dimensions(size, format);
-  set_id(resource_provider_->CreateResourceWithImageTextureTarget(
+  set_id(resource_provider_->CreateGpuMemoryBufferResource(
       size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format));
 
 #if DCHECK_IS_ON()
diff --git a/cc/resources/scoped_resource.h b/cc/resources/scoped_resource.h
index 927e7eb..8924ed9 100644
--- a/cc/resources/scoped_resource.h
+++ b/cc/resources/scoped_resource.h
@@ -28,8 +28,8 @@
   void Allocate(const gfx::Size& size,
                 ResourceProvider::TextureHint hint,
                 ResourceFormat format);
-  void AllocateWithImageTextureTarget(const gfx::Size& size,
-                                      ResourceFormat format);
+  void AllocateWithGpuMemoryBuffer(const gfx::Size& size,
+                                   ResourceFormat format);
   void Free();
 
  protected:
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 072086f..eb2c3e14 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -193,10 +193,6 @@
   ProcessScheduledActions();
 }
 
-void Scheduler::SetMaxSwapsPending(int max) {
-  state_machine_.SetMaxSwapsPending(max);
-}
-
 void Scheduler::DidSwapBuffers() {
   state_machine_.DidSwapBuffers();
 
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 5773bc4..6f8ba1e 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -95,7 +95,6 @@
 
   void SetNeedsPrepareTiles();
 
-  void SetMaxSwapsPending(int max);
   void DidSwapBuffers();
   void DidSwapBuffersComplete();
 
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 01ac8cbb..d770689 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -13,6 +13,11 @@
 
 namespace cc {
 
+namespace {
+// Surfaces and CompositorTimingHistory don't support more than 1 pending swap.
+const int kMaxPendingSwaps = 1;
+}  // namespace
+
 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
     : settings_(settings),
       output_surface_state_(OUTPUT_SURFACE_NONE),
@@ -32,7 +37,6 @@
       invalidate_output_surface_funnel_(false),
       prepare_tiles_funnel_(0),
       consecutive_checkerboard_animations_(0),
-      max_pending_swaps_(1),
       pending_swaps_(0),
       swaps_with_current_output_surface_(0),
       needs_redraw_(false),
@@ -217,7 +221,6 @@
                     invalidate_output_surface_funnel_);
   state->SetInteger("consecutive_checkerboard_animations",
                     consecutive_checkerboard_animations_);
-  state->SetInteger("max_pending_swaps_", max_pending_swaps_);
   state->SetInteger("pending_swaps_", pending_swaps_);
   state->SetInteger("swaps_with_current_output_surface",
                     swaps_with_current_output_surface_);
@@ -912,7 +915,7 @@
 }
 
 bool SchedulerStateMachine::SwapThrottled() const {
-  return pending_swaps_ >= max_pending_swaps_;
+  return pending_swaps_ >= kMaxPendingSwaps;
 }
 
 void SchedulerStateMachine::SetVisible(bool visible) {
@@ -957,17 +960,12 @@
     needs_prepare_tiles_ = true;
   }
 }
-
-void SchedulerStateMachine::SetMaxSwapsPending(int max) {
-  max_pending_swaps_ = max;
-}
-
 void SchedulerStateMachine::DidSwapBuffers() {
   TRACE_EVENT_ASYNC_BEGIN0("cc", "Scheduler:pending_swaps", this);
   pending_swaps_++;
   swaps_with_current_output_surface_++;
 
-  DCHECK_LE(pending_swaps_, max_pending_swaps_);
+  DCHECK_LE(pending_swaps_, kMaxPendingSwaps);
 
   did_perform_swap_in_last_draw_ = true;
   last_frame_number_swap_performed_ = current_frame_number_;
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 17fdf98..3c32dc6 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -174,9 +174,6 @@
   // PrepareTiles will occur shortly (even if no redraw is required).
   void SetNeedsPrepareTiles();
 
-  // Sets how many swaps can be pending to the OutputSurface.
-  void SetMaxSwapsPending(int max);
-
   // If the scheduler attempted to draw and swap, this provides feedback
   // regarding whether or not the swap actually occured. We might skip the
   // swap when there is not damage, for example.
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 6bdf5dd..362946f 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -1471,7 +1471,6 @@
 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
     bool swap_ack_before_deadline) {
   // To get into a high latency state, this test disables automatic swap acks.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Draw and swap for first BeginFrame
@@ -1595,7 +1594,6 @@
   SetUpScheduler(true);
 
   // To get into a high latency state, this test disables automatic swap acks.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Even if every estimate related to the main thread is slow, we should
@@ -1659,7 +1657,6 @@
 
 void SchedulerTest::ImplFrameIsNotSkippedAfterLateSwapAck() {
   // To get into a high latency state, this test disables automatic swap acks.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Draw and swap for first BeginFrame
@@ -1770,7 +1767,6 @@
   fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration);
 
   // To get into a high latency state, this test disables automatic swap acks.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Impl thread hits deadline before commit finishes to make
@@ -1899,7 +1895,6 @@
 
   // Disables automatic swap acks so this test can force swap ack throttling
   // to simulate a blocked Browser ui thread.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Get a new active tree in main-thread high latency mode and put us
@@ -1970,7 +1965,6 @@
 
   // Disables automatic swap acks so this test can force swap ack throttling
   // to simulate a blocked Browser ui thread.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Start a new commit in main-thread high latency mode and hold off on
@@ -2051,7 +2045,6 @@
 
   // Disables automatic swap acks so this test can force swap ack throttling
   // to simulate a blocked Browser ui thread.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // Start a new commit in main-thread high latency mode and hold off on
@@ -2447,7 +2440,6 @@
   fake_compositor_timing_history_->SetDrawDurationEstimate(base::TimeDelta());
 
   // To test swap ack throttling, this test disables automatic swap acks.
-  scheduler_->SetMaxSwapsPending(1);
   client_->SetAutomaticSwapAck(false);
 
   // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index 31335ae..ef9802c3 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -212,7 +212,7 @@
                                       stored_latency_info_.end());
   stored_latency_info_.clear();
   bool have_copy_requests = false;
-  for (const auto* pass : frame_data->render_pass_list) {
+  for (const auto& pass : frame_data->render_pass_list) {
     have_copy_requests |= !pass->copy_requests.empty();
   }
 
diff --git a/cc/surfaces/onscreen_display_client.cc b/cc/surfaces/onscreen_display_client.cc
index 067f443d..06828b05 100644
--- a/cc/surfaces/onscreen_display_client.cc
+++ b/cc/surfaces/onscreen_display_client.cc
@@ -35,10 +35,7 @@
 }
 
 bool OnscreenDisplayClient::Initialize() {
-  int max_frames_pending =
-      output_surface_ ? output_surface_->capabilities().max_frames_pending : 0;
-  if (max_frames_pending <= 0)
-    max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
+  DCHECK(output_surface_);
 
   BeginFrameSource* frame_source;
   if (disable_display_vsync_) {
@@ -51,8 +48,9 @@
     frame_source = synthetic_frame_source_.get();
   }
 
-  scheduler_.reset(new DisplayScheduler(
-      display_.get(), frame_source, task_runner_.get(), max_frames_pending));
+  scheduler_.reset(
+      new DisplayScheduler(display_.get(), frame_source, task_runner_.get(),
+                           output_surface_->capabilities().max_frames_pending));
 
   return display_->Initialize(output_surface_.Pass(), scheduler_.get());
 }
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 32f41f1e..351b679 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -6,6 +6,7 @@
 
 #include <algorithm>
 
+#include "cc/base/container_util.h"
 #include "cc/output/compositor_frame.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/surfaces/surface_factory.h"
@@ -116,8 +117,9 @@
          current_frame_->delegated_frame_data->render_pass_list) {
       while (!render_pass->copy_requests.empty()) {
         scoped_ptr<CopyOutputRequest> request =
-            render_pass->copy_requests.take_back();
-        render_pass->copy_requests.pop_back();
+            PopBack(&render_pass->copy_requests);
+        // TODO(vmpstr): |copy_requests| should store scoped_ptrs.
+        // crbug.com/557388.
         copy_requests->insert(
             std::make_pair(render_pass->id, request.release()));
       }
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h
index 18ca744..cbfa42e 100644
--- a/cc/surfaces/surface.h
+++ b/cc/surfaces/surface.h
@@ -14,7 +14,6 @@
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/quads/render_pass_id.h"
 #include "cc/surfaces/surface_factory.h"
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index a0108b7d..43c57bcf 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -29,7 +29,7 @@
 void MoveMatchingRequests(
     RenderPassId id,
     std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests,
-    ScopedPtrVector<CopyOutputRequest>* output_requests) {
+    std::vector<scoped_ptr<CopyOutputRequest>>* output_requests) {
   auto request_range = copy_requests->equal_range(id);
   for (auto it = request_range.first; it != request_range.second; ++it) {
     DCHECK(it->second);
@@ -576,7 +576,7 @@
 
   gfx::Rect damage_rect;
   if (!frame_data->render_pass_list.empty()) {
-    RenderPass* last_pass = frame_data->render_pass_list.back();
+    RenderPass* last_pass = frame_data->render_pass_list.back().get();
     damage_rect =
         DamageRectForSurface(surface, *last_pass, last_pass->output_rect);
   }
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 7696b74..848912e6 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -139,7 +139,7 @@
 
     // Ensure no duplicate pass ids output.
     std::set<RenderPassId> used_passes;
-    for (auto* pass : frame_data->render_pass_list) {
+    for (const auto& pass : frame_data->render_pass_list) {
       EXPECT_TRUE(used_passes.insert(pass->id).second);
     }
 
@@ -365,7 +365,7 @@
   ASSERT_EQ(2u, frame_data->render_pass_list.size());
   ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
   DCHECK_EQ(copy_request_ptr,
-            frame_data->render_pass_list[0]->copy_requests[0]);
+            frame_data->render_pass_list[0]->copy_requests[0].get());
 
   SurfaceId surface_ids[] = {root_surface_id_, embedded_surface_id};
   EXPECT_EQ(arraysize(surface_ids),
@@ -451,10 +451,10 @@
   ASSERT_EQ(2u, frame_data->render_pass_list.size());
   ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
   DCHECK_EQ(copy_request_ptr,
-            frame_data->render_pass_list[0]->copy_requests[0]);
+            frame_data->render_pass_list[0]->copy_requests[0].get());
   ASSERT_EQ(1u, frame_data->render_pass_list[1]->copy_requests.size());
   DCHECK_EQ(copy_request2_ptr,
-            frame_data->render_pass_list[1]->copy_requests[0]);
+            frame_data->render_pass_list[1]->copy_requests[0].get());
 
   SurfaceId surface_ids[] = {root_surface_id_, embedded_surface_id};
   EXPECT_EQ(arraysize(surface_ids),
@@ -542,7 +542,7 @@
     SCOPED_TRACE("First pass");
     // The first pass will just be the first pass from the root surfaces quad
     // with no render pass quads to remap.
-    TestPassMatchesExpectations(root_passes[0], aggregated_pass_list[0]);
+    TestPassMatchesExpectations(root_passes[0], aggregated_pass_list[0].get());
   }
 
   {
@@ -552,7 +552,8 @@
     // quad embedded into the root surface's second pass.
     // First, there's the first embedded pass which doesn't reference anything
     // else.
-    TestPassMatchesExpectations(embedded_passes[0], aggregated_pass_list[1]);
+    TestPassMatchesExpectations(embedded_passes[0],
+                                aggregated_pass_list[1].get());
   }
 
   {
@@ -1021,13 +1022,13 @@
     AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
               arraysize(child_passes));
 
-    RenderPass* child_nonroot_pass = child_pass_list.at(0u);
+    RenderPass* child_nonroot_pass = child_pass_list[0].get();
     child_nonroot_pass->transform_to_root_target.Translate(8, 0);
     SharedQuadState* child_nonroot_pass_sqs =
         child_nonroot_pass->shared_quad_state_list.front();
     child_nonroot_pass_sqs->quad_to_target_transform.Translate(5, 0);
 
-    RenderPass* child_root_pass = child_pass_list.at(1u);
+    RenderPass* child_root_pass = child_pass_list[1].get();
     SharedQuadState* child_root_pass_sqs =
         child_root_pass->shared_quad_state_list.front();
     child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
@@ -1060,7 +1061,7 @@
     AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes,
               arraysize(middle_passes));
 
-    RenderPass* middle_root_pass = middle_pass_list.at(0u);
+    RenderPass* middle_root_pass = middle_pass_list[0].get();
     middle_root_pass->quad_list.ElementAt(0)->visible_rect =
         gfx::Rect(0, 1, 100, 7);
     SharedQuadState* middle_root_pass_sqs =
@@ -1092,13 +1093,13 @@
             root_passes,
             arraysize(root_passes));
 
-  root_pass_list.at(0)
+  root_pass_list[0]
       ->shared_quad_state_list.front()
       ->quad_to_target_transform.Translate(0, 7);
-  root_pass_list.at(0)
+  root_pass_list[0]
       ->shared_quad_state_list.ElementAt(1)
       ->quad_to_target_transform.Translate(0, 10);
-  root_pass_list.at(0)->quad_list.ElementAt(1)->visible_rect =
+  root_pass_list[0]->quad_list.ElementAt(1)->visible_rect =
       gfx::Rect(0, 0, 8, 100);
 
   root_pass_list[0]->transform_to_root_target.Translate(10, 5);
@@ -1213,7 +1214,7 @@
             child_passes,
             arraysize(child_passes));
 
-  RenderPass* child_root_pass = child_pass_list.at(0u);
+  RenderPass* child_root_pass = child_pass_list[0].get();
   SharedQuadState* child_root_pass_sqs =
       child_root_pass->shared_quad_state_list.front();
   child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
@@ -1274,11 +1275,11 @@
             root_passes,
             arraysize(root_passes));
 
-  root_pass_list.at(0)
+  root_pass_list[0]
       ->shared_quad_state_list.front()
       ->quad_to_target_transform.Translate(0, 10);
-  root_pass_list.at(0)->damage_rect = gfx::Rect(5, 5, 10, 10);
-  root_pass_list.at(1)->damage_rect = gfx::Rect(5, 5, 100, 100);
+  root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10);
+  root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100);
 
   scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
   root_pass_list.swap(root_frame_data->render_pass_list);
@@ -1319,7 +1320,7 @@
               child_passes,
               arraysize(child_passes));
 
-    RenderPass* child_root_pass = child_pass_list.at(0u);
+    RenderPass* child_root_pass = child_pass_list[0].get();
     SharedQuadState* child_root_pass_sqs =
         child_root_pass->shared_quad_state_list.front();
     child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
@@ -1368,10 +1369,10 @@
               root_passes,
               arraysize(root_passes));
 
-    root_pass_list.at(0)
+    root_pass_list[0]
         ->shared_quad_state_list.front()
         ->quad_to_target_transform.Translate(0, 10);
-    root_pass_list.at(0)->damage_rect = gfx::Rect(0, 0, 1, 1);
+    root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1);
 
     scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
     root_pass_list.swap(root_frame_data->render_pass_list);
@@ -1390,10 +1391,10 @@
               root_passes,
               arraysize(root_passes));
 
-    root_pass_list.at(0)
+    root_pass_list[0]
         ->shared_quad_state_list.front()
         ->quad_to_target_transform.Translate(0, 10);
-    root_pass_list.at(0)->damage_rect = gfx::Rect(1, 1, 1, 1);
+    root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1);
 
     scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
     root_pass_list.swap(root_frame_data->render_pass_list);
@@ -1516,14 +1517,14 @@
     AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
               arraysize(child_passes));
 
-    child_pass_list.at(0u)->quad_list.ElementAt(0)->visible_rect =
+    child_pass_list[0]->quad_list.ElementAt(0)->visible_rect =
         gfx::Rect(1, 1, 2, 2);
     SharedQuadState* child_sqs =
-        child_pass_list.at(0u)->shared_quad_state_list.ElementAt(0u);
+        child_pass_list[0]->shared_quad_state_list.ElementAt(0u);
     child_sqs->quad_to_target_transform.Translate(1, 1);
     child_sqs->quad_to_target_transform.Scale(2, 2);
 
-    child_pass_list.at(1u)->quad_list.ElementAt(0)->visible_rect =
+    child_pass_list[1]->quad_list.ElementAt(0)->visible_rect =
         gfx::Rect(0, 0, 2, 2);
 
     SubmitPassListAsFrame(child_surface_id, &child_pass_list);
@@ -1538,7 +1539,7 @@
     AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
               arraysize(root_passes));
 
-    RenderPass* root_pass = root_pass_list.at(0u);
+    RenderPass* root_pass = root_pass_list[0].get();
     root_pass->shared_quad_state_list.front()
         ->quad_to_target_transform.Translate(10, 10);
     root_pass->damage_rect = gfx::Rect(0, 0, 1, 1);
@@ -1579,7 +1580,7 @@
     AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
               arraysize(root_passes));
 
-    RenderPass* root_pass = root_pass_list.at(0u);
+    RenderPass* root_pass = root_pass_list[0].get();
     root_pass->shared_quad_state_list.front()
         ->quad_to_target_transform.Translate(10, 10);
     root_pass->damage_rect = gfx::Rect(10, 10, 2, 2);
@@ -1629,17 +1630,17 @@
     AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
               arraysize(child_passes));
 
-    child_pass_list.at(0u)->quad_list.ElementAt(0)->visible_rect =
+    child_pass_list[0]->quad_list.ElementAt(0)->visible_rect =
         gfx::Rect(1, 1, 2, 2);
     SharedQuadState* child_sqs =
-        child_pass_list.at(0u)->shared_quad_state_list.ElementAt(0u);
+        child_pass_list[0]->shared_quad_state_list.ElementAt(0u);
     child_sqs->quad_to_target_transform.Translate(1, 1);
     child_sqs->quad_to_target_transform.Scale(2, 2);
 
-    child_pass_list.at(1u)->quad_list.ElementAt(0)->visible_rect =
+    child_pass_list[1]->quad_list.ElementAt(0)->visible_rect =
         gfx::Rect(0, 0, 2, 2);
 
-    RenderPass* child_root_pass = child_pass_list.at(1u);
+    RenderPass* child_root_pass = child_pass_list[1].get();
 
     child_root_pass->copy_requests.push_back(
         CopyOutputRequest::CreateEmptyRequest());
diff --git a/cc/surfaces/surface_display_output_surface.cc b/cc/surfaces/surface_display_output_surface.cc
index 31a8543..c887ca45 100644
--- a/cc/surfaces/surface_display_output_surface.cc
+++ b/cc/surfaces/surface_display_output_surface.cc
@@ -25,7 +25,6 @@
       allocator_(allocator) {
   factory_.set_needs_sync_points(false);
   capabilities_.delegated_rendering = true;
-  capabilities_.max_frames_pending = 1;
   capabilities_.adjust_deadline_for_parent = true;
   capabilities_.can_force_reclaim_resources = true;
   // Display and SurfaceDisplayOutputSurface share a GL context, so sync
diff --git a/cc/surfaces/surface_display_output_surface_unittest.cc b/cc/surfaces/surface_display_output_surface_unittest.cc
index daabafe..2fedf5a 100644
--- a/cc/surfaces/surface_display_output_surface_unittest.cc
+++ b/cc/surfaces/surface_display_output_surface_unittest.cc
@@ -36,6 +36,7 @@
     // to it now for future reference.
     fake_output_surface_ =
         static_cast<FakeOutputSurface*>(output_surface_.get());
+    fake_output_surface_->set_max_frames_pending(2);
   }
 
   FakeOutputSurface* output_surface() { return fake_output_surface_; }
diff --git a/cc/surfaces/surface_hittest.cc b/cc/surfaces/surface_hittest.cc
index 752a708..b7414de 100644
--- a/cc/surfaces/surface_hittest.cc
+++ b/cc/surfaces/surface_hittest.cc
@@ -231,11 +231,11 @@
     return nullptr;
 
   if (!render_pass_id.IsValid())
-    return frame_data->render_pass_list.back();
+    return frame_data->render_pass_list.back().get();
 
-  for (const auto* render_pass : frame_data->render_pass_list) {
+  for (const auto& render_pass : frame_data->render_pass_list) {
     if (render_pass->id == render_pass_id)
-      return render_pass;
+      return render_pass.get();
   }
 
   return nullptr;
diff --git a/cc/surfaces/surface_hittest_unittest.cc b/cc/surfaces/surface_hittest_unittest.cc
index 9bb7128..fde62f3 100644
--- a/cc/surfaces/surface_hittest_unittest.cc
+++ b/cc/surfaces/surface_hittest_unittest.cc
@@ -389,7 +389,7 @@
   RenderPass* root_pass = nullptr;
   scoped_ptr<CompositorFrame> root_frame =
       CreateCompositorFrameWithRenderPassList(&render_pass_list);
-  root_pass = root_frame->delegated_frame_data->render_pass_list.back();
+  root_pass = root_frame->delegated_frame_data->render_pass_list.back().get();
 
   // Create a RenderPassDrawQuad.
   gfx::Rect render_pass_quad_rect(100, 100);
@@ -401,7 +401,7 @@
 
   // Add a solid quad in the child render pass.
   RenderPass* child_render_pass =
-      root_frame->delegated_frame_data->render_pass_list.front();
+      root_frame->delegated_frame_data->render_pass_list.front().get();
   gfx::Rect child_solid_quad_rect(100, 100);
   CreateSolidColorDrawQuad(child_render_pass,
                            gfx::Transform(),
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index 56a93cd..3bf9b04 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -78,7 +78,7 @@
   int num_children_that_draw_content = 0;
   for (size_t i = 0; i < layer->children().size(); ++i) {
     num_children_that_draw_content +=
-        RecursiveUpdateNumChildren(layer->children()[i]);
+        RecursiveUpdateNumChildren(layer->children()[i].get());
   }
   if (layer->DrawsContent() && layer->HasDelegatedContent())
     num_children_that_draw_content += 1000;
diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h
index d05c11e5..961f0f26 100644
--- a/cc/test/fake_layer_tree_host_impl_client.h
+++ b/cc/test/fake_layer_tree_host_impl_client.h
@@ -19,7 +19,6 @@
   void CommitVSyncParameters(base::TimeTicks timebase,
                              base::TimeDelta interval) override {}
   void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override {}
-  void SetMaxSwapsPendingOnImplThread(int max) override {}
   void DidSwapBuffersOnImplThread() override {}
   void DidSwapBuffersCompleteOnImplThread() override {}
   void OnResourcelessSoftareDrawStateChanged(bool resourceless_draw) override {}
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index e30806ec..4855f30 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -25,10 +25,7 @@
       suspended_for_recycle_(false),
       framebuffer_(0),
       overlay_candidate_validator_(nullptr) {
-  if (delegated_rendering) {
-    capabilities_.delegated_rendering = true;
-    capabilities_.max_frames_pending = 1;
-  }
+  capabilities_.delegated_rendering = delegated_rendering;
 }
 
 FakeOutputSurface::FakeOutputSurface(
@@ -41,10 +38,7 @@
       suspended_for_recycle_(false),
       framebuffer_(0),
       overlay_candidate_validator_(nullptr) {
-  if (delegated_rendering) {
-    capabilities_.delegated_rendering = true;
-    capabilities_.max_frames_pending = 1;
-  }
+  capabilities_.delegated_rendering = delegated_rendering;
 }
 
 FakeOutputSurface::FakeOutputSurface(
@@ -57,10 +51,7 @@
       suspended_for_recycle_(false),
       framebuffer_(0),
       overlay_candidate_validator_(nullptr) {
-  if (delegated_rendering) {
-    capabilities_.delegated_rendering = true;
-    capabilities_.max_frames_pending = 1;
-  }
+  capabilities_.delegated_rendering = delegated_rendering;
 }
 
 FakeOutputSurface::FakeOutputSurface(
@@ -74,10 +65,7 @@
       suspended_for_recycle_(false),
       framebuffer_(0),
       overlay_candidate_validator_(nullptr) {
-  if (delegated_rendering) {
-    capabilities_.delegated_rendering = true;
-    capabilities_.max_frames_pending = 1;
-  }
+  capabilities_.delegated_rendering = delegated_rendering;
 }
 
 FakeOutputSurface::~FakeOutputSurface() {}
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
index 34274d85..14ec0f20 100644
--- a/cc/test/fake_output_surface.h
+++ b/cc/test/fake_output_surface.h
@@ -94,6 +94,10 @@
     return surface.Pass();
   }
 
+  void set_max_frames_pending(int max) {
+    capabilities_.max_frames_pending = max;
+  }
+
   CompositorFrame& last_sent_frame() { return last_sent_frame_; }
   size_t num_sent_frames() { return num_sent_frames_; }
 
diff --git a/cc/test/layer_tree_json_parser_unittest.cc b/cc/test/layer_tree_json_parser_unittest.cc
index 5521b37..c39423f 100644
--- a/cc/test/layer_tree_json_parser_unittest.cc
+++ b/cc/test/layer_tree_json_parser_unittest.cc
@@ -50,7 +50,7 @@
 
   for (size_t i = 0; i < layer_impl->children().size(); ++i) {
     RETURN_IF_EXPECTATION_FAILS(EXPECT_TRUE(LayerTreesMatch(
-        layer_impl->children()[i], layer->children()[i].get())));
+        layer_impl->children()[i].get(), layer->children()[i].get())));
   }
 
   return true;
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc
index 5c5c831..347933ce3 100644
--- a/cc/test/layer_tree_pixel_resource_test.cc
+++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -126,8 +126,7 @@
     case BITMAP_TILE_TASK_WORKER_POOL:
       EXPECT_FALSE(context_provider);
       EXPECT_EQ(PIXEL_TEST_SOFTWARE, test_type_);
-      *resource_pool = ResourcePool::CreateForImageTextureTarget(
-          resource_provider, task_runner);
+      *resource_pool = ResourcePool::Create(resource_provider, task_runner);
 
       *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create(
           task_runner, task_graph_runner(), resource_provider);
@@ -135,8 +134,7 @@
     case GPU_TILE_TASK_WORKER_POOL:
       EXPECT_TRUE(context_provider);
       EXPECT_EQ(PIXEL_TEST_GL, test_type_);
-      *resource_pool = ResourcePool::CreateForImageTextureTarget(
-          resource_provider, task_runner);
+      *resource_pool = ResourcePool::Create(resource_provider, task_runner);
 
       *tile_task_worker_pool = GpuTileTaskWorkerPool::Create(
           task_runner, task_graph_runner(), context_provider, resource_provider,
@@ -146,8 +144,7 @@
       EXPECT_TRUE(context_provider);
       EXPECT_EQ(PIXEL_TEST_GL, test_type_);
       EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image);
-      *resource_pool = ResourcePool::CreateForImageTextureTarget(
-          resource_provider, task_runner);
+      *resource_pool = ResourcePool::Create(resource_provider, task_runner);
 
       *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
           task_runner, task_graph_runner(), resource_provider, false);
@@ -156,8 +153,7 @@
       EXPECT_TRUE(context_provider);
       EXPECT_EQ(PIXEL_TEST_GL, test_type_);
       EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image);
-      *resource_pool = ResourcePool::CreateForImageTextureTarget(
-          resource_provider, task_runner);
+      *resource_pool = ResourcePool::Create(resource_provider, task_runner);
 
       *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
           task_runner, task_graph_runner(), context_provider, resource_provider,
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 36a113f..9adc94d2 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -44,10 +44,8 @@
 bool PixelTest::RunPixelTest(RenderPassList* pass_list,
                              const base::FilePath& ref_file,
                              const PixelComparator& comparator) {
-  return RunPixelTestWithReadbackTarget(pass_list,
-                                        pass_list->back(),
-                                        ref_file,
-                                        comparator);
+  return RunPixelTestWithReadbackTarget(pass_list, pass_list->back().get(),
+                                        ref_file, comparator);
 }
 
 bool PixelTest::RunPixelTestWithReadbackTarget(
diff --git a/cc/test/render_pass_test_utils.h b/cc/test/render_pass_test_utils.h
index b28bb04..9182b5a 100644
--- a/cc/test/render_pass_test_utils.h
+++ b/cc/test/render_pass_test_utils.h
@@ -5,7 +5,6 @@
 #ifndef CC_TEST_RENDER_PASS_TEST_UTILS_H_
 #define CC_TEST_RENDER_PASS_TEST_UTILS_H_
 
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/output/filter_operations.h"
 #include "cc/quads/render_pass.h"
 #include "cc/resources/resource_provider.h"
diff --git a/cc/test/surface_aggregator_test_helpers.cc b/cc/test/surface_aggregator_test_helpers.cc
index 16a4b5ba..05e54b7a 100644
--- a/cc/test/surface_aggregator_test_helpers.cc
+++ b/cc/test/surface_aggregator_test_helpers.cc
@@ -129,7 +129,7 @@
 
   for (size_t i = 0; i < passes->size(); ++i) {
     SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i));
-    RenderPass* pass = passes->at(i);
+    RenderPass* pass = (*passes)[i].get();
     TestPassMatchesExpectations(expected_passes[i], pass);
   }
 }
diff --git a/cc/test/surface_aggregator_test_helpers.h b/cc/test/surface_aggregator_test_helpers.h
index 0848515..ae3347c 100644
--- a/cc/test/surface_aggregator_test_helpers.h
+++ b/cc/test/surface_aggregator_test_helpers.h
@@ -5,7 +5,8 @@
 #ifndef CC_TEST_SURFACE_AGGREGATOR_TEST_HELPERS_H_
 #define CC_TEST_SURFACE_AGGREGATOR_TEST_HELPERS_H_
 
-#include "cc/base/scoped_ptr_vector.h"
+#include <vector>
+
 #include "cc/quads/draw_quad.h"
 #include "cc/quads/render_pass_id.h"
 #include "cc/surfaces/surface_id.h"
@@ -18,7 +19,7 @@
 class Surface;
 class TestRenderPass;
 
-typedef ScopedPtrVector<RenderPass> RenderPassList;
+typedef std::vector<scoped_ptr<RenderPass>> RenderPassList;
 
 namespace test {
 
diff --git a/cc/test/surface_hittest_test_helpers.cc b/cc/test/surface_hittest_test_helpers.cc
index 2f0cf06c..c7d37e5e 100644
--- a/cc/test/surface_hittest_test_helpers.cc
+++ b/cc/test/surface_hittest_test_helpers.cc
@@ -87,7 +87,8 @@
   scoped_ptr<CompositorFrame> root_frame =
       CreateCompositorFrameWithRenderPassList(&render_pass_list);
 
-  *render_pass = root_frame->delegated_frame_data->render_pass_list.back();
+  *render_pass =
+      root_frame->delegated_frame_data->render_pass_list.back().get();
   return root_frame;
 }
 
diff --git a/cc/tiles/eviction_tile_priority_queue.cc b/cc/tiles/eviction_tile_priority_queue.cc
index fb27448c..743c982 100644
--- a/cc/tiles/eviction_tile_priority_queue.cc
+++ b/cc/tiles/eviction_tile_priority_queue.cc
@@ -13,8 +13,8 @@
   explicit EvictionOrderComparator(TreePriority tree_priority)
       : tree_priority_(tree_priority) {}
 
-  bool operator()(const TilingSetEvictionQueue* a_queue,
-                  const TilingSetEvictionQueue* b_queue) const {
+  bool operator()(const scoped_ptr<TilingSetEvictionQueue>& a_queue,
+                  const scoped_ptr<TilingSetEvictionQueue>& b_queue) const {
     // Note that in this function, we have to return true if and only if
     // b is strictly lower priority than a.
     const PrioritizedTile& a_tile = a_queue->Top();
@@ -64,7 +64,7 @@
 void CreateTilingSetEvictionQueues(
     const std::vector<PictureLayerImpl*>& layers,
     TreePriority tree_priority,
-    ScopedPtrVector<TilingSetEvictionQueue>* queues) {
+    std::vector<scoped_ptr<TilingSetEvictionQueue>>* queues) {
   DCHECK(queues->empty());
 
   for (auto* layer : layers) {
@@ -74,7 +74,8 @@
     if (!tiling_set_queue->IsEmpty())
       queues->push_back(tiling_set_queue.Pass());
   }
-  queues->make_heap(EvictionOrderComparator(tree_priority));
+  std::make_heap(queues->begin(), queues->end(),
+                 EvictionOrderComparator(tree_priority));
 }
 
 }  // namespace
@@ -102,32 +103,38 @@
 
 const PrioritizedTile& EvictionTilePriorityQueue::Top() const {
   DCHECK(!IsEmpty());
-  const ScopedPtrVector<TilingSetEvictionQueue>& next_queues = GetNextQueues();
+  const auto& next_queues = GetNextQueues();
   return next_queues.front()->Top();
 }
 
 void EvictionTilePriorityQueue::Pop() {
   DCHECK(!IsEmpty());
 
-  ScopedPtrVector<TilingSetEvictionQueue>& next_queues = GetNextQueues();
-  next_queues.pop_heap(EvictionOrderComparator(tree_priority_));
-  TilingSetEvictionQueue* queue = next_queues.back();
+  auto& next_queues = GetNextQueues();
+  std::pop_heap(next_queues.begin(), next_queues.end(),
+                EvictionOrderComparator(tree_priority_));
+  TilingSetEvictionQueue* queue = next_queues.back().get();
   queue->Pop();
 
   // Remove empty queues.
-  if (queue->IsEmpty())
+  if (queue->IsEmpty()) {
     next_queues.pop_back();
-  else
-    next_queues.push_heap(EvictionOrderComparator(tree_priority_));
+  } else {
+    std::push_heap(next_queues.begin(), next_queues.end(),
+                   EvictionOrderComparator(tree_priority_));
+  }
 }
 
-ScopedPtrVector<TilingSetEvictionQueue>&
+std::vector<scoped_ptr<TilingSetEvictionQueue>>&
 EvictionTilePriorityQueue::GetNextQueues() {
-  return const_cast<ScopedPtrVector<TilingSetEvictionQueue>&>(
-      static_cast<const EvictionTilePriorityQueue*>(this)->GetNextQueues());
+  const EvictionTilePriorityQueue* const_this =
+      static_cast<const EvictionTilePriorityQueue*>(this);
+  const auto& const_queues = const_this->GetNextQueues();
+  return const_cast<std::vector<scoped_ptr<TilingSetEvictionQueue>>&>(
+      const_queues);
 }
 
-const ScopedPtrVector<TilingSetEvictionQueue>&
+const std::vector<scoped_ptr<TilingSetEvictionQueue>>&
 EvictionTilePriorityQueue::GetNextQueues() const {
   DCHECK(!IsEmpty());
 
diff --git a/cc/tiles/eviction_tile_priority_queue.h b/cc/tiles/eviction_tile_priority_queue.h
index e761026..3198889 100644
--- a/cc/tiles/eviction_tile_priority_queue.h
+++ b/cc/tiles/eviction_tile_priority_queue.h
@@ -31,11 +31,11 @@
   void Pop();
 
  private:
-  ScopedPtrVector<TilingSetEvictionQueue>& GetNextQueues();
-  const ScopedPtrVector<TilingSetEvictionQueue>& GetNextQueues() const;
+  std::vector<scoped_ptr<TilingSetEvictionQueue>>& GetNextQueues();
+  const std::vector<scoped_ptr<TilingSetEvictionQueue>>& GetNextQueues() const;
 
-  ScopedPtrVector<TilingSetEvictionQueue> active_queues_;
-  ScopedPtrVector<TilingSetEvictionQueue> pending_queues_;
+  std::vector<scoped_ptr<TilingSetEvictionQueue>> active_queues_;
+  std::vector<scoped_ptr<TilingSetEvictionQueue>> pending_queues_;
   TreePriority tree_priority_;
 
   DISALLOW_COPY_AND_ASSIGN(EvictionTilePriorityQueue);
diff --git a/cc/tiles/picture_layer_tiling_set.cc b/cc/tiles/picture_layer_tiling_set.cc
index 0848e61..7e41bcf 100644
--- a/cc/tiles/picture_layer_tiling_set.cc
+++ b/cc/tiles/picture_layer_tiling_set.cc
@@ -16,7 +16,8 @@
 
 class LargestToSmallestScaleFunctor {
  public:
-  bool operator() (PictureLayerTiling* left, PictureLayerTiling* right) {
+  bool operator()(const scoped_ptr<PictureLayerTiling>& left,
+                  const scoped_ptr<PictureLayerTiling>& right) {
     return left->contents_scale() > right->contents_scale();
   }
 };
@@ -71,7 +72,7 @@
   }
 
   bool tiling_sort_required = false;
-  for (PictureLayerTiling* pending_twin_tiling : pending_twin_set->tilings_) {
+  for (const auto& pending_twin_tiling : pending_twin_set->tilings_) {
     float contents_scale = pending_twin_tiling->contents_scale();
     PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale);
     if (!this_tiling) {
@@ -80,15 +81,17 @@
           tiling_interest_area_padding_, skewport_target_time_in_seconds_,
           skewport_extrapolation_limit_in_content_pixels_);
       tilings_.push_back(new_tiling.Pass());
-      this_tiling = tilings_.back();
+      this_tiling = tilings_.back().get();
       tiling_sort_required = true;
     }
-    this_tiling->TakeTilesAndPropertiesFrom(pending_twin_tiling,
+    this_tiling->TakeTilesAndPropertiesFrom(pending_twin_tiling.get(),
                                             layer_invalidation);
   }
 
-  if (tiling_sort_required)
-    tilings_.sort(LargestToSmallestScaleFunctor());
+  if (tiling_sort_required) {
+    std::sort(tilings_.begin(), tilings_.end(),
+              LargestToSmallestScaleFunctor());
+  }
 }
 
 void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation(
@@ -107,7 +110,7 @@
 
   // If the tiling is not shared (FindTilingWithScale returns nullptr), then
   // invalidate tiles and update them to the new raster source.
-  for (PictureLayerTiling* tiling : tilings_) {
+  for (const auto& tiling : tilings_) {
     if (pending_twin_set->FindTilingWithScale(tiling->contents_scale()))
       continue;
 
@@ -139,7 +142,7 @@
   RemoveTilingsAboveScale(maximum_contents_scale);
 
   // Invalidate tiles and update them to the new raster source.
-  for (PictureLayerTiling* tiling : tilings_) {
+  for (const scoped_ptr<PictureLayerTiling>& tiling : tilings_) {
     DCHECK(tree_ != PENDING_TREE || !tiling->has_tiles());
     tiling->SetRasterSourceAndResize(raster_source);
 
@@ -159,7 +162,7 @@
 void PictureLayerTilingSet::UpdateRasterSourceDueToLCDChange(
     const scoped_refptr<DisplayListRasterSource>& raster_source,
     const Region& layer_invalidation) {
-  for (PictureLayerTiling* tiling : tilings_) {
+  for (const auto& tiling : tilings_) {
     tiling->SetRasterSourceAndResize(raster_source);
     tiling->Invalidate(layer_invalidation);
     // Since the invalidation changed, we need to create any missing tiles in
@@ -171,7 +174,7 @@
 void PictureLayerTilingSet::VerifyTilings(
     const PictureLayerTilingSet* pending_twin_set) const {
 #if DCHECK_IS_ON()
-  for (PictureLayerTiling* tiling : tilings_) {
+  for (const auto& tiling : tilings_) {
     DCHECK(tiling->tile_size() ==
            client_->CalculateTileSize(tiling->tiling_size()))
         << "tile_size: " << tiling->tile_size().ToString()
@@ -202,7 +205,7 @@
     const std::vector<PictureLayerTiling*>& needed_tilings,
     PictureLayerTilingSet* twin_set) {
   std::vector<PictureLayerTiling*> to_remove;
-  for (auto* tiling : tilings_) {
+  for (const auto& tiling : tilings_) {
     // Keep all tilings within the min/max scales.
     if (tiling->contents_scale() >= min_acceptable_high_res_scale &&
         tiling->contents_scale() <= max_acceptable_high_res_scale) {
@@ -214,12 +217,12 @@
       continue;
 
     // Don't remove tilings that are required.
-    if (std::find(needed_tilings.begin(), needed_tilings.end(), tiling) !=
+    if (std::find(needed_tilings.begin(), needed_tilings.end(), tiling.get()) !=
         needed_tilings.end()) {
       continue;
     }
 
-    to_remove.push_back(tiling);
+    to_remove.push_back(tiling.get());
   }
 
   for (auto* tiling : to_remove) {
@@ -229,14 +232,16 @@
 }
 
 void PictureLayerTilingSet::RemoveNonIdealTilings() {
-  auto to_remove = tilings_.remove_if([](PictureLayerTiling* t) {
-    return t->resolution() == NON_IDEAL_RESOLUTION;
-  });
+  auto to_remove =
+      std::remove_if(tilings_.begin(), tilings_.end(),
+                     [](const scoped_ptr<PictureLayerTiling>& t) {
+                       return t->resolution() == NON_IDEAL_RESOLUTION;
+                     });
   tilings_.erase(to_remove, tilings_.end());
 }
 
 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() {
-  for (auto* tiling : tilings_)
+  for (const auto& tiling : tilings_)
     tiling->set_resolution(NON_IDEAL_RESOLUTION);
 }
 
@@ -252,50 +257,53 @@
       tree_, contents_scale, raster_source, client_,
       tiling_interest_area_padding_, skewport_target_time_in_seconds_,
       skewport_extrapolation_limit_in_content_pixels_));
-  PictureLayerTiling* appended = tilings_.back();
+  PictureLayerTiling* appended = tilings_.back().get();
 
-  tilings_.sort(LargestToSmallestScaleFunctor());
+  std::sort(tilings_.begin(), tilings_.end(), LargestToSmallestScaleFunctor());
   return appended;
 }
 
 int PictureLayerTilingSet::NumHighResTilings() const {
   return std::count_if(tilings_.begin(), tilings_.end(),
-                       [](PictureLayerTiling* tiling) {
-    return tiling->resolution() == HIGH_RESOLUTION;
-  });
+                       [](const scoped_ptr<PictureLayerTiling>& tiling) {
+                         return tiling->resolution() == HIGH_RESOLUTION;
+                       });
 }
 
 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScale(
     float scale) const {
   for (size_t i = 0; i < tilings_.size(); ++i) {
     if (tilings_[i]->contents_scale() == scale)
-      return tilings_[i];
+      return tilings_[i].get();
   }
-  return NULL;
+  return nullptr;
 }
 
 PictureLayerTiling* PictureLayerTilingSet::FindTilingWithResolution(
     TileResolution resolution) const {
-  auto iter = std::find_if(tilings_.begin(), tilings_.end(),
-                           [resolution](const PictureLayerTiling* tiling) {
-    return tiling->resolution() == resolution;
-  });
+  auto iter =
+      std::find_if(tilings_.begin(), tilings_.end(),
+                   [resolution](const scoped_ptr<PictureLayerTiling>& tiling) {
+                     return tiling->resolution() == resolution;
+                   });
   if (iter == tilings_.end())
-    return NULL;
-  return *iter;
+    return nullptr;
+  return iter->get();
 }
 
 void PictureLayerTilingSet::RemoveTilingsBelowScale(float minimum_scale) {
-  auto to_remove =
-      tilings_.remove_if([minimum_scale](PictureLayerTiling* tiling) {
+  auto to_remove = std::remove_if(
+      tilings_.begin(), tilings_.end(),
+      [minimum_scale](const scoped_ptr<PictureLayerTiling>& tiling) {
         return tiling->contents_scale() < minimum_scale;
       });
   tilings_.erase(to_remove, tilings_.end());
 }
 
 void PictureLayerTilingSet::RemoveTilingsAboveScale(float maximum_scale) {
-  auto to_remove =
-      tilings_.remove_if([maximum_scale](PictureLayerTiling* tiling) {
+  auto to_remove = std::remove_if(
+      tilings_.begin(), tilings_.end(),
+      [maximum_scale](const scoped_ptr<PictureLayerTiling>& tiling) {
         return tiling->contents_scale() > maximum_scale;
       });
   tilings_.erase(to_remove, tilings_.end());
@@ -306,8 +314,11 @@
 }
 
 void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) {
-  ScopedPtrVector<PictureLayerTiling>::iterator iter =
-    std::find(tilings_.begin(), tilings_.end(), tiling);
+  auto iter =
+      std::find_if(tilings_.begin(), tilings_.end(),
+                   [tiling](const scoped_ptr<PictureLayerTiling>& candidate) {
+                     return candidate.get() == tiling;
+                   });
   if (iter == tilings_.end())
     return;
   tilings_.erase(iter);
@@ -324,7 +335,7 @@
   // If a tiling exists within the max snapping ratio, snap to its scale.
   float snapped_contents_scale = start_scale;
   float snapped_ratio = snap_to_existing_tiling_ratio;
-  for (const auto* tiling : tilings_) {
+  for (const auto& tiling : tilings_) {
     float tiling_contents_scale = tiling->contents_scale();
     float ratio = LargerRatio(tiling_contents_scale, start_scale);
     if (ratio < snapped_ratio) {
@@ -349,7 +360,7 @@
     const Occlusion& occlusion_in_layer_space,
     bool can_require_tiles_for_activation) {
   bool updated = false;
-  for (auto* tiling : tilings_) {
+  for (const auto& tiling : tilings_) {
     tiling->set_can_require_tiles_for_activation(
         can_require_tiles_for_activation);
     updated |= tiling->ComputeTilePriorityRects(
@@ -361,7 +372,7 @@
 
 void PictureLayerTilingSet::GetAllPrioritizedTilesForTracing(
     std::vector<PrioritizedTile>* prioritized_tiles) const {
-  for (auto* tiling : tilings_)
+  for (const auto& tiling : tilings_)
     tiling->GetAllPrioritizedTilesForTracing(prioritized_tiles);
 }
 
@@ -378,7 +389,7 @@
 
   size_t tilings_size = set_->tilings_.size();
   for (ideal_tiling_ = 0; ideal_tiling_ < tilings_size; ++ideal_tiling_) {
-    PictureLayerTiling* tiling = set_->tilings_[ideal_tiling_];
+    PictureLayerTiling* tiling = set_->tilings_[ideal_tiling_].get();
     if (tiling->contents_scale() < ideal_contents_scale_) {
       if (ideal_tiling_ > 0)
         ideal_tiling_--;
@@ -412,13 +423,13 @@
 
 Tile* PictureLayerTilingSet::CoverageIterator::operator->() const {
   if (!tiling_iter_)
-    return NULL;
+    return nullptr;
   return *tiling_iter_;
 }
 
 Tile* PictureLayerTilingSet::CoverageIterator::operator*() const {
   if (!tiling_iter_)
-    return NULL;
+    return nullptr;
   return *tiling_iter_;
 }
 
@@ -431,10 +442,10 @@
 PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling()
     const {
   if (current_tiling_ == std::numeric_limits<size_t>::max())
-    return NULL;
+    return nullptr;
   if (current_tiling_ >= set_->tilings_.size())
-    return NULL;
-  return set_->tilings_[current_tiling_];
+    return nullptr;
+  return set_->tilings_[current_tiling_].get();
 }
 
 size_t PictureLayerTilingSet::CoverageIterator::NextTiling() const {
@@ -505,9 +516,7 @@
     // Construct a new iterator for the next tiling, but we need to loop
     // again until we get to a valid one.
     tiling_iter_ = PictureLayerTiling::CoverageIterator(
-        set_->tilings_[current_tiling_],
-        contents_scale_,
-        last_rect);
+        set_->tilings_[current_tiling_].get(), contents_scale_, last_rect);
   }
 
   return *this;
@@ -542,7 +551,7 @@
   TilingRange high_res_range(0, 0);
   TilingRange low_res_range(tilings_.size(), tilings_.size());
   for (size_t i = 0; i < tilings_size; ++i) {
-    const PictureLayerTiling* tiling = tilings_[i];
+    const PictureLayerTiling* tiling = tilings_[i].get();
     if (tiling->resolution() == HIGH_RESOLUTION)
       high_res_range = TilingRange(i, i + 1);
     if (tiling->resolution() == LOW_RESOLUTION)
diff --git a/cc/tiles/picture_layer_tiling_set.h b/cc/tiles/picture_layer_tiling_set.h
index c6d3589..ed1038f 100644
--- a/cc/tiles/picture_layer_tiling_set.h
+++ b/cc/tiles/picture_layer_tiling_set.h
@@ -9,7 +9,6 @@
 #include <vector>
 
 #include "cc/base/region.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/tiles/picture_layer_tiling.h"
 #include "ui/gfx/geometry/size.h"
 
@@ -79,9 +78,9 @@
       scoped_refptr<DisplayListRasterSource> raster_source);
   size_t num_tilings() const { return tilings_.size(); }
   int NumHighResTilings() const;
-  PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; }
+  PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx].get(); }
   const PictureLayerTiling* tiling_at(size_t idx) const {
-    return tilings_[idx];
+    return tilings_[idx].get();
   }
   WhichTree tree() const { return tree_; }
 
@@ -188,7 +187,7 @@
   void Remove(PictureLayerTiling* tiling);
   void VerifyTilings(const PictureLayerTilingSet* pending_twin_set) const;
 
-  ScopedPtrVector<PictureLayerTiling> tilings_;
+  std::vector<scoped_ptr<PictureLayerTiling>> tilings_;
 
   const size_t tiling_interest_area_padding_;
   const float skewport_target_time_in_seconds_;
diff --git a/cc/tiles/raster_tile_priority_queue_all.cc b/cc/tiles/raster_tile_priority_queue_all.cc
index ea3c14f..beca4d5a 100644
--- a/cc/tiles/raster_tile_priority_queue_all.cc
+++ b/cc/tiles/raster_tile_priority_queue_all.cc
@@ -15,8 +15,8 @@
   explicit RasterOrderComparator(TreePriority tree_priority)
       : tree_priority_(tree_priority) {}
 
-  bool operator()(const TilingSetRasterQueueAll* a_queue,
-                  const TilingSetRasterQueueAll* b_queue) const {
+  bool operator()(const scoped_ptr<TilingSetRasterQueueAll>& a_queue,
+                  const scoped_ptr<TilingSetRasterQueueAll>& b_queue) const {
     // Note that in this function, we have to return true if and only if
     // a is strictly lower priority than b.
     const TilePriority& a_priority = a_queue->Top().priority();
@@ -51,7 +51,7 @@
 void CreateTilingSetRasterQueues(
     const std::vector<PictureLayerImpl*>& layers,
     TreePriority tree_priority,
-    ScopedPtrVector<TilingSetRasterQueueAll>* queues) {
+    std::vector<scoped_ptr<TilingSetRasterQueueAll>>* queues) {
   DCHECK(queues->empty());
 
   for (auto* layer : layers) {
@@ -66,7 +66,8 @@
     if (!tiling_set_queue->IsEmpty())
       queues->push_back(tiling_set_queue.Pass());
   }
-  queues->make_heap(RasterOrderComparator(tree_priority));
+  std::make_heap(queues->begin(), queues->end(),
+                 RasterOrderComparator(tree_priority));
 }
 
 }  // namespace
@@ -93,32 +94,37 @@
 
 const PrioritizedTile& RasterTilePriorityQueueAll::Top() const {
   DCHECK(!IsEmpty());
-  const ScopedPtrVector<TilingSetRasterQueueAll>& next_queues = GetNextQueues();
+  const auto& next_queues = GetNextQueues();
   return next_queues.front()->Top();
 }
 
 void RasterTilePriorityQueueAll::Pop() {
   DCHECK(!IsEmpty());
 
-  ScopedPtrVector<TilingSetRasterQueueAll>& next_queues = GetNextQueues();
-  next_queues.pop_heap(RasterOrderComparator(tree_priority_));
-  TilingSetRasterQueueAll* queue = next_queues.back();
+  auto& next_queues = GetNextQueues();
+  std::pop_heap(next_queues.begin(), next_queues.end(),
+                RasterOrderComparator(tree_priority_));
+  TilingSetRasterQueueAll* queue = next_queues.back().get();
   queue->Pop();
 
   // Remove empty queues.
-  if (queue->IsEmpty())
+  if (queue->IsEmpty()) {
     next_queues.pop_back();
-  else
-    next_queues.push_heap(RasterOrderComparator(tree_priority_));
+  } else {
+    std::push_heap(next_queues.begin(), next_queues.end(),
+                   RasterOrderComparator(tree_priority_));
+  }
 }
 
-ScopedPtrVector<TilingSetRasterQueueAll>&
+std::vector<scoped_ptr<TilingSetRasterQueueAll>>&
 RasterTilePriorityQueueAll::GetNextQueues() {
-  return const_cast<ScopedPtrVector<TilingSetRasterQueueAll>&>(
-      static_cast<const RasterTilePriorityQueueAll*>(this)->GetNextQueues());
+  const auto* const_this = static_cast<const RasterTilePriorityQueueAll*>(this);
+  const auto& const_queues = const_this->GetNextQueues();
+  return const_cast<std::vector<scoped_ptr<TilingSetRasterQueueAll>>&>(
+      const_queues);
 }
 
-const ScopedPtrVector<TilingSetRasterQueueAll>&
+const std::vector<scoped_ptr<TilingSetRasterQueueAll>>&
 RasterTilePriorityQueueAll::GetNextQueues() const {
   DCHECK(!IsEmpty());
 
diff --git a/cc/tiles/raster_tile_priority_queue_all.h b/cc/tiles/raster_tile_priority_queue_all.h
index 507467f..10dc1f7 100644
--- a/cc/tiles/raster_tile_priority_queue_all.h
+++ b/cc/tiles/raster_tile_priority_queue_all.h
@@ -33,11 +33,11 @@
              const std::vector<PictureLayerImpl*>& pending_layers,
              TreePriority tree_priority);
 
-  ScopedPtrVector<TilingSetRasterQueueAll>& GetNextQueues();
-  const ScopedPtrVector<TilingSetRasterQueueAll>& GetNextQueues() const;
+  std::vector<scoped_ptr<TilingSetRasterQueueAll>>& GetNextQueues();
+  const std::vector<scoped_ptr<TilingSetRasterQueueAll>>& GetNextQueues() const;
 
-  ScopedPtrVector<TilingSetRasterQueueAll> active_queues_;
-  ScopedPtrVector<TilingSetRasterQueueAll> pending_queues_;
+  std::vector<scoped_ptr<TilingSetRasterQueueAll>> active_queues_;
+  std::vector<scoped_ptr<TilingSetRasterQueueAll>> pending_queues_;
   TreePriority tree_priority_;
 
   DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueueAll);
diff --git a/cc/tiles/raster_tile_priority_queue_required.cc b/cc/tiles/raster_tile_priority_queue_required.cc
index bccc34b..5c5fd7e7 100644
--- a/cc/tiles/raster_tile_priority_queue_required.cc
+++ b/cc/tiles/raster_tile_priority_queue_required.cc
@@ -12,7 +12,7 @@
 
 void AppendTilingSetRequiredQueues(
     const std::vector<PictureLayerImpl*>& layers,
-    ScopedPtrVector<TilingSetRasterQueueRequired>* queues) {
+    std::vector<scoped_ptr<TilingSetRasterQueueRequired>>* queues) {
   for (auto* layer : layers) {
     if (!layer->HasValidTilePriorities())
       continue;
diff --git a/cc/tiles/raster_tile_priority_queue_required.h b/cc/tiles/raster_tile_priority_queue_required.h
index c554c189..3719d95 100644
--- a/cc/tiles/raster_tile_priority_queue_required.h
+++ b/cc/tiles/raster_tile_priority_queue_required.h
@@ -35,7 +35,7 @@
       const std::vector<PictureLayerImpl*>& active_layers,
       const std::vector<PictureLayerImpl*>& pending_layers);
 
-  ScopedPtrVector<TilingSetRasterQueueRequired> tiling_set_queues_;
+  std::vector<scoped_ptr<TilingSetRasterQueueRequired>> tiling_set_queues_;
 
   DISALLOW_COPY_AND_ASSIGN(RasterTilePriorityQueueRequired);
 };
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index e3c50b94..347aa6d 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -838,7 +838,7 @@
   pending_layer_->AddChild(pending_child.Pass());
 
   FakePictureLayerImpl* pending_child_layer =
-      static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]);
+      static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0].get());
   pending_child_layer->SetDrawsContent(true);
 
   host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
@@ -851,7 +851,7 @@
   SetupPendingTree(pending_raster_source);
 
   FakePictureLayerImpl* active_child_layer =
-      static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]);
+      static_cast<FakePictureLayerImpl*>(active_layer_->children()[0].get());
 
   std::set<Tile*> all_tiles;
   size_t tile_count = 0;
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc
index 7dbfa10c..70e5eb6 100644
--- a/cc/trees/damage_tracker_unittest.cc
+++ b/cc/trees/damage_tracker_unittest.cc
@@ -44,7 +44,7 @@
 
   // Recursively clear damage for any existing surface.
   for (size_t i = 0; i < layer->children().size(); ++i)
-    ClearDamageForAllSurfaces(layer->children()[i]);
+    ClearDamageForAllSurfaces(layer->children()[i].get());
 }
 
 void EmulateDrawingOneFrame(LayerImpl* root) {
@@ -202,8 +202,8 @@
 
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
 
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* child2 = root->children()[1];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* child2 = root->children()[1].get();
   gfx::Rect child_damage_rect =
       child1->render_surface()->damage_tracker()->current_damage_rect();
   gfx::Rect root_damage_rect =
@@ -223,7 +223,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForUpdateRects) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   // CASE 1: Setting the update rect should cause the corresponding damage to
   //         the surface.
@@ -263,7 +263,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForLayerDamageRects) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   // CASE 1: Adding the layer damage rect should cause the corresponding damage
   // to the surface.
@@ -315,7 +315,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForLayerUpdateAndDamageRects) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   // CASE 1: Adding the layer damage rect and update rect should cause the
   // corresponding damage to the surface.
@@ -357,7 +357,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForPropertyChanges) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   // CASE 1: The layer's property changed flag takes priority over update rect.
   //
@@ -406,7 +406,7 @@
   // transformed layer.
 
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   gfx::Transform rotation;
   rotation.Rotate(45.0);
@@ -456,7 +456,7 @@
   //
 
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   gfx::Transform transform;
   transform.Translate3d(500.0, 500.0, 0.0);
@@ -493,8 +493,8 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForBlurredSurface) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* surface = root->children()[0];
-  LayerImpl* child = surface->children()[0];
+  LayerImpl* surface = root->children()[0].get();
+  LayerImpl* child = surface->children()[0].get();
 
   FilterOperations filters;
   filters.Append(FilterOperation::CreateBlurFilter(5.f));
@@ -527,7 +527,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
   gfx::Rect root_damage_rect, child_damage_rect;
 
   // Allow us to set damage on child too.
@@ -580,8 +580,8 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForBackgroundBlurredChild) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* child2 = root->children()[1];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* child2 = root->children()[1].get();
 
   // Allow us to set damage on child1 too.
   child1->SetDrawsContent(true);
@@ -707,7 +707,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForAddingAndRemovingLayer) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child1 = root->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
 
   // CASE 1: Adding a new layer should cause the appropriate damage.
   //
@@ -787,7 +787,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForMultipleLayers) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child1 = root->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
 
   // In this test we don't want the above tree manipulation to be considered
   // part of the same frame.
@@ -800,7 +800,7 @@
     child2->SetDrawsContent(true);
     root->AddChild(child2.Pass());
   }
-  LayerImpl* child2 = root->children()[1];
+  LayerImpl* child2 = root->children()[1].get();
   EmulateDrawingOneFrame(root.get());
 
   // Damaging two layers simultaneously should cause combined damage.
@@ -818,9 +818,9 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForNestedSurfaces) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* child2 = root->children()[1];
-  LayerImpl* grand_child1 = root->children()[0]->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* child2 = root->children()[1].get();
+  LayerImpl* grand_child1 = root->children()[0]->children()[0].get();
   gfx::Rect child_damage_rect;
   gfx::Rect root_damage_rect;
 
@@ -864,8 +864,8 @@
   // entire surface should be marked dirty.
 
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* grand_child1 = root->children()[0]->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* grand_child1 = root->children()[0]->children()[0].get();
   gfx::Rect child_damage_rect;
   gfx::Rect root_damage_rect;
 
@@ -902,7 +902,7 @@
   // transforming it, while the root surface would be damaged appropriately.
 
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
   gfx::Rect child_damage_rect;
   gfx::Rect root_damage_rect;
 
@@ -928,7 +928,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForAddingAndRemovingRenderSurfaces) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
   gfx::Rect child_damage_rect;
   gfx::Rect root_damage_rect;
 
@@ -981,7 +981,7 @@
 
 TEST_F(DamageTrackerTest, VerifyNoDamageWhenNothingChanged) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
   gfx::Rect child_damage_rect;
   gfx::Rect root_damage_rect;
 
@@ -1011,7 +1011,7 @@
 
 TEST_F(DamageTrackerTest, VerifyNoDamageForUpdateRectThatDoesNotDrawContent) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
   gfx::Rect child_damage_rect;
   gfx::Rect root_damage_rect;
 
@@ -1030,9 +1030,9 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForReplica) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* grand_child1 = child1->children()[0];
-  LayerImpl* grand_child2 = child1->children()[1];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* grand_child1 = child1->children()[0].get();
+  LayerImpl* grand_child2 = child1->children()[1].get();
 
   // Damage on a surface that has a reflection should cause the target surface
   // to receive the surface's damage and the surface's reflected damage.
@@ -1134,7 +1134,7 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForMask) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   // In the current implementation of the damage tracker, changes to mask
   // layers should damage the entire corresponding surface.
@@ -1220,8 +1220,8 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForReplicaMask) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* grand_child1 = child1->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* grand_child1 = child1->children()[0].get();
 
   // Changes to a replica's mask should not damage the original surface,
   // because it is not masked. But it does damage the ancestor target surface.
@@ -1289,8 +1289,8 @@
 
 TEST_F(DamageTrackerTest, VerifyDamageForReplicaMaskWithTransformOrigin) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces();
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* grand_child1 = child1->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* grand_child1 = child1->children()[0].get();
 
   // Verify that the correct replica_origin_transform is used for the
   // replica_mask.
@@ -1348,7 +1348,7 @@
 
 TEST_F(DamageTrackerTest, DamageWhenAddedExternally) {
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   // Case 1: This test ensures that when the tracker is given damage, that
   //         it is included with any other partial damage.
@@ -1405,7 +1405,7 @@
   // If damage is not cleared, it should accumulate.
 
   scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface();
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
 
   ClearDamageForAllSurfaces(root.get());
   child->SetUpdateRect(gfx::Rect(10.f, 11.f, 1.f, 2.f));
@@ -1449,7 +1449,7 @@
 
   for (int i = 0; i < kRange; ++i) {
     scoped_ptr<LayerImpl> root = CreateTestTreeWithOneSurface();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
 
     gfx::Transform transform;
     transform.Translate(-kBigNumber, -kBigNumber);
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 74dc211..13e6680 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -814,9 +814,7 @@
 }
 
 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) {
-  ScopedPtrVector<SwapPromise>::iterator it = info->swap_promises.begin();
-  for (; it != info->swap_promises.end(); ++it) {
-    scoped_ptr<SwapPromise> swap_promise(info->swap_promises.take(it));
+  for (auto& swap_promise : info->swap_promises) {
     TRACE_EVENT_WITH_FLOW1("input,benchmark",
                            "LatencyInfo.Flow",
                            TRACE_ID_DONT_MANGLE(swap_promise->TraceId()),
@@ -1030,13 +1028,13 @@
 }
 
 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
-  for (auto* swap_promise : swap_promise_list_)
+  for (const auto& swap_promise : swap_promise_list_)
     swap_promise->DidNotSwap(reason);
   swap_promise_list_.clear();
 }
 
 void LayerTreeHost::OnCommitForSwapPromises() {
-  for (auto* swap_promise : swap_promise_list_)
+  for (const auto& swap_promise : swap_promise_list_)
     swap_promise->OnCommit();
 }
 
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index b3a7740..bb8944e 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -19,7 +19,6 @@
 #include "base/time/time.h"
 #include "cc/animation/animation_events.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/debug/frame_timing_tracker.h"
 #include "cc/debug/micro_benchmark.h"
 #include "cc/debug/micro_benchmark_controller.h"
@@ -491,7 +490,7 @@
   gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
   TaskGraphRunner* task_graph_runner_;
 
-  ScopedPtrVector<SwapPromise> swap_promise_list_;
+  std::vector<scoped_ptr<SwapPromise>> swap_promise_list_;
   std::set<SwapPromiseMonitor*> swap_promise_monitor_;
 
   PropertyTrees property_trees_;
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index dddb80c5..c9c7495 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -2574,23 +2574,23 @@
   if (compute_content_rects && render_to_separate_surface)
     layer->render_surface()->SetAccumulatedContentRect(gfx::Rect());
 
-  for (auto& child_layer : layer->children()) {
+  for (const auto& child_layer : layer->children()) {
     CalculateRenderSurfaceLayerListInternal(
-        child_layer, property_trees, render_surface_layer_list, descendants,
-        nearest_occlusion_immune_ancestor, layer_is_drawn,
+        child_layer.get(), property_trees, render_surface_layer_list,
+        descendants, nearest_occlusion_immune_ancestor, layer_is_drawn,
         can_render_to_separate_surface, current_render_surface_layer_list_id,
         max_texture_size, verify_property_trees, use_property_trees);
 
     // If the child is its own render target, then it has a render surface.
-    if (child_layer->render_target() == child_layer &&
+    if (child_layer->render_target() == child_layer.get() &&
         !child_layer->render_surface()->layer_list().empty() &&
         !child_layer->render_surface()->content_rect().IsEmpty()) {
       // This child will contribute its render surface, which means
       // we need to mark just the mask layer (and replica mask layer)
       // with the id.
       MarkMasksWithRenderSurfaceLayerListId(
-          child_layer, current_render_surface_layer_list_id);
-      descendants->push_back(child_layer);
+          child_layer.get(), current_render_surface_layer_list_id);
+      descendants->push_back(child_layer.get());
     }
 
     if (child_layer->layer_or_descendant_is_drawn()) {
diff --git a/cc/trees/layer_tree_host_common.h b/cc/trees/layer_tree_host_common.h
index 7593314..f17bc7f 100644
--- a/cc/trees/layer_tree_host_common.h
+++ b/cc/trees/layer_tree_host_common.h
@@ -9,9 +9,9 @@
 #include <vector>
 
 #include "base/bind.h"
+#include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/layers/layer_lists.h"
 #include "cc/trees/property_tree.h"
 #include "ui/gfx/geometry/rect.h"
@@ -149,7 +149,7 @@
 
   static LayerImpl* get_layer_as_raw_ptr(const OwnedLayerImplList& layers,
                                          size_t index) {
-    return layers[index];
+    return layers[index].get();
   }
 
   static LayerImpl* get_layer_as_raw_ptr(const LayerImplList& layers,
@@ -173,7 +173,10 @@
   float page_scale_delta;
   gfx::Vector2dF elastic_overscroll_delta;
   float top_controls_delta;
-  ScopedPtrVector<SwapPromise> swap_promises;
+  std::vector<scoped_ptr<SwapPromise>> swap_promises;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet);
 };
 
 template <typename LayerType>
diff --git a/cc/trees/layer_tree_host_common_perftest.cc b/cc/trees/layer_tree_host_common_perftest.cc
index 968224f..1373af8 100644
--- a/cc/trees/layer_tree_host_common_perftest.cc
+++ b/cc/trees/layer_tree_host_common_perftest.cc
@@ -14,7 +14,6 @@
 #include "base/strings/string_piece.h"
 #include "base/threading/thread.h"
 #include "base/time/time.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/debug/lap_timer.h"
 #include "cc/layers/layer.h"
 #include "cc/output/bsp_tree.h"
@@ -154,7 +153,7 @@
     BuildLayerImplList(active_tree->root_layer(), &base_list);
 
     int polygon_counter = 0;
-    ScopedPtrVector<DrawPolygon> polygon_list;
+    std::vector<scoped_ptr<DrawPolygon>> polygon_list;
     for (LayerImplList::iterator it = base_list.begin(); it != base_list.end();
          ++it) {
       DrawPolygon* draw_polygon =
@@ -184,7 +183,7 @@
     }
 
     for (size_t i = 0; i < layer->children().size(); i++) {
-      BuildLayerImplList(layer->children()[i], list);
+      BuildLayerImplList(layer->children()[i].get(), list);
     }
   }
 
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 53a804cf..926b9b0 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -6,6 +6,7 @@
 
 #include <algorithm>
 #include <set>
+#include <vector>
 
 #include "cc/animation/keyframed_animation_curve.h"
 #include "cc/animation/layer_animation_controller.h"
@@ -3289,7 +3290,7 @@
   host_impl.active_tree()->UpdateDrawProperties(update_lcd_text);
 
   LayerImpl* grand_child_ptr =
-      host_impl.active_tree()->root_layer()->children()[0]->children()[0];
+      host_impl.active_tree()->root_layer()->children()[0]->children()[0].get();
 
   // Though all layers have invertible transforms, matrix multiplication using
   // floating-point math makes the draw transform uninvertible.
@@ -5371,7 +5372,7 @@
   copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true);
   copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true);
 
-  ScopedPtrVector<CopyOutputRequest> copy_requests;
+  std::vector<scoped_ptr<CopyOutputRequest>> copy_requests;
   copy_requests.push_back(
       CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
   copy_layer->PassCopyRequests(&copy_requests);
@@ -5463,7 +5464,7 @@
                                true, false, false);
   copy_child->SetDrawsContent(true);
 
-  ScopedPtrVector<CopyOutputRequest> copy_requests;
+  std::vector<scoped_ptr<CopyOutputRequest>> copy_requests;
   copy_requests.push_back(
       CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
   copy_layer->PassCopyRequests(&copy_requests);
@@ -8523,7 +8524,7 @@
   // Now, even though child has zero opacity, we will configure |grandchild| and
   // |greatgrandchild| in several ways that should force the subtree to be
   // processed anyhow.
-  ScopedPtrVector<CopyOutputRequest> requests;
+  std::vector<scoped_ptr<CopyOutputRequest>> requests;
   requests.push_back(CopyOutputRequest::CreateEmptyRequest());
 
   greatgrandchild_ptr->PassCopyRequests(&requests);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index fcc98b5..47ed787 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -271,7 +271,7 @@
     animation_host_->SetMutatorHostClient(nullptr);
   }
 
-  CleanUpTileManager();
+  CleanUpTileManagerAndUIResources();
   renderer_ = nullptr;
   resource_provider_ = nullptr;
 
@@ -760,9 +760,10 @@
 
 static RenderPass* FindRenderPassById(const RenderPassList& list,
                                       RenderPassId id) {
-  auto it = std::find_if(list.begin(), list.end(),
-                         [id](const RenderPass* p) { return p->id == id; });
-  return it == list.end() ? nullptr : *it;
+  auto it = std::find_if(
+      list.begin(), list.end(),
+      [id](const scoped_ptr<RenderPass>& p) { return p->id == id; });
+  return it == list.end() ? nullptr : it->get();
 }
 
 DrawResult LayerTreeHostImpl::CalculateRenderPasses(
@@ -827,7 +828,7 @@
   // damage visualizations are done off the LayerImpls and RenderSurfaceImpls,
   // changing the RenderPass does not affect them.
   if (active_tree_->hud_layer()) {
-    RenderPass* root_pass = frame->render_passes.back();
+    RenderPass* root_pass = frame->render_passes.back().get();
     root_pass->damage_rect = root_pass->output_rect;
   }
 
@@ -994,7 +995,7 @@
     frame->render_passes.back()->has_transparent_background = false;
     AppendQuadsToFillScreen(
         active_tree_->RootScrollLayerDeviceViewportBounds(),
-        frame->render_passes.back(), active_tree_->root_layer(),
+        frame->render_passes.back().get(), active_tree_->root_layer(),
         active_tree_->background_color(), unoccluded_screen_space_region);
   }
 
@@ -1003,7 +1004,7 @@
 
   // Any copy requests left in the tree are not going to get serviced, and
   // should be aborted.
-  ScopedPtrVector<CopyOutputRequest> requests_to_abort;
+  std::vector<scoped_ptr<CopyOutputRequest>> requests_to_abort;
   while (!active_tree_->LayersWithCopyOutputRequest().empty()) {
     LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back();
     layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort);
@@ -1139,7 +1140,7 @@
   // Iterate RenderPasses in draw order, removing empty render passes (except
   // the root RenderPass).
   for (size_t i = 0; i < frame->render_passes.size(); ++i) {
-    RenderPass* pass = frame->render_passes[i];
+    RenderPass* pass = frame->render_passes[i].get();
 
     // Remove orphan RenderPassDrawQuads.
     for (auto it = pass->quad_list.begin(); it != pass->quad_list.end();) {
@@ -1182,7 +1183,7 @@
     // back-most (root) pass, in order to remove each qualified RenderPass, and
     // drop references to earlier RenderPasses allowing them to be removed to.
     RenderPass* pass =
-        frame->render_passes[frame->render_passes.size() - 2 - i];
+        frame->render_passes[frame->render_passes.size() - 2 - i].get();
     if (!pass->copy_requests.empty())
       continue;
     if (pass_references[pass->id])
@@ -1365,7 +1366,7 @@
   if (!policy.bytes_limit_when_visible && resource_pool_ &&
       settings_.using_synchronous_renderer_compositor) {
     ReleaseTreeResources();
-    CleanUpTileManager();
+    CleanUpTileManagerAndUIResources();
 
     // Force a call to NotifyAllTileTasks completed - otherwise this logic may
     // be skipped if no work was enqueued at the time the tile manager was
@@ -1774,7 +1775,7 @@
   // one.
   ReleaseTreeResources();
   if (resource_pool_) {
-    CleanUpTileManager();
+    CleanUpTileManagerAndUIResources();
     CreateTileManagerResources();
   }
   RecreateTreeResources();
@@ -2184,7 +2185,7 @@
   }
 
   if (use_zero_copy) {
-    *resource_pool = ResourcePool::CreateForImageTextureTarget(
+    *resource_pool = ResourcePool::CreateForGpuMemoryBufferResources(
         resource_provider_.get(), GetTaskRunner());
 
     *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
@@ -2227,7 +2228,8 @@
                                              main_frame_events.Pass());
 }
 
-void LayerTreeHostImpl::CleanUpTileManager() {
+void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
+  ClearUIResources();
   tile_manager_->FinishTasksAndCleanUp();
   resource_pool_ = nullptr;
   tile_task_worker_pool_ = nullptr;
@@ -2244,7 +2246,7 @@
 
   // Note: order is important here.
   renderer_ = nullptr;
-  CleanUpTileManager();
+  CleanUpTileManagerAndUIResources();
   resource_provider_ = nullptr;
 
   // Detach from the old output surface and reset |output_surface_| pointer
@@ -2299,10 +2301,7 @@
           : base::TimeDelta();
   client_->SetEstimatedParentDrawTime(parent_draw_time);
 
-  int max_frames_pending = output_surface_->capabilities().max_frames_pending;
-  if (max_frames_pending <= 0)
-    max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
-  client_->SetMaxSwapsPendingOnImplThread(max_frames_pending);
+  DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending);
   client_->OnCanDrawStateChanged(CanDraw());
 
   // There will not be anything to draw here, so set high res
@@ -3014,7 +3013,7 @@
   }
 
   for (size_t i = 0; i < layer_impl->children().size(); ++i)
-    CollectScrollDeltas(scroll_info, layer_impl->children()[i]);
+    CollectScrollDeltas(scroll_info, layer_impl->children()[i].get());
 }
 
 scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
@@ -3402,10 +3401,7 @@
   MarkUIResourceNotEvicted(uid);
 }
 
-void LayerTreeHostImpl::EvictAllUIResources() {
-  if (ui_resource_map_.empty())
-    return;
-
+void LayerTreeHostImpl::ClearUIResources() {
   for (UIResourceMap::const_iterator iter = ui_resource_map_.begin();
       iter != ui_resource_map_.end();
       ++iter) {
@@ -3413,6 +3409,12 @@
     resource_provider_->DeleteResource(iter->second.resource_id);
   }
   ui_resource_map_.clear();
+}
+
+void LayerTreeHostImpl::EvictAllUIResources() {
+  if (ui_resource_map_.empty())
+    return;
+  ClearUIResources();
 
   client_->SetNeedsCommitOnImplThread();
   client_->OnCanDrawStateChanged(CanDraw());
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index e8d981a..583a4adf 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -93,7 +93,6 @@
   virtual void CommitVSyncParameters(base::TimeTicks timebase,
                                      base::TimeDelta interval) = 0;
   virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0;
-  virtual void SetMaxSwapsPendingOnImplThread(int max) = 0;
   virtual void DidSwapBuffersOnImplThread() = 0;
   virtual void DidSwapBuffersCompleteOnImplThread() = 0;
   virtual void OnResourcelessSoftareDrawStateChanged(
@@ -223,6 +222,9 @@
 
     // RenderPassSink implementation.
     void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override;
+
+   private:
+    DISALLOW_COPY_AND_ASSIGN(FrameData);
   };
 
   virtual void BeginMainFrameAborted(CommitEarlyOutReason reason);
@@ -633,7 +635,7 @@
       const gfx::Vector2dF& viewport_delta);
 
   void CreateAndSetRenderer();
-  void CleanUpTileManager();
+  void CleanUpTileManagerAndUIResources();
   void CreateTileManagerResources();
   void ReleaseTreeResources();
   void RecreateTreeResources();
@@ -686,6 +688,7 @@
   void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
 
   void MarkUIResourceNotEvicted(UIResourceId uid);
+  void ClearUIResources();
 
   void NotifySwapPromiseMonitorsOfSetNeedsRedraw();
   void NotifySwapPromiseMonitorsOfForwardingToMainThread();
@@ -738,7 +741,8 @@
   bool wheel_scrolling_;
   bool scroll_affects_scroll_handler_;
   int scroll_layer_id_when_mouse_over_scrollbar_;
-  ScopedPtrVector<SwapPromise> swap_promises_for_main_thread_scroll_update_;
+  std::vector<scoped_ptr<SwapPromise>>
+      swap_promises_for_main_thread_scroll_update_;
 
   // An object to implement the ScrollElasticityHelper interface and
   // hold all state related to elasticity. May be NULL if never requested.
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 849b566..80cd967 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -114,7 +114,6 @@
   void CommitVSyncParameters(base::TimeTicks timebase,
                              base::TimeDelta interval) override {}
   void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override {}
-  void SetMaxSwapsPendingOnImplThread(int max) override {}
   void DidSwapBuffersOnImplThread() override {}
   void DidSwapBuffersCompleteOnImplThread() override {}
   void OnResourcelessSoftareDrawStateChanged(bool resourceless_draw) override {}
@@ -192,7 +191,7 @@
   static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) {
     ASSERT_EQ(layer->ScrollDelta(), gfx::Vector2d());
     for (size_t i = 0; i < layer->children().size(); ++i)
-      ExpectClearedScrollDeltasRecursive(layer->children()[i]);
+      ExpectClearedScrollDeltasRecursive(layer->children()[i].get());
   }
 
   static ::testing::AssertionResult ScrollInfoContains(
@@ -317,7 +316,7 @@
     CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size);
 
     LayerImpl* content_layer =
-        host_impl_->OuterViewportScrollLayer()->children().back();
+        host_impl_->OuterViewportScrollLayer()->children().back().get();
     content_layer->SetBounds(content_size);
     host_impl_->OuterViewportScrollLayer()->SetBounds(content_size);
 
@@ -532,7 +531,8 @@
     root_layer->ScrollBy(scroll_delta);
     host_impl_->active_tree()->SetRootLayer(root_clip.Pass());
   }
-  LayerImpl* root = host_impl_->active_tree()->root_layer()->children()[0];
+  LayerImpl* root =
+      host_impl_->active_tree()->root_layer()->children()[0].get();
 
   scoped_ptr<ScrollAndScaleSet> scroll_info;
 
@@ -744,7 +744,7 @@
 
   // Create a normal scrollable root layer
   LayerImpl* root_scroll = SetupScrollAndContentsLayers(gfx::Size(100, 100));
-  LayerImpl* root_child = root_scroll->children()[0];
+  LayerImpl* root_child = root_scroll->children()[0].get();
   LayerImpl* root = host_impl_->active_tree()->root_layer();
   DrawFrame();
 
@@ -1042,7 +1042,7 @@
 
   gfx::Size overflow_size(400, 400);
   ASSERT_EQ(1u, scroll_layer->children().size());
-  LayerImpl* overflow = scroll_layer->children()[0];
+  LayerImpl* overflow = scroll_layer->children()[0].get();
   overflow->SetBounds(overflow_size);
   overflow->SetScrollClipLayer(scroll_layer->parent()->id());
   overflow->PushScrollOffsetFromMainThread(gfx::ScrollOffset());
@@ -1098,7 +1098,7 @@
   root->SetHasRenderSurface(true);
 
   root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2));
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
   child->SetBounds(gfx::Size(10, 10));
   child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
   child->SetDrawsContent(true);
@@ -1146,7 +1146,7 @@
   root->SetHasRenderSurface(true);
 
   root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2));
-  LayerImpl* child = root->children()[0];
+  LayerImpl* child = root->children()[0].get();
   child->SetBounds(gfx::Size(10, 10));
   child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
   child->SetDrawsContent(true);
@@ -2776,7 +2776,7 @@
   static void IgnoreResult(scoped_ptr<CopyOutputResult> result) {}
 
   void AddCopyRequest() {
-    ScopedPtrVector<CopyOutputRequest> requests;
+    std::vector<scoped_ptr<CopyOutputRequest>> requests;
     requests.push_back(
         CopyOutputRequest::CreateRequest(base::Bind(&IgnoreResult)));
     SetHasRenderSurface(true);
@@ -2813,7 +2813,7 @@
   root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
   root->SetHasRenderSurface(true);
   DidDrawCheckLayer* layer =
-      static_cast<DidDrawCheckLayer*>(root->children()[0]);
+      static_cast<DidDrawCheckLayer*>(root->children()[0].get());
 
   {
     LayerTreeHostImpl::FrameData frame;
@@ -2855,7 +2855,7 @@
   root->SetHasRenderSurface(true);
   root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
   DidDrawCheckLayer* layer =
-      static_cast<DidDrawCheckLayer*>(root->children()[0]);
+      static_cast<DidDrawCheckLayer*>(root->children()[0].get());
   // Ensure visible_layer_rect for layer is empty.
   layer->SetPosition(gfx::PointF(100.f, 100.f));
   layer->SetBounds(gfx::Size(10, 10));
@@ -2902,12 +2902,12 @@
 
   root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
   DidDrawCheckLayer* occluded_layer =
-      static_cast<DidDrawCheckLayer*>(root->children()[0]);
+      static_cast<DidDrawCheckLayer*>(root->children()[0].get());
 
   root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
   root->SetHasRenderSurface(true);
   DidDrawCheckLayer* top_layer =
-      static_cast<DidDrawCheckLayer*>(root->children()[1]);
+      static_cast<DidDrawCheckLayer*>(root->children()[1].get());
   // This layer covers the occluded_layer above. Make this layer large so it can
   // occlude.
   top_layer->SetBounds(big_size);
@@ -2939,11 +2939,11 @@
   root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
   root->SetHasRenderSurface(true);
   DidDrawCheckLayer* layer1 =
-      static_cast<DidDrawCheckLayer*>(root->children()[0]);
+      static_cast<DidDrawCheckLayer*>(root->children()[0].get());
 
   layer1->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
   DidDrawCheckLayer* layer2 =
-      static_cast<DidDrawCheckLayer*>(layer1->children()[0]);
+      static_cast<DidDrawCheckLayer*>(layer1->children()[0].get());
 
   layer1->SetHasRenderSurface(true);
   layer1->SetShouldFlattenTransform(true);
@@ -3113,8 +3113,8 @@
   for (size_t i = 0; i < cases.size(); ++i) {
     const auto& testcase = cases[i];
     std::vector<LayerImpl*> to_remove;
-    for (auto* child : root->children())
-      to_remove.push_back(child);
+    for (const auto& child : root->children())
+      to_remove.push_back(child.get());
     for (auto* child : to_remove)
       root->RemoveChild(child);
 
@@ -3127,7 +3127,7 @@
         testcase.layer_before.has_incomplete_tile,
         testcase.layer_before.is_animating, host_impl_->resource_provider()));
     DidDrawCheckLayer* before =
-        static_cast<DidDrawCheckLayer*>(root->children().back());
+        static_cast<DidDrawCheckLayer*>(root->children().back().get());
     if (testcase.layer_before.has_copy_request)
       before->AddCopyRequest();
 
@@ -3136,7 +3136,7 @@
         testcase.layer_between.has_incomplete_tile,
         testcase.layer_between.is_animating, host_impl_->resource_provider()));
     DidDrawCheckLayer* between =
-        static_cast<DidDrawCheckLayer*>(root->children().back());
+        static_cast<DidDrawCheckLayer*>(root->children().back().get());
     if (testcase.layer_between.has_copy_request)
       between->AddCopyRequest();
 
@@ -3145,7 +3145,7 @@
         testcase.layer_after.has_incomplete_tile,
         testcase.layer_after.is_animating, host_impl_->resource_provider()));
     DidDrawCheckLayer* after =
-        static_cast<DidDrawCheckLayer*>(root->children().back());
+        static_cast<DidDrawCheckLayer*>(root->children().back().get());
     if (testcase.layer_after.has_copy_request)
       after->AddCopyRequest();
 
@@ -3206,8 +3206,8 @@
   for (size_t i = 0; i < cases.size(); ++i) {
     const auto& testcase = cases[i];
     std::vector<LayerImpl*> to_remove;
-    for (auto* child : root->children())
-      to_remove.push_back(child);
+    for (const auto& child : root->children())
+      to_remove.push_back(child.get());
     for (auto* child : to_remove)
       root->RemoveChild(child);
 
@@ -3220,7 +3220,7 @@
         testcase.layer_before.has_incomplete_tile,
         testcase.layer_before.is_animating, host_impl_->resource_provider()));
     DidDrawCheckLayer* before =
-        static_cast<DidDrawCheckLayer*>(root->children().back());
+        static_cast<DidDrawCheckLayer*>(root->children().back().get());
     if (testcase.layer_before.has_copy_request)
       before->AddCopyRequest();
 
@@ -3229,7 +3229,7 @@
         testcase.layer_between.has_incomplete_tile,
         testcase.layer_between.is_animating, host_impl_->resource_provider()));
     DidDrawCheckLayer* between =
-        static_cast<DidDrawCheckLayer*>(root->children().back());
+        static_cast<DidDrawCheckLayer*>(root->children().back().get());
     if (testcase.layer_between.has_copy_request)
       between->AddCopyRequest();
 
@@ -3238,7 +3238,7 @@
         testcase.layer_after.has_incomplete_tile,
         testcase.layer_after.is_animating, host_impl_->resource_provider()));
     DidDrawCheckLayer* after =
-        static_cast<DidDrawCheckLayer*>(root->children().back());
+        static_cast<DidDrawCheckLayer*>(root->children().back().get());
     if (testcase.layer_after.has_copy_request)
       after->AddCopyRequest();
 
@@ -3390,7 +3390,8 @@
   int id = host_impl_->OuterViewportScrollLayer()->id();
   host_impl_->OuterViewportScrollLayer()->AddChild(
       LayerImpl::Create(host_impl_->active_tree(), id + 2));
-  LayerImpl* content = active_tree->OuterViewportScrollLayer()->children()[0];
+  LayerImpl* content =
+      active_tree->OuterViewportScrollLayer()->children()[0].get();
   content->SetBounds(gfx::Size(50, 50));
 
   DrawFrame();
@@ -4224,7 +4225,7 @@
   LayerImpl* scroll = SetupScrollAndContentsLayers(surface_size);
   scroll->SetDrawsContent(true);
   LayerImpl* root = host_impl_->active_tree()->root_layer();
-  LayerImpl* child = scroll->children()[0];
+  LayerImpl* child = scroll->children()[0].get();
   child->SetDrawsContent(true);
 
   scoped_ptr<LayerImpl> scrollable_child_clip =
@@ -4233,7 +4234,7 @@
       CreateScrollableLayer(7, surface_size, scrollable_child_clip.get());
   scrollable_child_clip->AddChild(scrollable_child.Pass());
   child->AddChild(scrollable_child_clip.Pass());
-  LayerImpl* grand_child = child->children()[0];
+  LayerImpl* grand_child = child->children()[0].get();
   grand_child->SetDrawsContent(true);
 
   // Set new page scale on impl thread by pinching.
@@ -4337,8 +4338,9 @@
         host_impl_->ProcessScrollDeltas();
 
     // The grand child should have scrolled up to its limit.
-    LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
-    LayerImpl* grand_child = child->children()[0];
+    LayerImpl* child =
+        host_impl_->active_tree()->root_layer()->children()[0].get();
+    LayerImpl* grand_child = child->children()[0].get();
     EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), grand_child->id(),
                                    gfx::Vector2d(0, -5)));
 
@@ -4393,8 +4395,9 @@
 
     // The grand child should have scrolled up to its limit.
     LayerImpl* child =
-        host_impl_->active_tree()->root_layer()->children()[0]->children()[0];
-    LayerImpl* grand_child = child->children()[0];
+        host_impl_->active_tree()->root_layer()->children()[0]->children()
+            [0].get();
+    LayerImpl* grand_child = child->children()[0].get();
     EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), grand_child->id(),
                                    gfx::Vector2d(0, -2)));
 
@@ -5369,7 +5372,7 @@
                                    2,
                                    host_impl_->resource_provider()));
   BlendStateCheckLayer* layer1 =
-      static_cast<BlendStateCheckLayer*>(root->children()[0]);
+      static_cast<BlendStateCheckLayer*>(root->children()[0].get());
   layer1->SetPosition(gfx::PointF(2.f, 2.f));
 
   LayerTreeHostImpl::FrameData frame;
@@ -5417,7 +5420,7 @@
                                    3,
                                    host_impl_->resource_provider()));
   BlendStateCheckLayer* layer2 =
-      static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
+      static_cast<BlendStateCheckLayer*>(layer1->children()[0].get());
   layer2->SetPosition(gfx::PointF(4.f, 4.f));
 
   // 2 opaque layers, drawn without blending.
@@ -5605,7 +5608,7 @@
                                      2,
                                      host_impl_->resource_provider()));
     child_ = static_cast<BlendStateCheckLayer*>(
-        host_impl_->active_tree()->root_layer()->children()[0]);
+        host_impl_->active_tree()->root_layer()->children()[0].get());
     child_->SetExpectation(false, false);
     child_->SetContentsOpaque(true);
   }
@@ -6433,14 +6436,15 @@
       ASSERT_EQ(1u, frame.render_passes.size());
 
       // Verify the damage rect for the root render pass.
-      const RenderPass* root_render_pass = frame.render_passes.back();
+      const RenderPass* root_render_pass = frame.render_passes.back().get();
       EXPECT_EQ(expected_damage, root_render_pass->damage_rect);
 
       // Verify the root and child layers' quads are generated and not being
       // culled.
       ASSERT_EQ(2u, root_render_pass->quad_list.size());
 
-      LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
+      LayerImpl* child =
+          host_impl_->active_tree()->root_layer()->children()[0].get();
       gfx::Rect expected_child_visible_rect(child->bounds());
       EXPECT_EQ(expected_child_visible_rect,
                 root_render_pass->quad_list.front()->visible_rect);
@@ -6882,7 +6886,7 @@
 
   SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
 
-  ScopedPtrVector<CopyOutputRequest> requests;
+  std::vector<scoped_ptr<CopyOutputRequest>> requests;
   requests.push_back(CopyOutputRequest::CreateRequest(
       base::Bind(&ShutdownReleasesContext_Callback)));
 
@@ -6981,8 +6985,9 @@
   {
     scoped_ptr<ScrollAndScaleSet> scroll_info;
     LayerImpl* child =
-        host_impl_->active_tree()->root_layer()->children()[0]->children()[0];
-    LayerImpl* grand_child = child->children()[0];
+        host_impl_->active_tree()->root_layer()->children()[0]->children()
+            [0].get();
+    LayerImpl* grand_child = child->children()[0].get();
 
     gfx::Vector2d scroll_delta(0, -2);
     EXPECT_EQ(InputHandler::SCROLL_STARTED,
@@ -8320,8 +8325,10 @@
 TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) {
   const gfx::Size layer_size(100, 100);
   SetupScrollAndContentsLayers(layer_size);
-  LayerImpl* content_layer =
-      host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
+  LayerImpl* content_layer = host_impl_->active_tree()
+                                 ->OuterViewportScrollLayer()
+                                 ->children()[0]
+                                 .get();
   RebuildPropertyTrees();
 
   bool update_lcd_text = false;
@@ -8355,8 +8362,10 @@
 TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsVisibleRects) {
   const gfx::Size layer_size(100, 100);
   SetupScrollAndContentsLayers(layer_size);
-  LayerImpl* content_layer =
-      host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
+  LayerImpl* content_layer = host_impl_->active_tree()
+                                 ->OuterViewportScrollLayer()
+                                 ->children()[0]
+                                 .get();
   RebuildPropertyTrees();
 
   bool update_lcd_text = false;
@@ -8393,8 +8402,10 @@
 TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsSublayerScaleFactor) {
   const gfx::Size layer_size(100, 100);
   SetupScrollAndContentsLayers(layer_size);
-  LayerImpl* content_layer =
-      host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
+  LayerImpl* content_layer = host_impl_->active_tree()
+                                 ->OuterViewportScrollLayer()
+                                 ->children()[0]
+                                 .get();
   content_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100));
   LayerImpl* test_layer = host_impl_->active_tree()->LayerById(100);
   test_layer->SetHasRenderSurface(true);
@@ -8712,18 +8723,19 @@
 }
 
 size_t CountRenderPassesWithId(const RenderPassList& list, RenderPassId id) {
-  return std::count_if(list.begin(), list.end(),
-                       [id](const RenderPass* p) { return p->id == id; });
+  return std::count_if(
+      list.begin(), list.end(),
+      [id](const scoped_ptr<RenderPass>& p) { return p->id == id; });
 }
 
 TEST_F(LayerTreeHostImplTest, RemoveUnreferencedRenderPass) {
   LayerTreeHostImpl::FrameData frame;
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass3 = frame.render_passes.back();
+  RenderPass* pass3 = frame.render_passes.back().get();
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass2 = frame.render_passes.back();
+  RenderPass* pass2 = frame.render_passes.back().get();
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass1 = frame.render_passes.back();
+  RenderPass* pass1 = frame.render_passes.back().get();
 
   pass1->SetNew(RenderPassId(1, 0), gfx::Rect(), gfx::Rect(), gfx::Transform());
   pass2->SetNew(RenderPassId(2, 0), gfx::Rect(), gfx::Rect(), gfx::Transform());
@@ -8759,11 +8771,11 @@
 TEST_F(LayerTreeHostImplTest, RemoveEmptyRenderPass) {
   LayerTreeHostImpl::FrameData frame;
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass3 = frame.render_passes.back();
+  RenderPass* pass3 = frame.render_passes.back().get();
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass2 = frame.render_passes.back();
+  RenderPass* pass2 = frame.render_passes.back().get();
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass1 = frame.render_passes.back();
+  RenderPass* pass1 = frame.render_passes.back().get();
 
   pass1->SetNew(RenderPassId(1, 0), gfx::Rect(), gfx::Rect(), gfx::Transform());
   pass2->SetNew(RenderPassId(2, 0), gfx::Rect(), gfx::Rect(), gfx::Transform());
@@ -8804,11 +8816,11 @@
 TEST_F(LayerTreeHostImplTest, DoNotRemoveEmptyRootRenderPass) {
   LayerTreeHostImpl::FrameData frame;
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass3 = frame.render_passes.back();
+  RenderPass* pass3 = frame.render_passes.back().get();
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass2 = frame.render_passes.back();
+  RenderPass* pass2 = frame.render_passes.back().get();
   frame.render_passes.push_back(RenderPass::Create());
-  RenderPass* pass1 = frame.render_passes.back();
+  RenderPass* pass1 = frame.render_passes.back().get();
 
   pass1->SetNew(RenderPassId(1, 0), gfx::Rect(), gfx::Rect(), gfx::Transform());
   pass2->SetNew(RenderPassId(2, 0), gfx::Rect(), gfx::Rect(), gfx::Transform());
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 3ceb3e1..5e4e1ef 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1649,7 +1649,7 @@
     FakePictureLayerImpl* root =
         static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer());
     FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>(
-        impl->active_tree()->root_layer()->children()[0]);
+        impl->active_tree()->root_layer()->children()[0].get());
 
     // Positions remain in layout pixels.
     EXPECT_EQ(gfx::PointF(), root->position());
@@ -2443,7 +2443,7 @@
     if (host_impl->GetDrawMode() == DRAW_MODE_RESOURCELESS_SOFTWARE) {
       EXPECT_EQ(1u, frame_data->render_passes.size());
       // Has at least 3 quads for each layer.
-      RenderPass* render_pass = frame_data->render_passes[0];
+      RenderPass* render_pass = frame_data->render_passes[0].get();
       EXPECT_GE(render_pass->quad_list.size(), 3u);
     } else {
       EXPECT_EQ(2u, frame_data->render_passes.size());
@@ -3014,21 +3014,21 @@
 
     if (root_impl_ && root_impl_->children().size() > 0) {
       child_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
-          root_impl_->children()[0]);
+          root_impl_->children()[0].get());
 
       if (child_impl_ && child_impl_->children().size() > 0)
         grandchild_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
-            child_impl_->children()[0]);
+            child_impl_->children()[0].get());
     }
 
     if (root_impl_ && root_impl_->children().size() > 1) {
       child2_impl_ = static_cast<PushPropertiesCountingLayerImpl*>(
-          root_impl_->children()[1]);
+          root_impl_->children()[1].get());
 
       if (child2_impl_ && child2_impl_->children().size() > 0)
         leaf_always_pushing_layer_impl_ =
             static_cast<PushPropertiesCountingLayerImpl*>(
-                child2_impl_->children()[0]);
+                child2_impl_->children()[0].get());
     }
 
     if (root_impl_)
@@ -3770,8 +3770,8 @@
 
   void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* parent = root->children()[0];
-    LayerImpl* child = parent->children()[0];
+    LayerImpl* parent = root->children()[0].get();
+    LayerImpl* child = parent->children()[0].get();
 
     switch (impl->active_tree()->source_frame_number()) {
       case 1:
@@ -5071,7 +5071,7 @@
     if (frame_data->has_no_damage)
       return 0.f;
     float frame_scale = 0.f;
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     for (const auto& draw_quad : root_pass->quad_list) {
       // Checkerboards mean an incomplete frame.
       if (draw_quad->material != DrawQuad::TILED_CONTENT)
@@ -5367,7 +5367,7 @@
     if (frame_data->has_no_damage)
       return 0.f;
     float frame_scale = 0.f;
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     for (const auto& draw_quad : root_pass->quad_list) {
       const TileDrawQuad* quad = TileDrawQuad::MaterialCast(draw_quad);
       float quad_scale =
@@ -5816,7 +5816,7 @@
                                    LayerTreeHostImpl::FrameData* frame_data,
                                    DrawResult draw_result) override {
     EXPECT_EQ(2u, frame_data->render_passes.size());
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     EXPECT_EQ(2u, root_pass->quad_list.size());
 
     // There's a solid color quad under everything.
@@ -5900,7 +5900,7 @@
                                    LayerTreeHostImpl::FrameData* frame_data,
                                    DrawResult draw_result) override {
     EXPECT_EQ(2u, frame_data->render_passes.size());
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     EXPECT_EQ(2u, root_pass->quad_list.size());
 
     // There's a solid color quad under everything.
@@ -5988,7 +5988,7 @@
                                    LayerTreeHostImpl::FrameData* frame_data,
                                    DrawResult draw_result) override {
     EXPECT_EQ(2u, frame_data->render_passes.size());
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     EXPECT_EQ(2u, root_pass->quad_list.size());
 
     // There's a solid color quad under everything.
@@ -6079,7 +6079,7 @@
                                    LayerTreeHostImpl::FrameData* frame_data,
                                    DrawResult draw_result) override {
     EXPECT_EQ(2u, frame_data->render_passes.size());
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     EXPECT_EQ(3u, root_pass->quad_list.size());
 
     // There's a solid color quad under everything.
@@ -6177,7 +6177,7 @@
                                    LayerTreeHostImpl::FrameData* frame_data,
                                    DrawResult draw_result) override {
     EXPECT_EQ(2u, frame_data->render_passes.size());
-    RenderPass* root_pass = frame_data->render_passes.back();
+    RenderPass* root_pass = frame_data->render_passes.back().get();
     EXPECT_EQ(3u, root_pass->quad_list.size());
 
     // There's a solid color quad under everything.
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 30e6f35..4ae38fe 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -741,7 +741,7 @@
     }
 
     LayerImpl* scroll_layer_impl =
-        host_impl->active_tree()->root_layer()->children()[0];
+        host_impl->active_tree()->root_layer()->children()[0].get();
     Animation* animation =
         scroll_layer_impl->layer_animation_controller()->GetAnimation(
             Animation::SCROLL_OFFSET);
@@ -764,7 +764,7 @@
     if (host_impl->pending_tree()->source_frame_number() != 1)
       return;
     LayerImpl* scroll_layer_impl =
-        host_impl->pending_tree()->root_layer()->children()[0];
+        host_impl->pending_tree()->root_layer()->children()[0].get();
     EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset());
   }
 
@@ -772,7 +772,7 @@
     if (host_impl->active_tree()->source_frame_number() != 1)
       return;
     LayerImpl* scroll_layer_impl =
-        host_impl->active_tree()->root_layer()->children()[0];
+        host_impl->active_tree()->root_layer()->children()[0].get();
     EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset());
     EndTest();
   }
@@ -910,7 +910,7 @@
       return;
 
     LayerImpl* root = host_impl->sync_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     LayerAnimationController* controller_impl =
         child->layer_animation_controller();
     Animation* animation = controller_impl->GetAnimation(Animation::TRANSFORM);
@@ -1088,7 +1088,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
     LayerImpl* root = host_impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     switch (host_impl->active_tree()->source_frame_number()) {
       case 0:
         // No animation yet.
@@ -1149,7 +1149,7 @@
 
   void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
     LayerImpl* root = host_impl->sync_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     switch (host_impl->sync_tree()->source_frame_number()) {
       case 0:
         // No animation yet.
@@ -1170,7 +1170,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
     LayerImpl* root = host_impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     switch (host_impl->active_tree()->source_frame_number()) {
       case 0:
         // No animation yet.
@@ -1238,7 +1238,7 @@
         gfx::Transform expected_transform;
         expected_transform.Translate(5.f, 5.f);
         LayerImpl* layer_impl =
-            host_impl->sync_tree()->root_layer()->children()[0];
+            host_impl->sync_tree()->root_layer()->children()[0].get();
         EXPECT_EQ(expected_transform, layer_impl->draw_transform());
         EndTest();
         break;
diff --git a/cc/trees/layer_tree_host_unittest_animation_timelines.cc b/cc/trees/layer_tree_host_unittest_animation_timelines.cc
index 69c42ef..30b69ee 100644
--- a/cc/trees/layer_tree_host_unittest_animation_timelines.cc
+++ b/cc/trees/layer_tree_host_unittest_animation_timelines.cc
@@ -658,7 +658,7 @@
         timeline_impl->GetPlayerById(player_child_id_);
 
     LayerImpl* scroll_layer_impl =
-        host_impl->active_tree()->root_layer()->children()[0];
+        host_impl->active_tree()->root_layer()->children()[0].get();
     Animation* animation = player_impl->element_animations()
                                ->layer_animation_controller()
                                ->GetAnimation(Animation::SCROLL_OFFSET);
@@ -681,7 +681,7 @@
     if (host_impl->pending_tree()->source_frame_number() != 1)
       return;
     LayerImpl* scroll_layer_impl =
-        host_impl->pending_tree()->root_layer()->children()[0];
+        host_impl->pending_tree()->root_layer()->children()[0].get();
     EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset());
   }
 
@@ -689,7 +689,7 @@
     if (host_impl->active_tree()->source_frame_number() != 1)
       return;
     LayerImpl* scroll_layer_impl =
-        host_impl->active_tree()->root_layer()->children()[0];
+        host_impl->active_tree()->root_layer()->children()[0].get();
     EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset());
     EndTest();
   }
@@ -970,7 +970,7 @@
         gfx::Transform expected_transform;
         expected_transform.Translate(5.f, 5.f);
         LayerImpl* layer_impl =
-            host_impl->sync_tree()->root_layer()->children()[0];
+            host_impl->sync_tree()->root_layer()->children()[0].get();
         EXPECT_EQ(expected_transform, layer_impl->draw_transform());
         EndTest();
         break;
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 74b225e..3bb2170 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -648,7 +648,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
     FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>(
-        host_impl->active_tree()->root_layer()->children()[0]);
+        host_impl->active_tree()->root_layer()->children()[0].get());
     EXPECT_TRUE(picture_impl->HighResTiling()
                     ->TileAt(0, 0)
                     ->draw_info()
@@ -857,9 +857,9 @@
     root_picture = static_cast<FakePictureLayerImpl*>(
         host_impl->active_tree()->root_layer());
     child_picture =
-        static_cast<FakePictureLayerImpl*>(root_picture->children()[0]);
+        static_cast<FakePictureLayerImpl*>(root_picture->children()[0].get());
     grandchild_picture =
-        static_cast<FakePictureLayerImpl*>(child_picture->children()[0]);
+        static_cast<FakePictureLayerImpl*>(child_picture->children()[0].get());
 
     ++num_commits_;
     switch (num_commits_) {
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 28938e5..4340241 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -412,9 +412,9 @@
     Renderer* renderer = host_impl->renderer();
 
     LayerImpl* root = host_impl->active_tree()->root_layer();
-    LayerImpl* grand_parent = root->children()[0];
-    LayerImpl* parent = grand_parent->children()[0];
-    LayerImpl* copy_layer = parent->children()[0];
+    LayerImpl* grand_parent = root->children()[0].get();
+    LayerImpl* parent = grand_parent->children()[0].get();
+    LayerImpl* copy_layer = parent->children()[0].get();
 
     // |parent| owns a surface, but it was hidden and not part of the copy
     // request so it should not allocate any resource.
@@ -1051,7 +1051,7 @@
                                    LayerTreeHostImpl::FrameData* frame_data,
                                    DrawResult draw_result) override {
     LayerImpl* root = host_impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
 
     bool saw_root = false;
     bool saw_child = false;
diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc
index 6d2b71b..6ca11e9 100644
--- a/cc/trees/layer_tree_host_unittest_damage.cc
+++ b/cc/trees/layer_tree_host_unittest_damage.cc
@@ -410,8 +410,8 @@
     ++did_swaps_;
     EXPECT_TRUE(result);
     LayerImpl* root = host_impl->active_tree()->root_layer();
-    LayerImpl* scroll_clip_layer = root->children()[0];
-    LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
+    LayerImpl* scroll_clip_layer = root->children()[0].get();
+    LayerImpl* scroll_layer = scroll_clip_layer->children()[0].get();
     switch (did_swaps_) {
       case 1:
         // Test that modifying the position of the content layer (not
@@ -503,8 +503,8 @@
     ++did_swaps_;
     EXPECT_TRUE(result);
     LayerImpl* root = host_impl->active_tree()->root_layer();
-    LayerImpl* scroll_clip_layer = root->children()[0];
-    LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
+    LayerImpl* scroll_clip_layer = root->children()[0].get();
+    LayerImpl* scroll_layer = scroll_clip_layer->children()[0].get();
     switch (did_swaps_) {
       case 1:
         // Scroll on the thread.  This should damage the scrollbar for the
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index f53f20c..22dff3e 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -149,7 +149,7 @@
   }
 
   void AddTextureQuad(DelegatedFrameData* frame, ResourceId resource_id) {
-    RenderPass* render_pass = frame->render_pass_list[0];
+    RenderPass* render_pass = frame->render_pass_list[0].get();
     SharedQuadState* sqs = render_pass->CreateAndAppendSharedQuadState();
     TextureDrawQuad* quad =
         render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>();
@@ -253,7 +253,7 @@
   }
 
   void SetFrameData(scoped_ptr<DelegatedFrameData> frame_data) {
-    RenderPass* root_pass = frame_data->render_pass_list.back();
+    RenderPass* root_pass = frame_data->render_pass_list.back().get();
     gfx::Size frame_size = root_pass->output_rect.size();
 
     if (frame_provider_.get() && frame_size == frame_provider_->frame_size()) {
@@ -323,7 +323,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     TestContextProvider* context_provider = static_cast<TestContextProvider*>(
         host_impl->output_surface()->context_provider());
@@ -356,7 +357,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     EXPECT_EQ(2, num_activates_);
     EXPECT_FALSE(delegated_impl->ChildId());
@@ -382,14 +384,16 @@
     // Act like the context was lost while the layer is in the pending tree.
     LayerImpl* root_impl = host_impl->sync_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
     delegated_impl->ReleaseResources();
   }
 
   void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     // Should not try to activate a frame without a child id. If we did try to
     // activate we would crash.
@@ -462,7 +466,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     EXPECT_EQ(2, num_activates_);
     // Resources should have gotten cleared after the context was lost.
@@ -719,7 +724,8 @@
   void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -759,7 +765,8 @@
   void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1004,7 +1011,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1019,7 +1027,7 @@
     EXPECT_EQ(1u, delegated_impl->Resources().size());
     EXPECT_EQ(1u, delegated_impl->Resources().count(999));
 
-    const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0];
+    const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0].get();
     EXPECT_EQ(1u, pass->quad_list.size());
     const TextureDrawQuad* quad =
         TextureDrawQuad::MaterialCast(pass->quad_list.front());
@@ -1113,7 +1121,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1131,7 +1140,7 @@
     EXPECT_EQ(1u, delegated_impl->Resources().count(555));
     EXPECT_EQ(1u, delegated_impl->Resources().count(444));
 
-    const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0];
+    const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0].get();
     EXPECT_EQ(3u, pass->quad_list.size());
     const TextureDrawQuad* quad1 =
         TextureDrawQuad::MaterialCast(pass->quad_list.ElementAt(0));
@@ -1232,7 +1241,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1250,7 +1260,8 @@
         EXPECT_EQ(1u, delegated_impl->Resources().count(999));
         EXPECT_EQ(1u, delegated_impl->Resources().count(555));
 
-        const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0];
+        const RenderPass* pass =
+            delegated_impl->RenderPassesInDrawOrder()[0].get();
         EXPECT_EQ(2u, pass->quad_list.size());
         const TextureDrawQuad* quad1 =
             TextureDrawQuad::MaterialCast(pass->quad_list.ElementAt(0));
@@ -1272,7 +1283,8 @@
 
         // The bad frame is dropped though, we still have the frame with 999 and
         // 555 in it.
-        const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0];
+        const RenderPass* pass =
+            delegated_impl->RenderPassesInDrawOrder()[0].get();
         EXPECT_EQ(2u, pass->quad_list.size());
         const TextureDrawQuad* quad1 =
             TextureDrawQuad::MaterialCast(pass->quad_list.ElementAt(0));
@@ -1290,7 +1302,8 @@
         EXPECT_EQ(1u, delegated_impl->Resources().size());
         EXPECT_EQ(1u, delegated_impl->Resources().count(999));
 
-        const RenderPass* pass = delegated_impl->RenderPassesInDrawOrder()[0];
+        const RenderPass* pass =
+            delegated_impl->RenderPassesInDrawOrder()[0].get();
         EXPECT_EQ(1u, pass->quad_list.size());
         const TextureDrawQuad* quad1 =
             TextureDrawQuad::MaterialCast(pass->quad_list.front());
@@ -1350,7 +1363,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1426,7 +1440,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1493,7 +1508,8 @@
   void ReceiveResourceOnThread(LayerTreeHostImpl* host_impl) {
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1526,7 +1542,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -1659,7 +1676,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
 
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
@@ -2204,7 +2222,8 @@
 
     LayerImpl* root_impl = host_impl->active_tree()->root_layer();
     FakeDelegatedRendererLayerImpl* delegated_impl =
-        static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+        static_cast<FakeDelegatedRendererLayerImpl*>(
+            root_impl->children()[0].get());
     const ResourceProvider::ResourceIdMap& map =
         host_impl->resource_provider()->GetChildToParentMap(
             delegated_impl->ChildId());
diff --git a/cc/trees/layer_tree_host_unittest_occlusion.cc b/cc/trees/layer_tree_host_unittest_occlusion.cc
index 37c56d1..13496f5 100644
--- a/cc/trees/layer_tree_host_unittest_occlusion.cc
+++ b/cc/trees/layer_tree_host_unittest_occlusion.cc
@@ -49,7 +49,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
 
     // Verify the draw properties are valid.
     EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember());
@@ -102,7 +102,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     RenderSurfaceImpl* surface = child->render_surface();
 
     // Verify the draw properties are valid.
@@ -165,7 +165,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     RenderSurfaceImpl* surface = child->render_surface();
     LayerImpl* mask = child->mask_layer();
 
@@ -237,7 +237,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
+    LayerImpl* child = root->children()[0].get();
     RenderSurfaceImpl* surface = child->render_surface();
     LayerImpl* mask = child->mask_layer();
 
diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc
index 9c5d00e..ec42144 100644
--- a/cc/trees/layer_tree_host_unittest_picture.cc
+++ b/cc/trees/layer_tree_host_unittest_picture.cc
@@ -81,7 +81,8 @@
     }
 
     FakePictureLayerImpl* pending_picture_impl =
-        static_cast<FakePictureLayerImpl*>(pending_root_impl->children()[0]);
+        static_cast<FakePictureLayerImpl*>(
+            pending_root_impl->children()[0].get());
 
     if (!active_root_impl) {
       EXPECT_EQ(0, activates_);
@@ -96,7 +97,8 @@
     }
 
     FakePictureLayerImpl* active_picture_impl =
-        static_cast<FakePictureLayerImpl*>(active_root_impl->children()[0]);
+        static_cast<FakePictureLayerImpl*>(
+            active_root_impl->children()[0].get());
 
     // After the first activation, when we commit again, we'll have a pending
     // and active layer. Then we recreate a picture layer in the 4th activate
@@ -115,7 +117,8 @@
       EXPECT_EQ(2, activates_);
     } else {
       FakePictureLayerImpl* active_picture_impl =
-          static_cast<FakePictureLayerImpl*>(active_root_impl->children()[0]);
+          static_cast<FakePictureLayerImpl*>(
+              active_root_impl->children()[0].get());
       EXPECT_EQ(nullptr, active_picture_impl->GetPendingOrActiveTwinLayer());
     }
 
@@ -152,7 +155,7 @@
   void BeginTest() override { PostSetNeedsCommitToMainThread(); }
 
   void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
-    LayerImpl* child = impl->sync_tree()->root_layer()->children()[0];
+    LayerImpl* child = impl->sync_tree()->root_layer()->children()[0].get();
     FakePictureLayerImpl* picture_impl =
         static_cast<FakePictureLayerImpl*>(child);
     gfx::Size tile_size =
@@ -221,7 +224,7 @@
   void BeginTest() override { PostSetNeedsCommitToMainThread(); }
 
   void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
-    LayerImpl* child = impl->active_tree()->root_layer()->children()[0];
+    LayerImpl* child = impl->active_tree()->root_layer()->children()[0].get();
     FakePictureLayerImpl* picture_impl =
         static_cast<FakePictureLayerImpl*>(child);
     switch (++frame_) {
@@ -272,7 +275,7 @@
   }
 
   void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override {
-    LayerImpl* child = impl->sync_tree()->root_layer()->children()[0];
+    LayerImpl* child = impl->sync_tree()->root_layer()->children()[0].get();
     FakePictureLayerImpl* picture_impl =
         static_cast<FakePictureLayerImpl*>(child);
     PictureLayerTiling* tiling = picture_impl->HighResTiling();
@@ -326,8 +329,8 @@
 
   void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->sync_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
-    LayerImpl* gchild = child->children()[0];
+    LayerImpl* child = root->children()[0].get();
+    LayerImpl* gchild = child->children()[0].get();
     FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild);
 
     switch (impl->sync_tree()->source_frame_number()) {
@@ -348,8 +351,8 @@
 
   void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* child = root->children()[0];
-    LayerImpl* gchild = child->children()[0];
+    LayerImpl* child = root->children()[0].get();
+    LayerImpl* gchild = child->children()[0].get();
     FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild);
 
     switch (impl->active_tree()->source_frame_number()) {
@@ -430,8 +433,8 @@
 
   void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->sync_tree()->root_layer();
-    LayerImpl* pinch = root->children()[0];
-    LayerImpl* gchild = pinch->children()[0];
+    LayerImpl* pinch = root->children()[0].get();
+    LayerImpl* gchild = pinch->children()[0].get();
     FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild);
     ready_to_draw_ = false;
 
@@ -457,8 +460,8 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
     LayerImpl* root = impl->active_tree()->root_layer();
-    LayerImpl* pinch = root->children()[0];
-    LayerImpl* gchild = pinch->children()[0];
+    LayerImpl* pinch = root->children()[0].get();
+    LayerImpl* gchild = pinch->children()[0].get();
     FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild);
 
     if (frame_ != last_frame_drawn_)
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 6e8d3ed..9ee2ba27 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -564,7 +564,7 @@
     FakePictureLayerImpl* root_scroll_layer_impl =
         static_cast<FakePictureLayerImpl*>(impl->OuterViewportScrollLayer());
     FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>(
-        root_scroll_layer_impl->children()[0]);
+        root_scroll_layer_impl->children()[0].get());
 
     LayerImpl* expected_scroll_layer_impl = NULL;
     LayerImpl* expected_no_scroll_layer_impl = NULL;
diff --git a/cc/trees/layer_tree_host_unittest_video.cc b/cc/trees/layer_tree_host_unittest_video.cc
index 2ae61bd..9488cad 100644
--- a/cc/trees/layer_tree_host_unittest_video.cc
+++ b/cc/trees/layer_tree_host_unittest_video.cc
@@ -70,7 +70,7 @@
 
   void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
     VideoLayerImpl* video = static_cast<VideoLayerImpl*>(
-        host_impl->active_tree()->root_layer()->children()[0]);
+        host_impl->active_tree()->root_layer()->children()[0].get());
 
     EXPECT_EQ(media::VIDEO_ROTATION_90, video->video_rotation());
 
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 62289494..9250ce5 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -554,7 +554,7 @@
                                      : InnerViewportScrollLayer();
   if (!root_scroll_layer || root_scroll_layer->children().empty())
     return gfx::Rect();
-  LayerImpl* layer = root_scroll_layer->children()[0];
+  LayerImpl* layer = root_scroll_layer->children()[0].get();
   return MathUtil::MapEnclosingClippedRect(layer->screen_space_transform(),
                                            gfx::Rect(layer->bounds()));
 }
@@ -865,7 +865,7 @@
         root_layer(), [](LayerImpl* layer) { layer->DidBecomeActive(); });
   }
 
-  for (auto* swap_promise : swap_promise_list_)
+  for (const auto& swap_promise : swap_promise_list_)
     swap_promise->DidActivate();
   devtools_instrumentation::DidActivateLayerTree(layer_tree_host_impl_->id(),
                                                  source_frame_number_);
@@ -1078,12 +1078,12 @@
   state->EndArray();
 
   state->BeginArray("swap_promise_trace_ids");
-  for (auto* swap_promise : swap_promise_list_)
+  for (const auto& swap_promise : swap_promise_list_)
     state->AppendDouble(swap_promise->TraceId());
   state->EndArray();
 
   state->BeginArray("pinned_swap_promise_trace_ids");
-  for (auto* swap_promise : pinned_swap_promise_list_)
+  for (const auto& swap_promise : pinned_swap_promise_list_)
     state->AppendDouble(swap_promise->TraceId());
   state->EndArray();
 }
@@ -1133,27 +1133,27 @@
 }
 
 void LayerTreeImpl::PassSwapPromises(
-    ScopedPtrVector<SwapPromise>* new_swap_promise) {
-  for (auto* swap_promise : swap_promise_list_)
+    std::vector<scoped_ptr<SwapPromise>>* new_swap_promise) {
+  for (const auto& swap_promise : swap_promise_list_)
     swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS);
   swap_promise_list_.clear();
   swap_promise_list_.swap(*new_swap_promise);
 }
 
 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
-  for (auto* swap_promise : swap_promise_list_)
+  for (const auto& swap_promise : swap_promise_list_)
     swap_promise->DidSwap(metadata);
   swap_promise_list_.clear();
-  for (auto* swap_promise : pinned_swap_promise_list_)
+  for (const auto& swap_promise : pinned_swap_promise_list_)
     swap_promise->DidSwap(metadata);
   pinned_swap_promise_list_.clear();
 }
 
 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
-  for (auto* swap_promise : swap_promise_list_)
+  for (const auto& swap_promise : swap_promise_list_)
     swap_promise->DidNotSwap(reason);
   swap_promise_list_.clear();
-  for (auto* swap_promise : pinned_swap_promise_list_)
+  for (const auto& swap_promise : pinned_swap_promise_list_)
     swap_promise->DidNotSwap(reason);
   pinned_swap_promise_list_.clear();
 }
@@ -1492,8 +1492,8 @@
   size_t children_size = layer->children().size();
   for (size_t i = 0; i < children_size; ++i) {
     size_t index = children_size - 1 - i;
-    FindClosestMatchingLayer(screen_space_point, layer->children()[index], func,
-                             transform_tree, use_property_trees,
+    FindClosestMatchingLayer(screen_space_point, layer->children()[index].get(),
+                             func, transform_tree, use_property_trees,
                              data_for_recursion);
   }
 
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 60ef91e..2f8fbfc7 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -12,7 +12,6 @@
 
 #include "base/containers/hash_tables.h"
 #include "base/values.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/base/synced_property.h"
 #include "cc/input/layer_selection_bound.h"
 #include "cc/layers/layer_impl.h"
@@ -306,7 +305,7 @@
   void QueuePinnedSwapPromise(scoped_ptr<SwapPromise> swap_promise);
 
   // Take the |new_swap_promise| and append it to |swap_promise_list_|.
-  void PassSwapPromises(ScopedPtrVector<SwapPromise>* new_swap_promise);
+  void PassSwapPromises(std::vector<scoped_ptr<SwapPromise>>* new_swap_promise);
   void FinishSwapPromises(CompositorFrameMetadata* metadata);
   void BreakSwapPromises(SwapPromise::DidNotSwapReason reason);
 
@@ -482,8 +481,8 @@
 
   bool has_ever_been_drawn_;
 
-  ScopedPtrVector<SwapPromise> swap_promise_list_;
-  ScopedPtrVector<SwapPromise> pinned_swap_promise_list_;
+  std::vector<scoped_ptr<SwapPromise>> swap_promise_list_;
+  std::vector<scoped_ptr<SwapPromise>> pinned_swap_promise_list_;
 
   UIResourceRequestQueue ui_resource_request_queue_;
 
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index bffdbaf..a757d86 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -755,9 +755,9 @@
     root->AddChild(child2.Pass());
   }
 
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* child2 = root->children()[1];
-  LayerImpl* grand_child1 = child1->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* child2 = root->children()[1].get();
+  LayerImpl* grand_child1 = child1->children()[0].get();
 
   host_impl().SetViewportSize(root->bounds());
   host_impl().active_tree()->SetRootLayer(root.Pass());
@@ -983,9 +983,9 @@
     root->AddChild(child2.Pass());
   }
 
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* child2 = root->children()[1];
-  LayerImpl* grand_child1 = child1->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* child2 = root->children()[1].get();
+  LayerImpl* grand_child1 = child1->children()[0].get();
 
   host_impl().SetViewportSize(root->bounds());
   host_impl().active_tree()->SetRootLayer(root.Pass());
@@ -1215,9 +1215,9 @@
     root->AddChild(child2.Pass());
   }
 
-  LayerImpl* child1 = root->children()[0];
-  LayerImpl* child2 = root->children()[1];
-  LayerImpl* grand_child1 = child1->children()[0];
+  LayerImpl* child1 = root->children()[0].get();
+  LayerImpl* child2 = root->children()[1].get();
+  LayerImpl* grand_child1 = child1->children()[0].get();
 
   host_impl().SetViewportSize(root->bounds());
   host_impl().active_tree()->SetRootLayer(root.Pass());
@@ -1558,7 +1558,7 @@
   // The visible content rect for test_layer is actually 100x100, even though
   // its layout size is 50x50, positioned at 25x25.
   LayerImpl* test_layer =
-      host_impl().active_tree()->root_layer()->children()[0];
+      host_impl().active_tree()->root_layer()->children()[0].get();
   ASSERT_EQ(1u, RenderSurfaceLayerList().size());
   ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
 
@@ -1850,7 +1850,7 @@
   host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
 
   LayerImpl* test_layer =
-      host_impl().active_tree()->root_layer()->children()[0];
+      host_impl().active_tree()->root_layer()->children()[0].get();
   // As test_layer doesn't draw content, the layer list of root's render surface
   // should contain only the root layer.
   ASSERT_EQ(1u, RenderSurfaceLayerList().size());
@@ -1881,7 +1881,7 @@
 
   // We change the position of the test layer such that the test point is now
   // inside the test_layer.
-  test_layer = host_impl().active_tree()->root_layer()->children()[0];
+  test_layer = host_impl().active_tree()->root_layer()->children()[0].get();
   test_layer->SetPosition(gfx::PointF(10.f, 10.f));
   expected_screen_space_transform.MakeIdentity();
   expected_screen_space_transform.Translate(10.f, 10.f);
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 680b782a..958d532 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -210,7 +210,7 @@
   }
 
   void AddCopyRequest(LayerImpl* layer) {
-    ScopedPtrVector<CopyOutputRequest> requests;
+    std::vector<scoped_ptr<CopyOutputRequest>> requests;
     requests.push_back(CopyOutputRequest::CreateBitmapRequest(base::Bind(
         &OcclusionTrackerTest::CopyOutputCallback, base::Unretained(this))));
     layer->SetHasRenderSurface(true);
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 55f2c31..3bcf0180 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -482,11 +482,6 @@
     scheduler_on_impl_thread_->SetEstimatedParentDrawTime(draw_time);
 }
 
-void SingleThreadProxy::SetMaxSwapsPendingOnImplThread(int max) {
-  if (scheduler_on_impl_thread_)
-    scheduler_on_impl_thread_->SetMaxSwapsPending(max);
-}
-
 void SingleThreadProxy::DidSwapBuffersOnImplThread() {
   TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread");
   if (scheduler_on_impl_thread_)
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 591e0c1..edc522f3 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -85,7 +85,6 @@
   void CommitVSyncParameters(base::TimeTicks timebase,
                              base::TimeDelta interval) override;
   void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override;
-  void SetMaxSwapsPendingOnImplThread(int max) override;
   void DidSwapBuffersOnImplThread() override;
   void DidSwapBuffersCompleteOnImplThread() override;
   void OnResourcelessSoftareDrawStateChanged(bool resourceless_draw) override;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 60d13688..a1928408 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -308,10 +308,6 @@
   impl().scheduler->SetEstimatedParentDrawTime(draw_time);
 }
 
-void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) {
-  impl().scheduler->SetMaxSwapsPending(max);
-}
-
 void ThreadProxy::DidSwapBuffersOnImplThread() {
   impl().scheduler->DidSwapBuffers();
 }
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index 7be549e..771ada24 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -187,7 +187,6 @@
   void CommitVSyncParameters(base::TimeTicks timebase,
                              base::TimeDelta interval) override;
   void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override;
-  void SetMaxSwapsPendingOnImplThread(int max) override;
   void DidSwapBuffersOnImplThread() override;
   void DidSwapBuffersCompleteOnImplThread() override;
   void OnResourcelessSoftareDrawStateChanged(bool resourceless_draw) override;
diff --git a/cc/trees/tree_synchronizer.cc b/cc/trees/tree_synchronizer.cc
index 9c61acb..4ecf5d3c 100644
--- a/cc/trees/tree_synchronizer.cc
+++ b/cc/trees/tree_synchronizer.cc
@@ -25,10 +25,8 @@
     return;
 
   OwnedLayerImplList& children = layer_impl->children();
-  for (OwnedLayerImplList::iterator it = children.begin();
-       it != children.end();
-       ++it)
-    CollectExistingLayerImplRecursive(old_layers, children.take(it));
+  for (auto& child : children)
+    CollectExistingLayerImplRecursive(old_layers, std::move(child));
 
   CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeMaskLayer());
   CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeReplicaLayer());
@@ -163,8 +161,7 @@
     DCHECK_EQ(layer->children().size(), impl_children.size());
 
     for (size_t i = 0; i < layer->children().size(); ++i) {
-      PushPropertiesInternal(layer->child_at(i),
-                             impl_children[i],
+      PushPropertiesInternal(layer->child_at(i), impl_children[i].get(),
                              &num_dependents_need_push_properties);
     }
 
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index 741de6b..6d88157 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -187,8 +187,8 @@
 
   for (size_t i = 0; i < layer_children.size(); ++i) {
     SCOPED_TRACE(base::StringPrintf("child layer %" PRIuS, i).c_str());
-    ExpectTreesAreIdentical(
-        layer_children[i].get(), layer_impl_children[i], tree_impl);
+    ExpectTreesAreIdentical(layer_children[i].get(),
+                            layer_impl_children[i].get(), tree_impl);
   }
 }
 
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 075f5b71..cc49543 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -423,6 +423,13 @@
       ]
 
       if (is_win) {
+        if (symbol_level == 2) {
+          # Incremental linking doesn't work on this target in debug mode with
+          # full symbols, but does work in other cases, including minimal
+          # symbols.
+          configs -= [ "//build/config/win:default_incremental_linking" ]
+          configs += [ "//build/config/win:incremental_linking" ]
+        }
         # TODO(GYP) bug 512851: PGO on Windows.
         # ['chrome_pgo_phase==1', {
         #   'msvs_settings': {
diff --git a/chrome/VERSION b/chrome/VERSION
index 06949ab8..ab32995e 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=49
 MINOR=0
-BUILD=2567
+BUILD=2568
 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 7f15c9d8..8379c7a4 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -396,13 +396,6 @@
           "scope",
           [ "chrome_apk.gyp" ])
   sources = gypi_values.chrome_public_app_native_sources
-
-  # TODO(GYP):
-  #'target_conditions': [
-  #['component != "shared_library"', {
-  #'product_extension': '<(version_libchrome_short).so',
-  #}],
-  #],
 }
 
 chrome_public_apk_tmpl("chrome_public_apk") {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
index 4ae346a..92bcd1c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -84,6 +84,7 @@
 import org.chromium.chrome.browser.share.ShareHelper;
 import org.chromium.chrome.browser.smartcard.EmptyPKCS11AuthenticationManager;
 import org.chromium.chrome.browser.smartcard.PKCS11AuthenticationManager;
+import org.chromium.chrome.browser.sync.GmsCoreSyncListener;
 import org.chromium.chrome.browser.sync.SyncController;
 import org.chromium.chrome.browser.tab.AuthenticatorNavigationInterceptor;
 import org.chromium.chrome.browser.tab.Tab;
@@ -789,6 +790,14 @@
     }
 
     /**
+     * @return An instance of GmsCoreSyncListener to notify GmsCore of sync encryption key changes.
+     *         Will be null if one is unavailable.
+     */
+    public GmsCoreSyncListener createGmsCoreSyncListener() {
+        return null;
+    }
+
+    /**
      * @return An instance of AppDetailsDelegate that can be queried about app information for the
      *         App Banner feature.  Will be null if one is unavailable.
      */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
index ae8956c..089109d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
@@ -375,7 +375,7 @@
             // If the panel has never been opened before, getPromoOpenCount() will be 0.
             // Once the panel has been opened, regardless of whether or not the user has opted-in or
             // opted-out, the promo open count will be greater than zero.
-            return getPromoOpenCount() == 0;
+            return isUserUndecided() && getPromoOpenCount() == 0;
         }
 
         return false;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/GmsCoreSyncListener.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/GmsCoreSyncListener.java
new file mode 100644
index 0000000..4d3642ac
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/GmsCoreSyncListener.java
@@ -0,0 +1,42 @@
+// 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.
+
+package org.chromium.chrome.browser.sync;
+
+import org.chromium.base.VisibleForTesting;
+
+/**
+ * A listener that will share sync's custom passphrase encryption key with GmsCore.
+ *
+ * This is to prevent users from seeing the custom passphrase dialog pop up in GmsCore after they
+ * have already entered it in Chrome.
+ */
+public abstract class GmsCoreSyncListener implements ProfileSyncService.SyncStateChangedListener {
+    private boolean mGmsCoreInformed;
+
+    /**
+     * Inform GMSCore of a new custom passphrase encryption key.
+     *
+     * @param key The serialized NigoriKey proto.
+     */
+    public abstract void updateEncryptionKey(byte[] key);
+
+    @Override
+    @VisibleForTesting
+    public void syncStateChanged() {
+        ProfileSyncService syncService = ProfileSyncService.get();
+        boolean passphraseSet = syncService.isBackendInitialized()
+                && syncService.isUsingSecondaryPassphrase() && syncService.isCryptographerReady();
+        if (passphraseSet && !mGmsCoreInformed) {
+            byte[] key = syncService.getCustomPassphraseKey();
+            if (key.length > 0) {
+                updateEncryptionKey(key);
+                mGmsCoreInformed = true;
+            }
+        } else if (!passphraseSet && mGmsCoreInformed) {
+            // Prepare to inform GmsCore if a passphrase is set again.
+            mGmsCoreInformed = false;
+        }
+    }
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
index 31f6d5b..3daecc50e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
@@ -195,6 +195,11 @@
         return nativeIsUsingSecondaryPassphrase(mNativeProfileSyncServiceAndroid);
     }
 
+    public byte[] getCustomPassphraseKey() {
+        assert isUsingSecondaryPassphrase();
+        return nativeGetCustomPassphraseKey(mNativeProfileSyncServiceAndroid);
+    }
+
     /**
      * Checks if we need a passphrase to decrypt a currently-enabled data type. This returns false
      * if a passphrase is needed for a type that is not currently enabled.
@@ -496,6 +501,7 @@
     private native boolean nativeIsPassphraseRequiredForDecryption(
             long nativeProfileSyncServiceAndroid);
     private native boolean nativeIsUsingSecondaryPassphrase(long nativeProfileSyncServiceAndroid);
+    private native byte[] nativeGetCustomPassphraseKey(long nativeProfileSyncServiceAndroid);
     private native boolean nativeSetDecryptionPassphrase(
             long nativeProfileSyncServiceAndroid, String passphrase);
     private native void nativeSetEncryptionPassphrase(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
index 2e4ca579..ee25f4b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
@@ -14,6 +14,7 @@
 import org.chromium.base.Log;
 import org.chromium.base.ThreadUtils;
 import org.chromium.base.VisibleForTesting;
+import org.chromium.chrome.browser.ChromeApplication;
 import org.chromium.chrome.browser.identity.UniqueIdentificationGenerator;
 import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory;
 import org.chromium.chrome.browser.invalidation.InvalidationController;
@@ -90,6 +91,12 @@
                 }
             }
         });
+
+        GmsCoreSyncListener gmsCoreSyncListener =
+                ((ChromeApplication) context.getApplicationContext()).createGmsCoreSyncListener();
+        if (gmsCoreSyncListener != null) {
+            mProfileSyncService.addSyncStateChangedListener(gmsCoreSyncListener);
+        }
     }
 
     /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchEventFilterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchEventFilterTest.java
index ac8d0521..60f398a 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchEventFilterTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchEventFilterTest.java
@@ -36,6 +36,9 @@
     private static final float LAYOUT_WIDTH_DP = 600.f;
     private static final float LAYOUT_HEIGHT_DP = 800.f;
 
+    // A small value used to check whether two floats are almost equal.
+    private static final float EPSILON = 1e-04f;
+
     private float mTouchSlopDp;
     private float mDpToPx;
 
@@ -88,7 +91,7 @@
             if (!mShouldLockHorizontalMotionInSearchContentView) {
                 float propagatedEventY = mEventPropagatedToSearchContentView.getY();
                 float offsetY = mContextualSearchPanel.getContentY() * mDpToPx;
-                assertEquals(propagatedEventY - offsetY, e.getY());
+                assertEquals(propagatedEventY - offsetY, e.getY(), EPSILON);
             }
 
             // Propagates the event to the GestureDetector in order to be able to tell
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java
index a2b1df3..18dd5733 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java
@@ -361,6 +361,19 @@
         });
     }
 
+    /**
+     * Clear the server data (perform dashboard stop and clear).
+     */
+    public void clearServerData() {
+        checkFakeServerInitialized("useFakeServer must be called before clearing data");
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                nativeClearServerData(mNativeFakeServerHelperAndroid, sNativeFakeServer);
+            }
+        });
+    }
+
     private static void checkFakeServerInitialized(String failureMessage) {
         if (sNativeFakeServer == 0L) {
             throw new IllegalStateException(failureMessage);
@@ -399,4 +412,6 @@
             long nativeFakeServerHelperAndroid, long nativeFakeServer);
     private native void nativeDeleteEntity(
             long nativeFakeServerHelperAndroid, long nativeFakeServer, String id);
+    private native void nativeClearServerData(
+            long nativeFakeServerHelperAndroid, long nativeFakeServer);
 }
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java
new file mode 100644
index 0000000..8713add
--- /dev/null
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java
@@ -0,0 +1,129 @@
+// 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.
+
+package org.chromium.chrome.browser.sync;
+
+import android.accounts.Account;
+import android.test.suitebuilder.annotation.MediumTest;
+
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.Feature;
+import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
+
+/**
+ * Test suite for the GmsCoreSyncListener.
+ */
+public class GmsCoreSyncListenerTest extends SyncTestBase {
+    private static final String PASSPHRASE = "passphrase";
+
+    static class CountingGmsCoreSyncListener extends GmsCoreSyncListener {
+        private int mCallCount = 0;
+
+        @Override
+        public void updateEncryptionKey(byte[] key) {
+            mCallCount++;
+        }
+
+        public int callCount() {
+            return mCallCount;
+        }
+    }
+
+    private CountingGmsCoreSyncListener mListener;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mListener = new CountingGmsCoreSyncListener();
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                ProfileSyncService.get().addSyncStateChangedListener(mListener);
+            }
+        });
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                ProfileSyncService.get().removeSyncStateChangedListener(mListener);
+            }
+        });
+        super.tearDown();
+    }
+
+    @MediumTest
+    @Feature({"Sync"})
+    public void testGetsKey() throws Throwable {
+        Account account = setUpTestAccountAndSignInToSync();
+        assertEquals(0, mListener.callCount());
+        encryptWithPassphrase(PASSPHRASE);
+        waitForCallCount(1);
+        signOut();
+        signIn(account);
+        assertEquals(1, mListener.callCount());
+        decryptWithPassphrase(PASSPHRASE);
+        waitForCallCount(2);
+    }
+
+    @MediumTest
+    @Feature({"Sync"})
+    public void testClearData() throws Throwable {
+        setUpTestAccountAndSignInToSync();
+        assertEquals(0, mListener.callCount());
+        encryptWithPassphrase(PASSPHRASE);
+        waitForCallCount(1);
+        clearServerData();
+        startSync();
+        encryptWithPassphrase(PASSPHRASE);
+        waitForCallCount(2);
+    }
+
+    private void encryptWithPassphrase(final String passphrase) throws InterruptedException {
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                ProfileSyncService.get().setEncryptionPassphrase(passphrase);
+            }
+        });
+        waitForCryptographer();
+        // Make sure the new encryption settings make it to the server.
+        SyncTestUtil.triggerSyncAndWaitForCompletion(mContext);
+    }
+
+    private void decryptWithPassphrase(final String passphrase) throws InterruptedException {
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                ProfileSyncService.get().setDecryptionPassphrase(passphrase);
+            }
+        });
+    }
+
+    private void waitForCryptographer() throws InterruptedException {
+        boolean isReady = CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
+            @Override
+            public boolean isSatisfied() {
+                ProfileSyncService syncService = ProfileSyncService.get();
+                return syncService.isUsingSecondaryPassphrase()
+                        && syncService.isCryptographerReady();
+            }
+        });
+        assertTrue("Timed out waiting for cryptographer to be ready.", isReady);
+    }
+
+    private void waitForCallCount(final int count) throws InterruptedException {
+        CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
+            @Override
+            public boolean isSatisfied() {
+                return mListener.callCount() == count;
+            }
+        });
+        assertEquals(count, mListener.callCount());
+    }
+}
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
index 8fe66d8..4360d4ef 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
@@ -16,6 +16,8 @@
 import org.chromium.chrome.test.ChromeActivityTestCaseBase;
 import org.chromium.chrome.test.util.browser.signin.SigninTestUtil;
 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
 import org.chromium.sync.AndroidSyncSettings;
 import org.chromium.sync.ModelType;
 import org.chromium.sync.test.util.MockSyncContentResolverDelegate;
@@ -23,6 +25,8 @@
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Base class for common functionality between sync tests.
@@ -125,7 +129,6 @@
     protected Account setUpTestAccountAndSignInToSync() throws InterruptedException {
         Account account = setUpTestAccount();
         signIn(account);
-        SyncTestUtil.verifySyncIsActiveForAccount(mContext, account);
         assertTrue("Sync everything should be enabled",
                 SyncTestUtil.isSyncEverythingEnabled(mContext));
         return account;
@@ -151,22 +154,43 @@
         getInstrumentation().waitForIdleSync();
     }
 
-    protected void signIn(final Account account) {
+    protected void signIn(final Account account) throws InterruptedException {
         ThreadUtils.runOnUiThreadBlocking(new Runnable() {
             @Override
             public void run() {
                 mSyncController.signIn(getActivity(), account.name);
             }
         });
+        SyncTestUtil.verifySyncIsActiveForAccount(mContext, account);
     }
 
     protected void signOut() throws InterruptedException {
+        final Semaphore s = new Semaphore(0);
         ThreadUtils.runOnUiThreadBlocking(new Runnable() {
             @Override
             public void run() {
-                SigninManager.get(mContext).signOut(getActivity(), null);
+                SigninManager.get(mContext).signOut(getActivity(), new Runnable() {
+                    @Override
+                    public void run() {
+                        s.release();
+                    }
+                });
             }
         });
+        assertTrue(s.tryAcquire(SyncTestUtil.UI_TIMEOUT_MS, TimeUnit.MILLISECONDS));
+        SyncTestUtil.verifySyncIsSignedOut(mContext);
+    }
+
+    protected void clearServerData() throws InterruptedException {
+        mFakeServerHelper.clearServerData();
+        SyncTestUtil.triggerSync();
+        boolean syncStopped = CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
+            @Override
+            public boolean isSatisfied() {
+                return !ProfileSyncService.get().isSyncRequested();
+            }
+        }, SyncTestUtil.UI_TIMEOUT_MS, SyncTestUtil.CHECK_INTERVAL_MS);
+        assertTrue("Timed out waiting for sync to stop.", syncStopped);
     }
 
     protected void disableDataType(final int modelType) {
diff --git a/chrome/app/bookmarks_strings.grdp b/chrome/app/bookmarks_strings.grdp
index 7223bb5..5e9c0f00 100644
--- a/chrome/app/bookmarks_strings.grdp
+++ b/chrome/app/bookmarks_strings.grdp
@@ -193,10 +193,7 @@
 
   <!-- Begin of Bookmarks Sync Promo strings. -->
   <message name="IDS_BOOKMARK_SYNC_PROMO_MESSAGE" desc="Text of the sync promo displayed at the bottom of the bookmark bubble.">
-    <ph name="SIGN_IN_LINK">$1<ex>Sign in</ex></ph> to get your bookmarks everywhere.
-  </message>
-  <message name="IDS_BOOKMARK_SYNC_PROMO_LINK" desc="Text of the link to sign in from the bookmark sync promo.">
-    Sign in
+    To get your bookmarks on all your devices, <ph name="SIGN_IN_LINK">$1<ex>sign in</ex></ph>.
   </message>
   <!-- End of Bookmarks Sync Promo strings. -->
 
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index c15f8b4..1ab7047 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -178,6 +178,9 @@
           New window
         </message>
       </if>
+      <message name="IDS_BOOKMARK_SYNC_PROMO_LINK" desc="Text of the link to sign in from the bookmark sync promo.">
+        sign in to Chromium
+      </message>
       <message name="IDS_TASK_MANAGER_TITLE" desc="The title of the Task Manager window">
         Task Manager - Chromium
       </message>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 63ff3cae..2947e73 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4215,6 +4215,9 @@
         <message name="IDS_EXTENSION_PROMPT_WARNING_USERS_PRIVATE" desc="Permission string for access to user accounts.">
           Read and change whitelisted users
         </message>
+        <message name="IDS_EXTENSION_PROMPT_WARNING_DISPLAY_SOURCE" desc="Permission string for access to Display Source API.">
+          Send audio and video to displays on the local network
+        </message>
       </if>
 
       <!-- Extension/App error messages -->
@@ -15309,7 +15312,7 @@
       </message>
     </if>
 
-    <if expr="not is_android and not is_ios">
+    <if expr="not is_ios">
       <!-- WebUSB permission bypass flag. -->
       <message name="IDS_FLAGS_ENABLE_WEBUSB_ON_ANY_ORIGIN_NAME" desc="Title for the flag that bypasses WebUSB permission prompts.">
         Allow WebUSB from any origin.
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 1fa5375..2a02ab7 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -180,6 +180,9 @@
           New window
         </message>
       </if>
+      <message name="IDS_BOOKMARK_SYNC_PROMO_LINK" desc="Text of the link to sign in from the bookmark sync promo.">
+        sign in to Chrome
+      </message>
       <message name="IDS_TASK_MANAGER_TITLE" desc="The title of the Task Manager window">
         Task Manager - Google Chrome
       </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 7950009..65923fb3 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -319,8 +319,13 @@
       "//components/visitedlink/common",
       "//components/web_cache/browser",
       "//components/web_modal",
+      "//components/webusb",
       "//content/app/resources",
+      "//device/core",
+      "//device/devices_app/public/cpp",
+      "//device/devices_app/public/cpp:factory",
       "//device/devices_app/usb/public/interfaces",
+      "//device/usb",
       "//media",
       "//media/midi",
       "//mojo/application/public/cpp",
@@ -698,14 +703,7 @@
     sources += rebase_path(gypi_values.chrome_browser_non_mobile_sources,
                            ".",
                            "//chrome")
-    deps += [
-      "//components/feedback",
-      "//components/webusb",
-      "//device/core",
-      "//device/devices_app/public/cpp",
-      "//device/devices_app/public/cpp:factory",
-      "//device/usb",
-    ]
+    deps += [ "//components/feedback" ]
   }
 
   if (!is_chrome_branded) {
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm
index 4a4794ce..bd36bb6 100644
--- a/chrome/browser/app_controller_mac_browsertest.mm
+++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -371,7 +371,7 @@
 
     method_exchangeImplementations(original, destination);
 
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     g_open_shortcut_url = embedded_test_server()->GetURL("/simple.html");
   }
 
@@ -395,7 +395,7 @@
   AppControllerReplaceNTPBrowserTest() {}
 
   void SetUpInProcessBrowserTestFixture() override {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -633,7 +633,7 @@
 // switches between browser windows, the correct URL is being passed to the
 // Handoff.
 IN_PROC_BROWSER_TEST_F(AppControllerHandoffBrowserTest, TestHandoffURLs) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   EXPECT_EQ(g_handoff_url, GURL(url::kAboutBlankURL));
 
   // Test that navigating to a URL updates the handoff URL.
diff --git a/chrome/browser/apps/app_url_redirector.cc b/chrome/browser/apps/app_url_redirector.cc
index 63962933..cf1915a 100644
--- a/chrome/browser/apps/app_url_redirector.cc
+++ b/chrome/browser/apps/app_url_redirector.cc
@@ -113,7 +113,8 @@
           new navigation_interception::InterceptNavigationThrottle(
               handle,
               base::Bind(&LaunchAppWithUrl,
-                         scoped_refptr<const Extension>(*iter), handler->id)));
+                         scoped_refptr<const Extension>(*iter), handler->id),
+              true));
     }
   }
 
diff --git a/chrome/browser/apps/drive/drive_app_converter_browsertest.cc b/chrome/browser/apps/drive/drive_app_converter_browsertest.cc
index 890dec9f..7cdef79 100644
--- a/chrome/browser/apps/drive/drive_app_converter_browsertest.cc
+++ b/chrome/browser/apps/drive/drive_app_converter_browsertest.cc
@@ -48,7 +48,7 @@
     base::FilePath test_data_dir;
     PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
     embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   void InstallAndWaitFinish(const drive::DriveAppInfo& drive_app) {
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index 0ebf5ee..337b21f 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -571,12 +571,9 @@
   // Helper to load interstitial page in a <webview>.
   void InterstitialTeardownTestHelper() {
     // Start a HTTPS server so we can load an interstitial page inside guest.
-    net::SpawnedTestServer::SSLOptions ssl_options;
-    ssl_options.server_certificate =
-        net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-    net::SpawnedTestServer https_server(
-        net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-        base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+    net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+    https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+    https_server.ServeFilesFromSourceDirectory("chrome/test/data");
     ASSERT_TRUE(https_server.Start());
 
     net::HostPortPair host_and_port = https_server.host_port_pair();
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index b552277..e975412 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -103,7 +103,7 @@
     // Don't want Keychain coming up on Mac.
     test::DisableSystemServices(browser()->profile()->GetPrefs());
 
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     InProcessBrowserTest::SetUpOnMainThread();
   }
 
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc
index e8d4b4e..c8b9980 100644
--- a/chrome/browser/autofill/autofill_interactive_uitest.cc
+++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -159,7 +159,7 @@
     reset_mouse = gfx::Point(reset_mouse.x() + 5, reset_mouse.y() + 5);
     ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse));
 
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     InProcessBrowserTest::SetUpOnMainThread();
   }
 
diff --git a/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc b/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc
index e803089b..b37df5f 100644
--- a/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc
+++ b/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc
@@ -65,7 +65,7 @@
   void SetUpOnMainThread() override {
     AppBannerSettingsHelper::SetEngagementWeights(1, 1);
     AppBannerSettingsHelper::SetTotalEngagementToTrigger(2);
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     InProcessBrowserTest::SetUpOnMainThread();
   }
 
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc
index 2cc8168..73c85e0 100644
--- a/chrome/browser/browser_keyevents_browsertest.cc
+++ b/chrome/browser/browser_keyevents_browsertest.cc
@@ -353,7 +353,7 @@
         "U 65 0 false false false false" } },
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -447,7 +447,7 @@
       "U 17 0 true false false false" }
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -493,7 +493,7 @@
       "U 91 0 false false false true" }
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -593,7 +593,7 @@
 #endif
 #endif
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -661,7 +661,7 @@
 #define MAYBE_ReservedAccelerators ReservedAccelerators
 #endif
 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -761,7 +761,7 @@
       "U 17 0 true false false false" }
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -799,7 +799,7 @@
       "U 34 0 false false false false" }
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
@@ -843,7 +843,7 @@
       "U 17 0 true false false false" }
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   GURL url = embedded_test_server()->GetURL(kTestingPage);
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 047ff60..79333e4 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -29,6 +29,7 @@
 #include "chrome/browser/chrome_browser_main.h"
 #include "chrome/browser/chrome_child_process_watcher.h"
 #include "chrome/browser/chrome_content_browser_client.h"
+#include "chrome/browser/chrome_device_client.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h"
@@ -111,7 +112,6 @@
 #endif
 
 #if !defined(OS_ANDROID)
-#include "chrome/browser/chrome_device_client.h"
 #include "chrome/browser/ui/user_manager.h"
 #include "components/gcm_driver/gcm_client_factory.h"
 #include "components/gcm_driver/gcm_desktop_utils.h"
@@ -217,9 +217,7 @@
   ui::InitIdleMonitor();
 #endif
 
-#if !defined(OS_ANDROID)
   device_client_.reset(new ChromeDeviceClient);
-#endif
 
 #if defined(ENABLE_EXTENSIONS)
   // Athena sets its own instance during Athena's init process.
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index e5e85896..c68f13df 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -319,9 +319,7 @@
 
   scoped_ptr<ChromeChildProcessWatcher> child_process_watcher_;
 
-#if !defined(OS_ANDROID)
   scoped_ptr<ChromeDeviceClient> device_client_;
-#endif
 
 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
   // Any change to this #ifdef must be reflected as well in
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc
index b10a497..2097daff4 100644
--- a/chrome/browser/captive_portal/captive_portal_browsertest.cc
+++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -58,6 +58,7 @@
 #include "net/cert/x509_certificate.h"
 #include "net/http/transport_security_state.h"
 #include "net/test/cert_test_util.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/url_request/url_request_failed_job.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request.h"
@@ -78,12 +79,12 @@
 namespace {
 
 // Path of the fake login page, when using the TestServer.
-const char* const kTestServerLoginPath = "files/captive_portal/login.html";
+const char* const kTestServerLoginPath = "/captive_portal/login.html";
 
 // Path of a page with an iframe that has a mock SSL timeout, when using the
 // TestServer.
 const char* const kTestServerIframeTimeoutPath =
-    "files/captive_portal/iframe_timeout.html";
+    "/captive_portal/iframe_timeout.html";
 
 // The following URLs each have two different behaviors, depending on whether
 // URLRequestMockCaptivePortalJobFactory is currently simulating the presence
@@ -540,7 +541,7 @@
 
 // Creates a server-side redirect for use with the TestServer.
 std::string CreateServerRedirect(const std::string& dest_url) {
-  const char* const kServerRedirectBase = "server-redirect?";
+  const char* const kServerRedirectBase = "/server-redirect?";
   return kServerRedirectBase + dest_url;
 }
 
@@ -1827,9 +1828,8 @@
 // Make sure no captive portal test triggers on HTTPS timeouts of iframes.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsIframeTimeout) {
   // Use an HTTPS server for the top level page.
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
 
   GURL url = https_server.GetURL(kTestServerIframeTimeoutPath);
@@ -1867,9 +1867,9 @@
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, InternetConnected) {
   // Can't just use SetBehindCaptivePortal(false), since then there wouldn't
   // be a timeout.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SetUpCaptivePortalService(browser()->profile(),
-                            test_server()->GetURL("nocontent"));
+                            embedded_test_server()->GetURL("/nocontent"));
   SlowLoadNoCaptivePortal(browser(), captive_portal::RESULT_INTERNET_CONNECTED);
 }
 
@@ -1877,14 +1877,11 @@
 // SSL certificate error.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RedirectSSLCertError) {
   // Need an HTTP TestServer to handle a dynamically created server redirect.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
 
   GURL ssl_login_url = https_server.GetURL(kTestServerLoginPath);
@@ -1892,9 +1889,9 @@
   CaptivePortalService* captive_portal_service =
       CaptivePortalServiceFactory::GetForProfile(browser()->profile());
   ASSERT_TRUE(captive_portal_service);
-  SetUpCaptivePortalService(
-      browser()->profile(),
-      test_server()->GetURL(CreateServerRedirect(ssl_login_url.spec())));
+  SetUpCaptivePortalService(browser()->profile(),
+                            embedded_test_server()->GetURL(
+                                CreateServerRedirect(ssl_login_url.spec())));
 
   SlowLoadNoCaptivePortal(browser(), captive_portal::RESULT_NO_RESPONSE);
 }
@@ -1965,12 +1962,9 @@
 // tab.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest,
                        ShowCaptivePortalInterstitialOnCertError) {
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
 
   TabStripModel* tab_strip_model = browser()->tab_strip_model();
@@ -2053,12 +2047,9 @@
 // - Stopping the page load shouldn't result in any interstitials.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest,
                        InterstitialTimerStopNavigationWhileLoading) {
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   // The path does not matter.
   GURL cert_error_url = https_server.GetURL(kTestServerLoginPath);
@@ -2110,12 +2101,9 @@
 // result is the same. (i.e. page load stops, no interstitials shown)
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest,
                        InterstitialTimerReloadWhileLoading) {
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   // The path does not matter.
   GURL cert_error_url = https_server.GetURL(kTestServerLoginPath);
@@ -2170,12 +2158,9 @@
 // interstitials should be shown.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest,
                        InterstitialTimerNavigateAwayWhileLoading) {
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   // The path does not matter.
   GURL cert_error_url = https_server.GetURL(kTestServerLoginPath);
@@ -2240,12 +2225,9 @@
 IN_PROC_BROWSER_TEST_F(
     CaptivePortalBrowserTest,
     InterstitialTimerNavigateWhileLoading_EndWithSSLInterstitial) {
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   // The path does not matter.
   GURL cert_error_url = https_server.GetURL(kTestServerLoginPath);
@@ -2291,12 +2273,9 @@
 IN_PROC_BROWSER_TEST_F(
     CaptivePortalBrowserTest,
     InterstitialTimerNavigateWhileLoading_EndWithCaptivePortalInterstitial) {
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   // The path does not matter.
   GURL cert_error_url = https_server.GetURL(kTestServerLoginPath);
@@ -2349,14 +2328,11 @@
 // tab.  The user then logs in and the page with the error is reloaded.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, SSLCertErrorLogin) {
   // Need an HTTP TestServer to handle a dynamically created server redirect.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
 
   // Set SSL interstitial delay to zero so that a captive portal result can not
@@ -2774,12 +2750,10 @@
 // captive portal is found, and then the user logs in before the original page
 // times out.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpToHttpsRedirectLogin) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SlowLoadBehindCaptivePortal(
-      browser(),
-      true,
-      test_server()->GetURL(CreateServerRedirect(kMockHttpsUrl)),
-      1,
+      browser(), true,
+      embedded_test_server()->GetURL(CreateServerRedirect(kMockHttpsUrl)), 1,
       1);
   Login(browser(), 1, 0);
   FailLoadsAfterLogin(browser(), 1);
@@ -2788,8 +2762,8 @@
 // An HTTPS page redirects to an HTTP page.
 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsToHttpRedirect) {
   // Use an HTTPS server for the top level page.
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost,
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.AddDefaultHandlers(
       base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
   ASSERT_TRUE(https_server.Start());
 
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 5114e39..da70b6e 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -1219,16 +1219,13 @@
 #endif
 
 #if defined(ENABLE_EXTENSIONS)
-  if (!variations::GetVariationParamValue(
-      "LightSpeed", "EarlyInitStartup").empty()) {
-    // Try to compute this early on another thread so that we don't spend time
-    // during profile load initializing the extensions APIs.
-    BrowserThread::PostTask(
-        BrowserThread::FILE_USER_BLOCKING,
-        FROM_HERE,
-        base::Bind(
-            base::IgnoreResult(&extensions::FeatureProvider::GetAPIFeatures)));
-  }
+  // Try to compute this early on another thread so that we don't spend time
+  // during profile load initializing the extensions APIs.
+  BrowserThread::PostTask(
+      BrowserThread::FILE_USER_BLOCKING,
+      FROM_HERE,
+      base::Bind(
+          base::IgnoreResult(&extensions::FeatureProvider::GetAPIFeatures)));
 #endif
 
   // Android updates the metrics service dynamically depending on whether the
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index dd8724d..fc1d416 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -639,7 +639,6 @@
 void CreateUsbDeviceManager(
     RenderFrameHost* render_frame_host,
     mojo::InterfaceRequest<device::usb::DeviceManager> request) {
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
   WebContents* web_contents =
       WebContents::FromRenderFrameHost(render_frame_host);
   if (!web_contents) {
@@ -650,7 +649,6 @@
   UsbTabHelper* tab_helper =
       UsbTabHelper::GetOrCreateForWebContents(web_contents);
   tab_helper->CreateDeviceManager(render_frame_host, request.Pass());
-#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 }
 
 }  // namespace
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc
index 3a2e65f..af7c13b 100644
--- a/chrome/browser/chrome_content_browser_client_browsertest.cc
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -12,6 +12,7 @@
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 namespace content {
@@ -102,8 +103,8 @@
 // such as http://crbug.com/164223.
 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientSitePerProcessTest,
                        SitePerProcessNavigation) {
-  ASSERT_TRUE(test_server()->Start());
-  const GURL url(test_server()->GetURL("files/title1.html"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  const GURL url(embedded_test_server()->GetURL("/title1.html"));
 
   ui_test_utils::NavigateToURL(browser(), url);
   NavigationEntry* entry = GetLastCommittedEntry();
diff --git a/chrome/browser/chrome_device_client.cc b/chrome/browser/chrome_device_client.cc
index e3ffbe7..b388d97 100644
--- a/chrome/browser/chrome_device_client.cc
+++ b/chrome/browser/chrome_device_client.cc
@@ -26,9 +26,11 @@
 
 device::HidService* ChromeDeviceClient::GetHidService() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
+#if !defined(OS_ANDROID)
   if (!hid_service_) {
     hid_service_ = device::HidService::Create(
         BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
   }
+#endif
   return hid_service_.get();
 }
diff --git a/chrome/browser/chrome_security_exploit_browsertest.cc b/chrome/browser/chrome_security_exploit_browsertest.cc
index 4486a022..00ad2b7 100644
--- a/chrome/browser/chrome_security_exploit_browsertest.cc
+++ b/chrome/browser/chrome_security_exploit_browsertest.cc
@@ -18,6 +18,7 @@
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 // The goal of these tests is to "simulate" exploited renderer processes, which
 // can send arbitrary IPC messages and confuse browser process internal state,
@@ -31,19 +32,14 @@
   ~ChromeSecurityExploitBrowserTest() override {}
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
-    ASSERT_TRUE(test_server()->Start());
-    net::SpawnedTestServer https_server(
-        net::SpawnedTestServer::TYPE_HTTPS,
-        net::SpawnedTestServer::kLocalhost,
-        base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
-    ASSERT_TRUE(https_server.Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     // Add a host resolver rule to map all outgoing requests to the test server.
     // This allows us to use "real" hostnames in URLs, which we can use to
     // create arbitrary SiteInstances.
     command_line->AppendSwitchASCII(
         switches::kHostResolverRules,
-        "MAP * " + test_server()->host_port_pair().ToString() +
+        "MAP * " + embedded_test_server()->host_port_pair().ToString() +
             ",EXCLUDE localhost");
 
     // Since we assume exploited renderer process, it can bypass the same origin
@@ -59,7 +55,7 @@
                        ChromeExtensionResources) {
   // Load a page that requests a chrome-extension:// image through XHR. We
   // expect this load to fail, as it is an illegal request.
-  GURL foo("http://foo.com/files/chrome_extension_resource.html");
+  GURL foo("http://foo.com/chrome_extension_resource.html");
 
   content::DOMMessageQueue msg_queue;
 
diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc
index 3a20420..e6c32fd 100644
--- a/chrome/browser/chrome_service_worker_browsertest.cc
+++ b/chrome/browser/chrome_service_worker_browsertest.cc
@@ -56,7 +56,7 @@
             "HTTP/1.1 200 OK\nContent-Type: text/javascript");
 
   embedded_test_server()->ServeFilesFromDirectory(service_worker_dir_.path());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::ServiceWorkerContext* sw_context =
       content::BrowserContext::GetDefaultStoragePartition(browser()->profile())
@@ -84,7 +84,7 @@
   WriteFile(FILE_PATH_LITERAL("test.html"), "");
 
   embedded_test_server()->ServeFilesFromDirectory(service_worker_dir_.path());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   Browser* incognito = CreateIncognitoBrowser();
   content::ServiceWorkerContext* sw_context =
diff --git a/chrome/browser/chrome_site_per_process_browsertest.cc b/chrome/browser/chrome_site_per_process_browsertest.cc
index b632c5b..11e2c848 100644
--- a/chrome/browser/chrome_site_per_process_browsertest.cc
+++ b/chrome/browser/chrome_site_per_process_browsertest.cc
@@ -32,7 +32,7 @@
 
   void SetUpOnMainThread() override {
     host_resolver()->AddRule("*", "127.0.0.1");
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     content::SetupCrossSiteRedirector(embedded_test_server());
   }
 
diff --git a/chrome/browser/chrome_switches_browsertest.cc b/chrome/browser/chrome_switches_browsertest.cc
index c936004..872e2d81 100644
--- a/chrome/browser/chrome_switches_browsertest.cc
+++ b/chrome/browser/chrome_switches_browsertest.cc
@@ -10,18 +10,18 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 class HostRulesTest : public InProcessBrowserTest {
  protected:
   HostRulesTest() {}
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     // Map all hosts to our local server.
-    std::string host_rule(
-        "MAP * " + test_server()->host_port_pair().ToString());
+    std::string host_rule("MAP * " +
+                          embedded_test_server()->host_port_pair().ToString());
     command_line->AppendSwitchASCII(switches::kHostRules, host_rule);
     // Use no proxy or otherwise this test will fail on a machine that has a
     // proxy configured.
@@ -34,7 +34,7 @@
 
 IN_PROC_BROWSER_TEST_F(HostRulesTest, TestMap) {
   // Go to the empty page using www.google.com as the host.
-  GURL local_url = test_server()->GetURL("files/empty.html");
+  GURL local_url = embedded_test_server()->GetURL("/empty.html");
   GURL test_url(std::string("http://www.google.com") + local_url.path());
   ui_test_utils::NavigateToURL(browser(), test_url);
 
diff --git a/chrome/browser/chromeos/app_mode/fake_cws.cc b/chrome/browser/chromeos/app_mode/fake_cws.cc
index e8c798d..a1f25c4 100644
--- a/chrome/browser/chromeos/app_mode/fake_cws.cc
+++ b/chrome/browser/chromeos/app_mode/fake_cws.cc
@@ -18,7 +18,6 @@
 #include "net/test/embedded_test_server/embedded_test_server.h"
 
 using net::test_server::BasicHttpResponse;
-using net::test_server::EmbeddedTestServer;
 using net::test_server::HttpRequest;
 using net::test_server::HttpResponse;
 
@@ -76,7 +75,7 @@
 FakeCWS::~FakeCWS() {
 }
 
-void FakeCWS::Init(EmbeddedTestServer* embedded_test_server) {
+void FakeCWS::Init(net::EmbeddedTestServer* embedded_test_server) {
   has_update_template_ = kAppHasUpdateTemplate;
   no_update_template_ = kAppNoUpdateTemplate;
   update_check_end_point_ = "/update_check.xml";
@@ -87,7 +86,7 @@
       base::Bind(&FakeCWS::HandleRequest, base::Unretained(this)));
 }
 
-void FakeCWS::InitAsPrivateStore(EmbeddedTestServer* embedded_test_server,
+void FakeCWS::InitAsPrivateStore(net::EmbeddedTestServer* embedded_test_server,
                                  const std::string& update_check_end_point) {
   has_update_template_ = kPrivateStoreAppHasUpdateTemplate;
   no_update_template_ = kAppNoUpdateTemplate;
diff --git a/chrome/browser/chromeos/app_mode/fake_cws.h b/chrome/browser/chromeos/app_mode/fake_cws.h
index baade207d..02ed184 100644
--- a/chrome/browser/chromeos/app_mode/fake_cws.h
+++ b/chrome/browser/chromeos/app_mode/fake_cws.h
@@ -26,15 +26,14 @@
 
   // Initializes as CWS request handler and overrides app gallery command line
   // switches.
-  void Init(net::test_server::EmbeddedTestServer* embedded_test_server);
+  void Init(net::EmbeddedTestServer* embedded_test_server);
 
   // Initializes as a private store handler using the given server and URL end
   // point. Private store does not override app gallery command lines and use a
   // slightly different template (as documented on
   // https://developer.chrome.com/extensions/autoupdate).
-  void InitAsPrivateStore(
-      net::test_server::EmbeddedTestServer* embedded_test_server,
-      const std::string& update_check_end_point);
+  void InitAsPrivateStore(net::EmbeddedTestServer* embedded_test_server,
+                          const std::string& update_check_end_point);
 
   // Sets up the update check response with has_update template.
   void SetUpdateCrx(const std::string& app_id,
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
index 5a2ff7e..e14e3eb 100644
--- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
+++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -517,7 +517,7 @@
 
   if (GetGuestModeParam() != IN_GUEST_MODE) {
     // Install the web server to serve the mocked share dialog.
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     const GURL share_url_base(embedded_test_server()->GetURL(
         "/chromeos/file_manager/share_dialog_mock/index.html"));
     drive_volume_ = drive_volumes_[profile()->GetOriginalProfile()];
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc b/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc
index c714b60..2f1d784 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_request_job.cc
@@ -10,6 +10,7 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
+#include "base/thread_task_runner_handle.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
 #include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
@@ -19,7 +20,6 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/url_constants.h"
-#include "net/base/net_errors.h"
 #include "net/http/http_byte_range.h"
 #include "net/http/http_request_headers.h"
 #include "net/http/http_response_info.h"
@@ -163,6 +163,7 @@
     net::NetworkDelegate* network_delegate)
     : net::URLRequestJob(request, network_delegate),
       profile_id_(profile_id),
+      range_parse_result_(net::OK),
       remaining_bytes_(0),
       weak_ptr_factory_(this) {}
 
@@ -170,24 +171,40 @@
     const net::HttpRequestHeaders& headers) {
   std::string range_header;
   if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) {
-    // Note: We only support single range requests.
+    // Currently this job only cares about the Range header, and only supports
+    // single range requests. Note that validation is deferred to Start,
+    // because NotifyStartError is not legal to call since the job has not
+    // started.
     std::vector<net::HttpByteRange> ranges;
     if (net::HttpUtil::ParseRangeHeader(range_header, &ranges) &&
         ranges.size() == 1) {
       byte_range_ = ranges[0];
     } else {
-      // Failed to parse Range: header, so notify the error.
-      NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                       net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+      range_parse_result_ = net::ERR_REQUEST_RANGE_NOT_SATISFIABLE;
     }
   }
 }
 
 void ExternalFileURLRequestJob::Start() {
+  // Post a task to invoke StartAsync asynchronously to avoid re-entering the
+  // delegate, because NotifyStartError is not legal to call synchronously in
+  // Start().
+  base::ThreadTaskRunnerHandle::Get()->PostTask(
+      FROM_HERE, base::Bind(&ExternalFileURLRequestJob::StartAsync,
+                            weak_ptr_factory_.GetWeakPtr()));
+}
+
+void ExternalFileURLRequestJob::StartAsync() {
   DVLOG(1) << "Starting request";
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   DCHECK(!stream_reader_);
 
+  if (range_parse_result_ != net::OK) {
+    NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                           range_parse_result_));
+    return;
+  }
+
   // We only support GET request.
   if (request()->method() != "GET") {
     LOG(WARNING) << "Failed to start request: " << request()->method()
@@ -325,37 +342,23 @@
   return true;
 }
 
-bool ExternalFileURLRequestJob::ReadRawData(net::IOBuffer* buf,
-                                            int buf_size,
-                                            int* bytes_read) {
+int ExternalFileURLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   DCHECK(stream_reader_);
 
-  if (remaining_bytes_ == 0) {
-    *bytes_read = 0;
-    return true;
-  }
+  if (remaining_bytes_ == 0)
+    return 0;
 
   const int result = stream_reader_->Read(
       buf, std::min<int64>(buf_size, remaining_bytes_),
       base::Bind(&ExternalFileURLRequestJob::OnReadCompleted,
                  weak_ptr_factory_.GetWeakPtr()));
 
-  if (result == net::ERR_IO_PENDING) {
-    // The data is not yet available.
-    SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-    return false;
-  }
-  if (result < 0) {
-    // An error occurs.
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
-    return false;
-  }
+  if (result < 0)
+    return result;
 
-  // Reading has been finished immediately.
-  *bytes_read = result;
   remaining_bytes_ -= result;
-  return true;
+  return result;
 }
 
 ExternalFileURLRequestJob::~ExternalFileURLRequestJob() {
@@ -364,15 +367,10 @@
 void ExternalFileURLRequestJob::OnReadCompleted(int read_result) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
-  if (read_result < 0) {
-    DCHECK_NE(read_result, net::ERR_IO_PENDING);
-    NotifyDone(
-        net::URLRequestStatus(net::URLRequestStatus::FAILED, read_result));
-  }
+  if (read_result > 0)
+    remaining_bytes_ -= read_result;
 
-  remaining_bytes_ -= read_result;
-  SetStatus(net::URLRequestStatus());  // Clear the IO_PENDING status.
-  NotifyReadComplete(read_result);
+  ReadRawDataComplete(read_result);
 }
 
 }  // namespace chromeos
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_request_job.h b/chrome/browser/chromeos/fileapi/external_file_url_request_job.h
index a026e43..dff3379b 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_request_job.h
+++ b/chrome/browser/chromeos/fileapi/external_file_url_request_job.h
@@ -63,12 +63,17 @@
   void Kill() override;
   bool GetMimeType(std::string* mime_type) const override;
   bool IsRedirectResponse(GURL* location, int* http_status_code) override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
 
  protected:
   ~ExternalFileURLRequestJob() override;
 
  private:
+  // Helper method to start the job. Should be called asynchronously because
+  // NotifyStartError() is not legal to call synchronously in
+  // URLRequestJob::Start().
+  void StartAsync();
+
   // Called from an internal helper class defined in drive_url_request_job.cc,
   // which is running on the UI thread.
   void OnHelperResultObtained(
@@ -91,6 +96,7 @@
   void* const profile_id_;
 
   // The range of the file to be returned.
+  net::Error range_parse_result_;
   net::HttpByteRange byte_range_;
   int64 remaining_bytes_;
 
diff --git a/chrome/browser/chromeos/first_run/drive_first_run_browsertest.cc b/chrome/browser/chromeos/first_run/drive_first_run_browsertest.cc
index a9ae4b7..04349ded 100644
--- a/chrome/browser/chromeos/first_run/drive_first_run_browsertest.cc
+++ b/chrome/browser/chromeos/first_run/drive_first_run_browsertest.cc
@@ -109,7 +109,7 @@
 void DriveFirstRunTest::InitTestServer(const std::string& directory) {
   embedded_test_server()->ServeFilesFromDirectory(
       test_data_dir_.AppendASCII(directory));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Configure the endpoint to use the test server's port.
   const GURL url(kTestEndpointUrl);
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc
index f045f45..4322d44 100644
--- a/chrome/browser/chromeos/login/kiosk_browsertest.cc
+++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -2143,8 +2143,8 @@
   set_test_app_id(kTestEnterpriseKioskApp);
 
   const char kPrivateStoreUpdate[] = "/private_store_update";
-  net::test_server::EmbeddedTestServer private_server;
-  ASSERT_TRUE(private_server.InitializeAndWaitUntilReady());
+  net::EmbeddedTestServer private_server;
+  ASSERT_TRUE(private_server.Start());
 
   // |private_server| serves crx from test data dir.
   base::FilePath test_data_dir;
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
index 7358ab0..36f8e92 100644
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -1075,7 +1075,7 @@
 
 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) {
   // Make it possible to force-install a hosted app and an extension.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider(
       new TestingUpdateManifestProvider(kRelativeUpdateURL));
   testing_update_manifest_provider->AddUpdate(
@@ -1150,7 +1150,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Pre-populate the device local account's extension cache with a hosted app
   // and an extension.
@@ -1245,7 +1245,7 @@
 
 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionCacheImplTest) {
   // Make it possible to force-install a hosted app and an extension.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider(
       new TestingUpdateManifestProvider(kRelativeUpdateURL));
   testing_update_manifest_provider->AddUpdate(
@@ -1431,7 +1431,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, UserAvatarImage) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   UploadDeviceLocalAccountPolicy();
   AddPublicSessionToDevicePolicy(kAccountId1);
@@ -2086,7 +2086,7 @@
 
 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) {
   // Specify Terms of Service URL.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value(
       embedded_test_server()->GetURL(
           std::string("/") + kExistentTermsOfServicePath).spec());
@@ -2213,7 +2213,7 @@
 
 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, PolicyForExtensions) {
   // Set up a test update server for the Show Managed Storage app.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider(
       new TestingUpdateManifestProvider(kRelativeUpdateURL));
   testing_update_manifest_provider->AddUpdate(
@@ -2317,7 +2317,7 @@
 
 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) {
   // Specify Terms of Service URL.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value(
       embedded_test_server()->GetURL(
             std::string("/") +
diff --git a/chrome/browser/chromeos/policy/upload_job_unittest.cc b/chrome/browser/chromeos/policy/upload_job_unittest.cc
index 76eca09..fffbabe2 100644
--- a/chrome/browser/chromeos/policy/upload_job_unittest.cc
+++ b/chrome/browser/chromeos/policy/upload_job_unittest.cc
@@ -178,7 +178,7 @@
     request_context_getter_ = new net::TestURLRequestContextGetter(
         base::ThreadTaskRunnerHandle::Get());
     oauth2_service_.AddAccount("robot@gmail.com");
-    ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady());
+    ASSERT_TRUE(test_server_.Start());
   }
 
   // testing::Test:
@@ -207,7 +207,7 @@
 
   content::TestBrowserThreadBundle test_browser_thread_bundle_;
   base::RunLoop run_loop_;
-  net::test_server::EmbeddedTestServer test_server_;
+  net::EmbeddedTestServer test_server_;
   scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_;
   MockOAuth2TokenService oauth2_service_;
 
diff --git a/chrome/browser/chromeos/policy/user_cloud_external_data_manager_browsertest.cc b/chrome/browser/chromeos/policy/user_cloud_external_data_manager_browsertest.cc
index 3112502e..1d917ae 100644
--- a/chrome/browser/chromeos/policy/user_cloud_external_data_manager_browsertest.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_external_data_manager_browsertest.cc
@@ -45,7 +45,7 @@
 IN_PROC_BROWSER_TEST_F(UserCloudExternalDataManagerTest, FetchExternalData) {
   CloudExternalDataManagerBase::SetMaxExternalDataSizeForTesting(1000);
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   const GURL url =
       embedded_test_server()->GetURL(std::string("/") + kExternalDataPath);
 
diff --git a/chrome/browser/collected_cookies_browsertest.cc b/chrome/browser/collected_cookies_browsertest.cc
index d687f7e7..d190cf9f 100644
--- a/chrome/browser/collected_cookies_browsertest.cc
+++ b/chrome/browser/collected_cookies_browsertest.cc
@@ -19,7 +19,7 @@
 
 // If this crashes on Windows, use http://crbug.com/79331
 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Disable cookies.
   CookieSettingsFactory::GetForProfile(browser()->profile())
@@ -38,7 +38,7 @@
 
 // If this crashes on Windows, use http://crbug.com/79331
 IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Disable cookies.
   CookieSettingsFactory::GetForProfile(browser()->profile())
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc
index 9ccb3299..c08f653d 100644
--- a/chrome/browser/content_settings/content_settings_browsertest.cc
+++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -33,7 +33,7 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 
 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR.
@@ -47,11 +47,8 @@
 
 class ContentSettingsTest : public InProcessBrowserTest {
  public:
-  ContentSettingsTest()
-      : https_server_(net::SpawnedTestServer::TYPE_HTTPS,
-                      net::SpawnedTestServer::SSLOptions(
-                          net::SpawnedTestServer::SSLOptions::CERT_OK),
-                      base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
+  ContentSettingsTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {
+    https_server_.ServeFilesFromSourceDirectory("chrome/test/data");
   }
 
   void SetUpOnMainThread() override {
@@ -94,42 +91,42 @@
     ASSERT_FALSE(GetCookies(browser()->profile(), url).empty());
   }
 
-  net::SpawnedTestServer https_server_;
+  net::EmbeddedTestServer https_server_;
 };
 
 // Sanity check on cookies before we do other tests. While these can be written
 // in content_browsertests, we want to verify Chrome's cookie storage and how it
 // handles incognito windows.
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BasicCookies) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL http_url = test_server()->GetURL("files/setcookie.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL http_url = embedded_test_server()->GetURL("/setcookie.html");
   PreBasic(http_url);
 }
 
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookies) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL http_url = test_server()->GetURL("files/setcookie.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL http_url = embedded_test_server()->GetURL("/setcookie.html");
   Basic(http_url);
 }
 
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BasicCookiesHttps) {
   ASSERT_TRUE(https_server_.Start());
-  GURL https_url = https_server_.GetURL("files/setcookie.html");
+  GURL https_url = https_server_.GetURL("/setcookie.html");
   PreBasic(https_url);
 }
 
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookiesHttps) {
   ASSERT_TRUE(https_server_.Start());
-  GURL https_url = https_server_.GetURL("files/setcookie.html");
+  GURL https_url = https_server_.GetURL("/setcookie.html");
   Basic(https_url);
 }
 
 // Verify that cookies are being blocked.
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BlockCookies) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   CookieSettingsFactory::GetForProfile(browser()->profile())
       ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
-  GURL url = test_server()->GetURL("files/setcookie.html");
+  GURL url = embedded_test_server()->GetURL("/setcookie.html");
   ui_test_utils::NavigateToURL(browser(), url);
   ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
   CookieCheckIncognitoWindow(url, false);
@@ -145,8 +142,8 @@
 // Verify that cookies can be allowed and set using exceptions for particular
 // website(s) when all others are blocked.
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, AllowCookiesUsingExceptions) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url = test_server()->GetURL("files/setcookie.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url = embedded_test_server()->GetURL("/setcookie.html");
   content_settings::CookieSettings* settings =
       CookieSettingsFactory::GetForProfile(browser()->profile()).get();
   settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
@@ -164,8 +161,8 @@
 
 // Verify that cookies can be blocked for a specific website using exceptions.
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BlockCookiesUsingExceptions) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url = test_server()->GetURL("files/setcookie.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url = embedded_test_server()->GetURL("/setcookie.html");
   content_settings::CookieSettings* settings =
       CookieSettingsFactory::GetForProfile(browser()->profile()).get();
   settings->SetCookieSetting(ContentSettingsPattern::FromURL(url),
@@ -176,7 +173,7 @@
   ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
 
   ASSERT_TRUE(https_server_.Start());
-  GURL unblocked_url = https_server_.GetURL("files/cookie1.html");
+  GURL unblocked_url = https_server_.GetURL("/cookie1.html");
 
   ui_test_utils::NavigateToURL(browser(), unblocked_url);
   ASSERT_FALSE(GetCookies(browser()->profile(), unblocked_url).empty());
@@ -217,9 +214,9 @@
 
 // Regression test for http://crbug.com/63649.
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectLoopCookies) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL test_url = test_server()->GetURL("files/redirect-loop.html");
+  GURL test_url = embedded_test_server()->GetURL("/redirect-loop.html");
 
   CookieSettingsFactory::GetForProfile(browser()->profile())
       ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
@@ -255,15 +252,15 @@
 // Tests that if redirect across origins occurs, the new process still gets the
 // content settings before the resource headers.
 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectCrossOrigin) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  net::HostPortPair host_port = test_server()->host_port_pair();
+  net::HostPortPair host_port = embedded_test_server()->host_port_pair();
   DCHECK_EQ(host_port.host(), std::string("127.0.0.1"));
 
   std::string redirect(base::StringPrintf(
-      "http://localhost:%d/files/redirect-cross-origin.html",
-      host_port.port()));
-  GURL test_url = test_server()->GetURL("server-redirect?" + redirect);
+      "http://localhost:%d/redirect-cross-origin.html", host_port.port()));
+  GURL test_url =
+      embedded_test_server()->GetURL("/server-redirect?" + redirect);
 
   CookieSettingsFactory::GetForProfile(browser()->profile())
       ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc
index 36ce51f..6850fb6 100644
--- a/chrome/browser/crash_recovery_browsertest.cc
+++ b/chrome/browser/crash_recovery_browsertest.cc
@@ -108,7 +108,7 @@
 
   // Use the test server so as not to bypass cache behavior. The title of the
   // active tab should change only when this URL is reloaded.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&CacheMaxAgeHandler::HandleRequest,
                  base::Owned(new CacheMaxAgeHandler(kTestPath))));
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
index 9a0f5187..38d2e96 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
@@ -17,6 +17,7 @@
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/web_contents.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "third_party/WebKit/public/web/WebContextMenuData.h"
 
 using content::WebContents;
@@ -112,8 +113,8 @@
 }
 
 IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL handler_url = test_server()->GetURL("files/custom_handler_foo.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL handler_url = embedded_test_server()->GetURL("/custom_handler_foo.html");
   AddProtocolHandler("foo", handler_url);
 
   ui_test_utils::NavigateToURL(browser(), GURL("foo:test"));
diff --git a/chrome/browser/devtools/device/port_forwarding_browsertest.cc b/chrome/browser/devtools/device/port_forwarding_browsertest.cc
index 006e0b7..3ad185b 100644
--- a/chrome/browser/devtools/device/port_forwarding_browsertest.cc
+++ b/chrome/browser/devtools/device/port_forwarding_browsertest.cc
@@ -23,10 +23,10 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 namespace {
-const char kPortForwardingTestPage[] =
-    "files/devtools/port_forwarding/main.html";
+const char kPortForwardingTestPage[] = "/devtools/port_forwarding/main.html";
 
 const int kDefaultDebuggingPort = 9223;
 const int kAlternativeDebuggingPort = 9224;
@@ -88,8 +88,8 @@
   DevToolsAndroidBridge::Factory::GetForProfile(profile)->
       set_device_providers_for_test(device_providers);
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL original_url = test_server()->GetURL(kPortForwardingTestPage);
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL original_url = embedded_test_server()->GetURL(kPortForwardingTestPage);
 
   std::string forwarding_port("8000");
   GURL forwarding_url(original_url.scheme() + "://" +
@@ -159,8 +159,8 @@
   DevToolsAndroidBridge::Factory::GetForProfile(profile)->
       set_device_providers_for_test(device_providers);
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL original_url = test_server()->GetURL(kPortForwardingTestPage);
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL original_url = embedded_test_server()->GetURL(kPortForwardingTestPage);
 
   std::string forwarding_port("8000");
   GURL forwarding_url(original_url.scheme() + "://" +
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
index 2bef961..99dd8359 100644
--- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -145,12 +145,12 @@
   }
 
   void LoadTestPage(const std::string& test_page) {
-    GURL url = test_server()->GetURL(test_page);
+    GURL url = spawned_test_server()->GetURL(test_page);
     ui_test_utils::NavigateToURL(browser(), url);
   }
 
   void OpenDevToolsWindow(const std::string& test_page, bool is_docked) {
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(spawned_test_server()->Start());
     LoadTestPage(test_page);
 
     window_ = DevToolsWindowTesting::OpenDevToolsWindowSync(GetInspectedTab(),
@@ -484,8 +484,8 @@
   void RunTest(const char* test_name,
                const char* test_page,
                const char* worker_path) {
-    ASSERT_TRUE(test_server()->Start());
-    GURL url = test_server()->GetURL(test_page);
+    ASSERT_TRUE(spawned_test_server()->Start());
+    GURL url = spawned_test_server()->GetURL(test_page);
     ui_test_utils::NavigateToURL(browser(), url);
 
     scoped_refptr<WorkerData> worker_data =
@@ -616,7 +616,7 @@
 // Disabled because of http://crbug.com/410327
 IN_PROC_BROWSER_TEST_F(DevToolsUnresponsiveBeforeUnloadTest,
                        DISABLED_TestUndockedDevToolsUnresponsive) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(spawned_test_server()->Start());
   LoadTestPage(kDebuggerTestPage);
   DevToolsWindow* devtools_window = OpenDevToolWindowOnWebContents(
       GetInspectedTab(), false);
@@ -639,7 +639,7 @@
 // @see http://crbug.com/323031
 IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
                        TestWorkerWindowClosing) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(spawned_test_server()->Start());
   LoadTestPage(kDebuggerTestPage);
   DevToolsWindow* devtools_window = OpenDevToolWindowOnWebContents(
       GetInspectedTab(), false);
@@ -653,7 +653,7 @@
 // Disabled because of http://crbug.com/497857
 IN_PROC_BROWSER_TEST_F(DevToolsBeforeUnloadTest,
                        DISABLED_TestDevToolsOnDevTools) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(spawned_test_server()->Start());
   LoadTestPage(kDebuggerTestPage);
 
   std::vector<DevToolsWindow*> windows;
@@ -838,7 +838,7 @@
 // DevToolsWindow and results in inspected page navigation.
 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) {
   OpenDevToolsWindow(kDebuggerTestPage, true);
-  GURL url = test_server()->GetURL(kNavigateBackTestPage);
+  GURL url = spawned_test_server()->GetURL(kNavigateBackTestPage);
   ui_test_utils::UrlLoadObserver observer(url,
       content::NotificationService::AllSources());
   ASSERT_TRUE(content::ExecuteScript(
@@ -936,8 +936,8 @@
 // Disabled, crashes under Dr.Memory and ASan, http://crbug.com/432444.
 IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest,
                        DISABLED_PauseInSharedWorkerInitialization) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url = test_server()->GetURL(kReloadSharedWorkerTestPage);
+  ASSERT_TRUE(spawned_test_server()->Start());
+  GURL url = spawned_test_server()->GetURL(kReloadSharedWorkerTestPage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   scoped_refptr<WorkerData> worker_data =
diff --git a/chrome/browser/do_not_track_browsertest.cc b/chrome/browser/do_not_track_browsertest.cc
index a3eef7a..f06e6c33 100644
--- a/chrome/browser/do_not_track_browsertest.cc
+++ b/chrome/browser/do_not_track_browsertest.cc
@@ -13,17 +13,18 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 typedef InProcessBrowserTest DoNotTrackTest;
 
 // Check that the DNT header is sent when the corresponding preference is set.
 IN_PROC_BROWSER_TEST_F(DoNotTrackTest, Simple) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   PrefService* prefs = browser()->profile()->GetPrefs();
   prefs->SetBoolean(prefs::kEnableDoNotTrack, true);
 
-  GURL url = test_server()->GetURL("echoheader?DNT");
+  GURL url = embedded_test_server()->GetURL("/echoheader?DNT");
   ui_test_utils::NavigateToURL(browser(), url);
 
   int matches = ui_test_utils::FindInPage(
@@ -37,14 +38,14 @@
 
 // Check that the DNT header is preserved during redirects.
 IN_PROC_BROWSER_TEST_F(DoNotTrackTest, Redirect) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   PrefService* prefs = browser()->profile()->GetPrefs();
   prefs->SetBoolean(prefs::kEnableDoNotTrack, true);
 
-  GURL final_url = test_server()->GetURL("echoheader?DNT");
-  GURL url = test_server()->GetURL(
-      std::string("server-redirect?") + final_url.spec());
+  GURL final_url = embedded_test_server()->GetURL("/echoheader?DNT");
+  GURL url = embedded_test_server()->GetURL(std::string("/server-redirect?") +
+                                            final_url.spec());
   ui_test_utils::NavigateToURL(browser(), url);
 
   int matches = ui_test_utils::FindInPage(
diff --git a/chrome/browser/dom_distiller/tab_utils_browsertest.cc b/chrome/browser/dom_distiller/tab_utils_browsertest.cc
index 5e34a74..6fd6aaf 100644
--- a/chrome/browser/dom_distiller/tab_utils_browsertest.cc
+++ b/chrome/browser/dom_distiller/tab_utils_browsertest.cc
@@ -94,7 +94,7 @@
 
 IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest,
                        MAYBE_TestSwapWebContents) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::WebContents* initial_web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
@@ -128,7 +128,7 @@
 
 IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest,
                        TestDistillIntoWebContents) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::WebContents* source_web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 6ae6059..4d48d78 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -851,7 +851,7 @@
   // If a Select File dialog opens, will automatically choose the default.
   void DownloadFilesCheckErrorsSetup() {
     embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory());
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     std::vector<DownloadItem*> download_items;
     GetDownloads(browser(), &download_items);
     ASSERT_TRUE(download_items.empty());
@@ -1229,7 +1229,7 @@
 IN_PROC_BROWSER_TEST_F(DownloadTest, MimeTypesToShowNotDownload) {
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&RespondWithContentTypeHandler));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // These files should all be displayed in the browser.
   const char* mime_types[] = {
@@ -1699,7 +1699,7 @@
   // persistence.
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&ServerRedirectRequestHandler));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL redirect_url =
       embedded_test_server()->GetURL("/a?" + download_url.spec());
 
@@ -2167,7 +2167,7 @@
 
 IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) {
   embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   EnableFileChooser(true);
   std::vector<DownloadItem*> download_items;
   GetDownloads(browser(), &download_items);
@@ -2246,7 +2246,7 @@
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&FilterPostOnlyURLsHandler));
   embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   EnableFileChooser(true);
   std::vector<DownloadItem*> download_items;
   GetDownloads(browser(), &download_items);
@@ -2635,7 +2635,7 @@
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&EchoReferrerRequestHandler));
   embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   EnableFileChooser(true);
   std::vector<DownloadItem*> download_items;
   GetDownloads(browser(), &download_items);
@@ -2687,7 +2687,7 @@
 IN_PROC_BROWSER_TEST_F(DownloadTest, SaveLinkAsReferrerPolicyOrigin) {
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&EchoReferrerRequestHandler));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   EnableFileChooser(true);
   std::vector<DownloadItem*> download_items;
   GetDownloads(browser(), &download_items);
@@ -2744,7 +2744,7 @@
 IN_PROC_BROWSER_TEST_F(DownloadTest, SaveImageAsReferrerPolicyDefault) {
   embedded_test_server()->RegisterRequestHandler(
       base::Bind(&EchoReferrerRequestHandler));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   EnableFileChooser(true);
   std::vector<DownloadItem*> download_items;
   GetDownloads(browser(), &download_items);
diff --git a/chrome/browser/download/notification/download_notification_browsertest.cc b/chrome/browser/download/notification/download_notification_browsertest.cc
index 7c260ef6..8123406 100644
--- a/chrome/browser/download/notification/download_notification_browsertest.cc
+++ b/chrome/browser/download/notification/download_notification_browsertest.cc
@@ -277,7 +277,7 @@
   }
 
   void SetUpOnMainThread() override {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     content::BrowserThread::PostTask(
         content::BrowserThread::IO, FROM_HERE,
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc
index c1f44f4..0c220e4 100644
--- a/chrome/browser/download/save_page_browsertest.cc
+++ b/chrome/browser/download/save_page_browsertest.cc
@@ -781,7 +781,7 @@
     SavePageBrowserTest::SetUpOnMainThread();
 
     host_resolver()->AddRule("*", "127.0.0.1");
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     content::SetupCrossSiteRedirector(embedded_test_server());
   }
 
diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc
index ba692e850..f178752b 100644
--- a/chrome/browser/errorpage_browsertest.cc
+++ b/chrome/browser/errorpage_browsertest.cc
@@ -44,7 +44,7 @@
 #include "net/base/net_util.h"
 #include "net/http/failing_http_transaction_factory.h"
 #include "net/http/http_cache.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/url_request/url_request_failed_job.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request_context.h"
@@ -902,10 +902,10 @@
 // is correctly transferred, and that stale cached copied can be loaded
 // from the javascript.
 IN_PROC_BROWSER_TEST_F(ErrorPageTest, StaleCacheStatus) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   // Load cache with entry with "nocache" set, to create stale
   // cache.
-  GURL test_url(test_server()->GetURL("files/nocache.html"));
+  GURL test_url(embedded_test_server()->GetURL("/nocache.html"));
   NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1);
 
   // Reload same URL after forcing an error from the the network layer;
@@ -1145,10 +1145,10 @@
 // above.
 IN_PROC_BROWSER_TEST_F(ErrorPageNavigationCorrectionsFailTest,
                        StaleCacheStatusFailedCorrections) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   // Load cache with entry with "nocache" set, to create stale
   // cache.
-  GURL test_url(test_server()->GetURL("files/nocache.html"));
+  GURL test_url(embedded_test_server()->GetURL("/nocache.html"));
   NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1);
 
   // Reload same URL after forcing an error from the the network layer;
diff --git a/chrome/browser/extensions/active_script_controller_browsertest.cc b/chrome/browser/extensions/active_script_controller_browsertest.cc
index e28bf662..ce80212 100644
--- a/chrome/browser/extensions/active_script_controller_browsertest.cc
+++ b/chrome/browser/extensions/active_script_controller_browsertest.cc
@@ -348,7 +348,7 @@
   // Navigate to an URL (which matches the explicit host specified in the
   // extension content_scripts_explicit_hosts). All four extensions should
   // inject the script.
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/extensions/test_file.html"));
 
@@ -376,7 +376,7 @@
       ActiveScriptController::GetForWebContents(web_contents);
   ASSERT_TRUE(active_script_controller);
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/extensions/test_file.html"));
 
@@ -424,7 +424,7 @@
                                        false /* won't reply */));
   inject_success_listener.set_extension_id(extension->id());
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url = embedded_test_server()->GetURL("/extensions/test_file.html");
   ui_test_utils::NavigateToURL(browser(), url);
 
@@ -488,7 +488,7 @@
           EXECUTE_SCRIPT),
   };
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/extensions/test_file.html"));
 
diff --git a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc
index 5236b96..0fdf5f30 100644
--- a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc
+++ b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc
@@ -11,6 +11,7 @@
 #include "chrome/common/extensions/api/cloud_print_private.h"
 #include "components/cloud_devices/common/cloud_devices_switches.h"
 #include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -26,7 +27,7 @@
     ExtensionApiTest::SetUpCommandLine(command_line);
     command_line->AppendSwitchASCII(
         switches::kCloudPrintURL,
-        "http://www.cloudprintapp.com/files/extensions/api_test/"
+        "http://www.cloudprintapp.com/extensions/api_test/"
         "cloud_print_private");
   }
 
@@ -34,7 +35,7 @@
     // Start up the test server and get us ready for calling the install
     // API functions.
     host_resolver()->AddRule("www.cloudprintapp.com", "127.0.0.1");
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
  protected:
@@ -42,8 +43,8 @@
    // matches the cloud print app's extent that we set up via command line
    // flags.
   GURL GetTestServerURL(const std::string& path) {
-    GURL url = test_server()->GetURL(
-        "files/extensions/api_test/cloud_print_private/" + path);
+    GURL url = embedded_test_server()->GetURL(
+        "/extensions/api_test/cloud_print_private/" + path);
 
     // Replace the host with 'www.cloudprintapp.com' so it matches the cloud
     // print app's extent.
diff --git a/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc b/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc
index e4cd9cff..2dcdab1 100644
--- a/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc
+++ b/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc
@@ -9,6 +9,7 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "extensions/test/result_catcher.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 namespace extensions {
 
@@ -28,7 +29,7 @@
 // crbug.com/51436 -- creating context menus from multiple script contexts
 // should work.
 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenusFromMultipleContexts) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("context_menus/add_from_multiple_contexts"))
       << message_;
   const extensions::Extension* extension = GetSingleLoadedExtension();
diff --git a/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc b/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc
index d6538b7..e16014d 100644
--- a/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc
+++ b/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc
@@ -197,7 +197,7 @@
 // http://crbug.com/421118
 IN_PROC_BROWSER_TEST_F(RequestContentScriptAPITest,
                        DISABLED_PermissionMatcherAgreementInjection) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Positive tests: permissions and matcher contain conditions that match URL
   // visited during test.
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
index 21c965c..1edc60c 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
@@ -190,7 +190,7 @@
   EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
   embedded_test_server()->ServeFilesFromDirectory(test_data.AppendASCII(
       "extensions/api_test/desktop_capture_delegate"));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   host_resolver()->AddRule("*", embedded_test_server()->base_url().host());
 
   // Load extension.
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index df3396b..6e8821d 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -43,6 +43,7 @@
 #include "extensions/browser/notification_types.h"
 #include "net/base/data_url.h"
 #include "net/base/net_util.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/url_request/url_request_slow_download_job.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_context.h"
@@ -1490,8 +1491,7 @@
                        DownloadExtensionTest_Download_Basic) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
   GoOnTheRecord();
 
   // Start downloading a file.
@@ -1514,14 +1514,13 @@
                           "  \"paused\": false,"
                           "  \"url\": \"%s\"}]",
                           download_url.c_str())));
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -1537,9 +1536,8 @@
                        DownloadExtensionTest_Download_Incognito) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
   GoOffTheRecord();
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -1561,14 +1559,13 @@
                           "  \"paused\": false,"
                           "  \"url\": \"%s\"}]",
                           download_url.c_str())));
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\":%d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\":%d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\":%d,"
@@ -1592,7 +1589,6 @@
                        MAYBE_DownloadExtensionTest_Download_UnsafeHeaders) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
   GoOnTheRecord();
 
   static const char* const kUnsafeHeaders[] = {
@@ -1624,7 +1620,7 @@
   };
 
   for (size_t index = 0; index < arraysize(kUnsafeHeaders); ++index) {
-    std::string download_url = test_server()->GetURL("slow?0").spec();
+    std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
     EXPECT_STREQ(errors::kInvalidHeaderUnsafe,
                   RunFunctionAndReturnError(new DownloadsDownloadFunction(),
                                             base::StringPrintf(
@@ -1644,9 +1640,8 @@
                        DownloadExtensionTest_Download_InvalidHeaders) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
   GoOnTheRecord();
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
   EXPECT_STREQ(errors::kInvalidHeaderName,
                RunFunctionAndReturnError(new DownloadsDownloadFunction(),
                                          base::StringPrintf(
@@ -1679,8 +1674,7 @@
                        MAYBE_DownloadExtensionTest_Download_Subdirectory) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -1726,8 +1720,7 @@
                        DownloadExtensionTest_Download_InvalidFilename) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
   GoOnTheRecord();
 
   EXPECT_STREQ(errors::kInvalidFilename,
@@ -1790,8 +1783,8 @@
                        DownloadExtensionTest_Download_URLFragment) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0#fragment").spec();
+  std::string download_url =
+      embedded_test_server()->GetURL("/slow?0#fragment").spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -1813,14 +1806,13 @@
                           "  \"paused\": false,"
                           "  \"url\": \"%s\"}]",
                           download_url.c_str())));
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -2017,8 +2009,8 @@
                        DownloadExtensionTest_Download_AuthBasic_Fail) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("auth-basic").spec();
+  std::string download_url =
+      embedded_test_server()->GetURL("/auth-basic").spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2050,9 +2042,12 @@
                        DownloadExtensionTest_Download_Headers) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("files/downloads/"
-      "a_zip_file.zip?expected_headers=Foo:bar&expected_headers=Qx:yo").spec();
+  std::string download_url =
+      embedded_test_server()
+          ->GetURL(
+              "/downloads/"
+              "a_zip_file.zip?expected_headers=Foo:bar&expected_headers=Qx:yo")
+          .spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2104,9 +2099,12 @@
                        DownloadExtensionTest_Download_Headers_Fail) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("files/downloads/"
-      "a_zip_file.zip?expected_headers=Foo:bar&expected_headers=Qx:yo").spec();
+  std::string download_url =
+      embedded_test_server()
+          ->GetURL(
+              "/downloads/"
+              "a_zip_file.zip?expected_headers=Foo:bar&expected_headers=Qx:yo")
+          .spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2141,8 +2139,8 @@
                        DownloadExtensionTest_Download_AuthBasic) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("auth-basic").spec();
+  std::string download_url =
+      embedded_test_server()->GetURL("/auth-basic").spec();
   // This is just base64 of 'username:secret'.
   static const char kAuthorization[] = "dXNlcm5hbWU6c2VjcmV0";
   GoOnTheRecord();
@@ -2168,7 +2166,6 @@
                           "[{\"danger\": \"safe\","
                           "  \"incognito\": false,"
                           "  \"bytesReceived\": 0.0,"
-                          "  \"fileSize\": 0.0,"
                           "  \"mime\": \"text/html\","
                           "  \"paused\": false,"
                           "  \"url\": \"%s\"}]",
@@ -2188,9 +2185,11 @@
                        DownloadExtensionTest_Download_Post) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("files/post/downloads/"
-      "a_zip_file.zip?expected_body=BODY").spec();
+  std::string download_url = embedded_test_server()
+                                 ->GetURL(
+                                     "/post/downloads/"
+                                     "a_zip_file.zip?expected_body=BODY")
+                                 .spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2242,9 +2241,11 @@
                        DownloadExtensionTest_Download_Post_Get) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("files/post/downloads/"
-      "a_zip_file.zip?expected_body=BODY").spec();
+  std::string download_url = embedded_test_server()
+                                 ->GetURL(
+                                     "/post/downloads/"
+                                     "a_zip_file.zip?expected_body=BODY")
+                                 .spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2283,9 +2284,11 @@
                        DownloadExtensionTest_Download_Post_NoBody) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("files/post/downloads/"
-      "a_zip_file.zip?expected_body=BODY").spec();
+  std::string download_url = embedded_test_server()
+                                 ->GetURL(
+                                     "/post/downloads/"
+                                     "a_zip_file.zip?expected_body=BODY")
+                                 .spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2323,9 +2326,9 @@
                        DownloadExtensionTest_Download_Cancel) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL(
-      "download-known-size").spec();
+  ASSERT_TRUE(spawned_test_server()->Start());
+  std::string download_url =
+      spawned_test_server()->GetURL("download-known-size").spec();
   GoOnTheRecord();
 
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2435,8 +2438,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2482,14 +2484,13 @@
   EXPECT_EQ("", error);
 
   // The download should complete successfully.
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -2507,8 +2508,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   ExtensionDownloadsEventRouter::SetDetermineFilenameTimeoutSecondsForTesting(
       0);
@@ -2546,13 +2546,13 @@
   // Do not respond to the onDeterminingFilename.
 
   // The download should complete successfully.
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-      base::StringPrintf("[{\"id\": %d,"
-                         "  \"filename\": {"
-                         "    \"previous\": \"\","
-                         "    \"current\": \"%s\"}}]",
-                         result_id,
-                         GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
       base::StringPrintf("[{\"id\": %d,"
                          "  \"state\": {"
@@ -2567,8 +2567,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2625,13 +2624,13 @@
   EXPECT_EQ(errors::kTooManyListeners, error);
 
   // The download should complete successfully.
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-      base::StringPrintf("[{\"id\": %d,"
-                         "  \"filename\": {"
-                         "    \"previous\": \"\","
-                         "    \"current\": \"%s\"}}]",
-                         result_id,
-                         GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
       base::StringPrintf("[{\"id\": %d,"
                          "  \"state\": {"
@@ -2647,8 +2646,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2726,8 +2724,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2770,14 +2767,13 @@
       downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -2794,8 +2790,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2838,14 +2833,13 @@
       downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -2862,8 +2856,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2907,14 +2900,13 @@
       downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -2937,8 +2929,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -2981,14 +2972,13 @@
       downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3005,8 +2995,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3049,14 +3038,13 @@
       downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3070,11 +3058,10 @@
     DownloadExtensionTest,
     DownloadExtensionTest_OnDeterminingFilename_ParentDirInvalid) {
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
   GoOnTheRecord();
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3117,14 +3104,13 @@
       downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY,
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3141,8 +3127,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3186,14 +3171,13 @@
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
 
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3210,8 +3194,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3255,14 +3238,13 @@
       &error));
   EXPECT_STREQ(errors::kInvalidFilename, error.c_str());
 
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3280,8 +3262,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3324,14 +3305,13 @@
       &error));
   EXPECT_EQ("", error);
 
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3385,14 +3365,13 @@
       &error));
   EXPECT_EQ("", error);
 
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3409,8 +3388,7 @@
   LoadExtension("downloads_split");
   AddFilenameDeterminer();
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3453,14 +3431,13 @@
       &error));
   EXPECT_EQ("", error);
 
-  ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
-                      base::StringPrintf(
-                          "[{\"id\": %d,"
-                          "  \"filename\": {"
-                          "    \"previous\": \"\","
-                          "    \"current\": \"%s\"}}]",
-                          result_id,
-                          GetFilename("slow.txt").c_str())));
+  ASSERT_TRUE(
+      WaitFor(downloads::OnChanged::kEventName,
+              base::StringPrintf("[{\"id\": %d,"
+                                 "  \"filename\": {"
+                                 "    \"previous\": \"\","
+                                 "    \"current\": \"%s\"}}]",
+                                 result_id, GetFilename("slow.txt").c_str())));
   ASSERT_TRUE(WaitFor(downloads::OnChanged::kEventName,
                       base::StringPrintf(
                           "[{\"id\": %d,"
@@ -3544,11 +3521,10 @@
     DownloadExtensionTest,
     MAYBE_DownloadExtensionTest_OnDeterminingFilename_RemoveFilenameDeterminer) {
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
   GoOnTheRecord();
   LoadExtension("downloads_split");
   content::RenderProcessHost* host = AddFilenameDeterminer();
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   // Start downloading a file.
   scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
@@ -3597,8 +3573,7 @@
     DownloadExtensionTest_OnDeterminingFilename_IncognitoSplit) {
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   GoOnTheRecord();
   AddFilenameDeterminer();
@@ -3736,8 +3711,7 @@
     DownloadExtensionTest_OnDeterminingFilename_IncognitoSpanning) {
   LoadExtension("downloads_spanning");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
-  std::string download_url = test_server()->GetURL("slow?0").spec();
+  std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
 
   GoOnTheRecord();
   AddFilenameDeterminer();
@@ -3888,7 +3862,6 @@
       switches::kEnableDownloadResumption);
   LoadExtension("downloads_split");
   ASSERT_TRUE(StartEmbeddedTestServer());
-  ASSERT_TRUE(test_server()->Start());
   GoOnTheRecord();
   content::RenderProcessHost* host = AddFilenameDeterminer();
 
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index 0b7f5cb..c971ea6 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -29,6 +29,7 @@
 #include "extensions/common/feature_switch.h"
 #include "extensions/test/result_catcher.h"
 #include "grit/theme_resources.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/geometry/size.h"
@@ -119,7 +120,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("browser_action/basics")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
   ASSERT_TRUE(extension) << message_;
@@ -141,8 +142,8 @@
             action->GetBadgeBackgroundColor(ExtensionAction::kDefaultTabId));
 
   // Simulate the browser action being clicked.
-  ui_test_utils::NavigateToURL(browser(),
-      test_server()->GetURL("files/extensions/test_file.txt"));
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
 
   ExtensionActionAPI::Get(browser()->profile())->ExecuteExtensionAction(
       extension, browser(), true);
@@ -484,7 +485,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoBasic) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(RunExtensionTest("browser_action/basics")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
@@ -586,7 +587,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BadgeBackgroundColor) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("browser_action/color")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
   ASSERT_TRUE(extension) << message_;
@@ -648,7 +649,7 @@
 
 // Verify triggering browser action.
 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TestTriggerBrowserAction) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(RunExtensionTest("trigger_actions/browser_action")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
@@ -657,9 +658,8 @@
   // Test that there is a browser action in the toolbar.
   ASSERT_EQ(1, GetBrowserActionsBar()->NumberOfBrowserActions());
 
-  ui_test_utils::NavigateToURL(
-     browser(),
-     test_server()->GetURL("files/simple.html"));
+  ui_test_utils::NavigateToURL(browser(),
+                               embedded_test_server()->GetURL("/simple.html"));
 
   ExtensionAction* browser_action = GetBrowserAction(*extension);
   EXPECT_TRUE(browser_action != NULL);
diff --git a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
index 0a03fdb6..c0e0311 100644
--- a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
@@ -22,6 +22,7 @@
 #include "extensions/browser/extension_system.h"
 #include "extensions/common/extension.h"
 #include "extensions/test/result_catcher.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::WebContents;
 
@@ -37,7 +38,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(PageActionApiTest, Basic) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("page_action/basics")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
   ASSERT_TRUE(extension) << message_;
@@ -201,7 +202,7 @@
 
 // Verify triggering page action.
 IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(RunExtensionTest("trigger_actions/page_action")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
@@ -209,7 +210,7 @@
 
   // Page action icon is displayed when a tab is created.
   ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL("files/simple.html"));
+                               embedded_test_server()->GetURL("/simple.html"));
   chrome::NewTab(browser());
   browser()->tab_strip_model()->ActivateTabAt(0, true);
 
diff --git a/chrome/browser/extensions/api/i18n/i18n_apitest.cc b/chrome/browser/extensions/api/i18n/i18n_apitest.cc
index 96c3605f..df16809 100644
--- a/chrome/browser/extensions/api/i18n/i18n_apitest.cc
+++ b/chrome/browser/extensions/api/i18n/i18n_apitest.cc
@@ -19,7 +19,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   // Create an Extension whose messages.json file will be updated.
   base::ScopedTempDir extension_dir;
   ASSERT_TRUE(extension_dir.CreateUniqueTempDir());
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index b964bc9..fceefe9 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -55,7 +55,7 @@
 #include "extensions/common/test_util.h"
 #include "google_apis/gaia/google_service_auth_error.h"
 #include "google_apis/gaia/oauth2_mint_token_flow.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
@@ -1781,13 +1781,11 @@
 };
 
 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, UserCloseWindow) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL(
-          "chrome/test/data/extensions/api_test/identity")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory(
+      "chrome/test/data/extensions/api_test/identity");
   ASSERT_TRUE(https_server.Start());
-  GURL auth_url(https_server.GetURL("files/interaction_required.html"));
+  GURL auth_url(https_server.GetURL("/interaction_required.html"));
 
   scoped_refptr<IdentityLaunchWebAuthFlowFunction> function(
       new IdentityLaunchWebAuthFlowFunction());
@@ -1807,13 +1805,11 @@
 }
 
 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, InteractionRequired) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL(
-          "chrome/test/data/extensions/api_test/identity")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory(
+      "chrome/test/data/extensions/api_test/identity");
   ASSERT_TRUE(https_server.Start());
-  GURL auth_url(https_server.GetURL("files/interaction_required.html"));
+  GURL auth_url(https_server.GetURL("/interaction_required.html"));
 
   scoped_refptr<IdentityLaunchWebAuthFlowFunction> function(
       new IdentityLaunchWebAuthFlowFunction());
@@ -1829,13 +1825,11 @@
 }
 
 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, LoadFailed) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL(
-          "chrome/test/data/extensions/api_test/identity")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory(
+      "chrome/test/data/extensions/api_test/identity");
   ASSERT_TRUE(https_server.Start());
-  GURL auth_url(https_server.GetURL("files/five_hundred.html"));
+  GURL auth_url(https_server.GetURL("/five_hundred.html"));
 
   scoped_refptr<IdentityLaunchWebAuthFlowFunction> function(
       new IdentityLaunchWebAuthFlowFunction());
@@ -1905,13 +1899,11 @@
 
 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest,
                        DISABLED_InteractiveSecondNavigationSuccess) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL(
-          "chrome/test/data/extensions/api_test/identity")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory(
+      "chrome/test/data/extensions/api_test/identity");
   ASSERT_TRUE(https_server.Start());
-  GURL auth_url(https_server.GetURL("files/redirect_to_chromiumapp.html"));
+  GURL auth_url(https_server.GetURL("/redirect_to_chromiumapp.html"));
 
   scoped_refptr<IdentityLaunchWebAuthFlowFunction> function(
       new IdentityLaunchWebAuthFlowFunction());
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc
index e34f6fc4..9266ff7 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc
@@ -43,7 +43,6 @@
 using net::test_server::BasicHttpResponse;
 using net::test_server::HttpRequest;
 using net::test_server::HttpResponse;
-using net::test_server::EmbeddedTestServer;
 using testing::_;
 
 namespace streams_private = extensions::api::streams_private;
@@ -136,8 +135,8 @@
 
   void SetUpOnMainThread() override {
     // Init test server.
-    test_server_.reset(new EmbeddedTestServer);
-    ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady());
+    test_server_.reset(new net::EmbeddedTestServer);
+    ASSERT_TRUE(test_server_->Start());
     test_server_->RegisterRequestHandler(base::Bind(&HandleRequest));
 
     ExtensionApiTest::SetUpOnMainThread();
@@ -235,7 +234,7 @@
  protected:
   std::string test_extension_id_;
   // The HTTP server used in the tests.
-  scoped_ptr<EmbeddedTestServer> test_server_;
+  scoped_ptr<net::EmbeddedTestServer> test_server_;
   base::ScopedTempDir downloads_dir_;
 };
 
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index 9fff228..4ee22430 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -42,7 +42,7 @@
 #include "extensions/common/test_util.h"
 #include "extensions/test/extension_test_message_listener.h"
 #include "extensions/test/result_catcher.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/views/widget/widget.h"
 #include "ui/views/widget/widget_observer.h"
@@ -1608,15 +1608,13 @@
   // load without causing an error page load), (2) have different domains, and
   // (3) are zoomable by the extension API (this last condition rules out
   // chrome:// urls). We achieve this by noting that about:blank meets these
-  // requirements, allowing us to spin up a spawned http server on localhost to
-  // get the other domain.
-  net::SpawnedTestServer http_server(
-      net::SpawnedTestServer::TYPE_HTTP,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  // requirements, allowing us to spin up an embedded http server on localhost
+  // to get the other domain.
+  net::EmbeddedTestServer http_server;
+  http_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(http_server.Start());
 
-  GURL url_A = http_server.GetURL("files/simple.html");
+  GURL url_A = http_server.GetURL("/simple.html");
   GURL url_B("about:blank");
 
   // Tabs A1 and A2 are navigated to the same origin, while B is navigated
@@ -1675,13 +1673,11 @@
 }
 
 IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, PerTabResetsOnNavigation) {
-  net::SpawnedTestServer http_server(
-      net::SpawnedTestServer::TYPE_HTTP,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer http_server;
+  http_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(http_server.Start());
 
-  GURL url_A = http_server.GetURL("files/simple.html");
+  GURL url_A = http_server.GetURL("/simple.html");
   GURL url_B("about:blank");
 
   content::WebContents* web_contents = OpenUrlAndWaitForLoad(url_A);
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
index 656b7d3..28f99f3 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
@@ -32,6 +32,7 @@
 #include "gpu/config/gpu_feature_type.h"
 #include "gpu/config/gpu_info.h"
 #include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/gl/gl_switches.h"
 
 using gpu::GpuFeatureType;
@@ -101,7 +102,7 @@
     ExtensionApiTest::SetUpCommandLine(command_line);
     command_line->AppendSwitchASCII(
         switches::kAppsGalleryURL,
-        "http://www.example.com/files/extensions/api_test");
+        "http://www.example.com/extensions/api_test");
   }
 
   void SetUpInProcessBrowserTestFixture() override {
@@ -110,7 +111,7 @@
     // Start up the test server and get us ready for calling the install
     // API functions.
     host_resolver()->AddRule("www.example.com", "127.0.0.1");
-    ASSERT_TRUE(StartSpawnedTestServer());
+    ASSERT_TRUE(StartEmbeddedTestServer());
     extensions::ExtensionInstallUI::set_disable_failure_ui_for_tests();
   }
 
@@ -130,7 +131,7 @@
   // Returns a test server URL, but with host 'www.example.com' so it matches
   // the web store app's extent that we set up via command line flags.
   GURL DoGetTestServerURL(const std::string& path) {
-    GURL url = test_server()->GetURL(path);
+    GURL url = embedded_test_server()->GetURL(path);
 
     // Replace the host with 'www.example.com' so it matches the web store
     // app's extent.
@@ -142,7 +143,7 @@
 
   virtual GURL GetTestServerURL(const std::string& path) {
     return DoGetTestServerURL(
-        std::string("files/extensions/api_test/webstore_private/") + path);
+        std::string("/extensions/api_test/webstore_private/") + path);
   }
 
   // Navigates to |page| and runs the Extension API test there. Any downloads
@@ -189,8 +190,8 @@
   base::string16 failure_title = base::UTF8ToUTF16("FAIL");
   content::TitleWatcher watcher(GetWebContents(), expected_title);
   watcher.AlsoWaitForTitle(failure_title);
-  GURL url = test_server()->GetURL(
-      "files/extensions/api_test/webstore_private/noframe.html");
+  GURL url = embedded_test_server()->GetURL(
+      "/extensions/api_test/webstore_private/noframe.html");
   ui_test_utils::NavigateToURL(browser(), url);
   base::string16 final_title = watcher.WaitAndGetTitle();
   EXPECT_EQ(expected_title, final_title);
@@ -204,8 +205,8 @@
   base::string16 failure_title = base::UTF8ToUTF16("FAIL");
   content::TitleWatcher watcher(GetWebContents(), expected_title);
   watcher.AlsoWaitForTitle(failure_title);
-  GURL url = test_server()->GetURL(
-      "files/extensions/api_test/webstore_private/noframe2.html");
+  GURL url = embedded_test_server()->GetURL(
+      "/extensions/api_test/webstore_private/noframe2.html");
   ui_test_utils::NavigateToURL(browser(), url);
   base::string16 final_title = watcher.WaitAndGetTitle();
   EXPECT_EQ(expected_title, final_title);
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 9539515..e0a17bd 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -73,7 +73,7 @@
         extensions::ProcessMap::Get(browser()->profile());
 
     host_resolver()->AddRule("*", "127.0.0.1");
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     ASSERT_TRUE(LoadExtension(
         test_data_dir_.AppendASCII(app_name)));
@@ -150,7 +150,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process")));
 
@@ -298,7 +298,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL base_url = GetTestBaseURL("app_process");
 
   // Load an app as a bookmark app.
@@ -378,7 +378,7 @@
 // Flaky.  http://crbug.com/341898
 IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_AppProcessRedirectBack) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process")));
 
@@ -423,7 +423,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
@@ -470,7 +470,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
@@ -535,7 +535,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
@@ -607,7 +607,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL base_url = GetTestBaseURL("app_process");
 
@@ -644,7 +644,7 @@
 #endif
 IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, MAYBE_OpenAppFromIframe) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Load app and start URL (not in the app).
   const Extension* app =
@@ -751,7 +751,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL base_url = GetTestBaseURL("app_process");
 
@@ -794,7 +794,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process")));
 
@@ -836,7 +836,7 @@
       extensions::ProcessMap::Get(browser()->profile());
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL base_url = GetTestBaseURL("app_process");
 
diff --git a/chrome/browser/extensions/background_xhr_browsertest.cc b/chrome/browser/extensions/background_xhr_browsertest.cc
index 6ff6deb..276352c 100644
--- a/chrome/browser/extensions/background_xhr_browsertest.cc
+++ b/chrome/browser/extensions/background_xhr_browsertest.cc
@@ -16,7 +16,8 @@
 #include "net/base/escape.h"
 #include "net/base/url_util.h"
 #include "net/ssl/client_cert_store.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/ssl/ssl_server_config.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 namespace {
@@ -63,20 +64,20 @@
   loop.Run();
 
   // Launch HTTPS server.
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.request_client_certificate = true;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("content/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  net::SSLServerConfig ssl_config;
+  ssl_config.require_client_cert = true;
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config);
+  https_server.ServeFilesFromSourceDirectory("content/test/data");
   ASSERT_TRUE(https_server.Start());
 
   ASSERT_NO_FATAL_FAILURE(
-      RunTest("test_tls_client_auth.html", https_server.GetURL("")));
+      RunTest("test_tls_client_auth.html", https_server.GetURL("/")));
 }
 
 // Test that fetching a URL using HTTP auth doesn't crash, hang, or prompt.
 IN_PROC_BROWSER_TEST_F(BackgroundXhrTest, HttpAuth) {
-  ASSERT_TRUE(test_server()->Start());
-  ASSERT_NO_FATAL_FAILURE(
-      RunTest("test_http_auth.html", test_server()->GetURL("auth-basic")));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ASSERT_NO_FATAL_FAILURE(RunTest(
+      "test_http_auth.html", embedded_test_server()->GetURL("/auth-basic")));
 }
diff --git a/chrome/browser/extensions/chrome_app_api_browsertest.cc b/chrome/browser/extensions/chrome_app_api_browsertest.cc
index d112f35..108d57b 100644
--- a/chrome/browser/extensions/chrome_app_api_browsertest.cc
+++ b/chrome/browser/extensions/chrome_app_api_browsertest.cc
@@ -90,7 +90,7 @@
 
 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL app_url =
       embedded_test_server()->GetURL("app.com", "/extensions/test_file.html");
   GURL non_app_url = embedded_test_server()->GetURL(
@@ -169,7 +169,7 @@
 
 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, InstallAndRunningState) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL app_url = embedded_test_server()->GetURL(
       "app.com", "/extensions/get_app_details_for_frame.html");
   GURL non_app_url = embedded_test_server()->GetURL(
@@ -226,7 +226,7 @@
 
 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, InstallAndRunningStateFrame) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL app_url = embedded_test_server()->GetURL(
       "app.com", "/extensions/get_app_details_for_frame_reversed.html");
 
diff --git a/chrome/browser/extensions/content_capabilities_browsertest.cc b/chrome/browser/extensions/content_capabilities_browsertest.cc
index 23afca7c..a33169c8 100644
--- a/chrome/browser/extensions/content_capabilities_browsertest.cc
+++ b/chrome/browser/extensions/content_capabilities_browsertest.cc
@@ -99,7 +99,7 @@
     EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
     embedded_test_server()->ServeFilesFromDirectory(
         test_data.AppendASCII("extensions/content_capabilities"));
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     host_resolver()->AddRule("*", embedded_test_server()->base_url().host());
   }
 
diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc
index d1f816c..a561187 100644
--- a/chrome/browser/extensions/content_script_apitest.cc
+++ b/chrome/browser/extensions/content_script_apitest.cc
@@ -367,7 +367,7 @@
       content::Source<Profile>(browser()->profile()));
 
   // Start with a renderer already open at a URL.
-  GURL url(test_server()->GetURL("file/extensions/test_file.html"));
+  GURL url(embedded_test_server()->GetURL("/extensions/test_file.html"));
   ui_test_utils::NavigateToURL(browser(), url);
 
   LoadExtension(
diff --git a/chrome/browser/extensions/dev_mode_bubble_delegate.cc b/chrome/browser/extensions/dev_mode_bubble_delegate.cc
index 5f723de..1ac48c9 100644
--- a/chrome/browser/extensions/dev_mode_bubble_delegate.cc
+++ b/chrome/browser/extensions/dev_mode_bubble_delegate.cc
@@ -19,13 +19,6 @@
 
 namespace extensions {
 
-namespace {
-
-base::LazyInstance<std::set<Profile*> > g_shown_for_profiles =
-    LAZY_INSTANCE_INITIALIZER;
-
-}  // namespace
-
 DevModeBubbleDelegate::DevModeBubbleDelegate(Profile* profile)
     : ExtensionMessageBubbleController::Delegate(profile) {
 }
@@ -105,13 +98,12 @@
       action, ExtensionMessageBubbleController::ACTION_BOUNDARY);
 }
 
-std::set<Profile*>* DevModeBubbleDelegate::GetProfileSet() {
-  return g_shown_for_profiles.Pointer();
+const char* DevModeBubbleDelegate::GetKey() {
+  return "DevModeBubbleDelegate";
 }
 
-// static
-void DevModeBubbleDelegate::ClearProfileListForTesting() {
-  g_shown_for_profiles.Get().clear();
+bool DevModeBubbleDelegate::ClearProfileSetAfterAction() {
+  return false;
 }
 
 }  // namespace extensions
diff --git a/chrome/browser/extensions/dev_mode_bubble_delegate.h b/chrome/browser/extensions/dev_mode_bubble_delegate.h
index b8bdaab..7412aa7a 100644
--- a/chrome/browser/extensions/dev_mode_bubble_delegate.h
+++ b/chrome/browser/extensions/dev_mode_bubble_delegate.h
@@ -40,9 +40,8 @@
   bool ShouldLimitToEnabledExtensions() const override;
   void LogExtensionCount(size_t count) override;
   void LogAction(ExtensionMessageBubbleController::BubbleAction) override;
-  std::set<Profile*>* GetProfileSet() override;
-
-  static void ClearProfileListForTesting();
+  const char* GetKey() override;
+  bool ClearProfileSetAfterAction() override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(DevModeBubbleDelegate);
diff --git a/chrome/browser/extensions/error_console/error_console_browsertest.cc b/chrome/browser/extensions/error_console/error_console_browsertest.cc
index b8ef787..c14cbaf 100644
--- a/chrome/browser/extensions/error_console/error_console_browsertest.cc
+++ b/chrome/browser/extensions/error_console/error_console_browsertest.cc
@@ -221,7 +221,7 @@
 
   const GURL& GetTestURL() {
     if (test_url_.is_empty()) {
-      CHECK(embedded_test_server()->InitializeAndWaitUntilReady());
+      CHECK(embedded_test_server()->Start());
       test_url_ = embedded_test_server()->GetURL(kTestingPage);
     }
     return test_url_;
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc
index 261ee75..c039ba7 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -33,12 +33,11 @@
 namespace {
 
 const char kTestCustomArg[] = "customArg";
-const char kTestServerPort[] = "testServer.port";
 const char kTestDataDirectory[] = "testDataDirectory";
 const char kTestWebSocketPort[] = "testWebSocketPort";
 const char kSitePerProcess[] = "sitePerProcess";
 const char kFtpServerPort[] = "ftpServer.port";
-const char kSpawnedTestServerPort[] = "spawnedTestServer.port";
+const char kEmbeddedTestServerPort[] = "testServer.port";
 
 scoped_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest(
     const net::test_server::HttpRequest& request) {
@@ -370,13 +369,13 @@
 }
 
 bool ExtensionApiTest::StartEmbeddedTestServer() {
-  if (!embedded_test_server()->InitializeAndWaitUntilReady())
+  if (!embedded_test_server()->Start())
     return false;
 
   // Build a dictionary of values that tests can use to build URLs that
   // access the test server and local file system.  Tests can see these values
   // using the extension API function chrome.test.getConfig().
-  test_config_->SetInteger(kTestServerPort,
+  test_config_->SetInteger(kEmbeddedTestServerPort,
                            embedded_test_server()->port());
 
   return true;
@@ -413,19 +412,6 @@
   return true;
 }
 
-bool ExtensionApiTest::StartSpawnedTestServer() {
-  if (!test_server()->Start())
-    return false;
-
-  // Build a dictionary of values that tests can use to build URLs that
-  // access the test server and local file system.  Tests can see these values
-  // using the extension API function chrome.test.getConfig().
-  test_config_->SetInteger(kSpawnedTestServerPort,
-                           test_server()->host_port_pair().port());
-
-  return true;
-}
-
 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) {
   ExtensionBrowserTest::SetUpCommandLine(command_line);
   test_data_dir_ = test_data_dir_.AppendASCII("api_test");
diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h
index 3f03fd7..7b1a193 100644
--- a/chrome/browser/extensions/extension_apitest.h
+++ b/chrome/browser/extensions/extension_apitest.h
@@ -148,11 +148,6 @@
   // chrome.test.getConfig().
   bool StartFTPServer(const base::FilePath& root_directory);
 
-  // Start the spawned test server, and store details of its state.  Those
-  // details will be available to javascript tests using
-  // chrome.test.getConfig().
-  bool StartSpawnedTestServer();
-
   // Test that exactly one extension loaded.  If so, return a pointer to
   // the extension.  If not, return NULL and set message_.
   const extensions::Extension* GetSingleLoadedExtension();
diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc
index 6985b54..c303164 100644
--- a/chrome/browser/extensions/extension_keybinding_apitest.cc
+++ b/chrome/browser/extensions/extension_keybinding_apitest.cc
@@ -29,6 +29,7 @@
 #include "extensions/common/permissions/permissions_data.h"
 #include "extensions/test/extension_test_message_listener.h"
 #include "extensions/test/result_catcher.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::WebContents;
 
@@ -142,11 +143,11 @@
 #if defined(OS_CHROMEOS)
   void RunChromeOSConversionTest(const std::string& extension_path) {
     // Setup the environment.
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
     ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
     ASSERT_TRUE(RunExtensionTest(extension_path)) << message_;
     ui_test_utils::NavigateToURL(
-        browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+        browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
 
     ResultCatcher catcher;
 
@@ -172,7 +173,7 @@
 // - The shortcut keys taken by one extension are not overwritten by the last
 //   installed extension.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
   ASSERT_TRUE(extension) << message_;
@@ -188,7 +189,7 @@
   ASSERT_EQ(2, browser_actions_bar.NumberOfBrowserActions());
 
   ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+      browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
 
   // activeTab shouldn't have been granted yet.
   WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
@@ -215,7 +216,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, PageAction) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("keybinding/page_action")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
   ASSERT_TRUE(extension) << message_;
@@ -225,7 +226,7 @@
     // the page action icon.
     ResultCatcher catcher;
     ui_test_utils::NavigateToURL(
-        browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+        browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
     ASSERT_TRUE(catcher.GetNextResult());
   }
 
@@ -251,7 +252,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, PageActionKeyUpdated) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("keybinding/page_action")) << message_;
   const Extension* extension = GetSingleLoadedExtension();
   ASSERT_TRUE(extension) << message_;
@@ -266,7 +267,7 @@
     // the page action icon.
     ResultCatcher catcher;
     ui_test_utils::NavigateToURL(
-        browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+        browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
     ASSERT_TRUE(catcher.GetNextResult());
   }
 
@@ -285,21 +286,21 @@
 // commands as well as synthesized ones and that inactive commands (like the
 // synthesized ones are in nature) have no shortcuts.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, SynthesizedCommand) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("keybinding/synthesized")) << message_;
 }
 
 // This test validates that an extension cannot request a shortcut that is
 // already in use by Chrome.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, DontOverwriteSystemShortcuts) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
   ASSERT_TRUE(RunExtensionTest("keybinding/dont_overwrite_system")) << message_;
 
   ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+      browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
 
   // Activate the regular shortcut (Alt+Shift+F).
   ExtensionTestMessageListener alt_shift_f_listener("alt_shift_f", false);
@@ -345,7 +346,7 @@
 // This test validates that an extension can remove the Chrome bookmark shortcut
 // if it has requested to do so.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, RemoveBookmarkShortcut) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
@@ -363,7 +364,7 @@
 // shortcut without being given permission with a feature flag.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest,
                        RemoveBookmarkShortcutWithoutPermission) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
@@ -378,7 +379,7 @@
 // Ctrl+D shortcut (i.e. it does not trigger the overwrite functionality).
 IN_PROC_BROWSER_TEST_F(CommandsApiTest,
                        RemoveBookmarkShortcutWithUserKeyBinding) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
@@ -406,7 +407,7 @@
 // This test validates that an extension can override the Chrome bookmark
 // shortcut if it has requested to do so.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, OverwriteBookmarkShortcut) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
@@ -418,7 +419,7 @@
       << message_;
 
   ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+      browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
 
   // Activate the shortcut (Ctrl+D) to send a test message.
   ExtensionTestMessageListener test_listener(false);  // Won't reply.
@@ -437,7 +438,7 @@
   base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
       "--enable-override-bookmarks-ui", "1");
 
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_BOOKMARK_PAGE));
 
@@ -467,7 +468,7 @@
 // shortcut does not supersede the same keybinding by web pages.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest,
                        OverwriteBookmarkShortcutDoesNotOverrideWebKeybinding) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
@@ -479,9 +480,8 @@
       << message_;
 
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL(
-          "files/extensions/test_file_with_ctrl-d_keybinding.html"));
+      browser(), embedded_test_server()->GetURL(
+                     "/extensions/test_file_with_ctrl-d_keybinding.html"));
 
   WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
   ASSERT_TRUE(tab);
@@ -499,7 +499,7 @@
 // web pages.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest,
                        OverwriteBookmarkShortcutByUserOverridesWebKeybinding) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
@@ -519,9 +519,8 @@
       kBookmarkKeybinding);
 
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL(
-          "files/extensions/test_file_with_ctrl-d_keybinding.html"));
+      browser(), embedded_test_server()->GetURL(
+                     "/extensions/test_file_with_ctrl-d_keybinding.html"));
 
   ExtensionTestMessageListener test_listener(false);  // Won't reply.
   // Activate the shortcut (Ctrl+D) which should be handled by the extension.
@@ -914,11 +913,11 @@
 
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, MAYBE_ContinuePropagation) {
   // Setup the environment.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   ASSERT_TRUE(RunExtensionTest("keybinding/continue_propagation")) << message_;
   ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/extensions/test_file.txt"));
+      browser(), embedded_test_server()->GetURL("/extensions/test_file.txt"));
 
   ResultCatcher catcher;
 
@@ -958,7 +957,7 @@
 // Make sure component extensions retain keybindings after removal then
 // re-adding.
 IN_PROC_BROWSER_TEST_F(CommandsApiTest, AddRemoveAddComponentExtension) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunComponentExtensionTest("keybinding/component")) << message_;
 
   extensions::ExtensionSystem::Get(browser()->profile())
diff --git a/chrome/browser/extensions/extension_loading_browsertest.cc b/chrome/browser/extensions/extension_loading_browsertest.cc
index b828879b..4e82ad16 100644
--- a/chrome/browser/extensions/extension_loading_browsertest.cc
+++ b/chrome/browser/extensions/extension_loading_browsertest.cc
@@ -33,7 +33,7 @@
                        UpgradeAfterNavigatingFromOverriddenNewTabPage) {
   embedded_test_server()->ServeFilesFromDirectory(
       base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   TestExtensionDir extension_dir;
   const char manifest_template[] =
@@ -99,7 +99,7 @@
                        KeepAliveWithDevToolsOpenOnReload) {
   embedded_test_server()->ServeFilesFromDirectory(
       base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   TestExtensionDir extension_dir;
   const char manifest_contents[] =
diff --git a/chrome/browser/extensions/extension_message_bubble_controller.cc b/chrome/browser/extensions/extension_message_bubble_controller.cc
index 8dd0160..7c9d2ce 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller.cc
+++ b/chrome/browser/extensions/extension_message_bubble_controller.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
 
 #include "base/bind.h"
+#include "base/lazy_instance.h"
 #include "base/metrics/histogram.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
@@ -24,12 +25,18 @@
 namespace extensions {
 
 namespace {
+
 // How many extensions to show in the bubble (max).
 const int kMaxExtensionsToShow = 7;
 
 // Whether or not to ignore the learn more link navigation for testing.
 bool g_should_ignore_learn_more_for_testing = false;
-}
+
+using ProfileSetMap = std::map<std::string, std::set<Profile*>>;
+base::LazyInstance<ProfileSetMap> g_shown_for_profiles =
+    LAZY_INSTANCE_INITIALIZER;
+
+}  // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
 // ExtensionMessageBubbleController::Delegate
@@ -48,6 +55,10 @@
   return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
 }
 
+bool ExtensionMessageBubbleController::Delegate::ClearProfileSetAfterAction() {
+  return true;
+}
+
 bool ExtensionMessageBubbleController::Delegate::HasBubbleInfoBeenAcknowledged(
     const std::string& extension_id) {
   std::string pref_name = get_acknowledged_flag_pref_name();
@@ -71,11 +82,6 @@
                              value ? new base::FundamentalValue(value) : NULL);
 }
 
-std::set<Profile*>*
-ExtensionMessageBubbleController::Delegate::GetProfileSet() {
-  return nullptr;
-}
-
 std::string
 ExtensionMessageBubbleController::Delegate::get_acknowledged_flag_pref_name()
     const {
@@ -108,8 +114,8 @@
 }
 
 bool ExtensionMessageBubbleController::ShouldShow() {
-  std::set<Profile*>* profiles = delegate_->GetProfileSet();
-  return (!profiles || !profiles->count(profile()->GetOriginalProfile())) &&
+  std::set<Profile*>* profiles = GetProfileSet();
+  return !profiles->count(profile()->GetOriginalProfile()) &&
          !GetExtensionList().empty();
 }
 
@@ -170,9 +176,7 @@
 }
 
 void ExtensionMessageBubbleController::OnShown() {
-  std::set<Profile*>* profiles = delegate_->GetProfileSet();
-  if (profiles)
-    profiles->insert(profile()->GetOriginalProfile());
+  GetProfileSet()->insert(profile()->GetOriginalProfile());
 }
 
 void ExtensionMessageBubbleController::OnBubbleAction() {
@@ -185,18 +189,21 @@
   OnClose();
 }
 
-void ExtensionMessageBubbleController::OnBubbleDismiss() {
+void ExtensionMessageBubbleController::OnBubbleDismiss(
+    bool closed_by_deactivation) {
   // OnBubbleDismiss() can be called twice when we receive multiple
   // "OnWidgetDestroying" notifications (this can at least happen when we close
   // a window with a notification open). Handle this gracefully.
   if (user_action_ != ACTION_BOUNDARY) {
-    DCHECK(user_action_ == ACTION_DISMISS);
+    DCHECK(user_action_ == ACTION_DISMISS_USER_ACTION ||
+           user_action_ == ACTION_DISMISS_DEACTIVATION);
     return;
   }
 
-  user_action_ = ACTION_DISMISS;
+  user_action_ = closed_by_deactivation ? ACTION_DISMISS_DEACTIVATION
+                                        : ACTION_DISMISS_USER_ACTION;
 
-  delegate_->LogAction(ACTION_DISMISS);
+  delegate_->LogAction(user_action_);
 
   OnClose();
 }
@@ -217,6 +224,10 @@
   OnClose();
 }
 
+void ExtensionMessageBubbleController::ClearProfileListForTesting() {
+  GetProfileSet()->clear();
+}
+
 // static
 void ExtensionMessageBubbleController::set_should_ignore_learn_more_for_testing(
     bool should_ignore) {
@@ -252,9 +263,22 @@
 }
 
 void ExtensionMessageBubbleController::OnClose() {
-  AcknowledgeExtensions();
+  DCHECK_NE(ACTION_BOUNDARY, user_action_);
+  // If the bubble was closed due to deactivation, don't treat it as
+  // acknowledgment so that the user will see the bubble again (until they
+  // explicitly take an action).
+  if (user_action_ != ACTION_DISMISS_DEACTIVATION) {
+    AcknowledgeExtensions();
+    if (delegate_->ClearProfileSetAfterAction())
+      GetProfileSet()->clear();
+  }
+
   if (did_highlight_)
     ToolbarActionsModel::Get(profile())->StopHighlighting();
 }
 
+std::set<Profile*>* ExtensionMessageBubbleController::GetProfileSet() {
+  return &g_shown_for_profiles.Get()[delegate_->GetKey()];
+}
+
 }  // namespace extensions
diff --git a/chrome/browser/extensions/extension_message_bubble_controller.h b/chrome/browser/extensions/extension_message_bubble_controller.h
index 40e5b81be..c3059c5 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller.h
+++ b/chrome/browser/extensions/extension_message_bubble_controller.h
@@ -24,8 +24,9 @@
   enum BubbleAction {
     ACTION_LEARN_MORE = 0,
     ACTION_EXECUTE,
-    ACTION_DISMISS,
-    ACTION_BOUNDARY, // Must be the last value.
+    ACTION_DISMISS_USER_ACTION,
+    ACTION_DISMISS_DEACTIVATION,
+    ACTION_BOUNDARY,  // Must be the last value.
   };
 
   class Delegate {
@@ -74,14 +75,22 @@
     virtual void LogExtensionCount(size_t count) = 0;
     virtual void LogAction(BubbleAction action) = 0;
 
-    // Has the user acknowledged info about the extension the bubble reports.
-    virtual bool HasBubbleInfoBeenAcknowledged(const std::string& extension_id);
-    virtual void SetBubbleInfoBeenAcknowledged(const std::string& extension_id,
-                                               bool value);
+    // Returns a key unique to the type of bubble that can be used to retrieve
+    // state specific to the type (e.g., shown for profiles).
+    virtual const char* GetKey() = 0;
 
-    // Returns the set of profiles for which this bubble has been shown.
-    // If profiles are not tracked, returns null (default).
-    virtual std::set<Profile*>* GetProfileSet();
+    // Whether the "shown for profiles" set should be cleared if an action is
+    // taken on the bubble. This defaults to true, since once an action is
+    // taken, the extension will usually either be acknowledged or removed, and
+    // the bubble won't show for that extension.
+    // This should be false in cases where there is no acknowledgment option
+    // (as in the developer-mode extension warning).
+    virtual bool ClearProfileSetAfterAction();
+
+    // Has the user acknowledged info about the extension the bubble reports.
+    bool HasBubbleInfoBeenAcknowledged(const std::string& extension_id);
+    void SetBubbleInfoBeenAcknowledged(const std::string& extension_id,
+                                       bool value);
 
    protected:
     Profile* profile() { return profile_; }
@@ -141,9 +150,11 @@
 
   // Callbacks from bubble. Declared virtual for testing purposes.
   virtual void OnBubbleAction();
-  virtual void OnBubbleDismiss();
+  virtual void OnBubbleDismiss(bool dismissed_by_deactivation);
   virtual void OnLinkClicked();
 
+  void ClearProfileListForTesting();
+
   static void set_should_ignore_learn_more_for_testing(
       bool should_ignore_learn_more);
 
@@ -157,6 +168,8 @@
   // Performs cleanup after the bubble closes.
   void OnClose();
 
+  std::set<Profile*>* GetProfileSet();
+
   // A weak pointer to the Browser we are associated with. Not owned by us.
   Browser* browser_;
 
diff --git a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
index 129990f..4af1301aa 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
+++ b/chrome/browser/extensions/extension_message_bubble_controller_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 "base/bind_helpers.h"
 #include "base/command_line.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
@@ -59,9 +60,9 @@
     ++action_button_callback_count_;
     ExtensionMessageBubbleController::OnBubbleAction();
   }
-  void OnBubbleDismiss() override {
+  void OnBubbleDismiss(bool by_deactivation) override {
     ++dismiss_button_callback_count_;
-    ExtensionMessageBubbleController::OnBubbleDismiss();
+    ExtensionMessageBubbleController::OnBubbleDismiss(by_deactivation);
   }
   void OnLinkClicked() override {
     ++link_click_callback_count_;
@@ -89,10 +90,12 @@
   enum ExtensionBubbleAction {
     BUBBLE_ACTION_CLICK_ACTION_BUTTON = 0,
     BUBBLE_ACTION_CLICK_DISMISS_BUTTON,
+    BUBBLE_ACTION_DISMISS_DEACTIVATION,
     BUBBLE_ACTION_CLICK_LINK,
   };
 
-  FakeExtensionMessageBubble() : controller_(nullptr) {}
+  FakeExtensionMessageBubble()
+      : action_(BUBBLE_ACTION_CLICK_ACTION_BUTTON), controller_(nullptr) {}
 
   void set_action_on_show(ExtensionBubbleAction action) {
     action_ = action;
@@ -103,12 +106,20 @@
 
   void Show() {
     controller_->OnShown();
-    if (action_ == BUBBLE_ACTION_CLICK_ACTION_BUTTON)
-      controller_->OnBubbleAction();
-    else if (action_ == BUBBLE_ACTION_CLICK_DISMISS_BUTTON)
-      controller_->OnBubbleDismiss();
-    else if (action_ == BUBBLE_ACTION_CLICK_LINK)
-      controller_->OnLinkClicked();
+    switch (action_) {
+      case BUBBLE_ACTION_CLICK_ACTION_BUTTON:
+        controller_->OnBubbleAction();
+        break;
+      case BUBBLE_ACTION_CLICK_DISMISS_BUTTON:
+        controller_->OnBubbleDismiss(false);
+        break;
+      case BUBBLE_ACTION_DISMISS_DEACTIVATION:
+        controller_->OnBubbleDismiss(true);
+        break;
+      case BUBBLE_ACTION_CLICK_LINK:
+        controller_->OnLinkClicked();
+        break;
+    }
   }
 
  private:
@@ -305,6 +316,70 @@
   DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleTest);
 };
 
+TEST_F(ExtensionMessageBubbleTest, BubbleReshowsOnDeactivationDismissal) {
+  Init();
+
+  ASSERT_TRUE(LoadExtensionOverridingNtp("1", kId1, Manifest::INTERNAL));
+  ASSERT_TRUE(LoadExtensionOverridingNtp("2", kId2, Manifest::INTERNAL));
+  scoped_ptr<TestExtensionMessageBubbleController> controller(
+      new TestExtensionMessageBubbleController(
+          new NtpOverriddenBubbleDelegate(browser()->profile()), browser()));
+
+  // The list will contain one enabled unpacked extension (ext 2).
+  EXPECT_TRUE(controller->ShouldShow());
+  std::vector<base::string16> override_extensions =
+      controller->GetExtensionList();
+  ASSERT_EQ(1U, override_extensions.size());
+  EXPECT_EQ(base::ASCIIToUTF16("Extension 2"), override_extensions[0]);
+  EXPECT_EQ(0U, controller->link_click_count());
+  EXPECT_EQ(0U, controller->dismiss_click_count());
+  EXPECT_EQ(0U, controller->action_click_count());
+
+  // Simulate showing the bubble and dismissing it due to deactivation.
+  FakeExtensionMessageBubble bubble;
+  bubble.set_action_on_show(
+      FakeExtensionMessageBubble::BUBBLE_ACTION_DISMISS_DEACTIVATION);
+  bubble.set_controller(controller.get());
+  bubble.Show();
+  EXPECT_EQ(0U, controller->link_click_count());
+  EXPECT_EQ(0U, controller->action_click_count());
+  EXPECT_EQ(1U, controller->dismiss_click_count());
+
+  // No extension should have become disabled.
+  ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
+  EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2));
+  // And since it was dismissed due to deactivation, the extension should not
+  // have been acknowledged.
+  EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2));
+
+  bubble.set_action_on_show(
+      FakeExtensionMessageBubble::BUBBLE_ACTION_DISMISS_DEACTIVATION);
+  controller.reset(new TestExtensionMessageBubbleController(
+      new NtpOverriddenBubbleDelegate(browser()->profile()), browser()));
+  // The bubble shouldn't show again for the same profile (we don't want to
+  // be annoying).
+  EXPECT_FALSE(controller->ShouldShow());
+  controller->ClearProfileListForTesting();
+  EXPECT_TRUE(controller->ShouldShow());
+  // Explicitly click the dismiss button. The extension should be acknowledged.
+  bubble.set_controller(controller.get());
+  bubble.set_action_on_show(
+      FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_DISMISS_BUTTON);
+  bubble.Show();
+  EXPECT_TRUE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2));
+
+  // Uninstall the current ntp-controlling extension, allowing the other to
+  // take control.
+  service_->UninstallExtension(kId2, UNINSTALL_REASON_FOR_TESTING,
+                               base::Bind(&base::DoNothing), nullptr);
+
+  // Even though we already showed for the given profile, we should show again,
+  // because it's a different extension.
+  controller.reset(new TestExtensionMessageBubbleController(
+      new NtpOverriddenBubbleDelegate(browser()->profile()), browser()));
+  EXPECT_TRUE(controller->ShouldShow());
+}
+
 // The feature this is meant to test is only enacted on Windows, but it should
 // pass on all platforms.
 TEST_F(ExtensionMessageBubbleTest, WipeoutControllerTest) {
@@ -343,7 +418,7 @@
       new TestExtensionMessageBubbleController(
           new SuspiciousExtensionBubbleDelegate(browser()->profile()),
           browser()));
-  SuspiciousExtensionBubbleDelegate::ClearProfileListForTesting();
+  controller->ClearProfileListForTesting();
   EXPECT_TRUE(controller->ShouldShow());
   suspicious_extensions = controller->GetExtensionList();
   ASSERT_EQ(1U, suspicious_extensions.size());
@@ -368,7 +443,7 @@
       new TestExtensionMessageBubbleController(
           new SuspiciousExtensionBubbleDelegate(browser()->profile()),
           browser()));
-  SuspiciousExtensionBubbleDelegate::ClearProfileListForTesting();
+  controller->ClearProfileListForTesting();
   EXPECT_TRUE(controller->ShouldShow());
   suspicious_extensions = controller->GetExtensionList();
   ASSERT_EQ(2U, suspicious_extensions.size());
@@ -430,7 +505,12 @@
       new TestExtensionMessageBubbleController(
           new DevModeBubbleDelegate(browser()->profile()),
           browser()));
-  DevModeBubbleDelegate::ClearProfileListForTesting();
+  // Most bubbles would want to show again as long as the extensions weren't
+  // acknowledged and the bubble wasn't dismissed due to deactivation. Since dev
+  // mode extensions can't be (persistently) acknowledged, this isn't the case
+  // for the dev mode bubble, and we should only show once per profile.
+  EXPECT_FALSE(controller->ShouldShow());
+  controller->ClearProfileListForTesting();
   EXPECT_TRUE(controller->ShouldShow());
   dev_mode_extensions = controller->GetExtensionList();
   EXPECT_EQ(2U, dev_mode_extensions.size());
@@ -453,7 +533,7 @@
       new TestExtensionMessageBubbleController(
           new DevModeBubbleDelegate(browser()->profile()),
           browser()));
-  DevModeBubbleDelegate::ClearProfileListForTesting();
+  controller->ClearProfileListForTesting();
   EXPECT_TRUE(controller->ShouldShow());
   dev_mode_extensions = controller->GetExtensionList();
   EXPECT_EQ(2U, dev_mode_extensions.size());
@@ -473,7 +553,7 @@
       new TestExtensionMessageBubbleController(
           new DevModeBubbleDelegate(browser()->profile()),
           browser()));
-  DevModeBubbleDelegate::ClearProfileListForTesting();
+  controller->ClearProfileListForTesting();
   EXPECT_FALSE(controller->ShouldShow());
   dev_mode_extensions = controller->GetExtensionList();
   EXPECT_EQ(0U, dev_mode_extensions.size());
diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc
index e203425..996e568 100644
--- a/chrome/browser/extensions/extension_messages_apitest.cc
+++ b/chrome/browser/extensions/extension_messages_apitest.cc
@@ -376,7 +376,7 @@
     EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
     embedded_test_server()->ServeFilesFromDirectory(test_data.AppendASCII(
         "extensions/api_test/messaging/externally_connectable/sites"));
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     host_resolver()->AddRule("*", embedded_test_server()->base_url().host());
   }
 
diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc
index 909c68f3..20b2793 100644
--- a/chrome/browser/extensions/extension_nacl_browsertest.cc
+++ b/chrome/browser/extensions/extension_nacl_browsertest.cc
@@ -22,6 +22,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "extensions/browser/extension_system.h"
 #include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::PluginService;
 using content::WebContents;
@@ -147,7 +148,7 @@
 // Test that the NaCl plugin isn't blocked for Webstore extensions.
 // Disabled: http://crbug.com/319892
 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_WebStoreExtension) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE);
   ASSERT_TRUE(extension);
@@ -157,7 +158,7 @@
 // Test that the NaCl plugin is blocked for non-Webstore extensions.
 // Disabled: http://crbug.com/319892
 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_NonWebStoreExtension) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = InstallExtension(INSTALL_TYPE_NON_WEBSTORE);
   ASSERT_TRUE(extension);
@@ -167,7 +168,7 @@
 // Test that the NaCl plugin isn't blocked for component extensions.
 // Disabled: http://crbug.com/319892
 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_ComponentExtension) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT);
   ASSERT_TRUE(extension);
@@ -178,7 +179,7 @@
 // Test that the NaCl plugin isn't blocked for unpacked extensions.
 // Disabled: http://crbug.com/319892
 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_UnpackedExtension) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED);
   ASSERT_TRUE(extension);
@@ -190,21 +191,22 @@
 // if it's a content (MIME type) handler.
 // Disabled: http://crbug.com/319892
 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, DISABLED_NonExtensionScheme) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = InstallExtension(INSTALL_TYPE_FROM_WEBSTORE);
   ASSERT_TRUE(extension);
   CheckPluginsCreated(
-      test_server()->GetURL("files/extensions/native_client/test.html"),
+      embedded_test_server()->GetURL("/extensions/native_client/test.html"),
       PLUGIN_TYPE_CONTENT_HANDLER);
 }
 
 // Test that NaCl plugin isn't blocked for hosted app URLs.
 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, HostedApp) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL url = test_server()->GetURL("files/extensions/native_client/test.html");
+  GURL url =
+      embedded_test_server()->GetURL("/extensions/native_client/test.html");
   GURL::Replacements replace_host;
   replace_host.SetHostStr("localhost");
   replace_host.ClearPort();
diff --git a/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc b/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
index cff9345..369abcc 100644
--- a/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
+++ b/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
@@ -104,7 +104,7 @@
     // Requests to 127.0.0.1 bypass throttling, so set up a host resolver rule
     // to use a fake domain.
     host_resolver()->AddRule("www.example.com", "127.0.0.1");
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     extension_ =
         LoadExtension(test_data_dir_.AppendASCII("extension_throttle"));
     ASSERT_TRUE(extension_);
diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc
index 2f2fbf8..651bf93 100644
--- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc
+++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc
@@ -13,6 +13,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "extensions/common/switches.h"
 #include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 class ExtensionResourceRequestPolicyTest : public ExtensionApiTest {
@@ -36,17 +37,16 @@
 #endif
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(LoadExtensionWithFlags(test_data_dir_
       .AppendASCII("extension_resource_request_policy")
       .AppendASCII("extension"),
       // Tests manifest_version 1 behavior, so warnings are expected.
       ExtensionBrowserTest::kFlagIgnoreManifestWarnings));
 
-  GURL web_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "index.html"));
+  GURL web_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "index.html"));
 
   GURL::Replacements make_host_a_com;
   make_host_a_com.SetHostStr("a.com");
@@ -65,10 +65,9 @@
   EXPECT_EQ(result, "Loaded");
 
   // A web host that loads a non-existent extension.
-  GURL non_existent_extension(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "non_existent_extension.html"));
+  GURL non_existent_extension(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "non_existent_extension.html"));
   ui_test_utils::NavigateToURL(browser(), non_existent_extension);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
       browser()->tab_strip_model()->GetActiveWebContents(),
@@ -154,15 +153,14 @@
 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
                        MAYBE_WebAccessibleResources) {
   std::string result;
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(LoadExtension(test_data_dir_
       .AppendASCII("extension_resource_request_policy")
       .AppendASCII("web_accessible")));
 
-  GURL accessible_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/accessible_resource.html"));
+  GURL accessible_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/accessible_resource.html"));
   ui_test_utils::NavigateToURL(browser(), accessible_resource);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
       browser()->tab_strip_model()->GetActiveWebContents(),
@@ -170,10 +168,9 @@
       &result));
   EXPECT_EQ("Loaded", result);
 
-  GURL xhr_accessible_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/xhr_accessible_resource.html"));
+  GURL xhr_accessible_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/xhr_accessible_resource.html"));
   ui_test_utils::NavigateToURL(
       browser(), xhr_accessible_resource);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
@@ -182,10 +179,9 @@
       &result));
   EXPECT_EQ("XHR completed with status: 200", result);
 
-  GURL xhr_inaccessible_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/xhr_inaccessible_resource.html"));
+  GURL xhr_inaccessible_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/xhr_inaccessible_resource.html"));
   ui_test_utils::NavigateToURL(
       browser(), xhr_inaccessible_resource);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
@@ -194,10 +190,9 @@
       &result));
   EXPECT_EQ("XHR failed to load resource", result);
 
-  GURL nonaccessible_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/nonaccessible_resource.html"));
+  GURL nonaccessible_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/nonaccessible_resource.html"));
   ui_test_utils::NavigateToURL(browser(), nonaccessible_resource);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
       browser()->tab_strip_model()->GetActiveWebContents(),
@@ -205,10 +200,9 @@
       &result));
   EXPECT_EQ("Image failed to load", result);
 
-  GURL nonexistent_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/nonexistent_resource.html"));
+  GURL nonexistent_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/nonexistent_resource.html"));
   ui_test_utils::NavigateToURL(browser(), nonexistent_resource);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
       browser()->tab_strip_model()->GetActiveWebContents(),
@@ -216,10 +210,9 @@
       &result));
   EXPECT_EQ("Image failed to load", result);
 
-  GURL nonaccessible_cer_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/nonaccessible_chrome_resource_scheme.html"));
+  GURL nonaccessible_cer_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/nonaccessible_chrome_resource_scheme.html"));
   ui_test_utils::NavigateToURL(browser(), nonaccessible_cer_resource);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
       browser()->tab_strip_model()->GetActiveWebContents(),
@@ -228,10 +221,9 @@
   EXPECT_EQ("Loading CER:// failed.", result);
 
   GURL newtab_page("chrome://newtab");
-  GURL accessible_newtab_override(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/accessible_history_navigation.html"));
+  GURL accessible_newtab_override(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/accessible_history_navigation.html"));
   ui_test_utils::NavigateToURL(browser(), newtab_page);
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(), accessible_newtab_override, 2);
@@ -245,15 +237,14 @@
 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
                        LinkToWebAccessibleResources) {
   std::string result;
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(LoadExtension(test_data_dir_
       .AppendASCII("extension_resource_request_policy")
       .AppendASCII("web_accessible")));
 
-  GURL accessible_linked_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/accessible_link_resource.html"));
+  GURL accessible_linked_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/accessible_link_resource.html"));
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
       accessible_linked_resource, 2);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
@@ -262,10 +253,9 @@
       &result));
   EXPECT_NE("about:blank", result);
 
-  GURL nonaccessible_linked_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/nonaccessible_link_resource.html"));
+  GURL nonaccessible_linked_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/nonaccessible_link_resource.html"));
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
       nonaccessible_linked_resource, 2);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
@@ -274,10 +264,9 @@
       &result));
   EXPECT_EQ("about:blank", result);
 
-  GURL accessible_client_redirect_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/accessible_redirect_resource.html"));
+  GURL accessible_client_redirect_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/accessible_redirect_resource.html"));
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
       accessible_client_redirect_resource, 2);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
@@ -286,10 +275,9 @@
       &result));
   EXPECT_NE("about:blank", result);
 
-  GURL nonaccessible_client_redirect_resource(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/nonaccessible_redirect_resource.html"));
+  GURL nonaccessible_client_redirect_resource(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/nonaccessible_redirect_resource.html"));
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
       nonaccessible_client_redirect_resource, 2);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
@@ -302,15 +290,14 @@
 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest,
                        WebAccessibleResourcesWithCSP) {
   std::string result;
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(LoadExtension(test_data_dir_
       .AppendASCII("extension_resource_request_policy")
       .AppendASCII("web_accessible")));
 
-  GURL accessible_resource_with_csp(
-      test_server()->GetURL(
-          "files/extensions/api_test/extension_resource_request_policy/"
-          "web_accessible/accessible_resource_with_csp.html"));
+  GURL accessible_resource_with_csp(embedded_test_server()->GetURL(
+      "/extensions/api_test/extension_resource_request_policy/"
+      "web_accessible/accessible_resource_with_csp.html"));
   ui_test_utils::NavigateToURL(browser(), accessible_resource_with_csp);
   ASSERT_TRUE(content::ExecuteScriptAndExtractString(
       browser()->tab_strip_model()->GetActiveWebContents(),
diff --git a/chrome/browser/extensions/external_provider_impl_unittest.cc b/chrome/browser/extensions/external_provider_impl_unittest.cc
index 43962c9f..a833f58 100644
--- a/chrome/browser/extensions/external_provider_impl_unittest.cc
+++ b/chrome/browser/extensions/external_provider_impl_unittest.cc
@@ -98,7 +98,7 @@
     ExtensionServiceTestBase::SetUp();
     test_server_.reset(new EmbeddedTestServer());
 
-    ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(test_server_->Start());
     test_server_->RegisterRequestHandler(
         base::Bind(&ExternalProviderImplTest::HandleRequest,
                    base::Unretained(this)));
diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc
index 9ff3f0d..255cda6 100644
--- a/chrome/browser/extensions/isolated_app_browsertest.cc
+++ b/chrome/browser/extensions/isolated_app_browsertest.cc
@@ -41,7 +41,7 @@
 }
 
 scoped_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest(
-    const net::test_server::EmbeddedTestServer* test_server,
+    const net::EmbeddedTestServer* test_server,
     const net::test_server::HttpRequest& request) {
   if (!base::StartsWith(request.relative_url, "/expect-and-set-cookie?",
                         base::CompareCase::SENSITIVE))
@@ -136,7 +136,7 @@
 
 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CrossProcessClientRedirect) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2")));
@@ -205,7 +205,7 @@
 #endif
 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_CookieIsolation) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2")));
@@ -300,7 +300,7 @@
 // Ensure that cookies are not isolated if the isolated apps are not installed.
 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
@@ -379,7 +379,7 @@
       base::Bind(&HandleExpectAndSetCookieRequest, embedded_test_server()));
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
 
@@ -451,7 +451,7 @@
 // where non-app popups may be kept in the hosted app process.
 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_IsolatedAppProcessModel) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
 
@@ -508,7 +508,7 @@
 // removed. http://crbug.com/159932
 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_SessionStorage) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2")));
diff --git a/chrome/browser/extensions/ntp_overridden_bubble_delegate.cc b/chrome/browser/extensions/ntp_overridden_bubble_delegate.cc
index f76ebdc8..c2baee0f 100644
--- a/chrome/browser/extensions/ntp_overridden_bubble_delegate.cc
+++ b/chrome/browser/extensions/ntp_overridden_bubble_delegate.cc
@@ -129,4 +129,8 @@
       ExtensionMessageBubbleController::ACTION_BOUNDARY);
 }
 
+const char* NtpOverriddenBubbleDelegate::GetKey() {
+  return "NtpOverriddenBubbleDelegate";
+}
+
 }  // namespace extensions
diff --git a/chrome/browser/extensions/ntp_overridden_bubble_delegate.h b/chrome/browser/extensions/ntp_overridden_bubble_delegate.h
index 80026ab..357d09ce 100644
--- a/chrome/browser/extensions/ntp_overridden_bubble_delegate.h
+++ b/chrome/browser/extensions/ntp_overridden_bubble_delegate.h
@@ -39,6 +39,7 @@
   bool ShouldLimitToEnabledExtensions() const override;
   void LogExtensionCount(size_t count) override;
   void LogAction(ExtensionMessageBubbleController::BubbleAction) override;
+  const char* GetKey() override;
 
  private:
   // The ID of the extension we are showing the bubble for.
diff --git a/chrome/browser/extensions/page_action_browsertest.cc b/chrome/browser/extensions/page_action_browsertest.cc
index c0cebeff..fe0b60b 100644
--- a/chrome/browser/extensions/page_action_browsertest.cc
+++ b/chrome/browser/extensions/page_action_browsertest.cc
@@ -15,23 +15,24 @@
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/switches.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 namespace extensions {
 namespace {
 
-const std::string kFeedPage = "files/feeds/feed.html";
-const std::string kNoFeedPage = "files/feeds/no_feed.html";
+const std::string kFeedPage = "/feeds/feed.html";
+const std::string kNoFeedPage = "/feeds/no_feed.html";
 const std::string kLocalization =
-    "files/extensions/browsertest/title_localized_pa/simple.html";
+    "/extensions/browsertest/title_localized_pa/simple.html";
 
 const std::string kHashPageA =
-    "files/extensions/api_test/page_action/hash_change/test_page_A.html";
+    "/extensions/api_test/page_action/hash_change/test_page_A.html";
 const std::string kHashPageAHash = kHashPageA + "#asdf";
 const std::string kHashPageB =
-    "files/extensions/api_test/page_action/hash_change/test_page_B.html";
+    "/extensions/api_test/page_action/hash_change/test_page_B.html";
 
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionCrash25562) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   base::CommandLine::ForCurrentProcess()->AppendSwitch(
       switches::kAllowLegacyExtensionManifests);
@@ -43,7 +44,7 @@
                     .AppendASCII("crash_25562")));
 
   // Navigate to the feed page.
-  GURL feed_url = test_server()->GetURL(kFeedPage);
+  GURL feed_url = embedded_test_server()->GetURL(kFeedPage);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   // We should now have one page action ready to go in the LocationBar.
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
@@ -51,7 +52,7 @@
 
 // Tests that we can load page actions in the Omnibox.
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action")));
@@ -59,13 +60,13 @@
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0));
 
   // Navigate to the feed page.
-  GURL feed_url = test_server()->GetURL(kFeedPage);
+  GURL feed_url = embedded_test_server()->GetURL(kFeedPage);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   // We should now have one page action ready to go in the LocationBar.
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
 
   // Navigate to a page with no feed.
-  GURL no_feed = test_server()->GetURL(kNoFeedPage);
+  GURL no_feed = embedded_test_server()->GetURL(kNoFeedPage);
   ui_test_utils::NavigateToURL(browser(), no_feed);
   // Make sure the page action goes away.
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0));
@@ -73,7 +74,7 @@
 
 // Tests that we don't lose the page action icon on in-page navigations.
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionInPageNavigation) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   base::FilePath extension_path(test_data_dir_.AppendASCII("api_test")
                                         .AppendASCII("page_action")
@@ -81,31 +82,31 @@
   ASSERT_TRUE(LoadExtension(extension_path));
 
   // Page action should become visible when we navigate here.
-  GURL feed_url = test_server()->GetURL(kHashPageA);
+  GURL feed_url = embedded_test_server()->GetURL(kHashPageA);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
 
   // In-page navigation, page action should remain.
-  feed_url = test_server()->GetURL(kHashPageAHash);
+  feed_url = embedded_test_server()->GetURL(kHashPageAHash);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
 
   // Not an in-page navigation, page action should go away.
-  feed_url = test_server()->GetURL(kHashPageB);
+  feed_url = embedded_test_server()->GetURL(kHashPageB);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0));
 }
 
 // Tests that the location bar forgets about unloaded page actions.
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   base::FilePath extension_path(
       test_data_dir_.AppendASCII("subscribe_page_action"));
   ASSERT_TRUE(LoadExtension(extension_path));
 
   // Navigation prompts the location bar to load page actions.
-  GURL feed_url = test_server()->GetURL(kFeedPage);
+  GURL feed_url = embedded_test_server()->GetURL(kFeedPage);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   content::WebContents* tab =
       browser()->tab_strip_model()->GetActiveWebContents();
@@ -175,7 +176,7 @@
 // Tests that tooltips of a page action icon can be specified using UTF8.
 // See http://crbug.com/25349.
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ExtensionRegistry* registry =
       extensions::ExtensionRegistry::Get(browser()->profile());
@@ -187,7 +188,7 @@
   ASSERT_TRUE(extension);
 
   // Any navigation prompts the location bar to load the page action.
-  GURL url = test_server()->GetURL(kLocalization);
+  GURL url = embedded_test_server()->GetURL(kLocalization);
   ui_test_utils::NavigateToURL(browser(), url);
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
 
diff --git a/chrome/browser/extensions/process_management_browsertest.cc b/chrome/browser/extensions/process_management_browsertest.cc
index 67ef9e8..46b49c9 100644
--- a/chrome/browser/extensions/process_management_browsertest.cc
+++ b/chrome/browser/extensions/process_management_browsertest.cc
@@ -54,7 +54,7 @@
   content::RenderProcessHost::SetMaxRendererProcessCount(1);
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2")));
@@ -192,7 +192,7 @@
   content::RenderProcessHost::SetMaxRendererProcessCount(6);
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc
index 980318c..3596cbc 100644
--- a/chrome/browser/extensions/process_manager_browsertest.cc
+++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -126,7 +126,7 @@
   ASSERT_TRUE(extension.get());
   const std::string& aliased_host = extension->id();
   host_resolver()->AddRule(aliased_host, "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url =
       embedded_test_server()->GetURL("/extensions/test_file_with_body.html");
   GURL::Replacements replace_host;
diff --git a/chrome/browser/extensions/proxy_overridden_bubble_delegate.cc b/chrome/browser/extensions/proxy_overridden_bubble_delegate.cc
index 59c7dd43..b2b3db5b 100644
--- a/chrome/browser/extensions/proxy_overridden_bubble_delegate.cc
+++ b/chrome/browser/extensions/proxy_overridden_bubble_delegate.cc
@@ -143,4 +143,8 @@
                             ExtensionMessageBubbleController::ACTION_BOUNDARY);
 }
 
+const char* ProxyOverriddenBubbleDelegate::GetKey() {
+  return "ProxyOverriddenBubbleDelegate";
+}
+
 }  // namespace extensions
diff --git a/chrome/browser/extensions/proxy_overridden_bubble_delegate.h b/chrome/browser/extensions/proxy_overridden_bubble_delegate.h
index cbd851d1..dedc843 100644
--- a/chrome/browser/extensions/proxy_overridden_bubble_delegate.h
+++ b/chrome/browser/extensions/proxy_overridden_bubble_delegate.h
@@ -40,6 +40,7 @@
   bool ShouldLimitToEnabledExtensions() const override;
   void LogExtensionCount(size_t count) override;
   void LogAction(ExtensionMessageBubbleController::BubbleAction) override;
+  const char* GetKey() override;
 
  private:
   // The ID of the extension we are showing the bubble for.
diff --git a/chrome/browser/extensions/settings_api_bubble_delegate.cc b/chrome/browser/extensions/settings_api_bubble_delegate.cc
index 2641883f..26ac3da 100644
--- a/chrome/browser/extensions/settings_api_bubble_delegate.cc
+++ b/chrome/browser/extensions/settings_api_bubble_delegate.cc
@@ -238,4 +238,17 @@
   }
 }
 
+const char* SettingsApiBubbleDelegate::GetKey() {
+  switch (type_) {
+    case BUBBLE_TYPE_HOME_PAGE:
+      return "SettingsApiBubbleDelegate.HomePage";
+    case BUBBLE_TYPE_STARTUP_PAGES:
+      return "SettingsApiBubbleDelegate.StartupPages";
+    case BUBBLE_TYPE_SEARCH_ENGINE:
+      return "SettingsApiBubbleDelegate.SearchEngine";
+  }
+  NOTREACHED();
+  return "";
+}
+
 }  // namespace extensions
diff --git a/chrome/browser/extensions/settings_api_bubble_delegate.h b/chrome/browser/extensions/settings_api_bubble_delegate.h
index dde081d3..aea8350 100644
--- a/chrome/browser/extensions/settings_api_bubble_delegate.h
+++ b/chrome/browser/extensions/settings_api_bubble_delegate.h
@@ -39,6 +39,7 @@
   bool ShouldLimitToEnabledExtensions() const override;
   void LogExtensionCount(size_t count) override;
   void LogAction(ExtensionMessageBubbleController::BubbleAction) override;
+  const char* GetKey() override;
 
  private:
   // The type of settings override this bubble will report on. This can be, for
diff --git a/chrome/browser/extensions/stubs_apitest.cc b/chrome/browser/extensions/stubs_apitest.cc
index 052a2db..4361260 100644
--- a/chrome/browser/extensions/stubs_apitest.cc
+++ b/chrome/browser/extensions/stubs_apitest.cc
@@ -18,7 +18,7 @@
 #define MAYBE_Stubs Stubs
 #endif
 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Stubs) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(RunExtensionTest("stubs")) << message_;
 
diff --git a/chrome/browser/extensions/subscribe_page_action_browsertest.cc b/chrome/browser/extensions/subscribe_page_action_browsertest.cc
index 1e9c7b62..c257c5c 100644
--- a/chrome/browser/extensions/subscribe_page_action_browsertest.cc
+++ b/chrome/browser/extensions/subscribe_page_action_browsertest.cc
@@ -11,6 +11,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "extensions/common/constants.h"
 #include "extensions/common/extension.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::WebContents;
 using extensions::Extension;
@@ -18,21 +19,21 @@
 namespace {
 
 const char kSubscribePage[] = "/subscribe.html";
-const char kFeedPageMultiRel[] = "files/feeds/feed_multi_rel.html";
-const char kValidFeedNoLinks[] = "files/feeds/feed_nolinks.xml";
-const char kValidFeed0[] = "files/feeds/feed_script.xml";
-const char kValidFeed1[] = "files/feeds/feed1.xml";
-const char kValidFeed2[] = "files/feeds/feed2.xml";
-const char kValidFeed3[] = "files/feeds/feed3.xml";
-const char kValidFeed4[] = "files/feeds/feed4.xml";
-const char kValidFeed5[] = "files/feeds/feed5.xml";
-const char kValidFeed6[] = "files/feeds/feed6.xml";
-const char kInvalidFeed1[] = "files/feeds/feed_invalid1.xml";
-const char kInvalidFeed2[] = "files/feeds/feed_invalid2.xml";
+const char kFeedPageMultiRel[] = "/feeds/feed_multi_rel.html";
+const char kValidFeedNoLinks[] = "/feeds/feed_nolinks.xml";
+const char kValidFeed0[] = "/feeds/feed_script.xml";
+const char kValidFeed1[] = "/feeds/feed1.xml";
+const char kValidFeed2[] = "/feeds/feed2.xml";
+const char kValidFeed3[] = "/feeds/feed3.xml";
+const char kValidFeed4[] = "/feeds/feed4.xml";
+const char kValidFeed5[] = "/feeds/feed5.xml";
+const char kValidFeed6[] = "/feeds/feed6.xml";
+const char kInvalidFeed1[] = "/feeds/feed_invalid1.xml";
+const char kInvalidFeed2[] = "/feeds/feed_invalid2.xml";
 // We need a triple encoded string to prove that we are not decoding twice in
 // subscribe.js because one layer is also stripped off when subscribe.js passes
 // it to the XMLHttpRequest object.
-const char kFeedTripleEncoded[] = "files/feeds/url%25255Fdecoding.html";
+const char kFeedTripleEncoded[] = "/feeds/url%25255Fdecoding.html";
 
 static const char kScriptFeedTitle[] =
     "window.domAutomationController.send("
@@ -59,8 +60,10 @@
     "    \"No error\""
     ");";
 
-GURL GetFeedUrl(net::SpawnedTestServer* server, const std::string& feed_page,
-                bool direct_url, std::string extension_id) {
+GURL GetFeedUrl(net::EmbeddedTestServer* server,
+                const std::string& feed_page,
+                bool direct_url,
+                std::string extension_id) {
   GURL feed_url = server->GetURL(feed_page);
   if (direct_url) {
     // We navigate directly to the subscribe page for feeds where the feed
@@ -94,7 +97,7 @@
 // extension to kick in, detect the feed and redirect to a feed preview page.
 // |sniff_xml_type| is generally set to true if the feed is sniffable and false
 // for invalid feeds.
-void NavigateToFeedAndValidate(net::SpawnedTestServer* server,
+void NavigateToFeedAndValidate(net::EmbeddedTestServer* server,
                                const std::string& url,
                                Browser* browser,
                                std::string extension_id,
@@ -126,7 +129,7 @@
 // Makes sure that the RSS detects RSS feed links, even when rel tag contains
 // more than just "alternate".
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(
     test_data_dir_.AppendASCII("subscribe_page_action")));
@@ -134,7 +137,7 @@
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0));
 
   // Navigate to the feed page.
-  GURL feed_url = test_server()->GetURL(kFeedPageMultiRel);
+  GURL feed_url = embedded_test_server()->GetURL(kFeedPageMultiRel);
   ui_test_utils::NavigateToURL(browser(), feed_url);
   // We should now have one page action ready to go in the LocationBar.
   ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
@@ -142,71 +145,64 @@
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed1) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
   ASSERT_TRUE(extension);
   std::string id = extension->id();
 
-  NavigateToFeedAndValidate(test_server(), kValidFeed1, browser(), id, true,
-                            "Feed for MyFeedTitle",
-                            "Title 1",
-                            "Desc",
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeed1, browser(), id,
+                            true, "Feed for MyFeedTitle", "Title 1", "Desc",
                             "No error");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed2) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
   ASSERT_TRUE(extension);
   std::string id = extension->id();
 
-  NavigateToFeedAndValidate(test_server(), kValidFeed2, browser(), id, true,
-                            "Feed for MyFeed2",
-                            "My item title1",
-                            "This is a summary.",
-                            "No error");
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeed2, browser(), id,
+                            true, "Feed for MyFeed2", "My item title1",
+                            "This is a summary.", "No error");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed3) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
   ASSERT_TRUE(extension);
   std::string id = extension->id();
 
-  NavigateToFeedAndValidate(test_server(), kValidFeed3, browser(), id, true,
-                            "Feed for Google Code buglist rss feed",
-                            "My dear title",
-                            "My dear content",
-                            "No error");
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeed3, browser(), id,
+                            true, "Feed for Google Code buglist rss feed",
+                            "My dear title", "My dear content", "No error");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed4) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
   ASSERT_TRUE(extension);
   std::string id = extension->id();
 
-  NavigateToFeedAndValidate(test_server(), kValidFeed4, browser(), id, true,
-                            "Feed for Title chars <script> %23 stop",
-                            "Title chars  %23 stop",
-                            "My dear content %23 stop",
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeed4, browser(), id,
+                            true, "Feed for Title chars <script> %23 stop",
+                            "Title chars  %23 stop", "My dear content %23 stop",
                             "No error");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed0) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -215,16 +211,14 @@
 
   // Try a feed with a link with an onclick handler (before r27440 this would
   // trigger a NOTREACHED).
-  NavigateToFeedAndValidate(test_server(), kValidFeed0, browser(), id, true,
-                            "Feed for MyFeedTitle",
-                            "Title 1",
-                            "Desc VIDEO",
-                            "No error");
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeed0, browser(), id,
+                            true, "Feed for MyFeedTitle", "Title 1",
+                            "Desc VIDEO", "No error");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed5) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -232,16 +226,15 @@
   std::string id = extension->id();
 
   // Feed with valid but mostly empty xml.
-  NavigateToFeedAndValidate(test_server(), kValidFeed5, browser(), id, true,
-                            "Feed for Unknown feed name",
-                            "element 'anchor_0' not found",
-                            "element 'desc_0' not found",
-                            "This feed contains no entries.");
+  NavigateToFeedAndValidate(
+      embedded_test_server(), kValidFeed5, browser(), id, true,
+      "Feed for Unknown feed name", "element 'anchor_0' not found",
+      "element 'desc_0' not found", "This feed contains no entries.");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed6) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -249,15 +242,13 @@
   std::string id = extension->id();
 
   // Feed that is technically invalid but still parseable.
-  NavigateToFeedAndValidate(test_server(), kValidFeed6, browser(), id, true,
-                            "Feed for MyFeedTitle",
-                            "Title 1",
-                            "Desc",
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeed6, browser(), id,
+                            true, "Feed for MyFeedTitle", "Title 1", "Desc",
                             "No error");
 }
 
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed1) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -265,15 +256,14 @@
   std::string id = extension->id();
 
   // Try an empty feed.
-  NavigateToFeedAndValidate(test_server(), kInvalidFeed1, browser(), id, false,
-                            "Feed for Unknown feed name",
-                            "element 'anchor_0' not found",
-                            "element 'desc_0' not found",
-                            "This feed contains no entries.");
+  NavigateToFeedAndValidate(
+      embedded_test_server(), kInvalidFeed1, browser(), id, false,
+      "Feed for Unknown feed name", "element 'anchor_0' not found",
+      "element 'desc_0' not found", "This feed contains no entries.");
 }
 
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed2) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -281,15 +271,14 @@
   std::string id = extension->id();
 
   // Try a garbage feed.
-  NavigateToFeedAndValidate(test_server(), kInvalidFeed2, browser(), id, false,
-                            "Feed for Unknown feed name",
-                            "element 'anchor_0' not found",
-                            "element 'desc_0' not found",
-                            "This feed contains no entries.");
+  NavigateToFeedAndValidate(
+      embedded_test_server(), kInvalidFeed2, browser(), id, false,
+      "Feed for Unknown feed name", "element 'anchor_0' not found",
+      "element 'desc_0' not found", "This feed contains no entries.");
 }
 
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed3) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -297,15 +286,14 @@
   std::string id = extension->id();
 
   // Try a feed that doesn't exist.
-  NavigateToFeedAndValidate(test_server(), "foo.xml", browser(), id, false,
-                            "Feed for Unknown feed name",
-                            "element 'anchor_0' not found",
-                            "element 'desc_0' not found",
-                            "This feed contains no entries.");
+  NavigateToFeedAndValidate(
+      embedded_test_server(), "/foo.xml", browser(), id, false,
+      "Feed for Unknown feed name", "element 'anchor_0' not found",
+      "element 'desc_0' not found", "This feed contains no entries.");
 }
 
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed4) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -320,17 +308,15 @@
   // we start erroneously double decoding again, the path (and the feed) will
   // become valid resulting in a failure for this test.
   NavigateToFeedAndValidate(
-      test_server(), kFeedTripleEncoded, browser(), id, true,
-      "Feed for Unknown feed name",
-      "element 'anchor_0' not found",
-      "element 'desc_0' not found",
-      "This feed contains no entries.");
+      embedded_test_server(), kFeedTripleEncoded, browser(), id, true,
+      "Feed for Unknown feed name", "element 'anchor_0' not found",
+      "element 'desc_0' not found", "This feed contains no entries.");
 }
 
 // This test is flaky on all platforms; see http://crbug.com/340354
 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest,
                        DISABLED_RSSParseFeedValidFeedNoLinks) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("subscribe_page_action"));
@@ -338,10 +324,7 @@
   std::string id = extension->id();
 
   // Valid feed but containing no links.
-  NavigateToFeedAndValidate(
-      test_server(), kValidFeedNoLinks, browser(), id, true,
-      "Feed for MyFeedTitle",
-      "Title with no link",
-      "Desc",
-      "No error");
+  NavigateToFeedAndValidate(embedded_test_server(), kValidFeedNoLinks,
+                            browser(), id, true, "Feed for MyFeedTitle",
+                            "Title with no link", "Desc", "No error");
 }
diff --git a/chrome/browser/extensions/suspicious_extension_bubble_delegate.cc b/chrome/browser/extensions/suspicious_extension_bubble_delegate.cc
index c4b95ed..33381d71d 100644
--- a/chrome/browser/extensions/suspicious_extension_bubble_delegate.cc
+++ b/chrome/browser/extensions/suspicious_extension_bubble_delegate.cc
@@ -26,9 +26,6 @@
 // Whether the user has been notified about extension being wiped out.
 const char kWipeoutAcknowledged[] = "ack_wiped";
 
-base::LazyInstance<std::set<Profile*> > g_shown_for_profiles =
-  LAZY_INSTANCE_INITIALIZER;
-
 }  // namespace
 
 namespace extensions {
@@ -132,13 +129,8 @@
       action, ExtensionMessageBubbleController::ACTION_BOUNDARY);
 }
 
-std::set<Profile*>* SuspiciousExtensionBubbleDelegate::GetProfileSet() {
-  return g_shown_for_profiles.Pointer();
-}
-
-// static
-void SuspiciousExtensionBubbleDelegate::ClearProfileListForTesting() {
-  g_shown_for_profiles.Get().clear();
+const char* SuspiciousExtensionBubbleDelegate::GetKey() {
+  return "SuspiciousExtensionBubbleDelegate";
 }
 
 }  // namespace extensions
diff --git a/chrome/browser/extensions/suspicious_extension_bubble_delegate.h b/chrome/browser/extensions/suspicious_extension_bubble_delegate.h
index 9ecad2668..0d1406e 100644
--- a/chrome/browser/extensions/suspicious_extension_bubble_delegate.h
+++ b/chrome/browser/extensions/suspicious_extension_bubble_delegate.h
@@ -38,11 +38,7 @@
   bool ShouldLimitToEnabledExtensions() const override;
   void LogExtensionCount(size_t count) override;
   void LogAction(ExtensionMessageBubbleController::BubbleAction) override;
-  std::set<Profile*>* GetProfileSet() override;
-
-  // Clears the list of profiles the bubble has been shown for. Should only be
-  // used during testing.
-  static void ClearProfileListForTesting();
+  const char* GetKey() override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleDelegate);
diff --git a/chrome/browser/extensions/wake_event_page_apitest.cc b/chrome/browser/extensions/wake_event_page_apitest.cc
index dbe5f665..8f95d81b 100644
--- a/chrome/browser/extensions/wake_event_page_apitest.cc
+++ b/chrome/browser/extensions/wake_event_page_apitest.cc
@@ -69,7 +69,7 @@
                BackgroundPageConfiguration bg_config,
                bool should_close,
                bool will_be_open) {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     GURL web_url = embedded_test_server()->GetURL("example.com", "/empty.html");
     host_resolver()->AddRule(web_url.host(), "127.0.0.1");
diff --git a/chrome/browser/extensions/webstore_installer_test.cc b/chrome/browser/extensions/webstore_installer_test.cc
index f5bb127..d2e0eaf8 100644
--- a/chrome/browser/extensions/webstore_installer_test.cc
+++ b/chrome/browser/extensions/webstore_installer_test.cc
@@ -27,6 +27,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "net/base/host_port_pair.h"
 #include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 using content::WebContents;
@@ -55,12 +56,12 @@
   ExtensionBrowserTest::SetUpCommandLine(command_line);
   // We start the test server now instead of in
   // SetUpInProcessBrowserTestFixture so that we can get its port number.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  net::HostPortPair host_port = test_server()->host_port_pair();
-  test_gallery_url_ = base::StringPrintf(
-      "http://%s:%d/files/%s",
-      webstore_domain_.c_str(), host_port.port(), test_data_path_.c_str());
+  net::HostPortPair host_port = embedded_test_server()->host_port_pair();
+  test_gallery_url_ =
+      base::StringPrintf("http://%s:%d/%s", webstore_domain_.c_str(),
+                         host_port.port(), test_data_path_.c_str());
   command_line->AppendSwitchASCII(
       switches::kAppsGalleryURL, test_gallery_url_);
 
@@ -90,10 +91,8 @@
 GURL WebstoreInstallerTest::GenerateTestServerUrl(
     const std::string& domain,
     const std::string& page_filename) {
-  GURL page_url = test_server()->GetURL(
-      base::StringPrintf("files/%s/%s",
-                         test_data_path_.c_str(),
-                         page_filename.c_str()));
+  GURL page_url = embedded_test_server()->GetURL(base::StringPrintf(
+      "/%s/%s", test_data_path_.c_str(), page_filename.c_str()));
 
   GURL::Replacements replace_host;
   replace_host.SetHostStr(domain);
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index f7c02393..28d5dac1 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -194,7 +194,7 @@
 
 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupBlockingHostedApp) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(LoadExtension(
       test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking")
@@ -207,14 +207,14 @@
   replace_host.SetHostStr("a.com");
 
   const std::string popup_app_contents_path(
-    "files/extensions/api_test/window_open/popup_blocking/hosted_app/");
+      "/extensions/api_test/window_open/popup_blocking/hosted_app/");
 
-  GURL open_tab =
-      test_server()->GetURL(popup_app_contents_path + "open_tab.html")
-          .ReplaceComponents(replace_host);
-  GURL open_popup =
-      test_server()->GetURL(popup_app_contents_path + "open_popup.html")
-          .ReplaceComponents(replace_host);
+  GURL open_tab = embedded_test_server()
+                      ->GetURL(popup_app_contents_path + "open_tab.html")
+                      .ReplaceComponents(replace_host);
+  GURL open_popup = embedded_test_server()
+                        ->GetURL(popup_app_contents_path + "open_popup.html")
+                        .ReplaceComponents(replace_host);
 
   browser()->OpenURL(OpenURLParams(
       open_tab, Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_TYPED,
diff --git a/chrome/browser/external_extension_browsertest.cc b/chrome/browser/external_extension_browsertest.cc
index 5a0022c8f..a9c2164 100644
--- a/chrome/browser/external_extension_browsertest.cc
+++ b/chrome/browser/external_extension_browsertest.cc
@@ -17,7 +17,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/url_constants.h"
 #include "content/public/test/browser_test_utils.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 namespace {
 
@@ -40,11 +40,11 @@
   SearchProviderTest() {}
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     // Map all hosts to our local server.
-    std::string host_rule(
-        "MAP * " + test_server()->host_port_pair().ToString());
+    std::string host_rule("MAP * " +
+                          embedded_test_server()->host_port_pair().ToString());
     command_line->AppendSwitchASCII(switches::kHostRules, host_rule);
     // Use no proxy or otherwise this test will fail on a machine that has a
     // proxy configured.
@@ -57,7 +57,7 @@
 
     // Get the url for the test page.
     search_provider_test_url_ =
-        test_server()->GetURL("files/is_search_provider_installed.html");
+        embedded_test_server()->GetURL("/is_search_provider_installed.html");
   }
 
   void SetUpOnMainThread() override {
@@ -153,8 +153,8 @@
                        TestIsSearchProviderInstalledWithException) {
   // Change the url for the test page to one that throws an exception when
   // toString is called on the argument given to isSearchProviderInstalled.
-  search_provider_test_url_ = test_server()->GetURL(
-      "files/is_search_provider_installed_with_exception.html");
+  search_provider_test_url_ = embedded_test_server()->GetURL(
+      "/is_search_provider_installed_with_exception.html");
 
   FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest(
       browser(), "www.google.com", ""));
diff --git a/chrome/browser/fast_shutdown_browsertest.cc b/chrome/browser/fast_shutdown_browsertest.cc
index 33481c37..3a73d30a 100644
--- a/chrome/browser/fast_shutdown_browsertest.cc
+++ b/chrome/browser/fast_shutdown_browsertest.cc
@@ -18,6 +18,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::BrowserThread;
 
@@ -41,9 +42,9 @@
 IN_PROC_BROWSER_TEST_F(FastShutdown, DISABLED_SlowTermination) {
   // Need to run these tests on http:// since we only allow cookies on that (and
   // https obviously).
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   // This page has an unload handler.
-  GURL url = test_server()->GetURL("files/fast_shutdown/on_unloader.html");
+  GURL url = embedded_test_server()->GetURL("/fast_shutdown/on_unloader.html");
   EXPECT_EQ("", content::GetCookies(browser()->profile(), url));
 
   content::WindowedNotificationObserver window_observer(
diff --git a/chrome/browser/favicon/content_favicon_driver_browsertest.cc b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
index 4ba0645e..9c9767b 100644
--- a/chrome/browser/favicon/content_favicon_driver_browsertest.cc
+++ b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
@@ -25,7 +25,7 @@
 #include "content/public/browser/resource_dispatcher_host.h"
 #include "content/public/browser/resource_dispatcher_host_delegate.h"
 #include "net/base/load_flags.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/url_request/url_request.h"
 #include "url/url_constants.h"
 
@@ -203,9 +203,9 @@
 // is redownloaded and (not returned from either the favicon cache or the HTTP
 // cache).
 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, ReloadIgnoringCache) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url = test_server()->GetURL("files/favicon/page_with_favicon.html");
-  GURL icon_url = test_server()->GetURL("files/favicon/icon.png");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url = embedded_test_server()->GetURL("/favicon/page_with_favicon.html");
+  GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png");
 
   scoped_ptr<TestResourceDispatcherHostDelegate> delegate(
       new TestResourceDispatcherHostDelegate(icon_url));
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc
index c8ff648..52b0ce5 100644
--- a/chrome/browser/geolocation/geolocation_browsertest.cc
+++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -294,8 +294,7 @@
 }
 
 void GeolocationBrowserTest::Initialize(InitializationOptions options) {
-  if (!embedded_test_server()->Started() &&
-      !embedded_test_server()->InitializeAndWaitUntilReady()) {
+  if (!embedded_test_server()->Started() && !embedded_test_server()->Start()) {
     ADD_FAILURE() << "Test server failed to start.";
     return;
   }
diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc
index ae6f988..e82e3b2e 100644
--- a/chrome/browser/history/history_browsertest.cc
+++ b/chrome/browser/history/history_browsertest.cc
@@ -26,7 +26,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_browser_thread.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 using content::BrowserThread;
@@ -67,10 +67,9 @@
 
 class HistoryBrowserTest : public InProcessBrowserTest {
  protected:
-  HistoryBrowserTest()
-      : test_server_(net::SpawnedTestServer::TYPE_HTTP,
-                     net::SpawnedTestServer::kLocalhost,
-                     base::FilePath(kDocRoot)) {}
+  HistoryBrowserTest() : test_server_() {
+    test_server_.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
+  }
 
   void SetUp() override {
     ASSERT_TRUE(test_server_.Start());
@@ -120,11 +119,11 @@
   }
 
   void LoadAndWaitForFile(const char* filename) {
-    GURL url = test_server_.GetURL(std::string("History") + filename);
+    GURL url = test_server_.GetURL(std::string("/History") + filename);
     LoadAndWaitForURL(url);
   }
 
-  net::SpawnedTestServer test_server_;
+  net::EmbeddedTestServer test_server_;
 };
 
 // Test that the browser history is saved (default setting).
diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc
index f51c18f4..56fb331 100644
--- a/chrome/browser/history/redirect_browsertest.cc
+++ b/chrome/browser/history/redirect_browsertest.cc
@@ -33,7 +33,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_navigation_observer.h"
 #include "net/base/filename_util.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/events/event_constants.h"
 
 class RedirectTest : public InProcessBrowserTest {
@@ -73,10 +73,10 @@
 
 // Tests a single server redirect
 IN_PROC_BROWSER_TEST_F(RedirectTest, Server) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL final_url = test_server()->GetURL(std::string());
-  GURL first_url = test_server()->GetURL(
-      "server-redirect?" + final_url.spec());
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL final_url = embedded_test_server()->GetURL("/defaultresponse");
+  GURL first_url =
+      embedded_test_server()->GetURL("/server-redirect?" + final_url.spec());
 
   ui_test_utils::NavigateToURL(browser(), first_url);
 
@@ -88,11 +88,11 @@
 
 // Tests a single client redirect.
 IN_PROC_BROWSER_TEST_F(RedirectTest, Client) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL final_url = test_server()->GetURL(std::string());
-  GURL first_url = test_server()->GetURL(
-      "client-redirect?" + final_url.spec());
+  GURL final_url = embedded_test_server()->GetURL("/defaultresponse");
+  GURL first_url =
+      embedded_test_server()->GetURL("/client-redirect?" + final_url.spec());
 
   // The client redirect appears as two page visits in the browser.
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
@@ -118,11 +118,11 @@
 
 // http://code.google.com/p/chromium/issues/detail?id=62772
 IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Create the file contents, which will do a redirect to the
   // test server.
-  GURL final_url = test_server()->GetURL(std::string());
+  GURL final_url = embedded_test_server()->GetURL("/defaultresponse");
   ASSERT_TRUE(final_url.is_valid());
   std::string file_redirect_contents = base::StringPrintf(
       "<html>"
@@ -184,15 +184,15 @@
 
 // Tests a client->server->server redirect
 IN_PROC_BROWSER_TEST_F(RedirectTest, ClientServerServer) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL final_url = test_server()->GetURL(std::string());
-  GURL next_to_last = test_server()->GetURL(
-      "server-redirect?" + final_url.spec());
-  GURL second_url = test_server()->GetURL(
-      "server-redirect?" + next_to_last.spec());
-  GURL first_url = test_server()->GetURL(
-      "client-redirect?" + second_url.spec());
+  GURL final_url = embedded_test_server()->GetURL("/defaultresponse");
+  GURL next_to_last =
+      embedded_test_server()->GetURL("/server-redirect?" + final_url.spec());
+  GURL second_url =
+      embedded_test_server()->GetURL("/server-redirect?" + next_to_last.spec());
+  GURL first_url =
+      embedded_test_server()->GetURL("/client-redirect?" + second_url.spec());
 
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(), first_url, 2);
@@ -206,13 +206,13 @@
 
 // Tests that the "#reference" gets preserved across server redirects.
 IN_PROC_BROWSER_TEST_F(RedirectTest, ServerReference) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const std::string ref("reference");
 
-  GURL final_url = test_server()->GetURL(std::string());
-  GURL initial_url = test_server()->GetURL(
-      "server-redirect?" + final_url.spec() + "#" + ref);
+  GURL final_url = embedded_test_server()->GetURL("/defaultresponse");
+  GURL initial_url = embedded_test_server()->GetURL(
+      "/server-redirect?" + final_url.spec() + "#" + ref);
 
   ui_test_utils::NavigateToURL(browser(), initial_url);
 
@@ -227,12 +227,12 @@
 //
 // Flaky on XP and Vista, http://crbug.com/69390.
 IN_PROC_BROWSER_TEST_F(RedirectTest, NoHttpToFile) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL file_url = ui_test_utils::GetTestUrl(
       base::FilePath(), base::FilePath().AppendASCII("http_to_file.html"));
 
-  GURL initial_url = test_server()->GetURL(
-      "client-redirect?" + file_url.spec());
+  GURL initial_url =
+      embedded_test_server()->GetURL("/client-redirect?" + file_url.spec());
 
   ui_test_utils::NavigateToURL(browser(), initial_url);
   // We make sure the title doesn't match the title from the file, because the
@@ -244,7 +244,7 @@
 // Ensures that non-user initiated location changes (within page) are
 // flagged as client redirects. See bug 1139823.
 IN_PROC_BROWSER_TEST_F(RedirectTest, ClientFragments) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL first_url = ui_test_utils::GetTestUrl(
       base::FilePath(), base::FilePath().AppendASCII("ref_redirect.html"));
   ui_test_utils::NavigateToURL(browser(), first_url);
@@ -255,7 +255,7 @@
 
 // TODO(timsteele): This is disabled because our current testserver can't
 // handle multiple requests in parallel, making it hang on the first request
-// to /slow?60. It's unable to serve our second request for files/title2.html
+// to /slow?60. It's unable to serve our second request for /title2.html
 // until /slow? completes, which doesn't give the desired behavior. We could
 // alternatively load the second page from disk, but we would need to start
 // the browser for this testcase with --process-per-tab, and I don't think
@@ -269,12 +269,12 @@
   // which causes it to start a provisional load, and while it is waiting
   // for the response (which means it hasn't committed the load for the client
   // redirect destination page yet), we issue a new navigation request.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL final_url = test_server()->GetURL("files/title2.html");
-  GURL slow = test_server()->GetURL("slow?60");
-  GURL first_url = test_server()->GetURL(
-      "client-redirect?" + slow.spec());
+  GURL final_url = embedded_test_server()->GetURL("/title2.html");
+  GURL slow = embedded_test_server()->GetURL("/slow?60");
+  GURL first_url =
+      embedded_test_server()->GetURL("/client-redirect?" + slow.spec());
 
   content::WebContents* web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
@@ -297,7 +297,7 @@
 
   bool final_navigation_not_redirect = true;
   std::vector<GURL> redirects = GetRedirects(first_url);
-  // Check to make sure our request for files/title2.html doesn't get flagged
+  // Check to make sure our request for /title2.html doesn't get flagged
   // as a client redirect from the first (/client-redirect?) page.
   for (std::vector<GURL>::iterator it = redirects.begin();
        it != redirects.end(); ++it) {
diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc
index c60acb84..12fd7b5c 100644
--- a/chrome/browser/infobars/infobars_browsertest.cc
+++ b/chrome/browser/infobars/infobars_browsertest.cc
@@ -60,7 +60,7 @@
     return;
 #endif
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/simple.html"));
diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
index 270b10df..52515c0 100644
--- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc
+++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
@@ -247,7 +247,7 @@
 };
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest, TestSingleTabShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/beforeunload.html")));
   RepeatedNotificationObserver cancel_observer(
@@ -269,7 +269,7 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestShutdownMoreThanOnce) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/beforeunload.html")));
   RepeatedNotificationObserver cancel_observer(
@@ -299,7 +299,7 @@
 #endif
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        MAYBE_PRE_TestSessionRestore) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/beforeunload.html")));
   AddBlankTabAndShow(browser());
@@ -353,7 +353,7 @@
 // Test that browser windows are only closed if all browsers are ready to close
 // and that all beforeunload dialogs are shown again after a cancel.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest, TestMultipleWindows) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
@@ -410,7 +410,7 @@
 #endif
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        MAYBE_TestHangInBeforeUnloadMultipleTabs) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload_hang.html")));
   AddBlankTabAndShow(browsers_[0]);
@@ -443,7 +443,7 @@
 // early.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestHangInBeforeUnloadMultipleWindows) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
@@ -476,7 +476,7 @@
 // Test that a window created during shutdown is closed.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestAddWindowDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
 
@@ -494,7 +494,7 @@
 // cancel the shutdown.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestAddWindowWithBeforeUnloadDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
 
@@ -526,7 +526,7 @@
 // Disabled for being flaky tests: crbug.com/519646
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        DISABLED_TestAddTabDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
@@ -550,7 +550,7 @@
 // Disabled for being flaky tests: crbug.com/519646
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        DISABLED_TestAddTabWithBeforeUnloadDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
@@ -588,7 +588,7 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestCloseTabDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   RepeatedNotificationObserver cancel_observer(
@@ -628,7 +628,7 @@
 #endif
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        MAYBE_TestOpenAndCloseWindowDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   RepeatedNotificationObserver cancel_observer(
@@ -660,7 +660,7 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestCloseWindowDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   browsers_.push_back(CreateBrowser(browser()->profile()));
@@ -730,7 +730,7 @@
 #if defined(OS_MACOSX)
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        TestWithDownloads) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
 
@@ -753,7 +753,7 @@
 // Test shutdown with a DANGEROUS_URL download undecided.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
     TestWithDangerousUrlDownload) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
 
   // Set up the fake delegate that forces the download to be malicious.
@@ -797,7 +797,7 @@
 // Test shutdown with a download in progress.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        TestWithDownloads) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
   content::TestNavigationObserver navigation_observer(
@@ -826,7 +826,7 @@
 // Test shutdown with a download in progress in an off-the-record profile.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        TestWithOffTheRecordDownloads) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   Profile* otr_profile = browser()->profile()->GetOffTheRecordProfile();
   SetDownloadPathForProfile(otr_profile);
   Browser* otr_browser = CreateBrowser(otr_profile);
@@ -871,7 +871,7 @@
   profile_manager->RegisterTestingProfile(other_profile, true, false);
   Browser* other_profile_browser = CreateBrowser(other_profile);
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   SetDownloadPathForProfile(other_profile);
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
@@ -914,7 +914,7 @@
 // Disabled, see http://crbug.com/315754.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        DISABLED_TestBeforeUnloadAndDownloads) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
diff --git a/chrome/browser/loadtimes_extension_bindings_browsertest.cc b/chrome/browser/loadtimes_extension_bindings_browsertest.cc
index 24ab846..1c55256 100644
--- a/chrome/browser/loadtimes_extension_bindings_browsertest.cc
+++ b/chrome/browser/loadtimes_extension_bindings_browsertest.cc
@@ -45,7 +45,7 @@
 
 IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest,
                        LoadTimesSameAfterClientInDocNavigation) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL plain_url = embedded_test_server()->GetURL("/simple.html");
   ui_test_utils::NavigateToURL(browser(), plain_url);
   content::WebContents* contents =
@@ -61,7 +61,7 @@
 
 IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest,
                        LoadTimesSameAfterUserInDocNavigation) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL plain_url = embedded_test_server()->GetURL("/simple.html");
   GURL hash_url(plain_url.spec() + "#");
   ui_test_utils::NavigateToURL(browser(), plain_url);
diff --git a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
index cd785b4..05f8033d 100644
--- a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
+++ b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
@@ -28,7 +28,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "media/base/media_switches.h"
 #include "net/dns/mock_host_resolver.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 // MediaStreamPermissionTest ---------------------------------------------------
 
@@ -56,14 +56,13 @@
 
   // Returns the URL of the main test page.
   GURL test_page_url() const {
-    const char kMainWebrtcTestHtmlPage[] =
-        "files/webrtc/webrtc_jsep01_test.html";
-    return test_server()->GetURL(kMainWebrtcTestHtmlPage);
+    const char kMainWebrtcTestHtmlPage[] = "/webrtc/webrtc_jsep01_test.html";
+    return embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage);
   }
 
  private:
   content::WebContents* LoadTestPageInBrowser(Browser* browser) {
-    EXPECT_TRUE(test_server()->Start());
+    EXPECT_TRUE(embedded_test_server()->Start());
 
     // Uses the default server.
     GURL url = test_page_url();
diff --git a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
index 8e77e216..758333d 100644
--- a/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc
@@ -281,8 +281,7 @@
 }
 
 #if defined(OS_LINUX)
-// TODO(phoglund): disabled due to https://crbug.com/545862.
-#define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInteropTest
+#define MAYBE_MANUAL_FirefoxApprtcInteropTest MANUAL_FirefoxApprtcInteropTest
 #else
 // Not implemented yet on Windows and Mac.
 #define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInteropTest
diff --git a/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc
index 749fe3f..286fa44 100644
--- a/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc
@@ -622,7 +622,7 @@
     const base::FilePath& recording,
     const std::string& constraints,
     const base::TimeDelta recording_time) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(test::HasReferenceFilesInCheckout());
   ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent());
 
@@ -685,7 +685,7 @@
     return;
   }
   ASSERT_TRUE(test::HasReferenceFilesInCheckout());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent());
 
diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc
index ccd1de75..035d337 100644
--- a/chrome/browser/media/chrome_webrtc_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_browsertest.cc
@@ -45,7 +45,7 @@
                        RunsAudioVideoWebRTCCallInTwoTabs) {
   if (OnWinXp()) return;
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::WebContents* left_tab =
       OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
@@ -75,7 +75,7 @@
   // integration.
   if (OnWinXp()) return;
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html"));
   ui_test_utils::NavigateToURL(browser(), url);
   content::WebContents* tab =
diff --git a/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc b/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc
index eb22e9a..1f514ee 100644
--- a/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_disable_encryption_flag_browsertest.cc
@@ -52,7 +52,7 @@
   if (!OnWinXp())
     return;  // Flaky timeout on a webrtc Win XP bot. http://crbug.com/368163.
 
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::WebContents* left_tab =
       OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
diff --git a/chrome/browser/media/chrome_webrtc_getmediadevices_browsertest.cc b/chrome/browser/media/chrome_webrtc_getmediadevices_browsertest.cc
index 8753b37..be8d639 100644
--- a/chrome/browser/media/chrome_webrtc_getmediadevices_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_getmediadevices_browsertest.cc
@@ -184,7 +184,7 @@
 // MediaDevices.enumerateDevices. http://crbug.com/388648.
 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest,
                        DISABLED_GetMediaDevicesWithoutAccess) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage));
   ui_test_utils::NavigateToURL(browser(), url);
   content::WebContents* tab =
@@ -205,7 +205,7 @@
 // Disabled, fails due to http://crbug.com/382391.
 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest,
                        DISABLED_GetMediaDevicesWithAccess) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage));
   ui_test_utils::NavigateToURL(browser(), url);
   content::WebContents* tab =
@@ -227,7 +227,7 @@
 // MediaDevices.enumerateDevices. http://crbug.com/388648.
 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest,
                        DISABLED_GetMediaDevicesEqualsGetSourcesWithoutAccess) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage));
   ui_test_utils::NavigateToURL(browser(), url);
   content::WebContents* tab =
@@ -262,7 +262,7 @@
 // Disabled, fails due to http://crbug.com/382391.
 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest,
                        DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage));
   ui_test_utils::NavigateToURL(browser(), url);
   content::WebContents* tab =
diff --git a/chrome/browser/media/chrome_webrtc_perf_browsertest.cc b/chrome/browser/media/chrome_webrtc_perf_browsertest.cc
index 8d17b53..0e02d08 100644
--- a/chrome/browser/media/chrome_webrtc_perf_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_perf_browsertest.cc
@@ -109,7 +109,7 @@
   if (OnWinXp()) return;
 
   ASSERT_TRUE(test::HasReferenceFilesInCheckout());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) <<
       "This is a long-running test; you must specify "
@@ -154,7 +154,7 @@
   if (OnWinXp()) return;
 
   ASSERT_TRUE(test::HasReferenceFilesInCheckout());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) <<
       "This is a long-running test; you must specify "
diff --git a/chrome/browser/media/chrome_webrtc_simulcast_browsertest.cc b/chrome/browser/media/chrome_webrtc_simulcast_browsertest.cc
index 18931f8..fea1b253 100644
--- a/chrome/browser/media/chrome_webrtc_simulcast_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_simulcast_browsertest.cc
@@ -51,7 +51,7 @@
 #endif
 IN_PROC_BROWSER_TEST_F(WebRtcSimulcastBrowserTest,
                        MAYBE_TestVgaReturnsTwoSimulcastStreams) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL(kSimulcastTestPage));
diff --git a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc
index 38b64de1..d8ac11e 100644
--- a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc
@@ -306,7 +306,7 @@
       "This is a long-running test; you must specify "
       "--ui-test-action-max-timeout to have a value of at least 150000.";
   ASSERT_TRUE(test::HasReferenceFilesInCheckout());
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::WebContents* left_tab =
       OpenPageAndGetUserMediaInNewTabWithConstraints(
diff --git a/chrome/browser/media/chrome_webrtc_webcam_browsertest.cc b/chrome/browser/media/chrome_webrtc_webcam_browsertest.cc
index a684c14..fc36cf8 100644
--- a/chrome/browser/media/chrome_webrtc_webcam_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_webcam_browsertest.cc
@@ -82,7 +82,7 @@
 // which webcam or drivers you have on the system.
 IN_PROC_BROWSER_TEST_P(WebRtcWebcamBrowserTest,
                        MANUAL_TestAcquiringAndReacquiringWebcam) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage));
   ui_test_utils::NavigateToURL(browser(), url);
   content::WebContents* tab =
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
index 14bb9a6..9a577d10 100644
--- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -20,7 +20,7 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
 #include "media/base/test_data_util.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR.
@@ -163,13 +163,11 @@
 
     // Load the test page needed so that checkKeySystemWithMediaMimeType()
     // is available.
-    scoped_ptr<net::SpawnedTestServer> http_test_server(
-        new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP,
-                                   net::SpawnedTestServer::kLocalhost,
-                                   media::GetTestDataPath()));
+    scoped_ptr<net::EmbeddedTestServer> http_test_server(
+        new net::EmbeddedTestServer);
+    http_test_server->ServeFilesFromSourceDirectory(media::GetTestDataPath());
     CHECK(http_test_server->Start());
-    GURL gurl =
-        http_test_server->GetURL("files/test_key_system_instantiation.html");
+    GURL gurl = http_test_server->GetURL("/test_key_system_instantiation.html");
     ui_test_utils::NavigateToURL(browser(), gurl);
   }
 
diff --git a/chrome/browser/media/media_browsertest.cc b/chrome/browser/media/media_browsertest.cc
index 53056ad..6aa919e 100644
--- a/chrome/browser/media/media_browsertest.cc
+++ b/chrome/browser/media/media_browsertest.cc
@@ -15,7 +15,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
 #include "media/base/test_data_util.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 // Common test results.
 const char MediaBrowserTest::kEnded[] = "ENDED";
@@ -34,16 +34,14 @@
                                         bool http) {
   GURL gurl;
   std::string query = media::GetURLQueryString(query_params);
-  scoped_ptr<net::SpawnedTestServer> http_test_server;
+  scoped_ptr<net::EmbeddedTestServer> http_test_server;
   if (http) {
     DVLOG(0) << base::TimeFormatTimeOfDayWithMilliseconds(base::Time::Now())
              << " Starting HTTP server";
-    http_test_server.reset(
-        new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP,
-                                   net::SpawnedTestServer::kLocalhost,
-                                   media::GetTestDataPath()));
+    http_test_server.reset(new net::EmbeddedTestServer);
+    http_test_server->ServeFilesFromSourceDirectory(media::GetTestDataPath());
     CHECK(http_test_server->Start());
-    gurl = http_test_server->GetURL("files/" + html_page + "?" + query);
+    gurl = http_test_server->GetURL("/" + html_page + "?" + query);
   } else {
     gurl = content::GetFileUrlWithQuery(media::GetTestDataFilePath(html_page),
                                         query);
@@ -84,4 +82,3 @@
 void MediaBrowserTest::IgnorePluginCrash() {
   ignore_plugin_crash_ = true;
 }
-
diff --git a/chrome/browser/media/media_browsertest.h b/chrome/browser/media/media_browsertest.h
index 5d3f2222..1ad9c6cc 100644
--- a/chrome/browser/media/media_browsertest.h
+++ b/chrome/browser/media/media_browsertest.h
@@ -16,8 +16,8 @@
 }
 
 // Class used to automate running media related browser tests. The functions
-// assume that media files are located under files/media/ folder known to
-// the test http server.
+// assume that media files are located under media/ folder known to the test
+// http server.
 class MediaBrowserTest : public InProcessBrowserTest,
                          public content::WebContentsObserver {
  protected:
diff --git a/chrome/browser/media/media_permission.cc b/chrome/browser/media/media_permission.cc
index b2a53a0..4ba86813 100644
--- a/chrome/browser/media/media_permission.cc
+++ b/chrome/browser/media/media_permission.cc
@@ -50,8 +50,29 @@
     return CONTENT_SETTING_BLOCK;
   }
 
+  // Use the Permission Context to find out if the kill switch is on. Set the
+  // denial reason to kill switch.
+  content::PermissionType permission_type =
+      ContentSettingsTypeToPermission(content_type_);
+  PermissionContextBase* permission_context =
+      PermissionContext::Get(profile_, permission_type);
+
+  if (!permission_context) {
+    *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED;
+    return CONTENT_SETTING_BLOCK;
+  }
+
+  MediaStreamDevicePermissionContext* media_device_permission_context =
+      static_cast<MediaStreamDevicePermissionContext*>(permission_context);
+
+  if (media_device_permission_context->IsPermissionKillSwitchOn()) {
+    *denial_reason = content::MEDIA_DEVICE_KILL_SWITCH_ON;
+    return CONTENT_SETTING_BLOCK;
+  }
+
   // Check policy and content settings.
-  ContentSetting result = GetStoredContentSetting();
+  ContentSetting result =
+      GetStoredContentSetting(media_device_permission_context);
   if (result == CONTENT_SETTING_BLOCK)
     *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED;
 
@@ -71,18 +92,8 @@
   return GetPermissionStatus(denial_reason);
 }
 
-ContentSetting MediaPermission::GetStoredContentSetting() const {
-  content::PermissionType permission_type =
-      ContentSettingsTypeToPermission(content_type_);
-  PermissionContextBase* permission_context =
-      PermissionContext::Get(profile_, permission_type);
-
-  if (!permission_context)
-    return CONTENT_SETTING_BLOCK;
-
-  MediaStreamDevicePermissionContext* media_device_permission_context =
-      static_cast<MediaStreamDevicePermissionContext*>(permission_context);
-
+ContentSetting MediaPermission::GetStoredContentSetting(
+    MediaStreamDevicePermissionContext* media_device_permission_context) const {
   if (is_insecure_pepper_request_) {
     return media_device_permission_context
         ->GetPermissionStatusAllowingInsecureForPepper(requesting_origin_,
diff --git a/chrome/browser/media/media_permission.h b/chrome/browser/media/media_permission.h
index 20157a5d..fcdcfa1f 100644
--- a/chrome/browser/media/media_permission.h
+++ b/chrome/browser/media/media_permission.h
@@ -12,6 +12,7 @@
 #include "content/public/common/media_stream_request.h"
 #include "url/gurl.h"
 
+class MediaStreamDevicePermissionContext;
 class Profile;
 
 // Represents a permission for microphone/camera access.
@@ -38,7 +39,9 @@
       content::MediaStreamRequestResult* denial_reason) const;
 
  private:
-  ContentSetting GetStoredContentSetting() const;
+  ContentSetting GetStoredContentSetting(
+      MediaStreamDevicePermissionContext* media_device_permission_context)
+      const;
   bool HasAvailableDevices(const std::string& device_id) const;
 
   const ContentSettingsType content_type_;
diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc
index 7ef1064..c01e52e 100644
--- a/chrome/browser/media/media_stream_devices_controller.cc
+++ b/chrome/browser/media/media_stream_devices_controller.cc
@@ -423,7 +423,10 @@
     content::MediaStreamRequestResult denial_reason) {
   CHECK(!callback_.is_null());
 
-  if (persist_permission_changes_) {
+  // If the kill switch is on we don't update the tab context or persist the
+  // setting.
+  if (persist_permission_changes_ &&
+      denial_reason != content::MEDIA_DEVICE_KILL_SWITCH_ON) {
     StorePermission(audio_setting, video_setting);
     UpdateTabSpecificContentSettings(audio_setting, video_setting);
   }
diff --git a/chrome/browser/media/media_stream_devices_controller_browsertest.cc b/chrome/browser/media/media_stream_devices_controller_browsertest.cc
index 75b9dc6..05dee3692 100644
--- a/chrome/browser/media/media_stream_devices_controller_browsertest.cc
+++ b/chrome/browser/media/media_stream_devices_controller_browsertest.cc
@@ -5,6 +5,7 @@
 #include <string>
 
 #include "base/bind.h"
+#include "base/metrics/field_trial.h"
 #include "base/prefs/pref_service.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
@@ -13,13 +14,17 @@
 #include "chrome/browser/media/media_stream_device_permissions.h"
 #include "chrome/browser/media/media_stream_devices_controller.h"
 #include "chrome/browser/media/webrtc_browsertest_base.h"
+#include "chrome/browser/permissions/permission_context_base.h"
+#include "chrome/browser/permissions/permission_util.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/variations/variations_associated_data.h"
 #include "content/public/common/media_stream_request.h"
+#include "content/public/test/mock_render_process_host.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
@@ -714,3 +719,33 @@
   ASSERT_TRUE(controller.IsAskingForAudio());
   ASSERT_TRUE(controller.IsAskingForVideo());
 }
+
+// Request and block microphone and camera access with kill switch.
+IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
+                       RequestAndKillSwitchMicCam) {
+  std::map<std::string, std::string> params;
+  params[PermissionUtil::GetPermissionString(
+      CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)] =
+      PermissionContextBase::kPermissionsKillSwitchBlockedValue;
+  params[PermissionUtil::GetPermissionString(
+      CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)] =
+      PermissionContextBase::kPermissionsKillSwitchBlockedValue;
+  variations::AssociateVariationParams(
+      PermissionContextBase::kPermissionsKillSwitchFieldStudy,
+      "TestGroup", params);
+  base::FieldTrialList::CreateFieldTrial(
+      PermissionContextBase::kPermissionsKillSwitchFieldStudy,
+      "TestGroup");
+  InitWithUrl(GURL("https://www.example.com"));
+  SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED);
+  SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED);
+  MediaStreamDevicesController controller(
+      GetWebContents(), CreateRequest(example_audio_id(), example_video_id()),
+      base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse,
+                 this));
+
+  EXPECT_FALSE(controller.IsAllowedForAudio());
+  EXPECT_FALSE(controller.IsAllowedForVideo());
+  EXPECT_FALSE(controller.IsAskingForAudio());
+  EXPECT_FALSE(controller.IsAskingForVideo());
+}
diff --git a/chrome/browser/metrics/variations/chrome_variations_service_client.cc b/chrome/browser/metrics/variations/chrome_variations_service_client.cc
index 3ddbb141..ed7ceff 100644
--- a/chrome/browser/metrics/variations/chrome_variations_service_client.cc
+++ b/chrome/browser/metrics/variations/chrome_variations_service_client.cc
@@ -18,10 +18,6 @@
 #include "chrome/browser/chromeos/settings/cros_settings.h"
 #endif
 
-#if defined(OS_ANDROID)
-#include "components/variations/android/variations_seed_bridge.h"
-#endif  // OS_ANDROID
-
 namespace {
 
 // Gets the version number to use for variations seed simulation. Must be called
@@ -83,15 +79,6 @@
 #endif
 }
 
-variations::VariationsFirstRunSeedCallback
-ChromeVariationsServiceClient::GetVariationsFirstRunSeedCallback() {
-#if defined(OS_ANDROID)
-  return base::Bind(&variations::android::GetVariationsFirstRunSeed);
-#else   // OS_ANDROID
-  return variations::VariationsFirstRunSeedCallback();
-#endif  // OS_ANDROID
-}
-
 void ChromeVariationsServiceClient::OnInitialStartup() {
 #if defined(OS_WIN)
   StartGoogleUpdateRegistrySync();
diff --git a/chrome/browser/metrics/variations/chrome_variations_service_client.h b/chrome/browser/metrics/variations/chrome_variations_service_client.h
index d38b170..2b84c84 100644
--- a/chrome/browser/metrics/variations/chrome_variations_service_client.h
+++ b/chrome/browser/metrics/variations/chrome_variations_service_client.h
@@ -8,9 +8,7 @@
 #include <string>
 
 #include "base/basictypes.h"
-#include "base/bind.h"
 #include "components/variations/service/variations_service_client.h"
-#include "components/variations/variations_seed_store.h"
 
 #if defined(OS_WIN)
 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h"
@@ -34,8 +32,6 @@
   version_info::Channel GetChannel() override;
   bool OverridesRestrictParameter(std::string* parameter) override;
   void OnInitialStartup() override;
-  variations::VariationsFirstRunSeedCallback GetVariationsFirstRunSeedCallback()
-      override;
 
  private:
 #if defined(OS_WIN)
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
index a0eabf4..eccbfad0 100644
--- a/chrome/browser/notifications/notification_browsertest.cc
+++ b/chrome/browser/notifications/notification_browsertest.cc
@@ -392,7 +392,7 @@
 
 // Flaky on Windows, Mac, Linux: http://crbug.com/437414.
 IN_PROC_BROWSER_TEST_F(NotificationsTest, DISABLED_TestUserGestureInfobar) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(
       browser(),
@@ -413,7 +413,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Creates a simple notification.
   AllowAllOrigins();
@@ -451,7 +451,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCloseNotification) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Creates a notification and closes it.
   AllowAllOrigins();
@@ -471,7 +471,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCancelNotification) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Creates a notification and cancels it in the origin page.
   AllowAllOrigins();
@@ -487,7 +487,7 @@
 
 // Requests notification privileges and verifies the prompt appears.
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestPermissionRequestUIAppears) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
   EXPECT_TRUE(RequestPermissionAndWait(browser()));
@@ -495,7 +495,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowOnPermissionRequestUI) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Tries to create a notification & clicks 'allow' on the prompt.
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -510,7 +510,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyOnPermissionRequestUI) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test that no notification is created when Deny is chosen from prompt.
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -523,7 +523,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestClosePermissionRequestUI) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test that no notification is created when prompt is dismissed.
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -536,7 +536,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowNotificationsFromAllSites) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify that all domains can be allowed to show notifications.
   SetDefaultContentSetting(CONTENT_SETTING_ALLOW);
@@ -549,7 +549,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyNotificationsFromAllSites) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify that no domain can show notifications.
   SetDefaultContentSetting(CONTENT_SETTING_BLOCK);
@@ -562,7 +562,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyDomainAndAllowAll) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify that denying a domain and allowing all shouldn't show
   // notifications from the denied domain.
@@ -578,7 +578,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowDomainAndDenyAll) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify that allowing a domain and denying all others should show
   // notifications from the allowed domain.
@@ -594,7 +594,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyAndThenAllowDomain) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify that denying and again allowing should show notifications.
   DenyOrigin(GetTestPageURL().GetOrigin());
@@ -614,7 +614,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateDenyCloseNotifications) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify able to create, deny, and close the notification.
   AllowAllOrigins();
@@ -640,7 +640,7 @@
 IN_PROC_BROWSER_TEST_F(
     NotificationsTest,
     DISABLED_TestOriginPrefsNotSavedInIncognito) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Verify that allow/deny origin preferences are not saved in incognito.
   Browser* incognito = CreateIncognitoBrowser();
@@ -667,7 +667,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestIncognitoNotification) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test notifications in incognito window.
   Browser* browser = CreateIncognitoBrowser();
@@ -679,7 +679,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCloseTabWithPermissionRequestUI) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test that user can close tab when bubble present.
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -702,7 +702,7 @@
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest,
                        MAYBE_TestCrashRendererNotificationRemain) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test crashing renderer does not close or crash notification.
   AllowAllOrigins();
@@ -720,7 +720,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationReplacement) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test that we can replace a notification using the replaceId.
   AllowAllOrigins();
@@ -746,7 +746,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestLastUsage) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   HostContentSettingsMap* settings_map =
       HostContentSettingsMapFactory::GetForProfile(browser()->profile());
@@ -781,7 +781,7 @@
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest,
                        TestNotificationReplacementReappearance) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Test that we can replace a notification using the tag, and that it will
   // cause the notification to reappear as a popup again.
@@ -816,7 +816,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationValidIcon) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   AllowAllOrigins();
 
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -837,7 +837,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationInvalidIcon) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   AllowAllOrigins();
 
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
@@ -868,7 +868,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNotificationDoubleClose) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   AllowAllOrigins();
 
   ui_test_utils::NavigateToURL(
diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc
index 70b27a2..af386a88 100644
--- a/chrome/browser/notifications/platform_notification_service_browsertest.cc
+++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc
@@ -24,7 +24,7 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/test/browser_test_utils.h"
 #include "net/base/filename_util.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "ui/base/l10n/l10n_util.h"
 
@@ -85,7 +85,7 @@
   const base::FilePath server_root_;
   const std::string test_page_url_;
   scoped_ptr<StubNotificationUIManager> ui_manager_;
-  scoped_ptr<net::SpawnedTestServer> https_server_;
+  scoped_ptr<net::EmbeddedTestServer> https_server_;
 };
 
 // -----------------------------------------------------------------------------
@@ -98,15 +98,13 @@
     : server_root_(FILE_PATH_LITERAL("chrome/test/data")),
       // The test server has a base directory that doesn't exist in the
       // filesystem.
-      test_page_url_(std::string("files/") + kTestFileName) {
-}
+      test_page_url_(std::string("/") + kTestFileName) {}
 
 void PlatformNotificationServiceBrowserTest::SetUp() {
   ui_manager_.reset(new StubNotificationUIManager);
-  https_server_.reset(new net::SpawnedTestServer(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::BaseTestServer::SSLOptions(net::BaseTestServer::SSLOptions::CERT_OK),
-      server_root_));
+  https_server_.reset(
+      new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
+  https_server_->ServeFilesFromSourceDirectory(server_root_);
   ASSERT_TRUE(https_server_->Start());
 
   service()->SetNotificationUIManagerForTesting(ui_manager_.get());
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
index f08ac73..2af8a6a 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -33,6 +33,7 @@
 #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
 #include "components/password_manager/content/common/credential_manager_messages.h"
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/log_receiver.h"
 #include "components/password_manager/core/browser/password_form_manager.h"
 #include "components/password_manager/core/browser/password_manager_internals_service.h"
@@ -64,7 +65,6 @@
 
 using password_manager::ContentPasswordManagerDriverFactory;
 using password_manager::PasswordManagerInternalsService;
-using password_manager::PasswordManagerInternalsServiceFactory;
 
 // Shorten the name to spare line breaks. The code provides enough context
 // already.
@@ -136,7 +136,6 @@
       driver_factory_(nullptr),
       credential_manager_dispatcher_(web_contents, this),
       observer_(nullptr),
-      can_use_log_router_(false),
       credentials_filter_(this,
                           base::Bind(&GetSyncService, profile_),
                           base::Bind(&GetSigninManager, profile_)) {
@@ -144,22 +143,20 @@
                                                             autofill_client);
   driver_factory_ =
       ContentPasswordManagerDriverFactory::FromWebContents(web_contents);
+  log_manager_ = password_manager::LogManager::Create(
+      password_manager::PasswordManagerInternalsServiceFactory::
+          GetForBrowserContext(profile_),
+      base::Bind(
+          &ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability,
+          base::Unretained(driver_factory_)));
 
-  PasswordManagerInternalsService* service =
-      PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_);
-  if (service)
-    can_use_log_router_ = service->RegisterClient(this);
   saving_and_filling_passwords_enabled_.Init(
       password_manager::prefs::kPasswordManagerSavingEnabled, GetPrefs());
   ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_);
+  driver_factory_->RequestSendLoggingAvailability();
 }
 
-ChromePasswordManagerClient::~ChromePasswordManagerClient() {
-  PasswordManagerInternalsService* service =
-      PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_);
-  if (service)
-    service->UnregisterClient(this);
-}
+ChromePasswordManagerClient::~ChromePasswordManagerClient() {}
 
 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const {
   return base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -184,8 +181,9 @@
     // this is effectively their master password.
     is_enabled = entry->GetURL().host() != chrome::kChromeUIChromeSigninHost;
   }
-  if (IsLoggingActive()) {
-    password_manager::BrowserSavePasswordProgressLogger logger(this);
+  if (log_manager_->IsLoggingActive()) {
+    password_manager::BrowserSavePasswordProgressLogger logger(
+        log_manager_.get());
     logger.LogBoolean(
         Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE,
         is_enabled);
@@ -322,37 +320,13 @@
   return password_manager_util::GetPasswordSyncState(sync_service);
 }
 
-void ChromePasswordManagerClient::OnLogRouterAvailabilityChanged(
-    bool router_can_be_used) {
-  if (can_use_log_router_ == router_can_be_used)
-    return;
-  can_use_log_router_ = router_can_be_used;
-
-  NotifyRendererOfLoggingAvailability();
-}
-
-void ChromePasswordManagerClient::LogSavePasswordProgress(
-    const std::string& text) const {
-  if (!IsLoggingActive())
-    return;
-  PasswordManagerInternalsService* service =
-      PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_);
-  if (service)
-    service->ProcessLog(text);
-}
-
-bool ChromePasswordManagerClient::IsLoggingActive() const {
-  // WebUI tabs do not need to log password saving progress. In particular, the
-  // internals page itself should not send any logs.
-  return can_use_log_router_ && !web_contents()->GetWebUI();
-}
-
 bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const {
   DCHECK(web_contents());
 
   scoped_ptr<password_manager::BrowserSavePasswordProgressLogger> logger;
-  if (IsLoggingActive()) {
-    logger.reset(new password_manager::BrowserSavePasswordProgressLogger(this));
+  if (log_manager_->IsLoggingActive()) {
+    logger.reset(new password_manager::BrowserSavePasswordProgressLogger(
+        log_manager_.get()));
     logger->LogMessage(
         Logger::STRING_WAS_LAST_NAVIGATION_HTTP_ERROR_METHOD);
   }
@@ -380,8 +354,9 @@
   } else {
     ssl_errors = net::IsCertStatusError(entry->GetSSL().cert_status);
   }
-  if (IsLoggingActive()) {
-    password_manager::BrowserSavePasswordProgressLogger logger(this);
+  if (log_manager_->IsLoggingActive()) {
+    password_manager::BrowserSavePasswordProgressLogger logger(
+        log_manager_.get());
     logger.LogBoolean(Logger::STRING_SSL_ERRORS_PRESENT, ssl_errors);
   }
   return ssl_errors;
@@ -429,8 +404,6 @@
                         HidePasswordGenerationPopup)
     IPC_MESSAGE_HANDLER(AutofillHostMsg_GenerationAvailableForForm,
                         GenerationAvailableForForm)
-    IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed,
-                        NotifyRendererOfLoggingAvailability)
     // Default:
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
@@ -438,6 +411,12 @@
   return handled;
 }
 
+void ChromePasswordManagerClient::DidStartNavigation(
+    content::NavigationHandle* navigation_handle) {
+  // Logging has no sense on WebUI sites.
+  log_manager_->SetSuspended(web_contents()->GetWebUI() != nullptr);
+}
+
 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace(
     const gfx::RectF& bounds) {
   gfx::Rect client_area = web_contents()->GetContainerBounds();
@@ -482,15 +461,6 @@
   password_manager_.GenerationAvailableForForm(form);
 }
 
-void ChromePasswordManagerClient::NotifyRendererOfLoggingAvailability() {
-  if (!web_contents())
-    return;
-
-  web_contents()->GetRenderViewHost()->Send(new AutofillMsg_SetLoggingState(
-      web_contents()->GetRenderViewHost()->GetRoutingID(),
-      can_use_log_router_));
-}
-
 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() {
 #if defined(OS_ANDROID)
   return false;
@@ -555,3 +525,8 @@
 ChromePasswordManagerClient::GetStoreResultFilter() const {
   return &credentials_filter_;
 }
+
+const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager()
+    const {
+  return log_manager_.get();
+}
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.h b/chrome/browser/password_manager/chrome_password_manager_client.h
index 1565545..dfa3fef 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.h
+++ b/chrome/browser/password_manager/chrome_password_manager_client.h
@@ -68,9 +68,6 @@
   PrefService* GetPrefs() override;
   password_manager::PasswordStore* GetPasswordStore() const override;
   password_manager::PasswordSyncState GetPasswordSyncState() const override;
-  void OnLogRouterAvailabilityChanged(bool router_can_be_used) override;
-  void LogSavePasswordProgress(const std::string& text) const override;
-  bool IsLoggingActive() const override;
   bool WasLastNavigationHTTPError() const override;
   bool DidLastPageLoadEncounterSSLErrors() const override;
   bool IsOffTheRecord() const override;
@@ -81,6 +78,7 @@
   const GURL& GetLastCommittedEntryURL() const override;
   const password_manager::CredentialsFilter* GetStoreResultFilter()
       const override;
+  const password_manager::LogManager* GetLogManager() const override;
 
   // Hides any visible generation UI.
   void HidePasswordGenerationPopup();
@@ -110,6 +108,8 @@
   // content::WebContentsObserver overrides.
   bool OnMessageReceived(const IPC::Message& message,
                          content::RenderFrameHost* render_frame_host) override;
+  void DidStartNavigation(
+      content::NavigationHandle* navigation_handle) override;
 
   // Given |bounds| in the renderers coordinate system, return the same bounds
   // in the screens coordinate system.
@@ -137,10 +137,6 @@
   // for UMA stats.
   void GenerationAvailableForForm(const autofill::PasswordForm& form);
 
-  // Sends a message to the renderer with the current value of
-  // |can_use_log_router_|.
-  void NotifyRendererOfLoggingAvailability();
-
   Profile* const profile_;
 
   password_manager::PasswordManager password_manager_;
@@ -157,15 +153,14 @@
   base::WeakPtr<
     autofill::PasswordGenerationPopupControllerImpl> popup_controller_;
 
-  // True if |this| is registered with some LogRouter which can accept logs.
-  bool can_use_log_router_;
-
   // Set to false to disable password saving (will no longer ask if you
   // want to save passwords and also won't fill the passwords).
   BooleanPrefMember saving_and_filling_passwords_enabled_;
 
   const password_manager::SyncStoreResultFilter credentials_filter_;
 
+  scoped_ptr<password_manager::LogManager> log_manager_;
+
   DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient);
 };
 
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 58eb799..82ae23f8 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
 
+#include <string>
+
 #include "base/command_line.h"
 #include "base/metrics/field_trial.h"
 #include "base/prefs/pref_registry_simple.h"
@@ -20,7 +22,9 @@
 #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
 #include "components/password_manager/content/common/credential_manager_messages.h"
 #include "components/password_manager/core/browser/credentials_filter.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/log_receiver.h"
+#include "components/password_manager/core/browser/log_router.h"
 #include "components/password_manager/core/browser/password_manager_internals_service.h"
 #include "components/password_manager/core/common/credential_manager_types.h"
 #include "components/password_manager/core/common/password_manager_pref_names.h"
@@ -47,13 +51,6 @@
 const char kPasswordManagerSettingsBehaviourChangeDisabledGroupName[] =
     "PasswordManagerSettingsBehaviourChange.NotActive";
 
-const char kTestText[] = "abcd1234";
-
-class MockLogReceiver : public password_manager::LogReceiver {
- public:
-  MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&));
-};
-
 // TODO(vabr): Get rid of the mocked client in the client's own test, see
 // http://crbug.com/474577.
 class MockChromePasswordManagerClient : public ChromePasswordManagerClient {
@@ -71,12 +68,21 @@
   DISALLOW_COPY_AND_ASSIGN(MockChromePasswordManagerClient);
 };
 
+class DummyLogReceiver : public password_manager::LogReceiver {
+ public:
+  DummyLogReceiver() = default;
+
+  void LogSavePasswordProgress(const std::string& text) override {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(DummyLogReceiver);
+};
+
 }  // namespace
 
 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness {
  public:
-  ChromePasswordManagerClientTest()
-      : service_(nullptr), field_trial_list_(nullptr) {}
+  ChromePasswordManagerClientTest() : field_trial_list_(nullptr) {}
   void SetUp() override;
 
   syncable_prefs::TestingPrefServiceSyncable* prefs() {
@@ -97,9 +103,6 @@
   // returns false.
   bool WasLoggingActivationMessageSent(bool* activation_flag);
 
-  password_manager::PasswordManagerInternalsService* service_;
-
-  testing::StrictMock<MockLogReceiver> receiver_;
   TestingPrefServiceSimple prefs_;
   base::FieldTrialList field_trial_list_;
 };
@@ -110,9 +113,6 @@
       password_manager::prefs::kPasswordManagerSavingEnabled, true);
   ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient(
       web_contents(), nullptr);
-  service_ = password_manager::PasswordManagerInternalsServiceFactory::
-      GetForBrowserContext(profile());
-  ASSERT_TRUE(service_);
 }
 
 ChromePasswordManagerClient* ChromePasswordManagerClientTest::GetClient() {
@@ -133,86 +133,25 @@
   return true;
 }
 
-TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNoReceiver) {
-  ChromePasswordManagerClient* client = GetClient();
-
-  EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(0);
-  // Before attaching the receiver, no text should be passed.
-  client->LogSavePasswordProgress(kTestText);
-  EXPECT_FALSE(client->IsLoggingActive());
-}
-
-TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressAttachReceiver) {
-  ChromePasswordManagerClient* client = GetClient();
-  EXPECT_FALSE(client->IsLoggingActive());
-
-  // After attaching the logger, text should be passed.
-  service_->RegisterReceiver(&receiver_);
-  EXPECT_TRUE(client->IsLoggingActive());
-  EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(1);
-  client->LogSavePasswordProgress(kTestText);
-  service_->UnregisterReceiver(&receiver_);
-  EXPECT_FALSE(client->IsLoggingActive());
-}
-
-TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressDetachReceiver) {
-  ChromePasswordManagerClient* client = GetClient();
-
-  service_->RegisterReceiver(&receiver_);
-  EXPECT_TRUE(client->IsLoggingActive());
-  service_->UnregisterReceiver(&receiver_);
-  EXPECT_FALSE(client->IsLoggingActive());
-
-  // After detaching the logger, no text should be passed.
-  EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(0);
-  client->LogSavePasswordProgress(kTestText);
-}
-
 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNotifyRenderer) {
-  ChromePasswordManagerClient* client = GetClient();
-  bool logging_active = false;
+  bool logging_active = true;
+  // Ensure the existence of a driver, which will send the IPCs we listen for
+  // below.
+  NavigateAndCommit(GURL("about:blank"));
 
   // Initially, the logging should be off, so no IPC messages.
-  EXPECT_FALSE(WasLoggingActivationMessageSent(&logging_active));
+  EXPECT_TRUE(!WasLoggingActivationMessageSent(&logging_active) ||
+              !logging_active)
+      << "logging_active=" << logging_active;
 
-  service_->RegisterReceiver(&receiver_);
-  EXPECT_TRUE(client->IsLoggingActive());
+  DummyLogReceiver log_receiver;
+  password_manager::LogRouter* log_router = password_manager::
+      PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile());
+  EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver));
   EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active));
   EXPECT_TRUE(logging_active);
 
-  service_->UnregisterReceiver(&receiver_);
-  EXPECT_FALSE(client->IsLoggingActive());
-  EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active));
-  EXPECT_FALSE(logging_active);
-}
-
-TEST_F(ChromePasswordManagerClientTest, AnswerToPingsAboutLoggingState_Active) {
-  service_->RegisterReceiver(&receiver_);
-
-  process()->sink().ClearMessages();
-
-  // Ping the client for logging activity update.
-  AutofillHostMsg_PasswordAutofillAgentConstructed msg(0);
-  static_cast<content::WebContentsObserver*>(GetClient())->OnMessageReceived(
-      msg, web_contents()->GetMainFrame());
-
-  bool logging_active = false;
-  EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active));
-  EXPECT_TRUE(logging_active);
-
-  service_->UnregisterReceiver(&receiver_);
-}
-
-TEST_F(ChromePasswordManagerClientTest,
-       AnswerToPingsAboutLoggingState_Inactive) {
-  process()->sink().ClearMessages();
-
-  // Ping the client for logging activity update.
-  AutofillHostMsg_PasswordAutofillAgentConstructed msg(0);
-  static_cast<content::WebContentsObserver*>(GetClient())->OnMessageReceived(
-      msg, web_contents()->GetMainFrame());
-
-  bool logging_active = true;
+  log_router->UnregisterReceiver(&log_receiver);
   EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active));
   EXPECT_FALSE(logging_active);
 }
@@ -232,18 +171,6 @@
     EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled());
 }
 
-TEST_F(ChromePasswordManagerClientTest, LogToAReceiver) {
-  ChromePasswordManagerClient* client = GetClient();
-  service_->RegisterReceiver(&receiver_);
-  EXPECT_TRUE(client->IsLoggingActive());
-
-  EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(1);
-  client->LogSavePasswordProgress(kTestText);
-
-  service_->UnregisterReceiver(&receiver_);
-  EXPECT_FALSE(client->IsLoggingActive());
-}
-
 TEST_F(ChromePasswordManagerClientTest, GetPasswordSyncState) {
   ChromePasswordManagerClient* client = GetClient();
 
@@ -404,3 +331,17 @@
   NavigateAndCommit(kUrl);
   EXPECT_EQ(kUrl, GetClient()->GetLastCommittedEntryURL());
 }
+
+TEST_F(ChromePasswordManagerClientTest, WebUINoLogging) {
+  // Make sure that logging is active.
+  password_manager::LogRouter* log_router = password_manager::
+      PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile());
+  DummyLogReceiver log_receiver;
+  EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver));
+
+  // But then navigate to a WebUI, there the logging should not be active.
+  NavigateAndCommit(GURL("about:password-manager-internals"));
+  EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive());
+
+  log_router->UnregisterReceiver(&log_receiver);
+}
diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc
index 25aa9bc..014f852 100644
--- a/chrome/browser/password_manager/password_manager_browsertest.cc
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -54,7 +54,6 @@
 #include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/embedded_test_server/http_request.h"
 #include "net/test/embedded_test_server/http_response.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
 #include "net/url_request/test_url_fetcher_factory.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
@@ -1384,18 +1383,16 @@
       ::switches::kIgnoreCertificateErrors);
   const base::FilePath::CharType kDocRoot[] =
       FILE_PATH_LITERAL("chrome/test/data");
-  net::SpawnedTestServer https_test_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::SSLOptions(
-          net::SpawnedTestServer::SSLOptions::CERT_OK),
-      base::FilePath(kDocRoot));
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
 
   // This test case cannot inject the scripts via content::ExecuteScript() in
   // files served through HTTPS. Therefore the scripts are made part of the HTML
   // site and executed on load.
   std::string path =
-      "password/separate_login_form_with_onload_submit_script.html";
+      "/password/separate_login_form_with_onload_submit_script.html";
   GURL https_url(https_test_server.GetURL(path));
   ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme));
 
@@ -2734,4 +2731,37 @@
   EXPECT_EQ("mypassword", actual_password);
 }
 
+// Check that the internals page contains logs both from the renderer and the
+// browser.
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage) {
+  ui_test_utils::NavigateToURLWithDisposition(
+      browser(), GURL("chrome://password-manager-internals"), CURRENT_TAB,
+      ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+  content::WebContents* internals_web_contents = WebContents();
+
+  ui_test_utils::NavigateToURLWithDisposition(
+      browser(), embedded_test_server()->GetURL("/password/password_form.html"),
+      NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+
+  std::string find_renderer_logs =
+      "var text = document.getElementById('log-entries').innerText;"
+      "var logs_found = /PasswordAutofillAgent::/.test(text);"
+      "window.domAutomationController.send(logs_found);";
+  bool renderer_logs_found;
+  ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
+      internals_web_contents->GetRenderViewHost(), find_renderer_logs,
+      &renderer_logs_found));
+  EXPECT_TRUE(renderer_logs_found);
+
+  std::string find_browser_logs =
+      "var text = document.getElementById('log-entries').innerText;"
+      "var logs_found = /PasswordManager::/.test(text);"
+      "window.domAutomationController.send(logs_found);";
+  bool browser_logs_found;
+  ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
+      internals_web_contents->GetRenderViewHost(), find_browser_logs,
+      &browser_logs_found));
+  EXPECT_TRUE(browser_logs_found);
+}
+
 }  // namespace password_manager
diff --git a/chrome/browser/password_manager/password_manager_test_base.cc b/chrome/browser/password_manager/password_manager_test_base.cc
index 0a875de..18750a31 100644
--- a/chrome/browser/password_manager/password_manager_test_base.cc
+++ b/chrome/browser/password_manager/password_manager_test_base.cc
@@ -193,7 +193,7 @@
       browser()->profile(),
       password_manager::BuildPasswordStore<
           content::BrowserContext, password_manager::TestPasswordStore>);
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
       password_manager::switches::kEnableAutomaticPasswordSaving));
 }
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc
index 5477b50..44cc7bdd 100644
--- a/chrome/browser/pdf/pdf_extension_test.cc
+++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -73,7 +73,7 @@
 
   void SetUpOnMainThread() override {
     ExtensionApiTest::SetUpOnMainThread();
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   void TearDownOnMainThread() override {
diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
index 374a337e7..d48cf72 100644
--- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc
+++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
@@ -261,7 +261,7 @@
 
   void SetUpOnMainThread() override {
     InProcessBrowserTest::SetUpOnMainThread();
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     embedded_test_server()->ServeFilesFromDirectory(
         ui_test_utils::GetTestFilePath(
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index b5220e0..e28497c 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -161,7 +161,7 @@
 #include "net/http/http_stream_factory.h"
 #include "net/ssl/ssl_config.h"
 #include "net/ssl/ssl_config_service.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/url_request/url_request_failed_job.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request.h"
@@ -3703,11 +3703,10 @@
 // Test that when extended reporting opt-in is disabled by policy, the
 // opt-in checkbox does not appear on SSL blocking pages.
 IN_PROC_BROWSER_TEST_F(PolicyTest, SafeBrowsingExtendedReportingOptInAllowed) {
-  net::SpawnedTestServer https_server_expired(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::SSLOptions(
-          net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server_expired(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
+  https_server_expired.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server_expired.Start());
 
   // Set the enterprise policy to disallow opt-in.
@@ -3756,11 +3755,10 @@
 // Test that when SSL error overriding is allowed by policy (default), the
 // proceed link appears on SSL blocking pages.
 IN_PROC_BROWSER_TEST_F(PolicyTest, SSLErrorOverridingAllowed) {
-  net::SpawnedTestServer https_server_expired(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::SSLOptions(
-          net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server_expired(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
+  https_server_expired.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server_expired.Start());
 
   const PrefService* const prefs = browser()->profile()->GetPrefs();
@@ -3787,11 +3785,10 @@
 // proceed link does not appear on SSL blocking pages and users should not
 // be able to proceed.
 IN_PROC_BROWSER_TEST_F(PolicyTest, SSLErrorOverridingDisallowed) {
-  net::SpawnedTestServer https_server_expired(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::SSLOptions(
-          net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server_expired(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
+  https_server_expired.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server_expired.Start());
 
   const PrefService* const prefs = browser()->profile()->GetPrefs();
diff --git a/chrome/browser/policy/test/local_policy_test_server.cc b/chrome/browser/policy/test/local_policy_test_server.cc
index 439067f..9909478 100644
--- a/chrome/browser/policy/test/local_policy_test_server.cc
+++ b/chrome/browser/policy/test/local_policy_test_server.cc
@@ -18,7 +18,6 @@
 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
 #include "crypto/rsa_private_key.h"
 #include "net/test/python_utils.h"
-#include "net/test/spawned_test_server/base_test_server.h"
 
 namespace policy {
 
diff --git a/chrome/browser/prefetch/prefetch_browsertest.cc b/chrome/browser/prefetch/prefetch_browsertest.cc
index 91b6aaf3..2119c83 100644
--- a/chrome/browser/prefetch/prefetch_browsertest.cc
+++ b/chrome/browser/prefetch/prefetch_browsertest.cc
@@ -53,7 +53,7 @@
   }
 
   void SetUpOnMainThread() override {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     InProcessBrowserTest::SetUpOnMainThread();
   }
 
diff --git a/chrome/browser/prefs/pref_functional_browsertest.cc b/chrome/browser/prefs/pref_functional_browsertest.cc
index 55b93a9..b449b607 100644
--- a/chrome/browser/prefs/pref_functional_browsertest.cc
+++ b/chrome/browser/prefs/pref_functional_browsertest.cc
@@ -25,6 +25,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/download_test_observer.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::BrowserContext;
 using content::DownloadManager;
@@ -48,7 +49,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   base::ScopedTempDir new_download_dir;
   ASSERT_TRUE(new_download_dir.CreateUniqueTempDir());
 
@@ -63,8 +64,7 @@
   scoped_ptr<content::DownloadTestObserver> downloads_observer(
       CreateWaiter(browser(), 1));
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL("files/downloads/a_zip_file.zip"));
+      browser(), embedded_test_server()->GetURL("/downloads/a_zip_file.zip"));
   // Waits for the download to complete.
   downloads_observer->WaitForFinished();
   EXPECT_TRUE(base::PathExists(downloaded_pkg));
@@ -72,11 +72,10 @@
 
 // Verify image content settings show or hide images.
 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestImageContentSettings) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL("files/settings/image_page.html"));
+      browser(), embedded_test_server()->GetURL("/settings/image_page.html"));
 
   bool result = false;
   std::string script =
@@ -100,8 +99,7 @@
       CONTENT_SETTING_BLOCK);
 
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL("files/settings/image_page.html"));
+      browser(), embedded_test_server()->GetURL("/settings/image_page.html"));
 
   result = false;
   EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
@@ -113,20 +111,18 @@
 
 // Verify that enabling/disabling Javascript in prefs works.
 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestJavascriptEnableDisable) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean(
       prefs::kWebKitJavascriptEnabled));
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL("files/javaScriptTitle.html"));
+      browser(), embedded_test_server()->GetURL("/javaScriptTitle.html"));
   EXPECT_EQ(base::ASCIIToUTF16("Title from script javascript enabled"),
             browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
   browser()->profile()->GetPrefs()->SetBoolean(prefs::kWebKitJavascriptEnabled,
                                                false);
   ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL("files/javaScriptTitle.html"));
+      browser(), embedded_test_server()->GetURL("/javaScriptTitle.html"));
   EXPECT_EQ(base::ASCIIToUTF16("This is html title"),
             browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
 }
@@ -148,8 +144,8 @@
 
 // Verify images are not blocked in incognito mode.
 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestImagesNotBlockedInIncognito) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url = test_server()->GetURL("files/settings/image_page.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url = embedded_test_server()->GetURL("/settings/image_page.html");
   Browser* incognito_browser = CreateIncognitoBrowser();
   ui_test_utils::NavigateToURL(incognito_browser, url);
 
@@ -241,4 +237,3 @@
 IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestHaveLocalStatePrefs) {
   EXPECT_TRUE(g_browser_process->local_state()->GetPreferenceValues().get());
 }
-
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index 37a605b..19fdb15 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -17,6 +17,7 @@
 #include "base/run_loop.h"
 #include "base/scoped_observer.h"
 #include "base/stl_util.h"
+#include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
@@ -103,6 +104,9 @@
 #include "net/dns/mock_host_resolver.h"
 #include "net/ssl/client_cert_store.h"
 #include "net/ssl/ssl_cert_request_info.h"
+#include "net/ssl/ssl_server_config.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "net/test/embedded_test_server/request_handler_util.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request_context.h"
 #include "net/url_request/url_request_context_getter.h"
@@ -201,12 +205,12 @@
 const char* kPassTitle = "PASS";
 
 std::string CreateClientRedirect(const std::string& dest_url) {
-  const char* const kClientRedirectBase = "client-redirect?";
+  const char* const kClientRedirectBase = "/client-redirect?";
   return kClientRedirectBase + net::EscapeQueryParamValue(dest_url, false);
 }
 
 std::string CreateServerRedirect(const std::string& dest_url) {
-  const char* const kServerRedirectBase = "server-redirect?";
+  const char* const kServerRedirectBase = "/server-redirect?";
   return kServerRedirectBase + net::EscapeQueryParamValue(dest_url, false);
 }
 
@@ -1101,8 +1105,9 @@
 #endif
         call_javascript_(true),
         check_load_events_(true),
-        loader_path_("files/prerender/prerender_loader.html"),
-        explicitly_set_browser_(NULL) {}
+        loader_path_("/prerender/prerender_loader.html"),
+        explicitly_set_browser_(NULL) {
+  }
 
   ~PrerenderBrowserTest() override {}
 
@@ -1140,7 +1145,7 @@
         prefs::kPromptForDownload, false);
     IncreasePrerenderMemory();
     if (autostart_test_server_)
-      ASSERT_TRUE(test_server()->Start());
+      ASSERT_TRUE(embedded_test_server()->Start());
     ChromeResourceDispatcherHostDelegate::
         SetExternalProtocolHandlerDelegateForTesting(
             &external_protocol_handler_delegate_);
@@ -1164,7 +1169,7 @@
       const std::string& html_file,
       FinalStatus expected_final_status,
       int expected_number_of_loads) {
-    GURL url = test_server()->GetURL(html_file);
+    GURL url = embedded_test_server()->GetURL(html_file);
     return PrerenderTestURL(url,
                             expected_final_status,
                             expected_number_of_loads);
@@ -1174,7 +1179,7 @@
       const std::string& html_file,
       const std::vector<FinalStatus>& expected_final_status_queue,
       int expected_number_of_loads) {
-    GURL url = test_server()->GetURL(html_file);
+    GURL url = embedded_test_server()->GetURL(html_file);
     return PrerenderTestURLImpl(url,
                                 expected_final_status_queue,
                                 expected_number_of_loads);
@@ -1215,7 +1220,7 @@
   void NavigateToURLWithDisposition(const std::string& dest_html_file,
                                     WindowOpenDisposition disposition,
                                     bool expect_swap_to_succeed) const {
-    GURL dest_url = test_server()->GetURL(dest_html_file);
+    GURL dest_url = embedded_test_server()->GetURL(dest_html_file);
     NavigateToURLWithDisposition(dest_url, disposition, expect_swap_to_succeed);
   }
 
@@ -1285,7 +1290,7 @@
   void NavigateToNextPageAfterPrerender() const {
     ui_test_utils::NavigateToURL(
         current_browser(),
-        test_server()->GetURL("files/prerender/prerender_page.html"));
+        embedded_test_server()->GetURL("/prerender/prerender_page.html"));
   }
 
   // Called after the prerendered page has been navigated to and then away from.
@@ -1321,7 +1326,7 @@
   }
 
   bool UrlIsInPrerenderManager(const std::string& html_file) const {
-    return UrlIsInPrerenderManager(test_server()->GetURL(html_file));
+    return UrlIsInPrerenderManager(embedded_test_server()->GetURL(html_file));
   }
 
   bool UrlIsInPrerenderManager(const GURL& url) const {
@@ -1333,10 +1338,8 @@
     if (https_src_server_)
       return;
     https_src_server_.reset(
-        new net::SpawnedTestServer(
-            net::SpawnedTestServer::TYPE_HTTPS,
-            net::SpawnedTestServer::kLocalhost,
-            base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))));
+        new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
+    https_src_server_->ServeFilesFromSourceDirectory("chrome/test/data");
     CHECK(https_src_server_->Start());
   }
 
@@ -1480,10 +1483,8 @@
     static const std::string secondary_domain = "www.foo.com";
     host_resolver()->AddRule(secondary_domain, "127.0.0.1");
     std::string url_str(base::StringPrintf(
-        "http://%s:%d/%s",
-        secondary_domain.c_str(),
-        test_server()->host_port_pair().port(),
-        path.c_str()));
+        "http://%s:%d/%s", secondary_domain.c_str(),
+        embedded_test_server()->host_port_pair().port(), path.c_str()));
     return GURL(url_str);
   }
 
@@ -1570,16 +1571,14 @@
       int expected_number_of_loads) {
     dest_url_ = prerender_url;
 
-    std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+    base::StringPairs replacement_text;
     replacement_text.push_back(
         make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec()));
     std::string replacement_path;
-    CHECK(net::SpawnedTestServer::GetFilePathWithReplacements(
-        loader_path_,
-        replacement_text,
-        &replacement_path));
+    net::test_server::GetFilePathWithReplacements(
+        loader_path_, replacement_text, &replacement_path);
 
-    const net::SpawnedTestServer* src_server = test_server();
+    const net::EmbeddedTestServer* src_server = embedded_test_server();
     if (https_src_server_)
       src_server = https_src_server_.get();
     GURL loader_url = src_server->GetURL(
@@ -1699,7 +1698,7 @@
 #endif
   NeverRunsExternalProtocolHandlerDelegate external_protocol_handler_delegate_;
   GURL dest_url_;
-  scoped_ptr<net::SpawnedTestServer> https_src_server_;
+  scoped_ptr<net::EmbeddedTestServer> https_src_server_;
   bool call_javascript_;
   bool check_load_events_;
   std::string loader_host_override_;
@@ -1713,7 +1712,7 @@
 // <link rel=prerender> tag and then loaded into a tab in response to a
 // navigation.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) {
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   EXPECT_EQ(1, GetPrerenderDomContentLoadedEventCountForLinkNumber(0));
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLT", 1);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLTMatched", 0);
@@ -1739,7 +1738,7 @@
 
 // Checks that cross-domain prerenders emit the correct histograms.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageCrossDomain) {
-  PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"),
+  PrerenderTestURL(GetCrossDomainTestUrl("prerender/prerender_page.html"),
                    FINAL_STATUS_USED, 1);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLT", 1);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLTMatched", 0);
@@ -1758,9 +1757,8 @@
 
 // Checks that pending prerenders launch and receive proper event treatment.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPagePending) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page_pending.html",
-                       FINAL_STATUS_USED, 1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page_pending.html", FINAL_STATUS_USED, 1);
 
   // Navigate to the prerender.
   scoped_ptr<TestPrerender> prerender2 = ExpectPrerender(FINAL_STATUS_USED);
@@ -1773,7 +1771,7 @@
   prerender2->WaitForLoads(1);
 
   const GURL prerender_page_url =
-      test_server()->GetURL("files/prerender/prerender_page.html");
+      embedded_test_server()->GetURL("/prerender/prerender_page.html");
   EXPECT_FALSE(IsEmptyPrerenderLinkManager());
   EXPECT_NE(static_cast<TestPrerenderContents*>(NULL),
             GetPrerenderContentsFor(prerender_page_url));
@@ -1792,7 +1790,7 @@
 // Checks that pending prerenders which are canceled before they are launched
 // never get started.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovesPending) {
-  PrerenderTestURL("files/prerender/prerender_page_removes_pending.html",
+  PrerenderTestURL("/prerender/prerender_page_removes_pending.html",
                    FINAL_STATUS_USED, 1);
 
   ChannelDestructionWatcher channel_close_watcher;
@@ -1811,9 +1809,8 @@
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovingLink) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_CANCELLED, 1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1);
 
   // No ChannelDestructionWatcher is needed here, since prerenders in the
   // PrerenderLinkManager should be deleted by removing the links, rather than
@@ -1836,9 +1833,8 @@
   GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2;
 
   set_loader_query("links_to_insert=2");
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_CANCELLED, 1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1);
   EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0));
   EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0));
   EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(1));
@@ -1864,7 +1860,7 @@
   GetPrerenderManager()->mutable_config().max_link_concurrency = 2;
   GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2;
 
-  GURL url = test_server()->GetURL("files/prerender/prerender_page.html");
+  GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html");
   scoped_ptr<TestPrerender> prerender =
       PrerenderTestURL(url, FINAL_STATUS_CANCELLED, 1);
 
@@ -1897,8 +1893,7 @@
   GetPrerenderManager()->mutable_config().max_link_concurrency = 2;
   GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2;
   set_loader_query("links_to_insert=2");
-  PrerenderTestURL("files/prerender/prerender_page.html",
-                   FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0));
   EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0));
   EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(1));
@@ -1926,8 +1921,7 @@
 
 // Checks that the visibility API works.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) {
-  PrerenderTestURL("files/prerender/prerender_visibility.html",
-                   FINAL_STATUS_USED,
+  PrerenderTestURL("/prerender/prerender_visibility.html", FINAL_STATUS_USED,
                    1);
   NavigateToDestURL();
 }
@@ -1979,23 +1973,21 @@
 // Checks that the prerendering of a page is canceled correctly when a
 // Javascript alert is called.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertBeforeOnload) {
-  PrerenderTestURL("files/prerender/prerender_alert_before_onload.html",
-                   FINAL_STATUS_JAVASCRIPT_ALERT,
-                   0);
+  PrerenderTestURL("/prerender/prerender_alert_before_onload.html",
+                   FINAL_STATUS_JAVASCRIPT_ALERT, 0);
 }
 
 // Checks that the prerendering of a page is canceled correctly when a
 // Javascript alert is called.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertAfterOnload) {
-  PrerenderTestURL("files/prerender/prerender_alert_after_onload.html",
-                   FINAL_STATUS_JAVASCRIPT_ALERT,
-                   1);
+  PrerenderTestURL("/prerender/prerender_alert_after_onload.html",
+                   FINAL_STATUS_JAVASCRIPT_ALERT, 1);
 }
 
 // Checks that plugins are not loaded while a page is being preloaded, but
 // are loaded when the page is displayed.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDelayLoadPlugin) {
-  PrerenderTestURL("files/prerender/prerender_plugin_delay_load.html",
+  PrerenderTestURL("/prerender/prerender_plugin_delay_load.html",
                    FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
@@ -2009,7 +2001,7 @@
   content_settings_map->SetDefaultContentSetting(
       CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_DETECT_IMPORTANT_CONTENT);
 
-  PrerenderTestURL("files/prerender/prerender_plugin_power_saver.html",
+  PrerenderTestURL("/prerender/prerender_plugin_power_saver.html",
                    FINAL_STATUS_USED, 1);
 
   DisableJavascriptCalls();
@@ -2029,16 +2021,15 @@
   content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
                                                  CONTENT_SETTING_BLOCK);
 
-  PrerenderTestURL("files/prerender/prerender_plugin_never_load.html",
+  PrerenderTestURL("/prerender/prerender_plugin_never_load.html",
                    FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that we don't load a NaCl plugin when NaCl is disabled.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNaClPluginDisabled) {
-  PrerenderTestURL("files/prerender/prerender_plugin_nacl_disabled.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_plugin_nacl_disabled.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 
 
@@ -2071,9 +2062,8 @@
 #endif
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        MAYBE_PrerenderIframeDelayLoadPlugin) {
-  PrerenderTestURL("files/prerender/prerender_iframe_plugin_delay_load.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_iframe_plugin_delay_load.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -2081,9 +2071,8 @@
 // iframe with a source that requires http authentication. This should not
 // prerender successfully.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttpAuthentication) {
-  PrerenderTestURL("files/prerender/prerender_http_auth_container.html",
-                   FINAL_STATUS_AUTH_NEEDED,
-                   0);
+  PrerenderTestURL("/prerender/prerender_http_auth_container.html",
+                   FINAL_STATUS_AUTH_NEEDED, 0);
 }
 
 // Checks that client-issued redirects work with prerendering.
@@ -2091,9 +2080,8 @@
 // than the final destination page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderClientRedirectNavigateToFirst) {
-  PrerenderTestURL(CreateClientRedirect("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_USED,
-                   2);
+  PrerenderTestURL(CreateClientRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_USED, 2);
   NavigateToDestURL();
 }
 
@@ -2102,19 +2090,17 @@
 // page which does the redirection.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderClientRedirectNavigateToSecond) {
-  PrerenderTestURL(CreateClientRedirect("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_USED,
-                   2);
-  NavigateToURL("files/prerender/prerender_page.html");
+  PrerenderTestURL(CreateClientRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_USED, 2);
+  NavigateToURL("/prerender/prerender_page.html");
 }
 
 // Checks that redirects with location.replace do not cancel a prerender and
 // and swap when navigating to the first page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderLocationReplaceNavigateToFirst) {
-  PrerenderTestURL("files/prerender/prerender_location_replace.html",
-                   FINAL_STATUS_USED,
-                   2);
+  PrerenderTestURL("/prerender/prerender_location_replace.html",
+                   FINAL_STATUS_USED, 2);
   NavigateToDestURL();
 }
 
@@ -2122,10 +2108,9 @@
 // and swap when navigating to the second.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderLocationReplaceNavigateToSecond) {
-  PrerenderTestURL("files/prerender/prerender_location_replace.html",
-                   FINAL_STATUS_USED,
-                   2);
-  NavigateToURL("files/prerender/prerender_page.html");
+  PrerenderTestURL("/prerender/prerender_location_replace.html",
+                   FINAL_STATUS_USED, 2);
+  NavigateToURL("/prerender/prerender_page.html");
 }
 
 // Checks that we get the right PPLT histograms for client redirect prerenders
@@ -2137,15 +2122,14 @@
   // The loader page should look like Google.
   static const char kGoogleDotCom[] = "www.google.com";
   SetLoaderHostOverride(kGoogleDotCom);
-  set_loader_path("files/prerender/prerender_loader_with_replace_state.html");
+  set_loader_path("/prerender/prerender_loader_with_replace_state.html");
 
-  GURL dest_url = GetCrossDomainTestUrl(
-      "files/prerender/prerender_deferred_image.html");
+  GURL dest_url =
+      GetCrossDomainTestUrl("prerender/prerender_deferred_image.html");
 
-  GURL prerender_url = test_server()->GetURL(
-      "files/prerender/prerender_location_replace.html?" +
-      net::EscapeQueryParamValue(dest_url.spec(), false) +
-      "#prerender");
+  GURL prerender_url = embedded_test_server()->GetURL(
+      "/prerender/prerender_location_replace.html?" +
+      net::EscapeQueryParamValue(dest_url.spec(), false) + "#prerender");
   GURL::Replacements replacements;
   replacements.SetHostStr(kGoogleDotCom);
   prerender_url = prerender_url.ReplaceComponents(replacements);
@@ -2168,10 +2152,9 @@
   histogram_tester().ExpectTotalCount("Prerender.gws_PrerenderNotSwappedInPLT",
                                       0);
 
-  GURL navigate_url = test_server()->GetURL(
-      "files/prerender/prerender_location_replace.html?" +
-      net::EscapeQueryParamValue(dest_url.spec(), false) +
-      "#navigate");
+  GURL navigate_url = embedded_test_server()->GetURL(
+      "/prerender/prerender_location_replace.html?" +
+      net::EscapeQueryParamValue(dest_url.spec(), false) + "#navigate");
   navigate_url = navigate_url.ReplaceComponents(replacements);
 
   NavigationOrSwapObserver swap_observer(
@@ -2201,21 +2184,20 @@
 // page which does the redirection via a mouse click.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderClientRedirectNavigateToSecondViaClick) {
-  GURL prerender_url = test_server()->GetURL(
-      CreateClientRedirect("files/prerender/prerender_page.html"));
-  GURL destination_url = test_server()->GetURL(
-      "files/prerender/prerender_page.html");
+  GURL prerender_url = embedded_test_server()->GetURL(
+      CreateClientRedirect("/prerender/prerender_page.html"));
+  GURL destination_url =
+      embedded_test_server()->GetURL("/prerender/prerender_page.html");
   PrerenderTestURL(prerender_url, FINAL_STATUS_USED, 2);
   OpenURLViaClick(destination_url);
 }
 
 // Checks that a page served over HTTPS is correctly prerendered.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
+  GURL https_url = https_server.GetURL("/prerender/prerender_page.html");
   PrerenderTestURL(https_url,
                    FINAL_STATUS_USED,
                    1);
@@ -2226,19 +2208,17 @@
 // page will not count as an "alias" for the prerendered page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderClientRedirectInIframe) {
-  std::string redirect_path = CreateClientRedirect(
-      "/files/prerender/prerender_embedded_content.html");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
-  replacement_text.push_back(
-      std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
+  std::string redirect_path =
+      CreateClientRedirect("/prerender/prerender_embedded_content.html");
+  base::StringPairs replacement_text;
+  replacement_text.push_back(std::make_pair("REPLACE_WITH_URL", redirect_path));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_iframe.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_iframe.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 2);
-  EXPECT_FALSE(UrlIsInPrerenderManager(
-      "files/prerender/prerender_embedded_content.html"));
+  EXPECT_FALSE(
+      UrlIsInPrerenderManager("/prerender/prerender_embedded_content.html"));
   NavigateToDestURL();
 }
 
@@ -2247,9 +2227,8 @@
 // than the final destination page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderServerRedirectNavigateToFirst) {
-  PrerenderTestURL(CreateServerRedirect("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL(CreateServerRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -2258,10 +2237,9 @@
 // page which does the redirection.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderServerRedirectNavigateToSecond) {
-  PrerenderTestURL(CreateServerRedirect("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_USED,
-                   1);
-  NavigateToURL("files/prerender/prerender_page.html");
+  PrerenderTestURL(CreateServerRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_USED, 1);
+  NavigateToURL("/prerender/prerender_page.html");
 }
 
 // Checks that server-issued redirects work with prerendering.
@@ -2269,10 +2247,10 @@
 // page which does the redirection via a mouse click.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderServerRedirectNavigateToSecondViaClick) {
-  GURL prerender_url = test_server()->GetURL(
-      CreateServerRedirect("files/prerender/prerender_page.html"));
-  GURL destination_url = test_server()->GetURL(
-      "files/prerender/prerender_page.html");
+  GURL prerender_url = embedded_test_server()->GetURL(
+      CreateServerRedirect("/prerender/prerender_page.html"));
+  GURL destination_url =
+      embedded_test_server()->GetURL("/prerender/prerender_page.html");
   PrerenderTestURL(prerender_url, FINAL_STATUS_USED, 1);
   OpenURLViaClick(destination_url);
 }
@@ -2280,52 +2258,45 @@
 // Checks that server-issued redirects within an iframe in a prerendered
 // page will not count as an "alias" for the prerendered page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectInIframe) {
-  std::string redirect_path = CreateServerRedirect(
-      "/files/prerender/prerender_embedded_content.html");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
-  replacement_text.push_back(
-      std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
+  std::string redirect_path =
+      CreateServerRedirect("//prerender/prerender_embedded_content.html");
+  base::StringPairs replacement_text;
+  replacement_text.push_back(std::make_pair("REPLACE_WITH_URL", redirect_path));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_iframe.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_iframe.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
-  EXPECT_FALSE(UrlIsInPrerenderManager(
-      "files/prerender/prerender_embedded_content.html"));
+  EXPECT_FALSE(
+      UrlIsInPrerenderManager("/prerender/prerender_embedded_content.html"));
   NavigateToDestURL();
 }
 
 // Prerenders a page that contains an automatic download triggered through an
 // iframe. This should not prerender successfully.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadIframe) {
-  PrerenderTestURL("files/prerender/prerender_download_iframe.html",
-                   FINAL_STATUS_DOWNLOAD,
-                   0);
+  PrerenderTestURL("/prerender/prerender_download_iframe.html",
+                   FINAL_STATUS_DOWNLOAD, 0);
 }
 
 // Prerenders a page that contains an automatic download triggered through
 // Javascript changing the window.location. This should not prerender
 // successfully
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadLocation) {
-  PrerenderTestURL(CreateClientRedirect("files/download-test1.lib"),
-                   FINAL_STATUS_DOWNLOAD,
-                   1);
+  PrerenderTestURL(CreateClientRedirect("/download-test1.lib"),
+                   FINAL_STATUS_DOWNLOAD, 1);
 }
 
 // Prerenders a page that contains an automatic download triggered through a
 // client-issued redirect. This should not prerender successfully.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadClientRedirect) {
-  PrerenderTestURL("files/prerender/prerender_download_refresh.html",
-                   FINAL_STATUS_DOWNLOAD,
-                   1);
+  PrerenderTestURL("/prerender/prerender_download_refresh.html",
+                   FINAL_STATUS_DOWNLOAD, 1);
 }
 
 // Checks that the referrer is set when prerendering.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReferrer) {
-  PrerenderTestURL("files/prerender/prerender_referrer.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_referrer.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -2334,8 +2305,7 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderNoSSLReferrer) {
   UseHttpsSrcServer();
-  PrerenderTestURL("files/prerender/prerender_no_referrer.html",
-                   FINAL_STATUS_USED,
+  PrerenderTestURL("/prerender/prerender_no_referrer.html", FINAL_STATUS_USED,
                    1);
   NavigateToDestURL();
 }
@@ -2347,8 +2317,7 @@
   content::ContentBrowserClient* original_browser_client =
       content::SetBrowserClientForTesting(test_content_browser_client.get());
 
-  PrerenderTestURL("files/prerender/prerender_referrer.html",
-                   FINAL_STATUS_CANCELLED,
+  PrerenderTestURL("/prerender/prerender_referrer.html", FINAL_STATUS_CANCELLED,
                    1);
   OpenDestURLViaClick();
 
@@ -2359,16 +2328,14 @@
 
 // Checks that popups on a prerendered page cause cancellation.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPopup) {
-  PrerenderTestURL("files/prerender/prerender_popup.html",
-                   FINAL_STATUS_CREATE_NEW_WINDOW,
-                   0);
+  PrerenderTestURL("/prerender/prerender_popup.html",
+                   FINAL_STATUS_CREATE_NEW_WINDOW, 0);
 }
 
 // Checks that registering a protocol handler causes cancellation.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRegisterProtocolHandler) {
-  PrerenderTestURL("files/prerender/prerender_register_protocol_handler.html",
-                   FINAL_STATUS_REGISTER_PROTOCOL_HANDLER,
-                   0);
+  PrerenderTestURL("/prerender/prerender_register_protocol_handler.html",
+                   FINAL_STATUS_REGISTER_PROTOCOL_HANDLER, 0);
 }
 
 // Checks that renderers using excessive memory will be terminated.
@@ -2381,7 +2348,7 @@
   // message gets through. This happens on XP debug bots because they're so
   // slow. Instead, don't bother checking the load event count.
   DisableLoadEventCheck();
-  PrerenderTestURL("files/prerender/prerender_excessive_memory.html",
+  PrerenderTestURL("/prerender/prerender_excessive_memory.html",
                    FINAL_STATUS_MEMORY_LIMIT_EXCEEDED, 0);
 }
 
@@ -2389,15 +2356,14 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderQuickQuit) {
   DisableJavascriptCalls();
   DisableLoadEventCheck();
-  PrerenderTestURL("files/prerender/prerender_page.html",
-                   FINAL_STATUS_APP_TERMINATING,
-                   0);
+  PrerenderTestURL("/prerender/prerender_page.html",
+                   FINAL_STATUS_APP_TERMINATING, 0);
 }
 
 // Checks that we don't prerender in an infinite loop.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderInfiniteLoop) {
-  const char* const kHtmlFileA = "files/prerender/prerender_infinite_a.html";
-  const char* const kHtmlFileB = "files/prerender/prerender_infinite_b.html";
+  const char* const kHtmlFileA = "/prerender/prerender_infinite_a.html";
+  const char* const kHtmlFileB = "/prerender/prerender_infinite_b.html";
 
   std::vector<FinalStatus> expected_final_status_queue;
   expected_final_status_queue.push_back(FINAL_STATUS_USED);
@@ -2430,11 +2396,11 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderInfiniteLoopMultiple) {
   const char* const kHtmlFileA =
-      "files/prerender/prerender_infinite_a_multiple.html";
+      "/prerender/prerender_infinite_a_multiple.html";
   const char* const kHtmlFileB =
-      "files/prerender/prerender_infinite_b_multiple.html";
+      "/prerender/prerender_infinite_b_multiple.html";
   const char* const kHtmlFileC =
-      "files/prerender/prerender_infinite_c_multiple.html";
+      "/prerender/prerender_infinite_c_multiple.html";
 
   // This test is conceptually simplest if concurrency is at two, since we
   // don't have to worry about which of kHtmlFileB or kHtmlFileC gets evicted.
@@ -2474,8 +2440,8 @@
 // Checks that pending prerenders are aborted (and never launched) when launched
 // by a prerender that itself gets aborted.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAbortPendingOnCancel) {
-  const char* const kHtmlFileA = "files/prerender/prerender_infinite_a.html";
-  const char* const kHtmlFileB = "files/prerender/prerender_infinite_b.html";
+  const char* const kHtmlFileA = "/prerender/prerender_infinite_a.html";
+  const char* const kHtmlFileB = "/prerender/prerender_infinite_b.html";
 
   scoped_ptr<TestPrerender> prerender =
       PrerenderTestURL(kHtmlFileA, FINAL_STATUS_CANCELLED, 1);
@@ -2514,7 +2480,7 @@
   ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, any_prerender));
 
   // Prerender a page in addition to the original tab.
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
 
   // A TaskManager entry should appear like "Prerender: Prerender Page"
   // alongside the original tab entry. There should be just these two entries.
@@ -2548,7 +2514,7 @@
   const base::string16 final = MatchTaskManagerTab("Prerender Page");
 
   // Start with two resources.
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
 
   // Show the task manager. This populates the model. Importantly, we're doing
   // this after the prerender WebContents already exists - the task manager
@@ -2584,7 +2550,7 @@
   const base::string16 final = MatchTaskManagerTab("Prerender Page");
 
   // Prerender, and swap it in.
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 
   // Show the task manager. This populates the model. Importantly, we're doing
@@ -2600,8 +2566,7 @@
 
 // Checks that audio loads are deferred on prerendering.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5Audio) {
-  PrerenderTestURL("files/prerender/prerender_html5_audio.html",
-                   FINAL_STATUS_USED,
+  PrerenderTestURL("/prerender/prerender_html5_audio.html", FINAL_STATUS_USED,
                    1);
   NavigateToDestURL();
   WaitForASCIITitle(GetActiveWebContents(), kPassTitle);
@@ -2610,9 +2575,8 @@
 // Checks that audio loads are deferred on prerendering and played back when
 // the prerender is swapped in if autoplay is set.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5AudioAutoplay) {
-  PrerenderTestURL("files/prerender/prerender_html5_audio_autoplay.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_html5_audio_autoplay.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   WaitForASCIITitle(GetActiveWebContents(), kPassTitle);
 }
@@ -2620,17 +2584,15 @@
 // Checks that audio loads are deferred on prerendering and played back when
 // the prerender is swapped in if js starts playing.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5AudioJsplay) {
-  PrerenderTestURL("files/prerender/prerender_html5_audio_jsplay.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_html5_audio_jsplay.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   WaitForASCIITitle(GetActiveWebContents(), kPassTitle);
 }
 
 // Checks that video loads are deferred on prerendering.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5Video) {
-  PrerenderTestURL("files/prerender/prerender_html5_video.html",
-                   FINAL_STATUS_USED,
+  PrerenderTestURL("/prerender/prerender_html5_video.html", FINAL_STATUS_USED,
                    1);
   NavigateToDestURL();
   WaitForASCIITitle(GetActiveWebContents(), kPassTitle);
@@ -2639,9 +2601,8 @@
 // Checks that video tags inserted by javascript are deferred and played
 // correctly on swap in.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5VideoJs) {
-  PrerenderTestURL("files/prerender/prerender_html5_video_script.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_html5_video_script.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   WaitForASCIITitle(GetActiveWebContents(), kPassTitle);
 }
@@ -2649,10 +2610,8 @@
 // Checks for correct network events by using a busy sleep the javascript.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5VideoNetwork) {
   DisableJavascriptCalls();
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_html5_video_network.html",
-                       FINAL_STATUS_USED,
-                       1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_html5_video_network.html", FINAL_STATUS_USED, 1);
   WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle);
   EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents()));
   NavigateToDestURL();
@@ -2661,9 +2620,7 @@
 
 // Checks that scripts can retrieve the correct window size while prerendering.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowSize) {
-  PrerenderTestURL("files/prerender/prerender_size.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_size.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -2672,10 +2629,8 @@
 
 // Checks that prerenderers will terminate when the RenderView crashes.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRendererCrash) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_RENDERER_CRASHED,
-                       1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page.html", FINAL_STATUS_RENDERER_CRASHED, 1);
 
   // Navigate to about:crash and then wait for the renderer to crash.
   ASSERT_TRUE(prerender->contents());
@@ -2692,8 +2647,7 @@
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderPageWithFragment) {
-  PrerenderTestURL("files/prerender/prerender_page.html#fragment",
-                   FINAL_STATUS_USED,
+  PrerenderTestURL("/prerender/prerender_page.html#fragment", FINAL_STATUS_USED,
                    1);
 
   ChannelDestructionWatcher channel_close_watcher;
@@ -2708,9 +2662,8 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderPageWithRedirectedFragment) {
   PrerenderTestURL(
-      CreateClientRedirect("files/prerender/prerender_page.html#fragment"),
-      FINAL_STATUS_USED,
-      2);
+      CreateClientRedirect("/prerender/prerender_page.html#fragment"),
+      FINAL_STATUS_USED, 2);
 
   ChannelDestructionWatcher channel_close_watcher;
   channel_close_watcher.WatchChannel(browser()->tab_strip_model()->
@@ -2725,36 +2678,30 @@
 // the main page to a fragment.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderPageNavigateFragment) {
-  PrerenderTestURL("files/prerender/no_prerender_page.html",
-                   FINAL_STATUS_APP_TERMINATING,
-                   1);
-  NavigateToURLWithDisposition(
-      "files/prerender/no_prerender_page.html#fragment",
-      CURRENT_TAB, false);
+  PrerenderTestURL("/prerender/no_prerender_page.html",
+                   FINAL_STATUS_APP_TERMINATING, 1);
+  NavigateToURLWithDisposition("/prerender/no_prerender_page.html#fragment",
+                               CURRENT_TAB, false);
 }
 
 // Checks that we do not use a prerendered page when we prerender a fragment
 // but navigate to the main page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderFragmentNavigatePage) {
-  PrerenderTestURL("files/prerender/no_prerender_page.html#fragment",
-                   FINAL_STATUS_APP_TERMINATING,
-                   1);
-  NavigateToURLWithDisposition(
-      "files/prerender/no_prerender_page.html",
-      CURRENT_TAB, false);
+  PrerenderTestURL("/prerender/no_prerender_page.html#fragment",
+                   FINAL_STATUS_APP_TERMINATING, 1);
+  NavigateToURLWithDisposition("/prerender/no_prerender_page.html", CURRENT_TAB,
+                               false);
 }
 
 // Checks that we do not use a prerendered page when we prerender a fragment
 // but navigate to a different fragment on the same page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderFragmentNavigateFragment) {
-  PrerenderTestURL("files/prerender/no_prerender_page.html#other_fragment",
-                   FINAL_STATUS_APP_TERMINATING,
-                   1);
-  NavigateToURLWithDisposition(
-      "files/prerender/no_prerender_page.html#fragment",
-      CURRENT_TAB, false);
+  PrerenderTestURL("/prerender/no_prerender_page.html#other_fragment",
+                   FINAL_STATUS_APP_TERMINATING, 1);
+  NavigateToURLWithDisposition("/prerender/no_prerender_page.html#fragment",
+                               CURRENT_TAB, false);
 }
 
 // Checks that we do not use a prerendered page when the page uses a client
@@ -2762,121 +2709,101 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderClientRedirectFromFragment) {
   PrerenderTestURL(
-      CreateClientRedirect("files/prerender/no_prerender_page.html#fragment"),
-      FINAL_STATUS_APP_TERMINATING,
-      2);
-  NavigateToURLWithDisposition(
-      "files/prerender/no_prerender_page.html",
-      CURRENT_TAB, false);
+      CreateClientRedirect("/prerender/no_prerender_page.html#fragment"),
+      FINAL_STATUS_APP_TERMINATING, 2);
+  NavigateToURLWithDisposition("/prerender/no_prerender_page.html", CURRENT_TAB,
+                               false);
 }
 
 // Checks that we do not use a prerendered page when the page uses a client
 // redirect to refresh to a fragment on the same page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderClientRedirectToFragment) {
-  PrerenderTestURL(
-      CreateClientRedirect("files/prerender/no_prerender_page.html"),
-      FINAL_STATUS_APP_TERMINATING,
-      2);
-  NavigateToURLWithDisposition(
-      "files/prerender/no_prerender_page.html#fragment",
-      CURRENT_TAB, false);
+  PrerenderTestURL(CreateClientRedirect("/prerender/no_prerender_page.html"),
+                   FINAL_STATUS_APP_TERMINATING, 2);
+  NavigateToURLWithDisposition("/prerender/no_prerender_page.html#fragment",
+                               CURRENT_TAB, false);
 }
 
 // Checks that we correctly use a prerendered page when the page uses JS to set
 // the window.location.hash to a fragment on the same page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderPageChangeFragmentLocationHash) {
-  PrerenderTestURL("files/prerender/prerender_fragment_location_hash.html",
-                   FINAL_STATUS_USED,
-                   1);
-  NavigateToURL("files/prerender/prerender_fragment_location_hash.html");
+  PrerenderTestURL("/prerender/prerender_fragment_location_hash.html",
+                   FINAL_STATUS_USED, 1);
+  NavigateToURL("/prerender/prerender_fragment_location_hash.html");
 }
 
 // Checks that prerendering a PNG works correctly.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderImagePng) {
   DisableJavascriptCalls();
-  PrerenderTestURL("files/prerender/image.png", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/image.png", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that prerendering a JPG works correctly.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderImageJpeg) {
   DisableJavascriptCalls();
-  PrerenderTestURL("files/prerender/image.jpeg", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/image.jpeg", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that a prerender of a CRX will result in a cancellation due to
 // download.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCrx) {
-  PrerenderTestURL("files/prerender/extension.crx", FINAL_STATUS_DOWNLOAD, 0);
+  PrerenderTestURL("/prerender/extension.crx", FINAL_STATUS_DOWNLOAD, 0);
 }
 
 // Checks that xhr GET requests allow prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrGet) {
-  PrerenderTestURL("files/prerender/prerender_xhr_get.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_xhr_get.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that xhr HEAD requests allow prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrHead) {
-  PrerenderTestURL("files/prerender/prerender_xhr_head.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_xhr_head.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that xhr OPTIONS requests allow prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrOptions) {
-  PrerenderTestURL("files/prerender/prerender_xhr_options.html",
-                   FINAL_STATUS_USED,
+  PrerenderTestURL("/prerender/prerender_xhr_options.html", FINAL_STATUS_USED,
                    1);
   NavigateToDestURL();
 }
 
 // Checks that xhr TRACE requests allow prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrTrace) {
-  PrerenderTestURL("files/prerender/prerender_xhr_trace.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_xhr_trace.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that xhr POST requests allow prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrPost) {
-  PrerenderTestURL("files/prerender/prerender_xhr_post.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_xhr_post.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that xhr PUT cancels prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrPut) {
-  PrerenderTestURL("files/prerender/prerender_xhr_put.html",
-                   FINAL_STATUS_INVALID_HTTP_METHOD,
-                   1);
+  PrerenderTestURL("/prerender/prerender_xhr_put.html",
+                   FINAL_STATUS_INVALID_HTTP_METHOD, 1);
 }
 
 // Checks that xhr DELETE cancels prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrDelete) {
-  PrerenderTestURL("files/prerender/prerender_xhr_delete.html",
-                   FINAL_STATUS_INVALID_HTTP_METHOD,
-                   1);
+  PrerenderTestURL("/prerender/prerender_xhr_delete.html",
+                   FINAL_STATUS_INVALID_HTTP_METHOD, 1);
 }
 
 // Checks that a top-level page which would trigger an SSL error is canceled.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) {
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
+  GURL https_url = https_server.GetURL("/prerender/prerender_page.html");
   PrerenderTestURL(https_url,
                    FINAL_STATUS_SSL_ERROR,
                    0);
@@ -2886,22 +2813,18 @@
 // the page. Non-main-frame requests are simply cancelled if they run into
 // an SSL problem.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) {
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL("files/prerender/image.jpeg");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  GURL https_url = https_server.GetURL("/prerender/image.jpeg");
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
@@ -2910,23 +2833,19 @@
 // the page. Non-main-frame requests are simply cancelled if they run into
 // an SSL problem.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorIframe) {
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL(
-      "files/prerender/prerender_embedded_content.html");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  GURL https_url =
+      https_server.GetURL("/prerender/prerender_embedded_content.html");
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_URL", https_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_iframe.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_iframe.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
@@ -2934,17 +2853,15 @@
 // Checks that we cancel correctly when window.print() is called.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPrint) {
   DisableLoadEventCheck();
-  PrerenderTestURL("files/prerender/prerender_print.html",
-                   FINAL_STATUS_WINDOW_PRINT,
+  PrerenderTestURL("/prerender/prerender_print.html", FINAL_STATUS_WINDOW_PRINT,
                    0);
 }
 
 // Checks that prerenders do not get swapped into target pages that have opened
 // popups; the BrowsingInstance is not empty.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTargetHasPopup) {
-  PrerenderTestURL("files/prerender/prerender_page.html",
-                   FINAL_STATUS_NON_EMPTY_BROWSING_INSTANCE,
-                   1);
+  PrerenderTestURL("/prerender/prerender_page.html",
+                   FINAL_STATUS_NON_EMPTY_BROWSING_INSTANCE, 1);
   OpenURLViaWindowOpen(GURL(url::kAboutBlankURL));
 
   // Switch back to the current tab and attempt to swap it in.
@@ -2980,13 +2897,13 @@
       current_browser()->profile()->GetResourceContext())->
           set_client_cert_store_factory_for_testing(
               base::Bind(&CreateCertStore));
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.request_client_certificate = true;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  net::SSLServerConfig ssl_config;
+  ssl_config.require_client_cert = true;
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
+  GURL https_url = https_server.GetURL("/prerender/prerender_page.html");
   PrerenderTestURL(https_url, FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, 0);
 }
 
@@ -2998,21 +2915,20 @@
       current_browser()->profile()->GetResourceContext())->
           set_client_cert_store_factory_for_testing(
               base::Bind(&CreateCertStore));
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.request_client_certificate = true;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  net::SSLServerConfig ssl_config;
+  ssl_config.require_client_cert = true;
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL("files/prerender/image.jpeg");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  GURL https_url = https_server.GetURL("/prerender/image.jpeg");
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path,
                    FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED,
                    0);
@@ -3025,22 +2941,21 @@
       current_browser()->profile()->GetResourceContext())->
           set_client_cert_store_factory_for_testing(
               base::Bind(&CreateCertStore));
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  ssl_options.request_client_certificate = true;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  net::SSLServerConfig ssl_config;
+  ssl_config.require_client_cert = true;
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
-  GURL https_url = https_server.GetURL(
-      "files/prerender/prerender_embedded_content.html");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  GURL https_url =
+      https_server.GetURL("/prerender/prerender_embedded_content.html");
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_URL", https_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_iframe.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_iframe.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path,
                    FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED,
                    0);
@@ -3050,48 +2965,45 @@
 // Ensures that we do not prerender pages with a safe browsing
 // interstitial.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingTopLevel) {
-  GURL url = test_server()->GetURL("files/prerender/prerender_page.html");
+  GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html");
   GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl(
       url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE);
-  PrerenderTestURL("files/prerender/prerender_page.html",
-                   FINAL_STATUS_SAFE_BROWSING, 0);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_SAFE_BROWSING,
+                   0);
 }
 
 // Ensures that server redirects to a malware page will cancel prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderSafeBrowsingServerRedirect) {
-  GURL url = test_server()->GetURL("files/prerender/prerender_page.html");
+  GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html");
   GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl(
       url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE);
-  PrerenderTestURL(CreateServerRedirect("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_SAFE_BROWSING,
-                   0);
+  PrerenderTestURL(CreateServerRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_SAFE_BROWSING, 0);
 }
 
 // Ensures that client redirects to a malware page will cancel prerenders.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderSafeBrowsingClientRedirect) {
-  GURL url = test_server()->GetURL("files/prerender/prerender_page.html");
+  GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html");
   GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl(
       url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE);
-  PrerenderTestURL(CreateClientRedirect("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_SAFE_BROWSING,
-                   1);
+  PrerenderTestURL(CreateClientRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_SAFE_BROWSING, 1);
 }
 
 // Ensures that we do not prerender pages which have a malware subresource.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingSubresource) {
-  GURL image_url = test_server()->GetURL("files/prerender/image.jpeg");
+  GURL image_url = embedded_test_server()->GetURL("/prerender/image.jpeg");
   GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl(
       image_url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE);
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path,
                    FINAL_STATUS_SAFE_BROWSING,
                    0);
@@ -3099,18 +3011,17 @@
 
 // Ensures that we do not prerender pages which have a malware iframe.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingIframe) {
-  GURL iframe_url = test_server()->GetURL(
-      "files/prerender/prerender_embedded_content.html");
+  GURL iframe_url = embedded_test_server()->GetURL(
+      "/prerender/prerender_embedded_content.html");
   GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl(
       iframe_url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE);
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_URL", iframe_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_iframe.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_iframe.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path,
                    FINAL_STATUS_SAFE_BROWSING,
                    0);
@@ -3120,26 +3031,22 @@
 
 // Checks that a local storage read will not cause prerender to fail.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderLocalStorageRead) {
-  PrerenderTestURL("files/prerender/prerender_localstorage_read.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_localstorage_read.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that a local storage write will not cause prerender to fail.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderLocalStorageWrite) {
-  PrerenderTestURL("files/prerender/prerender_localstorage_write.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_localstorage_write.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that the favicon is properly loaded on prerender.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderFavicon) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_favicon.html",
-                       FINAL_STATUS_USED,
-                       1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_favicon.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 
   favicon::FaviconDriver* favicon_driver =
@@ -3165,8 +3072,8 @@
       base::Bind(&CreateCountingInterceptorOnIO,
                  unload_url, empty_file, unload_counter.AsWeakPtr()));
 
-  set_loader_path("files/prerender/prerender_loader_with_unload.html");
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  set_loader_path("/prerender/prerender_loader_with_unload.html");
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   unload_counter.WaitForCount(1);
 }
@@ -3184,8 +3091,8 @@
                  hang_url, empty_file,
                  base::Closure()));
 
-  set_loader_path("files/prerender/prerender_loader_with_unload.html");
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  set_loader_path("/prerender/prerender_loader_with_unload.html");
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -3194,9 +3101,8 @@
 // prerendering history is cleared.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClearHistory) {
   scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_CACHE_OR_HISTORY_CLEARED,
-                       1);
+      PrerenderTestURL("/prerender/prerender_page.html",
+                       FINAL_STATUS_CACHE_OR_HISTORY_CLEARED, 1);
 
   ClearBrowsingData(current_browser(), BrowsingDataRemover::REMOVE_HISTORY);
   prerender->WaitForStop();
@@ -3209,9 +3115,8 @@
 // prerendering history is not cleared.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClearCache) {
   scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_CACHE_OR_HISTORY_CLEARED,
-                       1);
+      PrerenderTestURL("/prerender/prerender_page.html",
+                       FINAL_STATUS_CACHE_OR_HISTORY_CLEARED, 1);
 
   ClearBrowsingData(current_browser(), BrowsingDataRemover::REMOVE_CACHE);
   prerender->WaitForStop();
@@ -3222,10 +3127,8 @@
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelAll) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_CANCELLED,
-                       1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1);
 
   GetPrerenderManager()->CancelAllPrerenders();
   prerender->WaitForStop();
@@ -3234,9 +3137,8 @@
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderEvents) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_CANCELLED, 1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1);
 
   GetPrerenderManager()->CancelAllPrerenders();
   prerender->WaitForStop();
@@ -3250,10 +3152,8 @@
 // should never be started.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderCancelPrerenderWithPrerender) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_infinite_a.html",
-                       FINAL_STATUS_CANCELLED,
-                       1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_infinite_a.html", FINAL_STATUS_CANCELLED, 1);
 
   GetPrerenderManager()->CancelAllPrerenders();
   prerender->WaitForStop();
@@ -3268,49 +3168,45 @@
 // by a back navigation.
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNavigateClickGoBack) {
-  PrerenderTestURL("files/prerender/prerender_page_with_link.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_page_with_link.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   ClickToNextPageAfterPrerender();
   GoBackToPrerender();
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNavigateNavigateGoBack) {
-  PrerenderTestURL("files/prerender/prerender_page_with_link.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_page_with_link.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   NavigateToNextPageAfterPrerender();
   GoBackToPrerender();
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickClickGoBack) {
-  PrerenderTestURL("files/prerender/prerender_page_with_link.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_page_with_link.html",
+                   FINAL_STATUS_USED, 1);
   OpenDestURLViaClick();
   ClickToNextPageAfterPrerender();
   GoBackToPrerender();
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNavigateGoBack) {
-  PrerenderTestURL("files/prerender/prerender_page_with_link.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_page_with_link.html",
+                   FINAL_STATUS_USED, 1);
   OpenDestURLViaClick();
   NavigateToNextPageAfterPrerender();
   GoBackToPrerender();
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewWindow) {
-  PrerenderTestURL("files/prerender/prerender_page_with_link.html",
+  PrerenderTestURL("/prerender/prerender_page_with_link.html",
                    FINAL_STATUS_APP_TERMINATING, 1);
   OpenDestURLViaClickNewWindow();
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewForegroundTab) {
-  PrerenderTestURL("files/prerender/prerender_page_with_link.html",
+  PrerenderTestURL("/prerender/prerender_page_with_link.html",
                    FINAL_STATUS_APP_TERMINATING, 1);
   OpenDestURLViaClickNewForegroundTab();
 }
@@ -3324,7 +3220,7 @@
       DevToolsAgentHost::GetOrCreateFor(web_contents));
   FakeDevToolsClient client;
   agent->AttachClient(&client);
-  const char* url = "files/prerender/prerender_page.html";
+  const char* url = "/prerender/prerender_page.html";
   PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1);
   NavigateToURLWithDisposition(url, CURRENT_TAB, false);
   agent->DetachClient();
@@ -3333,10 +3229,9 @@
 // Validate that the sessionStorage namespace remains the same when swapping
 // in a prerendered page.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorage) {
-  set_loader_path("files/prerender/prerender_loader_with_session_storage.html");
-  PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"),
-                   FINAL_STATUS_USED,
-                   1);
+  set_loader_path("/prerender/prerender_loader_with_session_storage.html");
+  PrerenderTestURL(GetCrossDomainTestUrl("prerender/prerender_page.html"),
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   GoBackToPageBeforePrerender();
 }
@@ -3348,7 +3243,7 @@
   PrerenderManager::SetMode(
       PrerenderManager::PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP);
   DisableJavascriptCalls();
-  PrerenderTestURL("files/prerender/prerender_xhr_put.html",
+  PrerenderTestURL("/prerender/prerender_xhr_put.html",
                    FINAL_STATUS_WOULD_HAVE_BEEN_USED, 0);
   NavigateToDestURL();
 }
@@ -3361,7 +3256,7 @@
   PrerenderManager::SetMode(
       PrerenderManager::PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP);
   DisableJavascriptCalls();
-  PrerenderTestURL("files/prerender/prerender_xhr_put.html",
+  PrerenderTestURL("/prerender/prerender_xhr_put.html",
                    FINAL_STATUS_WOULD_HAVE_BEEN_USED, 0);
   OpenDestURLViaClick();
 }
@@ -3378,7 +3273,7 @@
   std::vector<FinalStatus> expected_final_status_queue;
   expected_final_status_queue.push_back(FINAL_STATUS_INVALID_HTTP_METHOD);
   expected_final_status_queue.push_back(FINAL_STATUS_WOULD_HAVE_BEEN_USED);
-  PrerenderTestURL("files/prerender/prerender_xhr_put.html",
+  PrerenderTestURL("/prerender/prerender_xhr_put.html",
                    expected_final_status_queue, 1);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLT", 1);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLTMatched", 0);
@@ -3397,10 +3292,9 @@
 
 // Checks that the referrer policy is used when prerendering.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReferrerPolicy) {
-  set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html");
-  PrerenderTestURL("files/prerender/prerender_referrer_policy.html",
-                   FINAL_STATUS_USED,
-                   1);
+  set_loader_path("/prerender/prerender_loader_with_referrer_policy.html");
+  PrerenderTestURL("/prerender/prerender_referrer_policy.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -3408,10 +3302,9 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderSSLReferrerPolicy) {
   UseHttpsSrcServer();
-  set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html");
-  PrerenderTestURL("files/prerender/prerender_referrer_policy.html",
-                   FINAL_STATUS_USED,
-                   1);
+  set_loader_path("/prerender/prerender_loader_with_referrer_policy.html");
+  PrerenderTestURL("/prerender/prerender_referrer_policy.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -3422,10 +3315,9 @@
   content::ContentBrowserClient* original_browser_client =
       content::SetBrowserClientForTesting(test_content_browser_client.get());
 
-  set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html");
-  PrerenderTestURL("files/prerender/prerender_referrer_policy.html",
-                   FINAL_STATUS_CANCELLED,
-                   1);
+  set_loader_path("/prerender/prerender_loader_with_referrer_policy.html");
+  PrerenderTestURL("/prerender/prerender_referrer_policy.html",
+                   FINAL_STATUS_CANCELLED, 1);
   OpenDestURLViaClick();
 
   bool display_test_result = false;
@@ -3478,7 +3370,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, WebNavigation) {
-  ASSERT_TRUE(StartSpawnedTestServer());
+  ASSERT_TRUE(StartEmbeddedTestServer());
   extensions::FrameNavigationState::set_allow_extension_scheme(true);
 
   // Wait for the extension to set itself up and return control to us.
@@ -3486,7 +3378,7 @@
 
   extensions::ResultCatcher catcher;
 
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
 
   ChannelDestructionWatcher channel_close_watcher;
   channel_close_watcher.WatchChannel(browser()->tab_strip_model()->
@@ -3499,7 +3391,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, TabsApi) {
-  ASSERT_TRUE(StartSpawnedTestServer());
+  ASSERT_TRUE(StartEmbeddedTestServer());
   extensions::FrameNavigationState::set_allow_extension_scheme(true);
 
   // Wait for the extension to set itself up and return control to us.
@@ -3507,7 +3399,7 @@
 
   extensions::ResultCatcher catcher;
 
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
 
   ChannelDestructionWatcher channel_close_watcher;
   channel_close_watcher.WatchChannel(browser()->tab_strip_model()->
@@ -3526,7 +3418,7 @@
   PrerenderManager::SetMode(
       PrerenderManager::PRERENDER_MODE_EXPERIMENT_MATCH_COMPLETE_GROUP);
 
-  ASSERT_TRUE(StartSpawnedTestServer());
+  ASSERT_TRUE(StartEmbeddedTestServer());
 
   const extensions::Extension* extension = LoadExtension(
       test_data_dir_.AppendASCII("streams_private/handle_mime_type"));
@@ -3537,7 +3429,7 @@
   ASSERT_TRUE(handler);
   EXPECT_TRUE(handler->CanHandleMIMEType("application/msword"));
 
-  PrerenderTestURL("files/prerender/document.doc", FINAL_STATUS_DOWNLOAD, 0);
+  PrerenderTestURL("/prerender/document.doc", FINAL_STATUS_DOWNLOAD, 0);
 
   // Sanity-check that the extension would have picked up the stream in a normal
   // navigation had prerender not intercepted it.
@@ -3553,14 +3445,13 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderCancelSubresourceUnsupportedScheme) {
   GURL image_url = GURL("invalidscheme://www.google.com/test.jpg");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_UNSUPPORTED_SCHEME, 0);
 }
 
@@ -3568,14 +3459,13 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderAllowAboutBlankSubresource) {
   GURL image_url = GURL("about:blank");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
@@ -3584,16 +3474,15 @@
 // on redirect.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderCancelSubresourceRedirectUnsupportedScheme) {
-  GURL image_url = test_server()->GetURL(
+  GURL image_url = embedded_test_server()->GetURL(
       CreateServerRedirect("invalidscheme://www.google.com/test.jpg"));
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_UNSUPPORTED_SCHEME, 0);
 }
 
@@ -3601,14 +3490,13 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderKeepSubresourceExtensionScheme) {
   GURL image_url = GURL("chrome-extension://abcdefg/test.jpg");
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
@@ -3617,16 +3505,15 @@
 // prerender.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderKeepSubresourceRedirectExtensionScheme) {
-  GURL image_url = test_server()->GetURL(
+  GURL image_url = embedded_test_server()->GetURL(
       CreateServerRedirect("chrome-extension://abcdefg/test.jpg"));
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
   std::string replacement_path;
-  ASSERT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
-      "files/prerender/prerender_with_image.html",
-      replacement_text,
-      &replacement_path));
+  net::test_server::GetFilePathWithReplacements(
+      "/prerender/prerender_with_image.html", replacement_text,
+      &replacement_path);
   PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
@@ -3634,16 +3521,15 @@
 // Checks that non-http/https main page redirects cancel the prerender.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderCancelMainFrameRedirectUnsupportedScheme) {
-  GURL url = test_server()->GetURL(
+  GURL url = embedded_test_server()->GetURL(
       CreateServerRedirect("invalidscheme://www.google.com/test.html"));
   PrerenderTestURL(url, FINAL_STATUS_UNSUPPORTED_SCHEME, 0);
 }
 
 // Checks that media source video loads are deferred on prerendering.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5MediaSourceVideo) {
-  PrerenderTestURL("files/prerender/prerender_html5_video_media_source.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_html5_video_media_source.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
   WaitForASCIITitle(GetActiveWebContents(), kPassTitle);
 }
@@ -3652,13 +3538,13 @@
 // is cancelled.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWebAudioDevice) {
   DisableLoadEventCheck();
-  PrerenderTestURL("files/prerender/prerender_web_audio_device.html",
+  PrerenderTestURL("/prerender/prerender_web_audio_device.html",
                    FINAL_STATUS_CREATING_AUDIO_STREAM, 0);
 }
 
 // Checks that prerenders do not swap in to WebContents being captured.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCapturedWebContents) {
-  PrerenderTestURL("files/prerender/prerender_page.html",
+  PrerenderTestURL("/prerender/prerender_page.html",
                    FINAL_STATUS_PAGE_BEING_CAPTURED, 1);
   WebContents* web_contents = GetActiveWebContents();
   web_contents->IncrementCapturerCount(gfx::Size());
@@ -3675,9 +3561,8 @@
   content::ContentBrowserClient* original_browser_client =
       content::SetBrowserClientForTesting(&test_browser_client);
 
-  PrerenderTestURL(
-      CreateServerRedirect("files/prerender/prerender_page.html"),
-      FINAL_STATUS_OPEN_URL, 0);
+  PrerenderTestURL(CreateServerRedirect("/prerender/prerender_page.html"),
+                   FINAL_STATUS_OPEN_URL, 0);
 
   content::SetBrowserClientForTesting(original_browser_client);
 }
@@ -3688,7 +3573,7 @@
 // See http://crbug.com/341134
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderCrossProcessServerRedirectNoHang) {
-  const char kDestPath[] = "files/prerender/prerender_page.html";
+  const char kDestPath[] = "/prerender/prerender_page.html";
   // Force everything to be a process swap.
   SwapProcessesContentBrowserClient test_browser_client;
   content::ContentBrowserClient* original_browser_client =
@@ -3696,9 +3581,8 @@
 
   PrerenderTestURL(CreateServerRedirect(kDestPath), FINAL_STATUS_OPEN_URL, 0);
 
-  ui_test_utils::NavigateToURL(
-      browser(),
-      test_server()->GetURL(kDestPath));
+  ui_test_utils::NavigateToURL(browser(),
+                               embedded_test_server()->GetURL(kDestPath));
 
   content::SetBrowserClientForTesting(original_browser_client);
 }
@@ -3734,7 +3618,7 @@
   expected_final_status_queue.push_back(FINAL_STATUS_JAVASCRIPT_ALERT);
   expected_final_status_queue.push_back(FINAL_STATUS_CANCELLED);
   ScopedVector<TestPrerender> prerenders =
-      PrerenderTestURL("files/prerender/prerender_alert_before_onload.html",
+      PrerenderTestURL("/prerender/prerender_alert_before_onload.html",
                        expected_final_status_queue, 0);
 
   // Cancel the MatchComplete dummy.
@@ -3752,10 +3636,8 @@
 
   // The prerender will not completely load until after the swap, so wait for a
   // title change before calling DidPrerenderPass.
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL(
-          "files/prerender/prerender_deferred_image.html",
-          FINAL_STATUS_USED, 0);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_deferred_image.html", FINAL_STATUS_USED, 0);
   WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle);
   EXPECT_EQ(1, GetPrerenderDomContentLoadedEventCountForLinkNumber(0));
   EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents()));
@@ -3798,10 +3680,8 @@
 
   // The prerender will not completely load until after the swap, so wait for a
   // title change before calling DidPrerenderPass.
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL(
-          "files/prerender/prerender_deferred_image.html",
-          FINAL_STATUS_USED, 0);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_deferred_image.html", FINAL_STATUS_USED, 0);
   WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle);
   EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents()));
   EXPECT_EQ(0, prerender->number_of_loads());
@@ -3824,9 +3704,7 @@
 // Checks that deferred redirects in the main frame are followed.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredMainFrame) {
   DisableJavascriptCalls();
-  PrerenderTestURL(
-      "files/prerender/image-deferred.png",
-      FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/image-deferred.png", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -3835,9 +3713,8 @@
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderDeferredMainFrameAfterRedirect) {
   DisableJavascriptCalls();
-  PrerenderTestURL(
-      CreateServerRedirect("files/prerender/image-deferred.png"),
-      FINAL_STATUS_USED, 1);
+  PrerenderTestURL(CreateServerRedirect("/prerender/image-deferred.png"),
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
@@ -3847,14 +3724,14 @@
   RestorePrerenderMode restore_prerender_mode;
   PrerenderManager::SetMode(
       PrerenderManager::PRERENDER_MODE_EXPERIMENT_MATCH_COMPLETE_GROUP);
-  PrerenderTestURL("files/prerender/prerender_deferred_sync_xhr.html",
+  PrerenderTestURL("/prerender/prerender_deferred_sync_xhr.html",
                    FINAL_STATUS_BAD_DEFERRED_REDIRECT, 0);
   NavigateToDestURL();
 }
 
 // Checks that prerenders are not swapped for navigations with extra headers.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderExtraHeadersNoSwap) {
-  PrerenderTestURL("files/prerender/prerender_page.html",
+  PrerenderTestURL("/prerender/prerender_page.html",
                    FINAL_STATUS_APP_TERMINATING, 1);
 
   content::OpenURLParams params(dest_url(), Referrer(), CURRENT_TAB,
@@ -3867,7 +3744,7 @@
 // POST data.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
                        PrerenderBrowserInitiatedPostNoSwap) {
-  PrerenderTestURL("files/prerender/prerender_page.html",
+  PrerenderTestURL("/prerender/prerender_page.html",
                    FINAL_STATUS_APP_TERMINATING, 1);
 
   std::string post_data = "DATA";
@@ -3882,15 +3759,14 @@
 // Checks that the prerendering of a page is canceled correctly when the
 // prerendered page tries to make a second navigation entry.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNewNavigationEntry) {
-  PrerenderTestURL("files/prerender/prerender_new_entry.html",
-                   FINAL_STATUS_NEW_NAVIGATION_ENTRY,
-                   1);
+  PrerenderTestURL("/prerender/prerender_new_entry.html",
+                   FINAL_STATUS_NEW_NAVIGATION_ENTRY, 1);
 }
 
 // Attempt a swap-in in a new tab. The session storage doesn't match, so it
 // should not swap.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageNewTab) {
-  PrerenderTestURL("files/prerender/prerender_page.html",
+  PrerenderTestURL("/prerender/prerender_page.html",
                    FINAL_STATUS_APP_TERMINATING, 1);
 
   // Open a new tab to navigate in.
@@ -3904,7 +3780,7 @@
 
 // Checks that prerenders honor |should_replace_current_entry|.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReplaceCurrentEntry) {
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
 
   content::OpenURLParams params(dest_url(), Referrer(), CURRENT_TAB,
                                 ui::PAGE_TRANSITION_TYPED, false);
@@ -3932,14 +3808,14 @@
       base::Bind(&CreateCountingInterceptorOnIO,
                  kPingURL, empty_file, ping_counter.AsWeakPtr()));
 
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   OpenDestURLViaClickPing(kPingURL);
 
   ping_counter.WaitForCount(1);
 }
 
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPPLTNormalNavigation) {
-  GURL url = test_server()->GetURL("files/prerender/prerender_page.html");
+  GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html");
   ui_test_utils::NavigateToURL(current_browser(), url);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLT", 1);
   histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLTMatched", 0);
@@ -3950,7 +3826,7 @@
 // Checks that a prerender which calls window.close() on itself is aborted.
 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowClose) {
   DisableLoadEventCheck();
-  PrerenderTestURL("files/prerender/prerender_window_close.html",
+  PrerenderTestURL("/prerender/prerender_window_close.html",
                    FINAL_STATUS_CLOSED, 0);
 }
 
@@ -3965,16 +3841,15 @@
 
 // Checks that prerendering works in incognito mode.
 IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest, PrerenderIncognito) {
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 }
 
 // Checks that prerenders are aborted when an incognito profile is closed.
 IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest,
                        PrerenderIncognitoClosed) {
-  scoped_ptr<TestPrerender> prerender =
-      PrerenderTestURL("files/prerender/prerender_page.html",
-                       FINAL_STATUS_PROFILE_DESTROYED, 1);
+  scoped_ptr<TestPrerender> prerender = PrerenderTestURL(
+      "/prerender/prerender_page.html", FINAL_STATUS_PROFILE_DESTROYED, 1);
   current_browser()->window()->Close();
   prerender->WaitForStop();
 }
@@ -4027,8 +3902,7 @@
                        DISABLED_PrerenderOmniboxCancel) {
   // Fake an omnibox prerender.
   scoped_ptr<TestPrerender> prerender = StartOmniboxPrerender(
-      test_server()->GetURL("files/empty.html"),
-      FINAL_STATUS_CANCELLED);
+      embedded_test_server()->GetURL("/empty.html"), FINAL_STATUS_CANCELLED);
 
   // Revert the location bar. This should cancel the prerender.
   GetLocationBar()->Revert();
@@ -4047,15 +3921,15 @@
   // Enter a URL into the Omnibox.
   OmniboxView* omnibox_view = GetOmniboxView();
   omnibox_view->OnBeforePossibleChange();
-  omnibox_view->SetUserText(
-      base::UTF8ToUTF16(test_server()->GetURL("files/empty.html?1").spec()));
+  omnibox_view->SetUserText(base::UTF8ToUTF16(
+      embedded_test_server()->GetURL("/empty.html?1").spec()));
   omnibox_view->OnAfterPossibleChange();
   WaitForAutocompleteDone(omnibox_view);
 
   // Fake an omnibox prerender for a different URL.
-  scoped_ptr<TestPrerender> prerender = StartOmniboxPrerender(
-      test_server()->GetURL("files/empty.html?2"),
-      FINAL_STATUS_APP_TERMINATING);
+  scoped_ptr<TestPrerender> prerender =
+      StartOmniboxPrerender(embedded_test_server()->GetURL("/empty.html?2"),
+                            FINAL_STATUS_APP_TERMINATING);
 
   // The final status may be either FINAL_STATUS_APP_TERMINATING or
   // FINAL_STATUS_CANCELLED. Although closing the omnibox will not cancel an
@@ -4094,9 +3968,8 @@
     return;
 #endif
 
-  PrerenderTestURL("files/prerender/prerender_plugin_nacl_enabled.html",
-                   FINAL_STATUS_USED,
-                   1);
+  PrerenderTestURL("/prerender/prerender_plugin_nacl_enabled.html",
+                   FINAL_STATUS_USED, 1);
   NavigateToDestURL();
 
   // To avoid any chance of a race, we have to let the script send its response
@@ -4131,7 +4004,7 @@
   EXPECT_EQ(1U, GetTrackedTags().size());
 
   // Start prerendering a page and make sure it's correctly tagged.
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
   EXPECT_EQ(2U, GetTrackedTags().size());
 
   // Swap in the prerendered content and make sure its tag is removed.
@@ -4152,7 +4025,7 @@
   EXPECT_EQ(1U, task_manager.tasks().size());
 
   // Start prerendering a page.
-  PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
+  PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
 
   EXPECT_EQ(2U, GetTrackedTags().size());
   ASSERT_EQ(2U, task_manager.tasks().size());
diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc
index 3ab5dff..4d64753 100644
--- a/chrome/browser/printing/printing_layout_browsertest.cc
+++ b/chrome/browser/printing/printing_layout_browsertest.cc
@@ -26,7 +26,7 @@
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "content/public/browser/notification_service.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "printing/image.h"
 #include "printing/printing_test.h"
 
@@ -339,10 +339,10 @@
                                                    "close_printdlg_thread");
 
   // Print a document, check its output.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/printing/test1.html"));
+      browser(), embedded_test_server()->GetURL("/printing/test1.html"));
   close_printdlg_thread.Start();
   PrintNowTab();
   close_printdlg_thread.Join();
@@ -355,12 +355,12 @@
 };
 
 const TestPool kTestPool[] = {
-  // ImagesB&W
-  "files/printing/test2.html", L"test2",
-  // ImagesTransparent
-  "files/printing/test3.html", L"test3",
-  // ImageColor
-  "files/printing/test4.html", L"test4",
+    // ImagesB&W
+    "/printing/test2.html", L"test2",
+    // ImagesTransparent
+    "/printing/test3.html", L"test3",
+    // ImageColor
+    "/printing/test4.html", L"test4",
 };
 
 // http://crbug.com/7721
@@ -368,7 +368,7 @@
   if (IsTestCaseDisabled())
     return;
 
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   DismissTheWindow dismisser;
 
@@ -377,7 +377,8 @@
     if (i)
       CleanupDumpDirectory();
     const TestPool& test = kTestPool[i % arraysize(kTestPool)];
-    ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(test.source));
+    ui_test_utils::NavigateToURL(browser(),
+                                 embedded_test_server()->GetURL(test.source));
     base::DelegateSimpleThread close_printdlg_thread1(&dismisser,
                                                       "close_printdlg_thread");
     EXPECT_EQ(NULL, FindDialogWindow(dismisser.owner_process()));
@@ -417,11 +418,12 @@
   if (IsTestCaseDisabled())
     return;
 
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   {
     bool is_timeout = true;
-    GURL url = test_server()->GetURL("files/printing/popup_delayed_print.htm");
+    GURL url =
+        embedded_test_server()->GetURL("/printing/popup_delayed_print.htm");
     ui_test_utils::NavigateToURL(browser(), url);
 
     DismissTheWindow dismisser;
@@ -431,7 +433,7 @@
     close_printdlg_thread.Join();
 
     // Force a navigation elsewhere to verify that it's fine with it.
-    url = test_server()->GetURL("files/printing/test1.html");
+    url = embedded_test_server()->GetURL("/printing/test1.html");
     ui_test_utils::NavigateToURL(browser(), url);
   }
   chrome::CloseWindow(browser());
@@ -446,10 +448,10 @@
   if (IsTestCaseDisabled())
     return;
 
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   {
-    GURL url = test_server()->GetURL("files/printing/iframe.htm");
+    GURL url = embedded_test_server()->GetURL("/printing/iframe.htm");
     ui_test_utils::NavigateToURL(browser(), url);
 
     DismissTheWindow dismisser;
@@ -459,7 +461,7 @@
     close_printdlg_thread.Join();
 
     // Force a navigation elsewhere to verify that it's fine with it.
-    url = test_server()->GetURL("files/printing/test1.html");
+    url = embedded_test_server()->GetURL("/printing/test1.html");
     ui_test_utils::NavigateToURL(browser(), url);
   }
   chrome::CloseWindow(browser());
diff --git a/chrome/browser/profiles/host_zoom_map_browsertest.cc b/chrome/browser/profiles/host_zoom_map_browsertest.cc
index 9bf73bf..f3d7764 100644
--- a/chrome/browser/profiles/host_zoom_map_browsertest.cc
+++ b/chrome/browser/profiles/host_zoom_map_browsertest.cc
@@ -140,7 +140,7 @@
 
   // BrowserTestBase:
   void SetUpOnMainThread() override {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     embedded_test_server()->RegisterRequestHandler(base::Bind(
         &HostZoomMapBrowserTest::HandleRequest, base::Unretained(this)));
     host_resolver()->AddRule("*", "127.0.0.1");
diff --git a/chrome/browser/profiles/profile_window_browsertest.cc b/chrome/browser/profiles/profile_window_browsertest.cc
index fa6ddd0..6d7ef46 100644
--- a/chrome/browser/profiles/profile_window_browsertest.cc
+++ b/chrome/browser/profiles/profile_window_browsertest.cc
@@ -27,7 +27,7 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 // This test verifies the Desktop implementation of Guest only.
 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
@@ -170,8 +170,8 @@
   Browser* guest_browser = OpenGuestBrowser();
   Profile* guest_profile = guest_browser->profile();
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL url(test_server()->GetURL("set-cookie?cookie1"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url(embedded_test_server()->GetURL("/set-cookie?cookie1"));
 
   // Before navigation there are no cookies for the URL.
   std::string cookie = content::GetCookies(guest_profile, url);
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index 587b355b..c0a05540 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -40,6 +40,7 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/base/window_open_disposition.h"
 
 #if defined(ENABLE_BACKGROUND)
@@ -88,11 +89,9 @@
 
   // InProcessBrowserTest:
   void SetUp() override {
-    https_server_.reset(new net::SpawnedTestServer(
-        net::SpawnedTestServer::TYPE_HTTPS,
-        net::BaseTestServer::SSLOptions(
-            net::BaseTestServer::SSLOptions::CERT_OK),
-        base::FilePath(FILE_PATH_LITERAL("chrome/test/data/"))));
+    https_server_.reset(
+        new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
+    https_server_->ServeFilesFromSourceDirectory("chrome/test/data");
     ASSERT_TRUE(https_server_->Start());
 
 #if defined(ENABLE_NOTIFICATIONS)
@@ -185,7 +184,7 @@
       const PushMessagingAppIdentifier& app_identifier,
       const gcm::IncomingMessage& message);
 
-  net::SpawnedTestServer* https_server() const { return https_server_.get(); }
+  net::EmbeddedTestServer* https_server() const { return https_server_.get(); }
 
   gcm::FakeGCMProfileService* gcm_service() const { return gcm_service_; }
 
@@ -214,14 +213,12 @@
   PushMessagingServiceImpl* push_service() const { return push_service_; }
 
  protected:
-  virtual std::string GetTestURL() {
-    return "files/push_messaging/test.html";
-  }
+  virtual std::string GetTestURL() { return "/push_messaging/test.html"; }
 
   virtual Browser* GetBrowser() const { return browser(); }
 
  private:
-  scoped_ptr<net::SpawnedTestServer> https_server_;
+  scoped_ptr<net::EmbeddedTestServer> https_server_;
   gcm::FakeGCMProfileService* gcm_service_;
   PushMessagingServiceImpl* push_service_;
 
@@ -235,7 +232,7 @@
 class PushMessagingBrowserTestEmptySubscriptionOptions
     : public PushMessagingBrowserTest {
   std::string GetTestURL() override {
-    return "files/push_messaging/test_no_subscription_options.html";
+    return "/push_messaging/test_no_subscription_options.html";
   }
 };
 
@@ -272,7 +269,7 @@
 PushMessagingAppIdentifier
 PushMessagingBrowserTest::GetAppIdentifierForServiceWorkerRegistration(
     int64 service_worker_registration_id) {
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   PushMessagingAppIdentifier app_identifier =
       PushMessagingAppIdentifier::FindByServiceWorker(
           GetBrowser()->profile(), origin, service_worker_registration_id);
@@ -382,24 +379,24 @@
       GetAppIdentifierForServiceWorkerRegistration(0LL);
   EXPECT_EQ(sw0_identifier.app_id(), gcm_service()->last_registered_app_id());
 
-  LoadTestPage("files/push_messaging/subscope1/test.html");
+  LoadTestPage("/push_messaging/subscope1/test.html");
   ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
   ASSERT_EQ("ok - service worker registered", script_result);
 
-  LoadTestPage("files/push_messaging/subscope2/test.html");
+  LoadTestPage("/push_messaging/subscope2/test.html");
   ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
   ASSERT_EQ("ok - service worker registered", script_result);
 
   // Note that we need to reload the page after registering, otherwise
   // navigator.serviceWorker.ready is going to be resolved with the parent
   // Service Worker which still controls the page.
-  LoadTestPage("files/push_messaging/subscope2/test.html");
+  LoadTestPage("/push_messaging/subscope2/test.html");
   TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */);
   PushMessagingAppIdentifier sw2_identifier =
       GetAppIdentifierForServiceWorkerRegistration(2LL);
   EXPECT_EQ(sw2_identifier.app_id(), gcm_service()->last_registered_app_id());
 
-  LoadTestPage("files/push_messaging/subscope1/test.html");
+  LoadTestPage("/push_messaging/subscope1/test.html");
   TryToSubscribeSuccessfully("1-2" /* expected_push_subscription_id */);
   PushMessagingAppIdentifier sw1_identifier =
       GetAppIdentifierForServiceWorkerRegistration(1LL);
@@ -413,11 +410,11 @@
   // test server uses random port numbers for each test (even PRE_Foo and Foo),
   // so we wouldn't be able to load the test pages with the same origin.
 
-  LoadTestPage("files/push_messaging/subscope1/test.html");
+  LoadTestPage("/push_messaging/subscope1/test.html");
   TryToSubscribeSuccessfully("1-2" /* expected_push_subscription_id */);
   EXPECT_EQ(sw1_identifier.app_id(), gcm_service()->last_registered_app_id());
 
-  LoadTestPage("files/push_messaging/subscope2/test.html");
+  LoadTestPage("/push_messaging/subscope2/test.html");
   TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */);
   EXPECT_EQ(sw1_identifier.app_id(), gcm_service()->last_registered_app_id());
 
@@ -856,7 +853,7 @@
   push_service()->SetContentSettingChangedCallbackForTesting(
       message_loop_runner->QuitClosure());
 
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
       ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
                           ContentSettingsPattern::FromURLNoWildcard(origin),
@@ -890,7 +887,7 @@
   push_service()->SetContentSettingChangedCallbackForTesting(
       message_loop_runner->QuitClosure());
 
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
       ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
                           ContentSettingsPattern::FromURLNoWildcard(origin),
@@ -953,7 +950,7 @@
   push_service()->SetContentSettingChangedCallbackForTesting(
       message_loop_runner->QuitClosure());
 
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
       ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
                           ContentSettingsPattern::Wildcard(),
@@ -987,7 +984,7 @@
   push_service()->SetContentSettingChangedCallbackForTesting(
       message_loop_runner->QuitClosure());
 
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
       ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
                           ContentSettingsPattern::Wildcard(),
@@ -1021,7 +1018,7 @@
   push_service()->SetContentSettingChangedCallbackForTesting(
       base::BarrierClosure(2, message_loop_runner->QuitClosure()));
 
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
       ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
                           ContentSettingsPattern::Wildcard(),
@@ -1065,7 +1062,7 @@
   push_service()->SetContentSettingChangedCallbackForTesting(
       base::BarrierClosure(4, message_loop_runner->QuitClosure()));
 
-  GURL origin = https_server()->GetURL(std::string()).GetOrigin();
+  GURL origin = https_server()->GetURL("/").GetOrigin();
   HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
       ->SetContentSetting(ContentSettingsPattern::Wildcard(),
                           ContentSettingsPattern::Wildcard(),
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
index 648911d0..d1a19c8 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -41,6 +41,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
 #include "net/base/load_flags.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_filter.h"
 #include "net/url_request/url_request_interceptor.h"
@@ -225,8 +226,8 @@
   ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
       content::NotificationService::AllSources());
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL echoheader(test_server()->GetURL("echoheader?Referer"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL echoheader(embedded_test_server()->GetURL("/echoheader?Referer"));
 
   // Go to a |page| with a link to echoheader URL.
   GURL page("data:text/html,<a href='" + echoheader.spec() + "'>link</a>");
@@ -276,8 +277,8 @@
   ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
       content::NotificationService::AllSources());
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL echoheader(test_server()->GetURL("echoheader?Referer"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL echoheader(embedded_test_server()->GetURL("/echoheader?Referer"));
 
   // Go to a |page| with a link to echoheader URL.
   GURL page("data:text/html,<a href='" + echoheader.spec() + "'>link</a>");
@@ -590,12 +591,12 @@
   void SetupAndLoadImagePage(const std::string& image_path) {
     // The test server must start first, so that we know the port that the test
     // server is using.
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
     SetupImageSearchEngine();
 
     // Go to a page with an image in it. The test server doesn't serve the image
     // with the right MIME type, so use a data URL to make a page containing it.
-    GURL image_url(test_server()->GetURL(image_path));
+    GURL image_url(embedded_test_server()->GetURL(image_path));
     GURL page("data:text/html,<img src='" + image_url.spec() + "'>");
     ui_test_utils::NavigateToURL(browser(), page);
   }
@@ -612,14 +613,14 @@
   }
 
   GURL GetImageSearchURL() {
-    static const char kImageSearchURL[] = "imagesearch";
-    return test_server()->GetURL(kImageSearchURL);
+    static const char kImageSearchURL[] = "/imagesearch";
+    return embedded_test_server()->GetURL(kImageSearchURL);
   }
 
  private:
   void SetupImageSearchEngine() {
     static const char kShortName[] = "test";
-    static const char kSearchURL[] = "search?q={searchTerms}";
+    static const char kSearchURL[] = "/search?q={searchTerms}";
     static const char kImageSearchPostParams[] =
         "thumb={google:imageThumbnail}";
 
@@ -632,7 +633,7 @@
     TemplateURLData data;
     data.SetShortName(base::ASCIIToUTF16(kShortName));
     data.SetKeyword(data.short_name());
-    data.SetURL(test_server()->GetURL(kSearchURL).spec());
+    data.SetURL(embedded_test_server()->GetURL(kSearchURL).spec());
     data.image_url = GetImageSearchURL().spec();
     data.image_url_post_params = kImageSearchPostParams;
 
@@ -650,7 +651,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(SearchByImageBrowserTest, ImageSearchWithValidImage) {
-  static const char kValidImage[] = "files/image_search/valid.png";
+  static const char kValidImage[] = "/image_search/valid.png";
   SetupAndLoadImagePage(kValidImage);
 
   ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
@@ -665,7 +666,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(SearchByImageBrowserTest, ImageSearchWithCorruptImage) {
-  static const char kCorruptImage[] = "files/image_search/corrupt.png";
+  static const char kCorruptImage[] = "/image_search/corrupt.png";
   SetupAndLoadImagePage(kCorruptImage);
 
   content::WebContents* tab =
@@ -748,9 +749,10 @@
 class LoadImageBrowserTest : public InProcessBrowserTest {
  protected:
   void SetupAndLoadImagePage(const std::string& image_path) {
+    ASSERT_TRUE(embedded_test_server()->Start());
     // Go to a page with an image in it. The test server doesn't serve the image
     // with the right MIME type, so use a data URL to make a page containing it.
-    GURL image_url(test_server()->GetURL(image_path));
+    GURL image_url(embedded_test_server()->GetURL(image_path));
     GURL page("data:text/html,<img src='" + image_url.spec() + "'>");
     ui_test_utils::NavigateToURL(browser(), page);
   }
@@ -762,7 +764,7 @@
         content::BrowserThread::IO, FROM_HERE,
         base::Bind(&LoadImageBrowserTest::AddInterceptorForURL,
                    base::Unretained(this),
-                   GURL(test_server()->GetURL(image_path).spec()),
+                   GURL(embedded_test_server()->GetURL(image_path).spec()),
                    base::Passed(&owned_interceptor)));
   }
 
@@ -791,7 +793,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) {
-  static const char kValidImage[] = "files/load_image/image.png";
+  static const char kValidImage[] = "/load_image/image.png";
   SetupAndLoadImagePage(kValidImage);
   AddLoadImageInterceptor(kValidImage);
   AttemptLoadImage();
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc
index 61829da..081cd65 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc
@@ -105,7 +105,7 @@
 
     embedded_test_server()->RegisterRequestHandler(
         base::Bind(&HandleTestRequest));
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     // Tell chrome that this is our DM server.
     dm_url_ = embedded_test_server()->GetURL("/DeviceManagement");
 
diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
index af6a727..774a1ee 100644
--- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
+++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
@@ -551,7 +551,7 @@
   }
 
   void SetUpOnMainThread() override {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     // Set up the server and get the test pages.
     base::FilePath test_data_dir;
diff --git a/chrome/browser/repost_form_warning_browsertest.cc b/chrome/browser/repost_form_warning_browsertest.cc
index 0a17796..e594e678 100644
--- a/chrome/browser/repost_form_warning_browsertest.cc
+++ b/chrome/browser/repost_form_warning_browsertest.cc
@@ -13,7 +13,7 @@
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/test_navigation_observer.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using web_modal::WebContentsModalDialogManager;
 
@@ -21,11 +21,11 @@
 
 // If becomes flaky, disable on Windows and use http://crbug.com/47228
 IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestDoubleReload) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Load a form.
-  ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/form.html"));
+  ui_test_utils::NavigateToURL(browser(),
+                               embedded_test_server()->GetURL("/form.html"));
   // Submit it.
   ui_test_utils::NavigateToURL(
       browser(),
@@ -43,7 +43,8 @@
   EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive());
 
   // Navigate away from the page (this is when the test usually crashes).
-  ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("bar"));
+  ui_test_utils::NavigateToURL(browser(),
+                               embedded_test_server()->GetURL("/bar"));
 
   // The dialog should've been closed.
   EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
@@ -51,11 +52,11 @@
 
 // If becomes flaky, disable on Windows and use http://crbug.com/47228
 IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Load a form.
-  ui_test_utils::NavigateToURL(
-      browser(), test_server()->GetURL("files/form.html"));
+  ui_test_utils::NavigateToURL(browser(),
+                               embedded_test_server()->GetURL("/form.html"));
   // Submit it.
   ui_test_utils::NavigateToURL(
       browser(),
@@ -73,8 +74,8 @@
       chrome::NOTIFICATION_AUTH_NEEDED,
       content::Source<content::NavigationController>(&controller));
   browser()->OpenURL(content::OpenURLParams(
-        test_server()->GetURL("auth-basic"), content::Referrer(), CURRENT_TAB,
-        ui::PAGE_TRANSITION_TYPED, false));
+      embedded_test_server()->GetURL("/auth-basic"), content::Referrer(),
+      CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
   observer.Wait();
 
   // Try to reload it again.
@@ -85,7 +86,7 @@
   // happen while the auth dialog is up.
   content::TestNavigationObserver navigation_observer(web_contents);
   browser()->OpenURL(content::OpenURLParams(
-        test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB,
-        ui::PAGE_TRANSITION_TYPED, false));
+      embedded_test_server()->GetURL("/bar"), content::Referrer(), CURRENT_TAB,
+      ui::PAGE_TRANSITION_TYPED, false));
   navigation_observer.Wait();
 }
diff --git a/chrome/browser/resources/bookmark_manager/css/bmm.css b/chrome/browser/resources/bookmark_manager/css/bmm.css
index be6e5ed..26883acb 100644
--- a/chrome/browser/resources/bookmark_manager/css/bmm.css
+++ b/chrome/browser/resources/bookmark_manager/css/bmm.css
@@ -345,9 +345,7 @@
   -webkit-appearance: none;
   -webkit-padding-end: 11px;
   -webkit-padding-start: 0;
-  background: transparent
-      url(../../../../../ui/webui/resources/images/drop_down_arrow_black.svg)
-      no-repeat right center;
+  background: transparent no-repeat right center;
   border: 0;
   font: inherit;
   font-weight: bold;
@@ -355,6 +353,13 @@
   padding-top: 0;
 }
 
+[i18n-processed] #folders-button,
+[i18n-processed] #organize-button,
+[i18n-processed] .splitter button {
+  background-image:
+      url(../../../../../ui/webui/resources/images/drop_down_arrow_black.svg);
+}
+
 #folders-button {
   -webkit-margin-start: 16px;
 }
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js
index 37ad129..7b769ce 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js
@@ -356,6 +356,8 @@
           cvox.PlatformUtil.matchesPlatform(value.sequence.platformFilter);
     });
   } catch (e) {
+    console.error('Failed to load key map from JSON');
+    console.error(e);
     return null;
   }
 
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
index 6fbbedc4..bcf68cf 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
@@ -88,6 +88,7 @@
       cvox.ChromeVox.braille.write(
           cvox.NavBraille.fromText(this.msg_('chrome_tab_selected', [title])));
       cvox.ChromeVox.earcons.playEarcon(cvox.Earcon.OBJECT_SELECT);
+      this.refreshAutomationHandler_(tab.id);
     }.bind(this));
   },
 
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/base_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/base_automation_handler.js
index 7888428..02c6aee 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/base_automation_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/base_automation_handler.js
@@ -40,9 +40,6 @@
     valueChanged: this.onValueChanged
   };
 
-  /** @type {boolean} @private */
-  this.isRegistered_ = false;
-
   /** @type {!Object<string, function(AutomationEvent): void>} @private */
   this.listeners_ = {};
 
@@ -62,23 +59,16 @@
       this.node_.addEventListener(eventType, listener, true);
       this.listeners_[eventType] = listener;
     }
-
-    this.isRegistered_ = true;
   },
 
   /**
    * Unregisters listeners.
    */
   unregister: function() {
-    if (!this.isRegistered_)
-      throw new Error('Not registered on node ' + this.node_.toString());
-
     for (var eventType in this.listenerMap_) {
       this.node_.removeEventListener(
           eventType, this.listeners_[eventType], true);
     }
-
-    this.isRegistered_ = false;
   },
 
   /**
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/tabs_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/tabs_automation_handler.js
index ae9fa82..f507215a 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/tabs_automation_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/tabs_automation_handler.js
@@ -10,13 +10,24 @@
 
 goog.require('DesktopAutomationHandler');
 
+goog.scope(function() {
+var EventType = chrome.automation.EventType;
+var RoleType = chrome.automation.RoleType;
+
 /**
- * @param {!chrome.automation.AutomationNode} node
+ * @param {!chrome.automation.AutomationNode} tabRoot
  * @constructor
  * @extends {DesktopAutomationHandler}
  */
-TabsAutomationHandler = function(node) {
-  DesktopAutomationHandler.call(this, node);
+TabsAutomationHandler = function(tabRoot) {
+  DesktopAutomationHandler.call(this, tabRoot);
+
+  if (tabRoot.role != RoleType.rootWebArea)
+    throw new Error('Expected rootWebArea node but got ' + tabRoot.role);
+
+  // When the root is focused, simulate what happens on a load complete.
+  if (tabRoot.state.focused)
+    this.onLoadComplete({target: tabRoot, type: EventType.loadComplete});
 };
 
 TabsAutomationHandler.prototype = {
@@ -25,5 +36,14 @@
   /** @override */
   didHandleEvent_: function(evt) {
     evt.stopPropagation();
+  },
+
+  /** @override */
+  onLoadComplete: function(evt) {
+    global.backgroundObj.refreshMode(evt.target.docUrl);
+    var focused = evt.target.find({state: {focused: true}}) || evt.target;
+    this.onFocus({target: focused, type: EventType.focus});
   }
 };
+
+});  // goog.scope
diff --git a/chrome/browser/resources/engagement/site_engagement.js b/chrome/browser/resources/engagement/site_engagement.js
index 22cef9c..3845129 100644
--- a/chrome/browser/resources/engagement/site_engagement.js
+++ b/chrome/browser/resources/engagement/site_engagement.js
@@ -9,20 +9,24 @@
     'chrome/browser/ui/webui/engagement/site_engagement.mojom',
     'content/public/renderer/service_provider',
 ], function(connection, siteEngagementMojom, serviceProvider) {
-
   return function() {
     var uiHandler = connection.bindHandleToProxy(
         serviceProvider.connectToService(
             siteEngagementMojom.SiteEngagementUIHandler.name),
         siteEngagementMojom.SiteEngagementUIHandler);
 
-    // Populate engagement table.
-    uiHandler.getSiteEngagementInfo().then(function(response) {
-      // Round each score to 2 decimal places.
-      response.info.forEach(function(x) {
-        x.score = Number(Math.round(x.score * 100) / 100);
+    var updateEngagementTable = function() {
+      // Populate engagement table.
+      uiHandler.getSiteEngagementInfo().then(function(response) {
+        // Round each score to 2 decimal places.
+        response.info.forEach(function(x) {
+          x.score = Number(Math.round(x.score * 100) / 100);
+        });
+        $('engagement-table').engagementInfo = response.info;
       });
-      $('engagement-table').engagementInfo = response.info;
-    });
+
+      setTimeout(updateEngagementTable, 2000);
+    };
+    updateEngagementTable();
   };
 });
diff --git a/chrome/browser/resources/plugin_metadata/plugins_linux.json b/chrome/browser/resources/plugin_metadata/plugins_linux.json
index be044fd..940a126c 100644
--- a/chrome/browser/resources/plugin_metadata/plugins_linux.json
+++ b/chrome/browser/resources/plugin_metadata/plugins_linux.json
@@ -1,5 +1,5 @@
 {
-  "x-version": 8,
+  "x-version": 9,
   "google-talk": {
     "mime_types": [
     ],
@@ -80,9 +80,9 @@
     ],
     "versions": [
       {
-        "version": "19.0.0.185",
+        "version": "19.0.0.245",
         "status": "up_to_date",
-        "reference": "https://helpx.adobe.com/security/products/flash-player/apsb15-23.html"
+        "reference": "https://helpx.adobe.com/security/products/flash-player/apsb15-28.html"
       }
     ],
     "lang": "en-US",
diff --git a/chrome/browser/resources/plugin_metadata/plugins_mac.json b/chrome/browser/resources/plugin_metadata/plugins_mac.json
index e921cac..8b8ef6eec 100644
--- a/chrome/browser/resources/plugin_metadata/plugins_mac.json
+++ b/chrome/browser/resources/plugin_metadata/plugins_mac.json
@@ -1,5 +1,5 @@
 {
-  "x-version": 14,
+  "x-version": 15,
   "google-talk": {
     "mime_types": [
     ],
@@ -115,9 +115,9 @@
     ],
     "versions": [
       {
-        "version": "19.0.0.185",
+        "version": "19.0.0.245",
         "status": "requires_authorization",
-        "reference": "https://helpx.adobe.com/security/products/flash-player/apsb15-23.html"
+        "reference": "https://helpx.adobe.com/security/products/flash-player/apsb15-28.html"
       }
     ],
     "lang": "en-US",
diff --git a/chrome/browser/resources/plugin_metadata/plugins_win.json b/chrome/browser/resources/plugin_metadata/plugins_win.json
index 753bebd..da9f9ff5 100644
--- a/chrome/browser/resources/plugin_metadata/plugins_win.json
+++ b/chrome/browser/resources/plugin_metadata/plugins_win.json
@@ -1,5 +1,5 @@
 {
-  "x-version": 23,
+  "x-version": 24,
   "google-talk": {
     "mime_types": [
     ],
@@ -137,9 +137,9 @@
     ],
     "versions": [
       {
-        "version": "19.0.0.185",
+        "version": "19.0.0.245",
         "status": "requires_authorization",
-        "reference": "https://helpx.adobe.com/security/products/flash-player/apsb15-23.html"
+        "reference": "https://helpx.adobe.com/security/products/flash-player/apsb15-28.html"
       }
     ],
     "lang": "en-US",
diff --git a/chrome/browser/resources/settings/a11y_page/a11y_page.html b/chrome/browser/resources/settings/a11y_page/a11y_page.html
index fbea6e3..66688cf 100644
--- a/chrome/browser/resources/settings/a11y_page/a11y_page.html
+++ b/chrome/browser/resources/settings/a11y_page/a11y_page.html
@@ -6,61 +6,63 @@
   <link rel="import" type="css" href="chrome://md-settings/settings_page/settings_page.css">
   <link rel="import" type="css" href="a11y_page.css">
   <template>
-    <span i18n-content="a11yExplanation"></span>
-    <a i18n-values="href:a11yLearnMoreUrl" i18n-content="learnMore"
-        target="_blank"></a>
+    <div class="settings-box">
+      <span i18n-content="a11yExplanation"></span>
+      <a i18n-values="href:a11yLearnMoreUrl" i18n-content="learnMore"
+          target="_blank"></a>
 
-    <settings-checkbox i18n-values="label:optionsInMenuLabel"
-        pref="{{prefs.settings.a11y.enable_menu}}">
-    </settings-checkbox>
-    <settings-checkbox i18n-values="label:largeMouseCursorLabel"
-        pref="{{prefs.settings.a11y.large_cursor_enabled}}">
-    </settings-checkbox>
-    <settings-checkbox i18n-values="label:highContrastLabel"
-        pref="{{prefs.settings.a11y.high_contrast_enabled}}">
-    </settings-checkbox>
-    <settings-checkbox
-        pref="{{prefs.settings.a11y.sticky_keys_enabled}}"
-        i18n-values="label:stickyKeysLabel">
-    </settings-checkbox>
-    <settings-checkbox pref="{{prefs.settings.accessibility}}"
-        i18n-values="label:chromeVoxLabel">
-    </settings-checkbox>
-    <settings-checkbox i18n-values="label:screenMagnifierLabel"
-        pref="{{prefs.settings.a11y.screen_magnifier}}">
-    </settings-checkbox>
-    <settings-checkbox i18n-values="label:tapDraggingLabel"
-        pref="{{prefs.settings.touchpad.enable_tap_dragging}}">
-    </settings-checkbox>
-    <settings-checkbox i18n-values="label:clickOnStopLabel"
-        pref="{{prefs.settings.a11y.autoclick}}">
-    </settings-checkbox>
+      <settings-checkbox i18n-values="label:optionsInMenuLabel"
+          pref="{{prefs.settings.a11y.enable_menu}}">
+      </settings-checkbox>
+      <settings-checkbox i18n-values="label:largeMouseCursorLabel"
+          pref="{{prefs.settings.a11y.large_cursor_enabled}}">
+      </settings-checkbox>
+      <settings-checkbox i18n-values="label:highContrastLabel"
+          pref="{{prefs.settings.a11y.high_contrast_enabled}}">
+      </settings-checkbox>
+      <settings-checkbox
+          pref="{{prefs.settings.a11y.sticky_keys_enabled}}"
+          i18n-values="label:stickyKeysLabel">
+      </settings-checkbox>
+      <settings-checkbox pref="{{prefs.settings.accessibility}}"
+          i18n-values="label:chromeVoxLabel">
+      </settings-checkbox>
+      <settings-checkbox i18n-values="label:screenMagnifierLabel"
+          pref="{{prefs.settings.a11y.screen_magnifier}}">
+      </settings-checkbox>
+      <settings-checkbox i18n-values="label:tapDraggingLabel"
+          pref="{{prefs.settings.touchpad.enable_tap_dragging}}">
+      </settings-checkbox>
+      <settings-checkbox i18n-values="label:clickOnStopLabel"
+          pref="{{prefs.settings.a11y.autoclick}}">
+      </settings-checkbox>
 
-    <div class="autoclick-delay-label"
-        hidden$="[[!prefs.settings.a11y.autoclick]]">
-      <span i18n-content="delayBeforeClickLabel"></span>
-      <select id="autoclickDropdown"
-          value="{{prefs.settings.a11y.autoclick_delay_ms::change}}">
-        <option value="200" i18n-content="delayBeforeClickExtremelyShort">
-        </option>
-        <option value="400" i18n-content="delayBeforeClickVeryShort">
-        </option>
-        <option value="600" i18n-content="delayBeforeClickShort">
-        </option>
-        <option value="800" i18n-content="delayBeforeClickLong">
-        </option>
-        <option value="1000" i18n-content="delayBeforeClickVeryLong">
-        </option>
-      </select>
-    </div>
+      <div class="autoclick-delay-label"
+          hidden$="[[!prefs.settings.a11y.autoclick]]">
+        <span i18n-content="delayBeforeClickLabel"></span>
+        <select id="autoclickDropdown"
+            value="{{prefs.settings.a11y.autoclick_delay_ms::change}}">
+          <option value="200" i18n-content="delayBeforeClickExtremelyShort">
+          </option>
+          <option value="400" i18n-content="delayBeforeClickVeryShort">
+          </option>
+          <option value="600" i18n-content="delayBeforeClickShort">
+          </option>
+          <option value="800" i18n-content="delayBeforeClickLong">
+          </option>
+          <option value="1000" i18n-content="delayBeforeClickVeryLong">
+          </option>
+        </select>
+      </div>
 
-    <settings-checkbox pref="{{prefs.settings.a11y.virtual_keyboard}}"
-        i18n-values="label:onScreenKeyboardLabel">
-    </settings-checkbox>
+      <settings-checkbox pref="{{prefs.settings.a11y.virtual_keyboard}}"
+          i18n-values="label:onScreenKeyboardLabel">
+      </settings-checkbox>
 
-    <div class="button-strip">
-      <paper-button i18n-content="moreFeaturesLink"
-          on-tap="onMoreFeaturesTap_"></paper-button>
+      <div class="button-strip">
+        <paper-button i18n-content="moreFeaturesLink"
+            on-tap="onMoreFeaturesTap_"></paper-button>
+      </div>
     </div>
   </template>
   <script src="a11y_page.js"></script>
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html b/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
index 807d57e..1f082ab9 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
+++ b/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
@@ -9,7 +9,7 @@
       href="chrome://md-settings/appearance_page/appearance_shared.css">
   <template>
     <div>[[selectedStandardFont_]]</div>
-    <div class="control-row">
+    <div class="settings-box">
       <div i18n-content="fontSize"></div>
       <paper-slider id="sizeSlider" value="{{fontSizeIndex_}}"
           max="[[fontSizeRangeLimit_]]"
@@ -17,74 +17,73 @@
           on-immediate-value-change="immediateSizeIndexChanged_">
       </paper-slider>
     </div>
-    <div class="control-row">
+    <div class="settings-box">
       <settings-dropdown-menu id="standardFont"
           i18n-values="label:standardFont"
           pref="{{prefs.webkit.webprefs.fonts.standard.Zyyy}}"
           menuOptions="[[fontOptions_]]">
       </settings-dropdown-menu>
-      <div class="control-column"
+      <div class="settings-column"
           style$="[[computeStyle_(defaultFontSize_,
               prefs.webkit.webprefs.fonts.standard.Zyyy.value)]]">
         <span>[[defaultFontSize_]]</span>:
         <span i18n-content="loremIpsum"></span>
       </div>
     </div>
-    <div class="control-row">
+    <div class="settings-box">
       <settings-dropdown-menu id="serifFont"
           i18n-values="label:serifFont"
           pref="{{prefs.webkit.webprefs.fonts.serif.Zyyy}}"
           menuOptions="[[fontOptions_]]">
       </settings-dropdown-menu>
-      <div class="control-column"
+      <div class="settings-column"
           style$="[[computeStyle_(defaultFontSize_,
               prefs.webkit.webprefs.fonts.serif.Zyyy.value)]]">
         <span>[[defaultFontSize_]]</span>:
         <span i18n-content="loremIpsum"></span>
       </div>
     </div>
-    <div class="control-row">
+    <div class="settings-box">
       <settings-dropdown-menu id="sansSerifFont"
           i18n-values="label:sansSerifFont"
           pref="{{prefs.webkit.webprefs.fonts.sansserif.Zyyy}}"
           menuOptions="[[fontOptions_]]">
       </settings-dropdown-menu>
-      <div class="control-column"
+      <div class="settings-column"
           style$="{{computeStyle_(defaultFontSize_,
               prefs.webkit.webprefs.fonts.sansserif.Zyyy.value)}}">
         <span>[[defaultFontSize_]]</span>:
         <span i18n-content="loremIpsum"></span>
       </div>
     </div>
-    <div class="control-row">
+    <div class="settings-box">
       <settings-dropdown-menu id="fixedFont"
           i18n-values="label:fixedWidthFont"
           pref="{{prefs.webkit.webprefs.fonts.fixed.Zyyy}}"
           menuOptions="[[fontOptions_]]">
       </settings-dropdown-menu>
-      <div class="control-column"
+      <div class="settings-column"
           style$="[[computeStyle_(defaultFontSize_,
               prefs.webkit.webprefs.fonts.fixed.Zyyy.value)]]">
         <span i18n-content="loremIpsum"></span>
       </div>
     </div>
-    <div class="control-row">
-      <div class="control-column">
-        <div class="control-title" i18n-content="minimumFont"></div>
+    <div class="settings-box">
+      <div>
+        <div i18n-content="minimumFont"></div>
         <paper-slider id="minimumSizeSlider" value="{{minimumSizeIndex_}}"
             max="[[minimumFontSizeRangeLimit_]]"
             immediate-value="{{immediateMinimumSizeIndex_}}"
             on-immediate-value-change="immediateMinimumSizeIndexChanged_">
         </paper-slider>
       </div>
-      <div class="control-column"
-          style$="[[computeStyle_(minimumFontSize_,
+      <div style$="[[computeStyle_(minimumFontSize_,
               prefs.webkit.webprefs.fonts.standard.Zyyy.value)]]">
         <span>[[minimumFontSize_]]</span>:
         <span i18n-content="loremIpsum"></span>
       </div>
     </div>
-    <div class="control-row">
+    <div class="settings-box">
       <settings-dropdown-menu id="encoding"
           i18n-values="label:encoding"
           pref="{{prefs.intl.charset_default}}"
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.html b/chrome/browser/resources/settings/appearance_page/appearance_page.html
index 5a36a7095..185bb3d 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.html
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.html
@@ -23,32 +23,30 @@
     <settings-animated-pages id="pages" current-route="{{currentRoute}}"
         section="appearance">
       <neon-animatable id="main">
-        <div class="settings-row">
-          <div>
+        <div class="settings-box split">
+          <div class="start">
             <iron-icon icon="image:brightness-1"></iron-icon>
             <paper-button i18n-content="setWallpaper"></paper-button>
           </div>
           <iron-icon icon="exit-to-app" disabled></iron-icon>
         </div>
-        <div class="settings-row">
-          <div>
+        <div class="settings-box split">
+          <div class="start">
             <iron-icon icon="image:brightness-1"></iron-icon>
             <paper-button id="get-themes"
                 on-tap="openThemesGallery_"
                 >[[i18n('getThemes')]]</paper-button>
           </div>
-          <div>
-            <template is="dom-if" if="[[!allowResetTheme_]]">
-              <iron-icon icon="exit-to-app"></iron-icon>
-            </template>
-            <template is="dom-if" if="[[allowResetTheme_]]">
-              <paper-button on-tap="resetTheme_"
-                  >[[i18n('resetToDefaultTheme')]]</paper-button>
-            </template>
-          </div>
+          <template is="dom-if" if="[[!allowResetTheme_]]">
+            <iron-icon icon="exit-to-app"></iron-icon>
+          </template>
+          <template is="dom-if" if="[[allowResetTheme_]]">
+            <paper-button on-tap="resetTheme_"
+                >[[i18n('resetToDefaultTheme')]]</paper-button>
+          </template>
         </div>
-        <div class="settings-row">
-          <div i18n-content="showHomeButton"></div>
+        <div class="settings-box split">
+          <div class="start" i18n-content="showHomeButton"></div>
           <paper-toggle-button
               checked="{{prefs.browser.show_home_button.value}}">
           </paper-toggle-button>
@@ -66,26 +64,26 @@
             </settings-input>
           </div>
         </template>
-        <div class="settings-row">
-          <div i18n-content="showBookmarksBar"></div>
+        <div class="settings-box split">
+          <div class="start" i18n-content="showBookmarksBar"></div>
           <paper-toggle-button
               checked="{{prefs.bookmark_bar.show_on_all_tabs.value}}">
           </paper-toggle-button>
         </div>
-        <div class="settings-row">
-          <div i18n-content="fontSize"></div>
+        <div class="settings-box split">
+          <div class="start" i18n-content="fontSize"></div>
           <settings-dropdown-menu id="defaultFontSize" disabled
               pref="{{prefs.webkit.webprefs.default_font_size}}"
               menuOptions="[[fontSizeOptions_]]">
           </settings-dropdown-menu>
         </div>
-        <div class="settings-row">
-          <div class="flex" i18n-content="customizeFonts"></div>
+        <div class="settings-box split">
+          <div class="start" i18n-content="customizeFonts"></div>
           <paper-button on-tap="onCustomizeFontsTap_"
               i18n-content="customizeFonts"></paper-button>
         </div>
-        <div class="settings-row">
-          <div i18n-content="pageZoom"></div>
+        <div class="settings-box split">
+          <div class="start" i18n-content="pageZoom"></div>
           <settings-dropdown-menu id="pageZoom" disabled
               pref="{{prefs.partition.default_zoom_level}}"
               menuOptions="[[pageZoomOptions_]]">
diff --git a/chrome/browser/resources/settings/clear_browsing_data_page/clear_browsing_data_page.html b/chrome/browser/resources/settings/clear_browsing_data_page/clear_browsing_data_page.html
index 9bb75b19..218673ade 100644
--- a/chrome/browser/resources/settings/clear_browsing_data_page/clear_browsing_data_page.html
+++ b/chrome/browser/resources/settings/clear_browsing_data_page/clear_browsing_data_page.html
@@ -11,66 +11,49 @@
       href="chrome://md-settings/settings_page/settings_page.css">
   <link rel="import" type="css" href="clear_browsing_data_page.css">
   <template>
-    <div class="settings-row">
+    <div class="settings-box">
       <span i18n-content="clearFollowingItemsFrom"></span>
       <settings-dropdown-menu id="clearFrom"
           pref="{{prefs.browser.clear_data.time_period}}"
           menuOptions="[[clearFromOptions_]]" disabled>
       </settings-dropdown-menu>
-    </div>
-    <div class="settings-row">
       <settings-checkbox id="browsingCheckbox"
           pref="{{prefs.browser.clear_data.browsing_history}}"
           i18n-values="label:clearBrowsingHistory">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox id="downloadCheckbox"
           pref="{{prefs.browser.clear_data.download_history}}"
           i18n-values="label:clearDownloadHistory">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox
           pref="{{prefs.browser.clear_data.cache}}"
           i18n-values="label:clearCache">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox
           pref="{{prefs.browser.clear_data.cookies}}"
           i18n-values="label:clearCookies">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox
           pref="{{prefs.browser.clear_data.passwords}}"
           i18n-values="label:clearPasswords">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox
           pref="{{prefs.browser.clear_data.form_data}}"
           i18n-values="label:clearFormData">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox
           pref="{{prefs.browser.clear_data.hosted_apps_data}}"
           i18n-values="label:clearHostedAppData">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
       <settings-checkbox
           pref="{{prefs.browser.clear_data.content_licenses}}"
           i18n-values="label:clearDeauthorizeContentLicenses">
       </settings-checkbox>
-    </div>
-    <div class="settings-row">
+    </settings-box>
       <span i18n-content="warnAboutNonClearedData"></span>
       <span i18n-content="clearsSyncedData"></span>
-    </div>
-    <div class="settings-row">
+    </settings-box>
+    <settings-box>
       <paper-button id="clearDataButton"
           on-tap="onPerformClearBrowsingDataTap_"
           raised i18n-content="clearBrowsingData">
diff --git a/chrome/browser/resources/settings/default_browser_page/default_browser_page.html b/chrome/browser/resources/settings/default_browser_page/default_browser_page.html
index 0e7c01582..ae5c6857 100644
--- a/chrome/browser/resources/settings/default_browser_page/default_browser_page.html
+++ b/chrome/browser/resources/settings/default_browser_page/default_browser_page.html
@@ -8,15 +8,17 @@
       href="chrome://md-settings/settings_page/settings_page.css">
   <link rel="import" type="css" href="default_browser_page.css">
   <template>
-    <div>[[message_]]</div>
-    <template is="dom-if" if="[[showButton_]]">
-      <paper-button on-tap="onSetDefaultBrowserTap_"
-          >[[i18n('defaultBrowserMakeDefault')]]</paper-button>
-      <template is="dom-if" if="[[showError_]]">
-        <iron-icon icon="error" class="error-icon"
-            title="[[i18n('unableToSetDefaultBrowser')]]"></iron-icon>
+    <div class="settings-box">[[message_]]</div>
+    <div class="settings-box">
+      <template is="dom-if" if="[[showButton_]]">
+        <paper-button on-tap="onSetDefaultBrowserTap_"
+            >[[i18n('defaultBrowserMakeDefault')]]</paper-button>
+        <template is="dom-if" if="[[showError_]]">
+          <iron-icon icon="error" class="error-icon"
+              title="[[i18n('unableToSetDefaultBrowser')]]"></iron-icon>
+        </template>
       </template>
-    </template>
+    </div>
   </template>
   <script src="default_browser_page.js"></script>
 </dom-module>
diff --git a/chrome/browser/resources/settings/downloads_page/downloads_page.html b/chrome/browser/resources/settings/downloads_page/downloads_page.html
index 45b1ccd7..bb3fb94 100644
--- a/chrome/browser/resources/settings/downloads_page/downloads_page.html
+++ b/chrome/browser/resources/settings/downloads_page/downloads_page.html
@@ -9,8 +9,8 @@
       href="chrome://md-settings/settings_page/settings_page.css">
   <link rel="import" type="css" href="downloads_page.css">
   <template>
-    <div class="horizontal layout center">
-      <div class="layout horizontal center">
+    <div class="settings-box split">
+      <div class="start layout horizontal center">
         <div id="locationLabel" i18n-content="downloadLocation"></div>
         <settings-input id="downloadsPath" no-label-float readonly
             pref="{{prefs.download.default_directory}}"
@@ -21,9 +21,11 @@
           i18n-content="changeDownloadLocation">
       </paper-button>
     </div>
-    <settings-checkbox pref="{{prefs.download.prompt_for_download}}"
-        i18n-values="label:promptForDownload">
-    </settings-checkbox>
+    <div class="settings-box">
+      <settings-checkbox pref="{{prefs.download.prompt_for_download}}"
+          i18n-values="label:promptForDownload">
+      </settings-checkbox>
+    </div>
   </template>
   <script src="downloads_page.js"></script>
 </dom-module>
diff --git a/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html b/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
index 26676a2..3d1dc31 100644
--- a/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
+++ b/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
@@ -11,24 +11,26 @@
   <link rel="import" type="css" href="chrome://md-settings/settings_page/settings_page.css">
   <link rel="import" type="css" href="edit_dictionary_page.css">
   <template>
-    <div id="addWordRow">
-      <iron-a11y-keys id="keys" keys="enter esc"
-          on-keys-pressed="onKeysPress_"></iron-a11y-keys>
-      <paper-input id="newWord" no-label-float
-          i18n-values="label:addDictionaryWordLabel"></paper-input>
-      <paper-button on-tap="onAddWordTap_"
-          i18n-content="addDictionaryWordButton"></paper-button>
+    <div class="settings-box">
+      <div id="addWordRow">
+        <iron-a11y-keys id="keys" keys="enter esc"
+            on-keys-pressed="onKeysPress_"></iron-a11y-keys>
+        <paper-input id="newWord" no-label-float
+            i18n-values="label:addDictionaryWordLabel"></paper-input>
+        <paper-button on-tap="onAddWordTap_"
+            i18n-content="addDictionaryWordButton"></paper-button>
+      </div>
+      <h2 i18n-content="customDictionaryWords"></h2>
+      <iron-list id="list" items="{{words_}}">
+        <template>
+          <paper-item>
+            <div class="word">[[item]]</div>
+            <paper-icon-button icon="clear" on-tap="onRemoveWordTap_">
+            </paper-icon-button>
+          </paper-item>
+        </template>
+      </iron-list>
     </div>
-    <h2 i18n-content="customDictionaryWords"></h2>
-    <iron-list id="list" items="{{words_}}">
-      <template>
-        <paper-item>
-          <div class="word">[[item]]</div>
-          <paper-icon-button icon="clear" on-tap="onRemoveWordTap_">
-          </paper-icon-button>
-        </paper-item>
-      </template>
-    </iron-list>
   </template>
   <script src="edit_dictionary_page.js"></script>
 </dom-module>
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.html b/chrome/browser/resources/settings/languages_page/languages_page.html
index 38a6e52..8d42d7f 100644
--- a/chrome/browser/resources/settings/languages_page/languages_page.html
+++ b/chrome/browser/resources/settings/languages_page/languages_page.html
@@ -28,59 +28,61 @@
     <settings-animated-pages id="pages" current-route="{{currentRoute}}"
         section="languages">
       <neon-animatable id="main">
-        <h2 i18n-content="languagesListTitle"></h2>
-        <div>
-          <array-selector id="languageSelector" selected="{{detailLanguage}}"
-              items="{{languages.enabledLanguages}}"></array-selector>
-          <template is="dom-repeat" items="{{languages.enabledLanguages}}">
-            <paper-item class="settings-row" on-tap="onLanguageTap_">
-              <div class="flex" title="[[item.language.nativeDisplayName]]"
-                  >[[item.language.displayName]]</div>
-              <iron-icon icon="done"
-                  hidden$="[[!isUILanguage_(item.language.code, prefs.intl.app_locale.value)]]">
-              </iron-icon>
-              <paper-icon-button icon="settings"
-                  on-tap="onShowLanguageDetailTap_"></paper-icon-button>
-            </paper-item>
-          </template>
-        </div>
-        <div class="manage">
-          <paper-button i18n-content="manageLanguages"
-              on-tap="onManageLanguagesTap_"></paper-button>
-        </div>
+        <div class="settings-box">
+          <h2 i18n-content="languagesListTitle"></h2>
+          <div>
+            <array-selector id="languageSelector" selected="{{detailLanguage}}"
+                items="{{languages.enabledLanguages}}"></array-selector>
+            <template is="dom-repeat" items="{{languages.enabledLanguages}}">
+              <paper-item class="split" on-tap="onLanguageTap_">
+                <div class="flex" title="[[item.language.nativeDisplayName]]"
+                    >[[item.language.displayName]]</div>
+                <iron-icon icon="done"
+                    hidden$="[[!isUILanguage_(item.language.code, prefs.intl.app_locale.value)]]">
+                </iron-icon>
+                <paper-icon-button icon="settings"
+                    on-tap="onShowLanguageDetailTap_"></paper-icon-button>
+              </paper-item>
+            </template>
+          </div>
+          <div class="manage">
+            <paper-button i18n-content="manageLanguages"
+                on-tap="onManageLanguagesTap_"></paper-button>
+          </div>
 <if expr="chromeos">
-        <h2 i18n-content="inputMethodsListTitle"></h2>
-        <div>
-          <template is="dom-repeat" items="{{languages.inputMethods}}">
-            <paper-item class="settings-row">
-              <div class="flex">[[item.name]]</div>
-              <iron-icon icon="done"
-                  hidden$="[[
-                      !isCurrentInputMethod_(item.id, languages.currentInputMethod)]]">
-              </iron-icon>
-              <paper-icon-button icon="settings"></paper-icon-button>
-            </paper-item>
-          </template>
-        </div>
-        <div class="manage">
-          <paper-button i18n-content="manageInputMethods"></paper-button>
-        </div>
+          <h2 i18n-content="inputMethodsListTitle"></h2>
+          <div>
+            <template is="dom-repeat" items="{{languages.inputMethods}}">
+              <paper-item class="split">
+                <div class="flex">[[item.name]]</div>
+                <iron-icon icon="done"
+                    hidden$="[[
+                        !isCurrentInputMethod_(item.id, languages.currentInputMethod)]]">
+                </iron-icon>
+                <paper-icon-button icon="settings"></paper-icon-button>
+              </paper-item>
+            </template>
+          </div>
+          <div class="manage">
+            <paper-button i18n-content="manageInputMethods"></paper-button>
+          </div>
 </if>
 <if expr="not is_macosx">
-        <h2 i18n-content="spellCheckListTitle"></h2>
-        <div class="layout vertical">
-          <template is="dom-repeat" items="{{languages.enabledLanguages}}">
-            <paper-checkbox hidden="[[!item.language.supportsSpellcheck]]"
-                checked="[[item.state.spellCheckEnabled]]"
-                on-change="onSpellCheckChange_"
-                >[[item.language.displayName]]</paper-checkbox>
-          </template>
-        </div>
-        <div class="manage">
-          <paper-button i18n-content="manageSpellCheck"
-              on-tap="onEditDictionaryTap_"></paper-button>
-        </div>
+          <h2 i18n-content="spellCheckListTitle"></h2>
+          <div class="layout vertical">
+            <template is="dom-repeat" items="{{languages.enabledLanguages}}">
+              <paper-checkbox hidden="[[!item.language.supportsSpellcheck]]"
+                  checked="[[item.state.spellCheckEnabled]]"
+                  on-change="onSpellCheckChange_"
+                  >[[item.language.displayName]]</paper-checkbox>
+            </template>
+          </div>
+          <div class="manage">
+            <paper-button i18n-content="manageSpellCheck"
+                on-tap="onEditDictionaryTap_"></paper-button>
+          </div>
 </if>
+        </div>
       </neon-animatable>
       <neon-animatable id="manage-languages">
         <settings-subheader i18n-values="page-title:manageLanguagesPageTitle">
diff --git a/chrome/browser/resources/settings/languages_page/manage_languages_page.html b/chrome/browser/resources/settings/languages_page/manage_languages_page.html
index aa11497..5051ce5 100644
--- a/chrome/browser/resources/settings/languages_page/manage_languages_page.html
+++ b/chrome/browser/resources/settings/languages_page/manage_languages_page.html
@@ -16,11 +16,11 @@
   <template>
     <settings-languages id="languages" languages="{{languages}}">
     </settings-languages>
-    <div class="content">
+    <div class="settings-box content">
       <h2 i18n-content="enabledLanguages"></h2>
       <div>
         <template is="dom-repeat" items="{{languages.enabledLanguages}}">
-          <paper-item class="settings-row">
+          <paper-item class="split">
             <div class="language-name"
                 title="[[item.language.nativeDisplayName]]"
                 >[[item.language.displayName]]</div>
diff --git a/chrome/browser/resources/settings/on_startup_page/on_startup_page.html b/chrome/browser/resources/settings/on_startup_page/on_startup_page.html
index 7df7904..1d823303 100644
--- a/chrome/browser/resources/settings/on_startup_page/on_startup_page.html
+++ b/chrome/browser/resources/settings/on_startup_page/on_startup_page.html
@@ -15,8 +15,8 @@
     <settings-animated-pages id="pages" current-route="{{currentRoute}}"
         section="on-startup">
       <neon-animatable id="main">
-        <div id="locationLabel" i18n-content="onStartup"></div>
-        <div>
+        <div class="settings-box">
+          <div id="locationLabel" i18n-content="onStartup"></div>
           <settings-radio-group pref="{{prefs.session.restore_on_startup}}">
             <paper-radio-button name="[[prefValues_.OPEN_NEW_TAB]]"
                 i18n-content="onStartupOpenNewTab">
@@ -28,6 +28,8 @@
               <span i18n-content="onStartupOpenSpecific"></span>
             </paper-radio-button>
           </settings-radio-group>
+        </div>
+        <div class="settings-box">
           <paper-button
               on-tap="onSetPagesTap_" raised i18n-content="onStartupSetPages">
           </paper-button>
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html
index e34f683..a4e3a771 100644
--- a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html
@@ -6,7 +6,7 @@
   <link rel="import" type="css" href="chrome://md-settings/settings_page/settings_page.css">
   <link rel="import" type="css" href="on_startup_shared.css">
   <template>
-    <div>
+    <div class="settings-box">
       <div class="entries">
         <template is="dom-repeat" items="{{prefs.session.startup_urls.value}}">
           <paper-icon-item>
@@ -17,21 +17,23 @@
           </paper-icon-item>
         </template>
       </div>
-      <paper-icon-item>
+    </div>
+    <div class="settings-box">
+      <paper-icon-item class="start">
         <div i18n-content="onStartupAddPage"></div>&nbsp;
         <paper-input class="flex" no-label-float
             i18n-values="label:onStartupEnterUrl" value="{{newUrl}}">
         </paper-input>
       </paper-icon-item>
-      <div class="button-row">
-        <div class="flex">
-          <paper-button on-tap="onUseCurrentPagesTap_"
-              i18n-content="onStartupUseCurrent">
-          </paper-button>
-        </div>
-        <paper-button on-tap="onCancelTap_" i18n-content="cancelButton">
-        </paper-button>
-        <paper-button on-tap="onOkTap_" raised i18n-content="okButton">
+      <paper-button on-tap="onCancelTap_" i18n-content="cancelButton">
+      </paper-button>
+      <paper-button on-tap="onOkTap_" raised i18n-content="okButton">
+      </paper-button>
+    </div>
+    <div class="settings-box">
+      <div class="flex">
+        <paper-button on-tap="onUseCurrentPagesTap_"
+            i18n-content="onStartupUseCurrent">
         </paper-button>
       </div>
     </div>
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html
index 47c54a4..aa649e80 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html
@@ -7,14 +7,16 @@
   <link rel="import" type="css"
       href="chrome://md-settings/passwords_and_forms_page/passwords_and_forms_page.css">
   <template>
-    <paper-item-body two-line class="flex">
-      <div i18n-content="autofill"></div>
-      <div class="option-value" i18n-content="autofillDetail"></div>
-    </paper-item>
-    <paper-item-body two-line class="flex">
-      <div i18n-content="passwords"></div>
-      <div class="option-value" i18n-content="passwordsDetail"></div>
-    </paper-item>
+    <div class="settings-box">
+      <paper-item-body two-line class="flex">
+        <div i18n-content="autofill"></div>
+        <div class="option-value" i18n-content="autofillDetail"></div>
+      </paper-item>
+      <paper-item-body two-line class="flex">
+        <div i18n-content="passwords"></div>
+        <div class="option-value" i18n-content="passwordsDetail"></div>
+      </paper-item>
+    </div>
   </template>
   <script src="passwords_and_forms_page.js"></script>
 </dom-module>
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
index 4eaabd0..a679f1a 100644
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -18,55 +18,57 @@
     <settings-animated-pages id="pages" current-route="{{currentRoute}}"
         section="privacy">
       <neon-animatable id="main">
-        <p class="privacy-explanation"
-            i18n-values=".innerHTML:improveBrowsingExperience">
-        </p>
-        <settings-checkbox
-            pref="{{prefs.alternate_error_pages.enabled}}"
-            i18n-values="label:linkDoctorPref">
-        </settings-checkbox>
-        <settings-checkbox
-            pref="{{prefs.search.suggest_enabled}}"
-            i18n-values="label:searchSuggestPref">
-        </settings-checkbox>
-        <settings-checkbox
-            pref="{{prefs.net.network_prediction_options}}"
-            i18n-values="label:networkPredictionEnabled">
-        </settings-checkbox>
-        <settings-checkbox
-            pref="{{prefs.safebrowsing.extended_reporting_enabled}}"
-            i18n-values="label:safeBrowsingEnableExtendedReporting">
-        </settings-checkbox>
-        <settings-checkbox pref="{{prefs.safebrowsing.enabled}}"
-            i18n-values="label:safeBrowsingEnableProtection">
-        </settings-checkbox>
+        <div class="settings-box">
+          <p class="privacy-explanation"
+              i18n-values=".innerHTML:improveBrowsingExperience">
+          </p>
+          <settings-checkbox
+              pref="{{prefs.alternate_error_pages.enabled}}"
+              i18n-values="label:linkDoctorPref">
+          </settings-checkbox>
+          <settings-checkbox
+              pref="{{prefs.search.suggest_enabled}}"
+              i18n-values="label:searchSuggestPref">
+          </settings-checkbox>
+          <settings-checkbox
+              pref="{{prefs.net.network_prediction_options}}"
+              i18n-values="label:networkPredictionEnabled">
+          </settings-checkbox>
+          <settings-checkbox
+              pref="{{prefs.safebrowsing.extended_reporting_enabled}}"
+              i18n-values="label:safeBrowsingEnableExtendedReporting">
+          </settings-checkbox>
+          <settings-checkbox pref="{{prefs.safebrowsing.enabled}}"
+              i18n-values="label:safeBrowsingEnableProtection">
+          </settings-checkbox>
 <if expr="_google_chrome">
-        <settings-checkbox
-            pref="{{prefs.spellcheck.use_spelling_service}}"
-            i18n-values="label:spellingPref">
-        </settings-checkbox>
+          <settings-checkbox
+              pref="{{prefs.spellcheck.use_spelling_service}}"
+              i18n-values="label:spellingPref">
+          </settings-checkbox>
 <if expr="chromeos">
         <settings-checkbox
-            pref="{{prefs.cros.metrics.reportingEnabled}}"
-            i18n-values="label:enableLogging">
-        </settings-checkbox>
+              pref="{{prefs.cros.metrics.reportingEnabled}}"
+              i18n-values="label:enableLogging">
+          </settings-checkbox>
 </if>
-        <!-- TODO(jlklein): Add non-chromeos metrics box. -->
+          <!-- TODO(jlklein): Add non-chromeos metrics box. -->
 </if>
-        <settings-checkbox pref="{{prefs.enable_do_not_track}}"
-            i18n-values="label:doNotTrack">
-        </settings-checkbox>
+          <settings-checkbox pref="{{prefs.enable_do_not_track}}"
+              i18n-values="label:doNotTrack">
+          </settings-checkbox>
 <if expr="chromeos">
-        <settings-checkbox
-            pref="{{prefs.cros.device.attestation_for_content_protection_enabled}}"
-            i18n-values="label:enableContentProtectionAttestation">
-        </settings-checkbox>
-        <settings-checkbox
-            pref="{{prefs.settings.internet.wake_on_wifi_darkconnect}}"
-            i18n-values="label:wakeOnWifi">
-        </settings-checkbox>
+          <settings-checkbox
+              pref="{{prefs.cros.device.attestation_for_content_protection_enabled}}"
+              i18n-values="label:enableContentProtectionAttestation">
+          </settings-checkbox>
+          <settings-checkbox
+              pref="{{prefs.settings.internet.wake_on_wifi_darkconnect}}"
+              i18n-values="label:wakeOnWifi">
+          </settings-checkbox>
 </if>
-        <div class="privacy-buttons layout horizontal end-justified">
+        </div>
+        <div class="settings-box end-justified">
           <paper-button
               on-tap="onManageCertificatesTap_"
               i18n-content="manageCertificates">
diff --git a/chrome/browser/resources/settings/reset_page/reset_page.html b/chrome/browser/resources/settings/reset_page/reset_page.html
index af08139..f5b7ceea 100644
--- a/chrome/browser/resources/settings/reset_page/reset_page.html
+++ b/chrome/browser/resources/settings/reset_page/reset_page.html
@@ -9,12 +9,12 @@
   <link rel="import" type="css"
       href="chrome://md-settings/settings_page/settings_page.css">
   <template>
-    <div on-tap="onShowResetProfileDialog_">
+    <div class="settings-box" on-tap="onShowResetProfileDialog_">
       <div i18n-content="resetPageTitle"></div>
       <div i18n-content="resetPageDescription"></div>
     </div>
 <if expr="chromeos">
-    <div on-tap="onShowPowerwashDialog_" hidden="[[!allowPowerwash_]]">
+    <div class="settings-box" on-tap="onShowPowerwashDialog_" hidden="[[!allowPowerwash_]]">
       <div i18n-content="powerwashTitle"></div>
       <div i18n-content="powerwashDescription"></div>
     </div>
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_adder.html b/chrome/browser/resources/settings/search_engines_page/search_engine_adder.html
index fe360563..1f2df89 100644
--- a/chrome/browser/resources/settings/search_engines_page/search_engine_adder.html
+++ b/chrome/browser/resources/settings/search_engines_page/search_engine_adder.html
@@ -12,29 +12,31 @@
       <cr-expand-button expanded="{{opened}}"></cr-expand-button>
     </div>
     <cr-collapse opened="{{opened}}">
-      <div class="container layout horizontal">
-        <div class="input-field flex two">
-          <div class="input-label" i18n-content="searchEnginesDomainLabel">
+      <div class="settings-box">
+        <div class="container layout horizontal">
+          <div class="input-field flex two">
+            <div class="input-label" i18n-content="searchEnginesDomainLabel">
+            </div>
+            <paper-input id="domainField" auto-validate="false" required>
+            </paper-input>
           </div>
-          <paper-input id="domainField" auto-validate="false" required>
-          </paper-input>
-        </div>
-        <div class="input-field flex two">
-          <div class="input-label" i18n-content="searchEnginesKeywordLabel">
+          <div class="input-field flex two">
+            <div class="input-label" i18n-content="searchEnginesKeywordLabel">
+            </div>
+            <paper-input id="keywordField" auto-validate="false" required>
+            </paper-input>
           </div>
-          <paper-input id="keywordField" auto-validate="false" required>
-          </paper-input>
-        </div>
-        <div class="input-field flex four">
-          <div class="input-label" i18n-content="searchEnginesQueryURLLabel">
+          <div class="input-field flex four">
+            <div class="input-label" i18n-content="searchEnginesQueryURLLabel">
+            </div>
+            <paper-input id="queryURLField" auto-validate="false" required>
+            </paper-input>
           </div>
-          <paper-input id="queryURLField" auto-validate="false" required>
-          </paper-input>
-        </div>
-        <div class="layout horizontal center">
-          <paper-button i18n-content="searchEnginesAddButtonLabel"
-              on-click="{{add_}}" raised>
-          </paper-button>
+          <div class="layout horizontal center">
+            <paper-button i18n-content="searchEnginesAddButtonLabel"
+                on-click="{{add_}}" raised>
+            </paper-button>
+          </div>
         </div>
       </div>
     </cr-collapse>
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engines_page.html b/chrome/browser/resources/settings/search_engines_page/search_engines_page.html
index 7929519..f457aab2 100644
--- a/chrome/browser/resources/settings/search_engines_page/search_engines_page.html
+++ b/chrome/browser/resources/settings/search_engines_page/search_engines_page.html
@@ -5,7 +5,7 @@
 <dom-module id="settings-search-engines-page">
   <link rel="import" type="css" href="chrome://md-settings/settings_page/settings_page.css">
   <template>
-    <div class="content">
+    <div class="settings-box">
       <cr-search-engine-adder></cr-search-engine-adder>
 
       <h2 i18n-content="searchEnginesLabel"></h2>
diff --git a/chrome/browser/resources/settings/search_page/search_page.html b/chrome/browser/resources/settings/search_page/search_page.html
index 1753bd8..dc879f55 100644
--- a/chrome/browser/resources/settings/search_page/search_page.html
+++ b/chrome/browser/resources/settings/search_page/search_page.html
@@ -14,19 +14,22 @@
     <settings-animated-pages id="pages" current-route="{{currentRoute}}"
         section="search">
       <neon-animatable id="main">
-        <p i18n-content="searchExplanation"></p>
+        <div class="settings-box">
+          <p i18n-content="searchExplanation"></p>
 
-        <div class="search-engines">
-          <select id="searchEnginesMenu" on-change="defaultEngineGuidChanged_">
-            <template is="dom-repeat" items="[[searchEngines]]">
-              <option value="[[item.guid]]">{{item.name}}</option>
-            </template>
-          </select>
+          <div class="search-engines">
+            <select id="searchEnginesMenu"
+                  on-change="defaultEngineGuidChanged_">
+              <template is="dom-repeat" items="[[searchEngines]]">
+                <option value="[[item.guid]]">{{item.name}}</option>
+              </template>
+            </select>
 
-          <paper-button class="search-engines"
-              i18n-content="searchManageButtonLabel"
-              on-tap="onSearchEnginesTap_" raised>
-          </paper-button>
+            <paper-button class="search-engines"
+                i18n-content="searchManageButtonLabel"
+                on-tap="onSearchEnginesTap_" raised>
+            </paper-button>
+          </div>
         </div>
       </neon-animatable>
       <neon-animatable id="search-engines">
diff --git a/chrome/browser/resources/settings/settings_page/settings_page.css b/chrome/browser/resources/settings/settings_page/settings_page.css
index d0dd101..c4db693d 100644
--- a/chrome/browser/resources/settings/settings_page/settings_page.css
+++ b/chrome/browser/resources/settings/settings_page/settings_page.css
@@ -52,21 +52,27 @@
   margin-top: 25px;
 }
 
-.settings-row {
+.settings-box {
   @apply(--layout-center);
-  @apply(--layout-horizontal);
   border-top: 1px solid #e0e0e0;
-  display: flex;
-  justify-content: space-between;
+  display: block;
   min-height: 20px;
   padding: 8px 16px;
 }
 
-.settings-row:first-of-type {
+.settings-box:first-of-type {
   border-top: none;
 }
 
-.settings-row paper-item iron-icon {
+.split {
+  display: flex;
+}
+
+.split .start {
+  flex: auto;
+}
+
+.settings-box paper-item iron-icon {
   /* Same padding as paper-icon-button. */
   padding: 8px;
 }
diff --git a/chrome/browser/resources/settings/settings_page/settings_section.css b/chrome/browser/resources/settings/settings_page/settings_section.css
index 6b0c5c5..9c1ee5b9 100644
--- a/chrome/browser/resources/settings/settings_page/settings_section.css
+++ b/chrome/browser/resources/settings/settings_page/settings_section.css
@@ -26,7 +26,6 @@
   background-color: white;
   box-sizing: border-box;
   overflow: hidden;
-  padding: 16px;
 }
 
 paper-material,
diff --git a/chrome/browser/resources/settings/signin_page/signin_page.html b/chrome/browser/resources/settings/signin_page/signin_page.html
index 06be1b7..42bb0124 100644
--- a/chrome/browser/resources/settings/signin_page/signin_page.html
+++ b/chrome/browser/resources/settings/signin_page/signin_page.html
@@ -16,7 +16,7 @@
     <settings-animated-pages id="pages" current-route="{{currentRoute}}"
         section="people">
       <neon-animatable id="main">
-        <div class="settings-row" hidden="[[!isStatusTextSet_(syncStatus)]]">
+        <div class="settings-box split" hidden="[[!isStatusTextSet_(syncStatus)]]">
           <span id="syncStatusText"></span>
           <paper-button on-tap="onActionLinkTap_">
             [[syncStatus.actionLinkText]]
@@ -24,8 +24,8 @@
         </div>
 
         <template is="dom-if" if="[[!syncStatus.signedIn]]">
-          <div class="settings-row">[[i18n('syncOverview')]]</div>
-          <div class="settings-row button-strip">
+          <div class="settings-box">[[i18n('syncOverview')]]</div>
+          <div class="settings-box button-strip">
             <paper-button on-tap="onSigninTap_" raised
                 disabled="[[syncStatus.setupInProgress]]">
                 [[i18n('syncSignin')]]
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index f0c507b..f9eb365 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -461,7 +461,7 @@
     base::FilePath test_data_dir;
     PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
     embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   // This will setup the "url" prefix in database and prepare protocol manager
@@ -1175,7 +1175,7 @@
 
   void SetUp() override {
     // We need to start the test server to get the host&port in the url.
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     embedded_test_server()->RegisterRequestHandler(
         base::Bind(&SafeBrowsingDatabaseManagerCookieTest::HandleRequest));
 
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index b520168..21d992b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -48,6 +48,7 @@
 #include "net/dns/host_resolver.h"
 #include "net/log/net_log.h"
 #include "net/test/python_utils.h"
+#include "net/test/spawned_test_server/spawned_test_server.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "net/url_request/url_request_status.h"
@@ -254,7 +255,7 @@
     return local_database_manager()->safe_browsing_task_runner_;
   }
 
-  const net::SpawnedTestServer& test_server() const {
+  const net::SpawnedTestServer& spawned_test_server() const {
     return *test_server_;
   }
 
@@ -540,8 +541,9 @@
     }
 
     // Fetches URLs to verify and waits till server responses with data.
-    EXPECT_EQ(net::URLRequestStatus::SUCCESS,
-              safe_browsing_helper->FetchUrlsToVerify(test_server(), step));
+    EXPECT_EQ(
+        net::URLRequestStatus::SUCCESS,
+        safe_browsing_helper->FetchUrlsToVerify(spawned_test_server(), step));
 
     std::vector<PhishingUrl> phishing_urls;
     EXPECT_TRUE(ParsePhishingUrls(safe_browsing_helper->response_data(),
@@ -569,15 +571,17 @@
     }
     // TODO(lzheng): We should verify the fetched database with local
     // database to make sure they match.
-    EXPECT_EQ(net::URLRequestStatus::SUCCESS,
-              safe_browsing_helper->FetchDBToVerify(test_server(), step));
+    EXPECT_EQ(
+        net::URLRequestStatus::SUCCESS,
+        safe_browsing_helper->FetchDBToVerify(spawned_test_server(), step));
     EXPECT_GT(safe_browsing_helper->response_data().size(), 0U);
     last_step = step;
   }
 
   // Verifies with server if test is done and waits till server responses.
   EXPECT_EQ(net::URLRequestStatus::SUCCESS,
-            safe_browsing_helper->VerifyTestComplete(test_server(), last_step));
+            safe_browsing_helper->VerifyTestComplete(spawned_test_server(),
+                                                     last_step));
   EXPECT_EQ("yes", safe_browsing_helper->response_data());
 }
 
diff --git a/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc b/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc
index 904a637d..034abca 100644
--- a/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc
+++ b/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc
@@ -12,7 +12,7 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "components/suggestions/image_fetcher_delegate.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -23,8 +23,8 @@
 namespace {
 
 const char kTestUrl[] = "http://go.com/";
-const char kTestImagePath[] = "files/image_decoding/droids.png";
-const char kInvalidImagePath[] = "files/DOESNOTEXIST";
+const char kTestImagePath[] = "/image_decoding/droids.png";
+const char kInvalidImagePath[] = "/DOESNOTEXIST";
 
 const base::FilePath::CharType kDocRoot[] =
     FILE_PATH_LITERAL("chrome/test/data");
@@ -58,19 +58,15 @@
 class ImageFetcherImplBrowserTest : public InProcessBrowserTest {
  protected:
   ImageFetcherImplBrowserTest()
-    : num_callback_valid_called_(0),
-      num_callback_null_called_(0),
-      test_server_(net::SpawnedTestServer::TYPE_HTTP,
-                   net::SpawnedTestServer::kLocalhost,
-                   base::FilePath(kDocRoot)) {}
+      : num_callback_valid_called_(0), num_callback_null_called_(0) {
+    test_server_.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
+  }
 
   void SetUpInProcessBrowserTestFixture() override {
     ASSERT_TRUE(test_server_.Start());
     InProcessBrowserTest::SetUpInProcessBrowserTestFixture();
   }
 
-  void TearDownInProcessBrowserTestFixture() override { test_server_.Stop(); }
-
   ImageFetcherImpl* CreateImageFetcher() {
     ImageFetcherImpl* fetcher =
         new ImageFetcherImpl(browser()->profile()->GetRequestContext());
@@ -104,7 +100,7 @@
   int num_callback_valid_called_;
   int num_callback_null_called_;
 
-  net::SpawnedTestServer test_server_;
+  net::EmbeddedTestServer test_server_;
   TestImageFetcherDelegate delegate_;
 
   DISALLOW_COPY_AND_ASSIGN(ImageFetcherImplBrowserTest);
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index 9dec1aa..975f35e 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -50,6 +50,7 @@
 #include "content/public/common/bindings_policy.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_navigation_observer.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "sync/protocol/session_specifics.pb.h"
 #include "ui/base/page_transition_types.h"
 
@@ -965,9 +966,9 @@
 // This test fails. See http://crbug.com/237497.
 IN_PROC_BROWSER_TEST_F(SessionRestoreTest,
                        DISABLED_RestoresCrossSiteForwardAndBackwardNavs) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL cross_site_url(test_server()->GetURL("files/title2.html"));
+  GURL cross_site_url(embedded_test_server()->GetURL("/title2.html"));
 
   // Visit URLs on different sites.
   ui_test_utils::NavigateToURL(browser(), url1_);
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc
index 725c66f..cc65c1d 100644
--- a/chrome/browser/sessions/tab_restore_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -411,7 +411,7 @@
 // Tests that a duplicate history entry is not created when we restore a page
 // to an existing SiteInstance.  (Bug 1230446)
 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL http_url1(embedded_test_server()->GetURL("/title1.html"));
   GURL http_url2(embedded_test_server()->GetURL("/title2.html"));
@@ -468,7 +468,7 @@
 // already exists.  (Bug 1204135)
 IN_PROC_BROWSER_TEST_F(TabRestoreTest,
                        MAYBE_RestoreCrossSiteWithExistingSiteInstance) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL http_url1(embedded_test_server()->GetURL("/title1.html"));
   GURL http_url2(embedded_test_server()->GetURL("/title2.html"));
@@ -591,7 +591,7 @@
 // Restore tab with special URL in its navigation history, go back to that
 // entry and see that it loads properly. See http://crbug.com/31905
 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURLOnBack) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   const GURL http_url(embedded_test_server()->GetURL("/title1.html"));
 
diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc
index a11d9b2..fb5ac9da 100644
--- a/chrome/browser/site_details_browsertest.cc
+++ b/chrome/browser/site_details_browsertest.cc
@@ -95,7 +95,7 @@
     ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir));
     embedded_test_server()->ServeFilesFromDirectory(
         test_data_dir.AppendASCII("content/test/data/"));
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   // Create and install an extension that has a couple of web-accessible
diff --git a/chrome/browser/speech/speech_recognition_browsertest.cc b/chrome/browser/speech/speech_recognition_browsertest.cc
index ceb0ff1a..ca242a4 100644
--- a/chrome/browser/speech/speech_recognition_browsertest.cc
+++ b/chrome/browser/speech/speech_recognition_browsertest.cc
@@ -80,16 +80,14 @@
 // when a WebContents goes away (WCO::WebContentsDestroyed) or the RVH
 // changes within a WebContents (WCO::RenderViewHostChanged).
 IN_PROC_BROWSER_TEST_F(ChromeSpeechRecognitionTest, BasicTearDown) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
-  net::SpawnedTestServer::SSLOptions ssl_options;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
 
   GURL http_url =
       embedded_test_server()->GetURL("/speech/web_speech_test.html");
-  GURL https_url(https_server.GetURL("files/speech/web_speech_test.html"));
+  GURL https_url(https_server.GetURL("/speech/web_speech_test.html"));
 
   scoped_ptr<ChromeSpeechRecognitionManagerDelegate> delegate(
       new ChromeSpeechRecognitionManagerDelegate());
diff --git a/chrome/browser/storage/durable_storage_browsertest.cc b/chrome/browser/storage/durable_storage_browsertest.cc
index 3dc3e3a..fa8e8265 100644
--- a/chrome/browser/storage/durable_storage_browsertest.cc
+++ b/chrome/browser/storage/durable_storage_browsertest.cc
@@ -66,7 +66,7 @@
 void DurableStorageBrowserTest::SetUpOnMainThread() {
   if (embedded_test_server()->Started())
     return;
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   url_ = embedded_test_server()->GetURL("/durable/durability-permissions.html");
 }
 
diff --git a/chrome/browser/supervised_user/supervised_user_browsertest.cc b/chrome/browser/supervised_user/supervised_user_browsertest.cc
index 53986885..36721cb 100644
--- a/chrome/browser/supervised_user/supervised_user_browsertest.cc
+++ b/chrome/browser/supervised_user/supervised_user_browsertest.cc
@@ -34,6 +34,7 @@
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 using content::InterstitialPage;
@@ -116,8 +117,8 @@
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
     // Enable the test server and remap all URLs to it.
-    ASSERT_TRUE(test_server()->Start());
-    std::string host_port = test_server()->host_port_pair().ToString();
+    ASSERT_TRUE(embedded_test_server()->Start());
+    std::string host_port = embedded_test_server()->host_port_pair().ToString();
     command_line->AppendSwitchASCII(switches::kHostResolverRules,
         "MAP *.example.com " + host_port + "," +
         "MAP *.new-example.com " + host_port + "," +
@@ -175,7 +176,7 @@
 // Navigates to a blocked URL.
 IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
                        SendAccessRequestOnBlockedURL) {
-  GURL test_url("http://www.example.com/files/simple.html");
+  GURL test_url("http://www.example.com/simple.html");
   ui_test_utils::NavigateToURL(browser(), test_url);
 
   WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
@@ -201,7 +202,7 @@
   WebContents* prev_tab = tab_strip->GetActiveWebContents();
 
   // Open blocked URL in a new tab.
-  GURL test_url("http://www.example.com/files/simple.html");
+  GURL test_url("http://www.example.com/simple.html");
   ui_test_utils::NavigateToURLWithDisposition(
       browser(), test_url, NEW_FOREGROUND_TAB,
       ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
@@ -225,7 +226,7 @@
 // Tests whether a visit attempt adds a special history entry.
 IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
                        HistoryVisitRecorded) {
-  GURL allowed_url("http://www.example.com/files/simple.html");
+  GURL allowed_url("http://www.example.com/simple.html");
 
   scoped_refptr<SupervisedUserURLFilter> filter =
       supervised_user_service_->GetURLFilterForUIThread();
@@ -250,7 +251,7 @@
   CheckShownPageIsNotInterstitial(tab);
 
   // Navigate to a blocked page and go back on the interstitial.
-  GURL blocked_url("http://www.new-example.com/files/simple.html");
+  GURL blocked_url("http://www.new-example.com/simple.html");
   ui_test_utils::NavigateToURL(browser(), blocked_url);
 
   tab = browser()->tab_strip_model()->GetActiveWebContents();
@@ -283,7 +284,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, Unblock) {
-  GURL test_url("http://www.example.com/files/simple.html");
+  GURL test_url("http://www.example.com/simple.html");
   ui_test_utils::NavigateToURL(browser(), test_url);
 
   WebContents* web_contents =
diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc
index b4c8083..e0312c6 100644
--- a/chrome/browser/sync/profile_sync_service_android.cc
+++ b/chrome/browser/sync/profile_sync_service_android.cc
@@ -241,6 +241,13 @@
   return sync_service_->IsUsingSecondaryPassphrase();
 }
 
+ScopedJavaLocalRef<jbyteArray>
+ProfileSyncServiceAndroid::GetCustomPassphraseKey(JNIEnv* env, jobject obj) {
+  std::string key = sync_service_->GetCustomPassphraseKey();
+  return base::android::ToJavaByteArray(
+      env, reinterpret_cast<const uint8_t*>(key.data()), key.size());
+}
+
 jint ProfileSyncServiceAndroid::GetPassphraseType(JNIEnv* env, jobject) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   return sync_service_->GetPassphraseType();
diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h
index c035a78..a3d067c0 100644
--- a/chrome/browser/sync/profile_sync_service_android.h
+++ b/chrome/browser/sync/profile_sync_service_android.h
@@ -64,6 +64,9 @@
   jboolean IsPassphraseRequired(JNIEnv* env, jobject obj);
   jboolean IsPassphraseRequiredForDecryption(JNIEnv* env, jobject obj);
   jboolean IsUsingSecondaryPassphrase(JNIEnv* env, jobject obj);
+  base::android::ScopedJavaLocalRef<jbyteArray> GetCustomPassphraseKey(
+      JNIEnv* env,
+      jobject obj);
   jint GetPassphraseType(JNIEnv* env, jobject obj);
   void SetEncryptionPassphrase(JNIEnv* env,
                                jobject obj,
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 0245fc6..f200924 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -77,7 +77,6 @@
 #include "net/base/network_change_notifier.h"
 #include "net/base/port_util.h"
 #include "net/cookies/cookie_monster.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
 #include "net/url_request/test_url_fetcher_factory.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_fetcher_delegate.h"
diff --git a/chrome/browser/tab_contents/view_source_browsertest.cc b/chrome/browser/tab_contents/view_source_browsertest.cc
index 332c7c9..d2ef0c1 100644
--- a/chrome/browser/tab_contents/view_source_browsertest.cc
+++ b/chrome/browser/tab_contents/view_source_browsertest.cc
@@ -21,7 +21,7 @@
 
 namespace {
 const char kTestHtml[] = "/viewsource/test.html";
-const char kTestMedia[] = "files/media/pink_noise_140ms.wav";
+const char kTestMedia[] = "/media/pink_noise_140ms.wav";
 }
 
 typedef InProcessBrowserTest ViewSourceTest;
@@ -31,7 +31,7 @@
 // page in view source).
 // Flaky; see http://crbug.com/72201.
 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // First we navigate to our view-source test page.
   GURL url(content::kViewSourceScheme + std::string(":") +
@@ -49,7 +49,7 @@
 // implementation of the view-source: prefix being consumed (removed from the
 // URL) if the URL was not changed (apart from adding the view-source prefix)
 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // First we navigate to google.html.
   GURL url(embedded_test_server()->GetURL(kTestHtml));
@@ -69,7 +69,7 @@
 // Make sure that when looking at the actual page, we can select "View Source"
 // from the menu.
 IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuEnabledOnANormalPage) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL url(embedded_test_server()->GetURL(kTestHtml));
   ui_test_utils::NavigateToURL(browser(), url);
@@ -80,9 +80,9 @@
 // For page that is media content, make sure that we cannot select "View Source"
 // See http://crbug.com/83714
 IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuDisabledOnAMediaPage) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL url(test_server()->GetURL(kTestMedia));
+  GURL url(embedded_test_server()->GetURL(kTestMedia));
   ui_test_utils::NavigateToURL(browser(), url);
 
   const char* mime_type = browser()->tab_strip_model()->GetActiveWebContents()->
@@ -96,7 +96,7 @@
 // from the menu.
 IN_PROC_BROWSER_TEST_F(ViewSourceTest,
                        ViewSourceInMenuDisabledWhileViewingSource) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL url_viewsource(content::kViewSourceScheme + std::string(":") +
                       embedded_test_server()->GetURL(kTestHtml).spec());
@@ -109,7 +109,7 @@
 // the page in view-source mode.
 // Times out on Mac, Windows, ChromeOS Linux: crbug.com/162080
 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DISABLED_TestViewSourceReload) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL url_viewsource(content::kViewSourceScheme + std::string(":") +
                       embedded_test_server()->GetURL(kTestHtml).spec());
diff --git a/chrome/browser/task_management/providers/web_contents/devtools_tag_browsertest.cc b/chrome/browser/task_management/providers/web_contents/devtools_tag_browsertest.cc
index c009d52..0a26496 100644
--- a/chrome/browser/task_management/providers/web_contents/devtools_tag_browsertest.cc
+++ b/chrome/browser/task_management/providers/web_contents/devtools_tag_browsertest.cc
@@ -9,13 +9,14 @@
 #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 "net/test/embedded_test_server/embedded_test_server.h"
 
 namespace task_management {
 
 namespace {
 
-const char kTestPage1[] = "files/devtools/debugger_test_page.html";
-const char kTestPage2[] = "files/devtools/navigate_back.html";
+const char kTestPage1[] = "/devtools/debugger_test_page.html";
+const char kTestPage2[] = "/devtools/navigate_back.html";
 
 }  // namespace
 
@@ -27,13 +28,13 @@
  public:
   DevToolsTagTest()
       : devtools_window_(nullptr) {
-    CHECK(test_server()->Start());
+    CHECK(embedded_test_server()->Start());
   }
 
   ~DevToolsTagTest() override {}
 
   void LoadTestPage(const std::string& test_page) {
-    GURL url = test_server()->GetURL(test_page);
+    GURL url = embedded_test_server()->GetURL(test_page);
     ui_test_utils::NavigateToURL(browser(), url);
   }
 
diff --git a/chrome/browser/task_management/providers/web_contents/subframe_task_browsertest.cc b/chrome/browser/task_management/providers/web_contents/subframe_task_browsertest.cc
index 53df0796..e99a3f9 100644
--- a/chrome/browser/task_management/providers/web_contents/subframe_task_browsertest.cc
+++ b/chrome/browser/task_management/providers/web_contents/subframe_task_browsertest.cc
@@ -50,7 +50,7 @@
 
   void SetUpOnMainThread() override {
     host_resolver()->AddRule("*", "127.0.0.1");
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
     content::SetupCrossSiteRedirector(embedded_test_server());
   }
 
diff --git a/chrome/browser/task_management/providers/web_contents/tab_contents_tag_browsertest.cc b/chrome/browser/task_management/providers/web_contents/tab_contents_tag_browsertest.cc
index 6ff3bbf..796b2a6 100644
--- a/chrome/browser/task_management/providers/web_contents/tab_contents_tag_browsertest.cc
+++ b/chrome/browser/task_management/providers/web_contents/tab_contents_tag_browsertest.cc
@@ -109,9 +109,7 @@
 // contents.
 class TabContentsTagTest : public InProcessBrowserTest {
  public:
-  TabContentsTagTest() {
-    EXPECT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
-  }
+  TabContentsTagTest() { EXPECT_TRUE(embedded_test_server()->Start()); }
   ~TabContentsTagTest() override {}
 
   void AddNewTestTabAt(int index, const char* test_page_file) {
diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc
index e0c8bda..d802188 100644
--- a/chrome/browser/task_manager/task_manager_browsertest.cc
+++ b/chrome/browser/task_manager/task_manager_browsertest.cc
@@ -234,7 +234,7 @@
 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
                        DISABLED_NavigateAwayFromHungRenderer) {
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ShowTaskManager();
 
   ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
@@ -628,7 +628,7 @@
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL::Replacements replace_host;
   replace_host.SetHostStr("localhost");
   GURL base_url = embedded_test_server()->GetURL(
@@ -692,7 +692,7 @@
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL::Replacements replace_host;
   replace_host.SetHostStr("localhost");
   GURL base_url =
@@ -727,7 +727,7 @@
   // The app under test acts on URLs whose host is "localhost",
   // so the URLs we navigate to must have host "localhost".
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   GURL::Replacements replace_host;
   replace_host.SetHostStr("localhost");
   GURL base_url =
@@ -930,7 +930,7 @@
   ShowTaskManager();
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   content::SetupCrossSiteRedirector(embedded_test_server());
 
   GURL main_url(embedded_test_server()->GetURL(
@@ -994,7 +994,7 @@
   ShowTaskManager();
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   content::SetupCrossSiteRedirector(embedded_test_server());
 
   // Navigate the tab to a page on a.com with cross-process subframes to
@@ -1045,7 +1045,7 @@
   ShowTaskManager();
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   content::SetupCrossSiteRedirector(embedded_test_server());
 
   // Navigate to a page on b.com with a simple (same-site) iframe.
@@ -1104,7 +1104,7 @@
   ShowTaskManager();
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   content::SetupCrossSiteRedirector(embedded_test_server());
 
   // Navigate the tab to a page on a.com with cross-process subframes to
@@ -1177,7 +1177,7 @@
   ShowTaskManager();
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
   content::SetupCrossSiteRedirector(embedded_test_server());
 
   // Navigate the tab to a page on a.com with cross-process subframes.
diff --git a/chrome/browser/translate/translate_browsertest.cc b/chrome/browser/translate/translate_browsertest.cc
index ff7ebbac..6c4bbbd3 100644
--- a/chrome/browser/translate/translate_browsertest.cc
+++ b/chrome/browser/translate/translate_browsertest.cc
@@ -29,7 +29,6 @@
 #include "content/public/test/browser_test_utils.h"
 #include "net/http/http_status_code.h"
 #include "net/test/embedded_test_server/embedded_test_server.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
 #include "net/url_request/test_url_fetcher_factory.h"
 #include "net/url_request/url_fetcher_delegate.h"
 
@@ -37,8 +36,6 @@
 
 const base::FilePath::CharType kTranslateRoot[] =
     FILE_PATH_LITERAL("chrome/test/data/translate");
-const char kNonSecurePrefix[] = "translate/";
-const char kSecurePrefix[] = "files/";
 const char kFrenchTestPath[] = "/fr_test.html";
 const char kBasicFrenchTestPath[] = "/basic_fr_test.html";
 const char kRefreshMetaTagTestPath[] = "/refresh_meta_tag.html";
@@ -66,12 +63,9 @@
   }
 
   void SetUpOnMainThread() override {
-    net::test_server::EmbeddedTestServer* test_server = embedded_test_server();
-    base::FilePath test_data_dir;
-    PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
-    test_data_dir = test_data_dir.AppendASCII(kNonSecurePrefix);
-    test_server->ServeFilesFromDirectory(test_data_dir);
-    ASSERT_TRUE(test_server->InitializeAndWaitUntilReady());
+    net::EmbeddedTestServer* test_server = embedded_test_server();
+    test_server->ServeFilesFromSourceDirectory(kTranslateRoot);
+    ASSERT_TRUE(test_server->Start());
     InProcessBrowserTest::SetUpOnMainThread();
   }
 
@@ -197,15 +191,15 @@
 class TranslateWithSecureServerBrowserTest : public TranslateBrowserTest {
  public:
   TranslateWithSecureServerBrowserTest()
-      : https_server_(net::SpawnedTestServer::TYPE_HTTPS,
-                      SSLOptions(SSLOptions::CERT_OK),
-                      base::FilePath(kTranslateRoot)) {}
+      : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {
+    https_server_.ServeFilesFromSourceDirectory(kTranslateRoot);
+  }
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
     ASSERT_TRUE(https_server_.Start());
     // Setup alternate security origin for testing in order to allow XHR against
     // local test server. Note that this flag shows a confirm infobar in tests.
-    GURL base_url = GetSecureURL("");
+    GURL base_url = GetSecureURL("/");
     command_line->AppendSwitchASCII(
         translate::switches::kTranslateSecurityOrigin,
         base_url.GetOrigin().spec());
@@ -214,14 +208,11 @@
 
  protected:
   GURL GetSecureURL(const std::string& path) const {
-    std::string prefix(kSecurePrefix);
-    return https_server_.GetURL(prefix + path);
+    return https_server_.GetURL(path);
   }
 
  private:
-  net::SpawnedTestServer https_server_;
-
-  typedef net::SpawnedTestServer::SSLOptions SSLOptions;
+  net::EmbeddedTestServer https_server_;
 
   DISALLOW_COPY_AND_ASSIGN(TranslateWithSecureServerBrowserTest);
 };
diff --git a/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc b/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc
index 73979b9..ff1529b 100644
--- a/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc
+++ b/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc
@@ -25,7 +25,6 @@
 using net::test_server::BasicHttpResponse;
 using net::test_server::HttpRequest;
 using net::test_server::HttpResponse;
-using net::test_server::EmbeddedTestServer;
 
 namespace app_list {
 namespace test {
@@ -167,12 +166,10 @@
 
   // InProcessBrowserTest overrides:
   void SetUpOnMainThread() override {
-    test_server_.reset(new EmbeddedTestServer);
-
-    ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady());
-    test_server_->RegisterRequestHandler(
+    embedded_test_server()->RegisterRequestHandler(
         base::Bind(&PeopleProviderTest::HandleRequest,
                    base::Unretained(this)));
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     people_provider_.reset(new PeopleProvider(
         ProfileManager::GetActiveUserProfile(), &test_controller_));
@@ -180,15 +177,10 @@
     people_provider_->SetupForTest(
         base::Bind(&PeopleProviderTest::OnSearchResultsFetched,
                    base::Unretained(this)),
-        test_server_->base_url());
+        embedded_test_server()->base_url());
     people_provider_->set_use_throttling(false);
   }
 
-  void TearDownOnMainThread() override {
-    EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete());
-    test_server_.reset();
-  }
-
   std::string RunQuery(const std::string& query,
                        const std::string& mock_server_response) {
     people_provider_->Start(false, base::UTF8ToUTF16(query));
@@ -237,7 +229,6 @@
       run_loop_->Quit();
   }
 
-  scoped_ptr<EmbeddedTestServer> test_server_;
   scoped_ptr<base::RunLoop> run_loop_;
 
   std::string mock_server_response_;
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider_browsertest.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider_browsertest.cc
index e8160aa2..4bb888a 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_provider_browsertest.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider_browsertest.cc
@@ -28,7 +28,6 @@
 using net::test_server::BasicHttpResponse;
 using net::test_server::HttpRequest;
 using net::test_server::HttpResponse;
-using net::test_server::EmbeddedTestServer;
 
 namespace app_list {
 namespace test {
@@ -135,14 +134,12 @@
 
   // InProcessBrowserTest overrides:
   void SetUpOnMainThread() override {
-    test_server_.reset(new EmbeddedTestServer);
-
-    ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady());
-    test_server_->RegisterRequestHandler(
+    embedded_test_server()->RegisterRequestHandler(
         base::Bind(&WebstoreProviderTest::HandleRequest,
                    base::Unretained(this)));
+    ASSERT_TRUE(embedded_test_server()->Start());
     base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
-        ::switches::kAppsGalleryURL, test_server_->base_url().spec());
+        ::switches::kAppsGalleryURL, embedded_test_server()->base_url().spec());
     base::CommandLine::ForCurrentProcess()->AppendSwitch(
         switches::kEnableExperimentalAppList);
 
@@ -155,11 +152,6 @@
     webstore_provider_->set_use_throttling(false);
   }
 
-  void TearDownOnMainThread() override {
-    EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete());
-    test_server_.reset();
-  }
-
   void RunQuery(const std::string& query,
                 const std::string& mock_server_response) {
     mock_server_response_ = mock_server_response;
@@ -248,7 +240,6 @@
       run_loop_->Quit();
   }
 
-  scoped_ptr<EmbeddedTestServer> test_server_;
   scoped_ptr<base::RunLoop> run_loop_;
 
   std::string mock_server_response_;
diff --git a/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc b/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc
index 85a93a29..384fed0e 100644
--- a/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_favicon_loader_browsertest.cc
@@ -13,6 +13,7 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_observer.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 
 using content::WebContents;
@@ -78,8 +79,9 @@
 
  protected:
   bool NavigateTo(const char* url) {
-    std::string url_path = base::StringPrintf("files/ash/launcher/%s", url);
-    ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(url_path));
+    std::string url_path = base::StringPrintf("/ash/launcher/%s", url);
+    ui_test_utils::NavigateToURL(browser(),
+                                 embedded_test_server()->GetURL(url_path));
     return true;
   }
 
@@ -125,7 +127,7 @@
 };
 
 IN_PROC_BROWSER_TEST_F(LauncherFaviconLoaderBrowsertest, SmallLauncherIcon) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(NavigateTo("launcher-smallfavicon.html"));
   EXPECT_TRUE(WaitForContentsLoaded());
   EXPECT_TRUE(WaitForFaviconUpdated());
@@ -135,7 +137,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(LauncherFaviconLoaderBrowsertest, LargeLauncherIcon) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(NavigateTo("launcher-largefavicon.html"));
   EXPECT_TRUE(WaitForContentsLoaded());
   EXPECT_TRUE(WaitForFaviconUpdated());
@@ -145,7 +147,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(LauncherFaviconLoaderBrowsertest, ManyLauncherIcons) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(NavigateTo("launcher-manyfavicon.html"));
   EXPECT_TRUE(WaitForContentsLoaded());
   EXPECT_TRUE(WaitForFaviconUpdated());
@@ -158,7 +160,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(LauncherFaviconLoaderBrowsertest, ChangeLauncherIcons) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(NavigateTo("launcher-manyfavicon.html"));
   EXPECT_TRUE(WaitForContentsLoaded());
   EXPECT_TRUE(WaitForFaviconUpdated());
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
index a1b58b1a..3b0f010 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
@@ -56,7 +56,7 @@
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_utils.h"
 #include "google_apis/gaia/google_service_auth_error.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
@@ -394,9 +394,8 @@
 
   // Loads an html page on a provided server, the causes it to launch rAc.
   // Returns whether rAc succesfully launched.
-  bool RunTestPage(const net::SpawnedTestServer& server) {
-    GURL url = server.GetURL(
-        "files/request_autocomplete/test_page.html");
+  bool RunTestPage(const net::EmbeddedTestServer& server) {
+    GURL url = server.GetURL("/request_autocomplete/test_page.html");
     ui_test_utils::NavigateToURL(browser(), url);
 
     // Pass through the broken SSL interstitial, if any.
@@ -422,10 +421,9 @@
     return !!controller;
   }
 
-  void RunTestPageInIframe(const net::SpawnedTestServer& server) {
+  void RunTestPageInIframe(const net::EmbeddedTestServer& server) {
     InitializeDOMMessageQueue();
-    GURL iframe_url = server.GetURL(
-        "files/request_autocomplete/test_page.html");
+    GURL iframe_url = server.GetURL("/request_autocomplete/test_page.html");
 
     ui_test_utils::NavigateToURL(
         browser(), GURL(std::string("data:text/html,") +
@@ -1082,10 +1080,8 @@
 
 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest,
                        DoesWorkOnHttpWithFlag) {
-  net::SpawnedTestServer http_server(
-      net::SpawnedTestServer::TYPE_HTTP,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer http_server;
+  http_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(http_server.Start());
   EXPECT_TRUE(RunTestPage(http_server));
 }
@@ -1109,30 +1105,24 @@
 
 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerSecurityTest,
                        DoesntWorkOnHttp) {
-  net::SpawnedTestServer http_server(
-      net::SpawnedTestServer::TYPE_HTTP,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer http_server;
+  http_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(http_server.Start());
   EXPECT_FALSE(RunTestPage(http_server));
 }
 
 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerSecurityTest,
                        DoesWorkOnHttpWithFlags) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      SSLOptions(SSLOptions::CERT_OK),
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   EXPECT_TRUE(RunTestPage(https_server));
 }
 
 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerSecurityTest,
                        DISABLED_DoesntWorkOnBrokenHttps) {
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      SSLOptions(SSLOptions::CERT_EXPIRED),
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
   EXPECT_FALSE(RunTestPage(https_server));
 }
@@ -1318,10 +1308,8 @@
 // Tests that the rAc dialog hides when the main frame is navigated, even if
 // it was invoked from a child frame.
 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, HideOnNavigateMainFrame) {
-  net::SpawnedTestServer http_server(
-      net::SpawnedTestServer::TYPE_HTTP,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer http_server;
+  http_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(http_server.Start());
   RunTestPageInIframe(http_server);
 
@@ -1333,10 +1321,8 @@
 
 // Tests that the rAc dialog hides when the iframe it's in is navigated.
 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, HideOnNavigateIframe) {
-  net::SpawnedTestServer http_server(
-      net::SpawnedTestServer::TYPE_HTTP,
-      net::SpawnedTestServer::kLocalhost,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer http_server;
+  http_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(http_server.Start());
   RunTestPageInIframe(http_server);
 
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
index 4ecd7ba..336a6e7 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
@@ -141,6 +141,8 @@
     ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
         web_contents(), autofill_client_.get(), "en-US",
         AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER);
+    // Make sure RenderFrame is created.
+    NavigateAndCommit(GURL("about:blank"));
     ContentAutofillDriverFactory* factory =
         ContentAutofillDriverFactory::FromWebContents(web_contents());
     ContentAutofillDriver* driver =
diff --git a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
index 636a3cb..d516618 100644
--- a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
+++ b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
@@ -145,7 +145,7 @@
     InProcessBrowserTest::SetUpOnMainThread();
 
     host_resolver()->AddRule("*", "127.0.0.1");
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   int GetBlockedContentsCount() {
diff --git a/chrome/browser/ui/bookmarks/bookmark_browsertest.cc b/chrome/browser/ui/bookmarks/bookmark_browsertest.cc
index f756be5..ca88e91 100644
--- a/chrome/browser/ui/bookmarks/bookmark_browsertest.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_browsertest.cc
@@ -26,6 +26,7 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using bookmarks::BookmarkModel;
 
@@ -170,16 +171,14 @@
 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest,
                        MAYBE_HideStarOnNonbookmarkedInterstitial) {
   // Start an HTTPS server with a certificate error.
-  net::SpawnedTestServer::SSLOptions https_options;
-  https_options.server_certificate =
-      net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME;
-  net::SpawnedTestServer https_server(
-      net::SpawnedTestServer::TYPE_HTTPS, https_options,
-      base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+  net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+  https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
+  https_server.ServeFilesFromSourceDirectory("chrome/test/data");
   ASSERT_TRUE(https_server.Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile());
-  GURL bookmark_url = test_server()->GetURL("http://example.test");
+  GURL bookmark_url = embedded_test_server()->GetURL("example.test", "/");
   bookmarks::AddIfNotBookmarked(bookmark_model,
                                 bookmark_url,
                                 base::ASCIIToUTF16("Bookmark"));
@@ -198,7 +197,7 @@
 
   // Now go to a non-bookmarked url which triggers an SSL warning. Bookmark
   // star should disappear.
-  GURL error_url = https_server.GetURL(".");
+  GURL error_url = https_server.GetURL("/");
   ui_test_utils::NavigateToURL(browser(), error_url);
   web_contents = browser()->tab_strip_model()->GetActiveWebContents();
   content::WaitForInterstitialAttach(web_contents);
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index e6973466..0d5915e 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -12,6 +12,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/prefs/pref_service.h"
+#include "base/strings/string_split.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/sys_info.h"
 #include "chrome/app/chrome_command_ids.h"
@@ -100,6 +101,8 @@
 #include "net/base/net_errors.h"
 #include "net/dns/mock_host_resolver.h"
 #include "net/ssl/ssl_connection_status_flags.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "net/test/embedded_test_server/request_handler_util.h"
 #include "net/test/spawned_test_server/spawned_test_server.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request_filter.h"
@@ -342,14 +345,14 @@
   observer.Wait();
 }
 
-bool GetFilePathWithHostAndPortReplacement(
+void GetFilePathWithHostAndPortReplacement(
     const std::string& original_file_path,
     const net::HostPortPair& host_port_pair,
     std::string* replacement_path) {
-  std::vector<net::SpawnedTestServer::StringPair> replacement_text;
+  base::StringPairs replacement_text;
   replacement_text.push_back(
       make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString()));
-  return net::SpawnedTestServer::GetFilePathWithReplacements(
+  net::test_server::GetFilePathWithReplacements(
       original_file_path, replacement_text, replacement_path);
 }
 
@@ -643,7 +646,7 @@
 // a pending entry if we start from the NTP but not from a normal page.
 // See http://crbug.com/355537.
 IN_PROC_BROWSER_TEST_F(BrowserTest, ClearPendingOnFailUnlessNTP) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   WebContents* web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
   GURL ntp_url(search::GetNewTabPageURL(browser()->profile()));
@@ -651,7 +654,7 @@
 
   // Navigate to a 204 URL (aborts with no content) on the NTP and make sure it
   // sticks around so that the user can edit it.
-  GURL abort_url(test_server()->GetURL("nocontent"));
+  GURL abort_url(embedded_test_server()->GetURL("/nocontent"));
   {
     content::WindowedNotificationObserver stop_observer(
         content::NOTIFICATION_LOAD_STOP,
@@ -665,7 +668,7 @@
   }
 
   // Navigate to a real URL.
-  GURL real_url(test_server()->GetURL("title1.html"));
+  GURL real_url(embedded_test_server()->GetURL("/title1.html"));
   ui_test_utils::NavigateToURL(browser(), real_url);
   EXPECT_EQ(real_url, web_contents->GetVisibleURL());
 
@@ -687,9 +690,9 @@
 // cross-process navigation is ready to commit.
 // Flaky test, see https://crbug.com/445155.
 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_CrossProcessNavCancelsDialogs) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
-  GURL url(test_server()->GetURL("empty.html"));
+  GURL url(embedded_test_server()->GetURL("/empty.html"));
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Test this with multiple alert dialogs to ensure that we can navigate away
@@ -715,9 +718,9 @@
 // Make sure that dialogs are closed after a renderer process dies, and that
 // subsequent navigations work.  See http://crbug/com/343265.
 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
-  GURL beforeunload_url(test_server()->GetURL("files/beforeunload.html"));
+  GURL beforeunload_url(embedded_test_server()->GetURL("/beforeunload.html"));
   ui_test_utils::NavigateToURL(browser(), beforeunload_url);
 
   // Start a navigation to trigger the beforeunload dialog.
@@ -739,7 +742,7 @@
   EXPECT_FALSE(dialog_queue->HasActiveDialog());
 
   // Make sure subsequent navigations work.
-  GURL url2("http://www.example.com/files/empty.html");
+  GURL url2("http://www.example.com/empty.html");
   ui_test_utils::NavigateToURL(browser(), url2);
 }
 
@@ -774,8 +777,8 @@
 // page is showing. See crbug.com/482380.
 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCancelsGuestViewDialogs) {
   // Navigate to a PDF, which is loaded within a guestview.
-  ASSERT_TRUE(test_server()->Start());
-  GURL pdf_with_dialog(test_server()->GetURL("files/alert_dialog.pdf"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL pdf_with_dialog(embedded_test_server()->GetURL("/alert_dialog.pdf"));
   ui_test_utils::NavigateToURL(browser(), pdf_with_dialog);
 
   AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
@@ -850,10 +853,10 @@
 // http://crbug.com/243957.
 IN_PROC_BROWSER_TEST_F(BrowserTest, NoStopDuringTransferUntilCommit) {
   // Create HTTP and HTTPS servers for a cross-site transition.
-  ASSERT_TRUE(test_server()->Start());
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
 
   // Temporarily replace ContentBrowserClient with one that will cause a
@@ -862,7 +865,7 @@
   content::ContentBrowserClient* old_client =
       SetBrowserClientForTesting(&new_client);
 
-  GURL init_url(test_server()->GetURL("files/title1.html"));
+  GURL init_url(embedded_test_server()->GetURL("/title1.html"));
   ui_test_utils::NavigateToURL(browser(), init_url);
 
   // Navigate to a same-site page that redirects, causing a transfer.
@@ -871,9 +874,9 @@
   // Create a RedirectObserver that goes away before we close the tab.
   {
     RedirectObserver redirect_observer(contents);
-    GURL dest_url(https_test_server.GetURL("files/title2.html"));
-    GURL redirect_url(test_server()->GetURL("server-redirect?" +
-        dest_url.spec()));
+    GURL dest_url(https_test_server.GetURL("/title2.html"));
+    GURL redirect_url(
+        embedded_test_server()->GetURL("/server-redirect?" + dest_url.spec()));
     ui_test_utils::NavigateToURL(browser(), redirect_url);
 
     // We should immediately see the new committed entry.
@@ -901,10 +904,10 @@
 // handler to run once.
 IN_PROC_BROWSER_TEST_F(BrowserTest, SingleBeforeUnloadAfterRedirect) {
   // Create HTTP and HTTPS servers for a cross-site transition.
-  ASSERT_TRUE(test_server()->Start());
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
 
   // Temporarily replace ContentBrowserClient with one that will cause a
@@ -914,7 +917,7 @@
       SetBrowserClientForTesting(&new_client);
 
   // Navigate to a page with a beforeunload handler.
-  GURL url(test_server()->GetURL("files/beforeunload.html"));
+  GURL url(embedded_test_server()->GetURL("/beforeunload.html"));
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Navigate to a URL that redirects to another process and approve the
@@ -922,9 +925,9 @@
   content::WindowedNotificationObserver nav_observer(
       content::NOTIFICATION_NAV_ENTRY_COMMITTED,
       content::NotificationService::AllSources());
-  GURL https_url(https_test_server.GetURL("files/title1.html"));
-  GURL redirect_url(test_server()->GetURL("server-redirect?" +
-      https_url.spec()));
+  GURL https_url(https_test_server.GetURL("/title1.html"));
+  GURL redirect_url(
+      embedded_test_server()->GetURL("/server-redirect?" + https_url.spec()));
   browser()->OpenURL(OpenURLParams(redirect_url, Referrer(), CURRENT_TAB,
                                    ui::PAGE_TRANSITION_TYPED, false));
   AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
@@ -945,8 +948,8 @@
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Navigate to a page that triggers a cross-site transition.
-  ASSERT_TRUE(test_server()->Start());
-  GURL url2(test_server()->GetURL("files/title1.html"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url2(embedded_test_server()->GetURL("/title1.html"));
   browser()->OpenURL(OpenURLParams(
       url2, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
 
@@ -1125,13 +1128,13 @@
       switches::kDisablePopupBlocking);
 
   // Create http and https servers for a cross-site transition.
-  ASSERT_TRUE(test_server()->Start());
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
-  GURL http_url(test_server()->GetURL("files/title1.html"));
-  GURL https_url(https_test_server.GetURL(std::string()));
+  GURL http_url(embedded_test_server()->GetURL("/title1.html"));
+  GURL https_url(https_test_server.GetURL(std::string("/")));
 
   // Start with an http URL.
   ui_test_utils::NavigateToURL(browser(), http_url);
@@ -1214,13 +1217,13 @@
       switches::kDisablePopupBlocking);
 
   // Create http and https servers for a cross-site transition.
-  ASSERT_TRUE(test_server()->Start());
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
-  GURL http_url(test_server()->GetURL("files/title1.html"));
-  GURL https_url(https_test_server.GetURL(std::string()));
+  GURL http_url(embedded_test_server()->GetURL("/title1.html"));
+  GURL https_url(https_test_server.GetURL("/"));
 
   // Start with an http URL.
   ui_test_utils::NavigateToURL(browser(), http_url);
@@ -1319,8 +1322,8 @@
   CommandUpdater* command_updater =
       browser()->command_controller()->command_updater();
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL http_url(test_server()->GetURL(std::string()));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL http_url(embedded_test_server()->GetURL("/"));
   ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme));
   ui_test_utils::NavigateToURL(browser(), http_url);
   EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
@@ -1330,11 +1333,12 @@
   CommandUpdater* command_updater =
       browser()->command_controller()->command_updater();
 
-  net::SpawnedTestServer test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                     net::SpawnedTestServer::kLocalhost,
-                                     base::FilePath(kDocRoot));
-  ASSERT_TRUE(test_server.Start());
-  GURL https_url(test_server.GetURL("/"));
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
+  ASSERT_TRUE(https_test_server.Start());
+
+  GURL https_url(https_test_server.GetURL("/"));
   ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme));
   ui_test_utils::NavigateToURL(browser(), https_url);
   EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS));
@@ -1375,8 +1379,8 @@
 // Change a tab into an application window.
 // DISABLED: http://crbug.com/72310
 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL http_url(test_server()->GetURL(std::string()));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL http_url(embedded_test_server()->GetURL("/"));
   ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme));
 
   ASSERT_EQ(1, browser()->tab_strip_model()->count());
@@ -1428,9 +1432,9 @@
 // to an anchor in javascript body.onload handler.
 IN_PROC_BROWSER_TEST_F(BrowserTest,
                        DISABLED_FaviconOfOnloadRedirectToAnchorPage) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url(test_server()->GetURL("files/onload_redirect_to_anchor.html"));
-  GURL expected_favicon_url(test_server()->GetURL("files/test.png"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url(embedded_test_server()->GetURL("/onload_redirect_to_anchor.html"));
+  GURL expected_favicon_url(embedded_test_server()->GetURL("/test.png"));
 
   ui_test_utils::NavigateToURL(browser(), url);
 
@@ -1473,9 +1477,9 @@
 // Makes sure TabClosing is sent when uninstalling an extension that is an app
 // tab.
 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TabClosingWhenRemovingExtension) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
-  GURL url(test_server()->GetURL("empty.html"));
+  GURL url(embedded_test_server()->GetURL("/empty.html"));
   TabStripModel* model = browser()->tab_strip_model();
 
   ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
@@ -1516,7 +1520,7 @@
 
 // Open with --app-id=<id>, and see that an application tab opens by default.
 IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // There should be one tab to start with.
   ASSERT_EQ(1, browser()->tab_strip_model()->count());
@@ -1556,7 +1560,7 @@
 // Open an app window and the dev tools window and ensure that the location
 // bar settings are correct.
 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Load an app.
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
@@ -1609,11 +1613,11 @@
 #if !defined(OS_CHROMEOS)
 // Makes sure pinned tabs are restored correctly on start.
 IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Add a pinned tab.
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
-  GURL url(test_server()->GetURL("empty.html"));
+  GURL url(embedded_test_server()->GetURL("/empty.html"));
   TabStripModel* model = browser()->tab_strip_model();
   ui_test_utils::NavigateToURL(browser(), url);
   model->SetTabPinned(0, true);
@@ -1680,7 +1684,7 @@
 
 #if !defined(OS_MACOSX)
 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Load an app
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
@@ -2008,9 +2012,9 @@
 }
 
 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
-  GURL url(test_server()->GetURL("empty.html"));
+  GURL url(embedded_test_server()->GetURL("/empty.html"));
   ui_test_utils::NavigateToURL(browser(), url);
 
   CommandUpdater* command_updater =
@@ -2051,9 +2055,9 @@
 // Ensure that creating an interstitial page closes any JavaScript dialogs
 // that were present on the previous page.  See http://crbug.com/295695.
 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialClosesDialogs) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
-  GURL url(test_server()->GetURL("empty.html"));
+  GURL url(embedded_test_server()->GetURL("/empty.html"));
   ui_test_utils::NavigateToURL(browser(), url);
 
   WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
@@ -2129,8 +2133,8 @@
       browser()->tab_strip_model()->GetActiveWebContents();
   MockWebContentsObserver mock_observer(web_contents);
 
-  ASSERT_TRUE(test_server()->Start());
-  GURL url(test_server()->GetURL("empty.html"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url(embedded_test_server()->GetURL("/empty.html"));
 
   ui_test_utils::NavigateToURL(browser(), url);
   EXPECT_TRUE(mock_observer.got_user_gesture());
@@ -2738,11 +2742,11 @@
   // visible_url=title1.html)
   browser()->profile()->GetPrefs()->SetBoolean(prefs::kWebKitJavascriptEnabled,
                                                false);
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   // Create an HTTPS server for cross-site transition.
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
 
   // Start with NTP.
@@ -2759,7 +2763,7 @@
 
   // Navigate to a non-NTP page, without resizing WebContentsView.
   ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL("files/title1.html"));
+                               embedded_test_server()->GetURL("/title1.html"));
   ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
   // A new RenderViewHost should be created.
   EXPECT_NE(prev_rvh, web_contents->GetRenderViewHost());
@@ -2797,7 +2801,7 @@
 
   // Navigate to another non-NTP page, without resizing WebContentsView.
   ui_test_utils::NavigateToURL(browser(),
-                               https_test_server.GetURL("files/title2.html"));
+                               https_test_server.GetURL("/title2.html"));
   ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
   // A new RenderVieHost should be created.
   EXPECT_NE(prev_rvh, web_contents->GetRenderViewHost());
@@ -2817,7 +2821,7 @@
   gfx::Size wcv_resize_insets(1, 1);
   observer.set_wcv_resize_insets(wcv_resize_insets);
   ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL("files/title2.html"));
+                               embedded_test_server()->GetURL("/title2.html"));
   ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
   gfx::Size rwhv_create_size2, rwhv_commit_size2, wcv_commit_size2;
   observer.GetSizeForRenderViewHost(web_contents->GetRenderViewHost(),
@@ -2906,25 +2910,25 @@
 // Tests that the WebContentsObserver::SecurityStyleChanged event fires
 // with the current style on HTTP, broken HTTPS, and valid HTTPS pages.
 IN_PROC_BROWSER_TEST_F(BrowserTest, SecurityStyleChangedObserver) {
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
-  net::SpawnedTestServer https_test_server_expired(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::SSLOptions(
-          net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
-      base::FilePath(kDocRoot));
-
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
+
+  net::EmbeddedTestServer https_test_server_expired(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
+  https_test_server_expired.ServeFilesFromSourceDirectory(
+      base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server_expired.Start());
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   content::WebContents* web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
   SecurityStyleTestObserver observer(web_contents);
 
   // Visit an HTTP url.
-  GURL http_url(test_server()->GetURL(std::string()));
+  GURL http_url(embedded_test_server()->GetURL("/"));
   ui_test_utils::NavigateToURL(browser(), http_url);
   EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED,
             observer.latest_security_style());
@@ -2937,9 +2941,9 @@
 
   // Visit an (otherwise valid) HTTPS page that displays mixed content.
   std::string replacement_path;
-  ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
-      "files/ssl/page_displays_insecure_content.html",
-      test_server()->host_port_pair(), &replacement_path));
+  GetFilePathWithHostAndPortReplacement(
+      "/ssl/page_displays_insecure_content.html",
+      embedded_test_server()->host_port_pair(), &replacement_path);
 
   GURL mixed_content_url(https_test_server.GetURL(replacement_path));
   ui_test_utils::NavigateToURL(browser(), mixed_content_url);
@@ -2961,7 +2965,7 @@
             mixed_content_explanation.ran_insecure_content_style);
 
   // Visit a broken HTTPS url.
-  GURL expired_url(https_test_server_expired.GetURL(std::string()));
+  GURL expired_url(https_test_server_expired.GetURL(std::string("/")));
   ui_test_utils::NavigateToURL(browser(), expired_url);
 
   // An interstitial should show, and an event for the lock icon on the
@@ -2977,7 +2981,7 @@
 
   // Before clicking through, navigate to a different page, and then go
   // back to the interstitial.
-  GURL valid_https_url(https_test_server.GetURL(std::string()));
+  GURL valid_https_url(https_test_server.GetURL(std::string("/")));
   ui_test_utils::NavigateToURL(browser(), valid_https_url);
   EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED,
             observer.latest_security_style());
@@ -3021,20 +3025,16 @@
 // Visit a valid HTTPS page, then a broken HTTPS page, and then go back,
 // and test that the observed security style matches.
 IN_PROC_BROWSER_TEST_F(BrowserTest, SecurityStyleChangedObserverGoBack) {
-  net::SpawnedTestServer https_test_server(net::SpawnedTestServer::TYPE_HTTPS,
-                                           net::SpawnedTestServer::kLocalhost,
-                                           base::FilePath(kDocRoot));
-
-  // Use a separate server to work around a mysterious SSL handshake
-  // timeout when both requests go to the same server. See
-  // https://crbug.com/515906.
-  net::SpawnedTestServer https_test_server_expired(
-      net::SpawnedTestServer::TYPE_HTTPS,
-      net::SpawnedTestServer::SSLOptions(
-          net::SpawnedTestServer::SSLOptions::CERT_EXPIRED),
-      base::FilePath(kDocRoot));
-
+  net::EmbeddedTestServer https_test_server(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server.Start());
+
+  net::EmbeddedTestServer https_test_server_expired(
+      net::EmbeddedTestServer::TYPE_HTTPS);
+  https_test_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
+  https_test_server_expired.ServeFilesFromSourceDirectory(
+      base::FilePath(kDocRoot));
   ASSERT_TRUE(https_test_server_expired.Start());
 
   content::WebContents* web_contents =
@@ -3042,7 +3042,7 @@
   SecurityStyleTestObserver observer(web_contents);
 
   // Visit a valid HTTPS url.
-  GURL valid_https_url(https_test_server.GetURL(std::string()));
+  GURL valid_https_url(https_test_server.GetURL(std::string("/")));
   ui_test_utils::NavigateToURL(browser(), valid_https_url);
   EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED,
             observer.latest_security_style());
@@ -3056,7 +3056,7 @@
 
   // Navigate to a bad HTTPS page on a different host, and then click
   // Back to verify that the previous good security style is seen again.
-  GURL expired_https_url(https_test_server_expired.GetURL(std::string()));
+  GURL expired_https_url(https_test_server_expired.GetURL(std::string("/")));
   host_resolver()->AddRule("www.example_broken.test", "127.0.0.1");
   GURL::Replacements replace_host;
   replace_host.SetHostStr("www.example_broken.test");
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc
index 6be8ead..dd51bde 100644
--- a/chrome/browser/ui/browser_focus_uitest.cc
+++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -71,7 +71,7 @@
  public:
   // InProcessBrowserTest overrides:
   void SetUpOnMainThread() override {
-     ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   bool IsViewFocused(ViewID vid) {
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index ba50af6..bc2fc35a 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -30,13 +30,14 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/web_contents.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::WebContents;
 
 namespace {
 
 const char kExpectedTitle[] = "PASSED!";
-const char kEchoTitleCommand[] = "echotitle";
+const char kEchoTitleCommand[] = "/echotitle";
 
 GURL GetGoogleURL() {
   return GURL("http://www.google.com/");
@@ -1355,14 +1356,15 @@
 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
                        SendBrowserInitiatedRequestUsingPOST) {
   // Uses a test sever to verify POST request.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Open a browser initiated POST request in new foreground tab.
   base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle));
   std::string post_data = kExpectedTitle;
   base::string16 title;
   ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle(
-      test_server()->GetURL(kEchoTitleCommand), post_data, true, &title));
+      embedded_test_server()->GetURL(kEchoTitleCommand), post_data, true,
+      &title));
   EXPECT_EQ(expected_title, title);
 }
 
@@ -1371,14 +1373,15 @@
 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
                        SendRendererInitiatedRequestUsingPOST) {
   // Uses a test sever to verify POST request.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Open a renderer initiated POST request in new foreground tab.
   base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle));
   std::string post_data = kExpectedTitle;
   base::string16 title;
   ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle(
-      test_server()->GetURL(kEchoTitleCommand), post_data, false, &title));
+      embedded_test_server()->GetURL(kEchoTitleCommand), post_data, false,
+      &title));
   EXPECT_NE(expected_title, title);
 }
 
diff --git a/chrome/browser/ui/cocoa/accelerators_cocoa.h b/chrome/browser/ui/cocoa/accelerators_cocoa.h
index 5c89619..d736814 100644
--- a/chrome/browser/ui/cocoa/accelerators_cocoa.h
+++ b/chrome/browser/ui/cocoa/accelerators_cocoa.h
@@ -20,7 +20,7 @@
 
 // This class maintains a map of command_ids to Accelerator objects (see
 // chrome/app/chrome_command_ids.h). Currently, this only lists the commands
-// that are used in the Wrench menu.
+// that are used in the App menu.
 //
 // It is recommended that this class be used as a singleton so that the key map
 // isn't created multiple places.
@@ -59,7 +59,7 @@
 
   // A map from command_id to Accelerator. The accelerator is fully filled out,
   // and its platform_accelerator is also fully filled out.
-  // Contains accelerators from both the wrench menu and the main menu.
+  // Contains accelerators from both the app menu and the main menu.
   AcceleratorMap accelerators_;
   // A list of accelerators used in the main menu that have no associated
   // command_id. The accelerator is fully filled out, and its
diff --git a/chrome/browser/ui/cocoa/wrench_menu/OWNERS b/chrome/browser/ui/cocoa/app_menu/OWNERS
similarity index 100%
rename from chrome/browser/ui/cocoa/wrench_menu/OWNERS
rename to chrome/browser/ui/cocoa/app_menu/OWNERS
diff --git a/chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm b/chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm
index 7119c25..8574e16f 100644
--- a/chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm
@@ -15,6 +15,8 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_window.h"
 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
+#import "chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h"
+#import "chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h"
 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
@@ -23,8 +25,6 @@
 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
 #import "chrome/browser/ui/cocoa/l10n_util.h"
 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
-#import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
-#import "chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h"
 #include "chrome/browser/ui/toolbar/app_menu_model.h"
 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h"
 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
diff --git a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.h b/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h
similarity index 89%
rename from chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.h
rename to chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h
index 528d8b8..0fbc5127 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.h
+++ b/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROME_BROWSER_UI_COCOA_WRENCH_MENU_MENU_TRACKED_BUTTON_H_
-#define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_MENU_TRACKED_BUTTON_H_
+#ifndef CHROME_BROWSER_UI_COCOA_APP_MENU_MENU_TRACKED_BUTTON_H_
+#define CHROME_BROWSER_UI_COCOA_APP_MENU_MENU_TRACKED_BUTTON_H_
 
 #import <Cocoa/Cocoa.h>
 
@@ -39,4 +39,4 @@
 
 @end
 
-#endif  // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_MENU_TRACKED_BUTTON_H_
+#endif  // CHROME_BROWSER_UI_COCOA_APP_MENU_MENU_TRACKED_BUTTON_H_
diff --git a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.mm b/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm
similarity index 97%
rename from chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.mm
rename to chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm
index e7da3df..40dfcb4 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.mm
+++ b/chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_button.h"
+#import "chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h"
 
 @interface MenuTrackedButton (Private)
 - (void)doHighlight:(BOOL)highlight;
diff --git a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h b/chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h
similarity index 77%
rename from chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h
rename to chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h
index 7dc4bff..8565518 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h
+++ b/chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROME_BROWSER_UI_COCOA_WRENCH_MENU_MENU_TRACKED_ROOT_VIEW_H_
-#define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_MENU_TRACKED_ROOT_VIEW_H_
+#ifndef CHROME_BROWSER_UI_COCOA_APP_MENU_MENU_TRACKED_ROOT_VIEW_H_
+#define CHROME_BROWSER_UI_COCOA_APP_MENU_MENU_TRACKED_ROOT_VIEW_H_
 
 #import <Cocoa/Cocoa.h>
 
@@ -21,4 +21,4 @@
 
 @end
 
-#endif  // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_MENU_TRACKED_ROOT_VIEW_H_
+#endif  // CHROME_BROWSER_UI_COCOA_APP_MENU_MENU_TRACKED_ROOT_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.mm b/chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.mm
similarity index 81%
rename from chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.mm
rename to chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.mm
index 96b3b26..d9790e9 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.mm
+++ b/chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.mm
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
+#import "chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h"
 
 @implementation MenuTrackedRootView
 
diff --git a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view_unittest.mm b/chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view_unittest.mm
similarity index 95%
rename from chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view_unittest.mm
rename to chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view_unittest.mm
index 924b9426..57accc1 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view_unittest.mm
+++ b/chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view_unittest.mm
@@ -5,8 +5,8 @@
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
+#import "chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h"
 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 #import "third_party/ocmock/OCMock/OCMock.h"
diff --git a/chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h b/chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h
similarity index 77%
rename from chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h
rename to chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h
index 774979a..0ad657a 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h
+++ b/chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h
@@ -2,12 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROME_BROWSER_UI_COCOA_WRENCH_MENU_RECENT_TABS_MENU_MODEL_DELEGATE_H_
-#define CHROME_BROWSER_UI_COCOA_WRENCH_MENU_RECENT_TABS_MENU_MODEL_DELEGATE_H_
+#ifndef CHROME_BROWSER_UI_COCOA_APP_MENU_RECENT_TABS_MENU_MODEL_DELEGATE_H_
+#define CHROME_BROWSER_UI_COCOA_APP_MENU_RECENT_TABS_MENU_MODEL_DELEGATE_H_
 
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
+#include "base/macros.h"
 #include "ui/base/models/menu_model_delegate.h"
 
 namespace ui {
@@ -31,4 +32,4 @@
   DISALLOW_COPY_AND_ASSIGN(RecentTabsMenuModelDelegate);
 };
 
-#endif  // CHROME_BROWSER_UI_COCOA_WRENCH_MENU_RECENT_TABS_MENU_MODEL_DELEGATE_H_
+#endif  // CHROME_BROWSER_UI_COCOA_APP_MENU_RECENT_TABS_MENU_MODEL_DELEGATE_H_
diff --git a/chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.mm b/chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.mm
similarity index 90%
rename from chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.mm
rename to chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.mm
index fdcaec3e..e4cbd713 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.mm
+++ b/chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.mm
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#import "chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h"
+#import "chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h"
 #include "ui/base/models/menu_model.h"
 #include "ui/gfx/image/image.h"
 
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.mm
index 4021743..be3a25d 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.mm
@@ -8,6 +8,7 @@
 #include "chrome/browser/signin/signin_promo.h"
 #include "chrome/browser/ui/chrome_pages.h"
 #include "chrome/browser/ui/chrome_style.h"
+#include "chrome/grit/chromium_strings.h"
 #include "chrome/grit/generated_resources.h"
 #include "skia/ext/skia_utils_mac.h"
 #include "third_party/skia/include/core/SkColor.h"
diff --git a/chrome/browser/ui/cocoa/extensions/extension_message_bubble_bridge.mm b/chrome/browser/ui/cocoa/extensions/extension_message_bubble_bridge.mm
index 86f1361..28b77e5e 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_message_bubble_bridge.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_message_bubble_bridge.mm
@@ -48,9 +48,12 @@
 
 void ExtensionMessageBubbleBridge::OnBubbleClosed(CloseAction action) {
   switch(action) {
-    case CLOSE_DISMISS:
-      controller_->OnBubbleDismiss();
+    case CLOSE_DISMISS_USER_ACTION:
+    case CLOSE_DISMISS_DEACTIVATION: {
+      bool close_by_deactivate = action == CLOSE_DISMISS_DEACTIVATION;
+      controller_->OnBubbleDismiss(close_by_deactivate);
       break;
+    }
     case CLOSE_EXECUTE:
       controller_->OnBubbleAction();
       break;
diff --git a/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.mm b/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.mm
index 5e01460..ccba1d80 100644
--- a/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.mm
+++ b/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.mm
@@ -106,7 +106,7 @@
 - (void)windowWillClose:(NSNotification*)notification {
   if (!acknowledged_) {
     delegate_->OnBubbleClosed(
-        ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS);
+        ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION);
     acknowledged_ = YES;
   }
   [super windowWillClose:notification];
@@ -327,7 +327,7 @@
   if (learnMoreButton_ && sender == learnMoreButton_) {
     action = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE;
   } else if (dismissButton_ && sender == dismissButton_) {
-    action = ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS;
+    action = ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION;
   } else {
     DCHECK_EQ(sender, actionButton_);
     action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE;
diff --git a/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac_unittest.mm b/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac_unittest.mm
index 6c266f4..4f9a443 100644
--- a/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac_unittest.mm
+++ b/chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac_unittest.mm
@@ -117,12 +117,15 @@
     case ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE:
       button = [bubble actionButton];
       break;
-    case ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS:
+    case ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION:
       button = [bubble dismissButton];
       break;
     case ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE:
       button = [bubble learnMoreButton];
       break;
+    case ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION:
+      NOTREACHED();  // Deactivation is tested below.
+      break;
   }
   ASSERT_TRUE(button);
 
@@ -144,7 +147,7 @@
 TEST_F(ToolbarActionsBarBubbleMacTest, CloseActionAndDismiss) {
   // Test all the possible actions.
   TestBubbleButton(ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE);
-  TestBubbleButton(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS);
+  TestBubbleButton(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION);
   TestBubbleButton(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE);
 
   {
@@ -160,7 +163,7 @@
     [bubble close];
     chrome::testing::NSRunLoopRunAllPending();
     ASSERT_TRUE(delegate.close_action());
-    EXPECT_EQ(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS,
+    EXPECT_EQ(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION,
               *delegate.close_action());
     EXPECT_TRUE([windowObserver windowIsClosing]);
   }
diff --git a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm
index 2cc4dbaa..b607324 100644
--- a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm
@@ -70,6 +70,7 @@
     ManagePasswordsControllerTest::SetUp();
     delegate_.reset([[ContentViewDelegateMock alloc] init]);
     avatar_manager_.reset([[AccountAvatarFetcherTestManager alloc] init]);
+    ui_controller()->SetState(password_manager::ui::CREDENTIAL_REQUEST_STATE);
   }
 
   ContentViewDelegateMock* delegate() { return delegate_.get(); }
diff --git a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h
index df9c21f..845c0d8 100644
--- a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h
+++ b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h
@@ -8,6 +8,7 @@
 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
 #import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controller.h"
+#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 
 namespace content {
 class WebContents;
@@ -25,6 +26,10 @@
   ManagePasswordsUIControllerMock* ui_controller() { return ui_controller_; }
   ManagePasswordsBubbleModel* model();
 
+  // An opportunity for tests to override the constructor parameter of
+  // ManagePasswordsBubbleModel.
+  virtual ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const;
+
  private:
   ManagePasswordsUIControllerMock* ui_controller_;
   scoped_ptr<content::WebContents> test_web_contents_;
diff --git a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
index a5738f25..61be389 100644
--- a/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
+++ b/chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm
@@ -4,8 +4,10 @@
 
 #include "chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h"
 
-#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
+#include "chrome/browser/password_manager/password_store_factory.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
+#include "components/password_manager/core/browser/mock_password_store.h"
+#include "components/password_manager/core/browser/password_manager_test_utils.h"
 #include "content/public/test/web_contents_tester.h"
 
 ManagePasswordsControllerTest::
@@ -24,17 +26,26 @@
       content::WebContentsTester::CreateTestWebContents(profile(), NULL));
   ui_controller_ =
       new ManagePasswordsUIControllerMock(test_web_contents_.get());
+  PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
+      profile(), password_manager::BuildPasswordStore<
+                     content::BrowserContext,
+                     testing::NiceMock<password_manager::MockPasswordStore>>);
 }
 
 ManagePasswordsBubbleModel*
 ManagePasswordsControllerTest::model() {
   if (!model_) {
-    model_.reset(new ManagePasswordsBubbleModel(
-        test_web_contents_.get(), ManagePasswordsBubbleModel::AUTOMATIC));
+    model_.reset(new ManagePasswordsBubbleModel(test_web_contents_.get(),
+                                                GetDisplayReason()));
   }
   return model_.get();
 }
 
+ManagePasswordsBubbleModel::DisplayReason
+ManagePasswordsControllerTest::GetDisplayReason() const {
+  return ManagePasswordsBubbleModel::AUTOMATIC;
+}
+
 @implementation ContentViewDelegateMock
 
 @synthesize dismissed = _dismissed;
diff --git a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
index 487ec8c..6c6783e 100644
--- a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller_unittest.mm
@@ -25,6 +25,7 @@
   void SetUp() override {
     ManagePasswordsControllerTest::SetUp();
     delegate_.reset([[ContentViewDelegateMock alloc] init]);
+    ui_controller()->SetState(password_manager::ui::CONFIRMATION_STATE);
   }
 
   ContentViewDelegateMock* delegate() { return delegate_.get(); }
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm
index 3c983a6..2045c7d 100644
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller_unittest.mm
@@ -25,6 +25,7 @@
   void SetUp() override {
     ManagePasswordsControllerTest::SetUp();
     delegate_.reset([[ContentViewDelegateMock alloc] init]);
+    ui_controller()->SetState(password_manager::ui::MANAGE_STATE);
   }
 
   ContentViewDelegateMock* delegate() { return delegate_.get(); }
@@ -39,6 +40,10 @@
     return controller_.get();
   }
 
+  ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const override {
+    return ManagePasswordsBubbleModel::USER_ACTION;
+  }
+
  private:
   base::scoped_nsobject<ManagePasswordsBubbleManageViewController> controller_;
   base::scoped_nsobject<ContentViewDelegateMock> delegate_;
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm
index 4df5dc55..7e1c456 100644
--- a/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm
@@ -8,6 +8,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/mac/foundation_util.h"
+#include "chrome/browser/password_manager/password_store_factory.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_command_controller.h"
 #include "chrome/browser/ui/browser_window.h"
@@ -21,6 +22,8 @@
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 #include "chrome/browser/ui/tab_dialogs.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "components/password_manager/core/browser/mock_password_store.h"
+#include "components/password_manager/core/browser/password_manager_test_utils.h"
 #include "content/public/browser/site_instance.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/web_contents_tester.h"
@@ -45,6 +48,10 @@
         new ManagePasswordsUIControllerMock(test_web_contents_);
     browser()->tab_strip_model()->AppendWebContents(
         test_web_contents_, /*foreground=*/true);
+    PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
+        profile(), password_manager::BuildPasswordStore<
+                       content::BrowserContext,
+                       testing::NiceMock<password_manager::MockPasswordStore>>);
     // Set the initial state.
     ScopedVector<autofill::PasswordForm> forms;
     forms.push_back(new autofill::PasswordForm);
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller_unittest.mm
index bc8315e..ca219da7 100644
--- a/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/passwords_bubble_controller_unittest.mm
@@ -16,6 +16,7 @@
 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h"
 #import "chrome/browser/ui/cocoa/passwords/pending_password_view_controller.h"
 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
+#include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/gtest_mac.h"
 #include "testing/platform_test.h"
@@ -38,18 +39,22 @@
     return controller_;
   }
 
+  ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const override {
+    return ManagePasswordsBubbleModel::USER_ACTION;
+  }
+
  private:
   ManagePasswordsBubbleController* controller_;  // weak; owns itself.
 };
 
 TEST_F(ManagePasswordsBubbleControllerTest, PendingStateShouldHavePendingView) {
-  model()->set_state(password_manager::ui::PENDING_PASSWORD_STATE);
+  ui_controller()->SetState(password_manager::ui::PENDING_PASSWORD_STATE);
   EXPECT_EQ([ManagePasswordsBubblePendingViewController class],
             [[controller() currentController] class]);
 }
 
 TEST_F(ManagePasswordsBubbleControllerTest, DismissingShouldCloseWindow) {
-  model()->set_state(password_manager::ui::PENDING_PASSWORD_STATE);
+  ui_controller()->SetState(password_manager::ui::PENDING_PASSWORD_STATE);
   [controller() showWindow:nil];
 
   // Turn off animations so that closing happens immediately.
@@ -63,7 +68,7 @@
 }
 
 TEST_F(ManagePasswordsBubbleControllerTest, ManageStateShouldHaveManageView) {
-  model()->set_state(password_manager::ui::MANAGE_STATE);
+  ui_controller()->SetState(password_manager::ui::MANAGE_STATE);
   EXPECT_EQ([ManagePasswordsBubbleManageViewController class],
             [[controller() currentController] class]);
 }
diff --git a/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm
index adf8ea8..43753d7 100644
--- a/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/passwords_list_view_controller_unittest.mm
@@ -43,14 +43,14 @@
 
   void SetUpManageState(
       const std::vector<const autofill::PasswordForm*>& forms) {
-    model()->set_state(password_manager::ui::MANAGE_STATE);
+    ui_controller()->SetState(password_manager::ui::MANAGE_STATE);
     controller_.reset([[PasswordsListViewController alloc]
         initWithModel:model()
                 forms:forms]);
   }
 
-  void SetUpManageState(const autofill::PasswordForm* form) {
-    model()->set_state(password_manager::ui::PENDING_PASSWORD_STATE);
+  void SetUpPendingState(const autofill::PasswordForm* form) {
+    ui_controller()->SetState(password_manager::ui::PENDING_PASSWORD_STATE);
     controller_.reset([[PasswordsListViewController alloc]
         initWithModel:model()
                 forms:std::vector<const autofill::PasswordForm*>(1, form)]);
@@ -83,6 +83,10 @@
     return static_cast<password_manager::MockPasswordStore*>(store);
   }
 
+  ManagePasswordsBubbleModel::DisplayReason GetDisplayReason() const override {
+    return ManagePasswordsBubbleModel::USER_ACTION;
+  }
+
  private:
   base::scoped_nsobject<PasswordsListViewController> controller_;
 
@@ -164,7 +168,7 @@
 
 TEST_F(PasswordsListViewControllerTest, PendingStateShouldHavePendingView) {
   autofill::PasswordForm form = local_credential();
-  SetUpManageState(&form);
+  SetUpPendingState(&form);
   EXPECT_EQ(MANAGE_PASSWORD_ITEM_STATE_PENDING, [GetControllerAt(0) state]);
   EXPECT_NSEQ([PendingPasswordItemView class],
               [[GetControllerAt(0) contentView] class]);
@@ -173,7 +177,7 @@
 TEST_F(PasswordsListViewControllerTest,
        PendingViewShouldHaveCorrectUsernameAndObscuredPassword) {
   autofill::PasswordForm form = local_credential();
-  SetUpManageState(&form);
+  SetUpPendingState(&form);
   PendingPasswordItemView* pendingView =
       base::mac::ObjCCast<PendingPasswordItemView>(
           [GetControllerAt(0) contentView]);
@@ -187,7 +191,7 @@
 TEST_F(PasswordsListViewControllerTest,
        PendingViewShouldHaveCorrectUsernameAndFederation) {
   autofill::PasswordForm form = federated_credential();
-  SetUpManageState(&form);
+  SetUpPendingState(&form);
   PendingPasswordItemView* pendingView =
       base::mac::ObjCCast<PendingPasswordItemView>(
           [GetControllerAt(0) contentView]);
diff --git a/chrome/browser/ui/cocoa/passwords/pending_password_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/pending_password_view_controller_unittest.mm
index b2974e2b..85c69184 100644
--- a/chrome/browser/ui/cocoa/passwords/pending_password_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/pending_password_view_controller_unittest.mm
@@ -26,6 +26,7 @@
   void SetUp() override {
     ManagePasswordsControllerTest::SetUp();
     delegate_.reset([[ContentViewDelegateMock alloc] init]);
+    ui_controller()->SetState(password_manager::ui::PENDING_PASSWORD_STATE);
   }
 
   ContentViewDelegateMock* delegate() { return delegate_.get(); }
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc
index 4b8b84e4..6303502 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc
@@ -16,7 +16,7 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "components/content_settings/core/common/content_settings_types.h"
 #include "content/public/test/test_navigation_observer.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 const base::FilePath::CharType kDocRoot[] =
@@ -26,11 +26,8 @@
  protected:
   void SetUpInProcessBrowserTestFixture() override {
     https_server_.reset(
-        new net::SpawnedTestServer(
-            net::SpawnedTestServer::TYPE_HTTPS,
-            net::SpawnedTestServer::SSLOptions(
-                net::SpawnedTestServer::SSLOptions::CERT_OK),
-            base::FilePath(kDocRoot)));
+        new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
+    https_server_->ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
     ASSERT_TRUE(https_server_->Start());
   }
 
@@ -39,15 +36,14 @@
         browser()->tab_strip_model()->GetActiveWebContents());
   }
 
-  scoped_ptr<net::SpawnedTestServer> https_server_;
+  scoped_ptr<net::EmbeddedTestServer> https_server_;
 };
 
 // Tests that a MIXEDSCRIPT type ContentSettingBubbleModel sends appropriate
 // IPCs to allow the renderer to load unsafe scripts and refresh the page
 // automatically.
 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, MainFrame) {
-  GURL url(https_server_->GetURL(
-      "files/content_setting_bubble/mixed_script.html"));
+  GURL url(https_server_->GetURL("/content_setting_bubble/mixed_script.html"));
 
   // Load a page with mixed content and do quick verification by looking at
   // the title string.
@@ -79,7 +75,7 @@
 // content shield isn't shown for it).
 IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, Iframe) {
   GURL url(https_server_->GetURL(
-      "files/content_setting_bubble/mixed_script_in_iframe.html"));
+      "/content_setting_bubble/mixed_script_in_iframe.html"));
 
   ui_test_utils::NavigateToURL(browser(), url);
 
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc
index 898a9233..cd5679dbb 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_browsertest.cc
@@ -14,6 +14,7 @@
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/url_constants.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::WebContents;
 using ui::PAGE_TRANSITION_TYPED;
@@ -95,8 +96,8 @@
 }
 
 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, PermissionContentSettings) {
-  GURL url = test_server()->GetURL(kFullscreenMouseLockHTML);
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url = embedded_test_server()->GetURL(kFullscreenMouseLockHTML);
   ui_test_utils::NavigateToURL(browser(), url);
 
   EXPECT_FALSE(browser()->window()->IsFullscreen());
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
index 868bb34..1f3ab90 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
@@ -19,6 +19,7 @@
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/url_constants.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using url::kAboutBlankURL;
 using content::WebContents;
@@ -26,7 +27,7 @@
 
 namespace {
 
-const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("simple.html");
+const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("/simple.html");
 
 }  // namespace
 
@@ -100,7 +101,7 @@
 // Tests Fullscreen and Mouse Lock with varying content settings ALLOW & BLOCK.
 void
 FullscreenControllerInteractiveTest::TestFullscreenMouseLockContentSettings() {
-  GURL url = test_server()->GetURL("simple.html");
+  GURL url = embedded_test_server()->GetURL("/simple.html");
   AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED);
 
   // Validate that going fullscreen for a URL defaults to asking permision.
@@ -185,7 +186,7 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_TestNewTabExitsFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
 
@@ -203,7 +204,7 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_TestTabExitsItselfFromFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
 
@@ -216,7 +217,7 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_TestFullscreenBubbleMouseLockState) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
   AddTabAtIndex(1, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
@@ -302,7 +303,7 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_TestTabExitsFullscreenOnNavigation) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
   ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true));
@@ -315,7 +316,7 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_TestTabExitsFullscreenOnGoBack) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
   ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"));
@@ -332,7 +333,7 @@
 IN_PROC_BROWSER_TEST_F(
     FullscreenControllerInteractiveTest,
     DISABLED_TestTabDoesntExitFullscreenOnSubFrameNavigation) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL url(ui_test_utils::GetTestUrl(base::FilePath(
       base::FilePath::kCurrentDirectory), base::FilePath(kSimpleFile)));
@@ -349,7 +350,7 @@
 IN_PROC_BROWSER_TEST_F(
     FullscreenControllerInteractiveTest,
     DISABLED_TestFullscreenFromTabWhenAlreadyInBrowserFullscreenWorks) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
   ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"));
@@ -367,7 +368,7 @@
 // http://crbug.com/100467
 IN_PROC_BROWSER_TEST_F(
     FullscreenControllerTest, DISABLED_TabEntersPresentationModeFromWindowed) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   AddTabAtIndex(0, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
 
@@ -405,9 +406,9 @@
 
 // Tests mouse lock can be escaped with ESC key.
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, EscapingMouseLock) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsFullscreenBubbleDisplayed());
 
@@ -455,9 +456,9 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_EscapingMouseLockAndFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsFullscreenBubbleDisplayed());
 
@@ -517,9 +518,9 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_MouseLockThenFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsFullscreenBubbleDisplayed());
 
@@ -574,9 +575,9 @@
 // Tests mouse lock then fullscreen in same request.
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_MouseLockAndFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsFullscreenBubbleDisplayed());
 
@@ -633,9 +634,9 @@
 // Test is flaky: http://crbug.com/146006
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_PrivilegedMouseLockAndFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsFullscreenBubbleDisplayed());
 
@@ -669,9 +670,9 @@
 // with no UI distraction for users.
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        MAYBE_MouseLockSilentAfterTargetUnlock) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsFullscreenBubbleDisplayed());
 
@@ -756,9 +757,9 @@
 // Tests mouse lock is exited on page navigation.
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        MAYBE_TestTabExitsMouseLockOnNavigation) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   // Lock the mouse with a user gesture.
   ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
@@ -781,12 +782,12 @@
 // Tests mouse lock is exited when navigating back.
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        MAYBE_TestTabExitsMouseLockOnGoBack) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Navigate twice to provide a place to go back to.
   ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   // Lock the mouse with a user gesture.
   ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
@@ -816,10 +817,10 @@
 // Tests mouse lock is not exited on sub frame navigation.
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        MAYBE_TestTabDoesntExitMouseLockOnSubFrameNavigation) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Create URLs for test page and test page with #fragment.
-  GURL url(test_server()->GetURL(kFullscreenMouseLockHTML));
+  GURL url(embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
   GURL url_with_fragment(url.spec() + "#fragment");
 
   // Navigate to test page.
@@ -848,9 +849,9 @@
 // mac: http://crbug.com/103912
 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
                        DISABLED_ReloadExitsMouseLockAndFullscreen) {
-  ASSERT_TRUE(test_server()->Start());
-  ui_test_utils::NavigateToURL(browser(),
-                               test_server()->GetURL(kFullscreenMouseLockHTML));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  ui_test_utils::NavigateToURL(
+      browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
 
   ASSERT_FALSE(IsMouseLockPermissionRequested());
 
@@ -924,7 +925,7 @@
   // TestFullscreenMouseLockContentSettings.
   // http://crbug.com/133831
 
-  GURL url = test_server()->GetURL("simple.html");
+  GURL url = embedded_test_server()->GetURL("/simple.html");
   AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED);
 
   // Validate that going fullscreen for a URL defaults to asking permision.
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_test.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_test.cc
index 335892b..9683341 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller_test.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_test.cc
@@ -17,7 +17,7 @@
 using content::WebContents;
 
 const char FullscreenControllerTest::kFullscreenMouseLockHTML[] =
-    "files/fullscreen_mouselock/fullscreen_mouselock.html";
+    "/fullscreen_mouselock/fullscreen_mouselock.html";
 
 void FullscreenControllerTest::RequestToLockMouse(
     bool user_gesture,
diff --git a/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc
index 9b890cc..1c068d1 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc
@@ -17,7 +17,6 @@
 
 using base::WideToUTF16;
 using content::WebContents;
-using net::test_server::EmbeddedTestServer;
 
 namespace {
 
@@ -67,7 +66,7 @@
 #define MAYBE_FindInPageEndState FindInPageEndState
 #endif
 IN_PROC_BROWSER_TEST_F(FindInPageInteractiveTest, MAYBE_FindInPageEndState) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Make sure Chrome is in the foreground, otherwise sending input
   // won't do anything and the test will hang.
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index 31f6bd3..906fce7 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -22,6 +22,7 @@
 #include "chrome/common/pref_names.h"
 #include "chrome/grit/generated_resources.h"
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/password_manager.h"
 #include "components/url_formatter/elide_url.h"
 #include "content/public/browser/browser_thread.h"
@@ -147,9 +148,10 @@
     return;
   }
 
-  if (password_manager && password_manager->client()->IsLoggingActive()) {
+  if (password_manager &&
+      password_manager->client()->GetLogManager()->IsLoggingActive()) {
     password_manager::BrowserSavePasswordProgressLogger logger(
-        password_manager->client());
+        password_manager->client()->GetLogManager());
     logger.LogMessage(
         autofill::SavePasswordProgressLogger::STRING_SHOW_LOGIN_PROMPT_METHOD);
   }
@@ -246,9 +248,10 @@
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   scoped_ptr<password_manager::BrowserSavePasswordProgressLogger> logger;
-  if (password_manager_ && password_manager_->client()->IsLoggingActive()) {
+  if (password_manager_ &&
+      password_manager_->client()->GetLogManager()->IsLoggingActive()) {
     logger.reset(new password_manager::BrowserSavePasswordProgressLogger(
-        password_manager_->client()));
+        password_manager_->client()->GetLogManager()));
     logger->LogMessage(
         autofill::SavePasswordProgressLogger::STRING_SET_AUTH_METHOD);
   }
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
index bcf6f73e..60db0f8 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -36,9 +36,16 @@
   return Profile::FromBrowserContext(web_contents->GetBrowserContext());
 }
 
-void RecordExperimentStatistics(content::WebContents* web_contents,
-                                metrics_util::UIDismissalReason reason) {
-  // TODO(vasilii): revive the function while implementing the smart bubble.
+void CleanStatisticsForSite(content::WebContents* web_contents,
+                            const GURL& origin) {
+  DCHECK(web_contents);
+  Profile* profile =
+      Profile::FromBrowserContext(web_contents->GetBrowserContext());
+  password_manager::PasswordStore* password_store =
+      PasswordStoreFactory::GetForProfile(profile,
+                                          ServiceAccessType::EXPLICIT_ACCESS)
+          .get();
+  password_store->RemoveSiteStats(origin.GetOrigin());
 }
 
 ScopedVector<const autofill::PasswordForm> DeepCopyForms(
@@ -132,6 +139,16 @@
         password_bubble_experiment::SmartLockBranding::FULL,
         &autosignin_welcome_text_,
         &autosignin_welcome_link_range_);
+  } else if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) {
+    interaction_stats_.origin_domain = origin_.GetOrigin();
+    interaction_stats_.username_value = pending_password_.username_value;
+    interaction_stats_.update_time = base::Time::Now();
+    password_manager::InteractionsStats* stats =
+        controller->GetCurrentInteractionStats();
+    if (stats) {
+      // TODO(vasilii): DCHECK that username and origin are the same.
+      interaction_stats_.dismissal_count = stats->dismissal_count;
+    }
   }
 
   manage_link_ =
@@ -149,7 +166,11 @@
       case password_manager::ui::MANAGE_STATE:
         display_disposition_ = metrics_util::MANUAL_MANAGE_PASSWORDS;
         break;
-      default:
+      case password_manager::ui::CONFIRMATION_STATE:
+      case password_manager::ui::CREDENTIAL_REQUEST_STATE:
+      case password_manager::ui::AUTO_SIGNIN_STATE:
+      case password_manager::ui::INACTIVE_STATE:
+        NOTREACHED();
         break;
     }
   } else {
@@ -171,7 +192,9 @@
       case password_manager::ui::AUTO_SIGNIN_STATE:
         display_disposition_ = metrics_util::AUTOMATIC_SIGNIN_TOAST;
         break;
-      default:
+      case password_manager::ui::MANAGE_STATE:
+      case password_manager::ui::INACTIVE_STATE:
+        NOTREACHED();
         break;
     }
   }
@@ -183,10 +206,25 @@
 ManagePasswordsBubbleModel::~ManagePasswordsBubbleModel() {
   if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) {
     Profile* profile = GetProfile();
-    if (profile && (GetSmartLockBrandingState(profile) ==
-                    password_bubble_experiment::SmartLockBranding::FULL)) {
-      password_bubble_experiment::RecordSavePromptFirstRunExperienceWasShown(
-          profile->GetPrefs());
+    if (profile) {
+      if (GetSmartLockBrandingState(profile) ==
+          password_bubble_experiment::SmartLockBranding::FULL) {
+        password_bubble_experiment::RecordSavePromptFirstRunExperienceWasShown(
+            profile->GetPrefs());
+      }
+      if (dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION &&
+          display_disposition_ ==
+              metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING) {
+        if (interaction_stats_.dismissal_count <
+            std::numeric_limits<decltype(
+                interaction_stats_.dismissal_count)>::max())
+          interaction_stats_.dismissal_count++;
+        password_manager::PasswordStore* password_store =
+            PasswordStoreFactory::GetForProfile(
+                profile, ServiceAccessType::EXPLICIT_ACCESS)
+                .get();
+        password_store->AddSiteStats(interaction_stats_);
+      }
     }
   }
   ManagePasswordsUIController* manage_passwords_ui_controller =
@@ -203,10 +241,6 @@
     // reason for it.
     metrics_util::LogUIDismissalReason(dismissal_reason_);
   }
-  // Other use cases have been reported in the callbacks like OnSaveClicked().
-  if (state_ == password_manager::ui::PENDING_PASSWORD_STATE &&
-      dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION)
-    RecordExperimentStatistics(web_contents(), dismissal_reason_);
   // Check if this was update password and record update statistics.
   if (update_password_submission_event_ == metrics_util::NO_UPDATE_SUBMISSION &&
       (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
@@ -227,18 +261,20 @@
 }
 
 void ManagePasswordsBubbleModel::OnNeverForThisSiteClicked() {
+  DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_);
   dismissal_reason_ = metrics_util::CLICKED_NEVER;
   update_password_submission_event_ = GetUpdateDismissalReason(NOPE_CLICKED);
-  RecordExperimentStatistics(web_contents(), dismissal_reason_);
+  CleanStatisticsForSite(web_contents(), origin_);
   ManagePasswordsUIController* manage_passwords_ui_controller =
       ManagePasswordsUIController::FromWebContents(web_contents());
   manage_passwords_ui_controller->NeverSavePassword();
 }
 
 void ManagePasswordsBubbleModel::OnSaveClicked() {
+  DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_);
   dismissal_reason_ = metrics_util::CLICKED_SAVE;
-  RecordExperimentStatistics(web_contents(), dismissal_reason_);
   update_password_submission_event_ = GetUpdateDismissalReason(UPDATE_CLICKED);
+  CleanStatisticsForSite(web_contents(), origin_);
   ManagePasswordsUIController* manage_passwords_ui_controller =
       ManagePasswordsUIController::FromWebContents(web_contents());
   manage_passwords_ui_controller->SavePassword();
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
index dcfca96..8e685097 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
@@ -8,6 +8,7 @@
 #include "base/memory/scoped_vector.h"
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/password_manager_metrics_util.h"
+#include "components/password_manager/core/browser/statistics_table.h"
 #include "components/password_manager/core/common/password_manager_ui.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "ui/gfx/range/range.h"
@@ -185,6 +186,9 @@
   password_manager::metrics_util::UpdatePasswordSubmissionEvent
       update_password_submission_event_;
 
+  // Current statistics for the save password bubble;
+  password_manager::InteractionsStats interaction_stats_;
+
   DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel);
 };
 
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 44af20e..b35b338 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -7,13 +7,17 @@
 #include "base/prefs/pref_service.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/histogram_tester.h"
+#include "chrome/browser/password_manager/password_store_factory.h"
 #include "chrome/browser/sync/profile_sync_service_factory.h"
 #include "chrome/browser/sync/profile_sync_service_mock.h"
 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 #include "chrome/test/base/testing_profile.h"
+#include "components/password_manager/core/browser/mock_password_store.h"
 #include "components/password_manager/core/browser/password_bubble_experiment.h"
 #include "components/password_manager/core/browser/password_manager_metrics_util.h"
+#include "components/password_manager/core/browser/password_manager_test_utils.h"
+#include "components/password_manager/core/browser/statistics_table.h"
 #include "components/password_manager/core/common/credential_manager_types.h"
 #include "components/password_manager/core/common/password_manager_pref_names.h"
 #include "components/password_manager/core/common/password_manager_ui.h"
@@ -25,9 +29,13 @@
 using password_bubble_experiment::kBrandingExperimentName;
 using password_bubble_experiment::kSmartLockBrandingGroupName;
 using password_bubble_experiment::kSmartLockBrandingSavePromptOnlyGroupName;
+using ::testing::AnyNumber;
+using ::testing::Return;
+using ::testing::_;
 
 namespace {
 
+const char kSiteOrigin[] = "http://example.com/login";
 const char kUIDismissalReasonMetric[] = "PasswordManager.UIDismissalReason";
 
 class TestSyncService : public ProfileSyncServiceMock {
@@ -77,8 +85,16 @@
   MOCK_METHOD0(NavigateToExternalPasswordManager, void());
   MOCK_METHOD0(NavigateToSmartLockPage, void());
   MOCK_METHOD0(NavigateToSmartLockHelpPage, void());
+  MOCK_CONST_METHOD0(GetCurrentInteractionStats,
+                     password_manager::InteractionsStats*());
 };
 
+// TODO(vasilii): get rid of the matcher when it's possible to test the whole
+// InteractionsStats.
+MATCHER_P(DissmisalCountIs, count, "") {
+  return count == arg.dismissal_count;
+}
+
 }  // namespace
 
 class ManagePasswordsBubbleModelTest : public ::testing::Test {
@@ -95,6 +111,11 @@
     // |test_web_contents_| and therefore accessible to the model.
     new testing::StrictMock<ManagePasswordsUIControllerMockWithMockNavigation>(
         test_web_contents_.get());
+    PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
+        profile(),
+        password_manager::BuildPasswordStore<
+            content::BrowserContext,
+            testing::StrictMock<password_manager::MockPasswordStore>>);
   }
 
   void TearDown() override {
@@ -107,6 +128,22 @@
 
   TestingProfile* profile() { return &profile_; }
 
+  password_manager::MockPasswordStore* GetStore() {
+    return static_cast<password_manager::MockPasswordStore*>(
+        PasswordStoreFactory::GetInstance()
+            ->GetForProfile(profile(), ServiceAccessType::EXPLICIT_ACCESS)
+            .get());
+  }
+
+  password_manager::InteractionsStats GetTestStats() {
+    password_manager::InteractionsStats result;
+    result.origin_domain = GURL(kSiteOrigin);
+    result.username_value = base::ASCIIToUTF16("username");
+    result.dismissal_count = 5;
+    result.update_time = base::Time::FromTimeT(1);
+    return result;
+  }
+
  protected:
   void SetUpWithState(password_manager::ui::State state,
                       ManagePasswordsBubbleModel::DisplayReason reason) {
@@ -150,7 +187,6 @@
   content::WebContents* test_web_contents() { return test_web_contents_.get(); }
 
   scoped_ptr<ManagePasswordsBubbleModel> model_;
-  autofill::PasswordForm test_form_;
 
  private:
   content::TestBrowserThreadBundle thread_bundle_;
@@ -161,11 +197,17 @@
 
 TEST_F(ManagePasswordsBubbleModelTest, CloseWithoutInteraction) {
   base::HistogramTester histogram_tester;
+  password_manager::InteractionsStats stats = GetTestStats();
+  EXPECT_CALL(*controller(), GetCurrentInteractionStats())
+      .WillOnce(Return(&stats));
   PretendPasswordWaiting();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::NO_DIRECT_INTERACTION);
   EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
             model_->state());
+  stats.dismissal_count++;
+  EXPECT_CALL(*GetStore(),
+              AddSiteStatsImpl(DissmisalCountIs(stats.dismissal_count)));
   model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
@@ -178,7 +220,11 @@
 
 TEST_F(ManagePasswordsBubbleModelTest, ClickSave) {
   base::HistogramTester histogram_tester;
+  password_manager::InteractionsStats stats = GetTestStats();
+  EXPECT_CALL(*controller(), GetCurrentInteractionStats())
+      .WillOnce(Return(&stats));
   PretendPasswordWaiting();
+  EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(_));
   model_->OnSaveClicked();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_SAVE);
@@ -194,7 +240,11 @@
 
 TEST_F(ManagePasswordsBubbleModelTest, ClickNever) {
   base::HistogramTester histogram_tester;
+  password_manager::InteractionsStats stats = GetTestStats();
+  EXPECT_CALL(*controller(), GetCurrentInteractionStats())
+      .WillOnce(Return(&stats));
   PretendPasswordWaiting();
+  EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(_));
   model_->OnNeverForThisSiteClicked();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_NEVER);
@@ -344,11 +394,13 @@
   base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName,
                                          kSmartLockBrandingGroupName);
 
+  EXPECT_CALL(*controller(), GetCurrentInteractionStats())
+      .WillRepeatedly(Return(nullptr));
+  EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_)).Times(AnyNumber());
   PretendPasswordWaiting();
   EXPECT_TRUE(model_->ShouldShowGoogleSmartLockWelcome());
   model_.reset();
-  model_.reset(new ManagePasswordsBubbleModel(
-      test_web_contents(), ManagePasswordsBubbleModel::AUTOMATIC));
+  PretendPasswordWaiting();
   EXPECT_FALSE(model_->ShouldShowGoogleSmartLockWelcome());
   EXPECT_TRUE(prefs()->GetBoolean(
       password_manager::prefs::kWasSavePrompFirstRunExperienceShown));
@@ -362,11 +414,13 @@
   base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName,
                                          kSmartLockBrandingGroupName);
 
+  EXPECT_CALL(*controller(), GetCurrentInteractionStats())
+      .WillRepeatedly(Return(nullptr));
+  EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_)).Times(AnyNumber());
   PretendPasswordWaiting();
   EXPECT_FALSE(model_->ShouldShowGoogleSmartLockWelcome());
   model_.reset();
-  model_.reset(new ManagePasswordsBubbleModel(
-      test_web_contents(), ManagePasswordsBubbleModel::AUTOMATIC));
+  PretendPasswordWaiting();
   EXPECT_FALSE(model_->ShouldShowGoogleSmartLockWelcome());
   EXPECT_FALSE(prefs()->GetBoolean(
       password_manager::prefs::kWasSavePrompFirstRunExperienceShown));
@@ -400,6 +454,8 @@
                                            test_case.experiment_group);
   }
 
+  EXPECT_CALL(*controller(), GetCurrentInteractionStats())
+      .WillOnce(Return(nullptr));
   PretendPasswordWaiting();
   EXPECT_THAT(base::UTF16ToUTF8(model_->title()),
               testing::HasSubstr(test_case.expected_title));
diff --git a/chrome/browser/ui/passwords/manage_passwords_state.cc b/chrome/browser/ui/passwords/manage_passwords_state.cc
index 16096d16..078d4cfa 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_state.cc
@@ -5,7 +5,9 @@
 #include "chrome/browser/ui/passwords/manage_passwords_state.h"
 
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/password_form_manager.h"
+#include "components/password_manager/core/browser/password_manager.h"
 #include "components/password_manager/core/browser/password_manager_client.h"
 #include "components/password_manager/core/common/credential_manager_types.h"
 
@@ -293,8 +295,9 @@
 
 void ManagePasswordsState::SetState(password_manager::ui::State state) {
   DCHECK(client_);
-  if (client_->IsLoggingActive()) {
-    password_manager::BrowserSavePasswordProgressLogger logger(client_);
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    password_manager::BrowserSavePasswordProgressLogger logger(
+        client_->GetLogManager());
     logger.LogNumber(
         autofill::SavePasswordProgressLogger::STRING_NEW_UI_STATE,
         state);
diff --git a/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
index b4bdb66..abf2964 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
@@ -25,21 +25,11 @@
 
 namespace {
 
-class MockPasswordManagerClient
-    : public password_manager::StubPasswordManagerClient {
- public:
-  MOCK_CONST_METHOD0(GetPasswordManager,
-                     const password_manager::PasswordManager*());
-};
-
 class ManagePasswordsStateTest : public testing::Test {
  public:
-  ManagePasswordsStateTest() : password_manager_(&mock_client_) {}
+  ManagePasswordsStateTest() : password_manager_(&stub_client_) {}
 
   void SetUp() override {
-    ON_CALL(mock_client_, GetPasswordManager())
-        .WillByDefault(testing::Return(&password_manager_));
-
     test_local_form_.origin = GURL("http://example.com");
     test_local_form_.username_value = base::ASCIIToUTF16("username");
     test_local_form_.password_value = base::ASCIIToUTF16("12345");
@@ -51,7 +41,7 @@
     test_federated_form_.origin = GURL("https://idp.com");
     test_federated_form_.username_value = base::ASCIIToUTF16("username");
 
-    passwords_data_.set_client(&mock_client_);
+    passwords_data_.set_client(&stub_client_);
   }
 
   autofill::PasswordForm& test_local_form() { return test_local_form_; }
@@ -76,7 +66,7 @@
                void(const password_manager::CredentialInfo&));
 
  private:
-  MockPasswordManagerClient mock_client_;
+  password_manager::StubPasswordManagerClient stub_client_;
   password_manager::StubPasswordManagerDriver driver_;
   password_manager::PasswordManager password_manager_;
 
@@ -90,7 +80,7 @@
 ManagePasswordsStateTest::CreateFormManager() {
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
       new password_manager::PasswordFormManager(
-          &password_manager_, &mock_client_, driver_.AsWeakPtr(),
+          &password_manager_, &stub_client_, driver_.AsWeakPtr(),
           test_local_form(), false));
   test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore();
   ScopedVector<autofill::PasswordForm> stored_forms;
diff --git a/chrome/browser/ui/passwords/manage_passwords_test.cc b/chrome/browser/ui/passwords/manage_passwords_test.cc
index 13634587..6551a75 100644
--- a/chrome/browser/ui/passwords/manage_passwords_test.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_test.cc
@@ -16,7 +16,6 @@
 #include "chrome/test/base/interactive_test_utils.h"
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/password_form_manager.h"
-#include "components/password_manager/core/browser/password_manager.h"
 #include "components/password_manager/core/browser/password_manager_metrics_util.h"
 #include "components/password_manager/core/browser/stub_password_manager_client.h"
 #include "components/password_manager/core/browser/stub_password_manager_driver.h"
@@ -54,11 +53,12 @@
 
 void ManagePasswordsTest::SetupPendingPassword() {
   password_manager::StubPasswordManagerClient client;
+  password_manager::StubLogManager log_manager;
   password_manager::StubPasswordManagerDriver driver;
-  password_manager::PasswordManager password_manager(&client);
+
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
       new password_manager::PasswordFormManager(
-          &password_manager, &client, driver.AsWeakPtr(), *test_form(), false));
+          nullptr, &client, driver.AsWeakPtr(), *test_form(), false));
   test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore();
   ScopedVector<autofill::PasswordForm> best_matches;
   test_form_manager->OnGetPasswordStoreResults(best_matches.Pass());
@@ -67,11 +67,12 @@
 
 void ManagePasswordsTest::SetupAutomaticPassword() {
   password_manager::StubPasswordManagerClient client;
+  password_manager::StubLogManager log_manager;
   password_manager::StubPasswordManagerDriver driver;
-  password_manager::PasswordManager password_manager(&client);
+
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
       new password_manager::PasswordFormManager(
-          &password_manager, &client, driver.AsWeakPtr(), *test_form(), false));
+          nullptr, &client, driver.AsWeakPtr(), *test_form(), false));
   GetController()->OnAutomaticPasswordSave(test_form_manager.Pass());
 }
 
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
index d6903dde..fa3090d 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -21,6 +21,7 @@
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
 #include "components/password_manager/core/browser/password_bubble_experiment.h"
 #include "components/password_manager/core/browser/password_form_manager.h"
+#include "components/password_manager/core/browser/statistics_table.h"
 #include "components/password_manager/core/common/credential_manager_types.h"
 #include "content/public/browser/navigation_details.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -41,6 +42,10 @@
 // Minimal time span the bubble should survive implicit navigations.
 const int kBubbleMinTime = 5;
 
+// For given site and username the password save bubble is suppressed after
+// the user dismissed it |kMaxShowSaveBubble| times.
+const int kMaxShowSaveBubble = 3;
+
 password_manager::PasswordStore* GetPasswordStore(
     content::WebContents* web_contents) {
   return PasswordStoreFactory::GetForProfile(
@@ -102,10 +107,15 @@
 
 void ManagePasswordsUIController::OnPasswordSubmitted(
     scoped_ptr<PasswordFormManager> form_manager) {
-  bool blacklisted = form_manager->IsBlacklisted();
+  bool show_bubble = !form_manager->IsBlacklisted();
   passwords_data_.OnPendingPassword(form_manager.Pass());
+  if (show_bubble) {
+    password_manager::InteractionsStats* stats = GetCurrentInteractionStats();
+    if (stats && stats->dismissal_count > kMaxShowSaveBubble)
+      show_bubble = false;
+  }
   timer_.reset(new base::ElapsedTimer);
-  base::AutoReset<bool> resetter(&should_pop_up_bubble_, !blacklisted);
+  base::AutoReset<bool> resetter(&should_pop_up_bubble_, show_bubble);
   UpdateBubbleAndIconVisibility();
 }
 
@@ -328,6 +338,16 @@
   return form_manager ? form_manager->password_overridden() : false;
 }
 
+password_manager::InteractionsStats*
+ManagePasswordsUIController::GetCurrentInteractionStats() const {
+  DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state());
+  password_manager::PasswordFormManager* form_manager =
+      passwords_data_.form_manager();
+  return password_manager::FindStatsByUsername(
+      form_manager->interactions_stats(),
+      form_manager->pending_credentials().username_value);
+}
+
 #if !defined(OS_ANDROID)
 void ManagePasswordsUIController::UpdateIconAndBubbleState(
     ManagePasswordsIconView* icon) {
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
index 618fe8170..2fae5d4 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
@@ -23,6 +23,7 @@
 namespace password_manager {
 enum class CredentialType;
 struct CredentialInfo;
+struct InteractionsStats;
 class PasswordFormManager;
 }
 
@@ -123,7 +124,7 @@
   void OnBubbleShown();
 
   // Called from the model when the bubble is hidden.
-  void OnBubbleHidden();
+  virtual void OnBubbleHidden();
 
   // Called when the user chose not to update password.
   void OnNopeUpdateClicked();
@@ -135,6 +136,7 @@
 
   // True if a password is sitting around, waiting for a user to decide whether
   // or not to save it.
+  // TODO(vasilii): remove.
   bool PasswordPendingUserDecision() const {
     return state() == password_manager::ui::PENDING_PASSWORD_STATE;
   }
@@ -157,6 +159,11 @@
   // newly submitted form the password is different from stored one.
   bool PasswordOverridden() const;
 
+  // For PENDING_PASSWORD_STATE state returns the current statistics for
+  // the pending username.
+  virtual password_manager::InteractionsStats* GetCurrentInteractionStats()
+      const;
+
  protected:
   explicit ManagePasswordsUIController(
       content::WebContents* web_contents);
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc
index 611f739..46224dc 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc
@@ -5,31 +5,11 @@
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 
 #include "components/password_manager/core/browser/password_form_manager.h"
-#include "components/password_manager/core/browser/password_manager.h"
-#include "components/password_manager/core/browser/stub_password_manager_client.h"
-#include "components/password_manager/core/browser/stub_password_manager_driver.h"
 #include "components/password_manager/core/common/credential_manager_types.h"
 #include "content/public/browser/web_contents.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-namespace {
-
-class MockPasswordManagerDriver
-    : public password_manager::StubPasswordManagerDriver {
- public:
-  MOCK_METHOD0(GetPasswordManager, password_manager::PasswordManager*());
-};
-
-class MockPasswordManagerClient
-    : public password_manager::StubPasswordManagerClient {
- public:
-  MOCK_CONST_METHOD0(GetPasswordManager,
-                     const password_manager::PasswordManager*());
-};
-
-}  // namespace
-
 ManagePasswordsUIControllerMock::ManagePasswordsUIControllerMock(
     content::WebContents* contents)
     : ManagePasswordsUIController(contents),
@@ -39,24 +19,13 @@
       never_saved_password_(false),
       choose_credential_(false),
       state_overridden_(false),
-      state_(password_manager::ui::INACTIVE_STATE) {
+      state_(password_manager::ui::INACTIVE_STATE),
+      password_manager_(&client_) {
   // Do not silently replace an existing ManagePasswordsUIController because it
   // unregisters itself in WebContentsDestroyed().
   EXPECT_FALSE(contents->GetUserData(UserDataKey()));
   contents->SetUserData(UserDataKey(), this);
-  scoped_ptr<MockPasswordManagerClient> mock_client(
-      new MockPasswordManagerClient());
-  scoped_ptr<MockPasswordManagerDriver> mock_driver(
-      new MockPasswordManagerDriver());
-  password_manager_.reset(
-      new password_manager::PasswordManager(mock_client.get()));
-  ON_CALL(*mock_driver, GetPasswordManager())
-      .WillByDefault(testing::Return(password_manager_.get()));
-  ON_CALL(*mock_client, GetPasswordManager())
-      .WillByDefault(testing::Return(password_manager_.get()));
-  client_ = mock_client.Pass();
-  driver_ = mock_driver.Pass();
-  set_client(client_.get());
+  set_client(&client_);
 }
 
 ManagePasswordsUIControllerMock::
@@ -100,6 +69,8 @@
   OnBubbleShown();
 }
 
+void ManagePasswordsUIControllerMock::OnBubbleHidden() {}
+
 void ManagePasswordsUIControllerMock::SavePassword() {
   saved_password_ = true;
 }
@@ -120,14 +91,19 @@
   chosen_credential_ = form;
 }
 
+password_manager::InteractionsStats*
+ManagePasswordsUIControllerMock::GetCurrentInteractionStats() const {
+  return nullptr;
+}
+
 void ManagePasswordsUIControllerMock::PretendSubmittedPassword(
     ScopedVector<autofill::PasswordForm> best_matches) {
   ASSERT_FALSE(best_matches.empty());
   autofill::PasswordForm observed_form = *best_matches[0];
   scoped_ptr<password_manager::PasswordFormManager> form_manager(
-      new password_manager::PasswordFormManager(
-          password_manager_.get(), client_.get(), driver_->AsWeakPtr(),
-          observed_form, true));
+      new password_manager::PasswordFormManager(&password_manager_, &client_,
+                                                driver_.AsWeakPtr(),
+                                                observed_form, true));
   form_manager->SimulateFetchMatchingLoginsFromPasswordStore();
   form_manager->OnGetPasswordStoreResults(best_matches.Pass());
   OnPasswordSubmitted(form_manager.Pass());
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
index 7e4cfb0..24574cbf 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
@@ -8,6 +8,9 @@
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
+#include "components/password_manager/core/browser/password_manager.h"
+#include "components/password_manager/core/browser/stub_password_manager_client.h"
+#include "components/password_manager/core/browser/stub_password_manager_driver.h"
 #include "components/password_manager/core/common/password_manager_ui.h"
 #include "content/public/browser/navigation_details.h"
 
@@ -67,6 +70,11 @@
 
   void UpdateAndroidAccountChooserInfoBarVisibility() override;
 
+  void OnBubbleHidden() override;
+
+  password_manager::InteractionsStats* GetCurrentInteractionStats()
+      const override;
+
   // Simulate the pending password state. |best_matches| can't be empty.
   void PretendSubmittedPassword(
     ScopedVector<autofill::PasswordForm> best_matches);
@@ -89,9 +97,9 @@
   autofill::PasswordForm chosen_credential_;
   autofill::PasswordForm pending_password_;
 
-  scoped_ptr<password_manager::PasswordManagerClient> client_;
-  scoped_ptr<password_manager::PasswordManagerDriver> driver_;
-  scoped_ptr<password_manager::PasswordManager> password_manager_;
+  password_manager::StubPasswordManagerClient client_;
+  password_manager::StubPasswordManagerDriver driver_;
+  password_manager::PasswordManager password_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIControllerMock);
 };
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
index 0a4fa82..9174b39c 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
@@ -13,6 +13,7 @@
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/password_form_manager.h"
 #include "components/password_manager/core/browser/password_manager.h"
+#include "components/password_manager/core/browser/statistics_table.h"
 #include "components/password_manager/core/browser/stub_password_manager_client.h"
 #include "components/password_manager/core/browser/stub_password_manager_driver.h"
 #include "components/password_manager/core/common/credential_manager_types.h"
@@ -34,6 +35,8 @@
 
 const int64 kSlowNavigationDelayInMS = 6000;
 const int64 kQuickNavigationDelayInMS = 500;
+// Number of dismissals that for sure supresses the bubble.
+const int kGreatDissmisalCount = 10;
 
 #if !defined(OS_ANDROID)
 class TestManagePasswordsIconView : public ManagePasswordsIconView {
@@ -120,36 +123,25 @@
   OnLoginsChanged(list);
 }
 
-// TODO(crbug.com/554886) Centralise mock clients.
-class MockPasswordManagerClient
-    : public password_manager::StubPasswordManagerClient {
- public:
-  MOCK_CONST_METHOD0(GetPasswordManager,
-                     const password_manager::PasswordManager*());
-};
-
 }  // namespace
 
 class ManagePasswordsUIControllerTest : public ChromeRenderViewHostTestHarness {
  public:
-  ManagePasswordsUIControllerTest() : password_manager_(&mock_client_) {}
+  ManagePasswordsUIControllerTest() : password_manager_(&client_) {}
 
   void SetUp() override {
     ChromeRenderViewHostTestHarness::SetUp();
 
-    ON_CALL(mock_client_, GetPasswordManager())
-        .WillByDefault(testing::Return(&password_manager_));
-
     // Create the test UIController here so that it's bound to
     // |test_web_contents_|, and will be retrieved correctly via
     // ManagePasswordsUIController::FromWebContents in |controller()|.
-    new TestManagePasswordsUIController(web_contents(), &mock_client_);
+    new TestManagePasswordsUIController(web_contents(), &client_);
 
-    test_local_form_.origin = GURL("http://example.com");
+    test_local_form_.origin = GURL("http://example.com/login");
     test_local_form_.username_value = base::ASCIIToUTF16("username");
     test_local_form_.password_value = base::ASCIIToUTF16("12345");
 
-    test_federated_form_.origin = GURL("http://example.com");
+    test_federated_form_.origin = GURL("http://example.com/login");
     test_federated_form_.username_value = base::ASCIIToUTF16("username");
     test_federated_form_.federation_url = GURL("https://federation.test/");
 
@@ -195,7 +187,7 @@
   scoped_ptr<password_manager::PasswordFormManager> CreateFormManager();
 
  private:
-  MockPasswordManagerClient mock_client_;
+  password_manager::StubPasswordManagerClient client_;
   password_manager::StubPasswordManagerDriver driver_;
   password_manager::PasswordManager password_manager_;
 
@@ -209,9 +201,9 @@
     const autofill::PasswordForm& observed_form,
     ScopedVector<autofill::PasswordForm> best_matches) {
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
-      new password_manager::PasswordFormManager(
-          &password_manager_, &mock_client_, driver_.AsWeakPtr(), observed_form,
-          true));
+      new password_manager::PasswordFormManager(&password_manager_, &client_,
+                                                driver_.AsWeakPtr(),
+                                                observed_form, true));
   test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore();
   test_form_manager->OnGetPasswordStoreResults(best_matches.Pass());
   return test_form_manager.Pass();
@@ -290,6 +282,51 @@
   ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 }
 
+TEST_F(ManagePasswordsUIControllerTest, PasswordSubmittedBubbleSuppressed) {
+  scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
+      CreateFormManager());
+  password_manager::InteractionsStats stats;
+  stats.origin_domain = test_local_form().origin.GetOrigin();
+  stats.username_value = test_local_form().username_value;
+  stats.dismissal_count = kGreatDissmisalCount;
+  ScopedVector<password_manager::InteractionsStats> interactions;
+  interactions.push_back(new password_manager::InteractionsStats(stats));
+  test_form_manager->OnGetSiteStatistics(interactions.Pass());
+  test_form_manager->ProvisionallySave(
+      test_local_form(),
+      password_manager::PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
+  controller()->OnPasswordSubmitted(test_form_manager.Pass());
+  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
+            controller()->state());
+  EXPECT_FALSE(controller()->opened_bubble());
+  ASSERT_TRUE(controller()->GetCurrentInteractionStats());
+  EXPECT_EQ(stats, *controller()->GetCurrentInteractionStats());
+
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
+}
+
+TEST_F(ManagePasswordsUIControllerTest, PasswordSubmittedBubbleNotSuppressed) {
+  scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
+      CreateFormManager());
+  password_manager::InteractionsStats stats;
+  stats.origin_domain = test_local_form().origin.GetOrigin();
+  stats.username_value = base::ASCIIToUTF16("not my username");
+  stats.dismissal_count = kGreatDissmisalCount;
+  ScopedVector<password_manager::InteractionsStats> interactions;
+  interactions.push_back(new password_manager::InteractionsStats(stats));
+  test_form_manager->OnGetSiteStatistics(interactions.Pass());
+  test_form_manager->ProvisionallySave(
+      test_local_form(),
+      password_manager::PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
+  controller()->OnPasswordSubmitted(test_form_manager.Pass());
+  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
+            controller()->state());
+  EXPECT_TRUE(controller()->opened_bubble());
+  EXPECT_FALSE(controller()->GetCurrentInteractionStats());
+
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
+}
+
 TEST_F(ManagePasswordsUIControllerTest, PasswordSaved) {
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
       CreateFormManager());
diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
index 44167e8..0ed5b736 100644
--- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
+++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
@@ -73,6 +73,7 @@
 #include "content/public/test/test_utils.h"
 #include "net/base/network_change_notifier.h"
 #include "net/http/http_status_code.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/url_request/test_url_fetcher_factory.h"
 #include "net/url_request/url_fetcher_impl.h"
 #include "net/url_request/url_request_status.h"
@@ -145,10 +146,10 @@
   void SetUpInProcessBrowserTestFixture() override {
     search::EnableQueryExtractionForTesting();
     ASSERT_TRUE(https_test_server().Start());
-    GURL instant_url = https_test_server().GetURL(
-        "files/instant_extended.html?strk=1&");
-    GURL ntp_url = https_test_server().GetURL(
-        "files/instant_extended_ntp.html?strk=1&");
+    GURL instant_url =
+        https_test_server().GetURL("/instant_extended.html?strk=1&");
+    GURL ntp_url =
+        https_test_server().GetURL("/instant_extended_ntp.html?strk=1&");
     InstantTestBase::Init(instant_url, ntp_url, false);
   }
 
@@ -257,10 +258,10 @@
   void SetUpInProcessBrowserTestFixture() override {
     search::EnableQueryExtractionForTesting();
     ASSERT_TRUE(https_test_server().Start());
-    GURL instant_url = https_test_server().GetURL(
-        "files/instant_extended.html?strk=1&");
-    GURL ntp_url = https_test_server().GetURL(
-        "files/instant_extended_ntp.html?strk=1&");
+    GURL instant_url =
+        https_test_server().GetURL("/instant_extended.html?strk=1&");
+    GURL ntp_url =
+        https_test_server().GetURL("/instant_extended_ntp.html?strk=1&");
     InstantTestBase::Init(instant_url, ntp_url, true);
   }
 
@@ -315,10 +316,10 @@
  protected:
   void SetUpInProcessBrowserTestFixture() override {
     ASSERT_TRUE(https_test_server().Start());
-    GURL instant_url = https_test_server().GetURL(
-        "files/instant_extended.html?strk=1&");
-    GURL ntp_url = https_test_server().GetURL(
-        "files/instant_extended_ntp.html?strk=1&");
+    GURL instant_url =
+        https_test_server().GetURL("/instant_extended.html?strk=1&");
+    GURL ntp_url =
+        https_test_server().GetURL("/instant_extended_ntp.html?strk=1&");
     InstantTestBase::Init(instant_url, ntp_url, false);
   }
 
@@ -983,9 +984,9 @@
 
 // Check that clicking on a result sends the correct referrer.
 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, Referrer) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL result_url =
-      test_server()->GetURL("files/referrer_policy/referrer-policy-log.html");
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL result_url = embedded_test_server()->GetURL(
+      "/referrer_policy/referrer-policy-log.html");
   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
   FocusOmnibox();
 
diff --git a/chrome/browser/ui/search/instant_test_utils.cc b/chrome/browser/ui/search/instant_test_utils.cc
index 56841fc..a6c5d5a3 100644
--- a/chrome/browser/ui/search/instant_test_utils.cc
+++ b/chrome/browser/ui/search/instant_test_utils.cc
@@ -35,11 +35,9 @@
 // InstantTestBase -----------------------------------------------------------
 
 InstantTestBase::InstantTestBase()
-    : https_test_server_(
-          net::SpawnedTestServer::TYPE_HTTPS,
-          net::BaseTestServer::SSLOptions(),
-          base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))),
+    : https_test_server_(net::EmbeddedTestServer::TYPE_HTTPS),
       init_suggestions_url_(false) {
+  https_test_server_.ServeFilesFromSourceDirectory("chrome/test/data");
 }
 
 InstantTestBase::~InstantTestBase() {}
diff --git a/chrome/browser/ui/search/instant_test_utils.h b/chrome/browser/ui/search/instant_test_utils.h
index 1a63cc6..83c3327 100644
--- a/chrome/browser/ui/search/instant_test_utils.h
+++ b/chrome/browser/ui/search/instant_test_utils.h
@@ -18,7 +18,7 @@
 #include "chrome/browser/ui/location_bar/location_bar.h"
 #include "chrome/browser/ui/search/instant_controller.h"
 #include "chrome/common/search_types.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "url/gurl.h"
 
 class BrowserInstantController;
@@ -64,7 +64,7 @@
 
   const GURL& ntp_url() const { return ntp_url_; }
 
-  net::SpawnedTestServer& https_test_server() { return https_test_server_; }
+  net::EmbeddedTestServer& https_test_server() { return https_test_server_; }
 
   void KillInstantRenderView();
 
@@ -106,7 +106,7 @@
   Browser* browser_;
 
   // HTTPS Testing server, started on demand.
-  net::SpawnedTestServer https_test_server_;
+  net::EmbeddedTestServer https_test_server_;
 
   // Set to true to initialize suggestions URL in default search provider.
   bool init_suggestions_url_;
diff --git a/chrome/browser/ui/search/local_ntp_browsertest.cc b/chrome/browser/ui/search/local_ntp_browsertest.cc
index 78af6c4..8503162 100644
--- a/chrome/browser/ui/search/local_ntp_browsertest.cc
+++ b/chrome/browser/ui/search/local_ntp_browsertest.cc
@@ -13,6 +13,7 @@
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/browser/web_contents.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/base/resource/resource_bundle.h"
 
 class LocalNTPTest : public InProcessBrowserTest,
@@ -23,10 +24,10 @@
  protected:
   void SetUpInProcessBrowserTestFixture() override {
     ASSERT_TRUE(https_test_server().Start());
-    GURL instant_url = https_test_server().GetURL(
-        "files/instant_extended.html?strk=1&");
-    GURL ntp_url = https_test_server().GetURL(
-        "files/local_ntp_browsertest.html?strk=1&");
+    GURL instant_url =
+        https_test_server().GetURL("/instant_extended.html?strk=1&");
+    GURL ntp_url =
+        https_test_server().GetURL("/local_ntp_browsertest.html?strk=1&");
     InstantTestBase::Init(instant_url, ntp_url, false);
   }
 };
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc
index 80e8032..4ab32fc 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper_browsertest.cc
@@ -16,7 +16,6 @@
 #include "net/test/embedded_test_server/http_response.h"
 
 using net::test_server::BasicHttpResponse;
-using net::test_server::EmbeddedTestServer;
 using net::test_server::HttpRequest;
 using net::test_server::HttpResponse;
 
@@ -89,7 +88,7 @@
     embedded_test_server()->RegisterRequestHandler(
         base::Bind(&SearchEngineTabHelperBrowserTest::HandleRequest,
                    base::Unretained(this), file_url));
-    return embedded_test_server()->InitializeAndWaitUntilReady();
+    return embedded_test_server()->Start();
   }
 
   void SetUpOnMainThread() override { ASSERT_TRUE(StartTestServer()); }
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 9fa9b52..e0fadeee2 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -46,6 +46,7 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/test/test_utils.h"
 #include "extensions/browser/extension_system.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -253,10 +254,10 @@
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
                        StartupURLsOnNewWindowWithNoTabbedBrowsers) {
   // Use a couple same-site HTTP URLs.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   std::vector<GURL> urls;
-  urls.push_back(test_server()->GetURL("files/title1.html"));
-  urls.push_back(test_server()->GetURL("files/title2.html"));
+  urls.push_back(embedded_test_server()->GetURL("/title1.html"));
+  urls.push_back(embedded_test_server()->GetURL("/title2.html"));
 
   Profile* profile = browser()->profile();
   chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type();
@@ -527,9 +528,12 @@
 #define MAYBE_AddFirstRunTab AddFirstRunTab
 #endif
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddFirstRunTab) {
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title2.html"));
 
   // Do a simple non-process-startup browser launch.
   base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
@@ -560,10 +564,13 @@
 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab
 #endif
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) {
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title2.html"));
   browser_creator.AddFirstRunTab(GURL("http://welcome_page"));
 
   // Do a simple non-process-startup browser launch.
@@ -660,8 +667,10 @@
 }
 
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) {
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
 
   // The welcome page should not be shown, even if
   // first_run::ShouldShowWelcomePage() says so, when there are already
@@ -697,8 +706,10 @@
 // tabs, but the welcome page was explcitly added to the first run tabs.
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
                        SyncPromoWithFirstRunTabsIncludingWelcomePage) {
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser_creator.AddFirstRunTab(GURL("http://welcome_page"));
 
   // Do a simple non-process-startup browser launch.
@@ -815,7 +826,7 @@
   // Simulate a browser restart by creating the profiles in the PRE_ part.
   ProfileManager* profile_manager = g_browser_process->profile_manager();
 
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Create two profiles.
   base::FilePath dest_path = profile_manager->user_data_dir();
@@ -834,7 +845,7 @@
                             browser()->host_desktop_type()));
   chrome::NewTab(browser1);
   ui_test_utils::NavigateToURL(browser1,
-                               test_server()->GetURL("files/empty.html"));
+                               embedded_test_server()->GetURL("/empty.html"));
   CloseBrowserSynchronously(browser1);
 
   Browser* browser2 = new Browser(
@@ -842,7 +853,7 @@
                             browser()->host_desktop_type()));
   chrome::NewTab(browser2);
   ui_test_utils::NavigateToURL(browser2,
-                               test_server()->GetURL("files/form.html"));
+                               embedded_test_server()->GetURL("/form.html"));
   CloseBrowserSynchronously(browser2);
 
   // Set different startup preferences for the 2 profiles.
@@ -921,8 +932,7 @@
   ASSERT_TRUE(new_browser);
   TabStripModel* tab_strip = new_browser->tab_strip_model();
   ASSERT_EQ(1, tab_strip->count());
-  EXPECT_EQ("/files/empty.html",
-            tab_strip->GetWebContentsAt(0)->GetURL().path());
+  EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path());
 
   ASSERT_EQ(1u, chrome::GetBrowserCount(profile2,
                                         browser()->host_desktop_type()));
@@ -930,8 +940,7 @@
   ASSERT_TRUE(new_browser);
   tab_strip = new_browser->tab_strip_model();
   ASSERT_EQ(1, tab_strip->count());
-  EXPECT_EQ("/files/form.html",
-            tab_strip->GetWebContentsAt(0)->GetURL().path());
+  EXPECT_EQ("/form.html", tab_strip->GetWebContentsAt(0)->GetURL().path());
 }
 
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
@@ -942,6 +951,7 @@
           switches::kAshBrowserTests))
     return;
 #endif
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   Profile* default_profile = browser()->profile();
 
@@ -990,7 +1000,7 @@
                             browser()->host_desktop_type()));
   chrome::NewTab(browser_last);
   ui_test_utils::NavigateToURL(browser_last,
-                               test_server()->GetURL("files/empty.html"));
+                               embedded_test_server()->GetURL("/empty.html"));
   CloseBrowserAsynchronously(browser_last);
 
   // Close the main browser.
@@ -1053,8 +1063,7 @@
   ASSERT_TRUE(new_browser);
   tab_strip = new_browser->tab_strip_model();
   ASSERT_EQ(1, tab_strip->count());
-  EXPECT_EQ("/files/empty.html",
-            tab_strip->GetWebContentsAt(0)->GetURL().path());
+  EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path());
 
   // profile_home2 was not launched since it would've only opened the home page.
   ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type));
@@ -1417,14 +1426,16 @@
   // Simulate the following master_preferences:
   // {
   //  "first_run_tabs" : [
-  //    "files/title1.html"
+  //    "/title1.html"
   //  ],
   //  "sync_promo": {
   //    "show_on_first_run_allowed": true
   //  }
   // }
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser()->profile()->GetPrefs()->SetBoolean(
       prefs::kSignInPromoShowOnFirstRunAllowed, true);
 
@@ -1462,16 +1473,17 @@
   // Simulate the following master_preferences:
   // {
   //  "first_run_tabs" : [
-  //    "files/title1.html",
+  //    "/title1.html",
   //    "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F"
   //  ],
   //  "sync_promo": {
   //    "show_on_first_run_allowed": true
   //  }
   // }
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser_creator.AddFirstRunTab(
       signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false));
   browser()->profile()->GetPrefs()->SetBoolean(
@@ -1514,15 +1526,17 @@
   // {
   //  "first_run_tabs" : [
   //    "new_tab_page",
-  //    "files/title1.html"
+  //    "/title1.html"
   //  ],
   //  "sync_promo": {
   //    "show_on_first_run_allowed": true
   //  }
   // }
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
   browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser()->profile()->GetPrefs()->SetBoolean(
       prefs::kSignInPromoShowOnFirstRunAllowed, true);
 
@@ -1563,15 +1577,17 @@
   // {
   //  "first_run_tabs" : [
   //    "new_tab_page",
-  //    "files/title1.html"
+  //    "/title1.html"
   //  ],
   //  "sync_promo": {
   //    "show_on_first_run_allowed": false
   //  }
   // }
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
   browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser()->profile()->GetPrefs()->SetBoolean(
       prefs::kSignInPromoShowOnFirstRunAllowed, false);
 
@@ -1610,14 +1626,16 @@
   // Simulate the following master_preferences:
   // {
   //  "first_run_tabs" : [
-  //    "files/title1.html"
+  //    "/title1.html"
   //  ],
   //  "sync_promo": {
   //    "show_on_first_run_allowed": false
   //  }
   // }
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
   browser()->profile()->GetPrefs()->SetBoolean(
       prefs::kSignInPromoShowOnFirstRunAllowed, false);
 
@@ -1658,13 +1676,14 @@
   //    "show_on_first_run_allowed": true
   //  }
   // }
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
   browser()->profile()->GetPrefs()->SetBoolean(
       prefs::kSignInPromoShowOnFirstRunAllowed, true);
 
   // Set the following user policies:
   // * RestoreOnStartup = RestoreOnStartupIsURLs
-  // * RestoreOnStartupURLs = [ "files/title1.html" ]
+  // * RestoreOnStartupURLs = [ "/title1.html" ]
   policy_map_.Set(
       policy::key::kRestoreOnStartup,
       policy::POLICY_LEVEL_MANDATORY,
@@ -1673,8 +1692,8 @@
       new base::FundamentalValue(SessionStartupPref::kPrefValueURLs),
       NULL);
   base::ListValue startup_urls;
-  startup_urls.Append(
-      new base::StringValue(test_server()->GetURL("files/title1.html").spec()));
+  startup_urls.Append(new base::StringValue(
+      embedded_test_server()->GetURL("/title1.html").spec()));
   policy_map_.Set(policy::key::kRestoreOnStartupURLs,
                   policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
                   policy::POLICY_SOURCE_CLOUD, startup_urls.DeepCopy(),
diff --git a/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc b/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc
index c92e8b04..49ada97 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc
@@ -20,6 +20,7 @@
 #include "chrome/common/url_constants.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
@@ -87,10 +88,10 @@
 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTriggeredResetTest,
                        TestTriggeredReset) {
   // Use a couple same-site HTTP URLs.
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   std::vector<GURL> urls;
-  urls.push_back(test_server()->GetURL("files/title1.html"));
-  urls.push_back(test_server()->GetURL("files/title2.html"));
+  urls.push_back(embedded_test_server()->GetURL("/title1.html"));
+  urls.push_back(embedded_test_server()->GetURL("/title2.html"));
 
   Profile* profile = browser()->profile();
   chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type();
@@ -137,9 +138,11 @@
   // The presence of First Run tabs (in production code, these commonly come
   // from master_preferences) should suppress the reset UI. Check that this is
   // the case.
+  ASSERT_TRUE(embedded_test_server()->Start());
   StartupBrowserCreator browser_creator;
   browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
-  browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
+  browser_creator.AddFirstRunTab(
+      embedded_test_server()->GetURL("/title1.html"));
 
   // Do a process-startup browser launch.
   base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h b/chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h
index 2fb9bc89..508371ea 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h
+++ b/chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h
@@ -13,7 +13,8 @@
   enum CloseAction {
     CLOSE_LEARN_MORE,
     CLOSE_EXECUTE,
-    CLOSE_DISMISS
+    CLOSE_DISMISS_USER_ACTION,
+    CLOSE_DISMISS_DEACTIVATION,
   };
 
   virtual ~ToolbarActionsBarBubbleDelegate() {}
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
index 7e793378..b0ce77b 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
@@ -424,7 +424,7 @@
       new ExtensionToolbarIconSurfacingBubbleDelegate(profile()));
   bubble_delegate->OnBubbleShown();
   bubble_delegate->OnBubbleClosed(
-      ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS);
+      ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION);
   EXPECT_FALSE(
     ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
         profile()));
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
index 787e5da..c0e7d26 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
@@ -1229,7 +1229,8 @@
 
   scoped_ptr<ToolbarActionsBarBubbleDelegate> bubble(
       new ExtensionToolbarIconSurfacingBubbleDelegate(profile()));
-  bubble->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS);
+  bubble->OnBubbleClosed(
+      ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION);
 
   EXPECT_FALSE(toolbar_model->is_highlighting());
   EXPECT_EQ(ToolbarActionsModel::HIGHLIGHT_NONE,
diff --git a/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc b/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc
index b9e83990..71c57a38 100644
--- a/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc
+++ b/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc
@@ -22,6 +22,7 @@
 #include "components/omnibox/browser/omnibox_view.h"
 #include "content/public/browser/browser_accessibility_state.h"
 #include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/test/ui_controls.h"
 #include "url/gurl.h"
@@ -208,8 +209,8 @@
   chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION);
 
   host_resolver()->AddRule("*", "127.0.0.1");
-  ASSERT_TRUE(test_server()->Start());
-  GURL main_url(test_server()->GetURL("files/english_page.html"));
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL main_url(embedded_test_server()->GetURL("/english_page.html"));
 
   OmniboxViewViews* omnibox_view =
       BrowserView::GetBrowserViewForBrowser(browser())->
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
index 5d298135..8314f733 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
@@ -245,10 +245,12 @@
   if (SyncPromoUI::ShouldShowSyncPromo(profile_)) {
     // The column layout used for the sync promo.
     cs = layout->AddColumnSet(SYNC_PROMO_COLUMN_SET_ID);
+    // Use FIXED as we don't want the width of the promo to impact the overall
+    // width.
     cs->AddColumn(GridLayout::FILL,
                   GridLayout::FILL,
                   1,
-                  GridLayout::USE_PREF,
+                  GridLayout::FIXED,
                   0,
                   0);
     layout->StartRow(0, SYNC_PROMO_COLUMN_SET_ID);
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.cc
index 9332471..a4a37a0e 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.cc
@@ -6,6 +6,7 @@
 
 #include "base/strings/string16.h"
 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h"
+#include "chrome/grit/chromium_strings.h"
 #include "chrome/grit/generated_resources.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/ui/views/collected_cookies_views_browsertest.cc b/chrome/browser/ui/views/collected_cookies_views_browsertest.cc
index 5ae8780f..e0c723f 100644
--- a/chrome/browser/ui/views/collected_cookies_views_browsertest.cc
+++ b/chrome/browser/ui/views/collected_cookies_views_browsertest.cc
@@ -15,7 +15,7 @@
 class CollectedCookiesViewsTest : public InProcessBrowserTest {
  public:
   void SetUpOnMainThread() override {
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
 
     // Disable cookies.
     CookieSettingsFactory::GetForProfile(browser()->profile())
diff --git a/chrome/browser/ui/views/extensions/bookmark_override_browsertest.cc b/chrome/browser/ui/views/extensions/bookmark_override_browsertest.cc
index 871ff72..ab2a0eeb 100644
--- a/chrome/browser/ui/views/extensions/bookmark_override_browsertest.cc
+++ b/chrome/browser/ui/views/extensions/bookmark_override_browsertest.cc
@@ -15,6 +15,7 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "extensions/common/manifest_constants.h"
 #include "extensions/test/result_catcher.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/events/event_utils.h"
 
 typedef ExtensionApiTest BookmarkOverrideTest;
@@ -32,7 +33,7 @@
 // requests to override ctrl-D and the user has assigned it to an extension.
 // Flaky on all platforms: https://crbug.com/448956.
 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideStarClick) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_;
   const extensions::Extension* extension = GetSingleLoadedExtension();
 
@@ -70,7 +71,7 @@
 // the user has assigned it to an extension.
 // Flaky on all platforms: https://crbug.com/448956.
 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideBookmarkPage) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_;
   const extensions::Extension* extension = GetSingleLoadedExtension();
 
diff --git a/chrome/browser/ui/views/extensions/extension_message_bubble_view.cc b/chrome/browser/ui/views/extensions/extension_message_bubble_view.cc
index c30ba3b..fc528bc 100644
--- a/chrome/browser/ui/views/extensions/extension_message_bubble_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_message_bubble_view.cc
@@ -77,8 +77,10 @@
 void ExtensionMessageBubbleView::OnWidgetDestroying(views::Widget* widget) {
   // To catch Esc, we monitor destroy message. Unless the link has been clicked,
   // we assume Dismiss was the action taken.
-  if (!link_clicked_ && !action_taken_)
-    controller_->OnBubbleDismiss();
+  if (!link_clicked_ && !action_taken_) {
+    bool closed_on_deactivation = close_reason() == CloseReason::DEACTIVATION;
+    controller_->OnBubbleDismiss(closed_on_deactivation);
+  }
 }
 
 void ExtensionMessageBubbleView::set_bubble_appearance_wait_time_for_testing(
diff --git a/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views.cc b/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views.cc
index c0ddf62e..24fefe36 100644
--- a/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views.cc
+++ b/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views.cc
@@ -78,7 +78,11 @@
     views::Widget* widget) {
   BubbleDelegateView::OnWidgetDestroying(widget);
   if (!acknowledged_) {
-    delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS);
+    ToolbarActionsBarBubbleDelegate::CloseAction close_action =
+        close_reason() == CloseReason::DEACTIVATION
+            ? ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION
+            : ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION;
+    delegate_->OnBubbleClosed(close_action);
     acknowledged_ = true;
   }
 }
diff --git a/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views_unittest.cc b/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views_unittest.cc
index ab7cbd2..ac8a6da6 100644
--- a/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views_unittest.cc
+++ b/chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bubble_views_unittest.cc
@@ -81,11 +81,12 @@
     views::test::TestWidgetObserver bubble_observer(bubble_widget);
     EXPECT_FALSE(delegate.close_action());
 
-    // Close the bubble. The delegate should be told it was dismissed.
-    bubble_widget->Close();
+    // Close the bubble by activating another widget. The delegate should be
+    // told it was dismissed.
+    anchor_widget->Activate();
     base::RunLoop().RunUntilIdle();
     ASSERT_TRUE(delegate.close_action());
-    EXPECT_EQ(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS,
+    EXPECT_EQ(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION,
               *delegate.close_action());
     EXPECT_TRUE(bubble_observer.widget_closed());
   }
diff --git a/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
index d7d23b3..e3328366 100644
--- a/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
@@ -19,7 +19,7 @@
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/web_contents.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "ui/base/clipboard/clipboard.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 #include "ui/views/focus/focus_manager.h"
@@ -30,7 +30,7 @@
 
 namespace {
 
-static const char kSimplePage[] = "files/find_in_page/simple.html";
+static const char kSimplePage[] = "/find_in_page/simple.html";
 
 class FindInPageTest : public InProcessBrowserTest {
  public:
@@ -57,10 +57,10 @@
 
 // Flaky because the test server fails to start? See: http://crbug.com/96594.
 IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // First we navigate to our test page (tab A).
-  GURL url = test_server()->GetURL(kSimplePage);
+  GURL url = embedded_test_server()->GetURL(kSimplePage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   chrome::Find(browser());
@@ -91,12 +91,13 @@
 }
 
 IN_PROC_BROWSER_TEST_F(FindInPageTest, NavigationByKeyEvent) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   // Make sure Chrome is in the foreground, otherwise sending input
   // won't do anything and the test will hang.
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
   // First we navigate to any page.
-  ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage));
+  ui_test_utils::NavigateToURL(browser(),
+                               embedded_test_server()->GetURL(kSimplePage));
   // Show the Find bar.
   browser()->GetFindBarController()->Show();
   EXPECT_TRUE(
@@ -136,9 +137,9 @@
 
 // Flaky because the test server fails to start? See: http://crbug.com/96594.
 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
-  GURL url = test_server()->GetURL("title1.html");
+  GURL url = embedded_test_server()->GetURL("/title1.html");
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Focus the location bar, open and close the find-in-page, focus should
@@ -187,14 +188,14 @@
 // interactive_ui_tests.
 // http://crbug.com/311363
 IN_PROC_BROWSER_TEST_F(FindInPageTest, DISABLED_SelectionRestoreOnTabSwitch) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Make sure Chrome is in the foreground, otherwise sending input
   // won't do anything and the test will hang.
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
   // First we navigate to any page in the current tab (tab A).
-  GURL url = test_server()->GetURL(kSimplePage);
+  GURL url = embedded_test_server()->GetURL(kSimplePage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Show the Find bar.
@@ -266,10 +267,10 @@
 
 // Flaky because the test server fails to start? See: http://crbug.com/96594.
 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestoreOnTabSwitch) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // First we navigate to our test page (tab A).
-  GURL url = test_server()->GetURL(kSimplePage);
+  GURL url = embedded_test_server()->GetURL(kSimplePage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   chrome::Find(browser());
@@ -322,14 +323,14 @@
 // it respects that and doesn't show you the last search, as reported in bug:
 // http://crbug.com/40121. For Aura see bug http://crbug.com/292299.
 IN_PROC_BROWSER_TEST_F(FindInPageTest, PrepopulateRespectBlank) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Make sure Chrome is in the foreground, otherwise sending input
   // won't do anything and the test will hang.
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
   // First we navigate to any page.
-  GURL url = test_server()->GetURL(kSimplePage);
+  GURL url = embedded_test_server()->GetURL(kSimplePage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Show the Find bar.
@@ -384,14 +385,14 @@
 #endif
 
 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PasteWithoutTextChange) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // Make sure Chrome is in the foreground, otherwise sending input
   // won't do anything and the test will hang.
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
 
   // First we navigate to any page.
-  GURL url = test_server()->GetURL(kSimplePage);
+  GURL url = embedded_test_server()->GetURL(kSimplePage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   // Show the Find bar.
diff --git a/chrome/browser/ui/views/frame/browser_view_focus_uitest.cc b/chrome/browser/ui/views/frame/browser_view_focus_uitest.cc
index 3d0aaf8..3f5418e 100644
--- a/chrome/browser/ui/views/frame/browser_view_focus_uitest.cc
+++ b/chrome/browser/ui/views/frame/browser_view_focus_uitest.cc
@@ -30,7 +30,7 @@
 // Flaky, http://crbug.com/69034.
 IN_PROC_BROWSER_TEST_F(BrowserViewFocusTest, DISABLED_BrowsersRememberFocus) {
   ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   // First we navigate to our test page.
   GURL url = embedded_test_server()->GetURL(kSimplePage);
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
index e5db354..371e4c5 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
@@ -78,15 +78,12 @@
 
 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, BasicOpenAndClose) {
   EXPECT_FALSE(IsBubbleShowing());
-  ManagePasswordsBubbleView::ShowBubble(
-      browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubbleView::USER_GESTURE);
+  SetupPendingPassword();
   EXPECT_TRUE(IsBubbleShowing());
   const ManagePasswordsBubbleView* bubble =
       ManagePasswordsBubbleView::manage_password_bubble();
   EXPECT_TRUE(bubble->initially_focused_view());
-  EXPECT_EQ(bubble->initially_focused_view(),
-            bubble->GetFocusManager()->GetFocusedView());
+  EXPECT_FALSE(bubble->GetFocusManager()->GetFocusedView());
   ManagePasswordsBubbleView::CloseBubble();
   EXPECT_FALSE(IsBubbleShowing());
 
@@ -94,9 +91,11 @@
   ManagePasswordsBubbleView::ShowBubble(
       browser()->tab_strip_model()->GetActiveWebContents(),
       ManagePasswordsBubbleView::USER_GESTURE);
-  EXPECT_TRUE(ManagePasswordsBubbleView::manage_password_bubble()->
-      GetFocusManager()->GetFocusedView());
   EXPECT_TRUE(IsBubbleShowing());
+  bubble = ManagePasswordsBubbleView::manage_password_bubble();
+  EXPECT_TRUE(bubble->initially_focused_view());
+  EXPECT_EQ(bubble->initially_focused_view(),
+            bubble->GetFocusManager()->GetFocusedView());
   ManagePasswordsBubbleView::CloseBubble();
   EXPECT_FALSE(IsBubbleShowing());
 }
@@ -222,9 +221,7 @@
 
 // If this flakes, disable and log details in http://crbug.com/523255.
 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, CloseOnClick) {
-  ManagePasswordsBubbleView::ShowBubble(
-      browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubbleView::AUTOMATIC);
+  SetupPendingPassword();
   EXPECT_TRUE(IsBubbleShowing());
   EXPECT_FALSE(ManagePasswordsBubbleView::manage_password_bubble()->
       GetFocusManager()->GetFocusedView());
@@ -233,9 +230,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, CloseOnEsc) {
-  ManagePasswordsBubbleView::ShowBubble(
-      browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubbleView::AUTOMATIC);
+  SetupPendingPassword();
   EXPECT_TRUE(IsBubbleShowing());
   ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
       false, false, false, false));
@@ -250,14 +245,13 @@
       browser(),
       GURL("data:text/html;charset=utf-8,<input type=\"text\" autofocus>"));
   focus_observer.Wait();
-  content::WebContents* web_contents =
-      browser()->tab_strip_model()->GetActiveWebContents();
-  ManagePasswordsBubbleView::ShowBubble(web_contents,
-                                        ManagePasswordsBubbleView::AUTOMATIC);
+  SetupPendingPassword();
   EXPECT_TRUE(IsBubbleShowing());
   EXPECT_FALSE(ManagePasswordsBubbleView::manage_password_bubble()->
       GetFocusManager()->GetFocusedView());
   EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
+  content::WebContents* web_contents =
+      browser()->tab_strip_model()->GetActiveWebContents();
   EXPECT_TRUE(web_contents->GetRenderViewHost()->IsFocusedElementEditable());
   ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_K,
       false, false, false, false));
@@ -277,18 +271,17 @@
   // Set up the first tab with the bubble.
   SetupPendingPassword();
   EXPECT_TRUE(IsBubbleShowing());
-  // Set up the second tab.
-  AddTabAtIndex(0, GURL("chrome://newtab"), ui::PAGE_TRANSITION_TYPED);
-  EXPECT_FALSE(IsBubbleShowing());
-  ManagePasswordsBubbleView::ShowBubble(
-      browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubbleView::AUTOMATIC);
-  EXPECT_TRUE(IsBubbleShowing());
+  // Set up the second tab and bring the bubble again.
+  AddTabAtIndex(1, GURL("http://example.com/"), ui::PAGE_TRANSITION_TYPED);
   TabStripModel* tab_model = browser()->tab_strip_model();
-  EXPECT_EQ(0, tab_model->active_index());
-  // Back to the first tab.
   tab_model->ActivateTabAt(1, true);
   EXPECT_FALSE(IsBubbleShowing());
+  EXPECT_EQ(1, tab_model->active_index());
+  SetupPendingPassword();
+  EXPECT_TRUE(IsBubbleShowing());
+  // Back to the first tab.
+  tab_model->ActivateTabAt(0, true);
+  EXPECT_FALSE(IsBubbleShowing());
 }
 
 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, ChooseCredential) {
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc b/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc
index 503c7dc..eab27b2da 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc
@@ -52,7 +52,7 @@
 #endif
 IN_PROC_BROWSER_TEST_F(PermissionBubbleManagerBrowserTest,
                        MAYBE_RequestsBeforeLoad) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(),
@@ -67,7 +67,7 @@
 // Requests before the load should not be bundled with a request after the load.
 IN_PROC_BROWSER_TEST_F(PermissionBubbleManagerBrowserTest,
                        RequestsBeforeAfterLoad) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(),
@@ -89,7 +89,7 @@
 #define MAYBE_NavTwice NavTwice
 #endif
 IN_PROC_BROWSER_TEST_F(PermissionBubbleManagerBrowserTest, MAYBE_NavTwice) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(),
@@ -117,7 +117,7 @@
 #endif
 IN_PROC_BROWSER_TEST_F(PermissionBubbleManagerBrowserTest,
                        MAYBE_NavTwiceWithHash) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(),
@@ -138,7 +138,7 @@
 
 // Bubble requests should be shown after in-page navigation.
 IN_PROC_BROWSER_TEST_F(PermissionBubbleManagerBrowserTest, InPageNavigation) {
-  ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+  ASSERT_TRUE(embedded_test_server()->Start());
 
   ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
       browser(),
diff --git a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc
index 7c8dcf54b..1e0b1f1 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc
@@ -17,6 +17,7 @@
 #include "content/public/test/mock_download_item.h"
 #include "content/public/test/mock_download_manager.h"
 #include "content/public/test/test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 namespace {
 
@@ -129,7 +130,7 @@
     browser()->profile()->GetPrefs()->SetFilePath(
         prefs::kDownloadDefaultDirectory,
         downloads_directory_.path());
-    CHECK(test_server()->Start());
+    CHECK(embedded_test_server()->Start());
     mock_handler_->HandleGetDownloads(nullptr);
   }
 
@@ -138,7 +139,7 @@
   }
 
   void DownloadAnItem() {
-    GURL url = test_server()->GetURL("files/downloads/image.jpg");
+    GURL url = embedded_test_server()->GetURL("/downloads/image.jpg");
     std::vector<GURL> url_chain;
     url_chain.push_back(url);
     base::Time current(base::Time::Now());
diff --git a/chrome/browser/ui/webui/inspect_ui_browsertest.cc b/chrome/browser/ui/webui/inspect_ui_browsertest.cc
index a54b340..60458d4 100644
--- a/chrome/browser/ui/webui/inspect_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/inspect_ui_browsertest.cc
@@ -13,15 +13,14 @@
 #include "content/public/browser/navigation_details.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 
 using content::WebContents;
 
 namespace {
 
-const char kSharedWorkerTestPage[] =
-    "files/workers/workers_ui_shared_worker.html";
-const char kSharedWorkerJs[] =
-    "files/workers/workers_ui_shared_worker.js";
+const char kSharedWorkerTestPage[] = "/workers/workers_ui_shared_worker.html";
+const char kSharedWorkerJs[] = "/workers/workers_ui_shared_worker.js";
 
 class InspectUITest : public WebUIBrowserTest {
  public:
@@ -46,8 +45,8 @@
 }
 
 IN_PROC_BROWSER_TEST_F(InspectUITest, SharedWorker) {
-  ASSERT_TRUE(test_server()->Start());
-  GURL url = test_server()->GetURL(kSharedWorkerTestPage);
+  ASSERT_TRUE(embedded_test_server()->Start());
+  GURL url = embedded_test_server()->GetURL(kSharedWorkerTestPage);
   ui_test_utils::NavigateToURL(browser(), url);
 
   ui_test_utils::NavigateToURLWithDisposition(
@@ -86,7 +85,7 @@
 }
 
 IN_PROC_BROWSER_TEST_F(InspectUITest, ReloadCrash) {
-  ASSERT_TRUE(test_server()->Start());
+  ASSERT_TRUE(embedded_test_server()->Start());
   ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIInspectURL));
   ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIInspectURL));
 }
diff --git a/chrome/browser/ui/webui/webui_webview_browsertest.cc b/chrome/browser/ui/webui/webui_webview_browsertest.cc
index 1bb2e9e6..2ed4fa8 100644
--- a/chrome/browser/ui/webui/webui_webview_browsertest.cc
+++ b/chrome/browser/ui/webui/webui_webview_browsertest.cc
@@ -29,7 +29,7 @@
     base::FilePath test_data_dir;
     PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
     embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
-    ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   GURL GetTestUrl(const std::string& path) const {
diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc
index 3a368cd0..ec7d76d 100644
--- a/chrome/browser/unload_browsertest.cc
+++ b/chrome/browser/unload_browsertest.cc
@@ -25,6 +25,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request_test_util.h"
 
@@ -429,14 +430,12 @@
   }
 
   void SetUpInProcessBrowserTestFixture() override {
-    ASSERT_TRUE(test_server()->Start());
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
-  void TearDownInProcessBrowserTestFixture() override { test_server()->Stop(); }
-
   GURL GetUrl(const std::string& name) {
-    return GURL(test_server()->GetURL(
-        "files/fast_tab_close/" + name + ".html"));
+    return GURL(
+        embedded_test_server()->GetURL("/fast_tab_close/" + name + ".html"));
   }
 
   void NavigateToPage(const char* name) {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index d6a9b8e3..79bd4d4 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -387,6 +387,8 @@
       'browser/chrome_content_browser_client.cc',
       'browser/chrome_content_browser_client.h',
       'browser/chrome_content_browser_client_parts.h',
+      'browser/chrome_device_client.cc',
+      'browser/chrome_device_client.h',
       'browser/chrome_elf_init_win.cc',
       'browser/chrome_elf_init_win.h',
       'browser/chrome_net_benchmarking_message_filter.cc',
@@ -396,6 +398,8 @@
       'browser/chrome_quota_permission_context.h',
       'browser/chrome_select_file_dialog_factory_win.cc',
       'browser/chrome_select_file_dialog_factory_win.h',
+      'browser/chrome_webusb_browser_client.cc',
+      'browser/chrome_webusb_browser_client.h',
       'browser/command_observer.h',
       'browser/command_updater.cc',
       'browser/command_updater.h',
@@ -874,6 +878,14 @@
       'browser/translate/translate_service.h',
       'browser/update_client/chrome_update_query_params_delegate.cc',
       'browser/update_client/chrome_update_query_params_delegate.h',
+      'browser/usb/usb_chooser_context.cc',
+      'browser/usb/usb_chooser_context.h',
+      'browser/usb/usb_chooser_context_factory.cc',
+      'browser/usb/usb_chooser_context_factory.h',
+      'browser/usb/usb_tab_helper.cc',
+      'browser/usb/usb_tab_helper.h',
+      'browser/usb/web_usb_permission_provider.cc',
+      'browser/usb/web_usb_permission_provider.h',
       'browser/web_data_service_factory.cc',
       'browser/web_data_service_factory.h',
     ],
@@ -1047,12 +1059,8 @@
       'browser/chrome_browser_field_trials_desktop.h',
       'browser/chrome_browser_main_posix.cc',
       'browser/chrome_browser_main_posix.h',
-      'browser/chrome_device_client.cc',
-      'browser/chrome_device_client.h',
       'browser/chrome_process_singleton.cc',
       'browser/chrome_process_singleton.h',
-      'browser/chrome_webusb_browser_client.cc',
-      'browser/chrome_webusb_browser_client.h',
       'browser/component_updater/widevine_cdm_component_installer.cc',
       'browser/component_updater/widevine_cdm_component_installer.h',
       'browser/custom_handlers/register_protocol_handler_permission_request.cc',
@@ -1304,16 +1312,8 @@
       'browser/sync/sync_ui_util.h',
       'browser/tracing/chrome_tracing_delegate.cc',
       'browser/tracing/chrome_tracing_delegate.h',
-      'browser/usb/usb_chooser_context.cc',
-      'browser/usb/usb_chooser_context.h',
-      'browser/usb/usb_chooser_context_factory.cc',
-      'browser/usb/usb_chooser_context_factory.h',
       'browser/upgrade_detector.cc',
       'browser/upgrade_detector.h',
-      'browser/usb/usb_tab_helper.cc',
-      'browser/usb/usb_tab_helper.h',
-      'browser/usb/web_usb_permission_provider.cc',
-      'browser/usb/web_usb_permission_provider.h',
     ],
     'chrome_browser_win_sources': [
       'browser/browser_process_platform_part_aurawin.cc',
@@ -3243,9 +3243,14 @@
             '../components/components.gyp:web_cache_browser',
             '../components/components.gyp:web_modal',
             '../components/components.gyp:web_resource',
+            '../components/components.gyp:webusb',
             '../components/components_resources.gyp:components_resources',
             '../content/app/resources/content_resources.gyp:content_resources',
+            '../device/core/core.gyp:device_core',
+            '../device/devices_app/devices_app.gyp:devices_app_public_cpp',
+            '../device/devices_app/devices_app.gyp:devices_app_public_cpp_factory',
             '../device/devices_app/devices_app.gyp:device_usb_mojo_bindings_lib',
+            '../device/usb/usb.gyp:device_usb',
             '../gpu/gpu.gyp:gpu',
             '../media/media.gyp:media',
             '../media/midi/midi.gyp:midi',
@@ -3642,11 +3647,6 @@
           'sources': [ '<@(chrome_browser_non_mobile_sources)' ],
           'dependencies': [
             '../components/components.gyp:feedback_component',
-            '../components/components.gyp:webusb',
-            '../device/core/core.gyp:device_core',
-            '../device/devices_app/devices_app.gyp:devices_app_public_cpp',
-            '../device/devices_app/devices_app.gyp:devices_app_public_cpp_factory',
-            '../device/usb/usb.gyp:device_usb',
             '../net/net.gyp:net_browser_services',
           ]
         }],
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 773aeeb..3fca748 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -733,6 +733,12 @@
       'browser/ui/cocoa/app_menu/app_menu_button_cell.mm',
       'browser/ui/cocoa/app_menu/app_menu_controller.h',
       'browser/ui/cocoa/app_menu/app_menu_controller.mm',
+      'browser/ui/cocoa/app_menu/menu_tracked_button.h',
+      'browser/ui/cocoa/app_menu/menu_tracked_button.mm',
+      'browser/ui/cocoa/app_menu/menu_tracked_root_view.h',
+      'browser/ui/cocoa/app_menu/menu_tracked_root_view.mm',
+      'browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h',
+      'browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.mm',
       'browser/ui/cocoa/applescript/apple_event_util.h',
       'browser/ui/cocoa/applescript/apple_event_util.mm',
       'browser/ui/cocoa/applescript/bookmark_folder_applescript.h',
@@ -1276,12 +1282,6 @@
       'browser/ui/cocoa/website_settings/website_settings_utils_cocoa.mm',
       'browser/ui/cocoa/window_size_autosaver.h',
       'browser/ui/cocoa/window_size_autosaver.mm',
-      'browser/ui/cocoa/wrench_menu/menu_tracked_button.h',
-      'browser/ui/cocoa/wrench_menu/menu_tracked_button.mm',
-      'browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h',
-      'browser/ui/cocoa/wrench_menu/menu_tracked_root_view.mm',
-      'browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h',
-      'browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.mm',
     ],
     # Files used only on desktop systems (not iOS, Android, ChromeOS).
     'chrome_browser_ui_desktop_sources': [
diff --git a/chrome/chrome_nibs.gyp b/chrome/chrome_nibs.gyp
index 8d8f6ed..d0f5dd89 100644
--- a/chrome/chrome_nibs.gyp
+++ b/chrome/chrome_nibs.gyp
@@ -55,6 +55,8 @@
         'browser/ui/cocoa/animatable_view.mm',
         'browser/ui/cocoa/app_menu/app_menu_controller.h',
         'browser/ui/cocoa/app_menu/app_menu_controller.mm',
+        'browser/ui/cocoa/app_menu/menu_tracked_root_view.h',
+        'browser/ui/cocoa/app_menu/menu_tracked_root_view.mm',
         'browser/ui/cocoa/background_gradient_view.h',
         'browser/ui/cocoa/background_gradient_view.mm',
         'browser/ui/cocoa/base_bubble_controller.h',
@@ -235,8 +237,6 @@
         'browser/ui/cocoa/vertical_gradient_view.mm',
         'browser/ui/cocoa/view_id_util.h',
         'browser/ui/cocoa/view_id_util.mm',
-        'browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h',
-        'browser/ui/cocoa/wrench_menu/menu_tracked_root_view.mm',
       ],
       'mac_bundle_resources': [
         '<@(mac_all_xibs)',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index c8cd2c92..a95e9c8c 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -3253,6 +3253,20 @@
           ],
         },
         {
+         'target_name': 'telemetry_unittests_run',
+         'type': 'none',
+         'dependencies': [
+            'chrome_run',
+            'telemetry_chrome_test_base'
+         ],
+         'includes': [
+           '../build/isolate.gypi',
+          ],
+          'sources': [
+            'telemetry_unittests.isolate',
+          ],
+        },
+        {
          'target_name': 'telemetry_gpu_unittests_run',
          'type': 'none',
          'dependencies': [
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 1171d043..7f9f754 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -266,6 +266,7 @@
       'browser/ui/cocoa/animatable_view_unittest.mm',
       'browser/ui/cocoa/app_menu/app_menu_button_cell_unittest.mm',
       'browser/ui/cocoa/app_menu/app_menu_controller_unittest.mm',
+      'browser/ui/cocoa/app_menu/menu_tracked_root_view_unittest.mm',
       'browser/ui/cocoa/applescript/apple_event_util_unittest.mm',
       'browser/ui/cocoa/applescript/bookmark_applescript_utils_unittest.h',
       'browser/ui/cocoa/applescript/bookmark_applescript_utils_unittest.mm',
@@ -446,7 +447,6 @@
       'browser/ui/cocoa/website_settings/permission_selector_button_unittest.mm',
       'browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm',
       'browser/ui/cocoa/window_size_autosaver_unittest.mm',
-      'browser/ui/cocoa/wrench_menu/menu_tracked_root_view_unittest.mm',
       'browser/ui/find_bar/find_backend_unittest.cc',
       'browser/ui/login/login_prompt_unittest.cc',
       'browser/ui/passwords/manage_passwords_state_unittest.cc',
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json
index 4cd1070..a4a90aa 100644
--- a/chrome/common/extensions/api/_permission_features.json
+++ b/chrome/common/extensions/api/_permission_features.json
@@ -157,7 +157,8 @@
       "4AC2B6C63C6480D150DFDA13E4A5956EB1D0DDBB",  // http://crbug.com/407693
       "81986D4F846CEDDDB962643FA501D1780DD441BB",  // http://crbug.com/407693
       "B620CF4203315F9F2E046EDED22C7571A935958D",  // http://crbug.com/510270
-      "B206D8716769728278D2D300349C6CB7D7DE2EF9"   // http://crbug.com/510270
+      "B206D8716769728278D2D300349C6CB7D7DE2EF9",  // http://crbug.com/510270
+      "F0CA817739BF63A227F634D6BF570C34CC6E676E"   // http://crbug.com/557054
     ]
   },
   "clipboardRead": {
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_rules.cc b/chrome/common/extensions/permissions/chrome_permission_message_rules.cc
index 66a4f20..4ef877e 100644
--- a/chrome/common/extensions/permissions/chrome_permission_message_rules.cc
+++ b/chrome/common/extensions/permissions/chrome_permission_message_rules.cc
@@ -633,6 +633,9 @@
       {IDS_EXTENSION_PROMPT_WARNING_USERS_PRIVATE,
        {APIPermission::kUsersPrivate},
        {}},
+      {IDS_EXTENSION_PROMPT_WARNING_DISPLAY_SOURCE,
+       {APIPermission::kDisplaySource},
+       {}},
   };
 
   return std::vector<ChromePermissionMessageRule>(
diff --git a/chrome/ct_top1k.isolate b/chrome/ct_top1k.isolate
new file mode 100644
index 0000000..fe1bbc8
--- /dev/null
+++ b/chrome/ct_top1k.isolate
@@ -0,0 +1,43 @@
+# Copyright (c) 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.
+
+{
+  'includes': [
+    # TODO(rmistry): Try out the below once things are running on the
+    #                FYI waterfall.
+    # '../tools/telemetry/telemetry.isolate',
+    # '../tools/perf/perf.isolate',
+    '../tools/perf/chrome_telemetry_build/telemetry_binary_manager.isolate',
+  ],
+  'conditions': [
+    ['OS=="android" or OS=="linux" or OS=="mac" or OS=="win"', {
+      'variables': {
+        'files': [
+          '../build/android/pylib/',
+          '../build/android/devil/',
+          '../testing/variations/',
+          '../third_party/catapult/',
+          '../tools/telemetry/',
+          '../tools/perf/',
+          '../tools/variations/',
+          '../testing/test_env.py',
+          '../out/Release/',
+
+          '../content/test/ct/run_ct_top1k.py',
+          '../content/test/ct/slave<(SLAVE_NUM)/page_sets/',
+          '../content/test/ct/run_chromium_perf_swarming',
+        ],
+        'command': [
+          'python',
+          '../content/test/ct/run_ct_top1k.py',
+          '--slave_num=<(SLAVE_NUM)',
+          '--benchmark=<(BENCHMARK)',
+          '--master=<(MASTER)',
+          '--builder=<(BUILDER)',
+          '--git_hash=<(GIT_HASH)',
+        ],
+      },
+    }],
+  ]
+}
diff --git a/chrome/telemetry_unittests.isolate b/chrome/telemetry_unittests.isolate
new file mode 100644
index 0000000..f91ea698
--- /dev/null
+++ b/chrome/telemetry_unittests.isolate
@@ -0,0 +1,28 @@
+# 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.
+{
+  'includes': [
+    '../tools/perf/chrome_telemetry_build/telemetry_chrome_test.isolate',
+  ],
+  'conditions': [
+    ['OS=="mac" or OS=="win"', {
+      'variables': {
+        'files': [
+          # Other dependencies of the tests and their harness.
+          '../testing/test_env.py',
+          '../testing/xvfb.py',
+          '../testing/scripts/common.py',
+          '../testing/scripts/run_telemetry_as_googletest.py',
+        ],
+        'command': [
+          '../testing/scripts/run_telemetry_as_googletest.py',
+          '../tools/telemetry/run_tests',
+          '-v',
+          '--chrome-root',
+          '..'
+        ],
+      },
+    }],
+  ]
+}
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 85dddc40..de5bd57 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -689,6 +689,46 @@
 
   # TODO(GYP): Delete this after we've converted everything to GN.
   # The _run targets exist only for compatibility w/ GYP.
+  group("telemetry_unittests_run") {
+    testonly = true
+    deps = [
+      ":telemetry_unittests",
+    ]
+  }
+
+  group("telemetry_unittests") {
+    deps = [
+      "//tools/perf/chrome_telemetry_build:telemetry_chrome_test",
+    ]
+
+    data = [
+      "//tools/perf/",
+
+      # Field trial config
+      "//tools/variations/",
+
+      # For isolate contract.
+      "//testing/scripts/common.py",
+      "//testing/xvfb.py",
+      "//testing/scripts/run_telemetry_as_googletest.py",
+    ]
+
+    if (is_win && (symbol_level == 1 || symbol_level == 2)) {
+      # TODO(GYP): These should be provided automatically through data_deps.
+      data += [ "$root_out_dir/chrome.exe.pdb" ]
+      if (is_component_build) {
+        data += [
+          "$root_out_dir/base.dll.pdb",
+          "$root_out_dir/blink_platform.dll.pdb",
+          "$root_out_dir/blink_web.dll.pdb",
+          "$root_out_dir/content.dll.pdb",
+        ]
+      }
+    }
+  }
+
+  # TODO(GYP): Delete this after we've converted everything to GN.
+  # The _run targets exist only for compatibility w/ GYP.
   group("telemetry_gpu_test_run") {
     testonly = true
     deps = [
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java
index c50ee4a..9b486878 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java
@@ -186,12 +186,9 @@
     }
 
     /**
-     * Triggers a sync and waits till it is complete.
+     * Triggers a sync cycle.
      */
-    public static void triggerSyncAndWaitForCompletion(final Context context)
-            throws InterruptedException {
-        final long oldSyncTime = getCurrentSyncTime(context);
-        // Request sync.
+    public static void triggerSync() throws InterruptedException {
         ThreadUtils.runOnUiThreadBlocking(new Runnable() {
             @Override
             public void run() {
@@ -199,6 +196,16 @@
                         .requestSyncFromNativeChromeForAllTypes();
             }
         });
+    }
+
+    /**
+     * Triggers a sync and waits till it is complete.
+     */
+    public static void triggerSyncAndWaitForCompletion(final Context context)
+            throws InterruptedException {
+        final long oldSyncTime = getCurrentSyncTime(context);
+
+        triggerSync();
 
         // Wait till lastSyncedTime > oldSyncTime.
         Assert.assertTrue("Timed out waiting for syncing to complete.",
diff --git a/chrome/test/data/extensions/api_test/webnavigation/prerender/test_prerender.js b/chrome/test/data/extensions/api_test/webnavigation/prerender/test_prerender.js
index 4a7e092..b4d2d0e 100644
--- a/chrome/test/data/extensions/api_test/webnavigation/prerender/test_prerender.js
+++ b/chrome/test/data/extensions/api_test/webnavigation/prerender/test_prerender.js
@@ -5,14 +5,14 @@
 onload = function() {
   var getURL = chrome.extension.getURL;
   var URL_LOAD =
-      "http://127.0.0.1:PORT/files/prerender/prerender_loader.html";
+      "http://127.0.0.1:PORT/prerender/prerender_loader.html";
   var URL_TARGET =
-      "http://127.0.0.1:PORT/files/prerender/prerender_page.html";
+      "http://127.0.0.1:PORT/prerender/prerender_page.html";
   chrome.tabs.create({"url": "about:blank"}, function(tab) {
     var tabId = tab.id;
     chrome.test.getConfig(function(config) {
       var fixPort = function(url) {
-        return url.replace(/PORT/g, config.spawnedTestServer.port);
+        return url.replace(/PORT/g, config.testServer.port);
       };
       URL_LOAD = fixPort(URL_LOAD);
       URL_TARGET = fixPort(URL_TARGET);
diff --git a/chrome/test/data/extensions/api_test/webstore_private/noframe2.html b/chrome/test/data/extensions/api_test/webstore_private/noframe2.html
index 073d0b7c0..f89deea 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/noframe2.html
+++ b/chrome/test/data/extensions/api_test/webstore_private/noframe2.html
@@ -13,7 +13,7 @@
     // an x-frame-options header for the error page.
     var f = document.createElement('iframe');
     s = s.replace('127.0.0.1', 'www.example.com');
-    s = s.replace('/files/', '/nonesuch/');
+    s = s.replace('/extensions/', '/nonesuch/extensions/');
     f.src = s;
     f.onload = checkFrame;
     f.onerror = checkFrame;
diff --git a/chrome/test/data/extensions/native_client_hosted_app/manifest.json b/chrome/test/data/extensions/native_client_hosted_app/manifest.json
index c1b4f5496..73cf16b 100644
--- a/chrome/test/data/extensions/native_client_hosted_app/manifest.json
+++ b/chrome/test/data/extensions/native_client_hosted_app/manifest.json
@@ -5,10 +5,10 @@
   "description": "end-to-end browser test for native client in hosted apps",
   "app": {
     "urls": [
-      "http://localhost/files/extensions/native_client"
+      "http://localhost/extensions/native_client"
     ],
     "launch": {
-      "web_url": "http://localhost/files/extensions/native_client/test.html"
+      "web_url": "http://localhost/extensions/native_client/test.html"
     }
   }
 }
diff --git a/chrome/test/data/extensions/platform_apps/web_view/interstitial_teardown/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/interstitial_teardown/embedder.js
index 979044a..4965030 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/interstitial_teardown/embedder.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/interstitial_teardown/embedder.js
@@ -8,7 +8,7 @@
 
   // This page is not loaded, we just need a https URL.
   var guestSrcHTTPS = 'https://localhost:' + port +
-      '/files/extensions/platform_apps/web_view/' +
+      '/extensions/platform_apps/web_view/' +
       'interstitial_teardown/https_page.html';
   window.console.log('guestSrcHTTPS: ' + guestSrcHTTPS);
   webview.setAttribute('src', guestSrcHTTPS);
diff --git a/chrome/test/data/prerender/prerender_deferred_image.html b/chrome/test/data/prerender/prerender_deferred_image.html
index 2507bf3..bcd8e60d 100644
--- a/chrome/test/data/prerender/prerender_deferred_image.html
+++ b/chrome/test/data/prerender/prerender_deferred_image.html
@@ -15,7 +15,7 @@
 
 // Insert a deferred redirect into the document.
 var image = new Image();
-image.src = prefix + "/files/prerender/image-deferred.png";
+image.src = prefix + "/prerender/image-deferred.png";
 image.onload = function() {
   imageWasLoaded = true;
 };
@@ -35,7 +35,7 @@
 // TODO(davidben): Wait on something more reasonable. This should
 // still pass reliably, but will only fail flakily on regression.
 var image2 = new Image();
-image2.src = prefix + "/files/prerender/image-redirect.png";
+image2.src = prefix + "/prerender/image-redirect.png";
 image2.onload = function() {
   document.title = "READY";
 };
diff --git a/chrome/test/data/redirect-loop.html.mock-http-headers b/chrome/test/data/redirect-loop.html.mock-http-headers
index e23c257..f30c5e4 100644
--- a/chrome/test/data/redirect-loop.html.mock-http-headers
+++ b/chrome/test/data/redirect-loop.html.mock-http-headers
@@ -1,3 +1,3 @@
 HTTP/1.1 302 Moved
-Location: /files/redirect-loop.html
+Location: /redirect-loop.html
 Set-Cookie: A=B
diff --git a/chrome/tools/build/win/resedit.py b/chrome/tools/build/win/resedit.py
index 4bd53f5..bc1eb62 100755
--- a/chrome/tools/build/win/resedit.py
+++ b/chrome/tools/build/win/resedit.py
@@ -45,7 +45,7 @@
   return res_id
 
 
-class _ResourceEditor(object):
+class ResourceEditor(object):
   """A utility class to make it easy to extract and manipulate resources in a
   Windows binary."""
 
@@ -157,7 +157,8 @@
                        res_type_str, res_lang, res_name_str, dest_file)
 
           # Extract each resource to a file in the output dir.
-          os.makedirs(dest_dir)
+          if not os.path.exists(dest_dir):
+            os.makedirs(dest_dir)
           self.ExtractResource(res_type, res_lang, res_name, dest_file)
 
   def ExtractResource(self, res_type, res_lang, res_name, dest_file):
@@ -209,7 +210,7 @@
       res_name: the name of the resource, e.g. "SETUP.EXE".
       file_path: path to the file containing the new resource data.
     """
-    _LOGGER.info('Writing resource "%s:%s" from file.',
+    _LOGGER.info('Writing resource "%s:%s" from file %s.',
         res_type, res_name, file_path)
 
     with open(file_path, 'rb') as f:
@@ -230,9 +231,11 @@
       update_handle = self._update_handle
       self._update_handle = None
       win32api.EndUpdateResource(update_handle, False)
-
-    _LOGGER.info('Writing edited file to "%s".', self._output_file)
-    shutil.copyfile(self._temp_file, self._output_file)
+      _LOGGER.info('Writing edited file to "%s".', self._output_file)
+      shutil.copyfile(self._temp_file, self._output_file)
+    else:
+      _LOGGER.info('No edits made. Copying input to "%s".', self._output_file)
+      shutil.copyfile(self._input_file, self._output_file)
 
 
 _USAGE = """\
@@ -298,7 +301,7 @@
     logging.basicConfig(level=logging.INFO)
 
   # Create the editor for our input file.
-  editor = _ResourceEditor(args[0], options.output_file)
+  editor = ResourceEditor(args[0], options.output_file)
 
   if options.extract_all:
     editor.ExtractAllToDir(options.extract_all)
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM
index 97b4b93..588ef4ae 100644
--- a/chromeos/CHROMEOS_LKGM
+++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@
-7644.0.0
\ No newline at end of file
+7650.0.0
\ No newline at end of file
diff --git a/components/BUILD.gn b/components/BUILD.gn
index 79e21283..505988d 100644
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
@@ -53,6 +53,7 @@
     "//components/pref_registry",
     "//components/omnibox/browser",
     "//components/infobars/core",
+    "//components/signin/core/browser",
     "//components/translate/core/browser",
     "//components/translate/core/common",
     "//components/version_ui",
@@ -133,7 +134,6 @@
       "//components/safe_browsing_db",
       "//components/search_provider_logos",
       "//components/security_interstitials/core",
-      "//components/signin/core/browser",
       "//components/ssl_config",
       "//components/startup_metric_utils/common",
       "//components/startup_metric_utils/browser",
@@ -228,6 +228,7 @@
       "//components/dom_distiller/ios",
       "//components/history/ios/browser",
       "//components/keyed_service/ios",
+      "//components/signin/ios/browser",
       "//components/translate/ios/browser",
       "//components/webp_transcode",
     ]
@@ -356,6 +357,7 @@
     "//components/search_engines:unit_tests",
     "//components/undo:unit_tests",
     "//components/leveldb_proto:unit_tests",
+    "//components/signin/core/browser:unit_tests",
     "//components/suggestions:unit_tests",
     "//components/translate/core/browser:unit_tests",
     "//components/translate/core/common:unit_tests",
@@ -429,7 +431,6 @@
       "//components/search_engines:unit_tests",
       "//components/search:unit_tests",
       "//components/search_provider_logos:unit_tests",
-      "//components/signin/core/browser:unit_tests",
       "//components/ssl_config:unit_tests",
       "//components/sync_bookmarks:unit_tests",
       "//components/sync_driver:unit_tests",
@@ -481,6 +482,7 @@
         "//components/invalidation/impl:java",
         "//components/safe_json/android:safe_json_java",
         "//components/signin/core/browser/android:java",
+        "//components/variations/android:variations_java",
         "//content/public/android:content_java",
         "//ui/android:ui_java",
       ]
@@ -507,6 +509,7 @@
     }
   } else {
     deps += [
+      "//components/signin/ios/browser:unit_tests",
       "//components/translate/ios/browser:unit_tests",
       "//components/webp_transcode:unit_tests",
     ]
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.cc b/components/autofill/content/browser/content_autofill_driver_factory.cc
index d19bd574..f8b1f80 100644
--- a/components/autofill/content/browser/content_autofill_driver_factory.cc
+++ b/components/autofill/content/browser/content_autofill_driver_factory.cc
@@ -4,7 +4,6 @@
 
 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
 
-#include "base/bind.h"
 #include "base/stl_util.h"
 #include "components/autofill/content/browser/content_autofill_driver.h"
 #include "components/autofill/core/browser/autofill_client.h"
@@ -52,21 +51,19 @@
       client_(client),
       app_locale_(app_locale),
       enable_download_manager_(enable_download_manager) {
-  web_contents->ForEachFrame(
-      base::Bind(&ContentAutofillDriverFactory::CreateDriverForFrame,
-                 base::Unretained(this)));
+  content::RenderFrameHost* main_frame = web_contents->GetMainFrame();
+  if (main_frame->IsRenderFrameLive()) {
+    frame_driver_map_[main_frame] = make_scoped_ptr(new ContentAutofillDriver(
+        main_frame, client_, app_locale_, enable_download_manager_));
+  }
 }
 
-ContentAutofillDriverFactory::~ContentAutofillDriverFactory() {
-  STLDeleteContainerPairSecondPointers(frame_driver_map_.begin(),
-                                       frame_driver_map_.end());
-  frame_driver_map_.clear();
-}
+ContentAutofillDriverFactory::~ContentAutofillDriverFactory() {}
 
 ContentAutofillDriver* ContentAutofillDriverFactory::DriverForFrame(
     content::RenderFrameHost* render_frame_host) {
   auto mapping = frame_driver_map_.find(render_frame_host);
-  return mapping == frame_driver_map_.end() ? nullptr : mapping->second;
+  return mapping == frame_driver_map_.end() ? nullptr : mapping->second.get();
 }
 
 bool ContentAutofillDriverFactory::OnMessageReceived(
@@ -77,22 +74,25 @@
 
 void ContentAutofillDriverFactory::RenderFrameCreated(
     content::RenderFrameHost* render_frame_host) {
-  // RenderFrameCreated is called more than once for the main frame.
-  if (!frame_driver_map_[render_frame_host])
-    CreateDriverForFrame(render_frame_host);
+  auto insertion_result =
+      frame_driver_map_.insert(std::make_pair(render_frame_host, nullptr));
+  // This is called twice for the main frame.
+  if (insertion_result.second) {  // This was the first time.
+    insertion_result.first->second = make_scoped_ptr(new ContentAutofillDriver(
+        render_frame_host, client_, app_locale_, enable_download_manager_));
+  }
 }
 
 void ContentAutofillDriverFactory::RenderFrameDeleted(
     content::RenderFrameHost* render_frame_host) {
-  delete frame_driver_map_[render_frame_host];
   frame_driver_map_.erase(render_frame_host);
 }
 
 void ContentAutofillDriverFactory::DidNavigateAnyFrame(
-    content::RenderFrameHost* rfh,
+    content::RenderFrameHost* render_frame_host,
     const content::LoadCommittedDetails& details,
     const content::FrameNavigateParams& params) {
-  frame_driver_map_[rfh]->DidNavigateFrame(details, params);
+  frame_driver_map_[render_frame_host]->DidNavigateFrame(details, params);
 }
 
 void ContentAutofillDriverFactory::NavigationEntryCommitted(
@@ -104,11 +104,4 @@
   client_->HideAutofillPopup();
 }
 
-void ContentAutofillDriverFactory::CreateDriverForFrame(
-    content::RenderFrameHost* render_frame_host) {
-  DCHECK(!frame_driver_map_[render_frame_host]);
-  frame_driver_map_[render_frame_host] = new ContentAutofillDriver(
-      render_frame_host, client_, app_locale_, enable_download_manager_);
-}
-
 }  // namespace autofill
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.h b/components/autofill/content/browser/content_autofill_driver_factory.h
index c0b1aa1..12d36d6 100644
--- a/components/autofill/content/browser/content_autofill_driver_factory.h
+++ b/components/autofill/content/browser/content_autofill_driver_factory.h
@@ -5,6 +5,7 @@
 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_
 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_CONTENT_AUTOFILL_DRIVER_FACTORY_H_
 
+#include <map>
 #include <string>
 
 #include "base/memory/scoped_ptr.h"
@@ -68,13 +69,12 @@
   ~ContentAutofillDriverFactory() override;
 
  private:
-  void CreateDriverForFrame(content::RenderFrameHost* render_frame_host);
-
   AutofillClient* client_;
   std::string app_locale_;
   AutofillManager::AutofillDownloadManagerState enable_download_manager_;
 
-  std::map<content::RenderFrameHost*, ContentAutofillDriver*> frame_driver_map_;
+  std::map<content::RenderFrameHost*, scoped_ptr<ContentAutofillDriver>>
+      frame_driver_map_;
 };
 
 }  // namespace autofill
diff --git a/components/autofill/core/common/form_data.cc b/components/autofill/core/common/form_data.cc
index aaa8178f..3d68639 100644
--- a/components/autofill/core/common/form_data.cc
+++ b/components/autofill/core/common/form_data.cc
@@ -4,6 +4,8 @@
 
 #include "components/autofill/core/common/form_data.h"
 
+#include <tuple>
+
 #include "base/base64.h"
 #include "base/pickle.h"
 #include "base/strings/string_util.h"
@@ -86,15 +88,9 @@
 }
 
 bool FormData::operator<(const FormData& form) const {
-  if (name != form.name)
-    return name < form.name;
-  if (origin != form.origin)
-    return origin < form.origin;
-  if (action != form.action)
-    return action < form.action;
-  if (is_form_tag != form.is_form_tag)
-    return is_form_tag < form.is_form_tag;
-  return fields < form.fields;
+  return std::tie(name, origin, action, is_form_tag, fields) <
+         std::tie(form.name, form.origin, form.action, form.is_form_tag,
+                  form.fields);
 }
 
 std::ostream& operator<<(std::ostream& os, const FormData& form) {
diff --git a/components/autofill/core/common/form_field_data.cc b/components/autofill/core/common/form_field_data.cc
index 1ae34468e..54db610 100644
--- a/components/autofill/core/common/form_field_data.cc
+++ b/components/autofill/core/common/form_field_data.cc
@@ -4,6 +4,8 @@
 
 #include "components/autofill/core/common/form_field_data.h"
 
+#include <tuple>
+
 #include "base/pickle.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
@@ -117,29 +119,15 @@
 
 bool FormFieldData::operator<(const FormFieldData& field) const {
   // Like operator==, this ignores the value.
-  if (label < field.label) return true;
-  if (label > field.label) return false;
-  if (name < field.name) return true;
-  if (name > field.name) return false;
-  if (form_control_type < field.form_control_type) return true;
-  if (form_control_type > field.form_control_type) return false;
-  if (autocomplete_attribute < field.autocomplete_attribute) return true;
-  if (autocomplete_attribute > field.autocomplete_attribute) return false;
-  if (max_length < field.max_length) return true;
-  if (max_length > field.max_length) return false;
   // Skip |is_checked| and |is_autofilled| as in SameFieldAs.
-  if (is_checkable < field.is_checkable) return true;
-  if (is_checkable > field.is_checkable) return false;
-  if (is_focusable < field.is_focusable) return true;
-  if (is_focusable > field.is_focusable) return false;
-  if (should_autocomplete < field.should_autocomplete) return true;
-  if (should_autocomplete > field.should_autocomplete) return false;
-  if (role < field.role) return true;
-  if (role > field.role) return false;
-  if (text_direction < field.text_direction) return true;
-  if (text_direction > field.text_direction) return false;
   // See operator== above for why we don't check option_values/contents.
-  return false;
+  return std::tie(label, name, form_control_type, autocomplete_attribute,
+                  max_length, is_checkable, is_focusable, should_autocomplete,
+                  role, text_direction) <
+         std::tie(field.label, field.name, field.form_control_type,
+                  field.autocomplete_attribute, field.max_length,
+                  field.is_checkable, field.is_focusable,
+                  field.should_autocomplete, field.role, field.text_direction);
 }
 
 void SerializeFormFieldData(const FormFieldData& field_data,
diff --git a/components/autofill/core/common/password_form_fill_data.cc b/components/autofill/core/common/password_form_fill_data.cc
index 148b5c2..1c35ba2b 100644
--- a/components/autofill/core/common/password_form_fill_data.cc
+++ b/components/autofill/core/common/password_form_fill_data.cc
@@ -4,6 +4,8 @@
 
 #include "components/autofill/core/common/password_form_fill_data.h"
 
+#include <tuple>
+
 #include "base/strings/utf_string_conversions.h"
 #include "components/autofill/core/common/form_field_data.h"
 
@@ -15,11 +17,8 @@
 
 bool UsernamesCollectionKey::operator<(
     const UsernamesCollectionKey& other) const {
-  if (username != other.username)
-    return username < other.username;
-  if (password != other.password)
-    return password < other.password;
-  return realm < other.realm;
+  return std::tie(username, password, realm) <
+         std::tie(other.username, other.password, other.realm);
 }
 
 PasswordFormFillData::PasswordFormFillData()
diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc
index dd6636b..4ace523 100644
--- a/components/browser_sync/browser/profile_sync_service.cc
+++ b/components/browser_sync/browser/profile_sync_service.cc
@@ -1863,6 +1863,13 @@
          passphrase_type == syncer::CUSTOM_PASSPHRASE;
 }
 
+std::string ProfileSyncService::GetCustomPassphraseKey() const {
+  sync_driver::SystemEncryptor encryptor;
+  syncer::Cryptographer cryptographer(&encryptor);
+  cryptographer.Bootstrap(sync_prefs_.GetEncryptionBootstrapToken());
+  return cryptographer.GetDefaultNigoriKeyData();
+}
+
 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const {
   return backend_->GetPassphraseType();
 }
diff --git a/components/browser_sync/browser/profile_sync_service.h b/components/browser_sync/browser/profile_sync_service.h
index 32c998e08..6f6a9345 100644
--- a/components/browser_sync/browser/profile_sync_service.h
+++ b/components/browser_sync/browser/profile_sync_service.h
@@ -565,6 +565,10 @@
   // killed in the near future.
   void FlushDirectory() const;
 
+  // Returns a serialized NigoriKey proto generated from the bootstrap token in
+  // SyncPrefs. Will return the empty string if no bootstrap token exists.
+  std::string GetCustomPassphraseKey() const;
+
   // Needed to test whether the directory is deleted properly.
   base::FilePath GetDirectoryPathForTest() const;
 
diff --git a/components/components.gyp b/components/components.gyp
index bce3ab7..03da51c 100644
--- a/components/components.gyp
+++ b/components/components.gyp
@@ -129,6 +129,7 @@
         'web_cache.gypi',
         'web_contents_delegate_android.gypi',
         'web_modal.gypi',
+        'webusb.gypi',
       ],
     }],
     ['OS == "ios"', {
@@ -143,7 +144,6 @@
         'feedback.gypi',
         'proximity_auth.gypi',
         'storage_monitor.gypi',
-        'webusb.gypi',
       ]
     }],
     ['chromeos == 1', {
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index fd49988..4eb1410 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -421,6 +421,7 @@
       'page_load_metrics/renderer/page_timing_metrics_sender_unittest.cc',
     ],
     'password_manager_unittest_sources': [
+      'password_manager/content/browser/content_password_manager_driver_unittest.cc',
       'password_manager/content/browser/credential_manager_dispatcher_unittest.cc',
       'password_manager/core/browser/affiliated_match_helper_unittest.cc',
       'password_manager/core/browser/affiliation_backend_unittest.cc',
@@ -433,6 +434,7 @@
       'password_manager/core/browser/export/csv_writer_unittest.cc',
       'password_manager/core/browser/facet_manager_unittest.cc',
       'password_manager/core/browser/import/csv_reader_unittest.cc',
+      'password_manager/core/browser/log_manager_unittest.cc',
       'password_manager/core/browser/log_router_unittest.cc',
       'password_manager/core/browser/login_database_ios_unittest.cc',
       'password_manager/core/browser/login_database_unittest.cc',
@@ -1312,6 +1314,7 @@
             'components.gyp:data_reduction_proxy_content',
             'components.gyp:data_usage_android',
             'components.gyp:safe_json_java',
+            'components.gyp:variations_java',
             '../content/content.gyp:content_java',
             '../testing/android/native_test.gyp:native_test_native_code',
           ],
diff --git a/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc b/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
index d51e624..0c3ab90 100644
--- a/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
+++ b/components/content_settings/core/browser/content_settings_origin_identifier_value_map.cc
@@ -4,6 +4,8 @@
 
 #include "components/content_settings/core/browser/content_settings_origin_identifier_value_map.h"
 
+#include <tuple>
+
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
@@ -61,9 +63,8 @@
 
 bool OriginIdentifierValueMap::EntryMapKey::operator<(
     const OriginIdentifierValueMap::EntryMapKey& other) const {
-  if (content_type != other.content_type)
-    return content_type < other.content_type;
-  return (resource_identifier < other.resource_identifier);
+  return std::tie(content_type, resource_identifier) <
+    std::tie(other.content_type, other.resource_identifier);
 }
 
 OriginIdentifierValueMap::PatternPair::PatternPair(
@@ -78,11 +79,8 @@
   // Note that this operator is the other way around than
   // |ContentSettingsPattern::operator<|. It sorts patterns with higher
   // precedence first.
-  if (primary_pattern > other.primary_pattern)
-    return true;
-  else if (other.primary_pattern > primary_pattern)
-    return false;
-  return (secondary_pattern > other.secondary_pattern);
+  return std::tie(primary_pattern, secondary_pattern) >
+         std::tie(other.primary_pattern, other.secondary_pattern);
 }
 
 RuleIterator* OriginIdentifierValueMap::GetRuleIterator(
diff --git a/components/data_usage/android/traffic_stats_amortizer.cc b/components/data_usage/android/traffic_stats_amortizer.cc
index 8e2bbf5..36ec15bd 100644
--- a/components/data_usage/android/traffic_stats_amortizer.cc
+++ b/components/data_usage/android/traffic_stats_amortizer.cc
@@ -71,21 +71,14 @@
 // |pre_amortization_total| into each of the DataUse objects in
 // |data_use_sequence| by scaling the byte counts determined by the
 // |get_byte_count_fn| function (e.g. tx_bytes, rx_bytes) for each DataUse
-// appropriately.
+// appropriately. |pre_amortization_total| must not be 0.
 void AmortizeByteCountSequence(DataUseBuffer* data_use_sequence,
                                int64_t* (*get_byte_count_fn)(DataUse*),
                                int64_t pre_amortization_total,
                                int64_t desired_post_amortization_total) {
-  DCHECK_GE(pre_amortization_total, 0);
+  DCHECK_GT(pre_amortization_total, 0);
   DCHECK_GE(desired_post_amortization_total, 0);
 
-  if (pre_amortization_total == 0) {
-    // TODO(sclittle): If |desired_post_amortization_total| is non-zero, this
-    // could be ignoring overhead that should be amortized in somehow. Handle
-    // this case gracefully.
-    return;
-  }
-
   const double ratio = static_cast<double>(desired_post_amortization_total) /
                        static_cast<double>(pre_amortization_total);
 
@@ -104,27 +97,6 @@
   return &data_use->rx_bytes;
 }
 
-// Amortizes the difference between |desired_post_amortization_total_tx_bytes|
-// and |pre_amortization_total_tx_bytes| into each of the DataUse objects in
-// |data_use_sequence| by scaling the DataUse's |tx_bytes| appropriately. Does
-// the same with the |rx_bytes| using those respective parameters.
-void AmortizeDataUseSequence(DataUseBuffer* data_use_sequence,
-                             int64_t pre_amortization_total_tx_bytes,
-                             int64_t desired_post_amortization_total_tx_bytes,
-                             int64_t pre_amortization_total_rx_bytes,
-                             int64_t desired_post_amortization_total_rx_bytes) {
-  DCHECK(data_use_sequence);
-  DCHECK(!data_use_sequence->empty());
-
-  AmortizeByteCountSequence(data_use_sequence, &GetTxBytes,
-                            pre_amortization_total_tx_bytes,
-                            desired_post_amortization_total_tx_bytes);
-
-  AmortizeByteCountSequence(data_use_sequence, &GetRxBytes,
-                            pre_amortization_total_rx_bytes,
-                            desired_post_amortization_total_rx_bytes);
-}
-
 }  // namespace
 
 TrafficStatsAmortizer::TrafficStatsAmortizer()
@@ -252,17 +224,21 @@
     DCHECK_GE(current_traffic_stats_rx_bytes,
               last_amortization_traffic_stats_rx_bytes_);
 
-    int64_t desired_post_amortization_total_tx_bytes =
-        current_traffic_stats_tx_bytes -
-        last_amortization_traffic_stats_tx_bytes_;
-    int64_t desired_post_amortization_total_rx_bytes =
-        current_traffic_stats_rx_bytes -
-        last_amortization_traffic_stats_rx_bytes_;
-
-    AmortizeDataUseSequence(&buffered_data_use_, pre_amortization_tx_bytes_,
-                            desired_post_amortization_total_tx_bytes,
-                            pre_amortization_rx_bytes_,
-                            desired_post_amortization_total_rx_bytes);
+    // Only attempt to amortize network overhead from TrafficStats if any of
+    // those bytes are reflected in the pre-amortization byte totals. Otherwise,
+    // that network overhead will be amortized in a later amortization run.
+    if (pre_amortization_tx_bytes_ != 0) {
+      AmortizeByteCountSequence(&buffered_data_use_, &GetTxBytes,
+                                pre_amortization_tx_bytes_,
+                                current_traffic_stats_tx_bytes -
+                                    last_amortization_traffic_stats_tx_bytes_);
+    }
+    if (pre_amortization_rx_bytes_ != 0) {
+      AmortizeByteCountSequence(&buffered_data_use_, &GetRxBytes,
+                                pre_amortization_rx_bytes_,
+                                current_traffic_stats_rx_bytes -
+                                    last_amortization_traffic_stats_rx_bytes_);
+    }
   }
 
   // TODO(sclittle): Record some UMA about the delay before amortizing and how
@@ -272,21 +248,34 @@
   is_amortization_in_progress_ = false;
   current_amortization_run_start_time_ = base::TimeTicks();
 
+  // Don't update the previous amortization run's TrafficStats byte counts if
+  // none of the bytes since then are reflected in the pre-amortization byte
+  // totals. This way, the overhead that wasn't handled in this amortization run
+  // can be handled in a later amortization run that actually has bytes in that
+  // direction. This mitigates the problem of losing TrafficStats overhead bytes
+  // on slow networks due to TrafficStats seeing the bytes much earlier than the
+  // network stack reports them, or vice versa.
+  if (!are_last_amortization_traffic_stats_available_ ||
+      pre_amortization_tx_bytes_ != 0) {
+    last_amortization_traffic_stats_tx_bytes_ = current_traffic_stats_tx_bytes;
+  }
+  if (!are_last_amortization_traffic_stats_available_ ||
+      pre_amortization_rx_bytes_ != 0) {
+    last_amortization_traffic_stats_rx_bytes_ = current_traffic_stats_rx_bytes;
+  }
+
   are_last_amortization_traffic_stats_available_ =
       are_current_traffic_stats_available;
-  last_amortization_traffic_stats_tx_bytes_ = current_traffic_stats_tx_bytes;
-  last_amortization_traffic_stats_rx_bytes_ = current_traffic_stats_rx_bytes;
 
   pre_amortization_tx_bytes_ = 0;
   pre_amortization_rx_bytes_ = 0;
 
-  // Pass post-amortization DataUse objects to their respective callbacks.
   DataUseBuffer data_use_sequence;
   data_use_sequence.swap(buffered_data_use_);
-  for (auto& data_use_buffer_pair : data_use_sequence) {
-    scoped_ptr<DataUse> data_use(data_use_buffer_pair.first.release());
-    data_use_buffer_pair.second.Run(data_use.Pass());
-  }
+
+  // Pass post-amortization DataUse objects to their respective callbacks.
+  for (auto& data_use_buffer_pair : data_use_sequence)
+    data_use_buffer_pair.second.Run(data_use_buffer_pair.first.Pass());
 }
 
 }  // namespace android
diff --git a/components/data_usage/android/traffic_stats_amortizer_unittest.cc b/components/data_usage/android/traffic_stats_amortizer_unittest.cc
index b6b7f56..8777a10 100644
--- a/components/data_usage/android/traffic_stats_amortizer_unittest.cc
+++ b/components/data_usage/android/traffic_stats_amortizer_unittest.cc
@@ -340,28 +340,61 @@
 TEST_F(TrafficStatsAmortizerTest, AmortizeWithZeroPreAmortizationBytes) {
   SkipFirstAmortizationRun();
 
-  // Both byte counts should stay 0, even though TrafficStats saw bytes.
+  // Both byte counts should stay 0, even though TrafficStats saw bytes, which
+  // should be reflected in the next amortization run instead.
   amortizer()->AmortizeDataUse(CreateDataUse(0, 0),
                                ExpectDataUseCallback(CreateDataUse(0, 0)));
+  // Add the TrafficStats byte counts for this and the next amortization run.
   amortizer()->AddTrafficStats(100, 1000);
   AdvanceTime(kTrafficStatsQueryDelay);
   EXPECT_EQ(1, data_use_callback_call_count());
 
-  // This time, only TX bytes are 0, so RX bytes should double, but TX bytes
-  // should stay 0.
-  amortizer()->AmortizeDataUse(CreateDataUse(0, 500),
-                               ExpectDataUseCallback(CreateDataUse(0, 1000)));
-  amortizer()->AddTrafficStats(100, 1000);
+  // Both byte counts should double, even though the TrafficStats byte counts
+  // actually updated during the previous amortization run.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 500),
+                               ExpectDataUseCallback(CreateDataUse(100, 1000)));
   AdvanceTime(kTrafficStatsQueryDelay);
   EXPECT_EQ(2, data_use_callback_call_count());
+}
 
-  // This time, only RX bytes are 0, so TX bytes should double, but RX bytes
-  // should stay 0.
-  amortizer()->AmortizeDataUse(CreateDataUse(50, 0),
-                               ExpectDataUseCallback(CreateDataUse(100, 0)));
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithZeroTxPreAmortizationBytes) {
+  SkipFirstAmortizationRun();
+
+  // The count of transmitted bytes starts at 0, so it should stay 0, and be
+  // amortized in the next amortization run instead.
+  amortizer()->AmortizeDataUse(CreateDataUse(0, 500),
+                               ExpectDataUseCallback(CreateDataUse(0, 1000)));
+  // Add the TrafficStats byte counts for this and the next amortization run.
   amortizer()->AddTrafficStats(100, 1000);
   AdvanceTime(kTrafficStatsQueryDelay);
-  EXPECT_EQ(3, data_use_callback_call_count());
+  EXPECT_EQ(1, data_use_callback_call_count());
+
+  // The count of transmitted bytes should double, even though they actually
+  // updated during the previous amortization run.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 0),
+                               ExpectDataUseCallback(CreateDataUse(100, 0)));
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(2, data_use_callback_call_count());
+}
+
+TEST_F(TrafficStatsAmortizerTest, AmortizeWithZeroRxPreAmortizationBytes) {
+  SkipFirstAmortizationRun();
+
+  // The count of received bytes starts at 0, so it should stay 0, and be
+  // amortized in the next amortization run instead.
+  amortizer()->AmortizeDataUse(CreateDataUse(50, 0),
+                               ExpectDataUseCallback(CreateDataUse(100, 0)));
+  // Add the TrafficStats byte counts for this and the next amortization run.
+  amortizer()->AddTrafficStats(100, 1000);
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(1, data_use_callback_call_count());
+
+  // The count of received bytes should double, even though they actually
+  // updated during the previous amortization run.
+  amortizer()->AmortizeDataUse(CreateDataUse(0, 500),
+                               ExpectDataUseCallback(CreateDataUse(0, 1000)));
+  AdvanceTime(kTrafficStatsQueryDelay);
+  EXPECT_EQ(2, data_use_callback_call_count());
 }
 
 TEST_F(TrafficStatsAmortizerTest, AmortizeAtMaxDelay) {
@@ -375,7 +408,7 @@
   // kSmallDelay is a delay that's shorter than the delay before TrafficStats
   // would be queried, where kMaxAmortizationDelay is a multiple of kSmallDelay.
   const base::TimeDelta kSmallDelay = kMaxAmortizationDelay / 10;
-  EXPECT_LT(kSmallDelay, kMaxAmortizationDelay);
+  EXPECT_LT(kSmallDelay, kTrafficStatsQueryDelay);
 
   // Simulate multiple cases of extra bytes being reported, each before
   // TrafficStats would be queried, until kMaxAmortizationDelay has elapsed.
diff --git a/components/guest_view/browser/guest_view_manager.cc b/components/guest_view/browser/guest_view_manager.cc
index 4c86e9d1..c93f9530 100644
--- a/components/guest_view/browser/guest_view_manager.cc
+++ b/components/guest_view/browser/guest_view_manager.cc
@@ -4,6 +4,8 @@
 
 #include "components/guest_view/browser/guest_view_manager.h"
 
+#include <tuple>
+
 #include "base/macros.h"
 #include "base/strings/stringprintf.h"
 #include "components/guest_view/browser/guest_view_base.h"
@@ -476,10 +478,8 @@
 
 bool GuestViewManager::ElementInstanceKey::operator<(
     const GuestViewManager::ElementInstanceKey& other) const {
-  if (embedder_process_id != other.embedder_process_id)
-    return embedder_process_id < other.embedder_process_id;
-
-  return element_instance_id < other.element_instance_id;
+  return std::tie(embedder_process_id, element_instance_id) <
+         std::tie(other.embedder_process_id, other.element_instance_id);
 }
 
 bool GuestViewManager::ElementInstanceKey::operator==(
diff --git a/components/html_viewer/BUILD.gn b/components/html_viewer/BUILD.gn
index 85b973c2..95d6539 100644
--- a/components/html_viewer/BUILD.gn
+++ b/components/html_viewer/BUILD.gn
@@ -186,6 +186,7 @@
     "//mojo/public/cpp/environment:environment",
     "//mojo/services/network/public/cpp",
     "//mojo/services/network/public/interfaces",
+    "//mojo/services/tracing/public/cpp",
     "//mojo/services/tracing/public/interfaces",
     "//net",
     "//skia",
diff --git a/components/html_viewer/global_state.cc b/components/html_viewer/global_state.cc
index 18077ca..9d7f46b 100644
--- a/components/html_viewer/global_state.cc
+++ b/components/html_viewer/global_state.cc
@@ -16,6 +16,7 @@
 #include "gin/v8_initializer.h"
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/logging/init_logging.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
 #include "ui/base/resource/resource_bundle.h"
@@ -78,6 +79,7 @@
       discardable_memory_allocator_(kDesiredMaxMemory),
       compositor_thread_("compositor thread"),
       blink_settings_(new BlinkSettingsImpl()) {
+  tracing_.Initialize(app);
 }
 
 GlobalState::~GlobalState() {
diff --git a/components/html_viewer/global_state.h b/components/html_viewer/global_state.h
index a7c3894..c8c9523 100644
--- a/components/html_viewer/global_state.h
+++ b/components/html_viewer/global_state.h
@@ -14,6 +14,7 @@
 #include "components/mus/gles2/raster_thread_helper.h"
 #include "components/mus/public/interfaces/gpu.mojom.h"
 #include "components/resource_provider/public/cpp/resource_loader.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 #include "skia/ext/refptr.h"
 #include "ui/gfx/geometry/size.h"
 
@@ -117,6 +118,8 @@
   // memory based purging allocator working here.
   DiscardableMemoryAllocator discardable_memory_allocator_;
 
+  mojo::TracingImpl tracing_;
+
   scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_;
   scoped_ptr<BlinkPlatformImpl> blink_platform_;
   base::Thread compositor_thread_;
diff --git a/components/html_viewer/stats_collection_controller.cc b/components/html_viewer/stats_collection_controller.cc
index 2190933..965c317 100644
--- a/components/html_viewer/stats_collection_controller.cc
+++ b/components/html_viewer/stats_collection_controller.cc
@@ -13,7 +13,7 @@
 #include "gin/handle.h"
 #include "gin/object_template_builder.h"
 #include "mojo/application/public/cpp/application_impl.h"
-#include "mojo/application/public/cpp/switches.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
 
@@ -67,7 +67,7 @@
   // Only make startup tracing available when running in the context of a test.
   if (!app ||
       !base::CommandLine::ForCurrentProcess()->HasSwitch(
-          mojo::kEnableStatsCollectionBindings)) {
+          tracing::kEnableStatsCollectionBindings)) {
     return nullptr;
   }
 
@@ -105,7 +105,7 @@
   // Only make startup tracing available when running in the context of a test.
   if (!app ||
       !base::CommandLine::ForCurrentProcess()->HasSwitch(
-          mojo::kEnableStatsCollectionBindings)) {
+          tracing::kEnableStatsCollectionBindings)) {
     return nullptr;
   }
 
@@ -134,7 +134,7 @@
 std::string StatsCollectionController::GetHistogram(
     const std::string& histogram_name) {
   DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
-      mojo::kEnableStatsCollectionBindings));
+      tracing::kEnableStatsCollectionBindings));
 
   static bool startup_histogram_initialized = false;
   if (!startup_histogram_initialized) {
diff --git a/components/mus/BUILD.gn b/components/mus/BUILD.gn
index f75f1c3e..e89df7e 100644
--- a/components/mus/BUILD.gn
+++ b/components/mus/BUILD.gn
@@ -77,6 +77,7 @@
     "//components/mus/ws:lib",
     "//mojo/application/public/cpp",
     "//mojo/common:common_base",
+    "//mojo/services/tracing/public/cpp",
     "//ui/events",
     "//ui/gl:gl",
     "//ui/platform_window:platform_impls",
diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc
index ac91a9a..f464ba4 100644
--- a/components/mus/mus_app.cc
+++ b/components/mus/mus_app.cc
@@ -18,6 +18,7 @@
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/application/public/cpp/application_runner.h"
 #include "mojo/public/c/system/main.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 #include "ui/events/event_switches.h"
 #include "ui/events/platform/platform_event_source.h"
 #include "ui/gl/gl_surface.h"
diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h
index 3750428..069e665 100644
--- a/components/mus/mus_app.h
+++ b/components/mus/mus_app.h
@@ -17,6 +17,7 @@
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/interface_factory.h"
 #include "mojo/common/weak_binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 
 namespace mojo {
 class ApplicationImpl;
diff --git a/components/mus/public/cpp/lib/output_surface.cc b/components/mus/public/cpp/lib/output_surface.cc
index 66d4fb8..83f7f7a 100644
--- a/components/mus/public/cpp/lib/output_surface.cc
+++ b/components/mus/public/cpp/lib/output_surface.cc
@@ -18,7 +18,6 @@
     scoped_ptr<mus::WindowSurface> surface)
     : cc::OutputSurface(context_provider), surface_(surface.Pass()) {
   capabilities_.delegated_rendering = true;
-  capabilities_.max_frames_pending = 1;
 }
 
 OutputSurface::~OutputSurface() {}
diff --git a/components/mus/public/cpp/lib/window.cc b/components/mus/public/cpp/lib/window.cc
index f34a469..82c077b 100644
--- a/components/mus/public/cpp/lib/window.cc
+++ b/components/mus/public/cpp/lib/window.cc
@@ -363,6 +363,11 @@
   return connection_ && connection_->GetFocusedWindow() == this;
 }
 
+void Window::SetCanFocus(bool can_focus) {
+  if (connection_)
+    tree_client()->SetCanFocus(id_, can_focus);
+}
+
 void Window::Embed(mus::mojom::WindowTreeClientPtr client) {
   Embed(client.Pass(), mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT,
         base::Bind(&EmptyEmbedCallback));
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc
index 01ed3eb..43fc02c 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.cc
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc
@@ -220,6 +220,11 @@
   tree_->SetFocus(window_id);
 }
 
+void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) {
+  DCHECK(tree_);
+  tree_->SetCanFocus(window_id, can_focus);
+}
+
 void WindowTreeClientImpl::SetVisible(Id window_id, bool visible) {
   DCHECK(tree_);
   tree_->SetWindowVisibility(window_id, visible, ActionCompletedCallback());
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.h b/components/mus/public/cpp/lib/window_tree_client_impl.h
index fa2ab93..3782101e 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.h
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.h
@@ -65,6 +65,7 @@
                  const gfx::Rect& bounds);
   void SetClientArea(Id window_id, const gfx::Insets& client_area);
   void SetFocus(Id window_id);
+  void SetCanFocus(Id window_id, bool can_focus);
   void SetVisible(Id window_id, bool visible);
   void SetProperty(Window* window,
                    const std::string& name,
diff --git a/components/mus/public/cpp/tests/test_window_tree.cc b/components/mus/public/cpp/tests/test_window_tree.cc
index 1e538ce..c49929f4 100644
--- a/components/mus/public/cpp/tests/test_window_tree.cc
+++ b/components/mus/public/cpp/tests/test_window_tree.cc
@@ -85,6 +85,8 @@
 
 void TestWindowTree::SetFocus(uint32_t window_id) {}
 
+void TestWindowTree::SetCanFocus(uint32_t window_id, bool can_focus) {}
+
 void TestWindowTree::SetWindowTextInputState(uint32_t window_id,
                                              mojo::TextInputStatePtr state) {}
 
diff --git a/components/mus/public/cpp/tests/test_window_tree.h b/components/mus/public/cpp/tests/test_window_tree.h
index 39af211..5cc6762 100644
--- a/components/mus/public/cpp/tests/test_window_tree.h
+++ b/components/mus/public/cpp/tests/test_window_tree.h
@@ -64,6 +64,7 @@
              uint32_t policy_bitmask,
              const EmbedCallback& callback) override;
   void SetFocus(uint32_t window_id) override;
+  void SetCanFocus(uint32_t window_id, bool can_focus) override;
   void SetWindowTextInputState(uint32_t window_id,
                                mojo::TextInputStatePtr state) override;
   void SetImeVisibility(uint32_t window_id,
diff --git a/components/mus/public/cpp/window.h b/components/mus/public/cpp/window.h
index 8eea7d5..77bb18f50 100644
--- a/components/mus/public/cpp/window.h
+++ b/components/mus/public/cpp/window.h
@@ -176,6 +176,7 @@
   // Focus.
   void SetFocus();
   bool HasFocus() const;
+  void SetCanFocus(bool can_focus);
 
   // Embedding. See window_tree.mojom for details.
   void Embed(mus::mojom::WindowTreeClientPtr client);
diff --git a/components/mus/public/interfaces/window_tree.mojom b/components/mus/public/interfaces/window_tree.mojom
index d0ebf76..c9d4ecf 100644
--- a/components/mus/public/interfaces/window_tree.mojom
+++ b/components/mus/public/interfaces/window_tree.mojom
@@ -201,6 +201,7 @@
         uint32 policy_bitmask) => (bool success, uint16 connection_id);
 
   SetFocus(uint32 window_id);
+  SetCanFocus(uint32 window_id, bool can_focus);
 
   // Set text input state for the given window.
   SetWindowTextInputState(uint32 window_id, mojo.TextInputState state);
diff --git a/components/mus/surfaces/BUILD.gn b/components/mus/surfaces/BUILD.gn
index 65889ca..8f12ed5 100644
--- a/components/mus/surfaces/BUILD.gn
+++ b/components/mus/surfaces/BUILD.gn
@@ -31,6 +31,7 @@
     "//mojo/application/public/cpp",
     "//mojo/converters/geometry",
     "//mojo/converters/surfaces",
+    "//mojo/services/tracing/public/cpp",
     "//ui/gfx",
     "//ui/gl",
     "//ui/mojo/geometry:interfaces",
diff --git a/components/mus/ws/BUILD.gn b/components/mus/ws/BUILD.gn
index 6556d88..e7f9223 100644
--- a/components/mus/ws/BUILD.gn
+++ b/components/mus/ws/BUILD.gn
@@ -74,6 +74,7 @@
     "//mojo/converters/input_events",
     "//mojo/converters/surfaces",
     "//mojo/public/cpp/bindings:callback",
+    "//mojo/services/tracing/public/cpp",
     "//ui/events",
     "//ui/events/platform",
     "//ui/gfx",
diff --git a/components/mus/ws/focus_controller.cc b/components/mus/ws/focus_controller.cc
index a0d0646..cef209c 100644
--- a/components/mus/ws/focus_controller.cc
+++ b/components/mus/ws/focus_controller.cc
@@ -28,12 +28,38 @@
   return drawn_tracker_ ? drawn_tracker_->window() : nullptr;
 }
 
+bool FocusController::CanBeFocused(ServerWindow* window) const {
+  // All ancestors of |window| must be drawn, and be focusable.
+  for (ServerWindow* w = window; w; w = w->parent()) {
+    if (!w->IsDrawn())
+      return false;
+    if (!w->can_focus())
+      return false;
+  }
+
+  // |window| must be a descendent of an activatable window.
+  for (ServerWindow* w = window; w; w = w->parent()) {
+    if (CanBeActivated(w))
+      return true;
+  }
+
+  return false;
+}
+
+bool FocusController::CanBeActivated(ServerWindow* window) const {
+  // TODO(sad): Implement this.
+  return true;
+}
+
 void FocusController::SetFocusedWindowImpl(ServerWindow* window,
                                            ChangeSource change_source) {
+  if (window && !CanBeFocused(window))
+    return;
   ServerWindow* old = GetFocusedWindow();
 
   DCHECK(!window || window->IsDrawn());
 
+  // TODO(sad): Activate the closest activatable ancestor window.
   if (window)
     drawn_tracker_.reset(new ServerWindowDrawnTracker(window, this));
   else
diff --git a/components/mus/ws/focus_controller.h b/components/mus/ws/focus_controller.h
index 485b8ba7..d63f565 100644
--- a/components/mus/ws/focus_controller.h
+++ b/components/mus/ws/focus_controller.h
@@ -28,6 +28,9 @@
   void SetFocusedWindow(ServerWindow* window);
   ServerWindow* GetFocusedWindow();
 
+  // Moves activation to the next activatable window.
+  void CycleActivationForward();
+
  private:
   // Describes the source of the change.
   enum ChangeSource {
@@ -35,6 +38,10 @@
     CHANGE_SOURCE_DRAWN_STATE_CHANGED,
   };
 
+  // Returns whether |window| can be focused or activated.
+  bool CanBeFocused(ServerWindow* window) const;
+  bool CanBeActivated(ServerWindow* window) const;
+
   // Implementation of SetFocusedWindow().
   void SetFocusedWindowImpl(ServerWindow* window, ChangeSource change_source);
 
diff --git a/components/mus/ws/ids.h b/components/mus/ws/ids.h
index 3c814d0..8ae41c9ce 100644
--- a/components/mus/ws/ids.h
+++ b/components/mus/ws/ids.h
@@ -5,6 +5,8 @@
 #ifndef COMPONENTS_MUS_WS_IDS_H_
 #define COMPONENTS_MUS_WS_IDS_H_
 
+#include <tuple>
+
 #include "components/mus/common/types.h"
 #include "components/mus/common/util.h"
 
@@ -29,10 +31,8 @@
   bool operator!=(const WindowId& other) const { return !(*this == other); }
 
   bool operator<(const WindowId& other) const {
-    if (connection_id == other.connection_id)
-      return window_id < other.window_id;
-
-    return connection_id < other.connection_id;
+    return std::tie(connection_id, window_id) <
+           std::tie(other.connection_id, other.window_id);
   }
 
   ConnectionSpecificId connection_id;
diff --git a/components/mus/ws/server_window.cc b/components/mus/ws/server_window.cc
index c33e4cbf..2e40f6f 100644
--- a/components/mus/ws/server_window.cc
+++ b/components/mus/ws/server_window.cc
@@ -25,6 +25,7 @@
       transient_parent_(nullptr),
       visible_(false),
       opacity_(1),
+      can_focus_(true),
       // Don't notify newly added observers during notification. This causes
       // problems for code that adds an observer as part of an observer
       // notification (such as ServerWindowDrawTracker).
diff --git a/components/mus/ws/server_window.h b/components/mus/ws/server_window.h
index 20ae2f8..d12bdfd7 100644
--- a/components/mus/ws/server_window.h
+++ b/components/mus/ws/server_window.h
@@ -119,6 +119,9 @@
     return text_input_state_;
   }
 
+  void set_can_focus(bool can_focus) { can_focus_ = can_focus; }
+  bool can_focus() const { return can_focus_; }
+
   // Returns true if this window is attached to a root and all ancestors are
   // visible.
   bool IsDrawn() const;
@@ -170,6 +173,7 @@
   gfx::Insets client_area_;
   scoped_ptr<ServerWindowSurfaceManager> surface_manager_;
   float opacity_;
+  bool can_focus_;
   gfx::Transform transform_;
   ui::TextInputState text_input_state_;
 
diff --git a/components/mus/ws/server_window_drawn_tracker_observer.h b/components/mus/ws/server_window_drawn_tracker_observer.h
index 09206d22..d12c32b 100644
--- a/components/mus/ws/server_window_drawn_tracker_observer.h
+++ b/components/mus/ws/server_window_drawn_tracker_observer.h
@@ -16,8 +16,7 @@
   // Invoked when the drawn state changes. If |is_drawn| is false |ancestor|
   // identifies where the change occurred. In the case of a remove |ancestor| is
   // the parent of the window that was removed. In the case of a visibility
-  // change
-  // |ancestor| is the parent of the window whose visibility changed.
+  // change |ancestor| is the parent of the window whose visibility changed.
   virtual void OnDrawnStateChanged(ServerWindow* ancestor,
                                    ServerWindow* window,
                                    bool is_drawn) {}
diff --git a/components/mus/ws/window_tree_impl.cc b/components/mus/ws/window_tree_impl.cc
index d63a1b52..df89c97 100644
--- a/components/mus/ws/window_tree_impl.cc
+++ b/components/mus/ws/window_tree_impl.cc
@@ -819,6 +819,12 @@
   }
 }
 
+void WindowTreeImpl::SetCanFocus(uint32_t window_id, bool can_focus) {
+  ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id));
+  if (window && ShouldRouteToWindowManager(window))
+    window->set_can_focus(can_focus);
+}
+
 void WindowTreeImpl::SetPreferredSize(
     uint32_t window_id,
     mojo::SizePtr size,
diff --git a/components/mus/ws/window_tree_impl.h b/components/mus/ws/window_tree_impl.h
index 4d2a9ca..56f93ab2 100644
--- a/components/mus/ws/window_tree_impl.h
+++ b/components/mus/ws/window_tree_impl.h
@@ -231,6 +231,7 @@
              uint32_t policy_bitmask,
              const EmbedCallback& callback) override;
   void SetFocus(uint32_t window_id) override;
+  void SetCanFocus(uint32_t window_id, bool can_focus) override;
   void SetWindowTextInputState(uint32_t window_id,
                                mojo::TextInputStatePtr state) override;
   void SetImeVisibility(Id transport_window_id,
diff --git a/components/navigation_interception/intercept_navigation_delegate.cc b/components/navigation_interception/intercept_navigation_delegate.cc
index 93c4d442..c24ccecb 100644
--- a/components/navigation_interception/intercept_navigation_delegate.cc
+++ b/components/navigation_interception/intercept_navigation_delegate.cc
@@ -89,7 +89,7 @@
     content::NavigationHandle* handle) {
   return scoped_ptr<content::NavigationThrottle>(
       new InterceptNavigationThrottle(
-          handle, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread)));
+          handle, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread), false));
 }
 
 // static
diff --git a/components/navigation_interception/intercept_navigation_throttle.cc b/components/navigation_interception/intercept_navigation_throttle.cc
index ded208d61..a58bce9 100644
--- a/components/navigation_interception/intercept_navigation_throttle.cc
+++ b/components/navigation_interception/intercept_navigation_throttle.cc
@@ -8,13 +8,41 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_handle.h"
 
+using content::BrowserThread;
+
 namespace navigation_interception {
 
+namespace {
+
+using ChecksPerformedCallback = base::Callback<void(bool)>;
+
+// This is used to run |should_ignore_callback| if it can destroy the
+// WebContents (and the InterceptNavigationThrottle along). In that case,
+// |on_checks_performed_callback| will be a no-op.
+void RunCallback(
+    content::WebContents* web_contents,
+    const NavigationParams& navigation_params,
+    InterceptNavigationThrottle::CheckCallback should_ignore_callback,
+    ChecksPerformedCallback on_checks_performed_callback) {
+  bool should_ignore_navigation =
+      should_ignore_callback.Run(web_contents, navigation_params);
+
+  // If the InterceptNavigationThrottle that called RunCallback is still alive
+  // after |should_ignore_callback| has run, this will run
+  // InterceptNavigationThrottle::OnAsynchronousChecksPerformed.
+  on_checks_performed_callback.Run(should_ignore_navigation);
+}
+
+}  // namespace
+
 InterceptNavigationThrottle::InterceptNavigationThrottle(
     content::NavigationHandle* navigation_handle,
-    CheckCallback should_ignore_callback)
+    CheckCallback should_ignore_callback,
+    bool run_callback_synchronously)
     : content::NavigationThrottle(navigation_handle),
-      should_ignore_callback_(should_ignore_callback) {}
+      should_ignore_callback_(should_ignore_callback),
+      run_callback_synchronously_(run_callback_synchronously),
+      weak_factory_(this) {}
 
 InterceptNavigationThrottle::~InterceptNavigationThrottle() {}
 
@@ -40,11 +68,56 @@
       navigation_handle()->IsExternalProtocol(),
       navigation_handle()->IsInMainFrame());
 
-  bool should_ignore_navigation = should_ignore_callback_.Run(
-      navigation_handle()->GetWebContents(), navigation_params);
-  return should_ignore_navigation
-             ? content::NavigationThrottle::CANCEL_AND_IGNORE
-             : content::NavigationThrottle::PROCEED;
+  if (run_callback_synchronously_) {
+    bool should_ignore_navigation = should_ignore_callback_.Run(
+        navigation_handle()->GetWebContents(), navigation_params);
+    return should_ignore_navigation
+               ? content::NavigationThrottle::CANCEL_AND_IGNORE
+               : content::NavigationThrottle::PROCEED;
+  }
+
+  // When the callback can potentially destroy the WebContents, along with the
+  // NavigationHandle and this InterceptNavigationThrottle, it should be run
+  // asynchronously. This will ensure that no objects on the stack can be
+  // deleted, and that the stack does not unwind through them in a deleted
+  // state.
+  BrowserThread::PostTask(
+      BrowserThread::UI, FROM_HERE,
+      base::Bind(&InterceptNavigationThrottle::RunCallbackAsynchronously,
+                 weak_factory_.GetWeakPtr(), navigation_params));
+  return DEFER;
+}
+
+void InterceptNavigationThrottle::RunCallbackAsynchronously(
+    const NavigationParams& navigation_params) {
+  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+  // Run the callback in a helper function as it may lead ot the destruction of
+  // this InterceptNavigationThrottle.
+  RunCallback(
+      navigation_handle()->GetWebContents(), navigation_params,
+      should_ignore_callback_,
+      base::Bind(&InterceptNavigationThrottle::OnAsynchronousChecksPerformed,
+                 weak_factory_.GetWeakPtr()));
+
+  // DO NOT ADD CODE AFTER HERE: at this point the InterceptNavigationThrottle
+  // may have been destroyed by the |should_ignore_callback_|. Adding code here
+  // will cause use-after-free bugs.
+  //
+  // Code that needs to act on the result of the |should_ignore_callback_|
+  // should be put inside OnAsynchronousChecksPerformed. This function will be
+  // called after |should_ignore_callback_| has run, if this
+  // InterceptNavigationThrottle is still alive.
+}
+
+void InterceptNavigationThrottle::OnAsynchronousChecksPerformed(
+    bool should_ignore_navigation) {
+  if (should_ignore_navigation) {
+    navigation_handle()->CancelDeferredNavigation(
+        content::NavigationThrottle::CANCEL_AND_IGNORE);
+  } else {
+    navigation_handle()->Resume();
+  }
 }
 
 }  // namespace navigation_interception
diff --git a/components/navigation_interception/intercept_navigation_throttle.h b/components/navigation_interception/intercept_navigation_throttle.h
index 0b7f7460..7ce2963 100644
--- a/components/navigation_interception/intercept_navigation_throttle.h
+++ b/components/navigation_interception/intercept_navigation_throttle.h
@@ -31,7 +31,8 @@
       CheckCallback;
 
   InterceptNavigationThrottle(content::NavigationHandle* navigation_handle,
-                              CheckCallback should_ignore_callback);
+                              CheckCallback should_ignore_callback,
+                              bool run_callback_synchronously);
   ~InterceptNavigationThrottle() override;
 
   // content::NavigationThrottle implementation:
@@ -41,8 +42,19 @@
  private:
   ThrottleCheckResult CheckIfShouldIgnoreNavigation(bool is_redirect);
 
+  // Called to perform the checks asynchronously
+  void RunCallbackAsynchronously(const NavigationParams& navigation_params);
+  void OnAsynchronousChecksPerformed(bool should_ignore_navigation);
+
   CheckCallback should_ignore_callback_;
 
+  // Whether the callback will be run synchronously or not. If the callback can
+  // lead to the destruction of the WebContents, this should be false.
+  // Otherwise this should be true.
+  const bool run_callback_synchronously_;
+
+  base::WeakPtrFactory<InterceptNavigationThrottle> weak_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(InterceptNavigationThrottle);
 };
 
diff --git a/components/navigation_interception/intercept_navigation_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
index 7c95a53..8c15876c 100644
--- a/components/navigation_interception/intercept_navigation_throttle_unittest.cc
+++ b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
@@ -67,7 +67,8 @@
                 test_handle.get(),
                 base::Bind(
                     &MockInterceptCallbackReceiver::ShouldIgnoreNavigation,
-                    base::Unretained(mock_callback_receiver_.get()))))
+                    base::Unretained(mock_callback_receiver_.get())),
+                true))
             .Pass());
     return test_handle->CallWillStartRequestForTesting(
         is_post, content::Referrer(), false, ui::PAGE_TRANSITION_LINK, false);
@@ -83,7 +84,8 @@
                 test_handle.get(),
                 base::Bind(
                     &MockInterceptCallbackReceiver::ShouldIgnoreNavigation,
-                    base::Unretained(mock_callback_receiver_.get()))))
+                    base::Unretained(mock_callback_receiver_.get())),
+                true))
             .Pass());
     test_handle->CallWillStartRequestForTesting(
         true, content::Referrer(), false, ui::PAGE_TRANSITION_LINK, false);
diff --git a/components/password_manager.gypi b/components/password_manager.gypi
index 15bcbf9..2497805 100644
--- a/components/password_manager.gypi
+++ b/components/password_manager.gypi
@@ -63,6 +63,8 @@
         'password_manager/core/browser/import/csv_reader.cc',
         'password_manager/core/browser/import/csv_reader.h',
         'password_manager/core/browser/keychain_migration_status_mac.h',
+        'password_manager/core/browser/log_manager.cc',
+        'password_manager/core/browser/log_manager.h',
         'password_manager/core/browser/log_receiver.h',
         'password_manager/core/browser/log_router.cc',
         'password_manager/core/browser/log_router.h',
@@ -168,7 +170,6 @@
         '..',
       ],
       'sources': [
-        # Note: sources list duplicated in GN build.
         'password_manager/core/browser/fake_affiliation_api.cc',
         'password_manager/core/browser/fake_affiliation_api.h',
         'password_manager/core/browser/fake_affiliation_fetcher.cc',
@@ -179,6 +180,9 @@
         'password_manager/core/browser/mock_password_store.h',
         'password_manager/core/browser/password_manager_test_utils.cc',
         'password_manager/core/browser/password_manager_test_utils.h',
+        # Note: sources list duplicated in GN build.
+        'password_manager/core/browser/stub_log_manager.cc',
+        'password_manager/core/browser/stub_log_manager.h',
         'password_manager/core/browser/stub_password_manager_client.cc',
         'password_manager/core/browser/stub_password_manager_client.h',
         'password_manager/core/browser/stub_password_manager_driver.cc',
diff --git a/components/password_manager/content/browser/BUILD.gn b/components/password_manager/content/browser/BUILD.gn
index 75d5f81..f8811d3 100644
--- a/components/password_manager/content/browser/BUILD.gn
+++ b/components/password_manager/content/browser/BUILD.gn
@@ -34,6 +34,7 @@
 source_set("unit_tests") {
   testonly = true
   sources = [
+    "content_password_manager_driver_unittest.cc",
     "credential_manager_dispatcher_unittest.cc",
   ]
   deps = [
diff --git a/components/password_manager/content/browser/DEPS b/components/password_manager/content/browser/DEPS
index 7f4d25a..8dac82f 100644
--- a/components/password_manager/content/browser/DEPS
+++ b/components/password_manager/content/browser/DEPS
@@ -1,4 +1,5 @@
 include_rules = [
+  "+components/autofill/core/browser",
   "+components/autofill/content/browser",
   "+components/keyed_service/content",
   "+content/public/browser",
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc
index 83239f4..533d7f4 100644
--- a/components/password_manager/content/browser/content_password_manager_driver.cc
+++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -9,6 +9,8 @@
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/content/browser/bad_message.h"
 #include "components/password_manager/content/browser/content_password_manager_driver_factory.h"
+#include "components/password_manager/core/browser/log_manager.h"
+#include "components/password_manager/core/browser/password_manager.h"
 #include "components/password_manager/core/browser/password_manager_client.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/child_process_security_policy.h"
@@ -33,8 +35,7 @@
       client_(client),
       password_generation_manager_(client, this),
       password_autofill_manager_(this, autofill_client),
-      next_free_key_(0) {
-}
+      next_free_key_(0) {}
 
 ContentPasswordManagerDriver::~ContentPasswordManagerDriver() {
 }
@@ -114,6 +115,12 @@
   host->Send(new AutofillMsg_FindFocusedPasswordForm(host->GetRoutingID()));
 }
 
+void ContentPasswordManagerDriver::SendLoggingAvailability() {
+  render_frame_host_->Send(new AutofillMsg_SetLoggingState(
+      render_frame_host_->GetRoutingID(),
+      client_->GetLogManager()->IsLoggingActive()));
+}
+
 PasswordGenerationManager*
 ContentPasswordManagerDriver::GetPasswordGenerationManager() {
   return &password_generation_manager_;
@@ -145,8 +152,11 @@
   IPC_MESSAGE_FORWARD(AutofillHostMsg_ShowPasswordSuggestions,
                       &password_autofill_manager_,
                       PasswordAutofillManager::OnShowPasswordSuggestions)
-  IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress, client_,
-                      PasswordManagerClient::LogSavePasswordProgress)
+  IPC_MESSAGE_FORWARD(AutofillHostMsg_RecordSavePasswordProgress,
+                      client_->GetLogManager(),
+                      LogManager::LogSavePasswordProgress)
+  IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed,
+                      SendLoggingAvailability)
   IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;
diff --git a/components/password_manager/content/browser/content_password_manager_driver.h b/components/password_manager/content/browser/content_password_manager_driver.h
index 504a913..42618e98 100644
--- a/components/password_manager/content/browser/content_password_manager_driver.h
+++ b/components/password_manager/content/browser/content_password_manager_driver.h
@@ -66,6 +66,7 @@
                          const base::string16& password) override;
   void ClearPreviewedForm() override;
   void ForceSavePassword() override;
+  void SendLoggingAvailability() override;
 
   PasswordGenerationManager* GetPasswordGenerationManager() override;
   PasswordManager* GetPasswordManager() override;
diff --git a/components/password_manager/content/browser/content_password_manager_driver_factory.cc b/components/password_manager/content/browser/content_password_manager_driver_factory.cc
index 222c743b..6b448f4 100644
--- a/components/password_manager/content/browser/content_password_manager_driver_factory.cc
+++ b/components/password_manager/content/browser/content_password_manager_driver_factory.cc
@@ -4,6 +4,8 @@
 
 #include "components/password_manager/content/browser/content_password_manager_driver_factory.h"
 
+#include <utility>
+
 #include "base/stl_util.h"
 #include "components/autofill/content/browser/content_autofill_driver.h"
 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
@@ -52,8 +54,11 @@
       password_client_(password_client),
       autofill_client_(autofill_client) {
   content::RenderFrameHost* main_frame = web_contents->GetMainFrame();
-  if (main_frame->IsRenderFrameLive())
-    CreateDriverForFrame(main_frame);
+  if (main_frame->IsRenderFrameLive()) {
+    frame_driver_map_[main_frame] =
+        make_scoped_ptr(new ContentPasswordManagerDriver(
+            main_frame, password_client_, autofill_client_));
+  }
 }
 
 ContentPasswordManagerDriverFactory::~ContentPasswordManagerDriverFactory() {}
@@ -71,14 +76,20 @@
 ContentPasswordManagerDriverFactory::GetDriverForFrame(
     content::RenderFrameHost* render_frame_host) {
   auto mapping = frame_driver_map_.find(render_frame_host);
-  return mapping == frame_driver_map_.end() ? nullptr : mapping->second;
+  return mapping == frame_driver_map_.end() ? nullptr : mapping->second.get();
 }
 
 void ContentPasswordManagerDriverFactory::RenderFrameCreated(
     content::RenderFrameHost* render_frame_host) {
+  auto insertion_result =
+      frame_driver_map_.insert(std::make_pair(render_frame_host, nullptr));
   // This is called twice for the main frame.
-  if (!ContainsKey(frame_driver_map_, render_frame_host))
-    CreateDriverForFrame(render_frame_host);
+  if (insertion_result.second) {  // This was the first time.
+    insertion_result.first->second =
+        make_scoped_ptr(new ContentPasswordManagerDriver(
+            render_frame_host, password_client_, autofill_client_));
+    insertion_result.first->second->SendLoggingAvailability();
+  }
 }
 
 void ContentPasswordManagerDriverFactory::RenderFrameDeleted(
@@ -101,19 +112,16 @@
       ->second->DidNavigateFrame(details, params);
 }
 
-void ContentPasswordManagerDriverFactory::CreateDriverForFrame(
-    content::RenderFrameHost* render_frame_host) {
-  DCHECK(!ContainsKey(frame_driver_map_, render_frame_host));
-  frame_driver_map_.set(
-      render_frame_host,
-      make_scoped_ptr(new ContentPasswordManagerDriver(
-          render_frame_host, password_client_, autofill_client_)));
-}
-
 void ContentPasswordManagerDriverFactory::TestingSetDriverForFrame(
     content::RenderFrameHost* render_frame_host,
     scoped_ptr<ContentPasswordManagerDriver> driver) {
-  frame_driver_map_.set(render_frame_host, driver.Pass());
+  frame_driver_map_[render_frame_host] = driver.Pass();
+}
+
+void ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability() {
+  for (const auto& key_val_iterator : frame_driver_map_) {
+    key_val_iterator.second->SendLoggingAvailability();
+  }
 }
 
 }  // namespace password_manager
diff --git a/components/password_manager/content/browser/content_password_manager_driver_factory.h b/components/password_manager/content/browser/content_password_manager_driver_factory.h
index b2a5daa..d36f53ce0 100644
--- a/components/password_manager/content/browser/content_password_manager_driver_factory.h
+++ b/components/password_manager/content/browser/content_password_manager_driver_factory.h
@@ -5,9 +5,11 @@
 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRIVER_FACTORY_H_
 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_PASSWORD_MANAGER_DRIVER_FACTORY_H_
 
+#include <map>
+
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
-#include "base/containers/scoped_ptr_map.h"
+#include "base/memory/scoped_ptr.h"
 #include "base/supports_user_data.h"
 #include "components/password_manager/core/browser/password_autofill_manager.h"
 #include "components/password_manager/core/browser/password_generation_manager.h"
@@ -49,6 +51,10 @@
       content::RenderFrameHost* render_frame_host,
       scoped_ptr<ContentPasswordManagerDriver> driver);
 
+  // Requests all drivers to inform their renderers whether
+  // chrome://password-manager-internals is available.
+  void RequestSendLoggingAvailability();
+
   // content::WebContentsObserver:
   bool OnMessageReceived(const IPC::Message& message,
                          content::RenderFrameHost* render_frame_host) override;
@@ -64,10 +70,7 @@
       PasswordManagerClient* client,
       autofill::AutofillClient* autofill_client);
 
-  void CreateDriverForFrame(content::RenderFrameHost* render_frame_host);
-
-  base::ScopedPtrMap<content::RenderFrameHost*,
-                     scoped_ptr<ContentPasswordManagerDriver>>
+  std::map<content::RenderFrameHost*, scoped_ptr<ContentPasswordManagerDriver>>
       frame_driver_map_;
 
   PasswordManagerClient* password_client_;
diff --git a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
new file mode 100644
index 0000000..ed03eb7
--- /dev/null
+++ b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
@@ -0,0 +1,115 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/content/browser/content_password_manager_driver.h"
+
+#include "components/autofill/content/common/autofill_messages.h"
+#include "components/autofill/core/browser/test_autofill_client.h"
+#include "components/password_manager/core/browser/stub_log_manager.h"
+#include "components/password_manager/core/browser/stub_password_manager_client.h"
+#include "content/public/test/mock_render_process_host.h"
+#include "content/public/test/test_renderer_host.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::Return;
+
+namespace password_manager {
+
+namespace {
+
+class MockLogManager : public StubLogManager {
+ public:
+  MOCK_CONST_METHOD0(IsLoggingActive, bool(void));
+};
+
+class MockPasswordManagerClient : public StubPasswordManagerClient {
+ public:
+  MockPasswordManagerClient() = default;
+  ~MockPasswordManagerClient() override = default;
+
+  MOCK_CONST_METHOD0(GetLogManager, const LogManager*());
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockPasswordManagerClient);
+};
+
+}  // namespace
+
+class ContentPasswordManagerDriverTest
+    : public content::RenderViewHostTestHarness,
+      public testing::WithParamInterface<bool> {
+ public:
+  void SetUp() override {
+    content::RenderViewHostTestHarness::SetUp();
+    ON_CALL(password_manager_client_, GetLogManager())
+        .WillByDefault(Return(&log_manager_));
+  }
+
+  bool WasLoggingActivationMessageSent(bool* activation_flag) {
+    const uint32 kMsgID = AutofillMsg_SetLoggingState::ID;
+    const IPC::Message* message =
+        process()->sink().GetFirstMessageMatching(kMsgID);
+    if (!message)
+      return false;
+    base::Tuple<bool> param;
+    AutofillMsg_SetLoggingState::Read(message, &param);
+    *activation_flag = base::get<0>(param);
+    process()->sink().ClearMessages();
+    return true;
+  }
+
+ protected:
+  MockLogManager log_manager_;
+  MockPasswordManagerClient password_manager_client_;
+  autofill::TestAutofillClient autofill_client_;
+};
+
+TEST_P(ContentPasswordManagerDriverTest,
+       AnswerToNotificationsAboutLoggingState) {
+  const bool should_allow_logging = GetParam();
+  scoped_ptr<ContentPasswordManagerDriver> driver(
+      new ContentPasswordManagerDriver(main_rfh(), &password_manager_client_,
+                                       &autofill_client_));
+  process()->sink().ClearMessages();
+
+  EXPECT_CALL(log_manager_, IsLoggingActive())
+      .WillRepeatedly(Return(should_allow_logging));
+  driver->SendLoggingAvailability();
+  if (should_allow_logging) {
+    bool logging_activated = false;
+    EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_activated));
+    EXPECT_TRUE(logging_activated);
+  } else {
+    bool logging_activated = true;
+    EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_activated));
+    EXPECT_FALSE(logging_activated);
+  }
+}
+
+TEST_P(ContentPasswordManagerDriverTest, AnswerToIPCPingsAboutLoggingState) {
+  const bool should_allow_logging = GetParam();
+  scoped_ptr<ContentPasswordManagerDriver> driver(
+      new ContentPasswordManagerDriver(main_rfh(), &password_manager_client_,
+                                       &autofill_client_));
+
+  EXPECT_CALL(log_manager_, IsLoggingActive())
+      .WillRepeatedly(Return(should_allow_logging));
+  driver->SendLoggingAvailability();
+  process()->sink().ClearMessages();
+
+  // Ping the driver for logging activity update.
+  AutofillHostMsg_PasswordAutofillAgentConstructed msg(0);
+  driver->HandleMessage(msg);
+
+  bool logging_activated = false;
+  EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_activated));
+  EXPECT_EQ(should_allow_logging, logging_activated);
+}
+
+INSTANTIATE_TEST_CASE_P(,
+                        ContentPasswordManagerDriverTest,
+                        testing::Values(true, false));
+
+}  // namespace password_manager
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
index 00111fb1..d9c3b98 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
@@ -18,7 +18,6 @@
 #include "components/password_manager/content/common/credential_manager_messages.h"
 #include "components/password_manager/core/browser/credential_manager_password_form_manager.h"
 #include "components/password_manager/core/browser/mock_affiliated_match_helper.h"
-#include "components/password_manager/core/browser/password_manager.h"
 #include "components/password_manager/core/browser/stub_password_manager_client.h"
 #include "components/password_manager/core/browser/stub_password_manager_driver.h"
 #include "components/password_manager/core/browser/test_password_store.h"
@@ -140,11 +139,6 @@
   return driver_;
 }
 
-class MockPasswordManagerDriver : public StubPasswordManagerDriver {
- public:
-  MOCK_METHOD0(GetPasswordManager, PasswordManager*());
-};
-
 void RunAllPendingTasks() {
   base::RunLoop run_loop;
   base::MessageLoop::current()->PostTask(
@@ -163,11 +157,8 @@
     content::RenderViewHostTestHarness::SetUp();
     store_ = new TestPasswordStore;
     client_.reset(new MockPasswordManagerClient(store_.get()));
-    password_manager_.reset(new PasswordManager(client_.get()));
-    ON_CALL(mock_driver_, GetPasswordManager())
-        .WillByDefault(testing::Return(password_manager_.get()));
     dispatcher_.reset(new TestCredentialManagerDispatcher(
-        web_contents(), client_.get(), &mock_driver_));
+        web_contents(), client_.get(), &stub_driver_));
     ON_CALL(*client_, IsSavingAndFillingEnabledForCurrentPage())
         .WillByDefault(testing::Return(true));
     ON_CALL(*client_, IsOffTheRecord()).WillByDefault(testing::Return(false));
@@ -276,9 +267,8 @@
   autofill::PasswordForm cross_origin_form_;
   scoped_refptr<TestPasswordStore> store_;
   scoped_ptr<MockPasswordManagerClient> client_;
-  MockPasswordManagerDriver mock_driver_;
+  StubPasswordManagerDriver stub_driver_;
   scoped_ptr<CredentialManagerDispatcher> dispatcher_;
-  scoped_ptr<PasswordManager> password_manager_;
 };
 
 TEST_F(CredentialManagerDispatcherTest, CredentialManagerOnStore) {
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn
index 35207d2..0368bc4 100644
--- a/components/password_manager/core/browser/BUILD.gn
+++ b/components/password_manager/core/browser/BUILD.gn
@@ -43,6 +43,8 @@
     "import/csv_reader.cc",
     "import/csv_reader.h",
     "keychain_migration_status_mac.h",
+    "log_manager.cc",
+    "log_manager.h",
     "log_receiver.h",
     "log_router.cc",
     "log_router.h",
@@ -151,6 +153,8 @@
     "mock_password_store.h",
     "password_manager_test_utils.cc",
     "password_manager_test_utils.h",
+    "stub_log_manager.cc",
+    "stub_log_manager.h",
     "stub_password_manager_client.cc",
     "stub_password_manager_client.h",
     "stub_password_manager_driver.cc",
@@ -184,6 +188,7 @@
     "export/csv_writer_unittest.cc",
     "facet_manager_unittest.cc",
     "import/csv_reader_unittest.cc",
+    "log_manager_unittest.cc",
     "log_router_unittest.cc",
     "login_database_unittest.cc",
     "login_model_unittest.cc",
diff --git a/components/password_manager/core/browser/browser_save_password_progress_logger.cc b/components/password_manager/core/browser/browser_save_password_progress_logger.cc
index f93ff50..dc5eda6 100644
--- a/components/password_manager/core/browser/browser_save_password_progress_logger.cc
+++ b/components/password_manager/core/browser/browser_save_password_progress_logger.cc
@@ -8,7 +8,8 @@
 #include "base/values.h"
 #include "components/autofill/core/browser/form_structure.h"
 #include "components/autofill/core/common/password_form.h"
-#include "components/password_manager/core/browser/password_manager_client.h"
+#include "components/password_manager/core/browser/log_manager.h"
+#include "components/password_manager/core/browser/password_manager.h"
 
 namespace password_manager {
 
@@ -24,9 +25,9 @@
 }  // namespace
 
 BrowserSavePasswordProgressLogger::BrowserSavePasswordProgressLogger(
-    const PasswordManagerClient* client)
-    : client_(client) {
-  DCHECK(client_);
+    const LogManager* log_manager)
+    : log_manager_(log_manager) {
+  DCHECK(log_manager_);
 }
 
 void BrowserSavePasswordProgressLogger::LogFormSignatures(
@@ -47,7 +48,7 @@
 }
 
 void BrowserSavePasswordProgressLogger::SendLog(const std::string& log) {
-  client_->LogSavePasswordProgress(log);
+  log_manager_->LogSavePasswordProgress(log);
 }
 
 }  // namespace password_manager
diff --git a/components/password_manager/core/browser/browser_save_password_progress_logger.h b/components/password_manager/core/browser/browser_save_password_progress_logger.h
index 7b89ca3..cba6c88b 100644
--- a/components/password_manager/core/browser/browser_save_password_progress_logger.h
+++ b/components/password_manager/core/browser/browser_save_password_progress_logger.h
@@ -11,15 +11,14 @@
 
 namespace password_manager {
 
-class PasswordManagerClient;
+class LogManager;
 
 // This is the SavePasswordProgressLogger specialization for the browser code,
-// where the PasswordManagerClient can be directly called.
+// where the LogManager can be directly called.
 class BrowserSavePasswordProgressLogger
     : public autofill::SavePasswordProgressLogger {
  public:
-  explicit BrowserSavePasswordProgressLogger(
-      const PasswordManagerClient* client);
+  explicit BrowserSavePasswordProgressLogger(const LogManager* log_manager);
   ~BrowserSavePasswordProgressLogger() override;
 
   // Browser-specific addition to the base class' Log* methods. The input is
@@ -31,9 +30,9 @@
   void SendLog(const std::string& log) override;
 
  private:
-  // The PasswordManagerClient to which logs can be sent for display. The client
-  // must outlive this logger.
-  const PasswordManagerClient* const client_;
+  // The LogManager to which logs can be sent for display. The log_manager must
+  // outlive this logger.
+  const LogManager* const log_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserSavePasswordProgressLogger);
 };
diff --git a/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc b/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc
index 1e73070a9..f832fb5 100644
--- a/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc
+++ b/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc
@@ -4,7 +4,7 @@
 
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
 
-#include "components/password_manager/core/browser/stub_password_manager_client.h"
+#include "components/password_manager/core/browser/stub_log_manager.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -17,13 +17,13 @@
 // The only purpose of TestLogger is to expose SendLog for the test.
 class TestLogger : public BrowserSavePasswordProgressLogger {
  public:
-  explicit TestLogger(PasswordManagerClient* client)
-      : BrowserSavePasswordProgressLogger(client) {}
+  explicit TestLogger(LogManager* log_manager)
+      : BrowserSavePasswordProgressLogger(log_manager) {}
 
   using BrowserSavePasswordProgressLogger::SendLog;
 };
 
-class MockPasswordManagerClient : public StubPasswordManagerClient {
+class MockLogManager : public StubLogManager {
  public:
   MOCK_CONST_METHOD1(LogSavePasswordProgress, void(const std::string& text));
 };
@@ -31,9 +31,9 @@
 }  // namespace
 
 TEST(BrowserSavePasswordProgressLoggerTest, SendLog) {
-  MockPasswordManagerClient client;
-  TestLogger logger(&client);
-  EXPECT_CALL(client, LogSavePasswordProgress(kTestText)).Times(1);
+  MockLogManager log_manager;
+  TestLogger logger(&log_manager);
+  EXPECT_CALL(log_manager, LogSavePasswordProgress(kTestText));
   logger.SendLog(kTestText);
 }
 
diff --git a/components/password_manager/core/browser/log_manager.cc b/components/password_manager/core/browser/log_manager.cc
new file mode 100644
index 0000000..8f78eee4
--- /dev/null
+++ b/components/password_manager/core/browser/log_manager.cc
@@ -0,0 +1,94 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/log_manager.h"
+
+#include "base/macros.h"
+#include "components/password_manager/core/browser/log_router.h"
+
+namespace password_manager {
+
+namespace {
+
+class LogManagerImpl : public LogManager {
+ public:
+  LogManagerImpl(LogRouter* log_router, base::Closure notification_callback);
+
+  ~LogManagerImpl() override;
+
+  // LogManager
+  void OnLogRouterAvailabilityChanged(bool router_can_be_used) override;
+  void SetSuspended(bool suspended) override;
+  void LogSavePasswordProgress(const std::string& text) const override;
+  bool IsLoggingActive() const override;
+
+ private:
+  // A LogRouter instance obtained on construction. May be null.
+  LogRouter* const log_router_;
+
+  // True if |this| is registered with some LogRouter which can accept logs.
+  bool can_use_log_router_;
+
+  bool is_suspended_ = false;
+
+  // Called every time the logging activity status changes.
+  base::Closure notification_callback_;
+
+  DISALLOW_COPY_AND_ASSIGN(LogManagerImpl);
+};
+
+LogManagerImpl::LogManagerImpl(LogRouter* log_router,
+                               base::Closure notification_callback)
+    : log_router_(log_router),
+      can_use_log_router_(log_router_ && log_router_->RegisterManager(this)),
+      notification_callback_(notification_callback) {}
+
+LogManagerImpl::~LogManagerImpl() {
+  if (log_router_)
+    log_router_->UnregisterManager(this);
+}
+
+void LogManagerImpl::OnLogRouterAvailabilityChanged(bool router_can_be_used) {
+  DCHECK(log_router_);  // |log_router_| should be calling this method.
+  if (can_use_log_router_ == router_can_be_used)
+    return;
+  can_use_log_router_ = router_can_be_used;
+
+  if (!is_suspended_) {
+    // The availability of the logging changed as a result.
+    if (!notification_callback_.is_null())
+      notification_callback_.Run();
+  }
+}
+
+void LogManagerImpl::SetSuspended(bool suspended) {
+  if (suspended == is_suspended_)
+    return;
+  is_suspended_ = suspended;
+  if (can_use_log_router_) {
+    // The availability of the logging changed as a result.
+    if (!notification_callback_.is_null())
+      notification_callback_.Run();
+  }
+}
+
+void LogManagerImpl::LogSavePasswordProgress(const std::string& text) const {
+  if (!IsLoggingActive())
+    return;
+  log_router_->ProcessLog(text);
+}
+
+bool LogManagerImpl::IsLoggingActive() const {
+  return can_use_log_router_ && !is_suspended_;
+}
+
+}  // namespace
+
+// static
+scoped_ptr<LogManager> LogManager::Create(LogRouter* log_router,
+                                          base::Closure notification_callback) {
+  return make_scoped_ptr(new LogManagerImpl(log_router, notification_callback));
+}
+
+}  // namespace password_manager
diff --git a/components/password_manager/core/browser/log_manager.h b/components/password_manager/core/browser/log_manager.h
new file mode 100644
index 0000000..875f0b8d
--- /dev/null
+++ b/components/password_manager/core/browser/log_manager.h
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_MANAGER_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_MANAGER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace password_manager {
+
+class LogRouter;
+
+// This interface is used by the password management code to receive and display
+// logs about progress of actions like saving a password.
+class LogManager {
+ public:
+  virtual ~LogManager() = default;
+
+  // This method is called by a LogRouter, after the LogManager registers with
+  // one. If |router_can_be_used| is true, logs can be sent to LogRouter after
+  // the return from OnLogRouterAvailabilityChanged and will reach at least one
+  // LogReceiver instance. If |router_can_be_used| is false, no logs should be
+  // sent to the LogRouter.
+  virtual void OnLogRouterAvailabilityChanged(bool router_can_be_used) = 0;
+
+  // The owner of the LogManager can call this to start or end suspending the
+  // logging, by setting |suspended| to true or false, respectively.
+  virtual void SetSuspended(bool suspended) = 0;
+
+  // Forward |text| for display to the LogRouter (if registered with one).
+  virtual void LogSavePasswordProgress(const std::string& text) const = 0;
+
+  // Returns true if logs recorded via LogSavePasswordProgress will be
+  // displayed, and false otherwise.
+  virtual bool IsLoggingActive() const = 0;
+
+  // Returns the production code implementation of LogManager. If |log_router|
+  // is null, the manager will do nothing. |notification_callback| will be
+  // called every time the activity status of logging changes.
+  static scoped_ptr<LogManager> Create(LogRouter* log_router,
+                                       base::Closure notification_callback);
+};
+
+}  // namespace password_manager
+
+#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOG_MANAGER_H_
diff --git a/components/password_manager/core/browser/log_manager_unittest.cc b/components/password_manager/core/browser/log_manager_unittest.cc
new file mode 100644
index 0000000..153da91
--- /dev/null
+++ b/components/password_manager/core/browser/log_manager_unittest.cc
@@ -0,0 +1,164 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/log_manager.h"
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/macros.h"
+#include "components/password_manager/core/browser/log_receiver.h"
+#include "components/password_manager/core/browser/log_router.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::_;
+
+namespace password_manager {
+
+namespace {
+
+const char kTestText[] = "abcd1234";
+
+class MockLogReceiver : public password_manager::LogReceiver {
+ public:
+  MockLogReceiver() = default;
+  MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&));
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockLogReceiver);
+};
+
+class MockNotifiedObject {
+ public:
+  MockNotifiedObject() = default;
+  MOCK_METHOD0(NotifyAboutLoggingActivity, void());
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockNotifiedObject);
+};
+
+}  // namespace
+
+class LogManagerTest : public testing::Test {
+ protected:
+  void SetUp() override {
+    manager_ = LogManager::Create(
+        &router_, base::Bind(&MockNotifiedObject::NotifyAboutLoggingActivity,
+                             base::Unretained(&notified_object_)));
+  }
+
+  void TearDown() override {
+    manager_.reset();  // Destruct before LogRouter.
+  }
+
+ protected:
+  testing::StrictMock<MockLogReceiver> receiver_;
+  LogRouter router_;
+  testing::StrictMock<MockNotifiedObject> notified_object_;
+  scoped_ptr<LogManager> manager_;
+};
+
+TEST_F(LogManagerTest, LogSavePasswordProgressNoReceiver) {
+  EXPECT_CALL(receiver_, LogSavePasswordProgress(_)).Times(0);
+  // Before attaching the receiver, no text should be passed.
+  manager_->LogSavePasswordProgress(kTestText);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+}
+
+TEST_F(LogManagerTest, LogSavePasswordProgressAttachReceiver) {
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  EXPECT_EQ(std::string(), router_.RegisterReceiver(&receiver_));
+  EXPECT_TRUE(manager_->IsLoggingActive());
+  // After attaching the logger, text should be passed.
+  EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText));
+  manager_->LogSavePasswordProgress(kTestText);
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  router_.UnregisterReceiver(&receiver_);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+}
+
+TEST_F(LogManagerTest, LogSavePasswordProgressDetachReceiver) {
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  EXPECT_EQ(std::string(), router_.RegisterReceiver(&receiver_));
+  EXPECT_TRUE(manager_->IsLoggingActive());
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  router_.UnregisterReceiver(&receiver_);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  // After detaching the logger, no text should be passed.
+  EXPECT_CALL(receiver_, LogSavePasswordProgress(_)).Times(0);
+  manager_->LogSavePasswordProgress(kTestText);
+}
+
+TEST_F(LogManagerTest, NullCallbackWillNotCrash) {
+  manager_ = LogManager::Create(&router_, base::Closure());
+  EXPECT_EQ(std::string(), router_.RegisterReceiver(&receiver_));
+  router_.UnregisterReceiver(&receiver_);
+}
+
+TEST_F(LogManagerTest, SetSuspended_WithActiveLogging) {
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  EXPECT_EQ(std::string(), router_.RegisterReceiver(&receiver_));
+  EXPECT_TRUE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  manager_->SetSuspended(true);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  manager_->SetSuspended(false);
+  EXPECT_TRUE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  router_.UnregisterReceiver(&receiver_);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+}
+
+TEST_F(LogManagerTest, SetSuspended_WithInactiveLogging) {
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  manager_->SetSuspended(true);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  manager_->SetSuspended(false);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+}
+
+TEST_F(LogManagerTest, InterleaveSuspendAndLoggingActivation_SuspendFirst) {
+  manager_->SetSuspended(true);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  EXPECT_EQ(std::string(), router_.RegisterReceiver(&receiver_));
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  manager_->SetSuspended(false);
+  EXPECT_TRUE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  router_.UnregisterReceiver(&receiver_);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+}
+
+TEST_F(LogManagerTest, InterleaveSuspendAndLoggingActivation_ActiveFirst) {
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  EXPECT_EQ(std::string(), router_.RegisterReceiver(&receiver_));
+  EXPECT_TRUE(manager_->IsLoggingActive());
+
+  EXPECT_CALL(notified_object_, NotifyAboutLoggingActivity());
+  manager_->SetSuspended(true);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  router_.UnregisterReceiver(&receiver_);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+
+  manager_->SetSuspended(false);
+  EXPECT_FALSE(manager_->IsLoggingActive());
+}
+
+}  // namespace password_manager
diff --git a/components/password_manager/core/browser/log_router.cc b/components/password_manager/core/browser/log_router.cc
index 03141bc..f23c95c 100644
--- a/components/password_manager/core/browser/log_router.cc
+++ b/components/password_manager/core/browser/log_router.cc
@@ -5,16 +5,14 @@
 #include "components/password_manager/core/browser/log_router.h"
 
 #include "base/stl_util.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/log_receiver.h"
-#include "components/password_manager/core/browser/password_manager_client.h"
 
 namespace password_manager {
 
-LogRouter::LogRouter() {
-}
+LogRouter::LogRouter() = default;
 
-LogRouter::~LogRouter() {
-}
+LogRouter::~LogRouter() = default;
 
 void LogRouter::ProcessLog(const std::string& text) {
   // This may not be called when there are no receivers (i.e., the router is
@@ -24,15 +22,15 @@
   FOR_EACH_OBSERVER(LogReceiver, receivers_, LogSavePasswordProgress(text));
 }
 
-bool LogRouter::RegisterClient(PasswordManagerClient* client) {
-  DCHECK(client);
-  clients_.AddObserver(client);
+bool LogRouter::RegisterManager(LogManager* manager) {
+  DCHECK(manager);
+  managers_.AddObserver(manager);
   return receivers_.might_have_observers();
 }
 
-void LogRouter::UnregisterClient(PasswordManagerClient* client) {
-  DCHECK(clients_.HasObserver(client));
-  clients_.RemoveObserver(client);
+void LogRouter::UnregisterManager(LogManager* manager) {
+  DCHECK(managers_.HasObserver(manager));
+  managers_.RemoveObserver(manager);
 }
 
 std::string LogRouter::RegisterReceiver(LogReceiver* receiver) {
@@ -40,8 +38,8 @@
   DCHECK(accumulated_logs_.empty() || receivers_.might_have_observers());
 
   if (!receivers_.might_have_observers()) {
-    FOR_EACH_OBSERVER(
-        PasswordManagerClient, clients_, OnLogRouterAvailabilityChanged(true));
+    FOR_EACH_OBSERVER(LogManager, managers_,
+                      OnLogRouterAvailabilityChanged(true));
   }
   receivers_.AddObserver(receiver);
   return accumulated_logs_;
@@ -51,9 +49,11 @@
   DCHECK(receivers_.HasObserver(receiver));
   receivers_.RemoveObserver(receiver);
   if (!receivers_.might_have_observers()) {
-    accumulated_logs_.clear();
-    FOR_EACH_OBSERVER(
-        PasswordManagerClient, clients_, OnLogRouterAvailabilityChanged(false));
+    // |accumulated_logs_| can become very long; use the swap instead of clear()
+    // to ensure that the memory is freed.
+    std::string().swap(accumulated_logs_);
+    FOR_EACH_OBSERVER(LogManager, managers_,
+                      OnLogRouterAvailabilityChanged(false));
   }
 }
 
diff --git a/components/password_manager/core/browser/log_router.h b/components/password_manager/core/browser/log_router.h
index f959dbad2..9044f2a 100644
--- a/components/password_manager/core/browser/log_router.h
+++ b/components/password_manager/core/browser/log_router.h
@@ -8,22 +8,24 @@
 #include <set>
 #include <string>
 
+#include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/observer_list.h"
 
 namespace password_manager {
 
+class LogManager;
 class LogReceiver;
-class PasswordManagerClient;
 
-// The router stands between PasswordManagerClient instances and log receivers.
-// During the process of saving a password, the password manager code generates
-// the log strings, and passes them to the router. The router distributes the
-// logs to the receivers for displaying.
+// The router stands between LogManager and LogReceiver instances. Both managers
+// and receivers need to register (and unregister) with the router. After that,
+// the following communication is enabled:
+//   * LogManagers are notified when logging starts or stops being possible
+//   * LogReceivers are sent logs routed through LogRouter
 class LogRouter {
  public:
   LogRouter();
-  virtual ~LogRouter();
+  ~LogRouter();
 
   // Passes logs to the router. Only call when there are receivers registered.
   void ProcessLog(const std::string& text);
@@ -32,26 +34,26 @@
   // constructor of the registered object, because they do not call that object,
   // and the router only runs on a single thread.
 
-  // The clients must register to be notified about whether there are some
-  // receivers or not. RegisterClient adds |client| to the right observer list
+  // The managers must register to be notified about whether there are some
+  // receivers or not. RegisterManager adds |manager| to the right observer list
   // and returns true iff there are some receivers registered.
-  bool RegisterClient(PasswordManagerClient* client);
-  // Remove |client| from the observers list.
-  void UnregisterClient(PasswordManagerClient* client);
+  bool RegisterManager(LogManager* manager);
+  // Remove |manager| from the observers list.
+  void UnregisterManager(LogManager* manager);
 
   // The receivers must register to get updates with new logs in the future.
   // RegisterReceiver adds |receiver| to the right observer list, and returns
   // the logs accumulated so far. (It returns by value, not const ref, to
   // provide a snapshot as opposed to a link to |accumulated_logs_|.)
-  std::string RegisterReceiver(LogReceiver* receiver);
+  std::string RegisterReceiver(LogReceiver* receiver) WARN_UNUSED_RESULT;
   // Remove |receiver| from the observers list.
   void UnregisterReceiver(LogReceiver* receiver);
 
  private:
-  // Observer lists for clients and receivers. The |true| in the template
+  // Observer lists for managers and receivers. The |true| in the template
   // specialisation means that they will check that all observers were removed
   // on destruction.
-  base::ObserverList<PasswordManagerClient, true> clients_;
+  base::ObserverList<LogManager, true> managers_;
   base::ObserverList<LogReceiver, true> receivers_;
 
   // Logs accumulated since the first receiver was registered.
diff --git a/components/password_manager/core/browser/log_router_unittest.cc b/components/password_manager/core/browser/log_router_unittest.cc
index d7216b9..479448b1 100644
--- a/components/password_manager/core/browser/log_router_unittest.cc
+++ b/components/password_manager/core/browser/log_router_unittest.cc
@@ -5,7 +5,7 @@
 #include "components/password_manager/core/browser/log_router.h"
 
 #include "components/password_manager/core/browser/log_receiver.h"
-#include "components/password_manager/core/browser/stub_password_manager_client.h"
+#include "components/password_manager/core/browser/stub_log_manager.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -19,14 +19,22 @@
 
 class MockLogReceiver : public LogReceiver {
  public:
-  MockLogReceiver() {}
+  MockLogReceiver() = default;
 
   MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&));
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockLogReceiver);
 };
 
-class MockClient : public StubPasswordManagerClient {
+class MockLogManager : public StubLogManager {
  public:
+  MockLogManager() = default;
+
   MOCK_METHOD1(OnLogRouterAvailabilityChanged, void(bool));
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockLogManager);
 };
 
 }  // namespace
@@ -35,7 +43,7 @@
  protected:
   testing::StrictMock<MockLogReceiver> receiver_;
   testing::StrictMock<MockLogReceiver> receiver2_;
-  testing::StrictMock<MockClient> client_;
+  testing::StrictMock<MockLogManager> manager_;
 };
 
 TEST_F(LogRouterTest, ProcessLog_NoReceiver) {
@@ -99,59 +107,59 @@
   router.UnregisterReceiver(&receiver2_);
 }
 
-TEST_F(LogRouterTest, RegisterClient_NoReceivers) {
+TEST_F(LogRouterTest, RegisterManager_NoReceivers) {
   LogRouter router;
-  EXPECT_FALSE(router.RegisterClient(&client_));
-  router.UnregisterClient(&client_);
+  EXPECT_FALSE(router.RegisterManager(&manager_));
+  router.UnregisterManager(&manager_);
 }
 
-TEST_F(LogRouterTest, RegisterClient_OneReceiverBeforeClient) {
+TEST_F(LogRouterTest, RegisterManager_OneReceiverBeforeManager) {
   LogRouter router;
   // First register a receiver.
   EXPECT_EQ(std::string(), router.RegisterReceiver(&receiver_));
-  // The client should be told the LogRouter has some receivers.
-  EXPECT_TRUE(router.RegisterClient(&client_));
-  // Now unregister the reciever. The client should be told the LogRouter has no
-  // receivers.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(false)).Times(1);
+  // The manager should be told the LogRouter has some receivers.
+  EXPECT_TRUE(router.RegisterManager(&manager_));
+  // Now unregister the reciever. The manager should be told the LogRouter has
+  // no receivers.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(false));
   router.UnregisterReceiver(&receiver_);
-  router.UnregisterClient(&client_);
+  router.UnregisterManager(&manager_);
 }
 
-TEST_F(LogRouterTest, RegisterClient_OneClientBeforeReceiver) {
+TEST_F(LogRouterTest, RegisterManager_OneManagerBeforeReceiver) {
   LogRouter router;
-  // First register a client; the client should be told the LogRouter has no
+  // First register a manager; the manager should be told the LogRouter has no
   // receivers.
-  EXPECT_FALSE(router.RegisterClient(&client_));
-  // Now register the receiver. The client should be notified.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(true)).Times(1);
+  EXPECT_FALSE(router.RegisterManager(&manager_));
+  // Now register the receiver. The manager should be notified.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(true));
   EXPECT_EQ(std::string(), router.RegisterReceiver(&receiver_));
-  // Now unregister the client.
-  router.UnregisterClient(&client_);
-  // Now unregister the reciever. The client should not hear about it.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(_)).Times(0);
+  // Now unregister the manager.
+  router.UnregisterManager(&manager_);
+  // Now unregister the reciever. The manager should not hear about it.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(_)).Times(0);
   router.UnregisterReceiver(&receiver_);
 }
 
-TEST_F(LogRouterTest, RegisterClient_OneClientTwoReceivers) {
+TEST_F(LogRouterTest, RegisterManager_OneManagerTwoReceivers) {
   LogRouter router;
-  // First register a client; the client should be told the LogRouter has no
+  // First register a manager; the manager should be told the LogRouter has no
   // receivers.
-  EXPECT_FALSE(router.RegisterClient(&client_));
-  // Now register the 1st receiver. The client should be notified.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(true)).Times(1);
+  EXPECT_FALSE(router.RegisterManager(&manager_));
+  // Now register the 1st receiver. The manager should be notified.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(true));
   EXPECT_EQ(std::string(), router.RegisterReceiver(&receiver_));
-  // Now register the 2nd receiver. The client should not be notified.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(true)).Times(0);
+  // Now register the 2nd receiver. The manager should not be notified.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(true)).Times(0);
   EXPECT_EQ(std::string(), router.RegisterReceiver(&receiver2_));
-  // Now unregister the 1st reciever. The client should not hear about it.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(false)).Times(0);
+  // Now unregister the 1st reciever. The manager should not hear about it.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(false)).Times(0);
   router.UnregisterReceiver(&receiver_);
-  // Now unregister the 2nd reciever. The client should hear about it.
-  EXPECT_CALL(client_, OnLogRouterAvailabilityChanged(false)).Times(1);
+  // Now unregister the 2nd reciever. The manager should hear about it.
+  EXPECT_CALL(manager_, OnLogRouterAvailabilityChanged(false));
   router.UnregisterReceiver(&receiver2_);
-  // Now unregister the client.
-  router.UnregisterClient(&client_);
+  // Now unregister the manager.
+  router.UnregisterManager(&manager_);
 }
 
 }  // namespace password_manager
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc
index 7d499f3..cb61d4b 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -18,6 +18,7 @@
 #include "components/password_manager/core/browser/affiliation_utils.h"
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
 #include "components/password_manager/core/browser/credentials_filter.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/password_manager.h"
 #include "components/password_manager/core/browser/password_manager_client.h"
 #include "components/password_manager/core/browser/password_manager_driver.h"
@@ -312,8 +313,9 @@
   }
 
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_FETCH_LOGINS_METHOD);
     logger->LogNumber(Logger::STRING_FORM_MANAGER_STATE, state_);
   }
@@ -382,8 +384,9 @@
   const size_t logins_result_size = logins_result.size();
 
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_ON_REQUEST_DONE_METHOD);
   }
 
@@ -585,8 +588,9 @@
   }
 
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_ON_GET_STORE_RESULTS_METHOD);
     logger->LogNumber(Logger::STRING_NUMBER_RESULTS, results.size());
   }
diff --git a/components/password_manager/core/browser/password_form_manager.h b/components/password_manager/core/browser/password_form_manager.h
index c07975e..b46cfe4 100644
--- a/components/password_manager/core/browser/password_form_manager.h
+++ b/components/password_manager/core/browser/password_form_manager.h
@@ -208,13 +208,11 @@
     // Just need to update the internal states.
     state_ = MATCHING_PHASE;
   }
+#endif
 
-  // TODO(vasilii): remove the unit test restriction when it's needed in
-  // production code.
   const std::vector<InteractionsStats*>& interactions_stats() const {
     return interactions_stats_.get();
   }
-#endif
 
   const autofill::PasswordForm& observed_form() const { return observed_form_; }
 
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index 99be508..17e791d 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -20,6 +20,7 @@
 #include "components/password_manager/core/browser/affiliation_utils.h"
 #include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
 #include "components/password_manager/core/browser/keychain_migration_status_mac.h"
+#include "components/password_manager/core/browser/log_manager.h"
 #include "components/password_manager/core/browser/password_autofill_manager.h"
 #include "components/password_manager/core/browser/password_form_manager.h"
 #include "components/password_manager/core/browser/password_manager_client.h"
@@ -223,8 +224,9 @@
       client_->IsSavingAndFillingEnabledForCurrentPage();
 
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_PROVISIONALLY_SAVE_PASSWORD_METHOD);
     logger->LogPasswordForm(Logger::STRING_PROVISIONALLY_SAVE_PASSWORD_FORM,
                             form);
@@ -452,8 +454,9 @@
     password_manager::PasswordManagerDriver* driver,
     const std::vector<PasswordForm>& forms) {
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_CREATE_LOGIN_MANAGERS_METHOD);
   }
 
@@ -525,8 +528,9 @@
 
 bool PasswordManager::CanProvisionalManagerSave() {
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_CAN_PROVISIONAL_MANAGER_SAVE_METHOD);
   }
 
@@ -566,8 +570,9 @@
     bool did_stop_loading) {
   CreatePendingLoginManagers(driver, visible_forms);
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_ON_PASSWORD_FORMS_RENDERED_METHOD);
   }
 
@@ -643,8 +648,9 @@
     password_manager::PasswordManagerDriver* driver,
     const PasswordForm& password_form) {
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_ON_IN_PAGE_NAVIGATION);
   }
 
@@ -658,8 +664,9 @@
 
 void PasswordManager::OnLoginSuccessful() {
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_ON_ASK_USER_OR_SAVE_PASSWORD);
   }
 
@@ -722,8 +729,9 @@
   DCHECK_EQ(PasswordForm::SCHEME_HTML, preferred_match.scheme);
 
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_PASSWORDMANAGER_AUTOFILL);
   }
 
@@ -749,8 +757,9 @@
   DCHECK_NE(PasswordForm::SCHEME_HTML, preferred_match.scheme);
 
   scoped_ptr<BrowserSavePasswordProgressLogger> logger;
-  if (client_->IsLoggingActive()) {
-    logger.reset(new BrowserSavePasswordProgressLogger(client_));
+  if (client_->GetLogManager()->IsLoggingActive()) {
+    logger.reset(
+        new BrowserSavePasswordProgressLogger(client_->GetLogManager()));
     logger->LogMessage(Logger::STRING_PASSWORDMANAGER_AUTOFILLHTTPAUTH);
     logger->LogBoolean(Logger::STRING_LOGINMODELOBSERVER_PRESENT,
                        observers_.might_have_observers());
diff --git a/components/password_manager/core/browser/password_manager_client.cc b/components/password_manager/core/browser/password_manager_client.cc
index 3bf6c76..8781ac38 100644
--- a/components/password_manager/core/browser/password_manager_client.cc
+++ b/components/password_manager/core/browser/password_manager_client.cc
@@ -29,18 +29,6 @@
   return NOT_SYNCING_PASSWORDS;
 }
 
-void PasswordManagerClient::OnLogRouterAvailabilityChanged(
-    bool router_can_be_used) {
-}
-
-void PasswordManagerClient::LogSavePasswordProgress(
-    const std::string& text) const {
-}
-
-bool PasswordManagerClient::IsLoggingActive() const {
-  return false;
-}
-
 bool PasswordManagerClient::WasLastNavigationHTTPError() const {
   return false;
 }
@@ -91,4 +79,8 @@
   return false;
 }
 
+const LogManager* PasswordManagerClient::GetLogManager() const {
+  return nullptr;
+}
+
 }  // namespace password_manager
diff --git a/components/password_manager/core/browser/password_manager_client.h b/components/password_manager/core/browser/password_manager_client.h
index b2af53f..9b0cda6 100644
--- a/components/password_manager/core/browser/password_manager_client.h
+++ b/components/password_manager/core/browser/password_manager_client.h
@@ -20,6 +20,7 @@
 namespace password_manager {
 
 struct CredentialInfo;
+class LogManager;
 class PasswordFormManager;
 class PasswordManager;
 class PasswordManagerDriver;
@@ -126,19 +127,6 @@
   // TODO(vabr): Factor this out of the client to the sync layer.
   virtual PasswordSyncState GetPasswordSyncState() const;
 
-  // Only for clients which registered with a LogRouter: If called with
-  // |router_can_be_used| set to false, the client may no longer use the
-  // LogRouter. If |router_can_be_used| is true, the LogRouter can be used after
-  // the return from OnLogRouterAvailabilityChanged.
-  virtual void OnLogRouterAvailabilityChanged(bool router_can_be_used);
-
-  // Forward |text| for display to the LogRouter (if registered with one).
-  virtual void LogSavePasswordProgress(const std::string& text) const;
-
-  // Returns true if logs recorded via LogSavePasswordProgress will be
-  // displayed, and false otherwise.
-  virtual bool IsLoggingActive() const;
-
   // Returns true if last navigation page had HTTP error i.e 5XX or 4XX
   virtual bool WasLastNavigationHTTPError() const;
 
@@ -173,6 +161,9 @@
   // Use this to filter credentials before handling them in password manager.
   virtual const CredentialsFilter* GetStoreResultFilter() const = 0;
 
+  // Returns a LogManager instance.
+  virtual const LogManager* GetLogManager() const;
+
  private:
   DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient);
 };
diff --git a/components/password_manager/core/browser/password_manager_driver.h b/components/password_manager/core/browser/password_manager_driver.h
index 9a63448..10d7558c 100644
--- a/components/password_manager/core/browser/password_manager_driver.h
+++ b/components/password_manager/core/browser/password_manager_driver.h
@@ -81,6 +81,10 @@
   // Returns the PasswordAutofillManager associated with this instance.
   virtual PasswordAutofillManager* GetPasswordAutofillManager() = 0;
 
+  // Sends a message to the renderer whether logging to
+  // chrome://password-manager-internals is available.
+  virtual void SendLoggingAvailability() {}
+
  private:
   DISALLOW_COPY_AND_ASSIGN(PasswordManagerDriver);
 };
diff --git a/components/password_manager/core/browser/statistics_table.cc b/components/password_manager/core/browser/statistics_table.cc
index e679663..b34aa6f 100644
--- a/components/password_manager/core/browser/statistics_table.cc
+++ b/components/password_manager/core/browser/statistics_table.cc
@@ -4,6 +4,8 @@
 
 #include "components/password_manager/core/browser/statistics_table.h"
 
+#include <algorithm>
+
 #include "sql/connection.h"
 #include "sql/statement.h"
 
@@ -29,6 +31,16 @@
          lhs.update_time == rhs.update_time;
 }
 
+InteractionsStats* FindStatsByUsername(
+    const std::vector<InteractionsStats*>& stats,
+    const base::string16& username) {
+  auto it = std::find_if(stats.begin(), stats.end(),
+                         [&username](const InteractionsStats* element) {
+                           return username == element->username_value;
+                         });
+  return it == stats.end() ? nullptr : *it;
+}
+
 StatisticsTable::StatisticsTable() : db_(nullptr) {
 }
 
diff --git a/components/password_manager/core/browser/statistics_table.h b/components/password_manager/core/browser/statistics_table.h
index a4900f9..7f20e33 100644
--- a/components/password_manager/core/browser/statistics_table.h
+++ b/components/password_manager/core/browser/statistics_table.h
@@ -5,6 +5,8 @@
 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STATISTICS_TABLE_H_
 
+#include <vector>
+
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
@@ -36,6 +38,11 @@
 
 bool operator==(const InteractionsStats& lhs, const InteractionsStats& rhs);
 
+// Returns an element from |stats| with |username| or nullptr if not found.
+InteractionsStats* FindStatsByUsername(
+    const std::vector<InteractionsStats*>& stats,
+    const base::string16& username);
+
 // Represents the 'stats' table in the Login Database.
 class StatisticsTable {
  public:
diff --git a/components/password_manager/core/browser/stub_log_manager.cc b/components/password_manager/core/browser/stub_log_manager.cc
new file mode 100644
index 0000000..1d3ba042
--- /dev/null
+++ b/components/password_manager/core/browser/stub_log_manager.cc
@@ -0,0 +1,19 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/stub_log_manager.h"
+
+namespace password_manager {
+
+void StubLogManager::OnLogRouterAvailabilityChanged(bool router_can_be_used) {}
+
+void StubLogManager::SetSuspended(bool suspended) {}
+
+void StubLogManager::LogSavePasswordProgress(const std::string& text) const {}
+
+bool StubLogManager::IsLoggingActive() const {
+  return false;
+}
+
+}  // namespace password_manager
diff --git a/components/password_manager/core/browser/stub_log_manager.h b/components/password_manager/core/browser/stub_log_manager.h
new file mode 100644
index 0000000..9fc6fe1c
--- /dev/null
+++ b/components/password_manager/core/browser/stub_log_manager.h
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_LOG_MANAGER_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_LOG_MANAGER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/password_manager/core/browser/log_manager.h"
+
+namespace password_manager {
+
+// Use this in tests only, to provide a no-op implementation of LogManager.
+class StubLogManager : public LogManager {
+ public:
+  StubLogManager() = default;
+  ~StubLogManager() override = default;
+
+ private:
+  // LogManager
+  void OnLogRouterAvailabilityChanged(bool router_can_be_used) override;
+  void SetSuspended(bool suspended) override;
+  void LogSavePasswordProgress(const std::string& text) const override;
+  bool IsLoggingActive() const override;
+
+  DISALLOW_COPY_AND_ASSIGN(StubLogManager);
+};
+
+}  // namespace password_manager
+
+#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_LOG_MANAGER_H_
diff --git a/components/password_manager/core/browser/stub_password_manager_client.cc b/components/password_manager/core/browser/stub_password_manager_client.cc
index d7bb3fd..64ec5379 100644
--- a/components/password_manager/core/browser/stub_password_manager_client.cc
+++ b/components/password_manager/core/browser/stub_password_manager_client.cc
@@ -66,4 +66,8 @@
   return &credentials_filter_;
 }
 
+const LogManager* StubPasswordManagerClient::GetLogManager() const {
+  return &log_manager_;
+}
+
 }  // namespace password_manager
diff --git a/components/password_manager/core/browser/stub_password_manager_client.h b/components/password_manager/core/browser/stub_password_manager_client.h
index 4405904..81d07b3 100644
--- a/components/password_manager/core/browser/stub_password_manager_client.h
+++ b/components/password_manager/core/browser/stub_password_manager_client.h
@@ -6,6 +6,7 @@
 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_PASSWORD_MANAGER_CLIENT_H_
 
 #include "components/password_manager/core/browser/password_manager_client.h"
+#include "components/password_manager/core/browser/stub_log_manager.h"
 
 namespace password_manager {
 
@@ -36,6 +37,7 @@
   PasswordStore* GetPasswordStore() const override;
   const GURL& GetLastCommittedEntryURL() const override;
   const CredentialsFilter* GetStoreResultFilter() const override;
+  const LogManager* GetLogManager() const override;
 
  private:
   // This filter does not filter out anything, it is a dummy implementation of
@@ -51,6 +53,7 @@
   };
 
   const PassThroughCredentialsFilter credentials_filter_;
+  StubLogManager log_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(StubPasswordManagerClient);
 };
diff --git a/components/pdf_viewer/BUILD.gn b/components/pdf_viewer/BUILD.gn
index 51d6df8..984b212b 100644
--- a/components/pdf_viewer/BUILD.gn
+++ b/components/pdf_viewer/BUILD.gn
@@ -27,6 +27,7 @@
     "//mojo/public/cpp/bindings",
     "//mojo/services/network/public/cpp",
     "//mojo/services/network/public/interfaces",
+    "//mojo/services/tracing/public/cpp",
     "//mojo/services/tracing/public/interfaces",
     "//third_party/pdfium",
     "//ui/gfx/geometry",
diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc
index 94fae5c..5dc90974 100644
--- a/components/pdf_viewer/pdf_viewer.cc
+++ b/components/pdf_viewer/pdf_viewer.cc
@@ -28,6 +28,7 @@
 #include "mojo/common/data_pipe_utils.h"
 #include "mojo/public/c/system/main.h"
 #include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 #include "third_party/pdfium/public/fpdf_ext.h"
 #include "third_party/pdfium/public/fpdfview.h"
 #include "ui/gfx/geometry/rect.h"
@@ -340,6 +341,10 @@
 
  private:
   // ApplicationDelegate:
+  void Initialize(mojo::ApplicationImpl* app) override {
+    tracing_.Initialize(app);
+  }
+
   bool ConfigureIncomingConnection(
       mojo::ApplicationConnection* connection) override {
     connection->AddService(this);
@@ -352,6 +357,8 @@
     new ContentHandlerImpl(request.Pass());
   }
 
+  mojo::TracingImpl tracing_;
+
   DISALLOW_COPY_AND_ASSIGN(PDFViewer);
 };
 }  // namespace
diff --git a/components/policy/core/common/policy_namespace.cc b/components/policy/core/common/policy_namespace.cc
index 0fac9ca..33a9992 100644
--- a/components/policy/core/common/policy_namespace.cc
+++ b/components/policy/core/common/policy_namespace.cc
@@ -4,6 +4,8 @@
 
 #include "components/policy/core/common/policy_namespace.h"
 
+#include <tuple>
+
 namespace policy {
 
 PolicyNamespace::PolicyNamespace() {}
@@ -26,8 +28,8 @@
 }
 
 bool PolicyNamespace::operator<(const PolicyNamespace& other) const {
-  return domain < other.domain ||
-         (domain == other.domain && component_id < other.component_id);
+  return std::tie(domain, component_id) <
+         std::tie(other.domain, other.component_id);
 }
 
 bool PolicyNamespace::operator==(const PolicyNamespace& other) const {
diff --git a/components/sessions.gypi b/components/sessions.gypi
index 8dc4826..2f5818f 100644
--- a/components/sessions.gypi
+++ b/components/sessions.gypi
@@ -126,6 +126,7 @@
     }, {  # OS==ios
       'targets': [
         {
+          # GN version: //components/sessions
           'target_name': 'sessions_ios',
           'type': 'static_library',
           'dependencies': [
diff --git a/components/signin/ios/browser/BUILD.gn b/components/signin/ios/browser/BUILD.gn
index 3a5ec77..9ab40ff 100644
--- a/components/signin/ios/browser/BUILD.gn
+++ b/components/signin/ios/browser/BUILD.gn
@@ -17,8 +17,8 @@
   ]
 
   deps = [
+    "//components/signin/core/browser",
     "//ios/web",
-    "//signin/core/browser",
   ]
 }
 
diff --git a/components/url_matcher/string_pattern.cc b/components/url_matcher/string_pattern.cc
index d103bce..a4b87bca 100644
--- a/components/url_matcher/string_pattern.cc
+++ b/components/url_matcher/string_pattern.cc
@@ -4,6 +4,8 @@
 
 #include "components/url_matcher/string_pattern.h"
 
+#include <tuple>
+
 namespace url_matcher {
 
 StringPattern::StringPattern(const std::string& pattern,
@@ -13,8 +15,7 @@
 StringPattern::~StringPattern() {}
 
 bool StringPattern::operator<(const StringPattern& rhs) const {
-  if (id_ != rhs.id_) return id_ < rhs.id_;
-  return pattern_ < rhs.pattern_;
+  return std::tie(id_, pattern_) < std::tie(rhs.id_, rhs.pattern_);
 }
 
 }  // namespace url_matcher
diff --git a/components/variations.gypi b/components/variations.gypi
index d0f5a56e..9649110d0 100644
--- a/components/variations.gypi
+++ b/components/variations.gypi
@@ -115,7 +115,6 @@
         'variations/service/variations_service.cc',
         'variations/service/variations_service.h',
         'variations/service/variations_service_client.h',
-        'variations/service/variations_service_client.cc',
       ],
     },
     {
diff --git a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
index 3af546bf..2b5a5be 100644
--- a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
+++ b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
@@ -5,7 +5,6 @@
 package org.chromium.components.variations.firstrun;
 
 import android.content.Context;
-import android.content.SharedPreferences;
 import android.preference.PreferenceManager;
 import android.util.Base64;
 
@@ -21,23 +20,67 @@
     private static final String VARIATIONS_FIRST_RUN_SEED_BASE64 = "variations_seed_base64";
     private static final String VARIATIONS_FIRST_RUN_SEED_SIGNATURE = "variations_seed_signature";
     private static final String VARIATIONS_FIRST_RUN_SEED_COUNTRY = "variations_seed_country";
+    private static final String VARIATIONS_FIRST_RUN_SEED_DATE = "variations_seed_date";
+    private static final String VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED =
+            "variations_seed_is_gzip_compressed";
+
+    // This pref is used to store information about successful seed storing on the C++ side, in
+    // order to not fetch the seed again.
+    private static final String VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED =
+            "variations_seed_native_stored";
 
     private static String getVariationsFirstRunSeedPref(Context context, String prefName) {
-        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
-        return prefs.getString(prefName, "");
+        return PreferenceManager.getDefaultSharedPreferences(context).getString(prefName, "");
     }
 
     /**
      * Stores variations seed data (raw data, seed signature and country code) in SharedPreferences.
      */
-    public static void setVariationsFirstRunSeed(
-            Context context, byte[] rawSeed, String signature, String country) {
-        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
-        prefs.edit()
+    public static void setVariationsFirstRunSeed(Context context, byte[] rawSeed, String signature,
+            String country, String date, boolean isGzipCompressed) {
+        PreferenceManager.getDefaultSharedPreferences(context)
+                .edit()
                 .putString(VARIATIONS_FIRST_RUN_SEED_BASE64,
                         Base64.encodeToString(rawSeed, Base64.NO_WRAP))
                 .putString(VARIATIONS_FIRST_RUN_SEED_SIGNATURE, signature)
                 .putString(VARIATIONS_FIRST_RUN_SEED_COUNTRY, country)
+                .putString(VARIATIONS_FIRST_RUN_SEED_DATE, date)
+                .putBoolean(VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED, isGzipCompressed)
+                .apply();
+    }
+
+    @CalledByNative
+    private static void clearFirstRunPrefs(Context context) {
+        PreferenceManager.getDefaultSharedPreferences(context)
+                .edit()
+                .remove(VARIATIONS_FIRST_RUN_SEED_BASE64)
+                .remove(VARIATIONS_FIRST_RUN_SEED_SIGNATURE)
+                .remove(VARIATIONS_FIRST_RUN_SEED_COUNTRY)
+                .apply();
+    }
+
+    /**
+     * Returns the status of the variations first run fetch: was it successful or not.
+     */
+    public static boolean hasJavaPref(Context context) {
+        return !PreferenceManager.getDefaultSharedPreferences(context)
+                        .getString(VARIATIONS_FIRST_RUN_SEED_BASE64, "")
+                        .isEmpty();
+    }
+
+    /**
+     * Returns the status of the variations seed storing on the C++ side: was it successful or not.
+     */
+    public static boolean hasNativePref(Context context) {
+        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
+                VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED, false);
+    }
+
+    @CalledByNative
+    private static void markVariationsSeedAsStored(Context context) {
+        PreferenceManager.getDefaultSharedPreferences(context)
+                .edit()
+                .putBoolean(VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED, true)
                 .apply();
     }
 
@@ -57,4 +100,15 @@
     private static String getVariationsFirstRunSeedCountry(Context context) {
         return getVariationsFirstRunSeedPref(context, VARIATIONS_FIRST_RUN_SEED_COUNTRY);
     }
+
+    @CalledByNative
+    private static String getVariationsFirstRunSeedDate(Context context) {
+        return getVariationsFirstRunSeedPref(context, VARIATIONS_FIRST_RUN_SEED_DATE);
+    }
+
+    @CalledByNative
+    private static boolean getVariationsFirstRunSeedIsGzipCompressed(Context context) {
+        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
+                VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED, false);
+    }
 }
diff --git a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java
index c752d884..02fc45d 100644
--- a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java
+++ b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java
@@ -27,19 +27,38 @@
     private static final int READ_TIMEOUT = 10000; // time in ms
     private static final int REQUEST_TIMEOUT = 15000; // time in ms
 
+    // Static variable that indicates a status of the variations seed fetch. If one request is in
+    // progress, we do not start another fetch.
+    private static boolean sFetchInProgress = false;
+
     public VariationsSeedService() {
         super(TAG);
     }
 
     @Override
     public void onHandleIntent(Intent intent) {
+        // Check if any variations seed fetch is in progress, or the seed has been already fetched,
+        // or seed has been successfully stored on the C++ side.
+        if (sFetchInProgress || VariationsSeedBridge.hasJavaPref(getApplicationContext())
+                || VariationsSeedBridge.hasNativePref(getApplicationContext())) {
+            return;
+        }
+        setFetchInProgressFlagValue(true);
         try {
             downloadContent(new URL(VARIATIONS_SERVER_URL));
         } catch (MalformedURLException e) {
             Log.w(TAG, "Variations server URL is malformed.", e);
+        } finally {
+            setFetchInProgressFlagValue(false);
         }
     }
 
+    // Separate function is needed to avoid FINDBUGS build error (assigning value to static variable
+    // from non-static onHandleIntent() method).
+    private static void setFetchInProgressFlagValue(boolean value) {
+        sFetchInProgress = value;
+    }
+
     private boolean downloadContent(URL variationsServerUrl) {
         HttpURLConnection connection = null;
         try {
@@ -47,8 +66,7 @@
             connection.setReadTimeout(READ_TIMEOUT);
             connection.setConnectTimeout(REQUEST_TIMEOUT);
             connection.setDoInput(true);
-            // TODO(agulenko): add gzip compression support.
-            // connection.setRequestProperty("A-IM", "gzip");
+            connection.setRequestProperty("A-IM", "gzip");
             connection.connect();
             int responseCode = connection.getResponseCode();
             if (responseCode != HttpURLConnection.HTTP_OK) {
@@ -58,10 +76,12 @@
 
             // Convert the InputStream into a byte array.
             byte[] rawSeed = getRawSeed(connection);
-            String signature = connection.getHeaderField("X-Seed-Signature");
-            String country = connection.getHeaderField("X-Country");
+            String signature = getHeaderFieldOrEmpty(connection, "X-Seed-Signature");
+            String country = getHeaderFieldOrEmpty(connection, "X-Country");
+            String date = getHeaderFieldOrEmpty(connection, "Date");
+            boolean isGzipCompressed = getHeaderFieldOrEmpty(connection, "IM").equals("gzip");
             VariationsSeedBridge.setVariationsFirstRunSeed(
-                    getApplicationContext(), rawSeed, signature, country);
+                    getApplicationContext(), rawSeed, signature, country, date, isGzipCompressed);
             return true;
         } catch (IOException e) {
             Log.w(TAG, "IOException fetching first run seed: ", e);
@@ -73,6 +93,14 @@
         }
     }
 
+    private String getHeaderFieldOrEmpty(HttpURLConnection connection, String name) {
+        String headerField = connection.getHeaderField(name);
+        if (headerField == null) {
+            return "";
+        }
+        return headerField.trim();
+    }
+
     private byte[] getRawSeed(HttpURLConnection connection) throws IOException {
         InputStream inputStream = null;
         try {
diff --git a/components/variations/android/variations_seed_bridge.cc b/components/variations/android/variations_seed_bridge.cc
index cf5cbe4..16dfeca 100644
--- a/components/variations/android/variations_seed_bridge.cc
+++ b/components/variations/android/variations_seed_bridge.cc
@@ -39,7 +39,9 @@
 
 void GetVariationsFirstRunSeed(std::string* seed_data,
                                std::string* seed_signature,
-                               std::string* seed_country) {
+                               std::string* seed_country,
+                               std::string* response_date,
+                               bool* is_gzip_compressed) {
   JNIEnv* env = AttachCurrentThread();
   ScopedJavaLocalRef<jbyteArray> j_seed_data =
       Java_VariationsSeedBridge_getVariationsFirstRunSeedData(
@@ -50,9 +52,28 @@
   ScopedJavaLocalRef<jstring> j_seed_country =
       Java_VariationsSeedBridge_getVariationsFirstRunSeedCountry(
           env, GetApplicationContext());
+  ScopedJavaLocalRef<jstring> j_response_date =
+      Java_VariationsSeedBridge_getVariationsFirstRunSeedDate(
+          env, GetApplicationContext());
+  jboolean j_is_gzip_compressed =
+      Java_VariationsSeedBridge_getVariationsFirstRunSeedIsGzipCompressed(
+          env, GetApplicationContext());
   *seed_data = JavaByteArrayToString(env, j_seed_data.obj());
   *seed_signature = ConvertJavaStringToUTF8(j_seed_signature);
   *seed_country = ConvertJavaStringToUTF8(j_seed_country);
+  *response_date = ConvertJavaStringToUTF8(j_response_date);
+  *is_gzip_compressed = static_cast<bool>(j_is_gzip_compressed);
+}
+
+void ClearJavaFirstRunPrefs() {
+  JNIEnv* env = AttachCurrentThread();
+  Java_VariationsSeedBridge_clearFirstRunPrefs(env, GetApplicationContext());
+}
+
+void MarkVariationsSeedAsStored() {
+  JNIEnv* env = AttachCurrentThread();
+  Java_VariationsSeedBridge_markVariationsSeedAsStored(env,
+                                                       GetApplicationContext());
 }
 
 }  // namespace android
diff --git a/components/variations/android/variations_seed_bridge.h b/components/variations/android/variations_seed_bridge.h
index 83381fa..63ce5e2fc 100644
--- a/components/variations/android/variations_seed_bridge.h
+++ b/components/variations/android/variations_seed_bridge.h
@@ -16,7 +16,17 @@
 // Return the first run seed data pulled from the Java side of application.
 void GetVariationsFirstRunSeed(std::string* seed_data,
                                std::string* seed_signature,
-                               std::string* seed_country);
+                               std::string* seed_country,
+                               std::string* response_date,
+                               bool* is_gzip_compressed);
+
+// Clears first run seed preferences stored on the Java side of Chrome for
+// Android.
+void ClearJavaFirstRunPrefs();
+
+// Marks variations seed as stored to avoid repeated fetches of the seed at
+// the Java side.
+void MarkVariationsSeedAsStored();
 
 }  // namespace android
 }  // namespace variations
diff --git a/components/variations/service/BUILD.gn b/components/variations/service/BUILD.gn
index a1fa0a2..c6cf5b11 100644
--- a/components/variations/service/BUILD.gn
+++ b/components/variations/service/BUILD.gn
@@ -8,7 +8,6 @@
     "ui_string_overrider.h",
     "variations_service.cc",
     "variations_service.h",
-    "variations_service_client.cc",
     "variations_service_client.h",
   ]
 
diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc
index 2c19983..8d3ced5c 100644
--- a/components/variations/service/variations_service.cc
+++ b/components/variations/service/variations_service.cc
@@ -4,8 +4,6 @@
 
 #include "components/variations/service/variations_service.h"
 
-#include <vector>
-
 #include "base/build_time.h"
 #include "base/command_line.h"
 #include "base/metrics/histogram.h"
@@ -290,8 +288,6 @@
   DCHECK(resource_request_allowed_notifier_.get());
 
   resource_request_allowed_notifier_->Init(this);
-  seed_store_.SetVariationsFirstRunSeedCallback(
-      client_->GetVariationsFirstRunSeedCallback());
 }
 
 VariationsService::~VariationsService() {
diff --git a/components/variations/service/variations_service_client.cc b/components/variations/service/variations_service_client.cc
deleted file mode 100644
index 688bb1f..0000000
--- a/components/variations/service/variations_service_client.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/variations/service/variations_service_client.h"
-
-namespace variations {
-
-VariationsFirstRunSeedCallback
-VariationsServiceClient::GetVariationsFirstRunSeedCallback() {
-  return VariationsFirstRunSeedCallback();
-}
-
-}  // namespace variations
diff --git a/components/variations/service/variations_service_client.h b/components/variations/service/variations_service_client.h
index fabaee83..b3758a6 100644
--- a/components/variations/service/variations_service_client.h
+++ b/components/variations/service/variations_service_client.h
@@ -10,7 +10,6 @@
 #include "base/callback.h"
 #include "base/strings/string16.h"
 #include "base/version.h"
-#include "components/variations/variations_seed_store.h"
 #include "components/version_info/version_info.h"
 
 namespace base {
@@ -60,10 +59,6 @@
 
   // Called from VariationsService::PerformPreMainMessageLoopStartup().
   virtual void OnInitialStartup() {}
-
-  // Get callback for pulling variations first run seed from Java applicaton
-  // in Chrome for Android.
-  virtual VariationsFirstRunSeedCallback GetVariationsFirstRunSeedCallback();
 };
 
 }  // namespace variations
diff --git a/components/variations/variations_seed_store.cc b/components/variations/variations_seed_store.cc
index 84dca7e..9054eae 100644
--- a/components/variations/variations_seed_store.cc
+++ b/components/variations/variations_seed_store.cc
@@ -17,6 +17,10 @@
 #include "crypto/signature_verifier.h"
 #include "third_party/protobuf/src/google/protobuf/io/coded_stream.h"
 
+#if defined(OS_ANDROID)
+#include "components/variations/android/variations_seed_bridge.h"
+#endif  // OS_ANDROID
+
 namespace variations {
 
 namespace {
@@ -359,32 +363,29 @@
 #if defined(OS_ANDROID)
 void VariationsSeedStore::ImportFirstRunJavaSeed() {
   DVLOG(1) << "Importing first run seed from Java preferences.";
-  if (get_variations_first_run_seed_.is_null()) {
-    RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_CALLBACK);
-    return;
-  }
 
   std::string seed_data;
   std::string seed_signature;
   std::string seed_country;
-  get_variations_first_run_seed_.Run(&seed_data, &seed_signature,
-                                     &seed_country);
+  std::string response_date;
+  bool is_gzip_compressed;
+
+  android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
+                                     &response_date, &is_gzip_compressed);
   if (seed_data.empty()) {
     RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED);
     return;
   }
 
-  // TODO(agulenko): Pull actual time from the response.
-  base::Time current_time = base::Time::Now();
+  base::Time current_date;
+  base::Time::FromUTCString(response_date.c_str(), &current_date);
 
-  // TODO(agulenko): Support gzip compressed seed.
-  if (!StoreSeedData(seed_data, seed_signature, seed_country, current_time,
-                     false, false, nullptr)) {
+  if (!StoreSeedData(seed_data, seed_signature, seed_country, current_date,
+                     false, is_gzip_compressed, nullptr)) {
     RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED);
     LOG(WARNING) << "First run variations seed is invalid.";
     return;
   }
-  // TODO(agulenko): Clear Java prefs.
   RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_SUCCESS);
 }
 #endif  // OS_ANDROID
@@ -464,6 +465,16 @@
   // in M45+.
   local_state_->ClearPref(prefs::kVariationsSeed);
 
+#if defined(OS_ANDROID)
+  // If currently we do not have any stored pref then we mark seed storing as
+  // successful on the Java side of Chrome for Android to avoid repeated seed
+  // fetches and clear preferences on the Java side.
+  if (local_state_->GetString(prefs::kVariationsCompressedSeed).empty()) {
+    android::MarkVariationsSeedAsStored();
+    android::ClearJavaFirstRunPrefs();
+  }
+#endif
+
   // Update the saved country code only if one was returned from the server.
   // Prefer the country code that was transmitted in the header over the one in
   // the seed (which is deprecated).
diff --git a/components/variations/variations_seed_store.h b/components/variations/variations_seed_store.h
index 42a6a59..d079a510 100644
--- a/components/variations/variations_seed_store.h
+++ b/components/variations/variations_seed_store.h
@@ -7,7 +7,6 @@
 
 #include <string>
 
-#include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/gtest_prod_util.h"
 #include "base/time/time.h"
@@ -21,9 +20,6 @@
 
 namespace variations {
 
-typedef base::Callback<void(std::string*, std::string*, std::string*)>
-    VariationsFirstRunSeedCallback;
-
 // VariationsSeedStore is a helper class for reading and writing the variations
 // seed from Local State.
 class VariationsSeedStore {
@@ -79,13 +75,6 @@
   // Registers Local State prefs used by this class.
   static void RegisterPrefs(PrefRegistrySimple* registry);
 
-  // Registers callback for pulling variations first run seed from Java side
-  // in Chrome for Android.
-  void SetVariationsFirstRunSeedCallback(
-      const VariationsFirstRunSeedCallback& callback) {
-    get_variations_first_run_seed_ = callback;
-  }
-
  protected:
   // Note: UMA histogram enum - don't re-order or remove entries.
   enum VerifySignatureResult {
@@ -151,8 +140,6 @@
   // Keeps track of an invalid signature.
   std::string invalid_base64_signature_;
 
-  VariationsFirstRunSeedCallback get_variations_first_run_seed_;
-
   DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore);
 };
 
diff --git a/content/browser/android/url_request_content_job.cc b/content/browser/android/url_request_content_job.cc
index 6e661a2..1bcbf210 100644
--- a/content/browser/android/url_request_content_job.cc
+++ b/content/browser/android/url_request_content_job.cc
@@ -11,7 +11,6 @@
 #include "base/task_runner.h"
 #include "net/base/file_stream.h"
 #include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
 #include "net/http/http_util.h"
 #include "net/url_request/url_request_error_job.h"
 #include "url/gurl.h"
@@ -34,6 +33,7 @@
       content_path_(content_path),
       stream_(new net::FileStream(content_task_runner)),
       content_task_runner_(content_task_runner),
+      range_parse_result_(net::OK),
       remaining_bytes_(0),
       io_pending_(false),
       weak_ptr_factory_(this) {}
@@ -56,43 +56,28 @@
   net::URLRequestJob::Kill();
 }
 
-bool URLRequestContentJob::ReadRawData(net::IOBuffer* dest,
-                                       int dest_size,
-                                       int* bytes_read) {
+int URLRequestContentJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
   DCHECK_GT(dest_size, 0);
-  DCHECK(bytes_read);
   DCHECK_GE(remaining_bytes_, 0);
 
   if (remaining_bytes_ < dest_size)
-    dest_size = static_cast<int>(remaining_bytes_);
+    dest_size = remaining_bytes_;
 
   // If we should copy zero bytes because |remaining_bytes_| is zero, short
   // circuit here.
-  if (!dest_size) {
-    *bytes_read = 0;
-    return true;
-  }
+  if (!dest_size)
+    return 0;
 
-  int rv =
-      stream_->Read(dest, dest_size, base::Bind(&URLRequestContentJob::DidRead,
-                                                weak_ptr_factory_.GetWeakPtr(),
-                                                make_scoped_refptr(dest)));
-  if (rv >= 0) {
-    // Data is immediately available.
-    *bytes_read = rv;
-    remaining_bytes_ -= rv;
-    DCHECK_GE(remaining_bytes_, 0);
-    return true;
-  }
-
-  // Otherwise, a read error occured.  We may just need to wait...
+  int rv = stream_->Read(dest, dest_size,
+                         base::Bind(&URLRequestContentJob::DidRead,
+                                    weak_ptr_factory_.GetWeakPtr()));
   if (rv == net::ERR_IO_PENDING) {
     io_pending_ = true;
-    SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-  } else {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, rv));
+  } else if (rv > 0) {
+    remaining_bytes_ -= rv;
   }
-  return false;
+  DCHECK_GE(remaining_bytes_, 0);
+  return rv;
 }
 
 bool URLRequestContentJob::IsRedirectResponse(GURL* location,
@@ -115,15 +100,16 @@
   if (!headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header))
     return;
 
-  // We only care about "Range" header here.
+  // Currently this job only cares about the Range header. Note that validation
+  // is deferred to DidOpen(), because NotifyStartError is not legal to call
+  // since the job has not started.
   std::vector<net::HttpByteRange> ranges;
   if (net::HttpUtil::ParseRangeHeader(range_header, &ranges)) {
     if (ranges.size() == 1) {
       byte_range_ = ranges[0];
     } else {
       // We don't support multiple range requests.
-      NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                       net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+      range_parse_result_ = net::ERR_REQUEST_RANGE_NOT_SATISFIABLE;
     }
   }
 }
@@ -160,13 +146,20 @@
 
 void URLRequestContentJob::DidOpen(int result) {
   if (result != net::OK) {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
+    NotifyStartError(
+        net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
+    return;
+  }
+
+  if (range_parse_result_ != net::OK) {
+    NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                           range_parse_result_));
     return;
   }
 
   if (!byte_range_.ComputeBounds(meta_info_.content_size)) {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                     net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+    NotifyStartError(net::URLRequestStatus(
+        net::URLRequestStatus::FAILED, net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
     return;
   }
 
@@ -193,8 +186,8 @@
 
 void URLRequestContentJob::DidSeek(int64 result) {
   if (result != byte_range_.first_byte_position()) {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                     net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+    NotifyStartError(net::URLRequestStatus(
+        net::URLRequestStatus::FAILED, net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
     return;
   }
 
@@ -202,24 +195,16 @@
   NotifyHeadersComplete();
 }
 
-void URLRequestContentJob::DidRead(scoped_refptr<net::IOBuffer> buf,
-                                   int result) {
+void URLRequestContentJob::DidRead(int result) {
+  DCHECK(io_pending_);
+  io_pending_ = false;
+
   if (result > 0) {
-    SetStatus(net::URLRequestStatus());  // Clear the IO_PENDING status
     remaining_bytes_ -= result;
     DCHECK_GE(remaining_bytes_, 0);
   }
 
-  DCHECK(io_pending_);
-  io_pending_ = false;
-
-  if (result == 0) {
-    NotifyDone(net::URLRequestStatus());
-  } else if (result < 0) {
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
-  }
-
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 }  // namespace content
diff --git a/content/browser/android/url_request_content_job.h b/content/browser/android/url_request_content_job.h
index 5d3d9336..dad9fbfc 100644
--- a/content/browser/android/url_request_content_job.h
+++ b/content/browser/android/url_request_content_job.h
@@ -12,6 +12,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "content/common/content_export.h"
+#include "net/base/net_errors.h"
 #include "net/http/http_byte_range.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_job.h"
@@ -42,7 +43,7 @@
   // net::URLRequestJob:
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool IsRedirectResponse(GURL* location, int* http_status_code) override;
   bool GetMimeType(std::string* mime_type) const override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
@@ -79,7 +80,7 @@
   void DidSeek(int64 result);
 
   // Callback after data is asynchronously read from the content URI into |buf|.
-  void DidRead(scoped_refptr<net::IOBuffer> buf, int result);
+  void DidRead(int result);
 
   // The full path of the content URI.
   base::FilePath content_path_;
@@ -89,6 +90,7 @@
   const scoped_refptr<base::TaskRunner> content_task_runner_;
 
   net::HttpByteRange byte_range_;
+  net::Error range_parse_result_;
   int64 remaining_bytes_;
 
   bool io_pending_;
diff --git a/content/browser/appcache/appcache_url_request_job.cc b/content/browser/appcache/appcache_url_request_job.cc
index 82997f7..de924a1 100644
--- a/content/browser/appcache/appcache_url_request_job.cc
+++ b/content/browser/appcache/appcache_url_request_job.cc
@@ -341,7 +341,6 @@
 void AppCacheURLRequestJob::OnReadComplete(int result) {
   DCHECK(is_delivering_appcache_response());
   if (result == 0) {
-    NotifyDone(net::URLRequestStatus());
     AppCacheHistograms::CountResponseRetrieval(
         true, is_main_resource_, manifest_url_.GetOrigin());
   } else if (result < 0) {
@@ -349,13 +348,10 @@
       storage_->service()->CheckAppCacheResponse(manifest_url_, cache_id_,
                                                  entry_.response_id());
     }
-    NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
     AppCacheHistograms::CountResponseRetrieval(
         false, is_main_resource_, manifest_url_.GetOrigin());
-  } else {
-    SetStatus(net::URLRequestStatus());  // Clear the IO_PENDING status
   }
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 // net::URLRequestJob overrides ------------------------------------------------
@@ -424,18 +420,14 @@
   return http_info()->headers->response_code();
 }
 
-bool AppCacheURLRequestJob::ReadRawData(net::IOBuffer* buf,
-                                        int buf_size,
-                                        int* bytes_read) {
+int AppCacheURLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
   DCHECK(is_delivering_appcache_response());
   DCHECK_NE(buf_size, 0);
-  DCHECK(bytes_read);
   DCHECK(!reader_->IsReadPending());
   reader_->ReadData(buf, buf_size,
                     base::Bind(&AppCacheURLRequestJob::OnReadComplete,
                                base::Unretained(this)));
-  SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-  return false;
+  return net::ERR_IO_PENDING;
 }
 
 void AppCacheURLRequestJob::SetExtraRequestHeaders(
diff --git a/content/browser/appcache/appcache_url_request_job.h b/content/browser/appcache/appcache_url_request_job.h
index 95a3e18..8f51e7b 100644
--- a/content/browser/appcache/appcache_url_request_job.h
+++ b/content/browser/appcache/appcache_url_request_job.h
@@ -148,7 +148,7 @@
   net::LoadState GetLoadState() const override;
   bool GetCharset(std::string* charset) override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
 
   // Sets extra request headers for Job types that support request headers.
   // This is how we get informed of range-requests.
diff --git a/content/browser/compositor/browser_compositor_output_surface.cc b/content/browser/compositor/browser_compositor_output_surface.cc
index bdf3a1b..38c8c26 100644
--- a/content/browser/compositor/browser_compositor_output_surface.cc
+++ b/content/browser/compositor/browser_compositor_output_surface.cc
@@ -56,7 +56,6 @@
 }
 
 void BrowserCompositorOutputSurface::Initialize() {
-  capabilities_.max_frames_pending = 1;
   capabilities_.adjust_deadline_for_parent = false;
 }
 
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index 9c313b4..b15b49a 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -319,7 +319,7 @@
     std::vector<uint32_t>* satisfies_sequences) {
   DCHECK(!frame_data->render_pass_list.empty());
 
-  cc::RenderPass* root_pass = frame_data->render_pass_list.back();
+  cc::RenderPass* root_pass = frame_data->render_pass_list.back().get();
 
   gfx::Size frame_size = root_pass->output_rect.size();
   gfx::Size frame_size_in_dip =
@@ -349,7 +349,7 @@
     damage_rect_in_dip = gfx::Rect(frame_size_in_dip);
 
     // Give the same damage rect to the compositor.
-    cc::RenderPass* root_pass = frame_data->render_pass_list.back();
+    cc::RenderPass* root_pass = frame_data->render_pass_list.back().get();
     root_pass->damage_rect = damage_rect;
   }
 
diff --git a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
index 7f3d5eb..15ae4d5 100644
--- a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
@@ -41,7 +41,6 @@
       fbo_(0),
       is_backbuffer_discarded_(false),
       weak_ptr_factory_(this) {
-  capabilities_.max_frames_pending = 1;
   capabilities_.uses_default_gl_framebuffer = false;
 }
 
diff --git a/content/browser/fileapi/file_writer_delegate_unittest.cc b/content/browser/fileapi/file_writer_delegate_unittest.cc
index c9bcfbb7..9eb73b1 100644
--- a/content/browser/fileapi/file_writer_delegate_unittest.cc
+++ b/content/browser/fileapi/file_writer_delegate_unittest.cc
@@ -184,17 +184,15 @@
         base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this));
   }
 
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override {
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override {
     if (remaining_bytes_ < buf_size)
-      buf_size = static_cast<int>(remaining_bytes_);
+      buf_size = remaining_bytes_;
 
     for (int i = 0; i < buf_size; ++i)
       buf->data()[i] = content_[cursor_++];
     remaining_bytes_ -= buf_size;
 
-    SetStatus(net::URLRequestStatus());
-    *bytes_read = buf_size;
-    return true;
+    return buf_size;
   }
 
   int GetResponseCode() const override { return 200; }
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 1330c8e6..6ac5243 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -85,6 +85,14 @@
 
 NavigationHandleImpl::~NavigationHandleImpl() {
   GetDelegate()->DidFinishNavigation(this);
+
+  // Cancel the navigation on the IO thread if the NavigationHandle is being
+  // destroyed in the middle of the NavigationThrottles checks.
+  if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+        switches::kEnableBrowserSideNavigation) &&
+      !complete_callback_.is_null()) {
+    RunCompleteCallback(NavigationThrottle::CANCEL_AND_IGNORE);
+  }
 }
 
 NavigatorDelegate* NavigationHandleImpl::GetDelegate() const {
@@ -169,7 +177,16 @@
   }
 
   if (result != NavigationThrottle::DEFER)
-    complete_callback_.Run(result);
+    RunCompleteCallback(result);
+}
+
+void NavigationHandleImpl::CancelDeferredNavigation(
+    NavigationThrottle::ThrottleCheckResult result) {
+  DCHECK(state_ == DEFERRING_START || state_ == DEFERRING_REDIRECT);
+  DCHECK(result == NavigationThrottle::CANCEL_AND_IGNORE ||
+         result == NavigationThrottle::CANCEL);
+  state_ = CANCELING;
+  RunCompleteCallback(result);
 }
 
 void NavigationHandleImpl::RegisterThrottleForTesting(
@@ -244,7 +261,7 @@
 
   // If the navigation is not deferred, run the callback.
   if (result != NavigationThrottle::DEFER)
-    callback.Run(result);
+    RunCompleteCallback(result);
 }
 
 void NavigationHandleImpl::WillRedirectRequest(
@@ -268,7 +285,7 @@
 
   // If the navigation is not deferred, run the callback.
   if (result != NavigationThrottle::DEFER)
-    callback.Run(result);
+    RunCompleteCallback(result);
 }
 
 void NavigationHandleImpl::DidRedirectNavigation(const GURL& new_url) {
@@ -305,7 +322,9 @@
       case NavigationThrottle::PROCEED:
         continue;
 
+      case NavigationThrottle::CANCEL:
       case NavigationThrottle::CANCEL_AND_IGNORE:
+        state_ = CANCELING;
         return result;
 
       case NavigationThrottle::DEFER:
@@ -334,7 +353,9 @@
       case NavigationThrottle::PROCEED:
         continue;
 
+      case NavigationThrottle::CANCEL:
       case NavigationThrottle::CANCEL_AND_IGNORE:
+        state_ = CANCELING;
         return result;
 
       case NavigationThrottle::DEFER:
@@ -351,4 +372,13 @@
   return NavigationThrottle::PROCEED;
 }
 
+void NavigationHandleImpl::RunCompleteCallback(
+    NavigationThrottle::ThrottleCheckResult result) {
+  DCHECK(result != NavigationThrottle::DEFER);
+  if (!complete_callback_.is_null())
+    complete_callback_.Run(result);
+
+  complete_callback_.Reset();
+}
+
 }  // namespace content
diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h
index 004cf82..622512f2 100644
--- a/content/browser/frame_host/navigation_handle_impl.h
+++ b/content/browser/frame_host/navigation_handle_impl.h
@@ -82,6 +82,8 @@
   bool HasCommitted() override;
   bool IsErrorPage() override;
   void Resume() override;
+  void CancelDeferredNavigation(
+      NavigationThrottle::ThrottleCheckResult result) override;
   void RegisterThrottleForTesting(
       scoped_ptr<NavigationThrottle> navigation_throttle) override;
   NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting(
@@ -162,6 +164,7 @@
     DEFERRING_START,
     WILL_REDIRECT_REQUEST,
     DEFERRING_REDIRECT,
+    CANCELING,
     READY_TO_COMMIT,
     DID_COMMIT,
     DID_COMMIT_ERROR_PAGE,
@@ -174,6 +177,10 @@
   NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
   NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
 
+  // Helper function to run and reset the |complete_callback_|. This marks the
+  // end of a round of NavigationThrottleChecks.
+  void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result);
+
   // Used in tests.
   State state() const { return state_; }
 
diff --git a/content/browser/frame_host/navigation_handle_impl_unittest.cc b/content/browser/frame_host/navigation_handle_impl_unittest.cc
index 614f17c..cd2d0ec 100644
--- a/content/browser/frame_host/navigation_handle_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_handle_impl_unittest.cc
@@ -72,6 +72,10 @@
     return test_handle_->state() == NavigationHandleImpl::DEFERRING_REDIRECT;
   }
 
+  bool IsCanceling() {
+    return test_handle_->state() == NavigationHandleImpl::CANCELING;
+  }
+
   // Helper function to call WillStartRequest on |handle|. If this function
   // returns DEFER, |callback_result_| will be set to the actual result of
   // the throttle checks when they are finished.
@@ -90,6 +94,8 @@
   // Helper function to call WillRedirectRequest on |handle|. If this function
   // returns DEFER, |callback_result_| will be set to the actual result of the
   // throttle checks when they are finished.
+  // TODO(clamy): this should also simulate that WillStartRequest was called if
+  // it has not been called before.
   void SimulateWillRedirectRequest() {
     was_callback_called_ = false;
     callback_result_ = NavigationThrottle::DEFER;
@@ -186,6 +192,98 @@
   EXPECT_EQ(1, test_throttle->will_redirect_calls());
 }
 
+// Checks that a navigation deferred during WillStartRequest can be properly
+// cancelled.
+TEST_F(NavigationHandleImplTest, CancelDeferredWillStart) {
+  TestNavigationThrottle* test_throttle =
+      CreateTestNavigationThrottle(NavigationThrottle::DEFER);
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_EQ(0, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+
+  // Simulate WillStartRequest. The request should be deferred. The callback
+  // should not have been called.
+  SimulateWillStartRequest();
+  EXPECT_TRUE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_FALSE(was_callback_called());
+  EXPECT_EQ(1, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+
+  // Cancel the request. The callback should have been called.
+  test_handle()->CancelDeferredNavigation(
+      NavigationThrottle::CANCEL_AND_IGNORE);
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_TRUE(IsCanceling());
+  EXPECT_TRUE(was_callback_called());
+  EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result());
+  EXPECT_EQ(1, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+}
+
+// Checks that a navigation deferred during WillRedirectRequest can be properly
+// cancelled.
+TEST_F(NavigationHandleImplTest, CancelDeferredWillRedirect) {
+  TestNavigationThrottle* test_throttle =
+      CreateTestNavigationThrottle(NavigationThrottle::DEFER);
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_EQ(0, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+
+  // Simulate WillRedirectRequest. The request should be deferred. The callback
+  // should not have been called.
+  SimulateWillRedirectRequest();
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_TRUE(IsDeferringRedirect());
+  EXPECT_FALSE(was_callback_called());
+  EXPECT_EQ(0, test_throttle->will_start_calls());
+  EXPECT_EQ(1, test_throttle->will_redirect_calls());
+
+  // Cancel the request. The callback should have been called.
+  test_handle()->CancelDeferredNavigation(
+      NavigationThrottle::CANCEL_AND_IGNORE);
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_TRUE(IsCanceling());
+  EXPECT_TRUE(was_callback_called());
+  EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result());
+  EXPECT_EQ(0, test_throttle->will_start_calls());
+  EXPECT_EQ(1, test_throttle->will_redirect_calls());
+}
+
+// Checks that a navigation deferred can be canceled and not ignored.
+TEST_F(NavigationHandleImplTest, CancelDeferredNoIgnore) {
+  TestNavigationThrottle* test_throttle =
+      CreateTestNavigationThrottle(NavigationThrottle::DEFER);
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_EQ(0, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+
+  // Simulate WillRedirectRequest. The request should be deferred. The callback
+  // should not have been called.
+  SimulateWillStartRequest();
+  EXPECT_TRUE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_FALSE(was_callback_called());
+  EXPECT_EQ(1, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+
+  // Cancel the request. The callback should have been called with CANCEL, and
+  // not CANCEL_AND_IGNORE.
+  test_handle()->CancelDeferredNavigation(NavigationThrottle::CANCEL);
+  EXPECT_FALSE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_TRUE(IsCanceling());
+  EXPECT_TRUE(was_callback_called());
+  EXPECT_EQ(NavigationThrottle::CANCEL, callback_result());
+  EXPECT_EQ(1, test_throttle->will_start_calls());
+  EXPECT_EQ(0, test_throttle->will_redirect_calls());
+}
+
 // Checks that a NavigationThrottle asking to defer followed by a
 // NavigationThrottle asking to proceed behave correctly.
 TEST_F(NavigationHandleImplTest, DeferThenProceed) {
@@ -278,8 +376,9 @@
   // Resume the request. The callback should have been called. The second
   // throttle should have been notified.
   test_handle()->Resume();
-  EXPECT_TRUE(IsDeferringStart());
+  EXPECT_FALSE(IsDeferringStart());
   EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_TRUE(IsCanceling());
   EXPECT_TRUE(was_callback_called());
   EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result());
   EXPECT_EQ(1, defer_throttle->will_start_calls());
@@ -318,7 +417,8 @@
   // throttle should have been notified.
   test_handle()->Resume();
   EXPECT_FALSE(IsDeferringStart());
-  EXPECT_TRUE(IsDeferringRedirect());
+  EXPECT_FALSE(IsDeferringRedirect());
+  EXPECT_TRUE(IsCanceling());
   EXPECT_TRUE(was_callback_called());
   EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result());
   EXPECT_EQ(0, defer_throttle->will_start_calls());
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 252d5472..fbabed6d 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -287,7 +287,9 @@
   CHECK(result != NavigationThrottle::DEFER);
 
   // Abort the request if needed. This will destroy the NavigationRequest.
-  if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
+  if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
+      result == NavigationThrottle::CANCEL) {
+    // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
     frame_tree_node_->ResetNavigationRequest(false);
     return;
   }
@@ -302,7 +304,9 @@
   CHECK(result != NavigationThrottle::DEFER);
 
   // Abort the request if needed. This will destroy the NavigationRequest.
-  if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
+  if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
+      result == NavigationThrottle::CANCEL) {
+    // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
     frame_tree_node_->ResetNavigationRequest(false);
     return;
   }
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index da5e12d4..0492c26 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -271,7 +271,7 @@
   }
 
   cc::RenderPass* root_pass =
-      frame->delegated_frame_data->render_pass_list.back();
+      frame->delegated_frame_data->render_pass_list.back().get();
 
   gfx::Size frame_size = root_pass->output_rect.size();
   float scale_factor = frame->metadata.device_scale_factor;
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index b389e40..656f2e8 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -225,7 +225,7 @@
   }
 
   cc::RenderPass* root_pass =
-      frame->delegated_frame_data->render_pass_list.back();
+      frame->delegated_frame_data->render_pass_list.back().get();
 
   gfx::Size frame_size = root_pass->output_rect.size();
   float scale_factor = frame->metadata.device_scale_factor;
diff --git a/content/browser/loader/navigation_resource_throttle.cc b/content/browser/loader/navigation_resource_throttle.cc
index 3c76bae8..efb3ac9 100644
--- a/content/browser/loader/navigation_resource_throttle.cc
+++ b/content/browser/loader/navigation_resource_throttle.cc
@@ -162,6 +162,8 @@
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
     controller()->CancelAndIgnore();
+  } else if (result == NavigationThrottle::CANCEL) {
+    controller()->Cancel();
   } else {
     controller()->Resume();
   }
diff --git a/content/browser/net/view_http_cache_job_factory.cc b/content/browser/net/view_http_cache_job_factory.cc
index 823ced9c..22b408e 100644
--- a/content/browser/net/view_http_cache_job_factory.cc
+++ b/content/browser/net/view_http_cache_job_factory.cc
@@ -45,15 +45,8 @@
   bool GetCharset(std::string* charset) override {
     return core_->GetCharset(charset);
   }
-  bool ReadRawData(net::IOBuffer* buf,
-                   int buf_size,
-                   int* out_bytes_read) override {
-    size_t bytes_read;
-    if (!core_->ReadRawData(buf, base::checked_cast<size_t>(buf_size),
-                            &bytes_read))
-      return false;
-    *out_bytes_read = base::checked_cast<int>(bytes_read);
-    return true;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override {
+    return core_->ReadRawData(buf, buf_size);
   }
 
  private:
@@ -73,7 +66,7 @@
 
     bool GetMimeType(std::string* mime_type) const;
     bool GetCharset(std::string* charset);
-    bool ReadRawData(net::IOBuffer* buf, size_t buf_size, size_t* bytes_read);
+    int ReadRawData(net::IOBuffer* buf, int buf_size);
 
    private:
     friend class base::RefCounted<Core>;
@@ -172,18 +165,14 @@
   return true;
 }
 
-bool ViewHttpCacheJob::Core::ReadRawData(net::IOBuffer* buf,
-                                         size_t buf_size,
-                                         size_t* bytes_read) {
-  DCHECK(bytes_read);
+int ViewHttpCacheJob::Core::ReadRawData(net::IOBuffer* buf, int buf_size) {
   DCHECK_LE(data_offset_, data_.size());
-  size_t remaining = data_.size() - data_offset_;
+  int remaining = base::checked_cast<int>(data_.size() - data_offset_);
   if (buf_size > remaining)
     buf_size = remaining;
   memcpy(buf->data(), data_.data() + data_offset_, buf_size);
   data_offset_ += buf_size;
-  *bytes_read = buf_size;
-  return true;
+  return buf_size;
 }
 
 void ViewHttpCacheJob::Core::OnIOComplete(int result) {
diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
index 9ef2bd3..cdf857a 100644
--- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc
+++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
@@ -9,9 +9,11 @@
 #include "base/location.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
+#include "base/strings/string_number_conversions.h"
 #include "base/thread_task_runner_handle.h"
 #include "content/browser/browser_thread_impl.h"
 #include "content/browser/renderer_host/media/media_stream_manager.h"
+#include "content/browser/renderer_host/media/media_stream_requester.h"
 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
 #include "content/common/media/media_stream_options.h"
 #include "content/public/common/content_switches.h"
@@ -60,14 +62,14 @@
   return base::Bind(&ReturnMockSalt);
 }
 
-}  // namespace
-
 // This class mocks the audio manager and overrides the
 // GetAudioInputDeviceNames() method to ensure that we can run our tests on
 // the buildbots. media::AudioManagerBase
 class MockAudioManager : public AudioManagerPlatform {
  public:
-  MockAudioManager() : AudioManagerPlatform(&fake_audio_log_factory_) {}
+  MockAudioManager()
+      : AudioManagerPlatform(&fake_audio_log_factory_),
+        num_output_devices_(2) {}
   ~MockAudioManager() override {}
 
   void GetAudioInputDeviceNames(
@@ -81,11 +83,81 @@
     }
   }
 
+  void GetAudioOutputDeviceNames(
+      media::AudioDeviceNames* device_names) override {
+    DCHECK(device_names->empty());
+
+    // AudioManagers add a default device when there is at least one real device
+    if (num_output_devices_ > 0) {
+      device_names->push_back(media::AudioDeviceName(
+          "Default", AudioManagerBase::kDefaultDeviceId));
+    }
+    for (size_t i = 0; i < num_output_devices_; i++) {
+      device_names->push_back(media::AudioDeviceName(
+          std::string("fake_device_name_") + base::SizeTToString(i),
+          std::string("fake_device_id_") + base::SizeTToString(i)));
+    }
+  }
+
+  void SetNumAudioOutputDevices(size_t num_devices) {
+    num_output_devices_ = num_devices;
+  }
+
  private:
   media::FakeAudioLogFactory fake_audio_log_factory_;
+  size_t num_output_devices_;
   DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
 };
 
+class MockMediaStreamRequester : public MediaStreamRequester {
+ public:
+  MockMediaStreamRequester(base::RunLoop* run_loop, size_t num_expected_devices)
+      : run_loop_(run_loop), num_expected_devices_(num_expected_devices) {}
+  virtual ~MockMediaStreamRequester() {}
+
+  // MediaStreamRequester implementation.
+  MOCK_METHOD5(StreamGenerated,
+               void(int render_frame_id,
+                    int page_request_id,
+                    const std::string& label,
+                    const StreamDeviceInfoArray& audio_devices,
+                    const StreamDeviceInfoArray& video_devices));
+  MOCK_METHOD3(StreamGenerationFailed,
+               void(int render_frame_id,
+                    int page_request_id,
+                    content::MediaStreamRequestResult result));
+  MOCK_METHOD3(DeviceStopped,
+               void(int render_frame_id,
+                    const std::string& label,
+                    const StreamDeviceInfo& device));
+  void DevicesEnumerated(int render_frame_id,
+                         int page_request_id,
+                         const std::string& label,
+                         const StreamDeviceInfoArray& devices) override {
+    MockDevicesEnumerated(render_frame_id, page_request_id, label, devices);
+    EXPECT_EQ(num_expected_devices_, devices.size());
+
+    run_loop_->Quit();
+  }
+  MOCK_METHOD4(MockDevicesEnumerated,
+               void(int render_frame_id,
+                    int page_request_id,
+                    const std::string& label,
+                    const StreamDeviceInfoArray& devices));
+  MOCK_METHOD4(DeviceOpened,
+               void(int render_frame_id,
+                    int page_request_id,
+                    const std::string& label,
+                    const StreamDeviceInfo& device_info));
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockMediaStreamRequester);
+  base::RunLoop* run_loop_;
+  size_t num_expected_devices_;
+};
+
+}  // namespace
+
 class MediaStreamManagerTest : public ::testing::Test {
  public:
   MediaStreamManagerTest()
@@ -127,7 +199,7 @@
                                                          callback);
   }
 
-  scoped_ptr<media::AudioManager> audio_manager_;
+  scoped_ptr<MockAudioManager> audio_manager_;
   scoped_ptr<MediaStreamManager> media_stream_manager_;
   content::TestBrowserThreadBundle thread_bundle_;
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
@@ -228,4 +300,25 @@
     EXPECT_TRUE((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'));
 }
 
+TEST_F(MediaStreamManagerTest, EnumerationOutputDevices) {
+  for (size_t num_devices = 0; num_devices < 3; num_devices++) {
+    audio_manager_->SetNumAudioOutputDevices(num_devices);
+    base::RunLoop run_loop;
+    MockMediaStreamRequester requester(&run_loop,
+                                       num_devices == 0 ? 0 : num_devices + 1);
+    const int render_process_id = 1;
+    const int render_frame_id = 1;
+    const int page_request_id = 1;
+    const GURL security_origin("http://localhost");
+    EXPECT_CALL(requester,
+                MockDevicesEnumerated(render_frame_id, page_request_id, _, _));
+    std::string label = media_stream_manager_->EnumerateDevices(
+        &requester, render_process_id, render_frame_id, GetMockSaltCallback(),
+        page_request_id, MEDIA_DEVICE_AUDIO_OUTPUT, security_origin);
+    run_loop.Run();
+    // CancelRequest is necessary for enumeration requests.
+    media_stream_manager_->CancelRequest(label);
+  }
+}
+
 }  // namespace content
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 39034ec7..48f8e3f 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -214,6 +214,7 @@
 }
 
 void RenderMessageFilter::OnDestruct() const {
+  const_cast<RenderMessageFilter*>(this)->resource_context_ = nullptr;
   BrowserThread::DeleteOnIOThread::Destruct(this);
 }
 
@@ -399,6 +400,9 @@
                                       const Referrer& referrer,
                                       const base::string16& suggested_name,
                                       const bool use_prompt) const {
+  if (!resource_context_)
+    return;
+
   scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
   save_info->suggested_name = suggested_name;
   save_info->prompt_for_save_location = use_prompt;
@@ -566,6 +570,9 @@
                                    const std::string& challenge_string,
                                    const GURL& url,
                                    IPC::Message* reply_msg) {
+  if (!resource_context_)
+    return;
+
   // Map displayed strings indicating level of keysecurity in the <keygen>
   // menu to the key size in bits. (See SSLKeyGeneratorChromium.cpp in WebCore.)
   int key_size_in_bits;
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index abb3ff1..d825cf7c 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -1146,7 +1146,7 @@
   DCHECK(!frame->delegated_frame_data->render_pass_list.empty());
 
   cc::RenderPass* root_pass =
-      frame->delegated_frame_data->render_pass_list.back();
+      frame->delegated_frame_data->render_pass_list.back().get();
   texture_size_in_layer_ = root_pass->output_rect.size();
 
   cc::CompositorFrameMetadata metadata = frame->metadata;
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 278fa99ce7..8f6dab7 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1477,7 +1477,7 @@
 
     // Compute the frame size based on the root render pass rect size.
     cc::RenderPass* root_pass =
-        frame->delegated_frame_data->render_pass_list.back();
+        frame->delegated_frame_data->render_pass_list.back().get();
     gfx::Size pixel_size = root_pass->output_rect.size();
     gfx::Size dip_size = gfx::ConvertSizeToDIP(scale_factor, pixel_size);
 
diff --git a/content/browser/service_worker/PRESUBMIT.py b/content/browser/service_worker/PRESUBMIT.py
index 928d9fe0..c82402dc 100644
--- a/content/browser/service_worker/PRESUBMIT.py
+++ b/content/browser/service_worker/PRESUBMIT.py
@@ -12,3 +12,11 @@
   results = []
   results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
   return results
+
+# Add Blink tests to the default CQ try bots.
+def GetPreferredTryMasters(project, change):
+  return {
+    'tryserver.blink': {
+      'linux_blink_rel': set(['defaulttests']),
+    },
+  }
diff --git a/content/browser/service_worker/service_worker_read_from_cache_job.cc b/content/browser/service_worker/service_worker_read_from_cache_job.cc
index 93579911..6aa92af8 100644
--- a/content/browser/service_worker/service_worker_read_from_cache_job.cc
+++ b/content/browser/service_worker/service_worker_read_from_cache_job.cc
@@ -41,26 +41,9 @@
 }
 
 void ServiceWorkerReadFromCacheJob::Start() {
-  TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker",
-                           "ServiceWorkerReadFromCacheJob::ReadInfo", this,
-                           "URL", request_->url().spec());
-  if (!context_) {
-    NotifyStartError(
-        net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
-    return;
-  }
-
-  // Create a response reader and start reading the headers,
-  // we'll continue when thats done.
-  if (is_main_script())
-    version_->embedded_worker()->OnScriptReadStarted();
-  reader_ = context_->storage()->CreateResponseReader(resource_id_);
-  http_info_io_buffer_ = new HttpResponseInfoIOBuffer;
-  reader_->ReadInfo(
-      http_info_io_buffer_.get(),
-      base::Bind(&ServiceWorkerReadFromCacheJob::OnReadInfoComplete,
-                 weak_factory_.GetWeakPtr()));
-  SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+  base::ThreadTaskRunnerHandle::Get()->PostTask(
+      FROM_HERE, base::Bind(&ServiceWorkerReadFromCacheJob::StartAsync,
+                            weak_factory_.GetWeakPtr()));
 }
 
 void ServiceWorkerReadFromCacheJob::Kill() {
@@ -122,11 +105,9 @@
     range_requested_ = ranges[0];
 }
 
-bool ServiceWorkerReadFromCacheJob::ReadRawData(net::IOBuffer* buf,
-                                                int buf_size,
-                                                int* bytes_read) {
+int ServiceWorkerReadFromCacheJob::ReadRawData(net::IOBuffer* buf,
+                                               int buf_size) {
   DCHECK_NE(buf_size, 0);
-  DCHECK(bytes_read);
   DCHECK(!reader_->IsReadPending());
   TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker",
                            "ServiceWorkerReadFromCacheJob::ReadRawData",
@@ -135,8 +116,31 @@
   reader_->ReadData(buf, buf_size,
                     base::Bind(&ServiceWorkerReadFromCacheJob::OnReadComplete,
                                weak_factory_.GetWeakPtr()));
+  return net::ERR_IO_PENDING;
+}
+
+void ServiceWorkerReadFromCacheJob::StartAsync() {
+  TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker",
+                           "ServiceWorkerReadFromCacheJob::ReadInfo", this,
+                           "URL", request_->url().spec());
+  if (!context_) {
+    // NotifyStartError is not safe to call synchronously in Start.
+    NotifyStartError(
+        net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
+    return;
+  }
+
+  // Create a response reader and start reading the headers,
+  // we'll continue when thats done.
+  if (is_main_script())
+    version_->embedded_worker()->OnScriptReadStarted();
+  reader_ = context_->storage()->CreateResponseReader(resource_id_);
+  http_info_io_buffer_ = new HttpResponseInfoIOBuffer;
+  reader_->ReadInfo(
+      http_info_io_buffer_.get(),
+      base::Bind(&ServiceWorkerReadFromCacheJob::OnReadInfoComplete,
+                 weak_factory_.GetWeakPtr()));
   SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-  return false;
 }
 
 const net::HttpResponseInfo* ServiceWorkerReadFromCacheJob::http_info() const {
@@ -154,6 +158,8 @@
     ServiceWorkerMetrics::CountReadResponseResult(
         ServiceWorkerMetrics::READ_HEADERS_ERROR);
     Done(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
+    NotifyStartError(
+        net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
     return;
   }
   DCHECK_GE(result, 0);
@@ -207,23 +213,22 @@
   }
   if (is_main_script())
     version_->embedded_worker()->OnScriptReadFinished();
-  NotifyDone(status);
 }
 
 void ServiceWorkerReadFromCacheJob::OnReadComplete(int result) {
   ServiceWorkerMetrics::ReadResponseResult check_result;
-  if (result == 0) {
+
+  if (result >= 0) {
     check_result = ServiceWorkerMetrics::READ_OK;
-    Done(net::URLRequestStatus());
-  } else if (result < 0) {
+    if (result == 0)
+      Done(net::URLRequestStatus());
+  } else {
     check_result = ServiceWorkerMetrics::READ_DATA_ERROR;
     Done(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
-  } else {
-    check_result = ServiceWorkerMetrics::READ_OK;
-    SetStatus(net::URLRequestStatus());  // Clear the IO_PENDING status
   }
+
   ServiceWorkerMetrics::CountReadResponseResult(check_result);
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
   TRACE_EVENT_ASYNC_END1("ServiceWorker",
                          "ServiceWorkerReadFromCacheJob::ReadRawData",
                          this,
diff --git a/content/browser/service_worker/service_worker_read_from_cache_job.h b/content/browser/service_worker/service_worker_read_from_cache_job.h
index fccde7a..a62893d 100644
--- a/content/browser/service_worker/service_worker_read_from_cache_job.h
+++ b/content/browser/service_worker/service_worker_read_from_cache_job.h
@@ -51,13 +51,14 @@
   void GetResponseInfo(net::HttpResponseInfo* info) override;
   int GetResponseCode() const override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
 
   // Reader completion callbacks.
   void OnReadInfoComplete(int result);
   void OnReadComplete(int result);
 
   // Helpers
+  void StartAsync();
   const net::HttpResponseInfo* http_info() const;
   bool is_range_request() const { return range_requested_.IsValid(); }
   void SetupRangeResponse(int response_data_size);
diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc
index 15c85a1..143e354 100644
--- a/content/browser/service_worker/service_worker_url_request_job.cc
+++ b/content/browser/service_worker/service_worker_url_request_job.cc
@@ -203,50 +203,44 @@
     byte_range_ = ranges[0];
 }
 
-bool ServiceWorkerURLRequestJob::ReadRawData(net::IOBuffer* buf,
-                                             int buf_size,
-                                             int* bytes_read) {
+int ServiceWorkerURLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
   DCHECK(buf);
   DCHECK_GE(buf_size, 0);
-  DCHECK(bytes_read);
   DCHECK(waiting_stream_url_.is_empty());
+
+  int bytes_read = 0;
+
   if (stream_.get()) {
-    switch (stream_->ReadRawData(buf, buf_size, bytes_read)) {
+    switch (stream_->ReadRawData(buf, buf_size, &bytes_read)) {
       case Stream::STREAM_HAS_DATA:
-        DCHECK_GT(*bytes_read, 0);
-        return true;
+        DCHECK_GT(bytes_read, 0);
+        return bytes_read;
       case Stream::STREAM_COMPLETE:
-        DCHECK(!*bytes_read);
+        DCHECK_EQ(0, bytes_read);
         RecordResult(ServiceWorkerMetrics::REQUEST_JOB_STREAM_RESPONSE);
-        return true;
+        return 0;
       case Stream::STREAM_EMPTY:
         stream_pending_buffer_ = buf;
         stream_pending_buffer_size_ = buf_size;
-        SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-        return false;
+        return net::ERR_IO_PENDING;
       case Stream::STREAM_ABORTED:
         // Handle this as connection reset.
         RecordResult(ServiceWorkerMetrics::REQUEST_JOB_ERROR_STREAM_ABORTED);
-        NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                         net::ERR_CONNECTION_RESET));
-        return false;
+        return net::ERR_CONNECTION_RESET;
     }
     NOTREACHED();
-    return false;
+    return net::ERR_FAILED;
   }
 
-  if (!blob_request_) {
-    *bytes_read = 0;
-    return true;
-  }
-  blob_request_->Read(buf, buf_size, bytes_read);
+  if (!blob_request_)
+    return 0;
+  blob_request_->Read(buf, buf_size, &bytes_read);
   net::URLRequestStatus status = blob_request_->status();
-  SetStatus(status);
-  if (status.is_io_pending())
-    return false;
-  if (status.is_success() && *bytes_read == 0)
+  if (status.status() != net::URLRequestStatus::SUCCESS)
+    return status.error();
+  if (bytes_read == 0)
     RecordResult(ServiceWorkerMetrics::REQUEST_JOB_BLOB_RESPONSE);
-  return status.is_success();
+  return bytes_read;
 }
 
 // TODO(falken): Refactor Blob and Stream specific handling to separate classes.
@@ -292,29 +286,18 @@
 
 void ServiceWorkerURLRequestJob::OnReadCompleted(net::URLRequest* request,
                                                  int bytes_read) {
-  SetStatus(request->status());
   if (!request->status().is_success()) {
     RecordResult(ServiceWorkerMetrics::REQUEST_JOB_ERROR_BLOB_READ);
-    NotifyDone(request->status());
-    return;
-  }
-
-  if (bytes_read == 0) {
-    // Protect because NotifyReadComplete() can destroy |this|.
-    scoped_refptr<ServiceWorkerURLRequestJob> protect(this);
+  } else if (bytes_read == 0) {
     RecordResult(ServiceWorkerMetrics::REQUEST_JOB_BLOB_RESPONSE);
-    NotifyReadComplete(bytes_read);
-    NotifyDone(request->status());
-    return;
   }
-  NotifyReadComplete(bytes_read);
+  net::URLRequestStatus status = request->status();
+  ReadRawDataComplete(status.is_success() ? bytes_read : status.error());
 }
 
 // Overrides for Stream reading -----------------------------------------------
 
 void ServiceWorkerURLRequestJob::OnDataAvailable(Stream* stream) {
-  // Clear the IO_PENDING status.
-  SetStatus(net::URLRequestStatus());
   // Do nothing if stream_pending_buffer_ is empty, i.e. there's no ReadRawData
   // operation waiting for IO completion.
   if (!stream_pending_buffer_.get())
@@ -323,15 +306,15 @@
   // stream_pending_buffer_ is set to the IOBuffer instance provided to
   // ReadRawData() by URLRequestJob.
 
-  int bytes_read = 0;
+  int result = 0;
   switch (stream_->ReadRawData(stream_pending_buffer_.get(),
-                               stream_pending_buffer_size_, &bytes_read)) {
+                               stream_pending_buffer_size_, &result)) {
     case Stream::STREAM_HAS_DATA:
-      DCHECK_GT(bytes_read, 0);
+      DCHECK_GT(result, 0);
       break;
     case Stream::STREAM_COMPLETE:
       // Calling NotifyReadComplete with 0 signals completion.
-      DCHECK(!bytes_read);
+      DCHECK(!result);
       RecordResult(ServiceWorkerMetrics::REQUEST_JOB_STREAM_RESPONSE);
       break;
     case Stream::STREAM_EMPTY:
@@ -339,9 +322,8 @@
       break;
     case Stream::STREAM_ABORTED:
       // Handle this as connection reset.
+      result = net::ERR_CONNECTION_RESET;
       RecordResult(ServiceWorkerMetrics::REQUEST_JOB_ERROR_STREAM_ABORTED);
-      NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                       net::ERR_CONNECTION_RESET));
       break;
   }
 
@@ -349,7 +331,7 @@
   // safe for the observer to read.
   stream_pending_buffer_ = nullptr;
   stream_pending_buffer_size_ = 0;
-  NotifyReadComplete(bytes_read);
+  ReadRawDataComplete(result);
 }
 
 void ServiceWorkerURLRequestJob::OnStreamRegistered(Stream* stream) {
@@ -645,7 +627,7 @@
   // error.
   if (response.status_code == 0) {
     RecordStatusZeroResponseError(response.error);
-    NotifyDone(
+    NotifyStartError(
         net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
     return;
   }
diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h
index 4815c0b..2a50c94 100644
--- a/content/browser/service_worker/service_worker_url_request_job.h
+++ b/content/browser/service_worker/service_worker_url_request_job.h
@@ -87,7 +87,7 @@
   void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
   int GetResponseCode() const override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
 
   // net::URLRequest::Delegate overrides that read the blob from the
   // ServiceWorkerFetchResponse.
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.cc b/content/browser/service_worker/service_worker_write_to_cache_job.cc
index 24bcd0f4..ba605c06 100644
--- a/content/browser/service_worker/service_worker_write_to_cache_job.cc
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.cc
@@ -7,6 +7,7 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/strings/stringprintf.h"
+#include "base/thread_task_runner_handle.h"
 #include "base/trace_event/trace_event.h"
 #include "content/browser/service_worker/service_worker_cache_writer.h"
 #include "content/browser/service_worker/service_worker_context_core.h"
@@ -47,7 +48,7 @@
 // developers.
 // TODO(falken): Redesign this class so we don't have to fail at the network
 // stack layer just to cancel the update.
-const int kIdenticalScriptError = net::ERR_FILE_EXISTS;
+const net::Error kIdenticalScriptError = net::ERR_FILE_EXISTS;
 
 }  // namespace
 
@@ -79,11 +80,18 @@
 }
 
 void ServiceWorkerWriteToCacheJob::Start() {
+  base::ThreadTaskRunnerHandle::Get()->PostTask(
+      FROM_HERE, base::Bind(&ServiceWorkerWriteToCacheJob::StartAsync,
+                            weak_factory_.GetWeakPtr()));
+}
+
+void ServiceWorkerWriteToCacheJob::StartAsync() {
   TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker",
                            "ServiceWorkerWriteToCacheJob::ExecutingJob",
                            this,
                            "URL", request_->url().spec());
   if (!context_) {
+    // NotifyStartError is not safe to call synchronously in Start().
     NotifyStartError(
         net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
     return;
@@ -108,8 +116,9 @@
   has_been_killed_ = true;
   net_request_.reset();
   if (did_notify_started_) {
-    NotifyFinishedCaching(net::URLRequestStatus::FromError(net::ERR_ABORTED),
-                          kKilledError);
+    net::Error error = NotifyFinishedCaching(
+        net::URLRequestStatus::FromError(net::ERR_ABORTED), kKilledError);
+    DCHECK_EQ(net::ERR_ABORTED, error);
   }
   writer_.reset();
   context_.reset();
@@ -156,40 +165,20 @@
   net_request_->SetExtraRequestHeaders(headers);
 }
 
-bool ServiceWorkerWriteToCacheJob::ReadRawData(net::IOBuffer* buf,
-                                               int buf_size,
-                                               int* bytes_read) {
-  net::URLRequestStatus status = ReadNetData(buf, buf_size, bytes_read);
-  SetStatus(status);
+int ServiceWorkerWriteToCacheJob::ReadRawData(net::IOBuffer* buf,
+                                              int buf_size) {
+  int bytes_read = 0;
+  net::URLRequestStatus status = ReadNetData(buf, buf_size, &bytes_read);
   if (status.is_io_pending())
-    return false;
+    return net::ERR_IO_PENDING;
 
   if (!status.is_success()) {
-    NotifyDoneHelper(status, kFetchScriptError);
-    return false;
+    net::Error error = NotifyFinishedCaching(status, kFetchScriptError);
+    DCHECK_EQ(status.error(), error);
+    return error;
   }
 
-  HandleNetData(*bytes_read);
-  status = GetStatus();
-
-  // Synchronous EOFs that do not replace the incumbent entry are considered
-  // failures. Since normally the URLRequestJob's status would be set by
-  // ReadNetData or HandleNetData, this code has to manually fix up the status
-  // to match the failure this function is about to return.
-  if (status.status() == net::URLRequestStatus::SUCCESS && *bytes_read == 0 &&
-      !cache_writer_->did_replace()) {
-    status = net::URLRequestStatus::FromError(kIdenticalScriptError);
-  }
-
-  if (!status.is_success()) {
-    NotifyDoneHelper(status, "");
-    return false;
-  }
-
-  // Since URLRequestStatus::is_success() means "SUCCESS or IO_PENDING", but the
-  // contract of this function is "return true for synchronous successes only",
-  // it is important to test against SUCCESS explicitly here.
-  return status.status() == net::URLRequestStatus::SUCCESS;
+  return HandleNetData(bytes_read);
 }
 
 const net::HttpResponseInfo* ServiceWorkerWriteToCacheJob::http_info() const {
@@ -244,9 +233,9 @@
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerWriteToCacheJob::OnReceivedRedirect");
   // Script resources can't redirect.
-  NotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                         net::ERR_UNSAFE_REDIRECT),
-                   kRedirectError);
+  NotifyStartErrorHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                               net::ERR_UNSAFE_REDIRECT),
+                         kRedirectError);
 }
 
 void ServiceWorkerWriteToCacheJob::OnAuthRequired(
@@ -256,7 +245,7 @@
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerWriteToCacheJob::OnAuthRequired");
   // TODO(michaeln): Pass this thru to our jobs client.
-  NotifyDoneHelper(
+  NotifyStartErrorHelper(
       net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED),
       kClientAuthenticationError);
 }
@@ -269,7 +258,7 @@
                "ServiceWorkerWriteToCacheJob::OnCertificateRequested");
   // TODO(michaeln): Pass this thru to our jobs client.
   // see NotifyCertificateRequested.
-  NotifyDoneHelper(
+  NotifyStartErrorHelper(
       net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED),
       kClientAuthenticationError);
 }
@@ -283,9 +272,9 @@
                "ServiceWorkerWriteToCacheJob::OnSSLCertificateError");
   // TODO(michaeln): Pass this thru to our jobs client,
   // see NotifySSLCertificateError.
-  NotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                         net::ERR_INSECURE_RESPONSE),
-                   kSSLError);
+  NotifyStartErrorHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                               net::ERR_INSECURE_RESPONSE),
+                         kSSLError);
 }
 
 void ServiceWorkerWriteToCacheJob::OnBeforeNetworkStart(
@@ -301,15 +290,15 @@
     net::URLRequest* request) {
   DCHECK_EQ(net_request_.get(), request);
   if (!request->status().is_success()) {
-    NotifyDoneHelper(request->status(), kFetchScriptError);
+    NotifyStartErrorHelper(request->status(), kFetchScriptError);
     return;
   }
   if (request->GetResponseCode() / 100 != 2) {
     std::string error_message =
         base::StringPrintf(kBadHTTPResponseError, request->GetResponseCode());
-    NotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                           net::ERR_INVALID_RESPONSE),
-                     error_message);
+    NotifyStartErrorHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                                 net::ERR_INVALID_RESPONSE),
+                           error_message);
     // TODO(michaeln): Instead of error'ing immediately, send the net
     // response to our consumer, just don't cache it?
     return;
@@ -320,9 +309,10 @@
     const net::HttpNetworkSession::Params* session_params =
         request->context()->GetNetworkSessionParams();
     if (!session_params || !session_params->ignore_certificate_errors) {
-      NotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                             net::ERR_INSECURE_RESPONSE),
-                       kSSLError);
+      NotifyStartErrorHelper(
+          net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                net::ERR_INSECURE_RESPONSE),
+          kSSLError);
       return;
     }
   }
@@ -337,9 +327,10 @@
           mime_type.empty()
               ? kNoMIMEError
               : base::StringPrintf(kBadMIMEError, mime_type.c_str());
-      NotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                             net::ERR_INSECURE_RESPONSE),
-                       error_message);
+      NotifyStartErrorHelper(
+          net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                net::ERR_INSECURE_RESPONSE),
+          error_message);
       return;
     }
 
@@ -375,52 +366,31 @@
   NotifyHeadersComplete();
 }
 
-void ServiceWorkerWriteToCacheJob::HandleNetData(int bytes_read) {
-  io_buffer_bytes_ = bytes_read;
-  net::Error error = cache_writer_->MaybeWriteData(
-      io_buffer_.get(), bytes_read,
-      base::Bind(&ServiceWorkerWriteToCacheJob::OnWriteDataComplete,
-                 weak_factory_.GetWeakPtr()));
-  SetStatus(net::URLRequestStatus::FromError(error));
-
-  // In case of ERR_IO_PENDING, this logic is done in OnWriteDataComplete.
-  if (error != net::ERR_IO_PENDING && bytes_read == 0) {
-    NotifyFinishedCaching(net::URLRequestStatus::FromError(error),
-                          std::string());
-  }
-}
-
 void ServiceWorkerWriteToCacheJob::OnWriteDataComplete(net::Error error) {
   SetStatus(net::URLRequestStatus::FromError(error));
   DCHECK_NE(net::ERR_IO_PENDING, error);
-  if (io_buffer_bytes_ == 0) {
-    NotifyDoneHelper(net::URLRequestStatus::FromError(error), std::string());
-  }
-  NotifyReadComplete(error == net::OK ? io_buffer_bytes_ : error);
+  if (io_buffer_bytes_ == 0)
+    error = NotifyFinishedCaching(net::URLRequestStatus::FromError(error), "");
+  ReadRawDataComplete(error == net::OK ? io_buffer_bytes_ : error);
 }
 
 void ServiceWorkerWriteToCacheJob::OnReadCompleted(net::URLRequest* request,
                                                    int bytes_read) {
   DCHECK_EQ(net_request_.get(), request);
+
+  int result;
   if (bytes_read < 0) {
     DCHECK(!request->status().is_success());
-    NotifyDoneHelper(request->status(), kFetchScriptError);
+    result = NotifyFinishedCaching(request->status(), kFetchScriptError);
+  } else {
+    result = HandleNetData(bytes_read);
+  }
+
+  // ReadRawDataComplete will be called in OnWriteDataComplete, so return early.
+  if (result == net::ERR_IO_PENDING)
     return;
-  }
-  HandleNetData(bytes_read);
-  // HandleNetData can cause status of this job to change. If the status changes
-  // to IO_PENDING, that means HandleNetData has pending IO, and
-  // NotifyReadComplete will be called later by the appropriate callback.
-  if (!GetStatus().is_io_pending()) {
-    int result = GetStatus().status() == net::URLRequestStatus::SUCCESS
-                     ? bytes_read
-                     : GetStatus().error();
-    // If bytes_read is 0, HandleNetData synchronously completed and this job is
-    // at EOF.
-    if (bytes_read == 0)
-      NotifyDoneHelper(GetStatus(), std::string());
-    NotifyReadComplete(result);
-  }
+
+  ReadRawDataComplete(result);
 }
 
 bool ServiceWorkerWriteToCacheJob::CheckPathRestriction(
@@ -434,43 +404,57 @@
   if (!ServiceWorkerUtils::IsPathRestrictionSatisfied(
           version_->scope(), url_,
           has_header ? &service_worker_allowed : nullptr, &error_message)) {
-    NotifyDoneHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                           net::ERR_INSECURE_RESPONSE),
-                     error_message);
+    NotifyStartErrorHelper(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+                                                 net::ERR_INSECURE_RESPONSE),
+                           error_message);
     return false;
   }
   return true;
 }
 
-void ServiceWorkerWriteToCacheJob::NotifyDoneHelper(
+int ServiceWorkerWriteToCacheJob::HandleNetData(int bytes_read) {
+  io_buffer_bytes_ = bytes_read;
+  net::Error error = cache_writer_->MaybeWriteData(
+      io_buffer_.get(), bytes_read,
+      base::Bind(&ServiceWorkerWriteToCacheJob::OnWriteDataComplete,
+                 weak_factory_.GetWeakPtr()));
+
+  // In case of ERR_IO_PENDING, this logic is done in OnWriteDataComplete.
+  if (error != net::ERR_IO_PENDING && bytes_read == 0) {
+    error = NotifyFinishedCaching(net::URLRequestStatus::FromError(error),
+                                  std::string());
+  }
+  return error == net::OK ? bytes_read : error;
+}
+
+void ServiceWorkerWriteToCacheJob::NotifyStartErrorHelper(
     const net::URLRequestStatus& status,
     const std::string& status_message) {
   DCHECK(!status.is_io_pending());
 
-  // Note that NotifyFinishedCaching has logic in it to detect the special case
-  // mentioned below as well.
-  NotifyFinishedCaching(status, status_message);
+  net::Error error = NotifyFinishedCaching(status, status_message);
+  // The special case mentioned in NotifyFinishedCaching about script being
+  // identical does not apply here, since the entire body needs to be read
+  // before this is relevant.
+  DCHECK_EQ(status.error(), error);
 
   net::URLRequestStatus reported_status = status;
   std::string reported_status_message = status_message;
 
-  // A strange special case: requests that successfully fetch the entire
-  // ServiceWorker and write it back, but which did not replace the incumbent
-  // script because the new script was identical, are considered to have failed.
-  if (status.is_success() && !cache_writer_->did_replace()) {
-    reported_status = net::URLRequestStatus::FromError(kIdenticalScriptError);
-    reported_status_message = "";
-  }
-
   SetStatus(reported_status);
-  NotifyDone(reported_status);
+  NotifyStartError(reported_status);
 }
 
-void ServiceWorkerWriteToCacheJob::NotifyFinishedCaching(
+net::Error ServiceWorkerWriteToCacheJob::NotifyFinishedCaching(
     net::URLRequestStatus status,
     const std::string& status_message) {
+  net::Error result = static_cast<net::Error>(status.error());
   if (did_notify_finished_)
-    return;
+    return result;
+
+  int size = -1;
+  if (status.is_success())
+    size = cache_writer_->bytes_written();
 
   // If all the calls to MaybeWriteHeaders/MaybeWriteData succeeded, but the
   // incumbent entry wasn't actually replaced because the new entry was
@@ -478,17 +462,18 @@
   // exists.
   if (status.status() == net::URLRequestStatus::SUCCESS &&
       !cache_writer_->did_replace()) {
-    status = net::URLRequestStatus::FromError(kIdenticalScriptError);
+    result = kIdenticalScriptError;
+    status = net::URLRequestStatus::FromError(result);
     version_->SetStartWorkerStatusCode(SERVICE_WORKER_ERROR_EXISTS);
+    version_->script_cache_map()->NotifyFinishedCaching(url_, size, status,
+                                                        std::string());
+  } else {
+    version_->script_cache_map()->NotifyFinishedCaching(url_, size, status,
+                                                        status_message);
   }
 
-  int size = -1;
-  if (status.is_success())
-    size = cache_writer_->bytes_written();
-
-  version_->script_cache_map()->NotifyFinishedCaching(url_, size, status,
-                                                      status_message);
   did_notify_finished_ = true;
+  return result;
 }
 
 scoped_ptr<ServiceWorkerResponseReader>
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.h b/content/browser/service_worker/service_worker_write_to_cache_job.h
index 92272399..e614912 100644
--- a/content/browser/service_worker/service_worker_write_to_cache_job.h
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.h
@@ -64,6 +64,7 @@
 
   // net::URLRequestJob overrides
   void Start() override;
+  void StartAsync();
   void Kill() override;
   net::LoadState GetLoadState() const override;
   bool GetCharset(std::string* charset) override;
@@ -71,7 +72,7 @@
   void GetResponseInfo(net::HttpResponseInfo* info) override;
   int GetResponseCode() const override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
 
   const net::HttpResponseInfo* http_info() const;
 
@@ -109,18 +110,22 @@
   bool CheckPathRestriction(net::URLRequest* request);
 
   // Writes network data back to the script cache if needed, and notifies the
-  // script cache of fetch completion at EOF. This function might need to do
-  // asynchronous IO; if so, it signals this through setting the URLRequestJob's
-  // status to IO_PENDING. After this function returns, if the URLRequestJob
-  // isn't IO_PENDING, all of the data in |io_buffer_| has been written back to
-  // the script cache if necessary.
-  void HandleNetData(int bytes_read);
+  // script cache of fetch completion at EOF. This function returns
+  // net::IO_PENDING if the IO is to be completed asynchronously, returns a
+  // negative number that represents a corresponding net error code (other than
+  // net::IO_PENDING) if an error occurred, or returns a non-negative number
+  // that represents the number of network bytes read. If the return value is
+  // non-negative, all of the data in |io_buffer_| has been written back to the
+  // script cache if necessary.
+  int HandleNetData(int bytes_read);
 
-  void NotifyDoneHelper(const net::URLRequestStatus& status,
-                        const std::string& status_message);
+  void NotifyStartErrorHelper(const net::URLRequestStatus& status,
+                              const std::string& status_message);
 
-  void NotifyFinishedCaching(net::URLRequestStatus status,
-                             const std::string& status_message);
+  // Returns an error code that is passed in through |status| or a new one if an
+  // additional error is found.
+  net::Error NotifyFinishedCaching(net::URLRequestStatus status,
+                                   const std::string& status_message);
 
   scoped_ptr<ServiceWorkerResponseReader> CreateCacheResponseReader();
   scoped_ptr<ServiceWorkerResponseWriter> CreateCacheResponseWriter();
@@ -140,6 +145,7 @@
   bool has_been_killed_;
   bool did_notify_started_;
   bool did_notify_finished_;
+
   base::WeakPtrFactory<ServiceWorkerWriteToCacheJob> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(ServiceWorkerWriteToCacheJob);
diff --git a/content/browser/streams/stream_url_request_job.cc b/content/browser/streams/stream_url_request_job.cc
index 0392d108f..e26fe35 100644
--- a/content/browser/streams/stream_url_request_job.cc
+++ b/content/browser/streams/stream_url_request_job.cc
@@ -40,8 +40,6 @@
 }
 
 void StreamURLRequestJob::OnDataAvailable(Stream* stream) {
-  // Clear the IO_PENDING status.
-  SetStatus(net::URLRequestStatus());
   // Do nothing if pending_buffer_ is empty, i.e. there's no ReadRawData()
   // operation waiting for IO completion.
   if (!pending_buffer_.get())
@@ -50,24 +48,22 @@
   // pending_buffer_ is set to the IOBuffer instance provided to ReadRawData()
   // by URLRequestJob.
 
-  int bytes_read;
+  int result = 0;
   switch (stream_->ReadRawData(pending_buffer_.get(), pending_buffer_size_,
-                               &bytes_read)) {
+                               &result)) {
     case Stream::STREAM_HAS_DATA:
-      DCHECK_GT(bytes_read, 0);
+      DCHECK_GT(result, 0);
       break;
     case Stream::STREAM_COMPLETE:
-      // Ensure this. Calling NotifyReadComplete call with 0 signals
-      // completion.
-      bytes_read = 0;
+      // Ensure ReadRawData gives net::OK.
+      DCHECK_EQ(net::OK, result);
       break;
     case Stream::STREAM_EMPTY:
       NOTREACHED();
       break;
     case Stream::STREAM_ABORTED:
       // Handle this as connection reset.
-      NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                       net::ERR_CONNECTION_RESET));
+      result = net::ERR_CONNECTION_RESET;
       break;
   }
 
@@ -76,8 +72,9 @@
   pending_buffer_ = NULL;
   pending_buffer_size_ = 0;
 
-  total_bytes_read_ += bytes_read;
-  NotifyReadComplete(bytes_read);
+  if (result > 0)
+    total_bytes_read_ += result;
+  ReadRawDataComplete(result);
 }
 
 // net::URLRequestJob methods.
@@ -94,43 +91,40 @@
   ClearStream();
 }
 
-bool StreamURLRequestJob::ReadRawData(net::IOBuffer* buf,
-                                      int buf_size,
-                                      int* bytes_read) {
+int StreamURLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
+  // TODO(ellyjones): This is not right. The old code returned true here, but
+  // ReadRawData's old contract was to return true only for synchronous
+  // successes, which had the effect of treating all errors as synchronous EOFs.
+  // See https://crbug.com/508957
   if (request_failed_)
-    return true;
+    return 0;
 
   DCHECK(buf);
-  DCHECK(bytes_read);
   int to_read = buf_size;
   if (max_range_ && to_read) {
     if (to_read + total_bytes_read_ > max_range_)
       to_read = max_range_ - total_bytes_read_;
 
-    if (to_read <= 0) {
-      *bytes_read = 0;
-      return true;
-    }
+    if (to_read == 0)
+      return 0;
   }
 
-  switch (stream_->ReadRawData(buf, to_read, bytes_read)) {
+  int bytes_read = 0;
+  switch (stream_->ReadRawData(buf, to_read, &bytes_read)) {
     case Stream::STREAM_HAS_DATA:
     case Stream::STREAM_COMPLETE:
-      total_bytes_read_ += *bytes_read;
-      return true;
+      total_bytes_read_ += bytes_read;
+      return bytes_read;
     case Stream::STREAM_EMPTY:
       pending_buffer_ = buf;
       pending_buffer_size_ = to_read;
-      SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-      return false;
+      return net::ERR_IO_PENDING;
     case Stream::STREAM_ABORTED:
       // Handle this as connection reset.
-      NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                       net::ERR_CONNECTION_RESET));
-      return false;
+      return net::ERR_CONNECTION_RESET;
   }
   NOTREACHED();
-  return false;
+  return net::ERR_FAILED;
 }
 
 bool StreamURLRequestJob::GetMimeType(std::string* mime_type) const {
@@ -189,13 +183,8 @@
 void StreamURLRequestJob::NotifyFailure(int error_code) {
   request_failed_ = true;
 
-  // If we already return the headers on success, we can't change the headers
-  // now. Instead, we just error out.
-  if (headers_set_) {
-    NotifyDone(
-        net::URLRequestStatus(net::URLRequestStatus::FAILED, error_code));
-    return;
-  }
+  // This method can only be called before headers are set.
+  DCHECK(!headers_set_);
 
   // TODO(zork): Share these with BlobURLRequestJob.
   net::HttpStatusCode status_code = net::HTTP_INTERNAL_SERVER_ERROR;
diff --git a/content/browser/streams/stream_url_request_job.h b/content/browser/streams/stream_url_request_job.h
index 05c9551..f22311d 100644
--- a/content/browser/streams/stream_url_request_job.h
+++ b/content/browser/streams/stream_url_request_job.h
@@ -29,7 +29,7 @@
   // net::URLRequestJob methods.
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool GetMimeType(std::string* mime_type) const override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
   int GetResponseCode() const override;
diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc
index 44302df1..485aff6 100644
--- a/content/browser/webui/url_data_manager_backend.cc
+++ b/content/browser/webui/url_data_manager_backend.cc
@@ -119,7 +119,7 @@
   // net::URLRequestJob implementation.
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool GetMimeType(std::string* mime_type) const override;
   int GetResponseCode() const override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
@@ -190,8 +190,9 @@
   bool RequiresUnsafeEval() const;
 
   // Do the actual copy from data_ (the data we're serving) into |buf|.
-  // Separate from ReadRawData so we can handle async I/O.
-  void CompleteRead(net::IOBuffer* buf, int buf_size, int* bytes_read);
+  // Separate from ReadRawData so we can handle async I/O. Returns the number of
+  // bytes read.
+  int CompleteRead(net::IOBuffer* buf, int buf_size);
 
   // The actual data we're serving.  NULL until it's been fetched.
   scoped_refptr<base::RefCountedMemory> data_;
@@ -336,22 +337,16 @@
 void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) {
   TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this);
   if (bytes) {
-    // The request completed, and we have all the data.
-    // Clear any IO pending status.
-    SetStatus(net::URLRequestStatus());
-
     data_ = bytes;
-    int bytes_read;
     if (pending_buf_.get()) {
       CHECK(pending_buf_->data());
-      CompleteRead(pending_buf_.get(), pending_buf_size_, &bytes_read);
+      int result = CompleteRead(pending_buf_.get(), pending_buf_size_);
       pending_buf_ = NULL;
-      NotifyReadComplete(bytes_read);
+      ReadRawDataComplete(result);
     }
   } else {
     // The request failed.
-    NotifyDone(
-        net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
+    ReadRawDataComplete(net::ERR_FAILED);
   }
 }
 
@@ -359,27 +354,21 @@
   return weak_factory_.GetWeakPtr();
 }
 
-bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf,
-                                      int buf_size,
-                                      int* bytes_read) {
+int URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
   if (!data_.get()) {
-    SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
     DCHECK(!pending_buf_.get());
     CHECK(buf->data());
     pending_buf_ = buf;
     pending_buf_size_ = buf_size;
-    return false;  // Tell the caller we're still waiting for data.
+    return net::ERR_IO_PENDING;
   }
 
   // Otherwise, the data is available.
-  CompleteRead(buf, buf_size, bytes_read);
-  return true;
+  return CompleteRead(buf, buf_size);
 }
 
-void URLRequestChromeJob::CompleteRead(net::IOBuffer* buf,
-                                       int buf_size,
-                                       int* bytes_read) {
-  int remaining = static_cast<int>(data_->size()) - data_offset_;
+int URLRequestChromeJob::CompleteRead(net::IOBuffer* buf, int buf_size) {
+  int remaining = data_->size() - data_offset_;
   if (buf_size > remaining)
     buf_size = remaining;
   if (buf_size > 0) {
@@ -391,7 +380,7 @@
     memcpy(buf->data(), data_->front() + data_offset_, buf_size);
     data_offset_ += buf_size;
   }
-  *bytes_read = buf_size;
+  return buf_size;
 }
 
 void URLRequestChromeJob::CheckStoragePartitionMatches(
diff --git a/content/child/service_worker/PRESUBMIT.py b/content/child/service_worker/PRESUBMIT.py
index 928d9fe0..c82402dc 100644
--- a/content/child/service_worker/PRESUBMIT.py
+++ b/content/child/service_worker/PRESUBMIT.py
@@ -12,3 +12,11 @@
   results = []
   results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
   return results
+
+# Add Blink tests to the default CQ try bots.
+def GetPreferredTryMasters(project, change):
+  return {
+    'tryserver.blink': {
+      'linux_blink_rel': set(['defaulttests']),
+    },
+  }
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index 5285d59c..55b2b9a 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -707,14 +707,19 @@
                "Thread ID", thread_id,
                "Provider ID", provider_id);
 
+  // Adopt the reference sent from the browser process and pass it to the
+  // provider context if it exists.
+  scoped_ptr<ServiceWorkerHandleReference> handle_ref =
+      ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
   ProviderContextMap::iterator provider = provider_contexts_.find(provider_id);
   if (provider != provider_contexts_.end())
-    provider->second->OnSetControllerServiceWorker(info);
+    provider->second->OnSetControllerServiceWorker(handle_ref.Pass());
 
   ProviderClientMap::iterator found = provider_clients_.find(provider_id);
   if (found != provider_clients_.end()) {
-    // Populate the .controller field with the new worker object.
-    scoped_refptr<WebServiceWorkerImpl> worker = GetOrAdoptServiceWorker(info);
+    // Get the existing worker object or create a new one with a new reference
+    // to populate the .controller field.
+    scoped_refptr<WebServiceWorkerImpl> worker = GetOrCreateServiceWorker(info);
     found->second->setController(WebServiceWorkerImpl::CreateHandle(worker),
                                  should_notify_controllerchange);
   }
diff --git a/content/child/service_worker/service_worker_dispatcher_unittest.cc b/content/child/service_worker/service_worker_dispatcher_unittest.cc
index 8b9f176b..6cd96213 100644
--- a/content/child/service_worker/service_worker_dispatcher_unittest.cc
+++ b/content/child/service_worker/service_worker_dispatcher_unittest.cc
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include "content/child/service_worker/service_worker_dispatcher.h"
+#include "content/child/service_worker/service_worker_provider_context.h"
 #include "content/child/service_worker/web_service_worker_impl.h"
 #include "content/child/service_worker/web_service_worker_registration_impl.h"
 #include "content/child/thread_safe_sender.h"
@@ -11,6 +12,7 @@
 #include "ipc/ipc_sync_message_filter.h"
 #include "ipc/ipc_test_sink.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h"
 
 namespace content {
 
@@ -63,10 +65,27 @@
     return ContainsKey(dispatcher_->registrations_, registration_handle_id);
   }
 
+  void OnAssociateRegistration(int thread_id,
+                               int provider_id,
+                               const ServiceWorkerRegistrationObjectInfo& info,
+                               const ServiceWorkerVersionAttributes& attrs) {
+    dispatcher_->OnAssociateRegistration(thread_id, provider_id, info, attrs);
+  }
+
+  void OnSetControllerServiceWorker(int thread_id,
+                                    int provider_id,
+                                    const ServiceWorkerObjectInfo& info,
+                                    bool should_notify_controllerchange) {
+    dispatcher_->OnSetControllerServiceWorker(thread_id, provider_id, info,
+                                              should_notify_controllerchange);
+  }
+
   ServiceWorkerDispatcher* dispatcher() { return dispatcher_.get(); }
+  ThreadSafeSender* thread_safe_sender() { return sender_.get(); }
   IPC::TestSink* ipc_sink() { return &ipc_sink_; }
 
  private:
+  base::MessageLoop message_loop_;
   IPC::TestSink ipc_sink_;
   scoped_ptr<ServiceWorkerDispatcher> dispatcher_;
   scoped_refptr<ServiceWorkerTestSender> sender_;
@@ -74,8 +93,124 @@
   DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherTest);
 };
 
+class MockWebServiceWorkerProviderClientImpl
+    : public blink::WebServiceWorkerProviderClient {
+ public:
+  MockWebServiceWorkerProviderClientImpl(int provider_id,
+                                         ServiceWorkerDispatcher* dispatcher)
+      : provider_id_(provider_id), dispatcher_(dispatcher) {
+    dispatcher_->AddProviderClient(provider_id, this);
+  }
+
+  ~MockWebServiceWorkerProviderClientImpl() {
+    dispatcher_->RemoveProviderClient(provider_id_);
+  }
+
+  void setController(
+      blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle,
+      bool shouldNotifyControllerChange) {
+    // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here.
+    // The destruction releases ServiceWorkerHandleReference.
+  }
+
+  void dispatchMessageEvent(
+      blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle,
+      const blink::WebString& message,
+      const blink::WebMessagePortChannelArray& channels) override {
+    NOTREACHED();
+  }
+
+ private:
+  const int provider_id_;
+  ServiceWorkerDispatcher* dispatcher_;
+};
+
 // TODO(nhiroki): Add tests for message handlers especially to receive reference
 // counts like OnAssociateRegistration().
+
+TEST_F(ServiceWorkerDispatcherTest, OnSetControllerServiceWorker) {
+  const int kProviderId = 10;
+  bool should_notify_controllerchange = true;
+
+  // Assume that these objects are passed from the browser process and own
+  // references to browser-side registration/worker representations.
+  ServiceWorkerRegistrationObjectInfo info;
+  ServiceWorkerVersionAttributes attrs;
+  CreateObjectInfoAndVersionAttributes(&info, &attrs);
+
+  // (1) In the case there are no SWProviderContext and WebSWProviderClient for
+  // the provider, the passed reference to the active worker should be adopted
+  // but immediately destroyed because there is no provider context to own it.
+  OnSetControllerServiceWorker(kDocumentMainThreadId, kProviderId, attrs.active,
+                               should_notify_controllerchange);
+  ASSERT_EQ(1UL, ipc_sink()->message_count());
+  EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(0)->type());
+  ipc_sink()->ClearMessages();
+
+  // (2) In the case there is no WebSWProviderClient but SWProviderContext for
+  // the provider, the passed referecence should be adopted and owned by the
+  // provider context.
+  scoped_refptr<ServiceWorkerProviderContext> provider_context(
+      new ServiceWorkerProviderContext(kProviderId,
+                                       SERVICE_WORKER_PROVIDER_FOR_WINDOW,
+                                       thread_safe_sender()));
+  OnAssociateRegistration(kDocumentMainThreadId, kProviderId, info, attrs);
+  ipc_sink()->ClearMessages();
+  OnSetControllerServiceWorker(kDocumentMainThreadId, kProviderId, attrs.active,
+                               should_notify_controllerchange);
+  EXPECT_EQ(0UL, ipc_sink()->message_count());
+
+  // Destruction of the provider context should release references to the
+  // associated registration and the controller.
+  provider_context = nullptr;
+  ASSERT_EQ(2UL, ipc_sink()->message_count());
+  EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(0)->type());
+  EXPECT_EQ(ServiceWorkerHostMsg_DecrementRegistrationRefCount::ID,
+            ipc_sink()->GetMessageAt(1)->type());
+  ipc_sink()->ClearMessages();
+
+  // (3) In the case there is no SWProviderContext but WebSWProviderClient for
+  // the provider, the new reference should be created and owned by the provider
+  // client (but the reference is immediately destroyed due to limitation of the
+  // mock provider client. See the comment on setController() of the mock).
+  // In addition, the passed reference should be adopted but immediately
+  // destroyed because there is no provider context to own it.
+  scoped_ptr<MockWebServiceWorkerProviderClientImpl> provider_client(
+      new MockWebServiceWorkerProviderClientImpl(kProviderId, dispatcher()));
+  OnSetControllerServiceWorker(kDocumentMainThreadId, kProviderId, attrs.active,
+                               should_notify_controllerchange);
+  ASSERT_EQ(3UL, ipc_sink()->message_count());
+  EXPECT_EQ(ServiceWorkerHostMsg_IncrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(0)->type());
+  EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(1)->type());
+  EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(2)->type());
+  provider_client.reset();
+  ipc_sink()->ClearMessages();
+
+  // (4) In the case there are both SWProviderContext and SWProviderClient for
+  // the provider, the passed referecence should be adopted and owned by the
+  // provider context. In addition, the new reference should be created for the
+  // provider client and immediately destroyed due to limitation of the mock
+  // implementation.
+  provider_context = new ServiceWorkerProviderContext(
+      kProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW, thread_safe_sender());
+  OnAssociateRegistration(kDocumentMainThreadId, kProviderId, info, attrs);
+  provider_client.reset(
+      new MockWebServiceWorkerProviderClientImpl(kProviderId, dispatcher()));
+  ipc_sink()->ClearMessages();
+  OnSetControllerServiceWorker(kDocumentMainThreadId, kProviderId, attrs.active,
+                               should_notify_controllerchange);
+  ASSERT_EQ(2UL, ipc_sink()->message_count());
+  EXPECT_EQ(ServiceWorkerHostMsg_IncrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(0)->type());
+  EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
+            ipc_sink()->GetMessageAt(1)->type());
+}
+
 TEST_F(ServiceWorkerDispatcherTest, GetServiceWorker) {
   ServiceWorkerRegistrationObjectInfo info;
   ServiceWorkerVersionAttributes attrs;
diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc
index cb0225c..5158be8 100644
--- a/content/child/service_worker/service_worker_network_provider.cc
+++ b/content/child/service_worker/service_worker_network_provider.cc
@@ -110,9 +110,11 @@
     : provider_id_(browser_provider_id) {
   if (provider_id_ == kInvalidServiceWorkerProviderId)
     return;
-  context_ = new ServiceWorkerProviderContext(provider_id_, provider_type);
   if (!ChildThreadImpl::current())
     return;  // May be null in some tests.
+  context_ = new ServiceWorkerProviderContext(
+      provider_id_, provider_type,
+      ChildThreadImpl::current()->thread_safe_sender());
   ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_ProviderCreated(
       provider_id_, route_id, provider_type));
 }
diff --git a/content/child/service_worker/service_worker_provider_context.cc b/content/child/service_worker/service_worker_provider_context.cc
index 375f564..9ef323e 100644
--- a/content/child/service_worker/service_worker_provider_context.cc
+++ b/content/child/service_worker/service_worker_provider_context.cc
@@ -138,18 +138,16 @@
 
 ServiceWorkerProviderContext::ServiceWorkerProviderContext(
     int provider_id,
-    ServiceWorkerProviderType provider_type)
+    ServiceWorkerProviderType provider_type,
+    ThreadSafeSender* thread_safe_sender)
     : provider_id_(provider_id),
-      main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
+      main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
+      thread_safe_sender_(thread_safe_sender) {
   if (provider_type == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER)
     delegate_.reset(new ControllerDelegate);
   else
     delegate_.reset(new ControlleeDelegate);
 
-  if (!ChildThreadImpl::current())
-    return;  // May be null in some tests.
-  thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender();
-
   ServiceWorkerDispatcher* dispatcher =
       ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
           thread_safe_sender_.get(), main_thread_task_runner_.get());
@@ -185,14 +183,9 @@
 }
 
 void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
-    const ServiceWorkerObjectInfo& info) {
+    scoped_ptr<ServiceWorkerHandleReference> controller) {
   DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
-  if (info.version_id == kInvalidServiceWorkerVersionId) {
-    delegate_->SetController(scoped_ptr<ServiceWorkerHandleReference>());
-    return;
-  }
-  delegate_->SetController(
-      ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()));
+  delegate_->SetController(controller.Pass());
 }
 
 void ServiceWorkerProviderContext::GetAssociatedRegistration(
diff --git a/content/child/service_worker/service_worker_provider_context.h b/content/child/service_worker/service_worker_provider_context.h
index 2040bcd..70c2f010 100644
--- a/content/child/service_worker/service_worker_provider_context.h
+++ b/content/child/service_worker/service_worker_provider_context.h
@@ -10,6 +10,7 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/sequenced_task_runner_helpers.h"
+#include "content/common/content_export.h"
 #include "content/common/service_worker/service_worker_types.h"
 
 namespace base {
@@ -39,18 +40,20 @@
 //
 // These operations are actually done in delegate classes owned by this class:
 // ControlleeDelegate and ControllerDelegate.
-class ServiceWorkerProviderContext
+class CONTENT_EXPORT ServiceWorkerProviderContext
     : public base::RefCountedThreadSafe<ServiceWorkerProviderContext,
                                         ServiceWorkerProviderContextDeleter> {
  public:
   ServiceWorkerProviderContext(int provider_id,
-                               ServiceWorkerProviderType provider_type);
+                               ServiceWorkerProviderType provider_type,
+                               ThreadSafeSender* thread_safe_sender);
 
   // Called from ServiceWorkerDispatcher.
   void OnAssociateRegistration(const ServiceWorkerRegistrationObjectInfo& info,
                                const ServiceWorkerVersionAttributes& attrs);
   void OnDisassociateRegistration();
-  void OnSetControllerServiceWorker(const ServiceWorkerObjectInfo& info);
+  void OnSetControllerServiceWorker(
+      scoped_ptr<ServiceWorkerHandleReference> controller);
 
   // Called on the worker thread. Used for initializing
   // ServiceWorkerGlobalScope.
diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc
index 7b14aeb..34b5614d 100644
--- a/content/common/cc_messages.cc
+++ b/content/common/cc_messages.cc
@@ -679,8 +679,7 @@
 
   size_t to_reserve = sizeof(p.device_scale_factor);
   to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource);
-  for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
-    const cc::RenderPass* pass = p.render_pass_list[i];
+  for (const auto& pass : p.render_pass_list) {
     to_reserve += sizeof(size_t) * 2;
     to_reserve += ReserveSizeForRenderPassWrite(*pass);
   }
@@ -689,7 +688,7 @@
   WriteParam(m, p.device_scale_factor);
   WriteParam(m, p.resource_list);
   WriteParam(m, p.render_pass_list.size());
-  for (const auto* pass : p.render_pass_list) {
+  for (const auto& pass : p.render_pass_list) {
     WriteParam(m, pass->quad_list.size());
     WriteParam(m, pass->shared_quad_state_list.size());
     WriteParam(m, *pass);
diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc
index 58128b7..a94cd4a8e 100644
--- a/content/common/cc_messages_unittest.cc
+++ b/content/common/cc_messages_unittest.cc
@@ -479,13 +479,11 @@
       &iter, &frame_out));
 
   // Make sure the out and cmp RenderPasses match.
-  scoped_ptr<RenderPass> child_pass_out =
-      frame_out.render_pass_list.take(frame_out.render_pass_list.begin());
+  scoped_ptr<RenderPass> child_pass_out = frame_out.render_pass_list[0].Pass();
   Compare(child_pass_cmp.get(), child_pass_out.get());
   ASSERT_EQ(0u, child_pass_out->shared_quad_state_list.size());
   ASSERT_EQ(0u, child_pass_out->quad_list.size());
-  scoped_ptr<RenderPass> pass_out =
-      frame_out.render_pass_list.take(frame_out.render_pass_list.begin() + 1);
+  scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list[1].Pass();
   Compare(pass_cmp.get(), pass_out.get());
   ASSERT_EQ(3u, pass_out->shared_quad_state_list.size());
   ASSERT_EQ(9u, pass_out->quad_list.size());
@@ -600,8 +598,7 @@
   EXPECT_TRUE(
       IPC::ParamTraits<DelegatedFrameData>::Read(&msg, &iter, &frame_out));
 
-  scoped_ptr<RenderPass> pass_out =
-      frame_out.render_pass_list.take(frame_out.render_pass_list.begin());
+  scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list[0].Pass();
 
   // 2 SharedQuadStates come out. The first and fourth SharedQuadStates were
   // used by quads, and so serialized. Others were not.
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
index ff958e69..0d447ce2 100644
--- a/content/public/android/BUILD.gn
+++ b/content/public/android/BUILD.gn
@@ -199,4 +199,3 @@
     "//base:base_java_test_support",
   ]
 }
-# TODO(GYP): content_icudata
diff --git a/content/public/browser/navigation_handle.h b/content/public/browser/navigation_handle.h
index cc96381..0bfbca8 100644
--- a/content/public/browser/navigation_handle.h
+++ b/content/public/browser/navigation_handle.h
@@ -97,6 +97,12 @@
   // Resumes a navigation that was previously deferred by a NavigationThrottle.
   virtual void Resume() = 0;
 
+  // Cancels a navigation that was previously deferred by a NavigationThrottle.
+  // |result| should be equal to NavigationThrottle::CANCEL or
+  // NavigationThrottle::CANCEL_AND_IGNORE.
+  virtual void CancelDeferredNavigation(
+      NavigationThrottle::ThrottleCheckResult result) = 0;
+
   // Testing methods ----------------------------------------------------------
   //
   // The following methods should be used exclusively for writing unit tests.
diff --git a/content/public/browser/navigation_throttle.h b/content/public/browser/navigation_throttle.h
index c5202ae7..fff64b1 100644
--- a/content/public/browser/navigation_throttle.h
+++ b/content/public/browser/navigation_throttle.h
@@ -17,8 +17,20 @@
   // This is returned to the NavigationHandle to allow the navigation to
   // proceed, or to cancel it.
   enum ThrottleCheckResult {
+    // The navigation proceeds uninterrupted.
     PROCEED,
+
+    // Defers the navigation until the NavigationThrottle calls
+    // NavigationHandle::Resume or NavigationHandle::CancelDeferredRequest.
+    // If the NavigationHandle is destroyed while the navigation is deferred,
+    // the navigation will be canceled in the network stack.
     DEFER,
+
+    // Cancels the navigation.
+    CANCEL,
+
+    // Cancels the navigation and makes the requester of the navigation acts
+    // like the request was never made.
     CANCEL_AND_IGNORE,
   };
 
@@ -26,9 +38,21 @@
   virtual ~NavigationThrottle();
 
   // Called when a network request is about to be made for this navigation.
+  //
+  // The implementer is responsible for ensuring that the WebContents this
+  // throttle is associated with remain alive during the duration of this
+  // method. Failing to do so will result in use-after-free bugs. Should the
+  // implementer need to destroy the WebContents, it should return CANCEL,
+  // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously.
   virtual ThrottleCheckResult WillStartRequest();
 
   // Called when a server redirect is received by the navigation.
+  //
+  // The implementer is responsible for ensuring that the WebContents this
+  // throttle is associated with remain alive during the duration of this
+  // method. Failing to do so will result in use-after-free bugs. Should the
+  // implementer need to destroy the WebContents, it should return CANCEL,
+  // CANCEL_AND_IGNORE or DEFER and perform the destruction asynchronously.
   virtual ThrottleCheckResult WillRedirectRequest();
 
   // The NavigationHandle that is tracking the information related to this
diff --git a/content/public/common/media_stream_request.h b/content/public/common/media_stream_request.h
index bd31f465..ed3f84d 100644
--- a/content/public/common/media_stream_request.h
+++ b/content/public/common/media_stream_request.h
@@ -78,6 +78,7 @@
   MEDIA_DEVICE_TRACK_START_FAILURE = 10,
   MEDIA_DEVICE_NOT_SUPPORTED = 11,
   MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN = 12,
+  MEDIA_DEVICE_KILL_SWITCH_ON = 13,
   NUM_MEDIA_REQUEST_RESULTS
 };
 
diff --git a/content/renderer/android/synchronous_compositor_output_surface.cc b/content/renderer/android/synchronous_compositor_output_surface.cc
index 9a48dff3..a6cf1e9d 100644
--- a/content/renderer/android/synchronous_compositor_output_surface.cc
+++ b/content/renderer/android/synchronous_compositor_output_surface.cc
@@ -79,7 +79,6 @@
   DCHECK(registry_);
   capabilities_.adjust_deadline_for_parent = false;
   capabilities_.delegated_rendering = true;
-  capabilities_.max_frames_pending = 1;
   memory_policy_.priority_cutoff_when_visible =
       gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
 }
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 4f23d6c..2abadbc 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -215,7 +215,7 @@
     return;
 
   DCHECK(!frame_data->render_pass_list.empty());
-  cc::RenderPass* root_pass = frame_data->render_pass_list.back();
+  cc::RenderPass* root_pass = frame_data->render_pass_list.back().get();
   gfx::Size frame_size = root_pass->output_rect.size();
 
   if (last_route_id_ != route_id ||
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index f8c756c..1d8a065 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -50,7 +50,6 @@
       weak_ptrs_(this) {
   DCHECK(output_surface_filter_.get());
   DCHECK(frame_swap_message_queue_.get());
-  capabilities_.max_frames_pending = 1;
   message_sender_ = RenderThreadImpl::current()->sync_message_filter();
   DCHECK(message_sender_.get());
 }
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc
index 902627a..f5a9f06 100644
--- a/content/renderer/media/user_media_client_impl.cc
+++ b/content/renderer/media/user_media_client_impl.cc
@@ -812,6 +812,9 @@
     case MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN:
       request_info.requestFailedUASpecific("MediaDeviceFailedDueToShutdown");
       return;
+    case MEDIA_DEVICE_KILL_SWITCH_ON:
+      request_info.requestFailedUASpecific("MediaDeviceKillSwitchOn");
+      return;
   }
   NOTREACHED();
   request_info.requestFailed();
diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
index 71666048..4e5dd05f 100644
--- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
+++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc
@@ -15,7 +15,7 @@
 #include "third_party/libjingle/source/talk/media/webrtc/webrtcvideoframe.h"
 #include "third_party/libyuv/include/libyuv/convert_from.h"
 #include "third_party/libyuv/include/libyuv/scale.h"
-#include "third_party/webrtc/common_video/interface/video_frame_buffer.h"
+#include "third_party/webrtc/common_video/include/video_frame_buffer.h"
 #include "third_party/webrtc/common_video/rotation.h"
 
 namespace content {
@@ -36,14 +36,12 @@
 class WebRtcVideoCapturerAdapter::MediaVideoFrameFactory
     : public cricket::VideoFrameFactory {
  public:
-  void SetFrame(const scoped_refptr<media::VideoFrame>& frame,
-                int64_t elapsed_time) {
+  void SetFrame(const scoped_refptr<media::VideoFrame>& frame) {
     DCHECK(frame.get());
     // Create a CapturedFrame that only contains header information, not the
     // actual pixel data.
     captured_frame_.width = frame->natural_size().width();
     captured_frame_.height = frame->natural_size().height();
-    captured_frame_.elapsed_time = elapsed_time;
     captured_frame_.time_stamp = frame->timestamp().InMicroseconds() *
                                  base::Time::kNanosecondsPerMicrosecond;
     captured_frame_.pixel_height = 1;
@@ -84,7 +82,7 @@
             media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS) {
       return new cricket::WebRtcVideoFrame(
           new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(frame_),
-          captured_frame_.elapsed_time, timestamp_ns);
+          timestamp_ns, webrtc::kVideoRotation_0);
     }
 
     // Create a centered cropped visible rect that preservers aspect ratio for
@@ -104,7 +102,7 @@
     if (video_frame->natural_size() == video_frame->visible_rect().size()) {
       return new cricket::WebRtcVideoFrame(
           new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(video_frame),
-          captured_frame_.elapsed_time, timestamp_ns);
+          timestamp_ns, webrtc::kVideoRotation_0);
     }
 
     // We need to scale the frame before we hand it over to cricket.
@@ -129,7 +127,7 @@
                       output_width, output_height, libyuv::kFilterBilinear);
     return new cricket::WebRtcVideoFrame(
         new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(scaled_frame),
-        captured_frame_.elapsed_time, timestamp_ns);
+        timestamp_ns, webrtc::kVideoRotation_0);
   }
 
   cricket::VideoFrame* CreateAliasedFrame(
@@ -149,8 +147,7 @@
 
 WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter(bool is_screencast)
     : is_screencast_(is_screencast),
-      running_(false),
-      first_frame_timestamp_(media::kNoTimestamp()) {
+      running_(false) {
   thread_checker_.DetachFromThread();
   // The base class takes ownership of the frame factory.
   set_frame_factory(new MediaVideoFrameFactory);
@@ -228,17 +225,10 @@
     return;
   }
 
-  if (first_frame_timestamp_ == media::kNoTimestamp())
-    first_frame_timestamp_ = frame->timestamp();
-
-  const int64 elapsed_time =
-      (frame->timestamp() - first_frame_timestamp_).InMicroseconds() *
-      base::Time::kNanosecondsPerMicrosecond;
-
   // Inject the frame via the VideoFrameFactory of base class.
   MediaVideoFrameFactory* media_video_frame_factory =
       reinterpret_cast<MediaVideoFrameFactory*>(frame_factory());
-  media_video_frame_factory->SetFrame(frame, elapsed_time);
+  media_video_frame_factory->SetFrame(frame);
 
   // This signals to libJingle that a new VideoFrame is available.
   SignalFrameCaptured(this, media_video_frame_factory->GetCapturedFrame());
diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h
index 8a80c55e..c16b5b0 100644
--- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h
+++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h
@@ -52,7 +52,6 @@
 
   const bool is_screencast_;
   bool running_;
-  base::TimeDelta first_frame_timestamp_;
 
   class MediaVideoFrameFactory;
 
diff --git a/content/renderer/media/webrtc/webrtc_video_frame_adapter.h b/content/renderer/media/webrtc/webrtc_video_frame_adapter.h
index c7f83d89..79287949 100644
--- a/content/renderer/media/webrtc/webrtc_video_frame_adapter.h
+++ b/content/renderer/media/webrtc/webrtc_video_frame_adapter.h
@@ -6,7 +6,7 @@
 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_
 
 #include "media/base/video_frame.h"
-#include "third_party/webrtc/common_video/interface/video_frame_buffer.h"
+#include "third_party/webrtc/common_video/include/video_frame_buffer.h"
 
 namespace content {
 // Thin adapter from media::VideoFrame to webrtc::VideoFrameBuffer. This
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index c79384a8..2193a45 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1507,6 +1507,7 @@
     frame_->selectWordAroundCaret();
 
   frame_->replaceSelection(text);
+  SyncSelectionIfRequired();
 }
 
 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) {
diff --git a/content/renderer/service_worker/PRESUBMIT.py b/content/renderer/service_worker/PRESUBMIT.py
index 928d9fe0..c82402dc 100644
--- a/content/renderer/service_worker/PRESUBMIT.py
+++ b/content/renderer/service_worker/PRESUBMIT.py
@@ -12,3 +12,11 @@
   results = []
   results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
   return results
+
+# Add Blink tests to the default CQ try bots.
+def GetPreferredTryMasters(project, change):
+  return {
+    'tryserver.blink': {
+      'linux_blink_rel': set(['defaulttests']),
+    },
+  }
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn
index d3cc6241..756416d 100644
--- a/content/shell/android/BUILD.gn
+++ b/content/shell/android/BUILD.gn
@@ -100,9 +100,6 @@
 
 android_apk("content_shell_apk") {
   testonly = true
-  data_deps = [
-    # "//tools/android/forwarder",
-  ]
   deps = [
     ":content_shell_apk_java",
     ":content_shell_apk_resources",
diff --git a/content/test/ct/run_ct_top1k.py b/content/test/ct/run_ct_top1k.py
new file mode 100755
index 0000000..8f97add
--- /dev/null
+++ b/content/test/ct/run_ct_top1k.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# Copyright (c) 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.
+
+"""This script is meant to be run on a Swarming bot."""
+
+import argparse
+import os
+import subprocess
+import sys
+
+
+PARENT_DIR = os.path.dirname(os.path.realpath(__file__))
+
+
+def _GetChromiumSrcDir():
+  return os.path.abspath(os.path.join(
+      PARENT_DIR, os.pardir, os.pardir, os.pardir))
+
+
+def main():
+  parser = argparse.ArgumentParser()
+  parser.add_argument('-s', '--slave_num', required=True,
+                      help='The slave num of this CT run.')
+  parser.add_argument('-b', '--benchmark', required=True,
+                      help='The benchmark to run.')
+  parser.add_argument('-m', '--master', required=True,
+                      help='The master the builder is running on.')
+  parser.add_argument('-c', '--builder', required=True,
+                      help='The builder that triggered this run.')
+  parser.add_argument('-g', '--git_hash', required=True,
+                      help='The git hash the build was triggered at.')
+
+  args = parser.parse_args()
+
+  ct_binary_path = os.path.join(PARENT_DIR, 'run_chromium_perf_swarming')
+  chromium_binary_path = os.path.join(_GetChromiumSrcDir(), 'out', 'Release')
+  page_sets_dir = os.path.join(
+      PARENT_DIR, 'slave%s' % args.slave_num, 'page_sets')
+  telemetry_binaries_dir = os.path.join(_GetChromiumSrcDir(), 'tools', 'perf')
+
+  # Run Cluster Telemetry.
+  cmd = [
+      ct_binary_path,
+      '--worker_num', args.slave_num,
+      '--chromium_build', chromium_binary_path,
+      '--benchmark_name', args.benchmark,
+      '--telemetry_binaries_dir', telemetry_binaries_dir,
+      '--page_sets_dir', page_sets_dir,
+      '--master', args.master,
+      '--builder', args.builder,
+      '--git_hash', args.git_hash,
+      '--alsologtostderr',
+  ]
+  return subprocess.call(cmd)
+
+
+if __name__ == '__main__':
+  sys.exit(main())
diff --git a/content/test/net/url_request_abort_on_end_job.cc b/content/test/net/url_request_abort_on_end_job.cc
index f7ff5a9..6d237a8 100644
--- a/content/test/net/url_request_abort_on_end_job.cc
+++ b/content/test/net/url_request_abort_on_end_job.cc
@@ -8,6 +8,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/location.h"
+#include "base/numerics/safe_conversions.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_util.h"
 #include "base/thread_task_runner_handle.h"
@@ -111,20 +112,16 @@
                             weak_factory_.GetWeakPtr()));
 }
 
-bool URLRequestAbortOnEndJob::ReadRawData(net::IOBuffer* buf,
-                                          const int max_bytes,
-                                          int* bytes_read) {
+int URLRequestAbortOnEndJob::ReadRawData(net::IOBuffer* buf, int max_bytes) {
   if (!sent_data_) {
-    *bytes_read = std::min(size_t(max_bytes), sizeof(kPageContent));
-    std::memcpy(buf->data(), kPageContent, *bytes_read);
+    max_bytes =
+        std::min(max_bytes, base::checked_cast<int>(sizeof(kPageContent)));
+    std::memcpy(buf->data(), kPageContent, max_bytes);
     sent_data_ = true;
-    return true;
+    return max_bytes;
   }
 
-  SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED,
-                                  net::ERR_CONNECTION_ABORTED));
-  *bytes_read = -1;
-  return false;
+  return net::ERR_CONNECTION_ABORTED;
 }
 
 }  // namespace content
diff --git a/content/test/net/url_request_abort_on_end_job.h b/content/test/net/url_request_abort_on_end_job.h
index 88e348c..8a95533 100644
--- a/content/test/net/url_request_abort_on_end_job.h
+++ b/content/test/net/url_request_abort_on_end_job.h
@@ -29,7 +29,7 @@
   void Start() override;
   bool GetMimeType(std::string* mime_type) const override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
 
   static void AddUrlHandler();
 
diff --git a/device/BUILD.gn b/device/BUILD.gn
index 467f781..1a72de1 100644
--- a/device/BUILD.gn
+++ b/device/BUILD.gn
@@ -104,8 +104,8 @@
     deps += [ "//device/udev_linux" ]
   }
 
-  # USB does not compile on mobile platforms.
-  if (!is_android && !is_ios) {
+  # USB does not compile on iOS.
+  if (!is_ios) {
     sources += [
       "devices_app/usb/device_impl_unittest.cc",
       "devices_app/usb/device_manager_impl_unittest.cc",
@@ -114,7 +114,6 @@
       "test/test_device_client.cc",
       "test/test_device_client.h",
       "test/usb_test_gadget_impl.cc",
-      "usb/usb_context_unittest.cc",
       "usb/usb_descriptors_unittest.cc",
       "usb/usb_device_filter_unittest.cc",
       "usb/usb_device_handle_unittest.cc",
@@ -128,10 +127,14 @@
       "//device/devices_app/usb/public/interfaces",
       "//device/usb",
       "//device/usb:mocks",
-      "//third_party/libusb",
     ]
   }
 
+  # UsbContext is a libusb-specific object.
+  if (!is_android && !is_ios) {
+    sources += [ "usb/usb_context_unittest.cc" ]
+  }
+
   if (is_android) {
     sources -= [ "battery/battery_status_service_unittest.cc" ]
     deps -= [ "//device/battery" ]
diff --git a/device/device_tests.gyp b/device/device_tests.gyp
index c7491ac..c0915ff 100644
--- a/device/device_tests.gyp
+++ b/device/device_tests.gyp
@@ -77,7 +77,6 @@
         'test/test_device_client.cc',
         'test/test_device_client.h',
         'test/usb_test_gadget_impl.cc',
-        'usb/usb_context_unittest.cc',
         'usb/usb_descriptors_unittest.cc',
         'usb/usb_device_filter_unittest.cc',
         'usb/usb_device_handle_unittest.cc',
@@ -111,11 +110,7 @@
         }],
         ['OS=="android"', {
           'dependencies!': [
-            '../tools/usb_gadget/usb_gadget.gyp:usb_gadget',
             'battery/battery.gyp:device_battery',
-            'devices_app/devices_app.gyp:devices_app_lib',
-            'usb/usb.gyp:device_usb',
-            'usb/usb.gyp:device_usb_mocks',
             'serial/serial.gyp:device_serial',
             'serial/serial.gyp:device_serial_test_util',
             'hid/hid.gyp:device_hid',
@@ -128,10 +123,10 @@
           'sources/': [
             ['exclude', '(^|/)hid'],
             ['exclude', '(^|/)serial'],
-            ['exclude', '(^|/)usb'],
           ],
           'sources!': [
             'battery/battery_status_service_unittest.cc',
+            'usb/usb_context_unittest.cc',
           ],
         }],
         ['OS=="mac"', {
diff --git a/device/serial/serial.gyp b/device/serial/serial.gyp
index 5d43bd1..de18133 100644
--- a/device/serial/serial.gyp
+++ b/device/serial/serial.gyp
@@ -29,6 +29,11 @@
       'target_name': 'device_serial',
       'type': 'static_library',
       'conditions': [
+        ['chromeos==1', {
+          'dependencies': [
+            '../../chromeos/chromeos.gyp:chromeos',
+          ],
+        }],
         ['use_udev == 1', {
           'dependencies': [
             '../udev_linux/udev.gyp:udev_linux',
diff --git a/device/usb/BUILD.gn b/device/usb/BUILD.gn
index 8a9f47f7..a139092b 100644
--- a/device/usb/BUILD.gn
+++ b/device/usb/BUILD.gn
@@ -11,8 +11,6 @@
 
 source_set("usb") {
   sources = [
-    "usb_context.cc",
-    "usb_context.h",
     "usb_descriptors.cc",
     "usb_descriptors.h",
     "usb_device.cc",
@@ -21,18 +19,10 @@
     "usb_device_filter.h",
     "usb_device_handle.cc",
     "usb_device_handle.h",
-    "usb_device_handle_impl.cc",
-    "usb_device_handle_impl.h",
-    "usb_device_impl.cc",
-    "usb_device_impl.h",
-    "usb_error.cc",
-    "usb_error.h",
     "usb_ids.cc",
     "usb_ids.h",
     "usb_service.cc",
     "usb_service.h",
-    "usb_service_impl.cc",
-    "usb_service_impl.h",
     "webusb_descriptors.cc",
     "webusb_descriptors.h",
     generated_ids,
@@ -45,23 +35,40 @@
     "//components/device_event_log",
     "//device/core",
     "//net",
-    "//third_party/libusb",
   ]
 
   if (use_udev) {
     deps += [ "//device/udev_linux" ]
   }
+
+  if (is_android) {
+    sources += [
+      "usb_service_android.cc",
+      "usb_service_android.h",
+    ]
+  } else {
+    sources += [
+      "usb_context.cc",
+      "usb_context.h",
+      "usb_device_handle_impl.cc",
+      "usb_device_handle_impl.h",
+      "usb_device_impl.cc",
+      "usb_device_impl.h",
+      "usb_error.cc",
+      "usb_error.h",
+      "usb_service_impl.cc",
+      "usb_service_impl.h",
+    ]
+
+    deps += [ "//third_party/libusb" ]
+  }
+
   if (is_chromeos) {
     deps += [
       "//chromeos",
       "//dbus",
     ]
   }
-
-  # TODO(moshayedi): crbug.com/549257. Add USB support for Aura on Android.
-  if (is_android) {
-    deps -= [ "//third_party/libusb" ]
-  }
 }
 
 source_set("mocks") {
diff --git a/device/usb/usb.gyp b/device/usb/usb.gyp
index 1d3493f8..c7bf776 100644
--- a/device/usb/usb.gyp
+++ b/device/usb/usb.gyp
@@ -73,6 +73,27 @@
             '../udev_linux/udev.gyp:udev_linux',
           ],
         }],
+        ['OS=="android"', {
+          'dependencies!': [
+            '../../third_party/libusb/libusb.gyp:libusb',
+          ],
+          'sources': [
+            'usb_service_android.cc',
+            'usb_service_android.h',
+          ],
+          'sources!': [
+            'usb_context.cc',
+            'usb_context.h',
+            'usb_device_handle_impl.cc',
+            'usb_device_handle_impl.h',
+            'usb_device_impl.cc',
+            'usb_device_impl.h',
+            'usb_error.cc',
+            'usb_error.h',
+            'usb_service_impl.cc',
+            'usb_service_impl.h',
+          ]
+        }],
         ['chromeos==1', {
           'dependencies': [
             '../../chromeos/chromeos.gyp:chromeos',
diff --git a/device/usb/usb_service.cc b/device/usb/usb_service.cc
index de9716f..807934ed8 100644
--- a/device/usb/usb_service.cc
+++ b/device/usb/usb_service.cc
@@ -8,7 +8,12 @@
 #include "base/bind.h"
 #include "components/device_event_log/device_event_log.h"
 #include "device/usb/usb_device.h"
+
+#if defined(OS_ANDROID)
+#include "device/usb/usb_service_android.h"
+#else
 #include "device/usb/usb_service_impl.h"
+#endif
 
 namespace device {
 
@@ -29,7 +34,11 @@
 // static
 scoped_ptr<UsbService> UsbService::Create(
     scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) {
+#if defined(OS_ANDROID)
+  return make_scoped_ptr(new UsbServiceAndroid());
+#else
   return make_scoped_ptr(new UsbServiceImpl(blocking_task_runner));
+#endif
 }
 
 UsbService::~UsbService() {
diff --git a/device/usb/usb_service_android.cc b/device/usb/usb_service_android.cc
new file mode 100644
index 0000000..45ce499
--- /dev/null
+++ b/device/usb/usb_service_android.cc
@@ -0,0 +1,28 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/usb/usb_service_android.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/thread_task_runner_handle.h"
+#include "device/usb/usb_device.h"
+
+namespace device {
+
+UsbServiceAndroid::UsbServiceAndroid() {}
+
+UsbServiceAndroid::~UsbServiceAndroid() {}
+
+scoped_refptr<UsbDevice> UsbServiceAndroid::GetDevice(const std::string& guid) {
+  return nullptr;
+}
+
+void UsbServiceAndroid::GetDevices(const GetDevicesCallback& callback) {
+  std::vector<scoped_refptr<UsbDevice>> empty;
+  base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+                                                base::Bind(callback, empty));
+}
+
+}  // namespace device
diff --git a/device/usb/usb_service_android.h b/device/usb/usb_service_android.h
new file mode 100644
index 0000000..d1ffd9df
--- /dev/null
+++ b/device/usb/usb_service_android.h
@@ -0,0 +1,25 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_USB_USB_SERVICE_ANDROID_H_
+#define DEVICE_USB_USB_SERVICE_ANDROID_H_
+
+#include "device/usb/usb_service.h"
+
+namespace device {
+
+// USB service implementation for Android. This is a stub implementation that
+// does not return any devices.
+class UsbServiceAndroid : public UsbService {
+ public:
+  UsbServiceAndroid();
+  ~UsbServiceAndroid() override;
+
+  scoped_refptr<UsbDevice> GetDevice(const std::string& guid) override;
+  void GetDevices(const GetDevicesCallback& callback) override;
+};
+
+}  // namespace device
+
+#endif  // DEVICE_USB_USB_SERVICE_ANDROID_H_
diff --git a/extensions/browser/api/display_source/OWNERS b/extensions/browser/api/display_source/OWNERS
new file mode 100644
index 0000000..f7e4f6f
--- /dev/null
+++ b/extensions/browser/api/display_source/OWNERS
@@ -0,0 +1,2 @@
+alexander.shalamov@intel.com
+mikhail.pozdnyakov@intel.com
diff --git a/extensions/browser/api/display_source/display_source_api.cc b/extensions/browser/api/display_source/display_source_api.cc
new file mode 100644
index 0000000..9b92f0f0
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_api.cc
@@ -0,0 +1,97 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/display_source_api.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+#include "extensions/common/api/display_source.h"
+
+namespace extensions {
+
+namespace {
+
+const char kErrorNotSupported[] = "Not supported";
+const char kErrorInvalidArguments[] = "Invalid arguments";
+
+}  // namespace
+
+////////////////////////////////////////////////////////////////////////////////
+// DisplaySourceGetAvailableSinksFunction
+
+DisplaySourceGetAvailableSinksFunction::
+    ~DisplaySourceGetAvailableSinksFunction() {}
+
+ExtensionFunction::ResponseAction
+DisplaySourceGetAvailableSinksFunction::Run() {
+  DisplaySourceConnectionDelegate* delegate =
+      DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
+          browser_context());
+  if (!delegate) {
+    return RespondNow(Error(kErrorNotSupported));
+  }
+
+  auto success_callback = base::Bind(
+      &DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted, this);
+  auto failure_callback = base::Bind(
+      &DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed, this);
+  delegate->GetAvailableSinks(success_callback, failure_callback);
+
+  return RespondLater();
+}
+
+void DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted(
+    const DisplaySourceSinkInfoList& sinks) {
+  scoped_ptr<base::ListValue> result =
+      api::display_source::GetAvailableSinks::Results::Create(sinks);
+  Respond(ArgumentList(result.Pass()));
+}
+
+void DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed(
+    const std::string& reason) {
+  Respond(Error(reason));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// DisplaySourceRequestAuthenticationFunction
+
+DisplaySourceRequestAuthenticationFunction::
+    ~DisplaySourceRequestAuthenticationFunction() {}
+
+ExtensionFunction::ResponseAction
+DisplaySourceRequestAuthenticationFunction::Run() {
+  scoped_ptr<api::display_source::RequestAuthentication::Params> params(
+      api::display_source::RequestAuthentication::Params::Create(*args_));
+  if (!params) {
+    return RespondNow(Error(kErrorInvalidArguments));
+  }
+
+  DisplaySourceConnectionDelegate* delegate =
+      DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
+          browser_context());
+  if (!delegate) {
+    return RespondNow(Error(kErrorNotSupported));
+  }
+
+  auto success_callback = base::Bind(
+      &DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted,
+      this);
+  auto failure_callback = base::Bind(
+      &DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed, this);
+  delegate->RequestAuthentication(params->sink_id, success_callback,
+                                  failure_callback);
+  return RespondLater();
+}
+
+void DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted(
+    const DisplaySourceAuthInfo& auth_info) {
+  scoped_ptr<base::ListValue> result =
+      api::display_source::RequestAuthentication::Results::Create(auth_info);
+  Respond(ArgumentList(result.Pass()));
+}
+
+void DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed(
+    const std::string& reason) {
+  Respond(Error(reason));
+}
+
+}  // namespace extensions
diff --git a/extensions/browser/api/display_source/display_source_api.h b/extensions/browser/api/display_source/display_source_api.h
new file mode 100644
index 0000000..f1e3ad4
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_api.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_API_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_API_H_
+
+#include "base/macros.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
+#include "extensions/browser/extension_function.h"
+
+namespace extensions {
+
+class DisplaySourceGetAvailableSinksFunction
+    : public UIThreadExtensionFunction {
+ public:
+  DECLARE_EXTENSION_FUNCTION("displaySource.getAvailableSinks",
+                             DISPLAYSOURCE_GETAVAILABLESINKS);
+  DisplaySourceGetAvailableSinksFunction() = default;
+
+ protected:
+  ~DisplaySourceGetAvailableSinksFunction() override;
+  ResponseAction Run() final;
+
+ private:
+  void OnGetSinksCompleted(const DisplaySourceSinkInfoList& sinks);
+  void OnGetSinksFailed(const std::string& reason);
+
+  DISALLOW_COPY_AND_ASSIGN(DisplaySourceGetAvailableSinksFunction);
+};
+
+class DisplaySourceRequestAuthenticationFunction
+    : public UIThreadExtensionFunction {
+ public:
+  DECLARE_EXTENSION_FUNCTION("displaySource.requestAuthentication",
+                             DISPLAYSOURCE_REQUESTAUTHENTICATION);
+  DisplaySourceRequestAuthenticationFunction() = default;
+
+ protected:
+  ~DisplaySourceRequestAuthenticationFunction() override;
+  ResponseAction Run() final;
+
+ private:
+  void OnRequestAuthCompleted(const DisplaySourceAuthInfo& auth_info);
+  void OnRequestAuthFailed(const std::string& reason);
+
+  DISALLOW_COPY_AND_ASSIGN(DisplaySourceRequestAuthenticationFunction);
+};
+
+}  // namespace extensions
+
+#endif  // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_API_H_
diff --git a/extensions/browser/api/display_source/display_source_apitest.cc b/extensions/browser/api/display_source/display_source_apitest.cc
new file mode 100644
index 0000000..9c44868
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_apitest.cc
@@ -0,0 +1,99 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/scoped_ptr.h"
+#include "content/public/test/test_utils.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+#include "extensions/shell/test/shell_apitest.h"
+
+namespace extensions {
+
+using api::display_source::SinkInfo;
+using api::display_source::SinkState;
+using api::display_source::SINK_STATE_DISCONNECTED;
+using api::display_source::AUTHENTICATION_METHOD_PBC;
+
+namespace {
+
+DisplaySourceSinkInfoPtr CreateSinkInfoPtr(int id,
+                                           const std::string& name,
+                                           SinkState state) {
+  DisplaySourceSinkInfoPtr ptr(new SinkInfo());
+  ptr->id = id;
+  ptr->name = name;
+  ptr->state = state;
+
+  return ptr;
+}
+
+}  // namespace
+
+class MockDisplaySourceConnectionDelegate
+    : public DisplaySourceConnectionDelegate {
+ public:
+  DisplaySourceSinkInfoList last_found_sinks() const override { return sinks_; }
+  const Connection* connection() const override { return nullptr; }
+  void GetAvailableSinks(const SinkInfoListCallback& sinks_callback,
+                         const FailureCallback& failure_callback) override {
+    AddSink(CreateSinkInfoPtr(1, "sink 1", SINK_STATE_DISCONNECTED));
+    sinks_callback.Run(sinks_);
+  }
+
+  void RequestAuthentication(int sink_id,
+                             const AuthInfoCallback& auth_info_callback,
+                             const FailureCallback& failure_callback) override {
+    DisplaySourceAuthInfo info;
+    info.method = AUTHENTICATION_METHOD_PBC;
+    auth_info_callback.Run(info);
+  }
+
+  void Connect(int sink_id,
+               const DisplaySourceAuthInfo& auth_info,
+               const base::Closure& connected_callback,
+               const FailureCallback& failure_callback) override {}
+
+  void Disconnect(const base::Closure& disconnected_callback,
+                  const FailureCallback& failure_callback) override {}
+
+  void StartWatchingSinks() override {
+    AddSink(CreateSinkInfoPtr(2, "sink 2", SINK_STATE_DISCONNECTED));
+  }
+
+  void StopWatchingSinks() override {}
+
+ private:
+  void AddSink(DisplaySourceSinkInfoPtr sink) {
+    sinks_.push_back(sink);
+    FOR_EACH_OBSERVER(DisplaySourceConnectionDelegate::Observer, observers_,
+                      OnSinksUpdated(sinks_));
+  }
+
+  DisplaySourceSinkInfoList sinks_;
+};
+
+class DisplaySourceApiTest : public ShellApiTest {
+ public:
+  DisplaySourceApiTest() = default;
+
+ private:
+  static scoped_ptr<KeyedService> CreateMockDelegate(
+      content::BrowserContext* profile) {
+    return make_scoped_ptr<KeyedService>(
+        new MockDisplaySourceConnectionDelegate());
+  }
+
+  void SetUpOnMainThread() override {
+    ShellApiTest::SetUpOnMainThread();
+    DisplaySourceConnectionDelegateFactory::GetInstance()->SetTestingFactory(
+        browser_context(), &CreateMockDelegate);
+    content::RunAllPendingInMessageLoop();
+  }
+};
+
+IN_PROC_BROWSER_TEST_F(DisplaySourceApiTest, DisplaySourceExtension) {
+  ASSERT_TRUE(RunAppTest("api_test/display_source/api")) << message_;
+}
+
+}  // namespace extensions
diff --git a/extensions/browser/api/display_source/display_source_connection_delegate.cc b/extensions/browser/api/display_source/display_source_connection_delegate.cc
new file mode 100644
index 0000000..1fd0990
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_connection_delegate.cc
@@ -0,0 +1,25 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
+
+namespace extensions {
+
+DisplaySourceConnectionDelegate::Connection::Connection() {}
+
+DisplaySourceConnectionDelegate::Connection::~Connection() {}
+
+DisplaySourceConnectionDelegate::DisplaySourceConnectionDelegate() {}
+
+DisplaySourceConnectionDelegate::~DisplaySourceConnectionDelegate() {}
+
+void DisplaySourceConnectionDelegate::AddObserver(Observer* observer) {
+  observers_.AddObserver(observer);
+}
+
+void DisplaySourceConnectionDelegate::RemoveObserver(Observer* observer) {
+  observers_.RemoveObserver(observer);
+}
+
+}  // namespace extensions
diff --git a/extensions/browser/api/display_source/display_source_connection_delegate.h b/extensions/browser/api/display_source/display_source_connection_delegate.h
new file mode 100644
index 0000000..a885dacf1
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_connection_delegate.h
@@ -0,0 +1,103 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_H_
+
+#include "base/callback.h"
+#include "base/observer_list.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "extensions/common/api/display_source.h"
+
+namespace extensions {
+
+using DisplaySourceSinkInfoPtr = linked_ptr<api::display_source::SinkInfo>;
+using DisplaySourceSinkInfoList = std::vector<DisplaySourceSinkInfoPtr>;
+using DisplaySourceAuthInfo = api::display_source::AuthenticationInfo;
+
+// The DisplaySourceConnectionDelegate interface should be implemented
+// to provide sinks search and connection functionality for
+// 'chrome.displaySource'
+// API.
+class DisplaySourceConnectionDelegate : public KeyedService {
+ public:
+  using AuthInfoCallback = base::Callback<void(const DisplaySourceAuthInfo&)>;
+  using FailureCallback = base::Callback<void(const std::string&)>;
+  using SinkInfoListCallback =
+      base::Callback<void(const DisplaySourceSinkInfoList&)>;
+
+  struct Connection {
+    Connection();
+    ~Connection();
+    DisplaySourceSinkInfoPtr connected_sink;
+    std::string local_ip;
+    std::string sink_ip;
+  };
+
+  class Observer {
+   public:
+    // This method is called each tiome the list of available
+    // sinks is updated whether after 'GetAvailableSinks' call
+    // or while the implementation is constantly watching the sinks
+    // (after 'StartWatchingSinks' was called).
+    virtual void OnSinksUpdated(const DisplaySourceSinkInfoList& sinks) = 0;
+
+   protected:
+    virtual ~Observer() {}
+  };
+
+  DisplaySourceConnectionDelegate();
+  ~DisplaySourceConnectionDelegate() override;
+
+  virtual void AddObserver(Observer* observer);
+  virtual void RemoveObserver(Observer* observer);
+
+  // Returns the list of last found available sinks
+  // this list may contain outdated data if the delegate
+  // is not watching the sinks (via 'StartWatchingSinks'
+  // method). The list is refreshed after 'GetAvailableSinks'
+  // call.
+  virtual DisplaySourceSinkInfoList last_found_sinks() const = 0;
+
+  // Returns the Connection object representing the current
+  // connection to the sink or NULL if there is no curent connection.
+  virtual const Connection* connection() const = 0;
+
+  // Queries the list of currently available sinks.
+  virtual void GetAvailableSinks(const SinkInfoListCallback& sinks_callback,
+                                 const FailureCallback& failure_callback) = 0;
+
+  // Queries the authentication method required by the sink for connection.
+  // If the used authentication method requires authentication data to be
+  // visible on the sink's display (e.g. PIN) the implementation should
+  // request the sink to show it.
+  virtual void RequestAuthentication(
+      int sink_id,
+      const AuthInfoCallback& auth_info_callback,
+      const FailureCallback& failure_callback) = 0;
+
+  // Connects to a sink by given id and auth info.
+  virtual void Connect(int sink_id,
+                       const DisplaySourceAuthInfo& auth_info,
+                       const base::Closure& connected_callback,
+                       const FailureCallback& failure_callback) = 0;
+
+  // Disconnects the current connection to sink, the 'failure_callback'
+  // is called if there is no current connection.
+  virtual void Disconnect(const base::Closure& disconnected_callback,
+                          const FailureCallback& failure_callback) = 0;
+
+  // Implementation should start watching the sinks updates.
+  virtual void StartWatchingSinks() = 0;
+
+  // Implementation should stop watching the sinks updates.
+  virtual void StopWatchingSinks() = 0;
+
+ protected:
+  base::ObserverList<Observer> observers_;
+};
+
+}  // namespace extensions
+
+#endif  // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_H_
diff --git a/extensions/browser/api/display_source/display_source_connection_delegate_factory.cc b/extensions/browser/api/display_source/display_source_connection_delegate_factory.cc
new file mode 100644
index 0000000..d6c5f27
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_connection_delegate_factory.cc
@@ -0,0 +1,60 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_thread.h"
+#include "extensions/browser/extensions_browser_client.h"
+
+namespace extensions {
+
+using content::BrowserContext;
+
+// static
+DisplaySourceConnectionDelegate*
+DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
+    BrowserContext* browser_context) {
+  return static_cast<DisplaySourceConnectionDelegate*>(
+      GetInstance()->GetServiceForBrowserContext(browser_context, true));
+}
+
+// static
+DisplaySourceConnectionDelegateFactory*
+DisplaySourceConnectionDelegateFactory::GetInstance() {
+  return base::Singleton<DisplaySourceConnectionDelegateFactory>::get();
+}
+
+DisplaySourceConnectionDelegateFactory::DisplaySourceConnectionDelegateFactory()
+    : BrowserContextKeyedServiceFactory(
+          "DisplaySourceConnectionDelegate",
+          BrowserContextDependencyManager::GetInstance()) {}
+
+DisplaySourceConnectionDelegateFactory::
+    ~DisplaySourceConnectionDelegateFactory() {}
+
+KeyedService* DisplaySourceConnectionDelegateFactory::BuildServiceInstanceFor(
+    BrowserContext* browser_context) const {
+  DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+  DisplaySourceConnectionDelegate* delegate = nullptr;
+  // TODO(mikhail): Add implementation.
+  return delegate;
+}
+
+BrowserContext* DisplaySourceConnectionDelegateFactory::GetBrowserContextToUse(
+    BrowserContext* context) const {
+  return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
+}
+
+bool DisplaySourceConnectionDelegateFactory::
+    ServiceIsCreatedWithBrowserContext() const {
+  return false;
+}
+
+bool DisplaySourceConnectionDelegateFactory::ServiceIsNULLWhileTesting() const {
+  return false;
+}
+
+}  // namespace extensions
diff --git a/extensions/browser/api/display_source/display_source_connection_delegate_factory.h b/extensions/browser/api/display_source/display_source_connection_delegate_factory.h
new file mode 100644
index 0000000..ec412a98
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_connection_delegate_factory.h
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_FACTORY_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_FACTORY_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
+
+namespace context {
+class BrowserContext;
+}
+
+namespace extensions {
+
+class DisplaySourceConnectionDelegateFactory
+    : public BrowserContextKeyedServiceFactory {
+ public:
+  static DisplaySourceConnectionDelegate* GetForBrowserContext(
+      content::BrowserContext* browser_context);
+  static DisplaySourceConnectionDelegateFactory* GetInstance();
+
+ private:
+  friend struct base::DefaultSingletonTraits<
+      DisplaySourceConnectionDelegateFactory>;
+
+  DisplaySourceConnectionDelegateFactory();
+  ~DisplaySourceConnectionDelegateFactory() override;
+
+  // BrowserContextKeyedServiceFactory:
+  KeyedService* BuildServiceInstanceFor(
+      content::BrowserContext* browser_context) const override;
+  content::BrowserContext* GetBrowserContextToUse(
+      content::BrowserContext* context) const override;
+  bool ServiceIsCreatedWithBrowserContext() const override;
+  bool ServiceIsNULLWhileTesting() const override;
+
+  DISALLOW_COPY_AND_ASSIGN(DisplaySourceConnectionDelegateFactory);
+};
+
+}  // namespace extensions
+
+#endif  // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_FACTORY_H_
diff --git a/extensions/browser/api/display_source/display_source_event_router.cc b/extensions/browser/api/display_source/display_source_event_router.cc
new file mode 100644
index 0000000..db6f9ab3
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_event_router.cc
@@ -0,0 +1,100 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/display_source_event_router.h"
+
+#include "content/public/browser/browser_context.h"
+#include "extensions/browser/api/display_source/display_source_api.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+#include "extensions/common/api/display_source.h"
+
+namespace extensions {
+
+DisplaySourceEventRouter::DisplaySourceEventRouter(
+    content::BrowserContext* browser_context)
+    : browser_context_(browser_context), listening_(false) {
+  EventRouter* event_router = EventRouter::Get(browser_context_);
+  if (!event_router)
+    return;
+  event_router->RegisterObserver(
+      this, api::display_source::OnSinksUpdated::kEventName);
+}
+
+DisplaySourceEventRouter::~DisplaySourceEventRouter() {
+  DCHECK(!listening_);
+}
+
+void DisplaySourceEventRouter::Shutdown() {
+  EventRouter* event_router = EventRouter::Get(browser_context_);
+  if (event_router)
+    event_router->UnregisterObserver(this);
+
+  if (!listening_)
+    return;
+  listening_ = false;
+  DisplaySourceConnectionDelegate* delegate =
+      DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
+          browser_context_);
+  if (delegate)
+    delegate->RemoveObserver(this);
+}
+
+void DisplaySourceEventRouter::OnListenerAdded(
+    const EventListenerInfo& details) {
+  StartOrStopListeningForSinksChanges();
+}
+
+void DisplaySourceEventRouter::OnListenerRemoved(
+    const EventListenerInfo& details) {
+  StartOrStopListeningForSinksChanges();
+}
+
+void DisplaySourceEventRouter::StartOrStopListeningForSinksChanges() {
+  EventRouter* event_router = EventRouter::Get(browser_context_);
+  if (!event_router)
+    return;
+
+  bool should_listen = event_router->HasEventListener(
+      api::display_source::OnSinksUpdated::kEventName);
+  if (should_listen && !listening_) {
+    DisplaySourceConnectionDelegate* delegate =
+        DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
+            browser_context_);
+    if (delegate) {
+      delegate->AddObserver(this);
+      delegate->StartWatchingSinks();
+    }
+  }
+  if (!should_listen && listening_) {
+    DisplaySourceConnectionDelegate* delegate =
+        DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
+            browser_context_);
+    if (delegate) {
+      delegate->RemoveObserver(this);
+      delegate->StopWatchingSinks();
+    }
+  }
+
+  listening_ = should_listen;
+}
+
+void DisplaySourceEventRouter::OnSinksUpdated(
+    const DisplaySourceSinkInfoList& sinks) {
+  EventRouter* event_router = EventRouter::Get(browser_context_);
+  if (!event_router)
+    return;
+  scoped_ptr<base::ListValue> args(
+      api::display_source::OnSinksUpdated::Create(sinks));
+  scoped_ptr<Event> sinks_updated_event(
+      new Event(events::DISPLAY_SOURCE_ON_SINKS_UPDATED,
+                api::display_source::OnSinksUpdated::kEventName, args.Pass()));
+  event_router->BroadcastEvent(sinks_updated_event.Pass());
+}
+
+DisplaySourceEventRouter* DisplaySourceEventRouter::Create(
+    content::BrowserContext* browser_context) {
+  return new DisplaySourceEventRouter(browser_context);
+}
+
+}  // namespace extensions
diff --git a/extensions/browser/api/display_source/display_source_event_router.h b/extensions/browser/api/display_source/display_source_event_router.h
new file mode 100644
index 0000000..6697fe8
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_event_router.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_EVENT_ROUTER_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_EVENT_ROUTER_H_
+
+#include "base/macros.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
+#include "extensions/browser/event_router.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+
+// Observe listeners to 'onSinksUpdated' events.
+class DisplaySourceEventRouter
+    : public KeyedService,
+      public EventRouter::Observer,
+      public DisplaySourceConnectionDelegate::Observer {
+ public:
+  static DisplaySourceEventRouter* Create(
+      content::BrowserContext* browser_context);
+
+  ~DisplaySourceEventRouter() override;
+
+ private:
+  explicit DisplaySourceEventRouter(content::BrowserContext* browser_context);
+
+  // KeyedService overrides:
+  void Shutdown() override;
+
+  // EventRouter::Observer overrides:
+  void OnListenerAdded(const EventListenerInfo& details) override;
+  void OnListenerRemoved(const EventListenerInfo& details) override;
+
+  // DisplaySourceConnectionDelegate::Observer overrides:
+  void OnSinksUpdated(const DisplaySourceSinkInfoList& sinks) override;
+
+ private:
+  void StartOrStopListeningForSinksChanges();
+
+  content::BrowserContext* browser_context_;
+  bool listening_;
+
+  DISALLOW_COPY_AND_ASSIGN(DisplaySourceEventRouter);
+};
+
+}  // namespace extensions
+
+#endif  // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_EVENT_ROUTER_H_
diff --git a/extensions/browser/api/display_source/display_source_event_router_factory.cc b/extensions/browser/api/display_source/display_source_event_router_factory.cc
new file mode 100644
index 0000000..050159f
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_event_router_factory.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/display_source_event_router_factory.h"
+
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+#include "extensions/browser/api/display_source/display_source_event_router.h"
+#include "extensions/browser/extension_system_provider.h"
+#include "extensions/browser/extensions_browser_client.h"
+
+namespace extensions {
+
+// static
+DisplaySourceEventRouter* DisplaySourceEventRouterFactory::GetForProfile(
+    content::BrowserContext* context) {
+  return static_cast<DisplaySourceEventRouter*>(
+      GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+DisplaySourceEventRouterFactory*
+DisplaySourceEventRouterFactory::GetInstance() {
+  return base::Singleton<DisplaySourceEventRouterFactory>::get();
+}
+
+DisplaySourceEventRouterFactory::DisplaySourceEventRouterFactory()
+    : BrowserContextKeyedServiceFactory(
+          "DisplaySourceEventRouter",
+          BrowserContextDependencyManager::GetInstance()) {
+  DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
+  DependsOn(DisplaySourceConnectionDelegateFactory::GetInstance());
+}
+
+DisplaySourceEventRouterFactory::~DisplaySourceEventRouterFactory() {}
+
+KeyedService* DisplaySourceEventRouterFactory::BuildServiceInstanceFor(
+    content::BrowserContext* context) const {
+  return DisplaySourceEventRouter::Create(context);
+}
+
+content::BrowserContext*
+DisplaySourceEventRouterFactory::GetBrowserContextToUse(
+    content::BrowserContext* context) const {
+  return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
+}
+
+bool DisplaySourceEventRouterFactory::ServiceIsCreatedWithBrowserContext()
+    const {
+  return true;
+}
+
+bool DisplaySourceEventRouterFactory::ServiceIsNULLWhileTesting() const {
+  return true;
+}
+
+}  // namespace extensions
diff --git a/extensions/browser/api/display_source/display_source_event_router_factory.h b/extensions/browser/api/display_source/display_source_event_router_factory.h
new file mode 100644
index 0000000..7fd777f
--- /dev/null
+++ b/extensions/browser/api/display_source/display_source_event_router_factory.h
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_EVENT_ROUTER_FACTORY_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_EVENT_ROUTER_FACTORY_H_
+
+#include "base/macros.h"
+#include "base/memory/singleton.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+
+namespace extensions {
+
+class DisplaySourceEventRouter;
+
+class DisplaySourceEventRouterFactory
+    : public BrowserContextKeyedServiceFactory {
+ public:
+  // Returns the DisplaySourceEventRouter for |profile|, creating it if
+  // it is not yet created.
+  static DisplaySourceEventRouter* GetForProfile(
+      content::BrowserContext* context);
+
+  static DisplaySourceEventRouterFactory* GetInstance();
+
+ protected:
+  // BrowserContextKeyedBaseFactory overrides:
+  content::BrowserContext* GetBrowserContextToUse(
+      content::BrowserContext* context) const override;
+  bool ServiceIsCreatedWithBrowserContext() const override;
+  bool ServiceIsNULLWhileTesting() const override;
+
+ private:
+  friend struct base::DefaultSingletonTraits<DisplaySourceEventRouterFactory>;
+
+  DisplaySourceEventRouterFactory();
+  ~DisplaySourceEventRouterFactory() override;
+
+  // BrowserContextKeyedServiceFactory:
+  KeyedService* BuildServiceInstanceFor(
+      content::BrowserContext* profile) const override;
+
+  DISALLOW_COPY_AND_ASSIGN(DisplaySourceEventRouterFactory);
+};
+
+}  // namespace extensions
+
+#endif  // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_EVENT_ROUTER_FACTORY_H_
diff --git a/extensions/browser/browser_context_keyed_service_factories.cc b/extensions/browser/browser_context_keyed_service_factories.cc
index 8d1061f..002c68f 100644
--- a/extensions/browser/browser_context_keyed_service_factories.cc
+++ b/extensions/browser/browser_context_keyed_service_factories.cc
@@ -10,6 +10,7 @@
 #include "extensions/browser/api/bluetooth/bluetooth_api.h"
 #include "extensions/browser/api/bluetooth/bluetooth_private_api.h"
 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h"
+#include "extensions/browser/api/display_source/display_source_event_router_factory.h"
 #include "extensions/browser/api/hid/hid_device_manager.h"
 #include "extensions/browser/api/idle/idle_manager_factory.h"
 #include "extensions/browser/api/management/management_api.h"
@@ -61,6 +62,7 @@
   api::TCPSocketEventDispatcher::GetFactoryInstance();
   api::UDPSocketEventDispatcher::GetFactoryInstance();
   DeclarativeUserScriptManagerFactory::GetInstance();
+  DisplaySourceEventRouterFactory::GetInstance();
   EventRouterFactory::GetInstance();
   ExtensionMessageFilter::EnsureShutdownNotifierFactoryBuilt();
   ExtensionPrefsFactory::GetInstance();
diff --git a/extensions/browser/extension_event_histogram_value.h b/extensions/browser/extension_event_histogram_value.h
index 8a2bf65..6d0b30e 100644
--- a/extensions/browser/extension_event_histogram_value.h
+++ b/extensions/browser/extension_event_histogram_value.h
@@ -410,6 +410,7 @@
   EASY_UNLOCK_PRIVATE_ON_CONNECTION_STATUS_CHANGED,
   EASY_UNLOCK_PRIVATE_ON_DATA_RECEIVED,
   EASY_UNLOCK_PRIVATE_ON_SEND_COMPLETED,
+  DISPLAY_SOURCE_ON_SINKS_UPDATED,
   // Last entry: Add new entries above, then run:
   // python tools/metrics/histograms/update_extension_histograms.py
   ENUM_BOUNDARY
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 1faed63..7820b7f5 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -1156,6 +1156,8 @@
   SETTINGSPRIVATE_SETDEFAULTZOOMPERCENTFUNCTION,
   BLUETOOTHPRIVATE_CONNECT,
   BLUETOOTHPRIVATE_FORGETDEVICE,
+  DISPLAYSOURCE_GETAVAILABLESINKS,
+  DISPLAYSOURCE_REQUESTAUTHENTICATION,
   // Last entry: Add new entries above, then run:
   // python tools/metrics/histograms/update_extension_histograms.py
   ENUM_BOUNDARY
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json
index 540818b..012d906a 100644
--- a/extensions/common/api/_api_features.json
+++ b/extensions/common/api/_api_features.json
@@ -127,6 +127,10 @@
     "extension_types": ["platform_app"],
     "contexts": ["blessed_extension"]
   },
+  "displaySource": {
+    "dependencies": ["permission:displaySource"],
+    "contexts": ["blessed_extension"]
+  },
   "dns": {
     "dependencies": ["permission:dns"],
     "contexts": ["blessed_extension"]
diff --git a/extensions/common/api/_permission_features.json b/extensions/common/api/_permission_features.json
index c395360..ed3e535 100644
--- a/extensions/common/api/_permission_features.json
+++ b/extensions/common/api/_permission_features.json
@@ -184,6 +184,10 @@
       ]
     }
   ],
+  "displaySource": {
+    "channel": "dev",
+    "extension_types": ["extension", "platform_app"]
+  },
   "dns": [
     {
       "channel": "dev",
diff --git a/extensions/common/api/display_source.idl b/extensions/common/api/display_source.idl
new file mode 100644
index 0000000..a3821e35
--- /dev/null
+++ b/extensions/common/api/display_source.idl
@@ -0,0 +1,152 @@
+// 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.
+
+// The <code>chrome.displaySource</code> API creates a Display
+// session using WebMediaStreamTrack as sources.
+namespace displaySource {
+  enum ErrorType {
+    // Cannot create media pipeline from the given media stream which could be
+    // appropriate for a Display session (e.g., necessary codecs are missing
+    // on the platform).
+    create_media_pipeline_error,
+
+    // A new Display session cannot be started before the existing one is
+    // terminated.
+    exceeded_session_limit_error,
+
+    // Could not establish connection to the sink.
+    establish_connection_error,
+
+    // The capabilities of this Display Source and the connected  
+    // sink do not fit (e.g. the sink cannot play the media content of
+    // the formats given by the source).
+    capabilities_negotiation_error,
+
+    // There was an error while packetizing and sending the media content.
+    media_send_error,
+
+    // The TCP connection with sink has dropped unexpectedly.
+    connection_error,
+
+    // An unexpected message has arrived from the sink.
+    unexpected_message_error,
+
+    // The sink became unresponsive.
+    timeout_error,
+
+    // Unspecified error.
+    unknown_error
+  };
+
+  dictionary ErrorInfo {
+    ErrorType type;
+    DOMString? description;
+  };
+
+  enum SinkState {
+    // Connected using this Display Source (i.e., there is an active session)
+    Connected,
+    // In process of connection to this Display Source
+    Connecting,
+    // Disconnected from this Display Source
+    Disconnected
+  };
+
+  dictionary SinkInfo {
+    // Id of the sink. It is guaranteed to be unique during the browser session.
+    long id;
+    // Human readable name of the sink.
+    DOMString name;
+    // State of the sink.
+    SinkState state;
+  };
+
+  enum AuthenticationMethod {
+    // Push Button Config authentication method.
+    PBC,
+    // PIN authentication method.
+    PIN
+  };
+
+  dictionary AuthenticationInfo {
+    // Authentication method.
+    AuthenticationMethod method;
+    // Authentication data (e.g. PIN value).
+    DOMString? data;
+  };
+
+  dictionary StartSessionInfo {
+    // Id of the sink to connect.
+    long sinkId;
+    // Authentication information.
+    AuthenticationInfo? authenticationInfo;
+    // The source audio track.
+    [instanceOf=MediaStreamTrack] object? audioTrack;
+    // The source audio track.
+    [instanceOf=MediaStreamTrack] object? videoTrack;
+  };
+
+  callback GetSinksCallback = void (SinkInfo[] result);
+  callback RequestAuthenticationCallback = void (AuthenticationInfo result);
+  callback TerminateSessionCallback = void ();
+ 
+  interface Functions {
+    // Queries the list of the currently available Display sinks.
+    //
+    // |callback| : Called when the request is completed. The argument list
+    // is empty if no available sinks were found.
+    static void getAvailableSinks(GetSinksCallback callback);
+
+    // Queries authentication data from the sink device.
+    //
+    // |sinkId| : Id of the sink
+    // |callback| : Called when authentication info retrieved from the sink.
+    // The argument |method| field contains the authentication method required
+    // by the sink for connection; the |data| field can be null or can contain
+    // some supplementary data provided by the sink. If authentication info
+    // cannot be retrieved from the sink the "chrome.runtime.lastError" property
+    // is defined.
+    static void requestAuthentication(long sinkId,
+                                      RequestAuthenticationCallback callback);
+
+    // Creates a Display session using the provided StartSessionInfo instance.
+    // The input argument fields must be initialized as described below:
+    // The |sinkId|  must be a valid id of a sink (obtained via
+    // ‘getAvailableSinks’).
+    //
+    // The |audioTrack| or |videoTrack| must be of type MediaStreamTrack.
+    // Either |audioTrack| or |videoTrack| can be null but not both. This
+    // means creating a session with only audio or video.
+    //
+    // The |authenticationInfo| can be null if no additional authentication data
+    // are required by the sink; otherwise its |data| field must contain the
+    // required authentication data (e.g. PIN value) and its |method| field must
+    // be the same as one obtained from ‘requestAuthentication’.
+    [nocompile] static void startSession(StartSessionInfo sessionInfo);
+
+    // Terminates the active Display session.
+    // |sinkId| : Id of the connected sink.
+    // |callback| : Called when the session is terminated.
+    [nocompile] static void terminateSession(
+        long sinkId, optional TerminateSessionCallback callback);
+  };
+
+  interface Events {
+    // Event fired when the available sinks are modified (either their amount
+    // or properties)
+    // |sinks| the list of all currently available sinks
+    static void onSinksUpdated(SinkInfo[] sinks);
+    // Event fired when the Display session is started.
+    // |sinkId| Id of the peer sink
+    [nocompile] static void onSessionStarted(long sinkId);
+    // Event fired when the Display session is terminated.
+    // |sinkId| Id of the peer sink
+    [nocompile] static void onSessionTerminated(long sinkId);
+    // Event fired when an error occurs.
+    // |sinkId| Id of the peer sink
+    // |errorInfo| error description
+    [nocompile] static void onSessionErrorOccured(long sinkId,
+                                                  ErrorInfo errorInfo);
+  };
+};
diff --git a/extensions/common/api/schemas.gypi b/extensions/common/api/schemas.gypi
index 63b8fcf..a661132c 100644
--- a/extensions/common/api/schemas.gypi
+++ b/extensions/common/api/schemas.gypi
@@ -20,6 +20,7 @@
       'bluetooth_socket.idl',
       'cast_channel.idl',
       'document_scan.idl',
+      'display_source.idl',
       'dns.idl',
       'events.json',
       'extensions_manifest_types.json',
diff --git a/extensions/common/api/test.json b/extensions/common/api/test.json
index f4e193f4..55809fd 100644
--- a/extensions/common/api/test.json
+++ b/extensions/common/api/test.json
@@ -39,20 +39,7 @@
                   "testServer": {
                     "type": "object",
                     "optional": true,
-                    "description": "Details on the test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartTestServer().",
-                    "properties": {
-                      "port": {
-                        "type": "integer",
-                        "description": "The port on which the test server is listening.",
-                        "minimum": 1024,
-                        "maximum": 65535
-                      }
-                    }
-                  },
-                  "spawnedTestServer": {
-                    "type": "object",
-                    "optional": true,
-                    "description": "Details on the spawned test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartSpawnedTestServer().",
+                    "description": "Details on the test server used to mock network responses.  Will be set only if test calls ExtensionApiTest::StartEmbeddedTestServer().",
                     "properties": {
                       "port": {
                         "type": "integer",
diff --git a/extensions/common/permissions/api_permission.h b/extensions/common/permissions/api_permission.h
index 4f5b38c..5d46ce91 100644
--- a/extensions/common/permissions/api_permission.h
+++ b/extensions/common/permissions/api_permission.h
@@ -243,6 +243,7 @@
     kEnterpriseDeviceAttributes,
     kCertificateProvider,
     kResourcesPrivate,
+    kDisplaySource,
     // Last entry: Add new entries above and ensure to update the
     // "ExtensionPermission3" enum in tools/metrics/histograms/histograms.xml
     // (by running update_extension_permission.py).
diff --git a/extensions/common/permissions/extensions_api_permissions.cc b/extensions/common/permissions/extensions_api_permissions.cc
index c9eb11b..70a667f 100644
--- a/extensions/common/permissions/extensions_api_permissions.cc
+++ b/extensions/common/permissions/extensions_api_permissions.cc
@@ -54,6 +54,7 @@
       {APIPermission::kDiagnostics,
        "diagnostics",
        APIPermissionInfo::kFlagCannotBeOptional},
+      {APIPermission::kDisplaySource, "displaySource"},
       {APIPermission::kDns, "dns"},
       {APIPermission::kDocumentScan, "documentScan"},
       {APIPermission::kExtensionView,
diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi
index d963eb3..3f7ad6c6 100644
--- a/extensions/extensions.gypi
+++ b/extensions/extensions.gypi
@@ -321,6 +321,16 @@
       'browser/api/device_permissions_manager.h',
       'browser/api/device_permissions_prompt.cc',
       'browser/api/device_permissions_prompt.h',
+      'browser/api/display_source/display_source_api.cc',
+      'browser/api/display_source/display_source_api.h',
+      'browser/api/display_source/display_source_connection_delegate.cc',
+      'browser/api/display_source/display_source_connection_delegate.h',
+      'browser/api/display_source/display_source_connection_delegate_factory.cc',
+      'browser/api/display_source/display_source_connection_delegate_factory.h',
+      'browser/api/display_source/display_source_event_router.cc',
+      'browser/api/display_source/display_source_event_router_factory.cc',
+      'browser/api/display_source/display_source_event_router_factory.h',
+      'browser/api/display_source/display_source_event_router.h',
       'browser/api/dns/dns_api.cc',
       'browser/api/dns/dns_api.h',
       'browser/api/dns/host_resolver_wrapper.cc',
diff --git a/extensions/extensions_tests.gypi b/extensions/extensions_tests.gypi
index aab6570..68758604 100644
--- a/extensions/extensions_tests.gypi
+++ b/extensions/extensions_tests.gypi
@@ -7,6 +7,7 @@
     'extensions_browsertests_sources': [
       'browser/api/audio/audio_apitest.cc',
       'browser/api/bluetooth_socket/bluetooth_socket_apitest.cc',
+      'browser/api/display_source/display_source_apitest.cc',
       'browser/api/dns/dns_apitest.cc',
       'browser/api/hid/hid_apitest.cc',
       'browser/api/printer_provider/printer_provider_apitest.cc',
diff --git a/extensions/test/data/api_test/display_source/api/background.js b/extensions/test/data/api_test/display_source/api/background.js
new file mode 100644
index 0000000..a54d6b5
--- /dev/null
+++ b/extensions/test/data/api_test/display_source/api/background.js
@@ -0,0 +1,39 @@
+// 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.
+
+var testGetAvailableSinks = function() {
+  var callback = function(sinks) {
+    chrome.test.assertEq(1, sinks.length);
+    var sink = sinks[0];
+    chrome.test.assertEq(1, sink.id);
+    chrome.test.assertEq("Disconnected", sink.state);
+    chrome.test.assertEq("sink 1", sink.name);
+    chrome.test.succeed("GetAvailableSinks succeded");
+  };
+  chrome.displaySource.getAvailableSinks(callback);
+};
+
+var testOnSinksUpdated = function() {
+  var callback = function(sinks) {
+    chrome.test.assertEq(2, sinks.length);
+    var sink = sinks[1];
+    chrome.test.assertEq(2, sink.id);
+    chrome.test.assertEq("Disconnected", sink.state);
+    chrome.test.assertEq("sink 2", sink.name);
+    chrome.test.succeed("onSinksUpdated event delivered");
+  };
+  chrome.displaySource.onSinksUpdated.addListener(callback);
+};
+
+var testRequestAuthentication = function() {
+  var callback = function(auth_info) {
+    chrome.test.assertEq("PBC", auth_info.method);
+    chrome.test.succeed("RequestAuthentication succeded");
+  };
+  chrome.displaySource.requestAuthentication(1, callback);
+};
+
+chrome.test.runTests([testGetAvailableSinks,
+                      testOnSinksUpdated,
+                      testRequestAuthentication]);
diff --git a/extensions/test/data/api_test/display_source/api/manifest.json b/extensions/test/data/api_test/display_source/api/manifest.json
new file mode 100644
index 0000000..c390d3c
--- /dev/null
+++ b/extensions/test/data/api_test/display_source/api/manifest.json
@@ -0,0 +1,12 @@
+{
+  "name": "chrome.displaySource",
+  "version": "0.1",
+  "description": "end-to-end browser test for chrome.displaySource API",
+  "app": {
+    "background": {
+      "scripts": ["background.js"]
+    }
+  },
+  "permissions": ["displaySource"]
+}
+
diff --git a/ios/chrome/browser/chrome_switches.cc b/ios/chrome/browser/chrome_switches.cc
index ebaed09..c069fd53 100644
--- a/ios/chrome/browser/chrome_switches.cc
+++ b/ios/chrome/browser/chrome_switches.cc
@@ -91,4 +91,11 @@
 // A string used to override the default user agent with a custom one.
 const char kUserAgent[] = "user-agent";
 
+// These mappings only apply to the host resolver.
+const char kIOSHostResolverRules[] = "host-resolver-rules";
+
+// Allows for forcing socket connections to http/https to use fixed ports.
+const char kIOSTestingFixedHttpPort[] = "testing-fixed-http-port";
+const char kIOSTestingFixedHttpsPort[] = "testing-fixed-https-port";
+
 }  // namespace switches
diff --git a/ios/chrome/browser/chrome_switches.h b/ios/chrome/browser/chrome_switches.h
index 6d452ca..f7eea29 100644
--- a/ios/chrome/browser/chrome_switches.h
+++ b/ios/chrome/browser/chrome_switches.h
@@ -35,6 +35,10 @@
 extern const char kIOSMetricsRecordingOnly[];
 extern const char kUserAgent[];
 
+extern const char kIOSHostResolverRules[];
+extern const char kIOSTestingFixedHttpPort[];
+extern const char kIOSTestingFixedHttpsPort[];
+
 }  // namespace switches
 
 #endif  // IOS_CHROME_BROWSER_CHROME_SWITCHES_H_
diff --git a/ios/chrome/browser/ui/webui/gcm/OWNERS b/ios/chrome/browser/ui/webui/gcm/OWNERS
new file mode 100644
index 0000000..0f8cc7a
--- /dev/null
+++ b/ios/chrome/browser/ui/webui/gcm/OWNERS
@@ -0,0 +1,4 @@
+dimich@chromium.org
+fgorski@chromium.org
+jianli@chromium.org
+zea@chromium.org
diff --git a/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc b/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc
new file mode 100644
index 0000000..f66350cf
--- /dev/null
+++ b/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc
@@ -0,0 +1,173 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.h"
+
+#include <vector>
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/memory/weak_ptr.h"
+#include "base/values.h"
+#include "components/gcm_driver/gcm_client.h"
+#include "components/gcm_driver/gcm_driver.h"
+#include "components/gcm_driver/gcm_internals_constants.h"
+#include "components/gcm_driver/gcm_internals_helper.h"
+#include "components/gcm_driver/gcm_profile_service.h"
+#include "grit/components_resources.h"
+#include "ios/chrome/browser/chrome_url_constants.h"
+#include "ios/chrome/browser/services/gcm/ios_chrome_gcm_profile_service_factory.h"
+#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/public/provider/web/web_ui_ios.h"
+#include "ios/public/provider/web/web_ui_ios_message_handler.h"
+#include "ios/web/public/web_ui_ios_data_source.h"
+
+namespace {
+
+// Class acting as a controller of the chrome://gcm-internals WebUI.
+class GcmInternalsUIMessageHandler : public web::WebUIIOSMessageHandler {
+ public:
+  GcmInternalsUIMessageHandler();
+  ~GcmInternalsUIMessageHandler() override;
+
+  // WebUIMessageHandler implementation.
+  void RegisterMessages() override;
+
+ private:
+  // Return all of the GCM related infos to the gcm-internals page by calling
+  // Javascript callback function |gcm-internals.returnInfo()|.
+  void ReturnResults(PrefService* prefs,
+                     gcm::GCMProfileService* profile_service,
+                     const gcm::GCMClient::GCMStatistics* stats) const;
+
+  // Request all of the GCM related infos through gcm profile service.
+  void RequestAllInfo(const base::ListValue* args);
+
+  // Enables/disables GCM activity recording through gcm profile service.
+  void SetRecording(const base::ListValue* args);
+
+  // Callback function of the request for all gcm related infos.
+  void RequestGCMStatisticsFinished(
+      const gcm::GCMClient::GCMStatistics& args) const;
+
+  // Factory for creating references in callbacks.
+  base::WeakPtrFactory<GcmInternalsUIMessageHandler> weak_ptr_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(GcmInternalsUIMessageHandler);
+};
+
+GcmInternalsUIMessageHandler::GcmInternalsUIMessageHandler()
+    : weak_ptr_factory_(this) {}
+
+GcmInternalsUIMessageHandler::~GcmInternalsUIMessageHandler() {}
+
+void GcmInternalsUIMessageHandler::ReturnResults(
+    PrefService* prefs,
+    gcm::GCMProfileService* profile_service,
+    const gcm::GCMClient::GCMStatistics* stats) const {
+  base::DictionaryValue results;
+  gcm_driver::SetGCMInternalsInfo(stats, profile_service, prefs, &results);
+  web_ui()->CallJavascriptFunction(gcm_driver::kSetGcmInternalsInfo, results);
+}
+
+void GcmInternalsUIMessageHandler::RequestAllInfo(const base::ListValue* args) {
+  if (args->GetSize() != 1) {
+    NOTREACHED();
+    return;
+  }
+  bool clear_logs = false;
+  if (!args->GetBoolean(0, &clear_logs)) {
+    NOTREACHED();
+    return;
+  }
+
+  ios::ChromeBrowserState* browser_state =
+      ios::ChromeBrowserState::FromWebUIIOS(web_ui());
+  gcm::GCMProfileService* profile_service =
+      IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state);
+
+  if (!profile_service || !profile_service->driver()) {
+    ReturnResults(browser_state->GetPrefs(), nullptr, nullptr);
+  } else {
+    profile_service->driver()->GetGCMStatistics(
+        base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
+                   weak_ptr_factory_.GetWeakPtr()),
+        clear_logs);
+  }
+}
+
+void GcmInternalsUIMessageHandler::SetRecording(const base::ListValue* args) {
+  if (args->GetSize() != 1) {
+    NOTREACHED();
+    return;
+  }
+  bool recording = false;
+  if (!args->GetBoolean(0, &recording)) {
+    NOTREACHED();
+    return;
+  }
+
+  ios::ChromeBrowserState* browser_state =
+      ios::ChromeBrowserState::FromWebUIIOS(web_ui());
+  gcm::GCMProfileService* profile_service =
+      IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state);
+
+  if (!profile_service) {
+    ReturnResults(browser_state->GetPrefs(), nullptr, nullptr);
+    return;
+  }
+  // Get fresh stats after changing recording setting.
+  profile_service->driver()->SetGCMRecording(
+      base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
+                 weak_ptr_factory_.GetWeakPtr()),
+      recording);
+}
+
+void GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished(
+    const gcm::GCMClient::GCMStatistics& stats) const {
+  ios::ChromeBrowserState* browser_state =
+      ios::ChromeBrowserState::FromWebUIIOS(web_ui());
+  DCHECK(browser_state);
+  gcm::GCMProfileService* profile_service =
+      IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state);
+
+  DCHECK(profile_service);
+  ReturnResults(browser_state->GetPrefs(), profile_service, &stats);
+}
+
+void GcmInternalsUIMessageHandler::RegisterMessages() {
+  web_ui()->RegisterMessageCallback(
+      gcm_driver::kGetGcmInternalsInfo,
+      base::Bind(&GcmInternalsUIMessageHandler::RequestAllInfo,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback(
+      gcm_driver::kSetGcmInternalsRecording,
+      base::Bind(&GcmInternalsUIMessageHandler::SetRecording,
+                 weak_ptr_factory_.GetWeakPtr()));
+}
+
+}  // namespace
+
+GCMInternalsUI::GCMInternalsUI(web::WebUIIOS* web_ui)
+    : web::WebUIIOSController(web_ui) {
+  // Set up the chrome://gcm-internals source.
+  web::WebUIIOSDataSource* html_source =
+      web::WebUIIOSDataSource::Create(kChromeUIGCMInternalsHost);
+
+  html_source->SetJsonPath("strings.js");
+
+  // Add required resources.
+  html_source->AddResourcePath(gcm_driver::kGcmInternalsCSS,
+                               IDR_GCM_DRIVER_GCM_INTERNALS_CSS);
+  html_source->AddResourcePath(gcm_driver::kGcmInternalsJS,
+                               IDR_GCM_DRIVER_GCM_INTERNALS_JS);
+  html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML);
+
+  web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
+                               html_source);
+
+  web_ui->AddMessageHandler(new GcmInternalsUIMessageHandler());
+}
+
+GCMInternalsUI::~GCMInternalsUI() {}
diff --git a/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.h b/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.h
new file mode 100644
index 0000000..e4c60f71
--- /dev/null
+++ b/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.h
@@ -0,0 +1,25 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_WEBUI_GCM_GCM_INTERNALS_UI_H_
+#define IOS_CHROME_BROWSER_UI_WEBUI_GCM_GCM_INTERNALS_UI_H_
+
+#include "base/macros.h"
+#include "ios/public/provider/web/web_ui_ios_controller.h"
+
+namespace web {
+class WebUIIOS;
+}
+
+// The WebUIIOS for chrome://gcm-internals.
+class GCMInternalsUI : public web::WebUIIOSController {
+ public:
+  explicit GCMInternalsUI(web::WebUIIOS* web_ui);
+  ~GCMInternalsUI() override;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(GCMInternalsUI);
+};
+
+#endif  // IOS_CHROME_BROWSER_UI_WEBUI_GCM_GCM_INTERNALS_UI_H_
diff --git a/ios/chrome/ios_chrome.gyp b/ios/chrome/ios_chrome.gyp
index 9fd040b..03007e35 100644
--- a/ios/chrome/ios_chrome.gyp
+++ b/ios/chrome/ios_chrome.gyp
@@ -118,6 +118,9 @@
         'ios_chrome_resources.gyp:ios_chrome_ui_string_overrider_factory',
         'ios_chrome_resources.gyp:ios_chrome_ui_string_overrider_factory_gen',
       ],
+      'export_dependent_settings': [
+        '../../components/components.gyp:dom_distiller_core',
+      ],
       'link_settings': {
         'libraries': [
           '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework',
@@ -526,6 +529,8 @@
         'browser/ui/webui/about_ui.h',
         'browser/ui/webui/crashes_ui.cc',
         'browser/ui/webui/crashes_ui.h',
+        'browser/ui/webui/gcm/gcm_internals_ui.cc',
+        'browser/ui/webui/gcm/gcm_internals_ui.h',
         'browser/ui/webui/net_export/net_export_ui.cc',
         'browser/ui/webui/net_export/net_export_ui.h',
         'browser/ui/webui/sync_internals/sync_internals_message_handler.cc',
diff --git a/ios/web/webui/url_data_manager_ios_backend.cc b/ios/web/webui/url_data_manager_ios_backend.cc
index cc3e3e9..d5117c2 100644
--- a/ios/web/webui/url_data_manager_ios_backend.cc
+++ b/ios/web/webui/url_data_manager_ios_backend.cc
@@ -96,7 +96,7 @@
   // net::URLRequestJob implementation.
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool GetMimeType(std::string* mime_type) const override;
   int GetResponseCode() const override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
@@ -142,7 +142,7 @@
 
   // Do the actual copy from data_ (the data we're serving) into |buf|.
   // Separate from ReadRawData so we can handle async I/O.
-  void CompleteRead(net::IOBuffer* buf, int buf_size, int* bytes_read);
+  int CompleteRead(net::IOBuffer* buf, int buf_size);
 
   // The actual data we're serving.  NULL until it's been fetched.
   scoped_refptr<base::RefCountedMemory> data_;
@@ -291,58 +291,46 @@
 void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) {
   TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this);
   if (bytes) {
-    // The request completed, and we have all the data.
-    // Clear any IO pending status.
-    SetStatus(net::URLRequestStatus());
-
     data_ = bytes;
-    int bytes_read;
     if (pending_buf_.get()) {
       CHECK(pending_buf_->data());
-      CompleteRead(pending_buf_.get(), pending_buf_size_, &bytes_read);
+      int rv = CompleteRead(pending_buf_.get(), pending_buf_size_);
       pending_buf_ = NULL;
-      NotifyReadComplete(bytes_read);
+      ReadRawDataComplete(rv);
     }
   } else {
-    // The request failed.
-    NotifyDone(
-        net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED));
+    ReadRawDataComplete(net::ERR_FAILED);
   }
 }
 
-bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf,
-                                      int buf_size,
-                                      int* bytes_read) {
+int URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size) {
   if (!data_.get()) {
-    SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
     DCHECK(!pending_buf_.get());
     CHECK(buf->data());
     pending_buf_ = buf;
     pending_buf_size_ = buf_size;
-    return false;  // Tell the caller we're still waiting for data.
+    return net::ERR_IO_PENDING;  // Tell the caller we're still waiting for
+                                 // data.
   }
 
   // Otherwise, the data is available.
-  CompleteRead(buf, buf_size, bytes_read);
-  return true;
+  return CompleteRead(buf, buf_size);
 }
 
-void URLRequestChromeJob::CompleteRead(net::IOBuffer* buf,
-                                       int buf_size,
-                                       int* bytes_read) {
+int URLRequestChromeJob::CompleteRead(net::IOBuffer* buf, int buf_size) {
   // http://crbug.com/373841
   char url_buf[128];
   base::strlcpy(url_buf, request_->url().spec().c_str(), arraysize(url_buf));
   base::debug::Alias(url_buf);
 
-  int remaining = static_cast<int>(data_->size()) - data_offset_;
+  int remaining = data_->size() - data_offset_;
   if (buf_size > remaining)
     buf_size = remaining;
   if (buf_size > 0) {
     memcpy(buf->data(), data_->front() + data_offset_, buf_size);
     data_offset_ += buf_size;
   }
-  *bytes_read = buf_size;
+  return buf_size;
 }
 
 namespace {
diff --git a/mandoline/services/core_services/BUILD.gn b/mandoline/services/core_services/BUILD.gn
index 90cfed5..642fe6d 100644
--- a/mandoline/services/core_services/BUILD.gn
+++ b/mandoline/services/core_services/BUILD.gn
@@ -47,6 +47,7 @@
     "//mojo/message_pump",
     "//mojo/public/cpp/bindings",
     "//mojo/services/tracing:lib",
+    "//mojo/services/tracing/public/cpp",
     "//third_party/icu",
     "//url",
   ]
diff --git a/mandoline/services/core_services/core_services_application_delegate.cc b/mandoline/services/core_services/core_services_application_delegate.cc
index 7a22c7b..093beac 100644
--- a/mandoline/services/core_services/core_services_application_delegate.cc
+++ b/mandoline/services/core_services/core_services_application_delegate.cc
@@ -17,6 +17,7 @@
 #include "mojo/application/public/cpp/application_runner.h"
 #include "mojo/logging/init_logging.h"
 #include "mojo/message_pump/message_pump_mojo.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 #include "mojo/services/tracing/tracing_app.h"
 #include "url/gurl.h"
 
@@ -98,6 +99,7 @@
 void CoreServicesApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
   base::PlatformThread::SetName("CoreServicesDispatcher");
   mojo::logging::InitLogging();
+  tracing_.Initialize(app);
 }
 
 bool CoreServicesApplicationDelegate::ConfigureIncomingConnection(
diff --git a/mandoline/services/core_services/core_services_application_delegate.h b/mandoline/services/core_services/core_services_application_delegate.h
index 03ee9d9d6..168f068 100644
--- a/mandoline/services/core_services/core_services_application_delegate.h
+++ b/mandoline/services/core_services/core_services_application_delegate.h
@@ -13,6 +13,7 @@
 #include "mojo/application/public/cpp/interface_factory_impl.h"
 #include "mojo/application/public/interfaces/content_handler.mojom.h"
 #include "mojo/common/weak_binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 
 namespace core_services {
 
@@ -51,6 +52,7 @@
   mojo::WeakBindingSet<ContentHandler> handler_bindings_;
 
   ScopedVector<ApplicationThread> application_threads_;
+  mojo::TracingImpl tracing_;
 
   base::WeakPtrFactory<CoreServicesApplicationDelegate> weak_factory_;
 
diff --git a/mandoline/ui/desktop_ui/BUILD.gn b/mandoline/ui/desktop_ui/BUILD.gn
index 12b8b76..e84c565 100644
--- a/mandoline/ui/desktop_ui/BUILD.gn
+++ b/mandoline/ui/desktop_ui/BUILD.gn
@@ -43,6 +43,7 @@
     "//mojo/common:common_base",
     "//mojo/converters/geometry",
     "//mojo/public/cpp/bindings",
+    "//mojo/services/tracing/public/cpp",
     "//mojo/services/tracing/public/interfaces",
     "//skia",
     "//ui/gfx",
diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc
index 067bfb6..c049cf2 100644
--- a/mandoline/ui/desktop_ui/browser_window.cc
+++ b/mandoline/ui/desktop_ui/browser_window.cc
@@ -17,9 +17,9 @@
 #include "mandoline/ui/desktop_ui/find_bar_view.h"
 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h"
 #include "mandoline/ui/desktop_ui/toolbar_view.h"
-#include "mojo/application/public/cpp/switches.h"
 #include "mojo/common/common_type_converters.h"
 #include "mojo/converters/geometry/geometry_type_converters.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 #include "ui/gfx/canvas.h"
 #include "ui/mojo/init/ui_init.h"
@@ -241,7 +241,7 @@
   static bool recorded_browser_startup_metrics = false;
   if (!recorded_browser_startup_metrics &&
       base::CommandLine::ForCurrentProcess()->HasSwitch(
-          mojo::kEnableStatsCollectionBindings)) {
+          tracing::kEnableStatsCollectionBindings)) {
     mojo::URLRequestPtr request(mojo::URLRequest::New());
     request->url = mojo::String::From("mojo:tracing");
     tracing::StartupPerformanceDataCollectorPtr collector;
diff --git a/media/base/android/webaudio_media_codec_bridge.cc b/media/base/android/webaudio_media_codec_bridge.cc
index 312e9663..55996a3 100644
--- a/media/base/android/webaudio_media_codec_bridge.cc
+++ b/media/base/android/webaudio_media_codec_bridge.cc
@@ -6,6 +6,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/media/blink/BUILD.gn b/media/blink/BUILD.gn
index 3b9365c..54d5429 100644
--- a/media/blink/BUILD.gn
+++ b/media/blink/BUILD.gn
@@ -48,8 +48,6 @@
     "media_blink_export.h",
     "multibuffer.cc",
     "multibuffer.h",
-    "multibuffer_reader.cc",
-    "multibuffer_reader.h",
     "new_session_cdm_result_promise.cc",
     "new_session_cdm_result_promise.h",
     "texttrack_impl.cc",
@@ -124,7 +122,6 @@
     "mock_webframeclient.h",
     "mock_weburlloader.cc",
     "mock_weburlloader.h",
-    "multibuffer_unittest.cc",
     "run_all_unittests.cc",
     "test_random.h",
     "test_response_generator.cc",
diff --git a/media/blink/interval_map.h b/media/blink/interval_map.h
index 74cdca7..e11a03c 100644
--- a/media/blink/interval_map.h
+++ b/media/blink/interval_map.h
@@ -124,6 +124,8 @@
 
   // Needed to make the following construct work:
   // for (const auto& interval_value_pair : interval_map)
+  // Note however that this will skip the "end" interval, which
+  // is usually ok since it generally has the default value.
   std::pair<Interval<KeyType>, ValueType> operator*() const {
     return std::make_pair(interval(), value());
   }
@@ -180,7 +182,8 @@
 
   // Increase [from..to) by |how_much|.
   void IncrementInterval(KeyType from, KeyType to, ValueType how_much) {
-    if (to <= from || how_much == 0)
+    DCHECK_GT(to, from);
+    if (how_much == 0)
       return;
     typename MapType::iterator a = MakeEntry(from);
     typename MapType::iterator b = MakeEntry(to);
@@ -194,8 +197,7 @@
 
   // Set [from..to) to |how_much|.
   void SetInterval(KeyType from, KeyType to, ValueType how_much) {
-    if (to <= from)
-      return;
+    DCHECK_GT(to, from);
     typename MapType::iterator a = MakeEntry(from);
     typename MapType::iterator b = MakeEntry(to);
     a->second = how_much;
diff --git a/media/blink/media_blink.gyp b/media/blink/media_blink.gyp
index 3b08ee7..17a577d 100644
--- a/media/blink/media_blink.gyp
+++ b/media/blink/media_blink.gyp
@@ -53,8 +53,6 @@
         'media_blink_export.h',
         'multibuffer.cc',
         'multibuffer.h',
-        'multibuffer_reader.cc',
-        'multibuffer_reader.h',
         'new_session_cdm_result_promise.cc',
         'new_session_cdm_result_promise.h',
         'texttrack_impl.cc',
@@ -130,7 +128,6 @@
         'mock_webframeclient.h',
         'mock_weburlloader.cc',
         'mock_weburlloader.h',
-        'multibuffer_unittest.cc',
         'run_all_unittests.cc',
         'test_random.h',
         'test_response_generator.cc',
diff --git a/media/blink/multibuffer_reader.cc b/media/blink/multibuffer_reader.cc
deleted file mode 100644
index 8f98167..0000000
--- a/media/blink/multibuffer_reader.cc
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/message_loop/message_loop.h"
-#include "media/blink/multibuffer_reader.h"
-#include "net/base/net_errors.h"
-
-namespace media {
-
-MultiBufferReader::MultiBufferReader(
-    MultiBuffer* multibuffer,
-    int64_t start,
-    int64_t end,
-    const base::Callback<void(int64_t, int64_t)>& progress_callback)
-    : multibuffer_(multibuffer),
-      // If end is -1, we use a very large (but still supported) value instead.
-      end_(end == -1LL ? (1LL << (multibuffer->block_size_shift() + 30)) : end),
-      preload_high_(0),
-      preload_low_(0),
-      max_buffer_forward_(0),
-      max_buffer_backward_(0),
-      pos_(start),
-      preload_pos_(-1),
-      loading_(true),
-      current_wait_size_(0),
-      progress_callback_(progress_callback),
-      weak_factory_(this) {
-  DCHECK_GE(start, 0);
-  DCHECK_GE(end_, 0);
-}
-
-MultiBufferReader::~MultiBufferReader() {
-  multibuffer_->RemoveReader(preload_pos_, this);
-  multibuffer_->IncrementMaxSize(
-      -block_ceil(max_buffer_forward_ + max_buffer_backward_));
-  multibuffer_->PinRange(block(pos_ - max_buffer_backward_),
-                         block_ceil(pos_ + max_buffer_forward_), -1);
-  multibuffer_->CleanupWriters(preload_pos_);
-}
-
-void MultiBufferReader::Seek(int64_t pos) {
-  DCHECK_GE(pos, 0);
-  if (pos == pos_)
-    return;
-  // Use a rangemap to compute the diff in pinning.
-  IntervalMap<MultiBuffer::BlockId, int32_t> tmp;
-  tmp.IncrementInterval(block(pos_ - max_buffer_backward_),
-                        block_ceil(pos_ + max_buffer_forward_), -1);
-  tmp.IncrementInterval(block(pos - max_buffer_backward_),
-                        block_ceil(pos + max_buffer_forward_), 1);
-
-  multibuffer_->PinRanges(tmp);
-
-  multibuffer_->RemoveReader(preload_pos_, this);
-  MultiBufferBlockId old_preload_pos = preload_pos_;
-  preload_pos_ = block(pos);
-  pos_ = pos;
-  UpdateInternalState();
-  multibuffer_->CleanupWriters(old_preload_pos);
-}
-
-void MultiBufferReader::SetMaxBuffer(int64_t backward, int64_t forward) {
-  // Safe, because we know this doesn't actually prune the cache right away.
-  multibuffer_->IncrementMaxSize(
-      -block_ceil(max_buffer_forward_ + max_buffer_backward_));
-  // Use a rangemap to compute the diff in pinning.
-  IntervalMap<MultiBuffer::BlockId, int32_t> tmp;
-  tmp.IncrementInterval(block(pos_ - max_buffer_backward_),
-                        block_ceil(pos_ + max_buffer_forward_), -1);
-  max_buffer_backward_ = backward;
-  max_buffer_forward_ = forward;
-  tmp.IncrementInterval(block(pos_ - max_buffer_backward_),
-                        block_ceil(pos_ + max_buffer_forward_), 1);
-  multibuffer_->PinRanges(tmp);
-
-  multibuffer_->IncrementMaxSize(
-      block_ceil(max_buffer_forward_ + max_buffer_backward_));
-}
-
-int64_t MultiBufferReader::Available() const {
-  int64_t unavailable_byte_pos =
-      static_cast<int64_t>(multibuffer_->FindNextUnavailable(block(pos_)))
-      << multibuffer_->block_size_shift();
-  return std::max<int64_t>(0, unavailable_byte_pos - pos_);
-}
-
-int64_t MultiBufferReader::TryRead(uint8_t* data, int64_t len) {
-  DCHECK_GT(len, 0);
-  current_wait_size_ = 0;
-  cb_.Reset();
-  DCHECK_LE(pos_ + len, end_);
-  const MultiBuffer::DataMap& data_map = multibuffer_->map();
-  MultiBuffer::DataMap::const_iterator i = data_map.find(block(pos_));
-  int64_t p = pos_;
-  int64_t bytes_read = 0;
-  while (bytes_read < len) {
-    if (i == data_map.end())
-      break;
-    if (i->first != block(p))
-      break;
-    if (i->second->end_of_stream())
-      break;
-    size_t offset = p & ((1LL << multibuffer_->block_size_shift()) - 1);
-    size_t tocopy =
-        std::min<size_t>(len - bytes_read, i->second->data_size() - offset);
-    memcpy(data, i->second->data() + offset, tocopy);
-    data += tocopy;
-    bytes_read += tocopy;
-    p += tocopy;
-    ++i;
-  }
-  Seek(p);
-  return bytes_read;
-}
-
-int MultiBufferReader::Wait(int64_t len, const base::Closure& cb) {
-  DCHECK_LE(pos_ + len, end_);
-  DCHECK_NE(Available(), -1);
-  DCHECK_LE(len, max_buffer_forward_);
-  current_wait_size_ = len;
-
-  cb_.Reset();
-  UpdateInternalState();
-
-  if (Available() >= current_wait_size_) {
-    return net::OK;
-  } else {
-    cb_ = cb;
-    return net::ERR_IO_PENDING;
-  }
-}
-
-void MultiBufferReader::SetPreload(int64_t preload_high, int64_t preload_low) {
-  DCHECK_GE(preload_high, preload_low);
-  multibuffer_->RemoveReader(preload_pos_, this);
-  preload_pos_ = block(pos_);
-  preload_high_ = preload_high;
-  preload_low_ = preload_low;
-  UpdateInternalState();
-}
-
-bool MultiBufferReader::IsLoading() const {
-  return loading_;
-}
-
-void MultiBufferReader::CheckWait() {
-  if (!cb_.is_null() &&
-      (Available() >= current_wait_size_ || Available() == -1)) {
-    // We redirect the call through a weak pointer to ourselves to guarantee
-    // there are no callbacks from us after we've been destroyed.
-    base::MessageLoop::current()->PostTask(
-        FROM_HERE,
-        base::Bind(&MultiBufferReader::Call, weak_factory_.GetWeakPtr(),
-                   base::ResetAndReturn(&cb_)));
-  }
-}
-
-void MultiBufferReader::Call(const base::Closure& cb) const {
-  cb.Run();
-}
-
-void MultiBufferReader::NotifyAvailableRange(
-    const Interval<MultiBufferBlockId>& range) {
-  // Update end_ if we can.
-  if (range.end > range.begin) {
-    auto i = multibuffer_->map().find(range.end - 1);
-    DCHECK(i != multibuffer_->map().end());
-    if (i->second->end_of_stream()) {
-      // This is an upper limit because the last-to-one block is allowed
-      // to be smaller than the rest of the blocks.
-      int64_t size_upper_limit = static_cast<int64_t>(range.end)
-                                 << multibuffer_->block_size_shift();
-      end_ = std::min(end_, size_upper_limit);
-    }
-  }
-  UpdateInternalState();
-  if (!progress_callback_.is_null()) {
-    // We redirect the call through a weak pointer to ourselves to guarantee
-    // there are no callbacks from us after we've been destroyed.
-    base::MessageLoop::current()->PostTask(
-        FROM_HERE,
-        base::Bind(&MultiBufferReader::Call, weak_factory_.GetWeakPtr(),
-                   base::Bind(progress_callback_,
-                              static_cast<int64_t>(range.begin)
-                                  << multibuffer_->block_size_shift(),
-                              static_cast<int64_t>(range.end)
-                                  << multibuffer_->block_size_shift())));
-    // We may be destroyed, do not touch |this|.
-  }
-}
-
-void MultiBufferReader::UpdateInternalState() {
-  int64_t effective_preload = loading_ ? preload_high_ : preload_low_;
-
-  loading_ = false;
-  if (preload_pos_ == -1) {
-    preload_pos_ = block(pos_);
-    DCHECK_GE(preload_pos_, 0);
-  }
-  MultiBuffer::BlockId max_preload = block_ceil(
-      std::min(end_, pos_ + std::max(effective_preload, current_wait_size_)));
-
-  // Note that we might not have been added to the multibuffer,
-  // removing ourselves is a no-op in that case.
-  multibuffer_->RemoveReader(preload_pos_, this);
-
-  // We explicitly allow preloading to go beyond the pinned region in the cache.
-  // It only happens when we want to preload something into the disk cache.
-  // Thus it is possible to have blocks between our current reading position
-  // and preload_pos_ be unavailable. When we get a Seek() call (possibly
-  // through TryRead()) we reset the preload_pos_ to the current reading
-  // position, and preload_pos_ will become the first unavailable block after
-  // our current reading position again.
-  preload_pos_ = multibuffer_->FindNextUnavailable(preload_pos_);
-  DCHECK_GE(preload_pos_, 0);
-
-  DVLOG(3) << "UpdateInternalState"
-           << " pp = " << preload_pos_
-           << " block_ceil(end_) = " << block_ceil(end_) << " end_ = " << end_
-           << " max_preload " << max_preload;
-
-  if (preload_pos_ < block_ceil(end_)) {
-    if (preload_pos_ < max_preload) {
-      loading_ = true;
-      multibuffer_->AddReader(preload_pos_, this);
-    } else if (multibuffer_->Contains(preload_pos_ - 1)) {
-      --preload_pos_;
-      multibuffer_->AddReader(preload_pos_, this);
-    }
-  }
-  CheckWait();
-}
-
-}  // namespace media
diff --git a/media/blink/multibuffer_reader.h b/media/blink/multibuffer_reader.h
deleted file mode 100644
index 44f14f9..0000000
--- a/media/blink/multibuffer_reader.h
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_BLINK_MULTIBUFFER_READER_H_
-#define MEDIA_BLINK_MULTIBUFFER_READER_H_
-
-#include <stdint.h>
-
-#include <limits>
-#include <map>
-#include <set>
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "media/blink/media_blink_export.h"
-#include "media/blink/multibuffer.h"
-
-namespace media {
-
-// Wrapper for MultiBuffer that offers a simple byte-reading
-// interface with prefetch.
-class MEDIA_BLINK_EXPORT MultiBufferReader
-    : NON_EXPORTED_BASE(public MultiBuffer::Reader) {
- public:
-  // Note that |progress_callback| is guaranteed to be called if
-  // a redirect happens and the url_data is updated. Otherwise
-  // origin checks will become insecure.
-  // Users probably want to call SetMaxBuffer & SetPreload after
-  // creating the a MultiBufferReader.
-  // The progress callback will be called when the "available range"
-  // changes. (The number of bytes available for reading before and
-  // after the current position.) The arguments for the progress
-  // callback is the first byte available (from beginning of file)
-  // and the last byte available + 1. Note that there may be other
-  // regions of available data in the cache as well.
-  // If |end| is not known, use -1.
-  MultiBufferReader(
-      MultiBuffer* multibuffer,
-      int64_t start,
-      int64_t end,
-      const base::Callback<void(int64_t, int64_t)>& progress_callback);
-
-  ~MultiBufferReader() override;
-
-  // Returns number of bytes available for reading. When the rest of the file
-  // is available, the number returned will be greater than the number
-  // or readable bytes. If an error occurs, -1 is returned.
-  int64_t Available() const;
-
-  // Seek to a different position.
-  // If there is a pending Wait(), it will be cancelled.
-  void Seek(int64_t pos);
-
-  // Returns the current position.
-  int64_t Tell() const { return pos_; }
-
-  // Tries to read |len| bytes and advance position.
-  // Returns number of bytes read.
-  // If there is a pending Wait(), it will be cancelled.
-  int64_t TryRead(uint8_t* data, int64_t len);
-
-  // Wait until |len| bytes are available for reading.
-  // Returns net::OK if |len| bytes are already available, otherwise it will
-  // return net::ERR_IO_PENDING and call |cb| at some point later.
-  // |len| must be smaller or equal to max_buffer_forward.
-  int Wait(int64_t len, const base::Closure& cb);
-
-  // Set how much data we try to preload into the cache ahead of our current
-  // location. Normally, we preload until we have preload_high bytes, then
-  // stop until we fall below preload_low bytes. Note that preload can be
-  // set higher than max_buffer_forward, but the result is usually that
-  // some blocks will be freed between the current position and the preload
-  // position.
-  void SetPreload(int64_t preload_high, int64_t preload_low);
-
-  // Change how much data we pin to the cache.
-  // The range [current_position - backward ... current_position + forward)
-  // will be locked in the cache. Calling Wait() or TryRead() with values
-  // larger than |forward| is not supported.
-  void SetMaxBuffer(int64_t backward, int64_t forward);
-
-  // Returns true if we are currently loading data.
-  bool IsLoading() const;
-
-  // Reader implementation.
-  void NotifyAvailableRange(const Interval<MultiBufferBlockId>& range) override;
-
-  // Getters
-  int64_t preload_high() const { return preload_high_; }
-  int64_t preload_low() const { return preload_low_; }
-
- private:
-  // Returns the block for a particular byte position.
-  MultiBufferBlockId block(int64_t byte_pos) const {
-    return byte_pos >> multibuffer_->block_size_shift();
-  }
-
-  // Returns the block for a particular byte position, rounding up.
-  MultiBufferBlockId block_ceil(int64_t byte_pos) const {
-    return block(byte_pos + (1LL << multibuffer_->block_size_shift()) - 1);
-  }
-
-  // Check if wait operation can complete now.
-  void CheckWait();
-
-  // Recalculate preload_pos_ and update our entry in the multibuffer
-  // reader index. Also call CheckWait(). This function is basically
-  // called anything changes, like when we get more data or seek to
-  // a new position.
-  void UpdateInternalState();
-
-  // Indirection function used to call callbacks. When we post a callback
-  // we indirect it through a weak_ptr and this function to make sure we
-  // don't call any callbacks after this object has been destroyed.
-  void Call(const base::Closure& cb) const;
-
-  // The multibuffer we're wrapping, not owned.
-  MultiBuffer* multibuffer_;
-
-  // We're not interested in reading past this position.
-  int64_t end_;
-
-  // Defer reading once we have this much data.
-  int64_t preload_high_;
-  // Stop deferring once we have this much data.
-  int64_t preload_low_;
-
-  // Pin this much data in the cache from the current position.
-  int64_t max_buffer_forward_;
-  int64_t max_buffer_backward_;
-
-  // Current position in bytes.
-  int64_t pos_;
-
-  // [block(pos_)..preload_pos_) are known to be in the cache.
-  // preload_pos_ is only allowed to point to a filled
-  // cache position if it is equal to end_ or pos_+preload_.
-  // This is a pointer to a slot in the cache, so the unit is
-  // blocks.
-  MultiBufferBlockId preload_pos_;
-
-  // True if we've requested data from the cache by calling WaitFor().
-  bool loading_;
-
-  // When Available() > current_wait_size_ we call cb_.
-  int64_t current_wait_size_;
-  base::Closure cb_;
-
-  // Progress callback.
-  base::Callback<void(int64_t, int64_t)> progress_callback_;
-
-  base::WeakPtrFactory<MultiBufferReader> weak_factory_;
-};
-
-}  // namespace media
-
-#endif  // MEDIA_BLINK_MULTIBUFFER_READER_H_
diff --git a/media/blink/multibuffer_unittest.cc b/media/blink/multibuffer_unittest.cc
deleted file mode 100644
index 59693ef1..0000000
--- a/media/blink/multibuffer_unittest.cc
+++ /dev/null
@@ -1,508 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <deque>
-#include <string>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/message_loop/message_loop.h"
-#include "media/blink/multibuffer.h"
-#include "media/blink/multibuffer_reader.h"
-#include "media/blink/test_random.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-const int kBlockSizeShift = 8;
-const size_t kBlockSize = 1UL << kBlockSizeShift;
-
-namespace media {
-class TestMultiBufferDataProvider;
-
-std::vector<TestMultiBufferDataProvider*> writers;
-
-class TestMultiBufferDataProvider : public media::MultiBuffer::DataProvider {
- public:
-  TestMultiBufferDataProvider(MultiBufferBlockId pos,
-                              size_t file_size,
-                              int max_blocks_after_defer,
-                              bool must_read_whole_file,
-                              media::TestRandom* rnd)
-      : pos_(pos),
-        blocks_until_deferred_(1 << 30),
-        max_blocks_after_defer_(max_blocks_after_defer),
-        file_size_(file_size),
-        must_read_whole_file_(must_read_whole_file),
-        rnd_(rnd) {
-    writers.push_back(this);
-  }
-
-  ~TestMultiBufferDataProvider() override {
-    if (must_read_whole_file_) {
-      CHECK_GE(pos_ * kBlockSize, file_size_);
-    }
-    for (size_t i = 0; i < writers.size(); i++) {
-      if (writers[i] == this) {
-        writers[i] = writers.back();
-        writers.pop_back();
-        return;
-      }
-    }
-    LOG(FATAL) << "Couldn't find myself in writers!";
-  }
-
-  MultiBufferBlockId Tell() const override { return pos_; }
-
-  bool Available() const override { return !fifo_.empty(); }
-
-  scoped_refptr<DataBuffer> Read() override {
-    DCHECK(Available());
-    scoped_refptr<DataBuffer> ret = fifo_.front();
-    fifo_.pop_front();
-    ++pos_;
-    return ret;
-  }
-
-  void SetAvailableCallback(const base::Closure& cb) override {
-    DCHECK(!Available());
-    cb_ = cb;
-  }
-
-  void SetDeferred(bool deferred) override {
-    if (deferred) {
-      if (max_blocks_after_defer_ > 0) {
-        blocks_until_deferred_ = rnd_->Rand() % max_blocks_after_defer_;
-      } else if (max_blocks_after_defer_ < 0) {
-        blocks_until_deferred_ = -max_blocks_after_defer_;
-      } else {
-        blocks_until_deferred_ = 0;
-      }
-    } else {
-      blocks_until_deferred_ = 1 << 30;
-    }
-  }
-
-  bool Advance() {
-    if (blocks_until_deferred_ == 0)
-      return false;
-    --blocks_until_deferred_;
-
-    bool ret = true;
-    scoped_refptr<media::DataBuffer> block = new media::DataBuffer(kBlockSize);
-    size_t x = 0;
-    size_t byte_pos = (fifo_.size() + pos_) * kBlockSize;
-    for (x = 0; x < kBlockSize; x++, byte_pos++) {
-      if (byte_pos >= file_size_)
-        break;
-      block->writable_data()[x] =
-          static_cast<uint8_t>((byte_pos * 15485863) >> 16);
-    }
-    block->set_data_size(static_cast<int>(x));
-    fifo_.push_back(block);
-    if (byte_pos == file_size_) {
-      fifo_.push_back(DataBuffer::CreateEOSBuffer());
-      ret = false;
-    }
-    cb_.Run();
-    return ret;
-  }
-
- private:
-  std::deque<scoped_refptr<media::DataBuffer>> fifo_;
-  MultiBufferBlockId pos_;
-  int32_t blocks_until_deferred_;
-  int32_t max_blocks_after_defer_;
-  size_t file_size_;
-  bool must_read_whole_file_;
-  base::Closure cb_;
-  media::TestRandom* rnd_;
-};
-
-class TestMultiBuffer : public media::MultiBuffer {
- public:
-  explicit TestMultiBuffer(
-      int32_t shift,
-      const scoped_refptr<media::MultiBuffer::GlobalLRU>& lru,
-      media::TestRandom* rnd)
-      : media::MultiBuffer(shift, lru),
-        range_supported_(false),
-        create_ok_(true),
-        max_writers_(10000),
-        file_size_(1 << 30),
-        max_blocks_after_defer_(0),
-        must_read_whole_file_(false),
-        writers_created_(0),
-        rnd_(rnd) {}
-
-  void SetMaxWriters(size_t max_writers) { max_writers_ = max_writers; }
-
-  void CheckPresentState() {
-    IntervalMap<MultiBufferBlockId, int32_t> tmp;
-    for (DataMap::iterator i = data_.begin(); i != data_.end(); ++i) {
-      CHECK(i->second);  // Null poineters are not allowed in data_
-      CHECK_NE(!!pinned_[i->first], lru_->Contains(this, i->first))
-          << " i->first = " << i->first;
-      tmp.IncrementInterval(i->first, i->first + 1, 1);
-    }
-    IntervalMap<MultiBufferBlockId, int32_t>::const_iterator tmp_iterator =
-        tmp.begin();
-    IntervalMap<MultiBufferBlockId, int32_t>::const_iterator present_iterator =
-        present_.begin();
-    while (tmp_iterator != tmp.end() && present_iterator != tmp.end()) {
-      EXPECT_EQ(tmp_iterator.interval_begin(),
-                present_iterator.interval_begin());
-      EXPECT_EQ(tmp_iterator.interval_end(), present_iterator.interval_end());
-      EXPECT_EQ(tmp_iterator.value(), present_iterator.value());
-      ++tmp_iterator;
-      ++present_iterator;
-    }
-    EXPECT_TRUE(tmp_iterator == tmp.end());
-    EXPECT_TRUE(present_iterator == present_.end());
-  }
-
-  void CheckLRUState() {
-    for (DataMap::iterator i = data_.begin(); i != data_.end(); ++i) {
-      CHECK(i->second);  // Null poineters are not allowed in data_
-      CHECK_NE(!!pinned_[i->first], lru_->Contains(this, i->first))
-          << " i->first = " << i->first;
-      CHECK_EQ(1, present_[i->first]) << " i->first = " << i->first;
-    }
-  }
-
-  void SetFileSize(size_t file_size) { file_size_ = file_size; }
-
-  void SetMaxBlocksAfterDefer(int32_t max_blocks_after_defer) {
-    max_blocks_after_defer_ = max_blocks_after_defer;
-  }
-
-  void SetMustReadWholeFile(bool must_read_whole_file) {
-    must_read_whole_file_ = must_read_whole_file;
-  }
-
-  int32_t writers_created() const { return writers_created_; }
-
-  void SetRangeSupported(bool supported) { range_supported_ = supported; }
-
- protected:
-  DataProvider* CreateWriter(const MultiBufferBlockId& pos) override {
-    DCHECK(create_ok_);
-    writers_created_++;
-    CHECK_LT(writers.size(), max_writers_);
-    return new TestMultiBufferDataProvider(
-        pos, file_size_, max_blocks_after_defer_, must_read_whole_file_, rnd_);
-  }
-  void Prune(size_t max_to_free) override {
-    // Prune should not cause additional writers to be spawned.
-    create_ok_ = false;
-    MultiBuffer::Prune(max_to_free);
-    create_ok_ = true;
-  }
-
-  bool RangeSupported() const override { return range_supported_; }
-
- private:
-  bool range_supported_;
-  bool create_ok_;
-  size_t max_writers_;
-  size_t file_size_;
-  int32_t max_blocks_after_defer_;
-  bool must_read_whole_file_;
-  int32_t writers_created_;
-  media::TestRandom* rnd_;
-};
-}
-
-class MultiBufferTest : public testing::Test {
- public:
-  MultiBufferTest()
-      : rnd_(42),
-        lru_(new media::MultiBuffer::GlobalLRU()),
-        multibuffer_(kBlockSizeShift, lru_, &rnd_) {}
-
-  void Advance() {
-    CHECK(media::writers.size());
-    media::writers[rnd_.Rand() % media::writers.size()]->Advance();
-  }
-
-  bool AdvanceAll() {
-    bool advanced = false;
-    for (size_t i = 0; i < media::writers.size(); i++) {
-      advanced |= media::writers[i]->Advance();
-    }
-    multibuffer_.CheckLRUState();
-    return advanced;
-  }
-
- protected:
-  media::TestRandom rnd_;
-  scoped_refptr<media::MultiBuffer::GlobalLRU> lru_;
-  media::TestMultiBuffer multibuffer_;
-  base::MessageLoop message_loop_;
-};
-
-TEST_F(MultiBufferTest, ReadAll) {
-  multibuffer_.SetMaxWriters(1);
-  size_t pos = 0;
-  size_t end = 10000;
-  multibuffer_.SetFileSize(10000);
-  multibuffer_.SetMustReadWholeFile(true);
-  media::MultiBufferReader reader(&multibuffer_, pos, end,
-                                  base::Callback<void(int64_t, int64_t)>());
-  reader.SetMaxBuffer(2000, 5000);
-  reader.SetPreload(1000, 1000);
-  while (pos < end) {
-    unsigned char buffer[27];
-    buffer[17] = 17;
-    size_t to_read = std::min<size_t>(end - pos, 17);
-    int64_t bytes_read = reader.TryRead(buffer, to_read);
-    if (bytes_read) {
-      EXPECT_EQ(buffer[17], 17);
-      for (int64_t i = 0; i < bytes_read; i++) {
-        uint8_t expected = static_cast<uint8_t>((pos * 15485863) >> 16);
-        EXPECT_EQ(expected, buffer[i]) << " pos = " << pos;
-        pos++;
-      }
-    } else {
-      Advance();
-    }
-  }
-}
-
-TEST_F(MultiBufferTest, ReadAllAdvanceFirst) {
-  multibuffer_.SetMaxWriters(1);
-  size_t pos = 0;
-  size_t end = 10000;
-  multibuffer_.SetFileSize(10000);
-  multibuffer_.SetMustReadWholeFile(true);
-  media::MultiBufferReader reader(&multibuffer_, pos, end,
-                                  base::Callback<void(int64_t, int64_t)>());
-  reader.SetMaxBuffer(2000, 5000);
-  reader.SetPreload(1000, 1000);
-  while (pos < end) {
-    unsigned char buffer[27];
-    buffer[17] = 17;
-    size_t to_read = std::min<size_t>(end - pos, 17);
-    while (AdvanceAll())
-      ;
-    int64_t bytes = reader.TryRead(buffer, to_read);
-    EXPECT_GT(bytes, 0);
-    EXPECT_EQ(buffer[17], 17);
-    for (int64_t i = 0; i < bytes; i++) {
-      uint8_t expected = static_cast<uint8_t>((pos * 15485863) >> 16);
-      EXPECT_EQ(expected, buffer[i]) << " pos = " << pos;
-      pos++;
-    }
-  }
-}
-
-// Checks that if the data provider provides too much data after we told it
-// to defer, we kill it.
-TEST_F(MultiBufferTest, ReadAllAdvanceFirst_NeverDefer) {
-  multibuffer_.SetMaxWriters(1);
-  size_t pos = 0;
-  size_t end = 10000;
-  multibuffer_.SetFileSize(10000);
-  multibuffer_.SetMaxBlocksAfterDefer(-10000);
-  multibuffer_.SetRangeSupported(true);
-  media::MultiBufferReader reader(&multibuffer_, pos, end,
-                                  base::Callback<void(int64_t, int64_t)>());
-  reader.SetMaxBuffer(2000, 5000);
-  reader.SetPreload(1000, 1000);
-  while (pos < end) {
-    unsigned char buffer[27];
-    buffer[17] = 17;
-    size_t to_read = std::min<size_t>(end - pos, 17);
-    while (AdvanceAll())
-      ;
-    int64_t bytes = reader.TryRead(buffer, to_read);
-    EXPECT_GT(bytes, 0);
-    EXPECT_EQ(buffer[17], 17);
-    for (int64_t i = 0; i < bytes; i++) {
-      uint8_t expected = static_cast<uint8_t>((pos * 15485863) >> 16);
-      EXPECT_EQ(expected, buffer[i]) << " pos = " << pos;
-      pos++;
-    }
-  }
-  EXPECT_GT(multibuffer_.writers_created(), 1);
-}
-
-// Same as ReadAllAdvanceFirst_NeverDefer, but the url doesn't support
-// ranges, so we don't destroy it no matter how much data it provides.
-TEST_F(MultiBufferTest, ReadAllAdvanceFirst_NeverDefer2) {
-  multibuffer_.SetMaxWriters(1);
-  size_t pos = 0;
-  size_t end = 10000;
-  multibuffer_.SetFileSize(10000);
-  multibuffer_.SetMustReadWholeFile(true);
-  multibuffer_.SetMaxBlocksAfterDefer(-10000);
-  media::MultiBufferReader reader(&multibuffer_, pos, end,
-                                  base::Callback<void(int64_t, int64_t)>());
-  reader.SetMaxBuffer(2000, 5000);
-  reader.SetPreload(1000, 1000);
-  while (pos < end) {
-    unsigned char buffer[27];
-    buffer[17] = 17;
-    size_t to_read = std::min<size_t>(end - pos, 17);
-    while (AdvanceAll())
-      ;
-    int64_t bytes = reader.TryRead(buffer, to_read);
-    EXPECT_GT(bytes, 0);
-    EXPECT_EQ(buffer[17], 17);
-    for (int64_t i = 0; i < bytes; i++) {
-      uint8_t expected = static_cast<uint8_t>((pos * 15485863) >> 16);
-      EXPECT_EQ(expected, buffer[i]) << " pos = " << pos;
-      pos++;
-    }
-  }
-}
-
-TEST_F(MultiBufferTest, LRUTest) {
-  int64_t max_size = 17;
-  int64_t current_size = 0;
-  lru_->IncrementMaxSize(max_size);
-
-  multibuffer_.SetMaxWriters(1);
-  size_t pos = 0;
-  size_t end = 10000;
-  multibuffer_.SetFileSize(10000);
-  media::MultiBufferReader reader(&multibuffer_, pos, end,
-                                  base::Callback<void(int64_t, int64_t)>());
-  reader.SetPreload(10000, 10000);
-  // Note, no pinning, all data should end up in LRU.
-  EXPECT_EQ(current_size, lru_->Size());
-  current_size += max_size;
-  while (AdvanceAll())
-    ;
-  EXPECT_EQ(current_size, lru_->Size());
-  lru_->IncrementMaxSize(-max_size);
-  lru_->Prune(3);
-  current_size -= 3;
-  EXPECT_EQ(current_size, lru_->Size());
-  lru_->Prune(3);
-  current_size -= 3;
-  EXPECT_EQ(current_size, lru_->Size());
-  lru_->Prune(1000);
-  EXPECT_EQ(0, lru_->Size());
-}
-
-class ReadHelper {
- public:
-  ReadHelper(size_t end,
-             size_t max_read_size,
-             media::MultiBuffer* multibuffer,
-             media::TestRandom* rnd)
-      : pos_(0),
-        end_(end),
-        max_read_size_(max_read_size),
-        read_size_(0),
-        rnd_(rnd),
-        reader_(multibuffer,
-                pos_,
-                end_,
-                base::Callback<void(int64_t, int64_t)>()) {
-    reader_.SetMaxBuffer(2000, 5000);
-    reader_.SetPreload(1000, 1000);
-  }
-
-  bool Read() {
-    if (read_size_ == 0)
-      return true;
-    unsigned char buffer[4096];
-    CHECK_LE(read_size_, static_cast<int64_t>(sizeof(buffer)));
-    CHECK_EQ(pos_, reader_.Tell());
-    int64_t bytes_read = reader_.TryRead(buffer, read_size_);
-    if (bytes_read) {
-      for (int64_t i = 0; i < bytes_read; i++) {
-        unsigned char expected = (pos_ * 15485863) >> 16;
-        EXPECT_EQ(expected, buffer[i]) << " pos = " << pos_;
-        pos_++;
-      }
-      CHECK_EQ(pos_, reader_.Tell());
-      return true;
-    }
-    return false;
-  }
-
-  void StartRead() {
-    CHECK_EQ(pos_, reader_.Tell());
-    read_size_ = std::min(1 + rnd_->Rand() % (max_read_size_ - 1), end_ - pos_);
-    if (!Read()) {
-      reader_.Wait(read_size_,
-                   base::Bind(&ReadHelper::WaitCB, base::Unretained(this)));
-    }
-  }
-
-  void WaitCB() { CHECK(Read()); }
-
-  void Seek() {
-    pos_ = rnd_->Rand() % end_;
-    reader_.Seek(pos_);
-    CHECK_EQ(pos_, reader_.Tell());
-  }
-
- private:
-  int64_t pos_;
-  int64_t end_;
-  int64_t max_read_size_;
-  int64_t read_size_;
-  media::TestRandom* rnd_;
-  media::MultiBufferReader reader_;
-};
-
-TEST_F(MultiBufferTest, RandomTest) {
-  size_t file_size = 1000000;
-  multibuffer_.SetFileSize(file_size);
-  multibuffer_.SetMaxBlocksAfterDefer(10);
-  std::vector<ReadHelper*> read_helpers;
-  for (size_t i = 0; i < 20; i++) {
-    read_helpers.push_back(
-        new ReadHelper(file_size, 1000, &multibuffer_, &rnd_));
-  }
-  for (int i = 0; i < 10000; i++) {
-    if (rnd_.Rand() & 1) {
-      if (!media::writers.empty())
-        Advance();
-    } else {
-      size_t j = rnd_.Rand() % read_helpers.size();
-      if (rnd_.Rand() % 100 < 3)
-        read_helpers[j]->Seek();
-      read_helpers[j]->StartRead();
-      multibuffer_.CheckLRUState();
-    }
-  }
-  multibuffer_.CheckPresentState();
-  while (!read_helpers.empty()) {
-    delete read_helpers.back();
-    read_helpers.pop_back();
-  }
-}
-
-TEST_F(MultiBufferTest, RandomTest_RangeSupported) {
-  size_t file_size = 1000000;
-  multibuffer_.SetFileSize(file_size);
-  multibuffer_.SetMaxBlocksAfterDefer(10);
-  std::vector<ReadHelper*> read_helpers;
-  multibuffer_.SetRangeSupported(true);
-  for (size_t i = 0; i < 20; i++) {
-    read_helpers.push_back(
-        new ReadHelper(file_size, 1000, &multibuffer_, &rnd_));
-  }
-  for (int i = 0; i < 10000; i++) {
-    if (rnd_.Rand() & 1) {
-      if (!media::writers.empty())
-        Advance();
-    } else {
-      size_t j = rnd_.Rand() % read_helpers.size();
-      if (rnd_.Rand() % 100 < 3)
-        read_helpers[j]->Seek();
-      read_helpers[j]->StartRead();
-      multibuffer_.CheckLRUState();
-    }
-  }
-  multibuffer_.CheckPresentState();
-  while (!read_helpers.empty()) {
-    delete read_helpers.back();
-    read_helpers.pop_back();
-  }
-}
diff --git a/media/cast/test/utility/tap_proxy.cc b/media/cast/test/utility/tap_proxy.cc
index ad7057a..7bd696b 100644
--- a/media/cast/test/utility/tap_proxy.cc
+++ b/media/cast/test/utility/tap_proxy.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 <errno.h>
 #include <fcntl.h>
 #include <linux/if_tun.h>
 #include <linux/types.h>
diff --git a/media/midi/midi_manager_alsa.cc b/media/midi/midi_manager_alsa.cc
index f972932..9a10169 100644
--- a/media/midi/midi_manager_alsa.cc
+++ b/media/midi/midi_manager_alsa.cc
@@ -4,6 +4,7 @@
 
 #include "media/midi/midi_manager_alsa.h"
 
+#include <errno.h>
 #include <poll.h>
 #include <stdlib.h>
 #include <algorithm>
diff --git a/mojo/application/public/cpp/BUILD.gn b/mojo/application/public/cpp/BUILD.gn
index f26cf73e..fb34910b 100644
--- a/mojo/application/public/cpp/BUILD.gn
+++ b/mojo/application/public/cpp/BUILD.gn
@@ -39,14 +39,8 @@
     "lib/service_provider_impl.cc",
     "lib/service_registry.cc",
     "lib/service_registry.h",
-    "lib/trace_provider_impl.cc",
-    "lib/trace_provider_impl.h",
-    "lib/tracing_impl.cc",
-    "lib/tracing_impl.h",
     "service_connector.h",
     "service_provider_impl.h",
-    "switches.cc",
-    "switches.h",
   ]
 
   deps = [
@@ -58,7 +52,6 @@
     "//mojo/message_pump",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//mojo/services/tracing/public/interfaces",
   ]
 }
 
diff --git a/mojo/application/public/cpp/application_impl.h b/mojo/application/public/cpp/application_impl.h
index de2aff2..90e79596 100644
--- a/mojo/application/public/cpp/application_impl.h
+++ b/mojo/application/public/cpp/application_impl.h
@@ -21,8 +21,6 @@
 
 namespace mojo {
 
-class TracingImpl;
-
 // TODO(beng): This comment is hilariously out of date.
 // Utility class for communicating with the Shell, and providing Services
 // to clients.
@@ -152,7 +150,6 @@
   ApplicationDelegate* delegate_;
   Binding<Application> binding_;
   ShellPtr shell_;
-  scoped_ptr<TracingImpl> tracing_impl_;
   std::string url_;
   Closure termination_closure_;
   AppLifetimeHelper app_lifetime_helper_;
diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc
index 99d2c69..6d2fb46 100644
--- a/mojo/application/public/cpp/lib/application_impl.cc
+++ b/mojo/application/public/cpp/lib/application_impl.cc
@@ -10,7 +10,6 @@
 #include "base/message_loop/message_loop.h"
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/lib/service_registry.h"
-#include "mojo/application/public/cpp/lib/tracing_impl.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
 #include "mojo/public/cpp/environment/logging.h"
 
@@ -18,8 +17,6 @@
 
 namespace {
 
-bool g_has_tracing_service = false;
-
 void DefaultTerminationClosure() {
   if (base::MessageLoop::current() &&
       base::MessageLoop::current()->is_running())
@@ -109,23 +106,6 @@
   shell_ = shell.Pass();
   shell_.set_connection_error_handler([this]() { OnConnectionError(); });
   url_ = url;
-
-  if (!g_has_tracing_service) {
-    // Each copy of base in our process must have one tracing service,
-    // otherwise data will be double counted or not counted. When we load a
-    // mojo application, either in process or creating a child process, the
-    // copy of base loaded needs to be connected to the tracing service.  It's
-    // the responsibility of the first application to connect to the tracing
-    // service to establish this connection.
-    //
-    // This is safe because if this is a ContentHandler, it will outlive all
-    // its served Applications. If this is a raw mojo application, it is the
-    // only Application served.
-    tracing_impl_.reset(new TracingImpl);
-    tracing_impl_->Initialize(this);
-    g_has_tracing_service = true;
-  }
-
   delegate_->Initialize(this);
 }
 
diff --git a/mojo/application/public/cpp/lib/application_runner.cc b/mojo/application/public/cpp/lib/application_runner.cc
index d3631f06..d3ac30cc 100644
--- a/mojo/application/public/cpp/lib/application_runner.cc
+++ b/mojo/application/public/cpp/lib/application_runner.cc
@@ -9,7 +9,6 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/process/launch.h"
-#include "base/threading/worker_pool.h"
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/message_pump/message_pump_mojo.h"
@@ -68,13 +67,6 @@
     loop.reset();
     delegate_.reset();
   }
-
-  // By default the worker pool continues running until all tasks are done or
-  // the process is shut down. However, because the application could be
-  // unloaded before process shutdown, we have to wait for the worker pool to
-  // shut down cleanly.
-  base::WorkerPool::ShutDownCleanly();
-
   return MOJO_RESULT_OK;
 }
 
diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp
index 9317698..9c308c6 100644
--- a/mojo/mojo_base.gyp
+++ b/mojo/mojo_base.gyp
@@ -241,14 +241,8 @@
         'application/public/cpp/lib/service_provider_impl.cc',
         'application/public/cpp/lib/service_registry.cc',
         'application/public/cpp/lib/service_registry.h',
-        'application/public/cpp/lib/trace_provider_impl.cc',
-        'application/public/cpp/lib/trace_provider_impl.h',
-        'application/public/cpp/lib/tracing_impl.cc',
-        'application/public/cpp/lib/tracing_impl.h',
         'application/public/cpp/service_connector.h',
         'application/public/cpp/service_provider_impl.h',
-        'application/public/cpp/switches.cc',
-        'application/public/cpp/switches.h',
       ],
       'dependencies': [
         'mojo_application_bindings',
@@ -262,7 +256,6 @@
       'dependencies': [
         'mojo_application_bindings_mojom',
         'mojo_services.gyp:network_service_bindings_lib',
-        'mojo_services.gyp:tracing_service_bindings_lib',
         '../third_party/mojo/mojo_public.gyp:mojo_cpp_bindings',
       ],
       'export_dependent_settings': [
diff --git a/mojo/mojo_services.gyp b/mojo/mojo_services.gyp
index 565f7dd..cb6c2fc9 100644
--- a/mojo/mojo_services.gyp
+++ b/mojo/mojo_services.gyp
@@ -50,27 +50,6 @@
       ],
     },
     {
-      'target_name': 'tracing_service_bindings_mojom',
-      'type': 'none',
-      'variables': {
-        'mojom_files': [
-          'services/tracing/public/interfaces/tracing.mojom',
-        ],
-        'mojom_include_path': '<(DEPTH)/mojo/services',
-      },
-      'includes': [
-        '../third_party/mojo/mojom_bindings_generator_explicit.gypi',
-      ],
-    },
-    {
-      # GN version: //mojo/services/tracing/public/interfaces
-      'target_name': 'tracing_service_bindings_lib',
-      'type': 'static_library',
-      'dependencies': [
-        'tracing_service_bindings_mojom',
-      ],
-    },
-    {
       'target_name': 'updater_bindings_mojom',
       'type': 'none',
       'variables': {
diff --git a/mojo/runner/BUILD.gn b/mojo/runner/BUILD.gn
index 588e997..49efb46 100644
--- a/mojo/runner/BUILD.gn
+++ b/mojo/runner/BUILD.gn
@@ -135,6 +135,7 @@
     "//mojo/runner/child:interfaces",
     "//mojo/runner/host:lib",
     "//mojo/services/network/public/interfaces",
+    "//mojo/services/tracing/public/cpp",
     "//mojo/services/tracing/public/interfaces",
     "//mojo/shell",
     "//mojo/util:filename_util",
diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc
index 1a9dca6..a21323b0 100644
--- a/mojo/runner/context.cc
+++ b/mojo/runner/context.cc
@@ -27,8 +27,6 @@
 #include "mojo/application/public/cpp/application_connection.h"
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/application_impl.h"
-#include "mojo/application/public/cpp/lib/trace_provider_impl.h"
-#include "mojo/application/public/cpp/switches.h"
 #include "mojo/package_manager/package_manager_impl.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/runner/host/in_process_native_runner.h"
@@ -36,6 +34,9 @@
 #include "mojo/runner/register_local_aliases.h"
 #include "mojo/runner/switches.h"
 #include "mojo/runner/tracer.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
+#include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/connect_to_application_params.h"
@@ -192,12 +193,10 @@
 
   bool trace_startup = command_line.HasSwitch(switches::kTraceStartup);
   if (trace_startup) {
-    std::string output_name =
-        command_line.GetSwitchValueASCII(mojo::kTraceStartupOutputName);
     tracer_.Start(
         command_line.GetSwitchValueASCII(switches::kTraceStartup),
         command_line.GetSwitchValueASCII(switches::kTraceStartupDuration),
-        output_name.empty() ? "mojo_runner.trace" : output_name);
+        "mojo_runner.trace");
   }
 
   // ICU data is a thing every part of the system needs. This here warms
@@ -250,7 +249,7 @@
   params->set_exposed_services(tracing_exposed_services.Pass());
   application_manager_->ConnectToApplication(params.Pass());
 
-  if (command_line.HasSwitch(switches::kTraceStartup)) {
+  if (command_line.HasSwitch(tracing::kTraceStartup)) {
     tracing::TraceCollectorPtr coordinator;
     auto coordinator_request = GetProxy(&coordinator);
     tracing_services->ConnectToService(tracing::TraceCollector::Name_,
@@ -260,7 +259,7 @@
 
   // Record the shell startup metrics used for performance testing.
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
-          mojo::kEnableStatsCollectionBindings)) {
+          tracing::kEnableStatsCollectionBindings)) {
     tracing::StartupPerformanceDataCollectorPtr collector;
     tracing_services->ConnectToService(
         tracing::StartupPerformanceDataCollector::Name_,
diff --git a/mojo/runner/tracer.h b/mojo/runner/tracer.h
index 56ab7cc5..6fd8b1c 100644
--- a/mojo/runner/tracer.h
+++ b/mojo/runner/tracer.h
@@ -12,8 +12,8 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted_memory.h"
-#include "mojo/application/public/cpp/lib/trace_provider_impl.h"
 #include "mojo/common/data_pipe_drainer.h"
+#include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 
 namespace mojo {
diff --git a/mojo/services/network/url_loader_impl_apptest.cc b/mojo/services/network/url_loader_impl_apptest.cc
index 0fe1749..0b9de67 100644
--- a/mojo/services/network/url_loader_impl_apptest.cc
+++ b/mojo/services/network/url_loader_impl_apptest.cc
@@ -49,32 +49,28 @@
 
   void Start() override { status_ = STARTED; }
 
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override {
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override {
     status_ = READING;
     buf_size_ = buf_size;
-    SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-    return false;
+    return net::ERR_IO_PENDING;
   }
 
   void NotifyHeadersComplete() { net::URLRequestJob::NotifyHeadersComplete(); }
 
   void NotifyReadComplete(int bytes_read) {
     if (bytes_read < 0) {
-      NotifyDone(net::URLRequestStatus(
-          net::URLRequestStatus::FromError(net::ERR_FAILED)));
-      net::URLRequestJob::NotifyReadComplete(0);
+      // Map errors to net::ERR_FAILED.
+      ReadRawDataComplete(net::ERR_FAILED);
       // Set this after calling ReadRawDataComplete since that ends up calling
       // ReadRawData.
       status_ = COMPLETED;
     } else if (bytes_read == 0) {
-      NotifyDone(net::URLRequestStatus());
-      net::URLRequestJob::NotifyReadComplete(bytes_read);
+      ReadRawDataComplete(bytes_read);
       // Set this after calling ReadRawDataComplete since that ends up calling
       // ReadRawData.
       status_ = COMPLETED;
     } else {
-      SetStatus(net::URLRequestStatus());
-      net::URLRequestJob::NotifyReadComplete(bytes_read);
+      ReadRawDataComplete(bytes_read);
       // Set this after calling ReadRawDataComplete since that ends up calling
       // ReadRawData.
       status_ = STARTED;
diff --git a/mojo/services/tracing/public/cpp/BUILD.gn b/mojo/services/tracing/public/cpp/BUILD.gn
new file mode 100644
index 0000000..02eed11a
--- /dev/null
+++ b/mojo/services/tracing/public/cpp/BUILD.gn
@@ -0,0 +1,21 @@
+# 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.
+
+source_set("cpp") {
+  sources = [
+    "switches.cc",
+    "switches.h",
+    "trace_provider_impl.cc",
+    "trace_provider_impl.h",
+    "tracing_impl.cc",
+    "tracing_impl.h",
+  ]
+
+  deps = [
+    "//base",
+    "//mojo/application/public/cpp",
+    "//mojo/public/cpp/bindings",
+    "//mojo/services/tracing/public/interfaces",
+  ]
+}
diff --git a/mojo/application/public/cpp/switches.cc b/mojo/services/tracing/public/cpp/switches.cc
similarity index 75%
rename from mojo/application/public/cpp/switches.cc
rename to mojo/services/tracing/public/cpp/switches.cc
index 102bd6f..1b838e6 100644
--- a/mojo/application/public/cpp/switches.cc
+++ b/mojo/services/tracing/public/cpp/switches.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/application/public/cpp/switches.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
 
-namespace mojo {
+namespace tracing {
 
 // Specifies if the |StatsCollectionController| needs to be bound in html pages.
 // This binding happens on per-frame basis and hence can potentially be a
@@ -15,11 +15,8 @@
 
 const char kTraceStartup[] = "trace-startup";
 
-// Sets the name of the output file for startup tracing.
-const char kTraceStartupOutputName[] = "trace-startup-output-name";
-
 #ifdef NDEBUG
 const char kEarlyTracing[] = "early-tracing";
 #endif
 
-}  // namespace mojo
+}  // namespace tracing
diff --git a/mojo/application/public/cpp/switches.h b/mojo/services/tracing/public/cpp/switches.h
similarity index 71%
rename from mojo/application/public/cpp/switches.h
rename to mojo/services/tracing/public/cpp/switches.h
index 0141e9a..8a1e512 100644
--- a/mojo/application/public/cpp/switches.h
+++ b/mojo/services/tracing/public/cpp/switches.h
@@ -2,17 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_APPLICATION_PUBLIC_CPP_SWITCHES_H_
-#define MOJO_APPLICATION_PUBLIC_CPP_SWITCHES_H_
+#ifndef MOJO_SERVICES_TRACING_PUBLIC_CPP_SWITCHES_H_
+#define MOJO_SERVICES_TRACING_PUBLIC_CPP_SWITCHES_H_
 
-namespace mojo {
+namespace tracing {
 
 // All switches in alphabetical order. The switches should be documented
 // alongside the definition of their values in the .cc file.
 extern const char kEnableStatsCollectionBindings[];
 
 extern const char kTraceStartup[];
-extern const char kTraceStartupOutputName[];
 
 #ifdef NDEBUG
 // In release builds, specifying this flag will force reporting of tracing
@@ -20,6 +19,6 @@
 extern const char kEarlyTracing[];
 #endif
 
-}  // namespace mojo
+}  // namespace tracing
 
-#endif  // MOJO_APPLICATION_PUBLIC_CPP_SWITCHES_H_
+#endif  // MOJO_SERVICES_TRACING_PUBLIC_CPP_SWITCHES_H_
diff --git a/mojo/application/public/cpp/lib/trace_provider_impl.cc b/mojo/services/tracing/public/cpp/trace_provider_impl.cc
similarity index 97%
rename from mojo/application/public/cpp/lib/trace_provider_impl.cc
rename to mojo/services/tracing/public/cpp/trace_provider_impl.cc
index 3a325f5..877ae202 100644
--- a/mojo/application/public/cpp/lib/trace_provider_impl.cc
+++ b/mojo/services/tracing/public/cpp/trace_provider_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/application/public/cpp/lib/trace_provider_impl.h"
+#include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
 
 #include "base/callback.h"
 #include "base/logging.h"
diff --git a/mojo/application/public/cpp/lib/trace_provider_impl.h b/mojo/services/tracing/public/cpp/trace_provider_impl.h
similarity index 88%
rename from mojo/application/public/cpp/lib/trace_provider_impl.h
rename to mojo/services/tracing/public/cpp/trace_provider_impl.h
index 4b836ca..5774911 100644
--- a/mojo/application/public/cpp/lib/trace_provider_impl.h
+++ b/mojo/services/tracing/public/cpp/trace_provider_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_APPLICATION_PUBLIC_CPP_LIB_TRACE_PROVIDER_IMPL_H_
-#define MOJO_APPLICATION_PUBLIC_CPP_LIB_TRACE_PROVIDER_IMPL_H_
+#ifndef MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_
+#define MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_
 
 #include "base/macros.h"
 #include "base/memory/ref_counted_memory.h"
@@ -48,4 +48,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_APPLICATION_PUBLIC_CPP_LIB_TRACE_PROVIDER_IMPL_H_
+#endif  // MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_
diff --git a/mojo/application/public/cpp/lib/tracing_impl.cc b/mojo/services/tracing/public/cpp/tracing_impl.cc
similarity index 82%
rename from mojo/application/public/cpp/lib/tracing_impl.cc
rename to mojo/services/tracing/public/cpp/tracing_impl.cc
index 50b6b36..788cd31 100644
--- a/mojo/application/public/cpp/lib/tracing_impl.cc
+++ b/mojo/services/tracing/public/cpp/tracing_impl.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 "mojo/application/public/cpp/lib/tracing_impl.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
 
 #include "base/trace_event/trace_event_impl.h"
 #include "mojo/application/public/cpp/application_impl.h"
 
 #ifdef NDEBUG
 #include "base/command_line.h"
-#include "mojo/application/public/cpp/switches.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
 #endif
 
 namespace mojo {
@@ -27,7 +27,8 @@
   connection_->AddService(this);
 
 #ifdef NDEBUG
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(kEarlyTracing)) {
+  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+          tracing::kEarlyTracing)) {
     provider_impl_.ForceEnableTracing();
   }
 #else
diff --git a/mojo/application/public/cpp/lib/tracing_impl.h b/mojo/services/tracing/public/cpp/tracing_impl.h
similarity index 80%
rename from mojo/application/public/cpp/lib/tracing_impl.h
rename to mojo/services/tracing/public/cpp/tracing_impl.h
index 2bcafa0f..648023f8 100644
--- a/mojo/application/public/cpp/lib/tracing_impl.h
+++ b/mojo/services/tracing/public/cpp/tracing_impl.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_APPLICATION_PUBLIC_CPP_LIB_TRACING_IMPL_H_
-#define MOJO_APPLICATION_PUBLIC_CPP_LIB_TRACING_IMPL_H_
+#ifndef MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_
+#define MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_
 
 #include "base/macros.h"
 #include "mojo/application/public/cpp/interface_factory.h"
-#include "mojo/application/public/cpp/lib/trace_provider_impl.h"
+#include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
 
 namespace mojo {
@@ -37,4 +37,4 @@
 
 }  // namespace mojo
 
-#endif  // MOJO_APPLICATION_PUBLIC_CPP_LIB_TRACING_IMPL_H_
+#endif  // MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_
diff --git a/mojo/shell/BUILD.gn b/mojo/shell/BUILD.gn
index 5892d64b..8478000 100644
--- a/mojo/shell/BUILD.gn
+++ b/mojo/shell/BUILD.gn
@@ -101,7 +101,6 @@
     "//mojo/package_manager",
     "//mojo/public/cpp/system",
     "//mojo/util:filename_util",
-    "//mojo/services/tracing:lib",
     "//third_party/mojo/src/mojo/edk/test:run_all_unittests",
     "//testing/gtest",
     "//url",
diff --git a/mojo/shell/application_manager_unittest.cc b/mojo/shell/application_manager_unittest.cc
index 2cc6b55..e13f616f 100644
--- a/mojo/shell/application_manager_unittest.cc
+++ b/mojo/shell/application_manager_unittest.cc
@@ -14,7 +14,6 @@
 #include "mojo/application/public/cpp/interface_factory.h"
 #include "mojo/application/public/interfaces/service_provider.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/services/tracing/tracing_app.h"
 #include "mojo/shell/application_loader.h"
 #include "mojo/shell/application_manager.h"
 #include "mojo/shell/connect_util.h"
@@ -138,15 +137,6 @@
   DISALLOW_COPY_AND_ASSIGN(TestApplicationLoader);
 };
 
-class TracingApplicationLoader : public ApplicationLoader {
- private:
-  // ApplicationLoader implementation.
-  void Load(const GURL& url,
-            InterfaceRequest<Application> application_request) override {
-    new ApplicationImpl(new tracing::TracingApp, application_request.Pass());
-  }
-};
-
 class ClosingApplicationLoader : public ApplicationLoader {
  private:
   // ApplicationLoader implementation.
@@ -413,9 +403,6 @@
     test_loader_->set_context(&context_);
     application_manager_->set_default_loader(
         scoped_ptr<ApplicationLoader>(test_loader_));
-    application_manager_->SetLoaderForURL(
-        make_scoped_ptr(new TracingApplicationLoader),
-        GURL("mojo:tracing"));
 
     TestServicePtr service_proxy;
     ConnectToService(application_manager_.get(), GURL(kTestURLString),
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index 3f79468..f86aae1 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -6,7 +6,6 @@
 
 #include "base/bind.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
 #include "base/rand_util.h"
 #include "base/sys_byteorder.h"
 #include "base/test/test_timeouts.h"
@@ -131,8 +130,8 @@
 
   scoped_ptr<DnsQuery> query_;
   bool use_tcp_;
-  ScopedVector<uint16> lengths_;
-  ScopedVector<DnsResponse> responses_;
+  std::vector<scoped_ptr<uint16>> lengths_;
+  std::vector<scoped_ptr<DnsResponse>> responses_;
   std::vector<MockWrite> writes_;
   std::vector<MockRead> reads_;
   scoped_ptr<SequencedSocketData> provider_;
@@ -467,7 +466,7 @@
 
   DnsConfig config_;
 
-  ScopedVector<DnsSocketData> socket_data_;
+  std::vector<scoped_ptr<DnsSocketData>> socket_data_;
 
   std::deque<int> transaction_ids_;
   scoped_ptr<TestSocketFactory> socket_factory_;
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 09713ba..b52cbc21 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -1286,9 +1286,7 @@
     // else CompleteRequests logged EndEvent.
 
     // Log any remaining Requests as cancelled.
-    for (RequestsList::const_iterator it = requests_.begin();
-         it != requests_.end(); ++it) {
-      Request* req = *it;
+    for (const scoped_ptr<Request>& req : requests_) {
       if (req->was_canceled())
         continue;
       DCHECK_EQ(this, req->job());
@@ -1730,10 +1728,7 @@
       resolver_->CacheResult(key_, entry, ttl);
 
     // Complete all of the requests that were attached to the job.
-    for (RequestsList::const_iterator it = requests_.begin();
-         it != requests_.end(); ++it) {
-      Request* req = *it;
-
+    for (const scoped_ptr<Request>& req : requests_) {
       if (req->was_canceled())
         continue;
 
@@ -1807,7 +1802,7 @@
   scoped_ptr<DnsTask> dns_task_;
 
   // All Requests waiting for the result of this Job. Some can be canceled.
-  RequestsList requests_;
+  std::vector<scoped_ptr<Request>> requests_;
 
   // A handle used in |HostResolverImpl::dispatcher_|.
   PrioritizedDispatcher::Handle handle_;
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index dd3cb3d..9e1b714 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -9,7 +9,6 @@
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "base/time/time.h"
@@ -151,7 +150,6 @@
   class Request;
   typedef HostCache::Key Key;
   typedef std::map<Key, Job*> JobMap;
-  typedef ScopedVector<Request> RequestsList;
 
   // Number of consecutive failures of DnsTask (with successful fallback to
   // ProcTask) before the DnsClient is disabled until the next DNS change.
diff --git a/net/test/url_request/url_request_failed_job.cc b/net/test/url_request/url_request_failed_job.cc
index e4ac6a6..d7c479b 100644
--- a/net/test/url_request/url_request_failed_job.cc
+++ b/net/test/url_request/url_request_failed_job.cc
@@ -97,40 +97,20 @@
 }
 
 void URLRequestFailedJob::Start() {
-  if (phase_ == START) {
-    if (net_error_ != ERR_IO_PENDING) {
-      NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_));
-      return;
-    }
-    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-    return;
-  }
-  response_info_.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
-  NotifyHeadersComplete();
-}
-
-bool URLRequestFailedJob::ReadRawData(IOBuffer* buf,
-                                      int buf_size,
-                                      int* bytes_read) {
-  CHECK(phase_ == READ_SYNC || phase_ == READ_ASYNC);
-  if (net_error_ != ERR_IO_PENDING && phase_ == READ_SYNC) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, net_error_));
-    return false;
-  }
-
-  SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-
-  if (net_error_ == ERR_IO_PENDING)
-    return false;
-
-  DCHECK_EQ(READ_ASYNC, phase_);
-  DCHECK_NE(ERR_IO_PENDING, net_error_);
-
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE,
-      base::Bind(&URLRequestFailedJob::NotifyDone, weak_factory_.GetWeakPtr(),
-                 URLRequestStatus(URLRequestStatus::FAILED, net_error_)));
-  return false;
+      base::Bind(&URLRequestFailedJob::StartAsync, weak_factory_.GetWeakPtr()));
+}
+
+int URLRequestFailedJob::ReadRawData(IOBuffer* buf, int buf_size) {
+  CHECK(phase_ == READ_SYNC || phase_ == READ_ASYNC);
+  if (net_error_ == ERR_IO_PENDING || phase_ == READ_SYNC)
+    return net_error_;
+
+  base::ThreadTaskRunnerHandle::Get()->PostTask(
+      FROM_HERE, base::Bind(&URLRequestFailedJob::ReadRawDataComplete,
+                            weak_factory_.GetWeakPtr(), net_error_));
+  return ERR_IO_PENDING;
 }
 
 int URLRequestFailedJob::GetResponseCode() const {
@@ -195,4 +175,17 @@
 URLRequestFailedJob::~URLRequestFailedJob() {
 }
 
+void URLRequestFailedJob::StartAsync() {
+  if (phase_ == START) {
+    if (net_error_ != ERR_IO_PENDING) {
+      NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_));
+      return;
+    }
+    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
+    return;
+  }
+  response_info_.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
+  NotifyHeadersComplete();
+}
+
 }  // namespace net
diff --git a/net/test/url_request/url_request_failed_job.h b/net/test/url_request/url_request_failed_job.h
index 0413111..45b1911 100644
--- a/net/test/url_request/url_request_failed_job.h
+++ b/net/test/url_request/url_request_failed_job.h
@@ -39,7 +39,7 @@
 
   // URLRequestJob implementation:
   void Start() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   int GetResponseCode() const override;
   void GetResponseInfo(HttpResponseInfo* info) override;
 
@@ -71,6 +71,7 @@
 
  protected:
   ~URLRequestFailedJob() override;
+  void StartAsync();
 
  private:
   HttpResponseInfo response_info_;
diff --git a/net/test/url_request/url_request_mock_data_job.cc b/net/test/url_request/url_request_mock_data_job.cc
index 9549242..b9ef385b 100644
--- a/net/test/url_request/url_request_mock_data_job.cc
+++ b/net/test/url_request/url_request_mock_data_job.cc
@@ -104,15 +104,12 @@
 URLRequestMockDataJob::~URLRequestMockDataJob() {
 }
 
-bool URLRequestMockDataJob::ReadRawData(IOBuffer* buf,
-                                        int buf_size,
-                                        int* bytes_read) {
-  DCHECK(bytes_read);
-  *bytes_read = static_cast<int>(
-      std::min(static_cast<size_t>(buf_size), data_.length() - data_offset_));
-  memcpy(buf->data(), data_.c_str() + data_offset_, *bytes_read);
-  data_offset_ += *bytes_read;
-  return true;
+int URLRequestMockDataJob::ReadRawData(IOBuffer* buf, int buf_size) {
+  int bytes_read =
+      std::min(static_cast<size_t>(buf_size), data_.length() - data_offset_);
+  memcpy(buf->data(), data_.c_str() + data_offset_, bytes_read);
+  data_offset_ += bytes_read;
+  return bytes_read;
 }
 
 int URLRequestMockDataJob::GetResponseCode() const {
diff --git a/net/test/url_request/url_request_mock_data_job.h b/net/test/url_request/url_request_mock_data_job.h
index 3d84e37..14ad665 100644
--- a/net/test/url_request/url_request_mock_data_job.h
+++ b/net/test/url_request/url_request_mock_data_job.h
@@ -24,7 +24,7 @@
                         int data_repeat_count);
 
   void Start() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   int GetResponseCode() const override;
   void GetResponseInfo(HttpResponseInfo* info) override;
 
diff --git a/net/test/url_request/url_request_slow_download_job.cc b/net/test/url_request/url_request_slow_download_job.cc
index f344feb..52fd71c 100644
--- a/net/test/url_request/url_request_slow_download_job.cc
+++ b/net/test/url_request/url_request_slow_download_job.cc
@@ -179,39 +179,34 @@
   return REQUEST_COMPLETE;
 }
 
-bool URLRequestSlowDownloadJob::ReadRawData(IOBuffer* buf,
-                                            int buf_size,
-                                            int* bytes_read) {
+int URLRequestSlowDownloadJob::ReadRawData(IOBuffer* buf, int buf_size) {
   if (base::LowerCaseEqualsASCII(kFinishDownloadUrl,
                                  request_->url().spec().c_str()) ||
       base::LowerCaseEqualsASCII(kErrorDownloadUrl,
                                  request_->url().spec().c_str())) {
     VLOG(10) << __FUNCTION__ << " called w/ kFinish/ErrorDownloadUrl.";
-    *bytes_read = 0;
-    return true;
+    return 0;
   }
 
   VLOG(10) << __FUNCTION__ << " called at position " << bytes_already_sent_
            << " in the stream.";
-  ReadStatus status = FillBufferHelper(buf, buf_size, bytes_read);
+  int bytes_read = 0;
+  ReadStatus status = FillBufferHelper(buf, buf_size, &bytes_read);
   switch (status) {
     case BUFFER_FILLED:
-      return true;
+    case REQUEST_COMPLETE:
+      return bytes_read;
     case REQUEST_BLOCKED:
       buffer_ = buf;
       buffer_size_ = buf_size;
-      SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
       base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
           FROM_HERE, base::Bind(&URLRequestSlowDownloadJob::CheckDoneStatus,
                                 weak_factory_.GetWeakPtr()),
           base::TimeDelta::FromMilliseconds(100));
-      return false;
-    case REQUEST_COMPLETE:
-      *bytes_read = 0;
-      return true;
+      return ERR_IO_PENDING;
   }
   NOTREACHED();
-  return true;
+  return OK;
 }
 
 void URLRequestSlowDownloadJob::CheckDoneStatus() {
@@ -223,12 +218,10 @@
         FillBufferHelper(buffer_.get(), buffer_size_, &bytes_written);
     DCHECK_EQ(BUFFER_FILLED, status);
     buffer_ = NULL;  // Release the reference.
-    SetStatus(URLRequestStatus());
-    NotifyReadComplete(bytes_written);
+    ReadRawDataComplete(bytes_written);
   } else if (should_error_download_) {
     VLOG(10) << __FUNCTION__ << " called w/ should_finish_ownload_ set.";
-    NotifyDone(
-        URLRequestStatus(URLRequestStatus::FAILED, ERR_CONNECTION_RESET));
+    ReadRawDataComplete(ERR_CONNECTION_RESET);
   } else {
     base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
         FROM_HERE, base::Bind(&URLRequestSlowDownloadJob::CheckDoneStatus,
diff --git a/net/test/url_request/url_request_slow_download_job.h b/net/test/url_request/url_request_slow_download_job.h
index 115a6ac..fcd7f661b 100644
--- a/net/test/url_request/url_request_slow_download_job.h
+++ b/net/test/url_request/url_request_slow_download_job.h
@@ -37,7 +37,7 @@
   void Start() override;
   bool GetMimeType(std::string* mime_type) const override;
   void GetResponseInfo(HttpResponseInfo* info) override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
 
   // Returns the current number of URLRequestSlowDownloadJobs that have
   // not yet completed.
diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc
index 114672ea..1dafbf2 100644
--- a/net/url_request/url_request_file_dir_job.cc
+++ b/net/url_request/url_request_file_dir_job.cc
@@ -13,7 +13,6 @@
 #include "base/thread_task_runner_handle.h"
 #include "base/time/time.h"
 #include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
 #include "net/base/net_util.h"
 #include "net/url_request/url_request_status.h"
 #include "url/gurl.h"
@@ -66,24 +65,19 @@
   weak_factory_.InvalidateWeakPtrs();
 }
 
-bool URLRequestFileDirJob::ReadRawData(IOBuffer* buf,
-                                       int buf_size,
-                                       int* bytes_read) {
-  DCHECK(bytes_read);
-  *bytes_read = 0;
-
+int URLRequestFileDirJob::ReadRawData(IOBuffer* buf, int buf_size) {
   if (is_done())
-    return true;
+    return 0;
 
-  if (FillReadBuffer(buf->data(), buf_size, bytes_read))
-    return true;
+  int bytes_read = 0;
+  if (FillReadBuffer(buf->data(), buf_size, &bytes_read))
+    return bytes_read;
 
   // We are waiting for more data
   read_pending_ = true;
   read_buffer_ = buf;
   read_buffer_length_ = buf_size;
-  SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-  return false;
+  return ERR_IO_PENDING;
 }
 
 bool URLRequestFileDirJob::GetMimeType(std::string* mime_type) const {
@@ -132,40 +126,45 @@
       data.info.GetLastModifiedTime()));
 
   // TODO(darin): coalesce more?
-  CompleteRead();
+  CompleteRead(OK);
 }
 
 void URLRequestFileDirJob::OnListDone(int error) {
   DCHECK(!canceled_);
-  if (error != OK) {
-    read_pending_ = false;
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, error));
-  } else {
+  DCHECK_LE(error, OK);
+  if (error == OK)
     list_complete_ = true;
-    CompleteRead();
-  }
+  CompleteRead(static_cast<Error>(error));
 }
 
 URLRequestFileDirJob::~URLRequestFileDirJob() {}
 
-void URLRequestFileDirJob::CompleteRead() {
-  if (read_pending_) {
-    int bytes_read;
+void URLRequestFileDirJob::CompleteRead(Error status) {
+  DCHECK_LE(status, OK);
+  DCHECK_NE(status, ERR_IO_PENDING);
+
+  // Do nothing if there is no read pending.
+  if (!read_pending_)
+    return;
+
+  int result = status;
+  if (status == OK) {
+    int filled_bytes = 0;
     if (FillReadBuffer(read_buffer_->data(), read_buffer_length_,
-                       &bytes_read)) {
+                       &filled_bytes)) {
+      result = filled_bytes;
       // We completed the read, so reset the read buffer.
-      read_pending_ = false;
       read_buffer_ = NULL;
       read_buffer_length_ = 0;
-
-      SetStatus(URLRequestStatus());
-      NotifyReadComplete(bytes_read);
     } else {
       NOTREACHED();
       // TODO: Better error code.
-      NotifyDone(URLRequestStatus::FromError(ERR_FAILED));
+      result = ERR_FAILED;
     }
   }
+
+  read_pending_ = false;
+  ReadRawDataComplete(result);
 }
 
 bool URLRequestFileDirJob::FillReadBuffer(char* buf, int buf_size,
diff --git a/net/url_request/url_request_file_dir_job.h b/net/url_request/url_request_file_dir_job.h
index 067db81e..f7a7b45 100644
--- a/net/url_request/url_request_file_dir_job.h
+++ b/net/url_request/url_request_file_dir_job.h
@@ -10,6 +10,7 @@
 #include "base/files/file_path.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/directory_lister.h"
+#include "net/base/net_errors.h"
 #include "net/url_request/url_request_job.h"
 
 namespace net {
@@ -29,7 +30,7 @@
   // Overridden from URLRequestJob:
   void Start() override;
   void Kill() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   bool GetMimeType(std::string* mime_type) const override;
   bool GetCharset(std::string* charset) override;
 
@@ -45,7 +46,7 @@
   // When we have data and a read has been pending, this function
   // will fill the response buffer and notify the request
   // appropriately.
-  void CompleteRead();
+  void CompleteRead(Error error);
 
   // Fills a buffer with the output.
   bool FillReadBuffer(char* buf, int buf_size, int* bytes_read);
@@ -67,6 +68,7 @@
   bool read_pending_;
   scoped_refptr<IOBuffer> read_buffer_;
   int read_buffer_length_;
+
   base::WeakPtrFactory<URLRequestFileDirJob> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(URLRequestFileDirJob);
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 06e1ba6b..2c5cf6a 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -33,7 +33,6 @@
 #include "net/base/io_buffer.h"
 #include "net/base/load_flags.h"
 #include "net/base/mime_util.h"
-#include "net/base/net_errors.h"
 #include "net/filter/filter.h"
 #include "net/http/http_util.h"
 #include "net/url_request/url_request_error_job.h"
@@ -63,6 +62,7 @@
       stream_(new FileStream(file_task_runner)),
       file_task_runner_(file_task_runner),
       remaining_bytes_(0),
+      range_parse_result_(OK),
       weak_ptr_factory_(this) {}
 
 void URLRequestFileJob::Start() {
@@ -83,22 +83,17 @@
   URLRequestJob::Kill();
 }
 
-bool URLRequestFileJob::ReadRawData(IOBuffer* dest,
-                                    int dest_size,
-                                    int* bytes_read) {
+int URLRequestFileJob::ReadRawData(IOBuffer* dest, int dest_size) {
   DCHECK_NE(dest_size, 0);
-  DCHECK(bytes_read);
   DCHECK_GE(remaining_bytes_, 0);
 
   if (remaining_bytes_ < dest_size)
-    dest_size = static_cast<int>(remaining_bytes_);
+    dest_size = remaining_bytes_;
 
   // If we should copy zero bytes because |remaining_bytes_| is zero, short
   // circuit here.
-  if (!dest_size) {
-    *bytes_read = 0;
-    return true;
-  }
+  if (!dest_size)
+    return 0;
 
   int rv = stream_->Read(dest,
                          dest_size,
@@ -106,20 +101,11 @@
                                     weak_ptr_factory_.GetWeakPtr(),
                                     make_scoped_refptr(dest)));
   if (rv >= 0) {
-    // Data is immediately available.
-    *bytes_read = rv;
     remaining_bytes_ -= rv;
     DCHECK_GE(remaining_bytes_, 0);
-    return true;
   }
 
-  // Otherwise, a read error occured.  We may just need to wait...
-  if (rv == ERR_IO_PENDING) {
-    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-  } else {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
-  }
-  return false;
+  return rv;
 }
 
 bool URLRequestFileJob::IsRedirectResponse(GURL* location,
@@ -179,7 +165,10 @@
     const HttpRequestHeaders& headers) {
   std::string range_header;
   if (headers.GetHeader(HttpRequestHeaders::kRange, &range_header)) {
-    // We only care about "Range" header here.
+    // This job only cares about the Range header. This method stashes the value
+    // for later use in DidOpen(), which is responsible for some of the range
+    // validation as well. NotifyStartError is not legal to call here since
+    // the job has not started.
     std::vector<HttpByteRange> ranges;
     if (HttpUtil::ParseRangeHeader(range_header, &ranges)) {
       if (ranges.size() == 1) {
@@ -189,8 +178,7 @@
         // because we need to do multipart encoding here.
         // TODO(hclam): decide whether we want to support multiple range
         // requests.
-        NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
-                                    ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+        range_parse_result_ = net::ERR_REQUEST_RANGE_NOT_SATISFIABLE;
       }
     }
   }
@@ -251,13 +239,19 @@
 
 void URLRequestFileJob::DidOpen(int result) {
   if (result != OK) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
+    NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
+    return;
+  }
+
+  if (range_parse_result_ != net::OK) {
+    NotifyStartError(
+        URLRequestStatus(URLRequestStatus::FAILED, range_parse_result_));
     return;
   }
 
   if (!byte_range_.ComputeBounds(meta_info_.file_size)) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
-                                ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+    NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
+                                      net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
     return;
   }
 
@@ -285,8 +279,8 @@
 void URLRequestFileJob::DidSeek(int64 result) {
   OnSeekComplete(result);
   if (result != byte_range_.first_byte_position()) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
-                                ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+    NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
+                                      ERR_REQUEST_RANGE_NOT_SATISFIABLE));
     return;
   }
 
@@ -295,8 +289,7 @@
 }
 
 void URLRequestFileJob::DidRead(scoped_refptr<IOBuffer> buf, int result) {
-  if (result > 0) {
-    SetStatus(URLRequestStatus());  // Clear the IO_PENDING status
+  if (result >= 0) {
     remaining_bytes_ -= result;
     DCHECK_GE(remaining_bytes_, 0);
   }
@@ -304,13 +297,7 @@
   OnReadComplete(buf.get(), result);
   buf = NULL;
 
-  if (result == 0) {
-    NotifyDone(URLRequestStatus());
-  } else if (result < 0) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
-  }
-
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 }  // namespace net
diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h
index 0436dac5..97c6c21 100644
--- a/net/url_request/url_request_file_job.h
+++ b/net/url_request/url_request_file_job.h
@@ -11,6 +11,7 @@
 #include "base/files/file_path.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
+#include "net/base/net_errors.h"
 #include "net/base/net_export.h"
 #include "net/http/http_byte_range.h"
 #include "net/url_request/url_request.h"
@@ -38,7 +39,7 @@
   // URLRequestJob:
   void Start() override;
   void Kill() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   bool IsRedirectResponse(GURL* location, int* http_status_code) override;
   Filter* SetupFilter() const override;
   bool GetMimeType(std::string* mime_type) const override;
@@ -97,9 +98,12 @@
   FileMetaInfo meta_info_;
   const scoped_refptr<base::TaskRunner> file_task_runner_;
 
+  std::vector<HttpByteRange> byte_ranges_;
   HttpByteRange byte_range_;
   int64 remaining_bytes_;
 
+  Error range_parse_result_;
+
   base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob);
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
index 3a088bd..e422d03 100644
--- a/net/url_request/url_request_ftp_job.cc
+++ b/net/url_request/url_request_ftp_job.cc
@@ -239,7 +239,7 @@
     HandleAuthNeededResponse();
     return;
   } else {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
+    NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
   }
 }
 
@@ -251,15 +251,7 @@
 
 void URLRequestFtpJob::OnReadCompleted(int result) {
   read_in_progress_ = false;
-  if (result == 0) {
-    NotifyDone(URLRequestStatus());
-  } else if (result < 0) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
-  } else {
-    // Clear the IO_PENDING status
-    SetStatus(URLRequestStatus());
-  }
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 void URLRequestFtpJob::RestartTransactionWithAuth() {
@@ -352,14 +344,12 @@
   return UploadProgress();
 }
 
-bool URLRequestFtpJob::ReadRawData(IOBuffer* buf,
-                                   int buf_size,
-                                   int* bytes_read) {
+int URLRequestFtpJob::ReadRawData(IOBuffer* buf, int buf_size) {
   DCHECK_NE(buf_size, 0);
-  DCHECK(bytes_read);
   DCHECK(!read_in_progress_);
 
   int rv;
+
   if (proxy_info_.is_direct()) {
     rv = ftp_transaction_->Read(buf, buf_size,
                                 base::Bind(&URLRequestFtpJob::OnReadCompleted,
@@ -370,18 +360,9 @@
                                             base::Unretained(this)));
   }
 
-  if (rv >= 0) {
-    *bytes_read = rv;
-    return true;
-  }
-
-  if (rv == ERR_IO_PENDING) {
+  if (rv == ERR_IO_PENDING)
     read_in_progress_ = true;
-    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-  } else {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
-  }
-  return false;
+  return rv;
 }
 
 void URLRequestFtpJob::HandleAuthNeededResponse() {
diff --git a/net/url_request/url_request_ftp_job.h b/net/url_request/url_request_ftp_job.h
index 74caf726..6315d8f 100644
--- a/net/url_request/url_request_ftp_job.h
+++ b/net/url_request/url_request_ftp_job.h
@@ -71,7 +71,7 @@
 
   // TODO(ibrar):  Yet to give another look at this function.
   UploadProgress GetUploadProgress() const override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
 
   void HandleAuthNeededResponse();
 
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index dac461d..13365df 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -414,11 +414,6 @@
   URLRequestJob::NotifyHeadersComplete();
 }
 
-void URLRequestHttpJob::NotifyDone(const URLRequestStatus& status) {
-  DoneWithRequest(FINISHED);
-  URLRequestJob::NotifyDone(status);
-}
-
 void URLRequestHttpJob::DestroyTransaction() {
   DCHECK(transaction_.get());
 
@@ -998,19 +993,16 @@
 void URLRequestHttpJob::OnReadCompleted(int result) {
   read_in_progress_ = false;
 
+  DCHECK_NE(ERR_IO_PENDING, result);
+
   if (ShouldFixMismatchedContentLength(result))
     result = OK;
 
-  if (result == OK) {
-    NotifyDone(URLRequestStatus());
-  } else if (result < 0) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
-  } else {
-    // Clear the IO_PENDING status
-    SetStatus(URLRequestStatus());
-  }
+  // EOF or error, done with this job.
+  if (result <= 0)
+    DoneWithRequest(FINISHED);
 
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 void URLRequestHttpJob::RestartTransactionWithAuth(
@@ -1334,11 +1326,8 @@
   return false;
 }
 
-bool URLRequestHttpJob::ReadRawData(IOBuffer* buf,
-                                    int buf_size,
-                                    int* bytes_read) {
+int URLRequestHttpJob::ReadRawData(IOBuffer* buf, int buf_size) {
   DCHECK_NE(buf_size, 0);
-  DCHECK(bytes_read);
   DCHECK(!read_in_progress_);
 
   int rv = transaction_->Read(
@@ -1346,23 +1335,15 @@
       base::Bind(&URLRequestHttpJob::OnReadCompleted, base::Unretained(this)));
 
   if (ShouldFixMismatchedContentLength(rv))
-    rv = 0;
+    rv = OK;
 
-  if (rv >= 0) {
-    *bytes_read = rv;
-    if (!rv)
-      DoneWithRequest(FINISHED);
-    return true;
-  }
+  if (rv == 0 || (rv < 0 && rv != ERR_IO_PENDING))
+    DoneWithRequest(FINISHED);
 
-  if (rv == ERR_IO_PENDING) {
+  if (rv == ERR_IO_PENDING)
     read_in_progress_ = true;
-    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-  } else {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
-  }
 
-  return false;
+  return rv;
 }
 
 void URLRequestHttpJob::StopCaching() {
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
index 4ee4440..f9ce401 100644
--- a/net/url_request/url_request_http_job.h
+++ b/net/url_request/url_request_http_job.h
@@ -78,9 +78,6 @@
   // Shadows URLRequestJob's version of this method so we can grab cookies.
   void NotifyHeadersComplete();
 
-  // Shadows URLRequestJob's method so we can record histograms.
-  void NotifyDone(const URLRequestStatus& status);
-
   void DestroyTransaction();
 
   void AddExtraHeaders();
@@ -131,7 +128,7 @@
   void ContinueWithCertificate(X509Certificate* client_cert) override;
   void ContinueDespiteLastError() override;
   void ResumeNetworkStart() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   void StopCaching() override;
   bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override;
   int64 GetTotalReceivedBytes() const override;
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 2747f22..82499a99 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -101,45 +101,46 @@
   request_ = NULL;
 }
 
-// This function calls ReadData to get stream data. If a filter exists, passes
-// the data to the attached filter. Then returns the output from filter back to
-// the caller.
+// This function calls ReadRawData to get stream data. If a filter exists, it
+// passes the data to the attached filter. It then returns the output from
+// filter back to the caller.
 bool URLRequestJob::Read(IOBuffer* buf, int buf_size, int *bytes_read) {
-  bool rv = false;
-
   DCHECK_LT(buf_size, 1000000);  // Sanity check.
   DCHECK(buf);
   DCHECK(bytes_read);
   DCHECK(filtered_read_buffer_.get() == NULL);
   DCHECK_EQ(0, filtered_read_buffer_len_);
 
+  Error error = OK;
   *bytes_read = 0;
 
   // Skip Filter if not present.
-  if (!filter_.get()) {
-    rv = ReadRawDataHelper(buf, buf_size, bytes_read);
+  if (!filter_) {
+    error = ReadRawDataHelper(buf, buf_size, bytes_read);
   } else {
     // Save the caller's buffers while we do IO
     // in the filter's buffers.
     filtered_read_buffer_ = buf;
     filtered_read_buffer_len_ = buf_size;
 
-    if (ReadFilteredData(bytes_read)) {
-      rv = true;  // We have data to return.
+    error = ReadFilteredData(bytes_read);
 
-      // It is fine to call DoneReading even if ReadFilteredData receives 0
-      // bytes from the net, but we avoid making that call if we know for
-      // sure that's the case (ReadRawDataHelper path).
-      if (*bytes_read == 0)
-        DoneReading();
-    } else {
-      rv = false;  // Error, or a new IO is pending.
-    }
+    // Synchronous EOF from the filter.
+    if (error == OK && *bytes_read == 0)
+      DoneReading();
   }
 
-  if (rv && *bytes_read == 0)
-    NotifyDone(URLRequestStatus());
-  return rv;
+  if (error == OK) {
+    // If URLRequestJob read zero bytes, the job is at EOF.
+    if (*bytes_read == 0)
+      NotifyDone(URLRequestStatus());
+  } else if (error == ERR_IO_PENDING) {
+    SetStatus(URLRequestStatus::FromError(ERR_IO_PENDING));
+  } else {
+    NotifyDone(URLRequestStatus::FromError(error));
+    *bytes_read = -1;
+  }
+  return error == OK;
 }
 
 void URLRequestJob::StopCaching() {
@@ -480,11 +481,21 @@
   request_->NotifyResponseStarted();
 }
 
-void URLRequestJob::NotifyReadComplete(int bytes_read) {
+void URLRequestJob::ConvertResultToError(int result, Error* error, int* count) {
+  if (result >= 0) {
+    *error = OK;
+    *count = result;
+  } else {
+    *error = static_cast<Error>(result);
+    *count = 0;
+  }
+}
+
+void URLRequestJob::ReadRawDataComplete(int result) {
   // TODO(cbentzel): Remove ScopedTracker below once crbug.com/475755 is fixed.
   tracked_objects::ScopedTracker tracking_profile(
       FROM_HERE_WITH_EXPLICIT_FUNCTION(
-          "475755 URLRequestJob::NotifyReadComplete"));
+          "475755 URLRequestJob::RawReadCompleted"));
 
   if (!request_ || !request_->has_delegate())
     return;  // The request was destroyed, so there is no more work to do.
@@ -497,11 +508,52 @@
   // The headers should be complete before reads complete
   DCHECK(has_handled_response_);
 
-  OnRawReadComplete(bytes_read);
+  Error error;
+  int bytes_read;
+  ConvertResultToError(result, &error, &bytes_read);
 
-  // Don't notify if we had an error.
-  if (!request_->status().is_success())
-    return;
+  DCHECK_NE(ERR_IO_PENDING, error);
+
+  // Synchronize the URLRequest state machine with the URLRequestJob state
+  // machine. If this read succeeded, either the request is at EOF and the
+  // URLRequest state machine goes to 'finished', or it is not and the
+  // URLRequest state machine goes to 'success'. If the read failed, the
+  // URLRequest state machine goes directly to 'finished'.
+  //
+  // Update the URLRequest's status first, so that NotifyReadCompleted has an
+  // accurate view of the request.
+  if (error == OK && bytes_read > 0) {
+    SetStatus(URLRequestStatus());
+  } else {
+    NotifyDone(URLRequestStatus::FromError(error));
+  }
+
+  GatherRawReadStats(error, bytes_read);
+
+  if (filter_.get() && error == OK) {
+    int filter_bytes_read = 0;
+    // Tell the filter that it has more data.
+    PushInputToFilter(bytes_read);
+
+    // Filter the data.
+    error = ReadFilteredData(&filter_bytes_read);
+
+    if (!filter_bytes_read)
+      DoneReading();
+
+    DVLOG(1) << __FUNCTION__ << "() "
+             << "\"" << (request_ ? request_->url().spec() : "???") << "\""
+             << " pre bytes read = " << bytes_read
+             << " pre total = " << prefilter_bytes_read_
+             << " post total = " << postfilter_bytes_read_;
+    bytes_read = filter_bytes_read;
+  } else {
+    DVLOG(1) << __FUNCTION__ << "() "
+             << "\"" << (request_ ? request_->url().spec() : "???") << "\""
+             << " pre bytes read = " << bytes_read
+             << " pre total = " << prefilter_bytes_read_
+             << " post total = " << postfilter_bytes_read_;
+  }
 
   // When notifying the delegate, the delegate can release the request
   // (and thus release 'this').  After calling to the delegate, we must
@@ -510,25 +562,10 @@
   // survival until we can get out of this method.
   scoped_refptr<URLRequestJob> self_preservation(this);
 
-  if (filter_.get()) {
-    // Tell the filter that it has more data
-    FilteredDataRead(bytes_read);
-
-    // Filter the data.
-    int filter_bytes_read = 0;
-    if (ReadFilteredData(&filter_bytes_read)) {
-      if (!filter_bytes_read)
-        DoneReading();
-      request_->NotifyReadCompleted(filter_bytes_read);
-    }
-  } else {
+  // NotifyReadCompleted should be called after SetStatus or NotifyDone updates
+  // the status.
+  if (error == OK)
     request_->NotifyReadCompleted(bytes_read);
-  }
-  DVLOG(1) << __FUNCTION__ << "() "
-           << "\"" << (request_ ? request_->url().spec() : "???") << "\""
-           << " pre bytes read = " << bytes_read
-           << " pre total = " << prefilter_bytes_read_
-           << " post total = " << postfilter_bytes_read_;
 }
 
 void URLRequestJob::NotifyStartError(const URLRequestStatus &status) {
@@ -555,7 +592,7 @@
   // the response before getting here.
   DCHECK(has_handled_response_ || !status.is_success());
 
-  // As with NotifyReadComplete, we need to take care to notice if we were
+  // As with RawReadCompleted, we need to take care to notice if we were
   // destroyed during a delegate callback.
   if (request_) {
     request_->set_is_pending(false);
@@ -638,10 +675,8 @@
   request_->OnCallToDelegateComplete();
 }
 
-bool URLRequestJob::ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) {
-  DCHECK(bytes_read);
-  *bytes_read = 0;
-  return true;
+int URLRequestJob::ReadRawData(IOBuffer* buf, int buf_size) {
+  return 0;
 }
 
 void URLRequestJob::DoneReading() {
@@ -651,38 +686,34 @@
 void URLRequestJob::DoneReadingRedirectResponse() {
 }
 
-void URLRequestJob::FilteredDataRead(int bytes_read) {
+void URLRequestJob::PushInputToFilter(int bytes_read) {
   DCHECK(filter_);
   filter_->FlushStreamBuffer(bytes_read);
 }
 
-bool URLRequestJob::ReadFilteredData(int* bytes_read) {
+Error URLRequestJob::ReadFilteredData(int* bytes_read) {
   DCHECK(filter_);
   DCHECK(filtered_read_buffer_.get());
   DCHECK_GT(filtered_read_buffer_len_, 0);
   DCHECK_LT(filtered_read_buffer_len_, 1000000);  // Sanity check.
-  DCHECK(!raw_read_buffer_.get());
+  DCHECK(!raw_read_buffer_);
 
   *bytes_read = 0;
-  bool rv = false;
+  Error error = ERR_FAILED;
 
   for (;;) {
     if (is_done())
-      return true;
+      return OK;
 
     if (!filter_needs_more_output_space_ && !filter_->stream_data_len()) {
       // We don't have any raw data to work with, so read from the transaction.
       int filtered_data_read;
-      if (ReadRawDataForFilter(&filtered_data_read)) {
-        if (filtered_data_read > 0) {
-          // Give data to filter.
-          filter_->FlushStreamBuffer(filtered_data_read);
-        } else {
-          return true;  // EOF.
-        }
-      } else {
-        return false;  // IO Pending (or error).
-      }
+      error = ReadRawDataForFilter(&filtered_data_read);
+      // If ReadRawDataForFilter returned some data, fall through to the case
+      // below; otherwise, return early.
+      if (error != OK || filtered_data_read == 0)
+        return error;
+      filter_->FlushStreamBuffer(filtered_data_read);
     }
 
     if ((filter_->stream_data_len() || filter_needs_more_output_space_) &&
@@ -708,7 +739,7 @@
           filter_needs_more_output_space_ = false;
           *bytes_read = filtered_data_len;
           postfilter_bytes_read_ += filtered_data_len;
-          rv = true;
+          error = OK;
           break;
         }
         case Filter::FILTER_NEED_MORE_DATA: {
@@ -721,7 +752,7 @@
           if (filtered_data_len > 0) {
             *bytes_read = filtered_data_len;
             postfilter_bytes_read_ += filtered_data_len;
-            rv = true;
+            error = OK;
           } else {
             // Read again since we haven't received enough data yet (e.g., we
             // may not have a complete gzip header yet).
@@ -732,7 +763,7 @@
         case Filter::FILTER_OK: {
           *bytes_read = filtered_data_len;
           postfilter_bytes_read_ += filtered_data_len;
-          rv = true;
+          error = OK;
           break;
         }
         case Filter::FILTER_ERROR: {
@@ -740,21 +771,19 @@
                    << "\"" << (request_ ? request_->url().spec() : "???")
                    << "\"" << " Filter Error";
           filter_needs_more_output_space_ = false;
-          NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
-                                      ERR_CONTENT_DECODING_FAILED));
-          rv = false;
+          error = ERR_CONTENT_DECODING_FAILED;
           break;
         }
         default: {
           NOTREACHED();
           filter_needs_more_output_space_ = false;
-          rv = false;
+          error = ERR_FAILED;
           break;
         }
       }
 
       // If logging all bytes is enabled, log the filtered bytes read.
-      if (rv && request() && filtered_data_len > 0 &&
+      if (error == OK && request() && filtered_data_len > 0 &&
           request()->net_log().IsCapturing()) {
         request()->net_log().AddByteTransferEvent(
             NetLog::TYPE_URL_REQUEST_JOB_FILTERED_BYTES_READ, filtered_data_len,
@@ -762,18 +791,18 @@
       }
     } else {
       // we are done, or there is no data left.
-      rv = true;
+      error = OK;
     }
     break;
   }
 
-  if (rv) {
+  if (error == OK) {
     // When we successfully finished a read, we no longer need to save the
     // caller's buffers. Release our reference.
     filtered_read_buffer_ = NULL;
     filtered_read_buffer_len_ = 0;
   }
-  return rv;
+  return error;
 }
 
 void URLRequestJob::DestroyFilters() {
@@ -806,9 +835,8 @@
   request_->proxy_server_ = proxy_server;
 }
 
-bool URLRequestJob::ReadRawDataForFilter(int* bytes_read) {
-  bool rv = false;
-
+Error URLRequestJob::ReadRawDataForFilter(int* bytes_read) {
+  Error error = ERR_FAILED;
   DCHECK(bytes_read);
   DCHECK(filter_.get());
 
@@ -820,30 +848,28 @@
   if (!filter_->stream_data_len() && !is_done()) {
     IOBuffer* stream_buffer = filter_->stream_buffer();
     int stream_buffer_size = filter_->stream_buffer_size();
-    rv = ReadRawDataHelper(stream_buffer, stream_buffer_size, bytes_read);
+    error = ReadRawDataHelper(stream_buffer, stream_buffer_size, bytes_read);
   }
-  return rv;
+  return error;
 }
 
-bool URLRequestJob::ReadRawDataHelper(IOBuffer* buf,
-                                      int buf_size,
-                                      int* bytes_read) {
-  DCHECK(!request_->status().is_io_pending());
-  DCHECK(raw_read_buffer_.get() == NULL);
+Error URLRequestJob::ReadRawDataHelper(IOBuffer* buf,
+                                       int buf_size,
+                                       int* bytes_read) {
+  DCHECK(!raw_read_buffer_);
 
-  // Keep a pointer to the read buffer, so we have access to it in the
-  // OnRawReadComplete() callback in the event that the read completes
-  // asynchronously.
+  // Keep a pointer to the read buffer, so we have access to it in
+  // GatherRawReadStats() in the event that the read completes asynchronously.
   raw_read_buffer_ = buf;
-  bool rv = ReadRawData(buf, buf_size, bytes_read);
+  Error error;
+  ConvertResultToError(ReadRawData(buf, buf_size), &error, bytes_read);
 
-  if (!request_->status().is_io_pending()) {
-    // If the read completes synchronously, either success or failure,
-    // invoke the OnRawReadComplete callback so we can account for the
-    // completed read.
-    OnRawReadComplete(*bytes_read);
+  if (error != ERR_IO_PENDING) {
+    // If the read completes synchronously, either success or failure, invoke
+    // GatherRawReadStats so we can account for the completed read.
+    GatherRawReadStats(error, *bytes_read);
   }
-  return rv;
+  return error;
 }
 
 void URLRequestJob::FollowRedirect(const RedirectInfo& redirect_info) {
@@ -852,9 +878,16 @@
     NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
 }
 
-void URLRequestJob::OnRawReadComplete(int bytes_read) {
-  DCHECK(raw_read_buffer_.get());
-  // If |filter_| is non-NULL, bytes will be logged after it is applied instead.
+void URLRequestJob::GatherRawReadStats(Error error, int bytes_read) {
+  DCHECK(raw_read_buffer_ || bytes_read == 0);
+  DCHECK_NE(ERR_IO_PENDING, error);
+
+  if (error != OK) {
+    raw_read_buffer_ = nullptr;
+    return;
+  }
+  // If |filter_| is non-NULL, bytes will be logged after it is applied
+  // instead.
   if (!filter_.get() && request() && bytes_read > 0 &&
       request()->net_log().IsCapturing()) {
     request()->net_log().AddByteTransferEvent(
@@ -865,7 +898,7 @@
   if (bytes_read > 0) {
     RecordBytesRead(bytes_read);
   }
-  raw_read_buffer_ = NULL;
+  raw_read_buffer_ = nullptr;
 }
 
 void URLRequestJob::RecordBytesRead(int bytes_read) {
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index a81ea08..002dc62 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -17,6 +17,7 @@
 #include "base/power_monitor/power_observer.h"
 #include "net/base/host_port_pair.h"
 #include "net/base/load_states.h"
+#include "net/base/net_errors.h"
 #include "net/base/net_export.h"
 #include "net/base/request_priority.h"
 #include "net/base/upload_progress.h"
@@ -276,23 +277,9 @@
   // Notifies the job that headers have been received.
   void NotifyHeadersComplete();
 
-  // Notifies the request that the job has completed a Read operation.
-  void NotifyReadComplete(int bytes_read);
-
   // Notifies the request that a start error has occurred.
   void NotifyStartError(const URLRequestStatus& status);
 
-  // NotifyDone marks when we are done with a request.  It is really
-  // a glorified set_status, but also does internal state checking and
-  // job tracking.  It should be called once per request, when the job is
-  // finished doing all IO.
-  void NotifyDone(const URLRequestStatus& status);
-
-  // Some work performed by NotifyDone must be completed on a separate task
-  // so as to avoid re-entering the delegate.  This method exists to perform
-  // that work.
-  void CompleteNotifyDone();
-
   // Used as an asynchronous callback for Kill to notify the URLRequest
   // that we were canceled.
   void NotifyCanceled();
@@ -305,17 +292,19 @@
   void OnCallToDelegate();
   void OnCallToDelegateComplete();
 
-  // Called to read raw (pre-filtered) data from this Job.
-  // If returning true, data was read from the job.  buf will contain
-  // the data, and bytes_read will receive the number of bytes read.
-  // If returning true, and bytes_read is returned as 0, there is no
-  // additional data to be read.
-  // If returning false, an error occurred or an async IO is now pending.
-  // If async IO is pending, the status of the request will be
-  // URLRequestStatus::IO_PENDING, and buf must remain available until the
-  // operation is completed.  See comments on URLRequest::Read for more
-  // info.
-  virtual bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read);
+  // Called to read raw (pre-filtered) data from this Job. Reads at most
+  // |buf_size| bytes into |buf|.
+  // Possible return values:
+  //   >= 0: Read completed synchronously. Return value is the number of bytes
+  //         read. 0 means eof.
+  //   ERR_IO_PENDING: Read pending asynchronously.
+  //                   When the read completes, |ReadRawDataComplete| should be
+  //                   called.
+  //   Any other negative number: Read failed synchronously. Return value is a
+  //                   network error code.
+  // This method might hold onto a reference to |buf| (by incrementing the
+  // refcount) until the method completes or is cancelled.
+  virtual int ReadRawData(IOBuffer* buf, int buf_size);
 
   // Called to tell the job that a filter has successfully reached the end of
   // the stream.
@@ -326,14 +315,14 @@
   // bodies are never read.
   virtual void DoneReadingRedirectResponse();
 
-  // Informs the filter that data has been read into its buffer
-  void FilteredDataRead(int bytes_read);
-
-  // Reads filtered data from the request.  Returns true if successful,
-  // false otherwise.  Note, if there is not enough data received to
-  // return data, this call can issue a new async IO request under
-  // the hood.
-  bool ReadFilteredData(int* bytes_read);
+  // Reads filtered data from the request. Returns OK if immediately successful,
+  // ERR_IO_PENDING if the request couldn't complete synchronously, and some
+  // other error code if the request failed synchronously. Note that this
+  // function can issue new asynchronous requests if needed, in which case it
+  // returns ERR_IO_PENDING. If this method completes synchronously,
+  // |*bytes_read| is the number of bytes output by the filter chain if this
+  // method returns OK, or zero if this method returns an error.
+  Error ReadFilteredData(int* bytes_read);
 
   // Whether the response is being filtered in this job.
   // Only valid after NotifyHeadersComplete() has been called.
@@ -365,19 +354,33 @@
   // reflects bytes read even when there is no filter.
   int64 postfilter_bytes_read() const { return postfilter_bytes_read_; }
 
+  // Turns an integer result code into an Error and a count of bytes read.
+  // The semantics are:
+  //   |result| >= 0: |*error| == OK, |*count| == |result|
+  //   |result| < 0: |*error| = |result|, |*count| == 0
+  static void ConvertResultToError(int result, Error* error, int* count);
+
+  // Completion callback for raw reads. See |ReadRawData| for details.
+  // |bytes_read| is either >= 0 to indicate a successful read and count of
+  // bytes read, or < 0 to indicate an error.
+  void ReadRawDataComplete(int bytes_read);
+
   // The request that initiated this job. This value MAY BE NULL if the
   // request was released by DetachRequest().
   URLRequest* request_;
 
  private:
   // When data filtering is enabled, this function is used to read data
-  // for the filter.  Returns true if raw data was read.  Returns false if
-  // an error occurred (or we are waiting for IO to complete).
-  bool ReadRawDataForFilter(int* bytes_read);
+  // for the filter. Returns a net error code to indicate if raw data was
+  // successfully read,  an error happened, or the IO is pending.
+  Error ReadRawDataForFilter(int* bytes_read);
+
+  // Informs the filter chain that data has been read into its buffer.
+  void PushInputToFilter(int bytes_read);
 
   // Invokes ReadRawData and records bytes read if the read completes
   // synchronously.
-  bool ReadRawDataHelper(IOBuffer* buf, int buf_size, int* bytes_read);
+  Error ReadRawDataHelper(IOBuffer* buf, int buf_size, int* bytes_read);
 
   // Called in response to a redirect that was not canceled to follow the
   // redirect. The current job will be replaced with a new job loading the
@@ -386,9 +389,9 @@
 
   // Called after every raw read. If |bytes_read| is > 0, this indicates
   // a successful read of |bytes_read| unfiltered bytes. If |bytes_read|
-  // is 0, this indicates that there is no additional data to read. If
-  // |bytes_read| is < 0, an error occurred and no bytes were read.
-  void OnRawReadComplete(int bytes_read);
+  // is 0, this indicates that there is no additional data to read. |error|
+  // specifies whether an error occurred and no bytes were read.
+  void GatherRawReadStats(Error error, int bytes_read);
 
   // Updates the profiling info and notifies observers that an additional
   // |bytes_read| unfiltered bytes have been read for this job.
@@ -398,6 +401,16 @@
   // out.
   bool FilterHasData();
 
+  // NotifyDone marks that request is done. It is really a glorified
+  // set_status, but also does internal state checking and job tracking. It
+  // should be called once per request, when the job is finished doing all IO.
+  void NotifyDone(const URLRequestStatus& status);
+
+  // Some work performed by NotifyDone must be completed asynchronously so
+  // as to avoid re-entering URLRequest::Delegate. This method performs that
+  // work.
+  void CompleteNotifyDone();
+
   // Subclasses may implement this method to record packet arrival times.
   // The default implementation does nothing.  Only invoked when bytes have been
   // read since the last invocation.
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc
index f9ea1fe..e0d19b30 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -76,6 +76,24 @@
     OK,
 };
 
+const MockTransaction kEmptyBodyGzip_Transaction = {
+    "http://www.google.com/empty_body",
+    "GET",
+    base::Time(),
+    "",
+    LOAD_NORMAL,
+    "HTTP/1.1 200 OK",
+    "Content-Encoding: gzip\n",
+    base::Time(),
+    "",
+    TEST_MODE_NORMAL,
+    nullptr,
+    nullptr,
+    0,
+    0,
+    OK,
+};
+
 }  // namespace
 
 TEST(URLRequestJob, TransactionNotifiedWhenDone) {
@@ -187,4 +205,30 @@
   RemoveMockTransaction(&kGZip_Transaction);
 }
 
+// Makes sure that ReadRawDataComplete correctly updates request status before
+// calling ReadFilteredData.
+// Regression test for crbug.com/553300.
+TEST(URLRequestJob, EmptyBodySkipFilter) {
+  MockNetworkLayer network_layer;
+  TestURLRequestContext context;
+  context.set_http_transaction_factory(&network_layer);
+
+  TestDelegate d;
+  scoped_ptr<URLRequest> req(context.CreateRequest(
+      GURL(kEmptyBodyGzip_Transaction.url), DEFAULT_PRIORITY, &d));
+  AddMockTransaction(&kEmptyBodyGzip_Transaction);
+
+  req->set_method("GET");
+  req->Start();
+
+  base::MessageLoop::current()->Run();
+
+  EXPECT_FALSE(d.request_failed());
+  EXPECT_EQ(200, req->GetResponseCode());
+  EXPECT_TRUE(d.data_received().empty());
+  EXPECT_TRUE(network_layer.done_reading_called());
+
+  RemoveMockTransaction(&kEmptyBodyGzip_Transaction);
+}
+
 }  // namespace net
diff --git a/net/url_request/url_request_simple_job.cc b/net/url_request/url_request_simple_job.cc
index bc15079..c12555d4 100644
--- a/net/url_request/url_request_simple_job.cc
+++ b/net/url_request/url_request_simple_job.cc
@@ -65,33 +65,20 @@
 
 URLRequestSimpleJob::~URLRequestSimpleJob() {}
 
-bool URLRequestSimpleJob::ReadRawData(IOBuffer* buf,
-                                      int buf_size,
-                                      int* bytes_read) {
-  DCHECK(bytes_read);
-  buf_size = static_cast<int>(
-      std::min(static_cast<int64>(buf_size),
-               byte_range_.last_byte_position() - next_data_offset_ + 1));
-  DCHECK_GE(buf_size, 0);
-  if (buf_size == 0) {
-    *bytes_read = 0;
-    return true;
-  }
+int URLRequestSimpleJob::ReadRawData(IOBuffer* buf, int buf_size) {
+  buf_size = std::min(static_cast<int64>(buf_size),
+                      byte_range_.last_byte_position() - next_data_offset_ + 1);
+  if (buf_size == 0)
+    return 0;
 
   // Do memory copy on a background thread. See crbug.com/422489.
   GetTaskRunner()->PostTaskAndReply(
       FROM_HERE, base::Bind(&CopyData, make_scoped_refptr(buf), buf_size, data_,
                             next_data_offset_),
-      base::Bind(&URLRequestSimpleJob::OnReadCompleted,
+      base::Bind(&URLRequestSimpleJob::ReadRawDataComplete,
                  weak_factory_.GetWeakPtr(), buf_size));
   next_data_offset_ += buf_size;
-  SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-  return false;
-}
-
-void URLRequestSimpleJob::OnReadCompleted(int bytes_read) {
-  SetStatus(URLRequestStatus());
-  NotifyReadComplete(bytes_read);
+  return ERR_IO_PENDING;
 }
 
 base::TaskRunner* URLRequestSimpleJob::GetTaskRunner() const {
@@ -122,8 +109,8 @@
     return;
 
   if (ranges().size() > 1) {
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
-                                ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+    NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
+                                      ERR_REQUEST_RANGE_NOT_SATISFIABLE));
     return;
   }
 
@@ -143,8 +130,8 @@
   if (result == OK) {
     // Notify that the headers are complete
     if (!byte_range_.ComputeBounds(data_->size())) {
-      NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
-                                  ERR_REQUEST_RANGE_NOT_SATISFIABLE));
+      NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
+                                        ERR_REQUEST_RANGE_NOT_SATISFIABLE));
       return;
     }
 
diff --git a/net/url_request/url_request_simple_job.h b/net/url_request/url_request_simple_job.h
index 6c9d5e8..06f718e 100644
--- a/net/url_request/url_request_simple_job.h
+++ b/net/url_request/url_request_simple_job.h
@@ -28,7 +28,7 @@
 
   void Start() override;
   void Kill() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   bool GetMimeType(std::string* mime_type) const override;
   bool GetCharset(std::string* charset) override;
 
@@ -66,7 +66,6 @@
 
  private:
   void OnGetDataCompleted(int result);
-  void OnReadCompleted(int bytes_read);
 
   HttpByteRange byte_range_;
   std::string mime_type_;
diff --git a/net/url_request/url_request_status.cc b/net/url_request/url_request_status.cc
index 2a6a2fa..7207df2f 100644
--- a/net/url_request/url_request_status.cc
+++ b/net/url_request/url_request_status.cc
@@ -46,4 +46,19 @@
   }
 }
 
+Error URLRequestStatus::ToNetError() const {
+  switch (status_) {
+    case SUCCESS:
+      return OK;
+    case IO_PENDING:
+      return ERR_IO_PENDING;
+    case CANCELED:
+      return ERR_ABORTED;
+    case FAILED:
+      return static_cast<Error>(error_);
+  }
+  NOTREACHED();
+  return ERR_FAILED;
+}
+
 }  // namespace net
diff --git a/net/url_request/url_request_status.h b/net/url_request/url_request_status.h
index 44a5d22b..694c5100 100644
--- a/net/url_request/url_request_status.h
+++ b/net/url_request/url_request_status.h
@@ -5,6 +5,7 @@
 #ifndef NET_URL_REQUEST_URL_REQUEST_STATUS_H_
 #define NET_URL_REQUEST_URL_REQUEST_STATUS_H_
 
+#include "net/base/net_errors.h"
 #include "net/base/net_export.h"
 
 namespace net {
@@ -41,6 +42,13 @@
   // deprecated. See https://crbug.com/490311.
   static URLRequestStatus FromError(int error);
 
+  // Returns a Error corresponding to |status_|.
+  //   OK for OK
+  //   ERR_IO_PENDING for IO_PENDING
+  //   ERR_ABORTED for CANCELLED
+  //   Error for FAILED
+  Error ToNetError() const;
+
   Status status() const { return status_; }
   int error() const { return error_; }
 
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index 8a293c38..bd1c9052 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -210,7 +210,8 @@
       // unexpected url, return error
       // FIXME(brettw) we may want to use WININET errors or have some more types
       // of errors
-      NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, ERR_INVALID_URL));
+      NotifyStartError(
+          URLRequestStatus(URLRequestStatus::FAILED, ERR_INVALID_URL));
       // FIXME(brettw): this should emulate a network error, and not just fail
       // initiating a connection
       return;
@@ -222,22 +223,15 @@
   this->NotifyHeadersComplete();
 }
 
-bool URLRequestTestJob::ReadRawData(IOBuffer* buf,
-                                    int buf_size,
-                                    int* bytes_read) {
+int URLRequestTestJob::ReadRawData(IOBuffer* buf, int buf_size) {
   if (stage_ == WAITING) {
     async_buf_ = buf;
     async_buf_size_ = buf_size;
-    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-    return false;
+    return ERR_IO_PENDING;
   }
 
-  DCHECK(bytes_read);
-  *bytes_read = 0;
-
-  if (offset_ >= static_cast<int>(response_data_.length())) {
-    return true;  // done reading
-  }
+  if (offset_ >= static_cast<int>(response_data_.length()))
+    return 0;  // done reading
 
   int to_read = buf_size;
   if (to_read + offset_ > static_cast<int>(response_data_.length()))
@@ -246,8 +240,7 @@
   memcpy(buf->data(), &response_data_.c_str()[offset_], to_read);
   offset_ += to_read;
 
-  *bytes_read = to_read;
-  return true;
+  return to_read;
 }
 
 void URLRequestTestJob::GetResponseInfo(HttpResponseInfo* info) {
@@ -305,16 +298,15 @@
       stage_ = DATA_AVAILABLE;
       // OK if ReadRawData wasn't called yet.
       if (async_buf_) {
-        int bytes_read;
-        if (!ReadRawData(async_buf_, async_buf_size_, &bytes_read))
-          NOTREACHED() << "This should not return false in DATA_AVAILABLE.";
-        SetStatus(URLRequestStatus());  // clear the io pending flag
+        int result = ReadRawData(async_buf_, async_buf_size_);
+        if (result < 0)
+          NOTREACHED() << "Reads should not fail in DATA_AVAILABLE.";
         if (NextReadAsync()) {
           // Make all future reads return io pending until the next
           // ProcessNextOperation().
           stage_ = WAITING;
         }
-        NotifyReadComplete(bytes_read);
+        ReadRawDataComplete(result);
       }
       break;
     case DATA_AVAILABLE:
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h
index 09b31a4..eb1db01 100644
--- a/net/url_request/url_request_test_job.h
+++ b/net/url_request/url_request_test_job.h
@@ -111,7 +111,7 @@
   // Job functions
   void SetPriority(RequestPriority priority) override;
   void Start() override;
-  bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(IOBuffer* buf, int buf_size) override;
   void Kill() override;
   bool GetMimeType(std::string* mime_type) const override;
   void GetResponseInfo(HttpResponseInfo* info) override;
diff --git a/storage/browser/blob/blob_url_request_job.cc b/storage/browser/blob/blob_url_request_job.cc
index 6ec2fe5..deea300 100644
--- a/storage/browser/blob/blob_url_request_job.cc
+++ b/storage/browser/blob/blob_url_request_job.cc
@@ -75,41 +75,37 @@
   weak_factory_.InvalidateWeakPtrs();
 }
 
-bool BlobURLRequestJob::ReadRawData(net::IOBuffer* dest,
-                                    int dest_size,
-                                    int* bytes_read) {
+int BlobURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
   TRACE_EVENT_ASYNC_BEGIN1("Blob", "BlobRequest::ReadRawData", this, "uuid",
                            blob_handle_ ? blob_handle_->uuid() : "NotFound");
   DCHECK_NE(dest_size, 0);
-  DCHECK(bytes_read);
 
-  // Bail out immediately if we encounter an error.
-  if (error_) {
-    *bytes_read = 0;
-    return true;
-  }
+  // Bail out immediately if we encounter an error. This happens if a previous
+  // ReadRawData signalled an error to its caller but the caller called
+  // ReadRawData again anyway.
+  if (error_)
+    return 0;
 
+  int bytes_read = 0;
   BlobReader::Status read_status =
-      blob_reader_->Read(dest, dest_size, bytes_read,
+      blob_reader_->Read(dest, dest_size, &bytes_read,
                          base::Bind(&BlobURLRequestJob::DidReadRawData,
                                     weak_factory_.GetWeakPtr()));
 
   switch (read_status) {
     case BlobReader::Status::NET_ERROR:
-      NotifyFailure(blob_reader_->net_error());
       TRACE_EVENT_ASYNC_END1("Blob", "BlobRequest::ReadRawData", this, "uuid",
                              blob_handle_ ? blob_handle_->uuid() : "NotFound");
-      return false;
+      return blob_reader_->net_error();
     case BlobReader::Status::IO_PENDING:
-      SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
-      return false;
+      return net::ERR_IO_PENDING;
     case BlobReader::Status::DONE:
       TRACE_EVENT_ASYNC_END1("Blob", "BlobRequest::ReadRawData", this, "uuid",
                              blob_handle_ ? blob_handle_->uuid() : "NotFound");
-      return true;
+      return bytes_read;
   }
   NOTREACHED();
-  return true;
+  return 0;
 }
 
 bool BlobURLRequestJob::GetMimeType(std::string* mime_type) const {
@@ -222,13 +218,7 @@
 void BlobURLRequestJob::DidReadRawData(int result) {
   TRACE_EVENT_ASYNC_END1("Blob", "BlobRequest::ReadRawData", this, "uuid",
                          blob_handle_ ? blob_handle_->uuid() : "NotFound");
-  if (result < 0) {
-    NotifyFailure(result);
-    return;
-  }
-  // Clear the IO_PENDING status
-  SetStatus(net::URLRequestStatus());
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 void BlobURLRequestJob::NotifyFailure(int error_code) {
@@ -236,11 +226,7 @@
 
   // If we already return the headers on success, we can't change the headers
   // now. Instead, we just error out.
-  if (response_info_) {
-    NotifyDone(
-        net::URLRequestStatus(net::URLRequestStatus::FAILED, error_code));
-    return;
-  }
+  DCHECK(!response_info_) << "Cannot NotifyFailure after headers.";
 
   net::HttpStatusCode status_code = net::HTTP_INTERNAL_SERVER_ERROR;
   switch (error_code) {
diff --git a/storage/browser/blob/blob_url_request_job.h b/storage/browser/blob/blob_url_request_job.h
index 21baa2c..1f0b9fb 100644
--- a/storage/browser/blob/blob_url_request_job.h
+++ b/storage/browser/blob/blob_url_request_job.h
@@ -44,7 +44,7 @@
   // net::URLRequestJob methods.
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool GetMimeType(std::string* mime_type) const override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
   int GetResponseCode() const override;
diff --git a/storage/browser/fileapi/file_system_dir_url_request_job.cc b/storage/browser/fileapi/file_system_dir_url_request_job.cc
index ac2118a..598b87a 100644
--- a/storage/browser/fileapi/file_system_dir_url_request_job.cc
+++ b/storage/browser/fileapi/file_system_dir_url_request_job.cc
@@ -14,7 +14,6 @@
 #include "base/time/time.h"
 #include "build/build_config.h"
 #include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
 #include "net/base/net_util.h"
 #include "net/url_request/url_request.h"
 #include "storage/browser/fileapi/file_system_context.h"
@@ -44,16 +43,14 @@
 FileSystemDirURLRequestJob::~FileSystemDirURLRequestJob() {
 }
 
-bool FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest,
-                                             int dest_size,
-                                             int* bytes_read) {
-  int count = std::min(dest_size, static_cast<int>(data_.size()));
+int FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest,
+                                            int dest_size) {
+  int count = std::min(dest_size, base::checked_cast<int>(data_.size()));
   if (count > 0) {
     memcpy(dest->data(), data_.data(), count);
     data_.erase(0, count);
   }
-  *bytes_read = count;
-  return true;
+  return count;
 }
 
 void FileSystemDirURLRequestJob::Start() {
@@ -99,8 +96,7 @@
                        false);
       return;
     }
-    NotifyDone(
-        URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FILE_NOT_FOUND));
+    NotifyStartError(URLRequestStatus::FromError(net::ERR_FILE_NOT_FOUND));
     return;
   }
   file_system_context_->operation_runner()->ReadDirectory(
@@ -113,8 +109,7 @@
       file_system_context_->CrackURL(request_->url()).is_valid()) {
     StartAsync();
   } else {
-    NotifyDone(
-        URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FILE_NOT_FOUND));
+    NotifyStartError(URLRequestStatus::FromError(net::ERR_FILE_NOT_FOUND));
   }
 }
 
@@ -126,7 +121,7 @@
     int rv = net::ERR_FILE_NOT_FOUND;
     if (result == base::File::FILE_ERROR_INVALID_URL)
       rv = net::ERR_INVALID_URL;
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
+    NotifyStartError(URLRequestStatus::FromError(rv));
     return;
   }
 
@@ -174,7 +169,7 @@
     int rv = net::ERR_FILE_NOT_FOUND;
     if (result == base::File::FILE_ERROR_INVALID_URL)
       rv = net::ERR_INVALID_URL;
-    NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
+    NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, rv));
   }
 
   if (!request_)
diff --git a/storage/browser/fileapi/file_system_dir_url_request_job.h b/storage/browser/fileapi/file_system_dir_url_request_job.h
index 01bd372..93fdd1fe 100644
--- a/storage/browser/fileapi/file_system_dir_url_request_job.h
+++ b/storage/browser/fileapi/file_system_dir_url_request_job.h
@@ -32,7 +32,7 @@
   // URLRequestJob methods:
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool GetCharset(std::string* charset) override;
 
   // FilterContext methods (via URLRequestJob):
diff --git a/storage/browser/fileapi/file_system_url_request_job.cc b/storage/browser/fileapi/file_system_url_request_job.cc
index 4607dd8..6c33fc86 100644
--- a/storage/browser/fileapi/file_system_url_request_job.cc
+++ b/storage/browser/fileapi/file_system_url_request_job.cc
@@ -62,6 +62,7 @@
       file_system_context_(file_system_context),
       is_directory_(false),
       remaining_bytes_(0),
+      range_parse_result_(net::OK),
       weak_factory_(this) {}
 
 FileSystemURLRequestJob::~FileSystemURLRequestJob() {}
@@ -79,39 +80,28 @@
   weak_factory_.InvalidateWeakPtrs();
 }
 
-bool FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest,
-                                          int dest_size,
-                                          int* bytes_read) {
+int FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
   DCHECK_NE(dest_size, 0);
-  DCHECK(bytes_read);
   DCHECK_GE(remaining_bytes_, 0);
 
   if (reader_.get() == NULL)
-    return false;
+    return net::ERR_FAILED;
 
   if (remaining_bytes_ < dest_size)
-    dest_size = static_cast<int>(remaining_bytes_);
+    dest_size = remaining_bytes_;
 
-  if (!dest_size) {
-    *bytes_read = 0;
-    return true;
-  }
+  if (!dest_size)
+    return 0;
 
   const int rv = reader_->Read(dest, dest_size,
                                base::Bind(&FileSystemURLRequestJob::DidRead,
                                           weak_factory_.GetWeakPtr()));
   if (rv >= 0) {
-    // Data is immediately available.
-    *bytes_read = rv;
     remaining_bytes_ -= rv;
     DCHECK_GE(remaining_bytes_, 0);
-    return true;
   }
-  if (rv == net::ERR_IO_PENDING)
-    SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
-  else
-    NotifyFailed(rv);
-  return false;
+
+  return rv;
 }
 
 bool FileSystemURLRequestJob::GetMimeType(std::string* mime_type) const {
@@ -126,8 +116,12 @@
 void FileSystemURLRequestJob::SetExtraRequestHeaders(
     const net::HttpRequestHeaders& headers) {
   std::string range_header;
+  // Currently this job only cares about the Range header. Note that validation
+  // is deferred to DidGetMetaData(), because NotifyStartError is not legal to
+  // call since the job has not started.
   if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) {
     std::vector<net::HttpByteRange> ranges;
+
     if (net::HttpUtil::ParseRangeHeader(range_header, &ranges)) {
       if (ranges.size() == 1) {
         byte_range_ = ranges[0];
@@ -135,7 +129,7 @@
         // We don't support multiple range requests in one single URL request.
         // TODO(adamk): decide whether we want to support multiple range
         // requests.
-        NotifyFailed(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE);
+        range_parse_result_ = net::ERR_REQUEST_RANGE_NOT_SATISFIABLE;
       }
     }
   }
@@ -167,7 +161,7 @@
   }
   if (!file_system_context_->CanServeURLRequest(url_)) {
     // In incognito mode the API is not usable and there should be no data.
-    NotifyFailed(net::ERR_FILE_NOT_FOUND);
+    NotifyStartError(URLRequestStatus::FromError(net::ERR_FILE_NOT_FOUND));
     return;
   }
   file_system_context_->operation_runner()->GetMetadata(
@@ -181,7 +175,7 @@
       file_system_context_->CrackURL(request_->url()).is_valid()) {
     StartAsync();
   } else {
-    NotifyFailed(net::ERR_FILE_NOT_FOUND);
+    NotifyStartError(URLRequestStatus::FromError(net::ERR_FILE_NOT_FOUND));
   }
 }
 
@@ -189,9 +183,10 @@
     base::File::Error error_code,
     const base::File::Info& file_info) {
   if (error_code != base::File::FILE_OK) {
-    NotifyFailed(error_code == base::File::FILE_ERROR_INVALID_URL
-                     ? net::ERR_INVALID_URL
-                     : net::ERR_FILE_NOT_FOUND);
+    NotifyStartError(URLRequestStatus::FromError(
+        error_code == base::File::FILE_ERROR_INVALID_URL
+            ? net::ERR_INVALID_URL
+            : net::ERR_FILE_NOT_FOUND));
     return;
   }
 
@@ -201,8 +196,14 @@
 
   is_directory_ = file_info.is_directory;
 
+  if (range_parse_result_ != net::OK) {
+    NotifyStartError(URLRequestStatus::FromError(range_parse_result_));
+    return;
+  }
+
   if (!byte_range_.ComputeBounds(file_info.size)) {
-    NotifyFailed(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE);
+    NotifyStartError(
+        URLRequestStatus::FromError(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE));
     return;
   }
 
@@ -226,17 +227,12 @@
 }
 
 void FileSystemURLRequestJob::DidRead(int result) {
-  if (result > 0)
-    SetStatus(URLRequestStatus());  // Clear the IO_PENDING status
-  else if (result == 0)
-    NotifyDone(URLRequestStatus());
-  else
-    NotifyFailed(result);
+  if (result >= 0) {
+    remaining_bytes_ -= result;
+    DCHECK_GE(remaining_bytes_, 0);
+  }
 
-  remaining_bytes_ -= result;
-  DCHECK_GE(remaining_bytes_, 0);
-
-  NotifyReadComplete(result);
+  ReadRawDataComplete(result);
 }
 
 bool FileSystemURLRequestJob::IsRedirectResponse(GURL* location,
@@ -256,8 +252,4 @@
   return false;
 }
 
-void FileSystemURLRequestJob::NotifyFailed(int rv) {
-  NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
-}
-
 }  // namespace storage
diff --git a/storage/browser/fileapi/file_system_url_request_job.h b/storage/browser/fileapi/file_system_url_request_job.h
index e442cae3..308b66c 100644
--- a/storage/browser/fileapi/file_system_url_request_job.h
+++ b/storage/browser/fileapi/file_system_url_request_job.h
@@ -11,6 +11,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
+#include "net/base/net_errors.h"
 #include "net/http/http_byte_range.h"
 #include "net/url_request/url_request_job.h"
 #include "storage/browser/fileapi/file_system_url.h"
@@ -41,7 +42,7 @@
   // URLRequestJob methods:
   void Start() override;
   void Kill() override;
-  bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
+  int ReadRawData(net::IOBuffer* buf, int buf_size) override;
   bool IsRedirectResponse(GURL* location, int* http_status_code) override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
   void GetResponseInfo(net::HttpResponseInfo* info) override;
@@ -60,7 +61,6 @@
   void DidGetMetadata(base::File::Error error_code,
                       const base::File::Info& file_info);
   void DidRead(int result);
-  void NotifyFailed(int rv);
 
   const std::string storage_domain_;
   FileSystemContext* file_system_context_;
@@ -69,6 +69,7 @@
   bool is_directory_;
   scoped_ptr<net::HttpResponseInfo> response_info_;
   int64 remaining_bytes_;
+  net::Error range_parse_result_;
   net::HttpByteRange byte_range_;
   base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_;
 
diff --git a/styleguide/c++/c++11.html b/styleguide/c++/c++11.html
index 42cdc7a..a5565013 100644
--- a/styleguide/c++/c++11.html
+++ b/styleguide/c++/c++11.html
@@ -298,6 +298,26 @@
 <td>Note: std::move() is allowed but writing your own move constructors is still only allowed in exceptional cases for now, see 'Rvalue References (and Move Semantics)'. <a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/x_dWFxJFdbM'>Discussion thread</a></td>
 </tr>
 
+<tr>
+<td>Conditional Type Selection</td>
+<td><code>std::enable_if</code> and <code>std::conditional</code></td>
+<td>Enables compile-time conditional type selection</td>
+<td><a href="http://en.cppreference.com/w/cpp/types/enable_if">
+std::enable_if</a> and
+<a href="http://en.cppreference.com/w/cpp/types/conditional">
+conditional</a></td>
+<td>Usage should be rare.<a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/vCxo4tZNd_M'>Discussion thread</a></td>
+</tr>
+
+<tr>
+<td>Type Traits</td>
+<td>Class templates within <code>&lt;type_traits&gt;</code></td>
+<td>Allows compile-time inspection of the properties of types</td>
+<td><a href="http://en.cppreference.com/w/cpp/header/type_traits">
+Standard library header &lt;type_traits&gt;</a></td>
+<td>Note that not all type traits are available on all platforms (eg std::underlying_type doesn't work in libstdc++4.6). Use judiciously. <a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/vCxo4tZNd_M'>Discussion thread</a></td>
+</tr>
+
 </tbody>
 </table>
 
@@ -676,17 +696,6 @@
 </tr>
 
 <tr>
-<td>Conditional Type Selection</td>
-<td><code>std::enable_if</code> and <code>std::conditional</code></td>
-<td>Enables compile-time conditional type selection</td>
-<td><a href="http://en.cppreference.com/w/cpp/types/enable_if">
-std::enable_if</a> and
-<a href="http://en.cppreference.com/w/cpp/types/conditional">
-conditional</a></td>
-<td></td>
-</tr>
-
-<tr>
 <td>Constant Iterator Methods on Containers</td>
 <td><code>std::cbegin()</code> and <code>std::cend()</code></td>
 <td>Enforces iteration methods that don't change container contents</td>
@@ -966,15 +975,6 @@
 </tr>
 
 <tr>
-<td>Type Traits</td>
-<td>Class templates within <code>&lt;type_traits&gt;</code></td>
-<td>Allows compile-time inspection of the properties of types</td>
-<td><a href="http://en.cppreference.com/w/cpp/header/type_traits">
-Standard library header &lt;type_traits&gt;</a></td>
-<td></td>
-</tr>
-
-<tr>
 <td>Unique Pointers</td>
 <td><code>std::unique_ptr&lt;<i>type</i>&gt;</code></td>
 <td>Defines a pointer with clear and unambiguous ownership</td>
diff --git a/sync/test/fake_server/android/fake_server_helper_android.cc b/sync/test/fake_server/android/fake_server_helper_android.cc
index 4254295..ed5d639 100644
--- a/sync/test/fake_server/android/fake_server_helper_android.cc
+++ b/sync/test/fake_server/android/fake_server_helper_android.cc
@@ -294,6 +294,14 @@
       fake_server::TombstoneEntity::Create(native_id));
 }
 
+void FakeServerHelperAndroid::ClearServerData(JNIEnv* env,
+                                              jobject obj,
+                                              jlong fake_server) {
+  fake_server::FakeServer* fake_server_ptr =
+      reinterpret_cast<fake_server::FakeServer*>(fake_server);
+  fake_server_ptr->ClearServerData();
+}
+
 // static
 bool FakeServerHelperAndroid::Register(JNIEnv* env) {
   return RegisterNativesImpl(env);
diff --git a/sync/test/fake_server/android/fake_server_helper_android.h b/sync/test/fake_server/android/fake_server_helper_android.h
index a0418ed..fb95af1 100644
--- a/sync/test/fake_server/android/fake_server_helper_android.h
+++ b/sync/test/fake_server/android/fake_server_helper_android.h
@@ -114,6 +114,9 @@
                     jlong fake_server,
                     jstring id);
 
+  // Simulates a dashboard stop and clear.
+  void ClearServerData(JNIEnv* env, jobject obj, jlong fake_server);
+
  private:
   virtual ~FakeServerHelperAndroid();
 
diff --git a/sync/test/fake_server/fake_server.cc b/sync/test/fake_server/fake_server.cc
index 7849cd84a..1b2f16d 100644
--- a/sync/test/fake_server/fake_server.cc
+++ b/sync/test/fake_server/fake_server.cc
@@ -186,14 +186,18 @@
                            network_enabled_(true),
                            enable_implicit_permanent_folder_creation_(false),
                            weak_ptr_factory_(this) {
+  Init();
+}
+
+FakeServer::~FakeServer() {}
+
+void FakeServer::Init() {
   keystore_keys_.push_back(kDefaultKeystoreKey);
 
   const bool create_result = CreateDefaultPermanentItems();
   DCHECK(create_result) << "Permanent items were not created successfully.";
 }
 
-FakeServer::~FakeServer() {}
-
 bool FakeServer::CreatePermanentBookmarkFolder(const std::string& server_tag,
                                                const std::string& name) {
   DCHECK(thread_checker_.CalledOnValidThread());
@@ -619,6 +623,7 @@
   entities_.clear();
   keystore_keys_.clear();
   ++store_birthday_;
+  Init();
 }
 
 void FakeServer::SetAuthenticated() {
diff --git a/sync/test/fake_server/fake_server.h b/sync/test/fake_server/fake_server.h
index 7bcd935..7a55fbe 100644
--- a/sync/test/fake_server/fake_server.h
+++ b/sync/test/fake_server/fake_server.h
@@ -153,6 +153,9 @@
   typedef base::ScopedPtrMap<std::string, scoped_ptr<FakeServerEntity>>
       EntityMap;
 
+  // Gets FakeServer ready for syncing.
+  void Init();
+
   // Processes a GetUpdates call.
   bool HandleGetUpdatesRequest(const sync_pb::GetUpdatesMessage& get_updates,
                                sync_pb::GetUpdatesResponse* response);
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json
index d1ed40c0..ee56ed6 100644
--- a/testing/buildbot/chromium.fyi.json
+++ b/testing/buildbot/chromium.fyi.json
@@ -607,14 +607,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -1540,14 +1546,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -1760,14 +1772,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -4861,14 +4879,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -5065,14 +5089,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -5374,14 +5404,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -5566,14 +5602,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index ed24041..a1959fe 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -689,6 +689,16 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
@@ -705,10 +715,6 @@
         "script": "checkperms.py"
       },
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       },
@@ -1067,14 +1073,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json
index 2da7a3f..7c13bcf0 100644
--- a/testing/buildbot/chromium.mac.json
+++ b/testing/buildbot/chromium.mac.json
@@ -334,14 +334,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -635,14 +641,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -936,14 +948,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -1237,14 +1255,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -1539,14 +1563,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json
index cc97231..bd9753e 100644
--- a/testing/buildbot/chromium.win.json
+++ b/testing/buildbot/chromium.win.json
@@ -706,14 +706,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -1160,14 +1166,20 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
+      },
+      {
+        "isolate_name": "telemetry_unittests",
+        "name": "telemetry_unittests",
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "nacl_integration",
         "script": "nacl_integration.py"
       }
@@ -1518,12 +1530,16 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         }
-      }
-    ],
-    "scripts": [
+      },
       {
+        "isolate_name": "telemetry_unittests",
         "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
+        "override_compile_targets": [
+          "telemetry_unittests_run"
+        ],
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        }
       }
     ]
   },
@@ -2005,10 +2021,6 @@
     ],
     "scripts": [
       {
-        "name": "telemetry_unittests",
-        "script": "telemetry_unittests.py"
-      },
-      {
         "name": "telemetry_perf_unittests",
         "script": "telemetry_perf_unittests.py"
       },
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index 0cf89ab5..07fa7f6 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -411,6 +411,18 @@
       "-v",
     ],
   },
+  "telemetry_unittests": {
+    "label": "//chrome/test:telemetry_unittests",
+    "type": "script",
+    "script": "//testing/scripts/run_telemetry_as_googletest.py",
+    "args": [
+      "--xvfb",
+      "../../tools/telemetry/run_tests",
+      "-v",
+      "--chrome-root",
+      "../../",
+    ],
+  },
   "ui_android_unittests": {
     "label": "//ui/android:ui_android_unittests",
     "type": "console_test_launcher",
diff --git a/testing/buildbot/manage.py b/testing/buildbot/manage.py
index 8a3924ef..3c51341f 100755
--- a/testing/buildbot/manage.py
+++ b/testing/buildbot/manage.py
@@ -76,6 +76,7 @@
   'telemetry_gpu_test',
   'telemetry_gpu_unittests',
   'telemetry_perf_unittests',
+  'telemetry_unittests',
 }
 
 
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 3f90d9fa..bb6fa26 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -105,7 +105,6 @@
 crbug.com/521084 animations/additive-transform-animations.html [ Pass Timeout ]
 crbug.com/521085 fast/compositorworker/compositor-proxy-disconnect-worker-terminate.html [ Crash Pass ]
 crbug.com/521086 fast/cookies/cookies-disabled-in-data-url.html [ Crash Pass Timeout ]
-crbug.com/521087 [ Linux Debug ] fast/dom/shadow/gc-after-body-removed.html [ Crash Pass ]
 crbug.com/521089 [ Precise ] fast/preloader/image.html [ Failure Pass ]
 crbug.com/521090 [ Mac Win ] http/tests/history/post-replace-state-reload.html [ Crash Failure Pass ]
 crbug.com/521091 http/tests/inspector/elements/styles/selector-line-sourcemap-header.html [ Crash Failure Timeout Pass ]
@@ -428,6 +427,8 @@
 crbug.com/526898 imported/web-platform-tests/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml [ Failure ]
 crbug.com/108417 imported/web-platform-tests/html/rendering/non-replaced-elements/tables/table-border-1.html [ Failure ]
 crbug.com/525872 imported/web-platform-tests/html/rendering/non-replaced-elements/tables/table-border-2.html [ Failure ]
+crbug.com/490511 imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color.html [ Failure Pass ]
+crbug.com/490511 imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width.html [ Failure Pass ]
 crbug.com/490511 imported/web-platform-tests/html/semantics/document-metadata/styling/LinkStyle.html [ Failure Pass ]
 crbug.com/525896 imported/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-01.html [ Failure ]
 crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ]
@@ -653,6 +654,7 @@
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/inline-block-alignment-007.xht [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/inline-table-alignment-003.xht [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/inline-table-alignment-005.xht [ Failure ]
+crbug.com/491454 imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006.html [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/table-column-order-002.xht [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/table-column-order-003.xht [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/table-column-order-004.xht [ Failure ]
@@ -925,42 +927,6 @@
 crbug.com/546538 svg/clip-path/clip-path-evenodd-nonzero.svg [ NeedsManualRebaseline ]
 crbug.com/546538 svg/clip-path/clip-path-nonzero-evenodd.svg [ NeedsManualRebaseline ]
 
-crbug.com/548596 css3/selectors3/html/css3-modsel-23.html [ NeedsRebaseline ]
-crbug.com/548596 css3/selectors3/html/css3-modsel-69.html [ NeedsRebaseline ]
-crbug.com/548596 css3/selectors3/xhtml/css3-modsel-23.xml [ NeedsRebaseline ]
-crbug.com/548596 css3/selectors3/xhtml/css3-modsel-69.xml [ NeedsRebaseline ]
-crbug.com/548596 css3/selectors3/xml/css3-modsel-23.xml [ NeedsRebaseline ]
-crbug.com/548596 css3/selectors3/xml/css3-modsel-69.xml [ NeedsRebaseline ]
-crbug.com/548596 editing/input/caret-at-the-edge-of-contenteditable.html [ NeedsRebaseline ]
-crbug.com/548596 editing/input/caret-at-the-edge-of-input.html [ NeedsRebaseline ]
-crbug.com/548596 editing/input/editable-container-with-word-wrap-normal.html [ NeedsRebaseline ]
-crbug.com/548596 editing/pasteboard/drop-text-without-selection.html [ NeedsRebaseline ]
-crbug.com/548596 fast/clip/outline-overflowClip.html [ NeedsRebaseline ]
-crbug.com/548596 fast/css/text-overflow-input.html [ NeedsRebaseline ]
-crbug.com/548596 fast/events/autoscroll.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/basic-inputs.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/control-restrict-line-height.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-appearance-preventDefault.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-appearance-selection.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-disabled-color.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-text-drag-down.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-text-scroll-left-on-blur.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-text-word-wrap.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/input-type-text-min-width.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/minWidthPercent.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/tabbing-input-iframe.html [ NeedsRebaseline ]
-crbug.com/548596 fast/forms/textfield-outline.html [ NeedsRebaseline ]
-crbug.com/548596 fast/overflow/overflow-focus-ring.html [ NeedsRebaseline ]
-crbug.com/548596 fast/repaint/caret-invalidation-in-overflow-scroll.html [ NeedsRebaseline ]
-crbug.com/548596 fast/replaced/width100percent-searchfield.html [ NeedsRebaseline ]
-crbug.com/548596 fast/replaced/width100percent-textfield.html [ NeedsRebaseline ]
-crbug.com/548596 tables/mozilla/bugs/bug59354.html [ NeedsRebaseline ]
-crbug.com/548596 tables/mozilla/bugs/bug96334.html [ NeedsRebaseline ]
-crbug.com/548596 fast/css/input-search-padding.html [ NeedsRebaseline ]
-crbug.com/548596 virtual/pointerevent/fast/events/autoscroll.html [ NeedsRebaseline ]
-crbug.com/548596 virtual/trustedeventsdefaultaction/fast/events/autoscroll.html [ NeedsRebaseline ]
-crbug.com/548596 virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll.html [ NeedsRebaseline ]
-
 crbug.com/425113 svg/clip-path/clip-path-multiple-children.svg [ Failure ]
 
 crbug.com/480769 http/tests/inspector/service-workers/service-workers-redundant.html [ Crash Pass Slow Failure ]
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations
index d267c7b4..5ccf3c499 100644
--- a/third_party/WebKit/LayoutTests/W3CImportExpectations
+++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -118,6 +118,7 @@
 imported/web-platform-tests/http [ Skip ]
 imported/web-platform-tests/images [ Skip ]
 imported/web-platform-tests/infrastructure [ Skip ]
+imported/web-platform-tests/innerText [ Skip ]
 imported/web-platform-tests/js [ Skip ]
 imported/web-platform-tests/lint [ Skip ]
 imported/web-platform-tests/lint.whitelist [ Skip ]
@@ -363,6 +364,7 @@
 imported/web-platform-tests/html/semantics/document-metadata/the-base-element/base_multiple.html [ Skip ]
 imported/web-platform-tests/html/semantics/embedded-content/the-object-element/object-handler.html [ Skip ]
 imported/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/dirname-ltr.html [ Skip ]
+imported/web-platform-tests/html/webappapis/scripting/events/onerroreventhandler.html [ Skip ]
 
 # crbug.com/493537: Need to support SVG reference tests
 imported/web-platform-tests/html/editing/the-hidden-attribute/hidden-2.svg [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt b/third_party/WebKit/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt
index c488536..c597563 100644
--- a/third_party/WebKit/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt
+++ b/third_party/WebKit/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt
@@ -1,4 +1,4 @@
-Testcase for bug http://www.webkit.org/b/89649. The test case checks if caret is drawn properly (especially scrolls properly) inside a editable container having word-wrap:normal.
+Testcase for bug http://www.webkit.org/b/89649. The test case checks if caret is drawn properly(especially scrolls properly) inside a editable container having word-wrap:normal.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
@@ -11,8 +11,8 @@
 
 Final caret rect is calculated by following constraints
 1) ScrollWidth = text content width + caret width
-2) Caret rect is always within container bounding box (thus subtracting the scroll left)
-PASS startCaretRect.left + editableContainer.scrollWidth - editableContainer.scrollLeft is finalCaretRect.right
+2) Caret rect is always within container bounding box (thus substracting the scroll left)
+PASS startCaretRect.left + editableContainer.scrollWidth - editableContainer.scrollLeft - caretWidth is finalCaretRect.right
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt
new file mode 100644
index 0000000..26e5dee0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt
@@ -0,0 +1,9 @@
+PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false
+PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false
+PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false
+PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false
+PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html
new file mode 100644
index 0000000..03b642d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<script src="../../resources/run-after-layout-and-paint.js"></script>
+<style>
+  .test {
+      width: 100px;
+      height: 100px;
+  }
+</style>
+<div class="test"></div>
+<script>
+  var BorderImageWithBorderStyleNone = 1026; // From UseCounter.h
+  window.jsTestIsAsync = true;
+
+  shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)");
+
+  var style = document.querySelector('.test').style;
+
+  // Set a solid border-image; expect no hit
+  style.borderWidth = '20px';
+  style.borderStyle = 'solid';
+  style.borderImage = 'linear-gradient(to bottom, blue, white) 1 repeat';
+    
+  runAfterLayoutAndPaint(
+      function() {
+          shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)");
+
+          // Set one border to none but nuke all border widths; expect no hit
+          style.borderWidth = '0px';
+          style.borderTopStyle = 'none';
+
+          runAfterLayoutAndPaint(
+              function() {
+                  shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)");
+
+                  // Add fill to trigger more border-image code; expect no hit
+                  style.borderImage = 'linear-gradient(to bottom, blue, white) fill 1 repeat';
+
+                  runAfterLayoutAndPaint(
+                      function() {
+                          shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)");
+
+                          // Add a top border width that according to spec should be clamped to zero because
+                          // border-top-style is none; expect hit
+                          style.borderTopWidth = '10px';
+
+                          runAfterLayoutAndPaint(
+                              function() {
+                                  shouldBeTrue("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)");
+                                  finishJSTest();
+                              });
+                      });
+              });
+      });
+</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo-expected.txt b/third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo-expected.txt
new file mode 100644
index 0000000..978e28b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo-expected.txt
@@ -0,0 +1,17 @@
+Use descendant invalidation sets for :read-only and :read-write pseudo classes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(i1, '').backgroundColor is transparent
+PASS getComputedStyle(i2, '').backgroundColor is transparent
+PASS internals.updateStyleAndReturnAffectedElementCount() is 1
+PASS getComputedStyle(i1, '').backgroundColor is green
+PASS internals.updateStyleAndReturnAffectedElementCount() is 1
+PASS getComputedStyle(i2, '').backgroundColor is green
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo.html
new file mode 100644
index 0000000..77718a5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+input { background: transparent }
+input + div { color: pink }
+#i1:read-only { background-color: green }
+#i2:read-write { background-color: green }
+</style>
+<input id="i1" type="text"></input>
+<div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+</div>
+<input id="i2" type="text" readonly></input>
+<div>
+    <div></div>
+    <div></div>
+    <div></div>
+    <div></div>
+</div>
+<script>
+description("Use descendant invalidation sets for :read-only and :read-write pseudo classes.")
+
+var transparent = "rgba(0, 0, 0, 0)";
+var green = "rgb(0, 128, 0)";
+
+shouldBe("getComputedStyle(i1, '').backgroundColor", "transparent");
+shouldBe("getComputedStyle(i2, '').backgroundColor", "transparent");
+
+i1.offsetTop; // Force recalc.
+i1.setAttribute("readonly", "");
+
+if (window.internals)
+    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+
+shouldBe("getComputedStyle(i1, '').backgroundColor", "green");
+
+i2.offsetTop; // Force recalc.
+i2.removeAttribute("readonly");
+
+if (window.internals)
+    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+
+shouldBe("getComputedStyle(i2, '').backgroundColor", "green");
+</script>
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 9cd6729..fa988b2 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
@@ -595,6 +595,15 @@
             'Creating a Request with FormData body should success.');
         })
       .then(function() {
+          var params = new URLSearchParams();
+          params.append('sample string', '1234567890');
+          request = new Request(URL, {method: 'POST', body: params});
+          return request.text();
+        })
+      .then(function(result) {
+          assert_equals(result, "sample+string=1234567890");
+        })
+      .then(function() {
           t.done();
         })
       .catch(unreached_rejection(t));
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt
index 9f354ed..3f4b0fe 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt
@@ -1,6 +1,5 @@
 Tests single resource search in inspector page agent with non existing resource url does not cause a crash.
 
 Bug 69767  
-Search matches: 
-
+No resource with given URL found
 
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html b/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html
index 31b11c52..b3b85e2c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html
@@ -19,7 +19,7 @@
 
     function step3(error, searchMatches)
     {
-        InspectorTest.dumpSearchMatches(searchMatches);
+        InspectorTest.addResult(error);
         InspectorTest.completeTest();
     }
 }
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vlr-006-expected.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vlr-006-expected.html
new file mode 100644
index 0000000..03dcb808
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vlr-006-expected.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<title>CSS Writing Modes Test: outline layout and non-replaced inline and vertical-lr writing-mode</title>
+<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com" />
+<meta content="ahem" name="flags" />
+<style>
+div {
+  color:transparent;
+  font:50px/1 Ahem;
+  width:2em;
+  height:5em;
+}
+.outline {
+  color:orange;
+  outline:blue solid 2px;
+}
+</style>
+<p>Test passes if inside of blue rectangles are orange.
+<div>1<span class="outline">2</span> 34 56 78 <span class="outline">9</span>0</div>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vlr-006.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vlr-006.html
new file mode 100644
index 0000000..861df1f15
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vlr-006.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>CSS Writing Modes Test: outline layout and non-replaced inline and vertical-lr writing-mode</title>
+<link rel="match" href="reference/outline-inline-vlr-006.html" />
+<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com" />
+<link rel="help" title="7.1. Principles of Layout in Vertical Writing Modes" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" />
+<link rel="help" title="18.4 Dynamic outlines: the 'outline' property" href="http://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#dynamic-outlines" />
+<meta content="ahem" name="flags" />
+<style>
+div {
+  color:transparent;
+  font:50px/1 Ahem;
+  width:2em;
+  height:5em;
+}
+.vlr {
+  writing-mode:vertical-lr;
+}
+.outline {
+  color:orange;
+  outline:blue solid 2px;
+}
+</style>
+<p>Test passes if inside of blue rectangles are orange.
+<div class="vlr">1234<span class="outline">5 6</span>7890</div>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006-expected.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006-expected.html
new file mode 100644
index 0000000..91b7ed2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006-expected.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<title>CSS Writing Modes Test: outline layout and non-replaced inline and vertical-rl writing-mode</title>
+<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com" />
+<meta content="ahem" name="flags" />
+<style>
+div {
+  color:transparent;
+  font:50px/1 Ahem;
+  width:2em;
+  height:5em;
+}
+.outline {
+  color:orange;
+  outline:blue solid 2px;
+}
+</style>
+<p>Test passes if inside of blue rectangles are orange.
+<div><span class="outline">1</span>2 34 56 78 9<span class="outline">0</span></div>
diff --git a/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006.html b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006.html
new file mode 100644
index 0000000..e579882
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/outline-inline-vrl-006.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>CSS Writing Modes Test: outline layout and non-replaced inline and vertical-rl writing-mode</title>
+<link rel="match" href="reference/outline-inline-vrl-006.html" />
+<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com" />
+<link rel="help" title="7.1. Principles of Layout in Vertical Writing Modes" href="http://www.w3.org/TR/css-writing-modes-3/#vertical-layout" />
+<link rel="help" title="18.4 Dynamic outlines: the 'outline' property" href="http://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#dynamic-outlines" />
+<meta content="ahem" name="flags" />
+<style>
+div {
+  color:transparent;
+  font:50px/1 Ahem;
+  width:2em;
+  height:5em;
+}
+.vrl {
+  writing-mode:vertical-rl;
+}
+.outline {
+  color:orange;
+  outline:blue solid 2px;
+}
+</style>
+<p>Test passes if inside of blue rectangles are orange.
+<div class="vrl">1234<span class="outline">5 6</span>7890</div>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/cssom-view/elementFromPoint-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/cssom-view/elementFromPoint-expected.txt
new file mode 100644
index 0000000..f7576d8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/cssom-view/elementFromPoint-expected.txt
@@ -0,0 +1,19 @@



+Hello WPT!

+Another teal
+This is a testharness.js-based test.
+PASS Negative co-ordinates 
+PASS co-ordinates larger than the viewport 
+PASS co-ordinates larger than the viewport from in iframe 
+PASS Return first element that is the target for hit testing 
+PASS First element to get mouse events with pointer-events css 
+PASS SVG element at x,y 
+FAIL transformed element at x,y assert_equals: Should have returned pink element that has a transform expected Element node <div id="pink" class="size pink" style="transform: transl... but got null
+FAIL no hit target at x,y assert_equals: Should have returned the root expected Element node <body>
+  <div id="purple" class="size purple">&nbsp;</div... but got null
+PASS No viewport available 
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/cssom-view/elementFromPoint.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/cssom-view/elementFromPoint.html
new file mode 100644
index 0000000..4937ec5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/cssom-view/elementFromPoint.html
@@ -0,0 +1,143 @@
+<!DOCTYPE html>
+<title>cssom-view - elementFromPoint</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+  .size {
+    width:100px;
+    height:100px;
+  }
+  .overlay {
+    position:absolute;
+    top:109px;
+    pointer-events:none;
+  }
+  .purple {
+    background-color: rebeccapurple;
+  }
+  .yellow {
+    background-color: yellow;
+  }
+  .teal {
+    background-color: teal;
+  }
+  .pink {
+    background-color: pink;
+  }
+</style>
+<body>
+  <div id='purple' class="size purple" >&nbsp;</div>
+  <div id='yellow' class="size yellow">&nbsp;</div>
+  <div id='teal' class="size overlay teal">&nbsp;</div>
+  <iframe id=iframe-1 src="iframe.html" style='display:none;position:absolute; left:300px;'></iframe>
+  <iframe id=iframe-2 src="iframe.html" width="" height=""></iframe>
+  <iframe id=iframe-3 width="" height=""></iframe>
+  <svg id=squiggle xmlns="http://www.w3.org/2000/svg" height="98" width="581" viewBox="0 0 581 98">
+    <path stroke-dashoffset="0.00" stroke-dasharray="" d="M62.9 14.9c-25-7.74-56.6 4.8-60.4 24.3-3.73 19.6 21.6 35 39.6 37.6 42.8 6.2 72.9-53.4 116-58.9 65-18.2 191 101 215 28.8 5-16.7-7-49.1-34-44-34 11.5-31 46.5-14 69.3 9.38 12.6 24.2 20.6 39.8 22.9 91.4 9.05 102-98.9 176-86.7 18.8 3.81 33 17.3 36.7 34.6 2.01 10.2.124 21.1-5.18 30.1" stroke="#000" stroke-width="4.3" fill="none">
+    </path>
+  </svg>
+  <svg id=svg-transform width="180" height="200"
+  xmlns="http://www.w3.org/2000/svg"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <!--  Now we add a text element and apply rotate and translate to both  -->
+  <rect x="50" y="50" height="100" width="100" style="stroke:#000; fill: #0086B2" transform="translate(30) rotate(45 50 50)"></rect>
+  <text x="60" y="105" transform="translate(30) rotate(45 50 50)"> Hello WPT! </text>
+
+</svg>
+  <div id='pink' class='size pink' style='transform: translate(10px)'>&nbsp;</div>
+  <div id='anotherteal' class='size teal' style='pointer-events:none'>Another teal</div>
+  <script>
+    setup({explicit_done:true});
+    window.onload = function () {
+      test(function () {
+              assert_equals(document.elementFromPoint(-1, -1), null,
+                "both co-ordinates passed in are negative so should have returned a null");
+              assert_equals(document.elementFromPoint(-1, -1), null,
+                "x co-ordinates passed in are negative so should have returned a null");
+              assert_equals(document.elementFromPoint(-1, -1), null,
+                "y co-ordinates passed in are negative so should have returned a null");
+                  }, "Negative co-ordinates");
+
+      test(function () {
+              var viewportX = window.innerWidth;
+              var viewportY = window.innerHeight;
+              assert_equals(document.elementFromPoint(viewportX + 100, 10), null,
+                "X co-ordinates larger than viewport");
+              assert_equals(document.elementFromPoint(10, viewportY + 100), null,
+                "Y co-ordinates larger than viewport");
+              assert_equals(document.elementFromPoint(viewportX + 100, viewportY + 100), null,
+                "X, Y co-ordinates larger than viewport");
+      }, "co-ordinates larger than the viewport");
+
+      test(function () {
+              var viewportX = window.frames[1].innerWidth;
+              var viewportY = window.frames[1].innerHeight;
+              var iframeRect = document.getElementById('iframe-2').getBoundingClientRect();
+              assert_equals(null, window.frames[1].document.elementFromPoint(iframeRect.right + viewportX + 100, 10),
+                "X co-ordinates larger than viewport");
+              assert_equals(null, window.frames[1].document.elementFromPoint(10, iframeRect.bottom + viewportY + 100),
+                "Y co-ordinates larger than viewport");
+              assert_equals(null, window.frames[1].document.elementFromPoint(iframeRect.right + viewportX + 100,
+                                                                             iframeRect.bottom + viewportY + 100),
+                "X, Y co-ordinates larger than viewport");
+      }, "co-ordinates larger than the viewport from in iframe");
+
+      test(function () {
+              assert_equals(document.elementFromPoint(10, 10), document.getElementById('purple'),
+                "Should have returned the element with id `purple`");
+            }, "Return first element that is the target for hit testing");
+
+      test(function () {
+              assert_equals(document.elementFromPoint(10, 120), document.getElementById('yellow'),
+                "Should have returned the element with id `yellow` as element with `teal` has `pointer-events:none`");
+            }, "First element to get mouse events with pointer-events css");
+
+      test(function () {
+             var svg = document.getElementById('squiggle');
+             var svgRect = svg.getBoundingClientRect();
+             assert_equals(document.elementFromPoint(svgRect.left + Math.round(svgRect.width/2),
+                                                     svgRect.top + Math.round(svgRect.height/2)),
+                           svg,
+                           "Should have returned the line SVG");
+      }, "SVG element at x,y");
+
+      test(function () {
+              var svg = document.getElementById('svg-transform');
+              var svgRect = svg.getBoundingClientRect();
+              assert_equals(document.elementFromPoint(svgRect.left + Math.round(svgRect.width/2),
+                                                      svgRect.top + Math.round(svgRect.height/2)),
+                            svg.querySelector("rect"),
+                            "Should have returned SVG with Hello WPT! that has a transform");
+
+              var pink = document.getElementById('pink');
+              var pinkRect = pink.getBoundingClientRect();
+              assert_equals(document.elementFromPoint(pinkRect.left + Math.round(pinkRect.width/2),
+                                                      pinkRect.top + Math.round(pinkRect.height/2)),
+                            pink,
+                            "Should have returned pink element that has a transform");
+
+      }, "transformed element at x,y");
+
+      test(function () {
+            var anotherteal = document.getElementById('anotherteal');
+            var anothertealRect = anotherteal.getBoundingClientRect();
+            assert_equals(document.elementFromPoint(anothertealRect.left + Math.round(anothertealRect.width/2),
+                                                    anothertealRect.top + Math.round(anothertealRect.height/2)),
+                          document.body,
+                          "Should have returned the root");
+
+            var doc = frames[2].document;
+            doc.removeChild(doc.documentElement);
+            assert_equals(doc.elementFromPoint(0, 0), null,
+                          "Should have returned null as no root element");
+      }, "no hit target at x,y");
+
+      test(function () {
+            var doc = document.implementation.createHTMLDocument('foo');
+            assert_equals(doc.elementFromPoint(0, 0), null,
+                          "Should have returned the documentElement for the document")
+      }, "No viewport available");
+      done();
+    }
+ </script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/hr-time/basic.worker.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/hr-time/basic.worker.js
new file mode 100644
index 0000000..6a9f7a39
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/hr-time/basic.worker.js
@@ -0,0 +1,18 @@
+importScripts("/resources/testharness.js");
+
+test(function() {
+  assert_true((performance !== undefined), "WorkerGlobalScope.performance exists");
+  assert_equals((typeof performance.now), "function");
+}, "WorkerGlobalScope.performance.now() is a function");
+
+test(function() {
+  assert_true(performance.now() > 0);
+}, "WorkerGlobalScope.performance.now() returns a positive number");
+
+test(function() {
+    var now1 = performance.now();
+    var now2 = performance.now();
+    assert_true((now2-now1) >= 0);
+  }, "WorkerGlobalScope.performance.now() difference is not negative");
+
+done();
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html
index f180841..7006067 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html
@@ -25,14 +25,18 @@
   var minutes = d.getMinutes()
   var seconds = d.getSeconds()
 
-  test(function() {
-    var local_time = hours * 60 * 60 + minutes * 60 + seconds;
-    var m = pattern.exec(last_modified);
-    var last_modified_time = parseInt(m[1]) * 60 * 60 + parseInt(m[2]) * 60 + parseInt(m[3]);
-    assert_approx_equals(last_modified_time, local_time, 2,
-                         "Hours and minutes should match local time.");
-  }, "Date returned by lastModified is in the user's local time zone.");
-
+  // Checking whether d and and new instance of Date have the same timezone.
+  // Do not run the time zone test in the case daylight saving occurs.
+  var d2 = new Date();
+  if (d2.getTimezoneOffset() == d.getTimezoneOffset()) {
+    test(function() {
+      var local_time = hours * 60 * 60 + minutes * 60 + seconds;
+      var m = pattern.exec(last_modified);
+      var last_modified_time = parseInt(m[1]) * 60 * 60 + parseInt(m[2]) * 60 + parseInt(m[3]);
+      assert_approx_equals(last_modified_time, local_time, 2,
+                           "Hours and minutes should match local time.");
+    }, "Date returned by lastModified is in the user's local time zone.");
+  }
   var t = async_test("Date returned by lastModified is current after timeout.");
 
   setTimeout(function() {
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/reflection.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/reflection.js
index 7bd41d5..35099c1 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/reflection.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/reflection.js
@@ -139,10 +139,9 @@
  *
  * Note that all tests/expected values are only baselines, and can be expanded
  * with additional tests hardcoded into the function for particular types if
- * necessary (e.g., enum).  null means "default" as a DOM expected value, and
- * "throw an INDEX_SIZE_ERR exception" as an IDL expected value.  (This is a
- * kind of stupid and fragile convention, but it's simple and works for now.)
- * Expected DOM values are cast to strings by adding "".
+ * necessary. For example, a special codepath is used for enums, and for
+ * IDL setters which throw an exception. null means "defaultVal" is the
+ * expected value. Expected DOM values are cast to strings by adding "".
  *
  * TODO: Test strings that aren't valid UTF-16.  Desired behavior is not clear
  * here at the time of writing, see
@@ -379,8 +378,8 @@
             }
             return parsed;
         },
-        "idlTests":       [minInt, -36,  -1,   0, 1, maxInt],
-        "idlDomExpected": [null,   null, null, 0, 1, maxInt]
+        "idlTests":       [minInt, -36,  -1, 0, 1, maxInt],
+        "idlDomExpected": [null/*exception*/, null/*exception*/, null/*exception*/, 0, 1, maxInt]
     },
     /**
      * "If a reflecting IDL attribute is an unsigned integer type (unsigned
@@ -416,8 +415,9 @@
             }
             return parsed;
         },
-        "idlTests": [0, 1, 257, 2147483647, "-0"],
-        "idlIdlExpected": [0, 1, 257, 2147483647, 0]
+        "idlTests": [0, 1, 257, maxInt, "-0", maxInt + 1, maxUnsigned],
+        "idlIdlExpected": [0, 1, 257, maxInt, 0, null, null],
+        "idlDomExpected": [0, 1, 257, maxInt, 0, null, null],
     },
     /**
      * "If a reflecting IDL attribute is an unsigned integer type (unsigned
@@ -457,8 +457,8 @@
             }
             return parsed;
         },
-        "idlTests":       [0,    1, 2147483647],
-        "idlDomExpected": [null, 1, 2147483647]
+        "idlTests":       [0, 1, maxInt, maxInt + 1, maxUnsigned],
+        "idlDomExpected": [null/*exception*/, 1, maxInt, null, null]
     },
     /**
      * "If a reflecting IDL attribute is a floating point number type (double),
@@ -610,8 +610,8 @@
     var domTests = typeInfo.domTests.slice(0);
     var domExpected = typeInfo.domExpected.map(function(val) { return val === null ? defaultVal : val; });
     var idlTests = typeInfo.idlTests.slice(0);
-    var idlDomExpected = typeInfo.idlDomExpected.slice(0);
-    var idlIdlExpected = typeInfo.idlIdlExpected.slice(0);
+    var idlDomExpected = typeInfo.idlDomExpected.map(function(val) { return val === null ? defaultVal : val; });
+    var idlIdlExpected = typeInfo.idlIdlExpected.map(function(val) { return val === null ? defaultVal : val; });
     switch (data.type) {
         // Extra tests and other special-casing
         case "boolean":
@@ -712,7 +712,8 @@
     }
 
     for (var i = 0; i < idlTests.length; i++) {
-        if (idlDomExpected[i] === null && data.type != "enum") {
+        if ((data.type == "limited long" && idlTests[i] < 0) ||
+            (data.type == "limited unsigned long" && idlTests[i] == 0)) {
             ReflectionHarness.testException("INDEX_SIZE_ERR", function() {
                 idlObj[idlName] = idlTests[i];
             }, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " must throw INDEX_SIZE_ERR");
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color-expected.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color-expected.html
new file mode 100644
index 0000000..5cd35c8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color-expected.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<meta charset=utf-8>
+<style>
+.hr {
+  color: gray;
+  border-style: inset;
+  border-width: 1px;
+  margin: 0.5em auto;
+}
+
+.green {
+  color: green;
+}
+
+.no-inset {
+  border-style: solid;
+}
+</style>
+<div class='hr'></div>
+<div class='hr no-inset'></div>
+<div class='hr no-inset'></div>
+<div class='hr green no-inset'></div>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color.html
new file mode 100644
index 0000000..750f77e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/color.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<meta charset=utf-8>
+<link rel=match href="color-ref.html">
+<hr>
+<hr color="">
+<hr color=transparent>
+<hr color=green>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width-expected.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width-expected.html
new file mode 100644
index 0000000..245fde99
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width-expected.html
@@ -0,0 +1,19 @@
+<style>
+.hr {
+  color: gray;
+  border-style: inset;
+  border-width: 1px;
+  margin: 0.5em auto;
+}
+</style>
+<div class=hr></div>
+<div class=hr style="width: 50%"></div>
+<div class=hr style="width: 100px"></div>
+<div class=hr style="width: 100px"></div>
+<div class=hr style="width: 100px"></div>
+<div class=hr style="width: 100.99px"></div>
+<div class=hr style="width: 0%"></div>
+<div class=hr style="width: 0%"></div>
+<div class=hr style="width: 0%"></div>
+<div class=hr style="width: 0%"></div>
+<div class=hr></div>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width.html
new file mode 100644
index 0000000..a436d2ae
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/width.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset="utf-8">
+<title></title>
+<link rel="match" href="width-ref.html">
+<hr>
+<hr width='50%'>
+<hr width='100'>
+<hr width='100foo'>
+<hr width='  100    '>
+<hr width='100.99'>
+<hr width='0'>
+<hr width='00'>
+<hr width='+0'>
+<hr width='+00'>
+<hr width='++0'>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity-expected.txt
index c6f4d69b..9c987e4 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-checkValidity-expected.txt
@@ -4,40 +4,40 @@
 This is a testharness.js-based test.
 PASS [INPUT in TEXT status] no constraint 
 PASS [INPUT in TEXT status] no constraint (in a form) 
-PASS [INPUT in TEXT status] suffering from being too long 
-PASS [INPUT in TEXT status] suffering from being too long (in a form) 
+FAIL [INPUT in TEXT status] suffering from being too long assert_false: The checkValidity method should be false. expected false got true
+FAIL [INPUT in TEXT status] suffering from being too long (in a form) assert_false: The checkValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in TEXT status] suffering from a pattern mismatch 
 PASS [INPUT in TEXT status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in TEXT status] suffering from being missing 
 PASS [INPUT in TEXT status] suffering from being missing (in a form) 
 PASS [INPUT in SEARCH status] no constraint 
 PASS [INPUT in SEARCH status] no constraint (in a form) 
-PASS [INPUT in SEARCH status] suffering from being too long 
-PASS [INPUT in SEARCH status] suffering from being too long (in a form) 
+FAIL [INPUT in SEARCH status] suffering from being too long assert_false: The checkValidity method should be false. expected false got true
+FAIL [INPUT in SEARCH status] suffering from being too long (in a form) assert_false: The checkValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch 
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in SEARCH status] suffering from being missing 
 PASS [INPUT in SEARCH status] suffering from being missing (in a form) 
 PASS [INPUT in TEL status] no constraint 
 PASS [INPUT in TEL status] no constraint (in a form) 
-PASS [INPUT in TEL status] suffering from being too long 
-PASS [INPUT in TEL status] suffering from being too long (in a form) 
+FAIL [INPUT in TEL status] suffering from being too long assert_false: The checkValidity method should be false. expected false got true
+FAIL [INPUT in TEL status] suffering from being too long (in a form) assert_false: The checkValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in TEL status] suffering from a pattern mismatch 
 PASS [INPUT in TEL status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in TEL status] suffering from being missing 
 PASS [INPUT in TEL status] suffering from being missing (in a form) 
 PASS [INPUT in PASSWORD status] no constraint 
 PASS [INPUT in PASSWORD status] no constraint (in a form) 
-PASS [INPUT in PASSWORD status] suffering from being too long 
-PASS [INPUT in PASSWORD status] suffering from being too long (in a form) 
+FAIL [INPUT in PASSWORD status] suffering from being too long assert_false: The checkValidity method should be false. expected false got true
+FAIL [INPUT in PASSWORD status] suffering from being too long (in a form) assert_false: The checkValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch 
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in PASSWORD status] suffering from being missing 
 PASS [INPUT in PASSWORD status] suffering from being missing (in a form) 
 PASS [INPUT in URL status] no constraint 
 PASS [INPUT in URL status] no constraint (in a form) 
-PASS [INPUT in URL status] suffering from being too long 
-PASS [INPUT in URL status] suffering from being too long (in a form) 
+FAIL [INPUT in URL status] suffering from being too long assert_false: The checkValidity method should be false. expected false got true
+FAIL [INPUT in URL status] suffering from being too long (in a form) assert_false: The checkValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in URL status] suffering from a pattern mismatch 
 PASS [INPUT in URL status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in URL status] suffering from a type mismatch 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
index 7130f51..377586b6 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
@@ -1,29 +1,19 @@
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 22 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 22 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please enter a URL. sub-message=
@@ -90,40 +80,40 @@
 This is a testharness.js-based test.
 PASS [INPUT in TEXT status] no constraint 
 PASS [INPUT in TEXT status] no constraint (in a form) 
-PASS [INPUT in TEXT status] suffering from being too long 
-PASS [INPUT in TEXT status] suffering from being too long (in a form) 
+FAIL [INPUT in TEXT status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in TEXT status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in TEXT status] suffering from a pattern mismatch 
 PASS [INPUT in TEXT status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in TEXT status] suffering from being missing 
 PASS [INPUT in TEXT status] suffering from being missing (in a form) 
 PASS [INPUT in SEARCH status] no constraint 
 PASS [INPUT in SEARCH status] no constraint (in a form) 
-PASS [INPUT in SEARCH status] suffering from being too long 
-PASS [INPUT in SEARCH status] suffering from being too long (in a form) 
+FAIL [INPUT in SEARCH status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in SEARCH status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch 
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in SEARCH status] suffering from being missing 
 PASS [INPUT in SEARCH status] suffering from being missing (in a form) 
 PASS [INPUT in TEL status] no constraint 
 PASS [INPUT in TEL status] no constraint (in a form) 
-PASS [INPUT in TEL status] suffering from being too long 
-PASS [INPUT in TEL status] suffering from being too long (in a form) 
+FAIL [INPUT in TEL status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in TEL status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in TEL status] suffering from a pattern mismatch 
 PASS [INPUT in TEL status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in TEL status] suffering from being missing 
 PASS [INPUT in TEL status] suffering from being missing (in a form) 
 PASS [INPUT in PASSWORD status] no constraint 
 PASS [INPUT in PASSWORD status] no constraint (in a form) 
-PASS [INPUT in PASSWORD status] suffering from being too long 
-PASS [INPUT in PASSWORD status] suffering from being too long (in a form) 
+FAIL [INPUT in PASSWORD status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in PASSWORD status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch 
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in PASSWORD status] suffering from being missing 
 PASS [INPUT in PASSWORD status] suffering from being missing (in a form) 
 PASS [INPUT in URL status] no constraint 
 PASS [INPUT in URL status] no constraint (in a form) 
-PASS [INPUT in URL status] suffering from being too long 
-PASS [INPUT in URL status] suffering from being too long (in a form) 
+FAIL [INPUT in URL status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in URL status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in URL status] suffering from a pattern mismatch 
 PASS [INPUT in URL status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in URL status] suffering from a type mismatch 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooLong-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooLong-expected.txt
index 1ce7657..1ac90a1 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooLong-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooLong-expected.txt
@@ -18,7 +18,7 @@
 PASS [INPUT in TEXT status] Dirty value - value is less than maxlength 
 PASS [INPUT in TEXT status] Dirty value - length of value(AAA) in unicode is less than maxlength 
 PASS [INPUT in TEXT status] Dirty value - value equals to maxlength 
-FAIL [INPUT in TEXT status] Dirty value - length of value is greater than maxlength assert_false: The validity.tooLong should be false. expected false got true
+PASS [INPUT in TEXT status] Dirty value - length of value is greater than maxlength 
 PASS [INPUT in SEARCH status] Non-dirty value - maxlength is not set 
 PASS [INPUT in SEARCH status] Non-dirty value - value is empty string 
 PASS [INPUT in SEARCH status] Non-dirty value - length of value is less than maxlength 
@@ -27,7 +27,7 @@
 PASS [INPUT in SEARCH status] Dirty value - value is less than maxlength 
 PASS [INPUT in SEARCH status] Dirty value - length of value(AAA) in unicode is less than maxlength 
 PASS [INPUT in SEARCH status] Dirty value - value equals to maxlength 
-FAIL [INPUT in SEARCH status] Dirty value - length of value is greater than maxlength assert_false: The validity.tooLong should be false. expected false got true
+PASS [INPUT in SEARCH status] Dirty value - length of value is greater than maxlength 
 PASS [INPUT in TEL status] Non-dirty value - maxlength is not set 
 PASS [INPUT in TEL status] Non-dirty value - value is empty string 
 PASS [INPUT in TEL status] Non-dirty value - length of value is less than maxlength 
@@ -36,7 +36,7 @@
 PASS [INPUT in TEL status] Dirty value - value is less than maxlength 
 PASS [INPUT in TEL status] Dirty value - length of value(AAA) in unicode is less than maxlength 
 PASS [INPUT in TEL status] Dirty value - value equals to maxlength 
-FAIL [INPUT in TEL status] Dirty value - length of value is greater than maxlength assert_false: The validity.tooLong should be false. expected false got true
+PASS [INPUT in TEL status] Dirty value - length of value is greater than maxlength 
 PASS [INPUT in URL status] Non-dirty value - maxlength is not set 
 PASS [INPUT in URL status] Non-dirty value - value is empty string 
 PASS [INPUT in URL status] Non-dirty value - length of value is less than maxlength 
@@ -45,7 +45,7 @@
 PASS [INPUT in URL status] Dirty value - value is less than maxlength 
 PASS [INPUT in URL status] Dirty value - length of value(AAA) in unicode is less than maxlength 
 PASS [INPUT in URL status] Dirty value - value equals to maxlength 
-FAIL [INPUT in URL status] Dirty value - length of value is greater than maxlength assert_false: The validity.tooLong should be false. expected false got true
+PASS [INPUT in URL status] Dirty value - length of value is greater than maxlength 
 PASS [INPUT in EMAIL status] Non-dirty value - maxlength is not set 
 PASS [INPUT in EMAIL status] Non-dirty value - value is empty string 
 PASS [INPUT in EMAIL status] Non-dirty value - length of value is less than maxlength 
@@ -63,7 +63,7 @@
 PASS [INPUT in PASSWORD status] Dirty value - value is less than maxlength 
 PASS [INPUT in PASSWORD status] Dirty value - length of value(AAA) in unicode is less than maxlength 
 PASS [INPUT in PASSWORD status] Dirty value - value equals to maxlength 
-FAIL [INPUT in PASSWORD status] Dirty value - length of value is greater than maxlength assert_false: The validity.tooLong should be false. expected false got true
+PASS [INPUT in PASSWORD status] Dirty value - length of value is greater than maxlength 
 PASS [textarea]  Non-dirty value - maxlength is not set 
 PASS [textarea]  Non-dirty value - value is empty string 
 PASS [textarea]  Non-dirty value - length of value is less than maxlength 
@@ -72,6 +72,6 @@
 PASS [textarea]  Dirty value - value is less than maxlength 
 PASS [textarea]  Dirty value - length of value(LF, CRLF) in unicode is less than maxlength 
 PASS [textarea]  Dirty value - length of value equals to maxlength 
-FAIL [textarea]  Dirty value - length of value is greater than maxlength assert_false: The validity.tooLong should be false. expected false got true
+PASS [textarea]  Dirty value - length of value is greater than maxlength 
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooShort-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooShort-expected.txt
index 9ff1802..eb370b2d 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooShort-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-tooShort-expected.txt
@@ -18,7 +18,7 @@
 PASS [INPUT in TEXT status] Dirty value - value is greater than minLength 
 PASS [INPUT in TEXT status] Dirty value - length of value(AAAAA) in unicode is greater than minLength 
 PASS [INPUT in TEXT status] Dirty value - value equals to minLength 
-PASS [INPUT in TEXT status] Dirty value - length of value is less than minLength 
+FAIL [INPUT in TEXT status] Dirty value - length of value is less than minLength assert_true: The validity.tooShort should be true. expected true got false
 PASS [INPUT in SEARCH status] Non-dirty value - minLength is not set 
 PASS [INPUT in SEARCH status] Non-dirty value - value is empty string 
 PASS [INPUT in SEARCH status] Non-dirty value - length of value is greater than minLength 
@@ -27,7 +27,7 @@
 PASS [INPUT in SEARCH status] Dirty value - value is greater than minLength 
 PASS [INPUT in SEARCH status] Dirty value - length of value(AAAAA) in unicode is greater than minLength 
 PASS [INPUT in SEARCH status] Dirty value - value equals to minLength 
-PASS [INPUT in SEARCH status] Dirty value - length of value is less than minLength 
+FAIL [INPUT in SEARCH status] Dirty value - length of value is less than minLength assert_true: The validity.tooShort should be true. expected true got false
 PASS [INPUT in TEL status] Non-dirty value - minLength is not set 
 PASS [INPUT in TEL status] Non-dirty value - value is empty string 
 PASS [INPUT in TEL status] Non-dirty value - length of value is greater than minLength 
@@ -36,7 +36,7 @@
 PASS [INPUT in TEL status] Dirty value - value is greater than minLength 
 PASS [INPUT in TEL status] Dirty value - length of value(AAAAA) in unicode is greater than minLength 
 PASS [INPUT in TEL status] Dirty value - value equals to minLength 
-PASS [INPUT in TEL status] Dirty value - length of value is less than minLength 
+FAIL [INPUT in TEL status] Dirty value - length of value is less than minLength assert_true: The validity.tooShort should be true. expected true got false
 PASS [INPUT in URL status] Non-dirty value - minLength is not set 
 PASS [INPUT in URL status] Non-dirty value - value is empty string 
 PASS [INPUT in URL status] Non-dirty value - length of value is greater than minLength 
@@ -45,7 +45,7 @@
 PASS [INPUT in URL status] Dirty value - value is greater than minLength 
 PASS [INPUT in URL status] Dirty value - length of value(AAAAA) in unicode is greater than minLength 
 PASS [INPUT in URL status] Dirty value - value equals to minLength 
-PASS [INPUT in URL status] Dirty value - length of value is less than minLength 
+FAIL [INPUT in URL status] Dirty value - length of value is less than minLength assert_true: The validity.tooShort should be true. expected true got false
 PASS [INPUT in EMAIL status] Non-dirty value - minLength is not set 
 PASS [INPUT in EMAIL status] Non-dirty value - value is empty string 
 PASS [INPUT in EMAIL status] Non-dirty value - length of value is greater than minLength 
@@ -63,7 +63,7 @@
 PASS [INPUT in PASSWORD status] Dirty value - value is greater than minLength 
 PASS [INPUT in PASSWORD status] Dirty value - length of value(AAAAA) in unicode is greater than minLength 
 PASS [INPUT in PASSWORD status] Dirty value - value equals to minLength 
-PASS [INPUT in PASSWORD status] Dirty value - length of value is less than minLength 
+FAIL [INPUT in PASSWORD status] Dirty value - length of value is less than minLength assert_true: The validity.tooShort should be true. expected true got false
 PASS [textarea]  Non-dirty value - minLength is no set 
 PASS [textarea]  Non-dirty value - value is empty string 
 PASS [textarea]  Non-dirty value - length of value is greater than minLength 
@@ -72,6 +72,6 @@
 PASS [textarea]  Dirty value - value is less than minLength 
 PASS [textarea]  Dirty value - length of value(LF, CRLF) in unicode is less than minLength 
 PASS [textarea]  Dirty value - length of value equals to minLength 
-PASS [textarea]  Dirty value - length of value is greater than minLength 
+FAIL [textarea]  Dirty value - length of value is greater than minLength assert_true: The validity.tooShort should be true. expected true got false
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
index 602abf9..6ba4c133 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt
@@ -1,19 +1,19 @@
 CONSOLE WARNING: The specified value "a" is not a valid email address.
 CONSOLE WARNING: The specified value "abc" is not a valid email address.
 This is a testharness.js-based test.
-PASS [INPUT in TEXT status] validity.valid must be false if validity.tooLong is true 
+FAIL [INPUT in TEXT status] validity.valid must be false if validity.tooLong is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in TEXT status] validity.valid must be false if validity.patternMismatch is true 
 PASS [INPUT in TEXT status] validity.valid must be false if validity.valueMissing is true 
-PASS [INPUT in SEARCH status] validity.valid must be false if validity.tooLong is true 
+FAIL [INPUT in SEARCH status] validity.valid must be false if validity.tooLong is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in SEARCH status] validity.valid must be false if validity.patternMismatch is true 
 PASS [INPUT in SEARCH status] validity.valid must be false if validity.valueMissing is true 
-PASS [INPUT in TEL status] validity.valid must be false if validity.tooLong is true 
+FAIL [INPUT in TEL status] validity.valid must be false if validity.tooLong is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in TEL status] validity.valid must be false if validity.patternMismatch is true 
 PASS [INPUT in TEL status] validity.valid must be false if validity.valueMissing is true 
-PASS [INPUT in PASSWORD status] validity.valid must be false if validity.tooLong is true 
+FAIL [INPUT in PASSWORD status] validity.valid must be false if validity.tooLong is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in PASSWORD status] validity.valid must be false if validity.patternMismatch is true 
 PASS [INPUT in PASSWORD status] validity.valid must be false if validity.valueMissing is true 
-PASS [INPUT in URL status] validity.valid must be false if validity.tooLong is true 
+FAIL [INPUT in URL status] validity.valid must be false if validity.tooLong is true assert_false: The validity.valid should be false. expected false got true
 PASS [INPUT in URL status] validity.valid must be false if validity.patternMismatch is true 
 PASS [INPUT in URL status] validity.valid must be false if validity.typeMismatch is true 
 PASS [INPUT in URL status] validity.valid must be false if validity.valueMissing is true 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/support/validator.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/support/validator.js
index cd9d964..e969ce4 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/support/validator.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/constraints/support/validator.js
@@ -285,30 +285,10 @@
   },
 
   set_dirty: function(ctl) {
-    document.designMode = "on";
     ctl.focus();
     var old_value = ctl.value;
     ctl.value = "a";
     ctl.value = old_value;
-    if (
-      // See https://html.spec.whatwg.org/multipage/#input-type-attr-summary
-      // and https://html.spec.whatwg.org/multipage/#textFieldSelection
-      (
-        ctl.tagName === "INPUT" && (
-          ctl.type === "text" ||
-          ctl.type === "search" ||
-          ctl.type === "tel" ||
-          ctl.type === "url" ||
-          ctl.type === "password"
-        )
-      ) ||
-      ctl.tagName === "TEXTAREA"
-    ) {
-      ctl.value += "1";
-      ctl.setSelectionRange(ctl.value.length - 1, ctl.value.length);
-      document.execCommand("Delete");
-    }
-    document.designMode = "off";
   },
 
   pre_check: function(ctl, item) {
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes-expected.txt
index 53674ae..9fb5a38 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes-expected.txt
@@ -6,6 +6,7 @@
 PASS A non-control follows by a control with same ID. 
 PASS The 'for' attribute is an empty string. 
 PASS A form control has multiple labels. 
+PASS A form control has an implicit label. 
 PASS A form control has no label 1. 
 PASS A form control has no label 2. 
 PASS A label's form attribute should return its form owner. 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.html
index fea872a..55ca767 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/label-attributes.html
@@ -53,6 +53,7 @@
                       "A label element not in a document should not label an element in a document.");
     document.body.appendChild(label);
     assert_equals(label.control, document.getElementById("test1"));
+    label.remove();
   }, "A label element not in a document can not label any element in the document.");
 
   test(function () {
@@ -63,6 +64,7 @@
     document.getElementById("lbl1").insertBefore(input, document.getElementById("test2"));
     assert_equals(document.getElementById("lbl1").control, input,
                   "The first labelable descendant of a label element in tree order should be its labeled control.");
+    input.remove();
   }, "The labeled control for a label element that has no 'for' attribute is the first labelable element which is a descendant of that label element.");
 
   test(function () {
@@ -95,12 +97,19 @@
     document.getElementById("fm").insertBefore(newLabel, document.getElementById("lbl0"));
     assert_array_equals(document.getElementById("test7").labels, [newLabel, document.getElementById("lbl5"), document.getElementById("lbl6")],
                         "The labels for a form control should be returned in tree order.");
+    newLabel.remove();
   }, "A form control has multiple labels.");
 
   test(function () {
+    var labels = document.getElementById("test3").labels;
+    assert_true(labels instanceof NodeList, "A form control's 'labels' property should be an instance of a NodeList.");
+    assert_equals(labels.length, 1, "The form control has an ancestor with no explicit associated label, and is the first labelable descendant.");
+  }, "A form control has an implicit label.");
+
+  test(function () {
     var labels = document.getElementById("test4").labels;
     assert_true(labels instanceof NodeList, "A form control's 'labels' property should be an instance of a NodeList.");
-    assert_equals(labels.length, 0, "The number of labels should be 0 if the associated form control isn't referenced by any <label>.");
+    assert_equals(labels.length, 0, "The form control has an ancestor with no explicit associated label, but is *not* the first labelable descendant");
   }, "A form control has no label 1.");
 
   test(function () {
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements-expected.txt
new file mode 100644
index 0000000..8a91b217
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements-expected.txt
@@ -0,0 +1,29 @@
+This is a testharness.js-based test.
+PASS Check if the output element is a labelable element 
+PASS Check if the output element can access 'labels' 
+PASS Check if the progress element is a labelable element 
+PASS Check if the progress element can access 'labels' 
+PASS Check if the select element is a labelable element 
+PASS Check if the select element can access 'labels' 
+PASS Check if the textarea element is a labelable form-element 
+PASS Check if the textarea element can access 'labels' 
+PASS Check if the button element is a labelable element 
+PASS Check if the button element can access 'labels' 
+PASS Check if the hidden input element is not a labelable element. 
+FAIL Check if the hidden input element can access 'labels' Cannot read property 'length' of null
+PASS Check if the input element in radio state is a labelable element 
+PASS Check if the input element in radio state can access 'labels' 
+PASS Check if the keygen element is a labelable element 
+PASS Check if the keygen element can access 'labels' 
+PASS Check if the meter element is a labelable element 
+PASS Check if the meter element can access 'labels' 
+PASS Check if the fieldset element is not a labelable element 
+PASS Check if the fieldset element can access 'labels' 
+PASS Check if the label element is not a labelable element 
+PASS Check if the label element can access 'labels' 
+PASS Check if the object element is not a labelable element 
+PASS Check if the object element can access 'labels' 
+PASS Check if the img element is not a labelable element 
+PASS Check if the img element can access 'labels' 
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements.html
index 2516484..4624ab81 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-label-element/labelable-elements.html
@@ -36,61 +36,121 @@
 </form>
 
 <script>
+function testLabelsAttr(formElementId, labelElementId, hasLabels) {
+  var elem = document.getElementById(formElementId);
+  if (labelElementId) {
+    assert_equals(elem.labels.length, 1);
+    assert_equals(elem.labels[0].id, labelElementId);
+  } else {
+    assert_equals(elem.labels.length, 0);
+  }
+}
 
 test(function() {
   assert_equals(document.getElementById("lbl0").control.id, "testoutput", "An output element should be labelable.");
 }, "Check if the output element is a labelable element");
 
 test(function() {
+  testLabelsAttr("testoutput", "lbl0");
+}, "Check if the output element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl1").control.id, "testprogress", "A progress element should be labelable.");
 }, "Check if the progress element is a labelable element");
 
 test(function() {
+  testLabelsAttr("testprogress", "lbl1");
+}, "Check if the progress element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl2").control.id, "testselect", "A select element should be labelable.");
 }, "Check if the select element is a labelable element");
 
 test(function() {
+  testLabelsAttr("testselect", "lbl2");
+}, "Check if the select element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl3").control.id, "testarea", "A textarea element should be labelable.");
 }, "Check if the textarea element is a labelable form-element");
 
 test(function() {
+  testLabelsAttr("testarea", "lbl3");
+}, "Check if the textarea element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl4").control.id, "testButton", "A button element should be labelable.");
 }, "Check if the button element is a labelable element");
 
 test(function() {
+  testLabelsAttr("testButton", "lbl4");
+}, "Check if the button element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl5").control, null, "An input element in hidden state should not be labelable.");
 }, "Check if the hidden input element is not a labelable element.");
 
 test(function() {
+  testLabelsAttr("testHidden", null);
+}, "Check if the hidden input element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl6").control.id, "testRadio", "An input  element in radio state should be labelable.");
 }, "Check if the input element in radio state is a labelable element");
 
 test(function() {
+  testLabelsAttr("testRadio", "lbl6");
+}, "Check if the input element in radio state can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl7").control.id, "testkeygen", "A keygen element should be labelable.");
 }, "Check if the keygen element is a labelable element");
 
 test(function() {
+  testLabelsAttr("testkeygen", "lbl7");
+}, "Check if the keygen element can access 'labels'");
+
+test(function() {
   assert_equals(document.getElementById("lbl8").control.id, "testmeter", "A meter element should be labelable.");
 }, "Check if the meter element is a labelable element");
 
 test(function() {
+  testLabelsAttr("testmeter", "lbl8");
+}, "Check if the meter element can access 'labels'");
+
+test(function() {
   assert_not_equals(document.getElementById("lbl9").control, document.getElementById("testfieldset"));
   assert_equals(document.getElementById("lbl9").control, null, "A fieldset element should not be labelable.");
 }, "Check if the fieldset element is not a labelable element");
 
 test(function() {
+  assert_equals(document.getElementById("testfieldset").labels, undefined);
+}, "Check if the fieldset element can access 'labels'");
+
+test(function() {
   assert_not_equals(document.getElementById("lbl9").control, document.getElementById("testlabel"));
   assert_equals(document.getElementById("lbl10").control, null, "A label element should not be labelable.");
 }, "Check if the label element is not a labelable element");
 
 test(function() {
+  assert_equals(document.getElementById("testlabel").labels, undefined);
+}, "Check if the label element can access 'labels'");
+
+test(function() {
   assert_not_equals(document.getElementById("lbl9").control, document.getElementById("testobject"));
   assert_equals(document.getElementById("lbl11").control, null, "An object element should not be labelable.");
 }, "Check if the object element is not a labelable element");
 
 test(function() {
+  assert_equals(document.getElementById("testobject").labels, undefined);
+}, "Check if the object element can access 'labels'");
+
+test(function() {
   assert_not_equals(document.getElementById("lbl9").control, document.getElementById("testimg"));
   assert_equals(document.getElementById("lbl12").control, null, "An img element should not be labelable.");
 }, "Check if the img element is not a labelable element");
 
+test(function() {
+  assert_equals(document.getElementById("lbl9").labels, undefined);
+}, "Check if the img element can access 'labels'");
 </script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem-expected.txt
deleted file mode 100644
index abe5a187..0000000
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem-expected.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-This is a testharness.js-based test.
-PASS if only one item has a *name* or id value matching the parameter, return that object and stop 
-PASS if only one item has a name or *id* value matching the parameter, return that object and stop 
-PASS if no item has a name or id value matching the parameter, return null and stop 
-FAIL return an HTMLOptionsCollection in correct order for repeated 'id' value assert_array_equals: lengths differ, expected 2 got 0
-FAIL return an HTMLOptionsCollection in correct order for repeated 'name' value assert_array_equals: lengths differ, expected 2 got 0
-FAIL return an HTMLOptionsCollection in correct order for repeated mixed value assert_array_equals: lengths differ, expected 2 got 0
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.html
index 7a4092e..dc73dd4c 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.html
@@ -5,6 +5,8 @@
 <title id='title'>HTMLOptionsCollection</title>
 <script src="../../../../../../resources/testharness.js"></script>
 <script src="../../../../../../resources/testharnessreport.js"></script>
+</head>
+<body>
 <div id="log"></div>
 <select id="selly">
   <option id="id1" name="name1">1</option>
@@ -37,26 +39,16 @@
 }, "if no item has a name or id value matching the parameter, return null and stop");
 
 test(function () {
-    var testarr = [];
-    for (var i = 0; i < selly.namedItem('id3').length; i++) {
-        testarr.push(selly.namedItem('id3')[i].text);
-    }
-    assert_array_equals(testarr, ['3','duplicate ID']);
-}, "return an HTMLOptionsCollection in correct order for repeated 'id' value");
+    assert_equals(selly.namedItem('id3')["value"], "3");
+}, "if multiple items have a name or *id* value matching the parameter, return the first object and stop");
 
 test(function () {
-    var testarr = [];
-    for (var i = 0; i < selly.namedItem('name4').length; i++) {
-        testarr.push(selly.namedItem('name4')[i].text);
-    }
-    assert_array_equals(testarr, ['4', 'duplicate name']);
-}, "return an HTMLOptionsCollection in correct order for repeated 'name' value");
+    assert_equals(selly.namedItem('name4')["value"], "4");
+}, "if multiple items have a *name* or id value matching the parameter, return the first object and stop");
 
 test(function () {
-    var testarr = [];
-    for (var i = 0; i < selly.namedItem('mixed1').length; i++) {
-        testarr.push(selly.namedItem('mixed1')[i].text);
-    }
-    assert_array_equals(testarr, ['mixed ID', 'mixed name']);
-}, "return an HTMLOptionsCollection in correct order for repeated mixed value");
+    assert_equals(selly.namedItem('mixed1')["value"], "mixed ID");
+}, "if multiple items have a *name* or *id* value matching the parameter, return the first object and stop");
 </script>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/animation-frames/callback-multicalls.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/animation-frames/callback-multicalls.html
new file mode 100644
index 0000000..91d3f07
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/animation-frames/callback-multicalls.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>AnimationTiming Test: multiple calls to requestAnimationFrame with the same callback</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-window-requestanimationframe">
+<script src="../../../../../resources/testharness.js"></script>
+<script src="../../../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+
+  async_test(function(t) {
+    var counter = 0;
+    window.requestAnimationFrame(callback);
+
+    function callback() {
+      ++counter;
+      if (counter == 2) {
+        t.done();
+      } else {
+        window.requestAnimationFrame(callback);
+      }
+    };
+
+  }, "Check that multiple calls to requestAnimationFrame with the same callback will result in multiple entries being in the list with that same callback.");
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt
index 955759a..831c1db3 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt
@@ -1,26 +1,26 @@
 This is a testharness.js-based test.
-PASS HTMLBodyElement.onblur 
-PASS HTMLBodyElement.onblur 1 
-PASS HTMLBodyElement.onblur 2 
-PASS HTMLBodyElement.onblur 3 
-PASS HTMLBodyElement.onblur 4 
-PASS HTMLBodyElement.onblur 5 
-FAIL HTMLBodyElement.onblur 6 assert_equals: expected (function) function "function f() {
+PASS blur 
+PASS error 
+PASS focus 
+PASS load 
+PASS resize 
+PASS scroll 
+FAIL afterprint assert_equals: expected (function) function "function f() {
   return 0;
 }" but got (undefined) undefined
-FAIL HTMLBodyElement.onblur 7 assert_equals: expected (function) function "function f() {
+FAIL beforeprint assert_equals: expected (function) function "function f() {
   return 0;
 }" but got (undefined) undefined
-PASS HTMLBodyElement.onblur 8 
-PASS HTMLBodyElement.onblur 9 
-PASS HTMLBodyElement.onblur 10 
-PASS HTMLBodyElement.onblur 11 
-PASS HTMLBodyElement.onblur 12 
-PASS HTMLBodyElement.onblur 13 
-PASS HTMLBodyElement.onblur 14 
-PASS HTMLBodyElement.onblur 15 
-PASS HTMLBodyElement.onblur 16 
-PASS HTMLBodyElement.onblur 17 
-PASS HTMLBodyElement.onblur 18 
+PASS beforeunload 
+PASS hashchange 
+PASS languagechange 
+PASS message 
+PASS offline 
+PASS online 
+PASS pagehide 
+PASS pageshow 
+PASS popstate 
+PASS storage 
+PASS unload 
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html
index 04590499..cf8520d 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<title>HTMLBodyElement.onblur</title>
+<title>HTMLBodyElement event handlers</title>
 
 <script src="../../../../../../resources/testharness.js"></script>
 <script src="../../../../../../resources/testharnessreport.js"></script>
@@ -18,7 +18,7 @@
   test(function() {
     document.body['on' + handler] = f;
     assert_equals(window['on' + handler], f);
-  });
+  }, handler);
 });
 
-</script>
\ No newline at end of file
+</script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/document-domain-expected.txt b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/document-domain-expected.txt
new file mode 100644
index 0000000..a11c457c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/document-domain-expected.txt
@@ -0,0 +1,4 @@
+This is a testharness.js-based test.
+FAIL localStorage and document.domain Failed to set the 'domain' property on 'Document': '' is an empty domain.
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/document-domain.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/document-domain.html
new file mode 100644
index 0000000..cccec3b0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/document-domain.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>localStorage and document.domain</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<iframe></iframe>
+<script>
+  async_test(function(t) {
+    frames[0].addEventListener("storage", function(e) {
+      t.step(function() {
+        localStorage.clear()
+        t.done()
+      })
+    })
+    frames[0].document.domain = document.domain
+    localStorage.setItem("test", "test")
+  })
+</script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/eventTestHarness.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/eventTestHarness.js
index 6d1eee9..893d250 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/eventTestHarness.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/eventTestHarness.js
@@ -33,6 +33,20 @@
     setTimeout(onTimeout, 20);
 }
 
+function clearStorage(storageName, callback)
+{
+    if (window[storageName].length === 0) {
+        storageEventList = [];
+        setTimeout(callback, 0);
+    } else {
+        window[storageName].clear();
+        runAfterNStorageEvents(function() {
+            storageEventList = [];
+            callback();
+        }, 1);
+    }
+}
+
 function testStorages(testCallback)
 {
     testCallback("sessionStorage");
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_basic.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_basic.js
index 5dfbe03..fe8446c 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_basic.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_basic.js
@@ -4,15 +4,11 @@
         var storage = window[storageString];
         t.add_cleanup(function() { storage.clear() });
 
-        storageEventList = new Array();
-        storage.clear();
+        clearStorage(storageString, t.step_func(step1));
         assert_equals(storage.length, 0, "storage.length");
 
-        runAfterNStorageEvents(t.step_func(step1), 0);
-
         function step1(msg)
         {
-            storageEventList = new Array();
             storage.setItem('FOO', 'BAR');
 
             runAfterNStorageEvents(t.step_func(step2), 1);
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_body_attribute.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_body_attribute.js
index 8220349..d625635 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_body_attribute.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_body_attribute.js
@@ -4,11 +4,14 @@
         var storage = window[storageString];
         t.add_cleanup(function() { storage.clear() });
 
-        storage.clear();
+        clearStorage(storageString, t.step_func(step0));
         assert_equals(storage.length, 0, "storage.length");
 
-        iframe.onload = t.step_func(step1);
-        iframe.src = "resources/event_body_handler.html";
+        function step0(msg)
+        {
+            iframe.onload = t.step_func(step1);
+            iframe.src = "resources/event_body_handler.html";
+        }
 
         function step1(msg)
         {
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_case_sensitive.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_case_sensitive.js
index 0b7a9b2..2729a3be 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_case_sensitive.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_case_sensitive.js
@@ -4,11 +4,14 @@
         var storage = window[storageString];
         t.add_cleanup(function() { storage.clear() });
 
-        storage.clear();
+        clearStorage(storageString, t.step_func(step0));
         assert_equals(storage.length, 0, "storage.length");
-        storage.foo = "test";
 
-        runAfterNStorageEvents(t.step_func(step1), 1);
+        function step0(msg)
+        {
+            storage.foo = "test";
+            runAfterNStorageEvents(t.step_func(step1), 1);
+        }
 
         function step1(msg)
         {
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_constructor_eventinit.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_constructor_eventinit.html
index 441a5627..738e603 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_constructor_eventinit.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_constructor_eventinit.html
@@ -9,21 +9,18 @@
     <h1>event_Constructor</h1>
     <div id="log"></div>
     <script>
-        test(function() {
-            var t = async_test("StorageEvent constructor and nulls");
+        async_test(function(t) {
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.type, 'storage', 'type');
-                    assert_equals(event.key, null, 'key');
-                    assert_equals(event.oldValue, null, 'oldValue');
-                    assert_equals(event.newValue, null, 'newValue');
-                    assert_equals(event.url, 'null', 'url');
-                    assert_equals(event.storageArea, null, 'storageArea');
-                });
+                assert_equals(event.type, 'storage', 'type');
+                assert_equals(event.key, null, 'key');
+                assert_equals(event.oldValue, null, 'oldValue');
+                assert_equals(event.newValue, null, 'newValue');
+                assert_equals(event.url, 'null', 'url');
+                assert_equals(event.storageArea, null, 'storageArea');
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
             var event = new StorageEvent('storage', {
                 key: null,
                 oldValue: null,
@@ -31,7 +28,7 @@
                 url: null
             });
             window.dispatchEvent(event);
-        }, "Construct StorageEvent with StorageEventInit.");
+        }, "StorageEvent constructor and nulls - Construct StorageEvent with StorageEventInit.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_key.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_key.html
index c0385b3..a6869a71 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_key.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_key.html
@@ -4,40 +4,35 @@
   <title>WebStorage Test: localStorage event - key</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_local_key</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("key property test of local event");
-
-        test(function() {
+        async_test(function(t) {
             localStorage.clear();
+            t.add_cleanup(function() { localStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             var expected = ['name', null]
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.key, expected.shift());
-                });
+                assert_equals(event.key, expected.shift());
                 if (!expected.length) {
                     t.done();
                 }
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/local_set_item_clear_iframe.html');
             document.body.appendChild(el);
-        }, "Local event is fired due to an invocation of the setItem(), clear() methods.");
+        }, "key property test of local event - Local event is fired due to an invocation of the setItem(), clear() methods.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_newvalue.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_newvalue.html
index 3a6bbed..5935ac6 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_newvalue.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_newvalue.html
@@ -4,40 +4,35 @@
   <title>WebStorage Test: localStorage event - newValue</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_local_newValue</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("newValue property test of local event");
-
-        test(function() {
+        async_test(function(t) {
             localStorage.clear();
+            t.add_cleanup(function() { localStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             var expected = ['user1', 'user2', null]
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.newValue, expected.shift());
-                });
+                assert_equals(event.newValue, expected.shift());
                 if (!expected.length) {
                     t.done();
                 }
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/local_change_item_iframe.html');
             document.body.appendChild(el);
-        }, "Local event is fired due to an invocation of the setItem(), clear() methods.");
+        }, "newValue property test of local event - Local event is fired due to an invocation of the setItem(), clear() methods.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_oldvalue.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_oldvalue.html
index 384c6800..a45c4b0 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_oldvalue.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_oldvalue.html
@@ -4,40 +4,35 @@
   <title>WebStorage Test: localStorage event - oldValue</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_local_oldValue</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("oldValue property test of local event");
-
-        test(function() {
+        async_test(function(t) {
             localStorage.clear();
+            t.add_cleanup(function() { localStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             var expected = [null, 'user1', null]
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.oldValue, expected.shift());
-                });
+                assert_equals(event.oldValue, expected.shift());
                 if (!expected.length) {
                     t.done();
                 }
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/local_change_item_iframe.html');
             document.body.appendChild(el);
-        }, "Local event is fired due to an invocation of the setItem(), clear() methods.");
+        }, "oldValue property test of local event - Local event is fired due to an invocation of the setItem(), clear() methods.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_removeitem.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_removeitem.html
index d59cc7a3..9d8070f 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_removeitem.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_removeitem.html
@@ -9,10 +9,11 @@
 
 <script>
 
-var t = async_test("key property test of local event");
-
-t.step(function() {
+async_test(function(t) {
     localStorage.clear();
+    t.add_cleanup(function() { localStorage.clear() });
+
+    self.step = function(f) { t.step(f); };
 
     var event_index = 0;
     window.addEventListener('storage', t.step_func(function(event) {
@@ -39,6 +40,6 @@
     el.setAttribute('id', 'ifrm');
     el.setAttribute('src', 'resources/local_set_item_remove_iframe.html');
     document.body.appendChild(el);
-});
+}, "key property test of local event");
 
 </script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storagearea.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storagearea.html
index 26c4e302..3aefe92 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storagearea.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storagearea.html
@@ -4,41 +4,36 @@
   <title>WebStorage Test: localStorage event - storageArea</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_local_storageArea</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("storageArea property test of local event");
-
-        test(function() {
+        async_test(function(t) {
             localStorage.clear();
+            t.add_cleanup(function() { localStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.storageArea.length, 1);
-                    var key = event.storageArea.key(0);
-                    var value = event.storageArea.getItem(key);
-                    assert_equals(key, "name");
-                    assert_equals(value, "user1");
-                });
+                assert_equals(event.storageArea.length, 1);
+                var key = event.storageArea.key(0);
+                var value = event.storageArea.getItem(key);
+                assert_equals(key, "name");
+                assert_equals(value, "user1");
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/local_set_item_iframe.html');
             document.body.appendChild(el);
-        }, "Local event is fired due to an invocation of the setItem() method.");
+        }, "storageArea property test of local event - Local event is fired due to an invocation of the setItem() method.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storageeventinit.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storageeventinit.html
index 4f964df..fd692fa4 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storageeventinit.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_storageeventinit.html
@@ -9,20 +9,18 @@
     <h1>event_local_StorageEventInit</h1>
     <div id="log"></div>
     <script>
-        test(function() {
-            var t = async_test("storageeventinit test");
+        async_test(function(t) {
+
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.key, 'key');
-                    assert_equals(event.oldValue, 'oldValue');
-                    assert_equals(event.newValue, 'newValue');
-                    assert_equals(event.url, window.location.href);
-                    assert_equals(event.storageArea, window.localStorage);
-                });
+                assert_equals(event.key, 'key');
+                assert_equals(event.oldValue, 'oldValue');
+                assert_equals(event.newValue, 'newValue');
+                assert_equals(event.url, window.location.href);
+                assert_equals(event.storageArea, window.localStorage);
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var event = new StorageEvent('storage', {
                 key: 'key',
@@ -33,7 +31,7 @@
             });
 
             window.dispatchEvent(event);
-        }, "Storage event is fired due to set values for StorageEventInit.");
+        }, "storageeventinit test - Storage event is fired due to set values for StorageEventInit.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_url.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_url.html
index 051e3a55..b8208d5f 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_url.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_local_url.html
@@ -4,45 +4,40 @@
   <title>WebStorage Test: localStorage event - url</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_local_url</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("url property test of local event");
-
-        test(function() {
+        async_test(function(t) {
             localStorage.clear();
+            t.add_cleanup(function() { localStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             function onStorageEvent(event) {
-                t.step(function() {
-                    var url = window.location.href;
+                var url = window.location.href;
 
-                    var pos = url.lastIndexOf("/");
-                    if (pos != -1) {
-                        url = url.substr(0, pos + 1);
-                        url = url + "resources/local_set_item_iframe.html";
-                    }
+                var pos = url.lastIndexOf("/");
+                if (pos != -1) {
+                    url = url.substr(0, pos + 1);
+                    url = url + "resources/local_set_item_iframe.html";
+                }
 
-                   assert_equals(event.url, url);
-                });
+                assert_equals(event.url, url);
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/local_set_item_iframe.html');
             document.body.appendChild(el);
-        }, "Local event is fired due to an invocation of the setItem() method.");
+        }, "url property test of local event - Local event is fired due to an invocation of the setItem() method.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_key.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_key.html
index 233373ba..6e7481f 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_key.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_key.html
@@ -4,40 +4,35 @@
   <title>WebStorage Test: sessionStorage event - key</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_session_key</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("key property test of session event");
-
-        test(function() {
+        async_test(function(t) {
             sessionStorage.clear();
+            t.add_cleanup(function() { sessionStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             var expected = ['name', null]
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.key, expected.shift());
-                });
+                assert_equals(event.key, expected.shift());
                 if (!expected.length) {
                     t.done();
                 }
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/session_set_item_clear_iframe.html');
             document.body.appendChild(el);
-        }, "Session event is fired due to an invocation of the setItem(), clear() methods.");
+        }, "key property test of session event - Session event is fired due to an invocation of the setItem(), clear() methods.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_newvalue.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_newvalue.html
index 80a1591..80908d4 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_newvalue.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_newvalue.html
@@ -4,23 +4,20 @@
   <title>WebStorage Test: sessionStorage event - newValue</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_session_newValue</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("newvalue property test of session event");
-
-        test(function() {
+        async_test(function(t) {
             sessionStorage.clear();
+            t.add_cleanup(function() { sessionStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             var expected = ['user1', 'user2', null]
             function onStorageEvent(event) {
                 t.step(function() {
@@ -31,13 +28,13 @@
                 }
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/session_change_item_iframe.html');
             document.body.appendChild(el);
-        }, "Session event is fired due to an invocation of the setItem(), clear() methods.");
+        }, "newvalue property test of session event - Session event is fired due to an invocation of the setItem(), clear() methods.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_oldvalue.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_oldvalue.html
index 0ec610d..b932f80b 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_oldvalue.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_oldvalue.html
@@ -4,40 +4,35 @@
   <title>WebStorage Test: sessionStorage event - oldValue</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_session_oldValue</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("oldvalue property test of session event");
-
-        test(function() {
+        async_test(function(t) {
             sessionStorage.clear();
+            t.add_cleanup(function() { sessionStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             var expected = [null, 'user1', null]
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.oldValue, expected.shift());
-                });
+                assert_equals(event.oldValue, expected.shift());
                 if (!expected.length) {
                     t.done();
                 }
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/session_change_item_iframe.html');
             document.body.appendChild(el);
-        }, "Session event is fired due to an invocation of the setItem(), clear() methods.");
+        }, "oldvalue property test of session event - Session event is fired due to an invocation of the setItem(), clear() methods.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_removeitem.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_removeitem.html
index c6239cdc..80093ba 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_removeitem.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_removeitem.html
@@ -9,10 +9,11 @@
 
 <script>
 
-var t = async_test("key property test of session event");
-
-t.step(function() {
+async_test(function(t) {
     sessionStorage.clear();
+    t.add_cleanup(function() { sessionStorage.clear() });
+
+    self.step = function(f) { t.step(f); };
 
     var event_index = 0;
     window.addEventListener('storage', t.step_func(function(event) {
@@ -39,5 +40,5 @@
     el.setAttribute('id', 'ifrm');
     el.setAttribute('src', 'resources/session_set_item_remove_iframe.html');
     document.body.appendChild(el);
-});
+}, "key property test of session event");
 </script>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storagearea.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storagearea.html
index c774432..4708bfa6 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storagearea.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storagearea.html
@@ -4,40 +4,36 @@
   <title>WebStorage Test: sessionStorage event - storageArea</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_session_storageArea</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("storageArea property test of session event");
+        async_test(function(t) {
+            sessionStorage.clear();
+            t.add_cleanup(function() { sessionStorage.clear() });
 
-        test(function() {
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.storageArea.length, 1);
-                    var key = event.storageArea.key(0);
-                    var value = event.storageArea.getItem(key);
-                    assert_equals(key, "name");
-                    assert_equals(value, "user1");
-                });
+                assert_equals(event.storageArea.length, 1);
+                var key = event.storageArea.key(0);
+                var value = event.storageArea.getItem(key);
+                assert_equals(key, "name");
+                assert_equals(value, "user1");
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/session_set_item_iframe.html');
             document.body.appendChild(el);
-        }, "Session event is fired due to an invocation of the setItem() method.");
+        }, "storageArea property test of session event - session event is fired due to an invocation of the setItem() method.");
     </script>
 
  </body>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storageeventinit.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storageeventinit.html
index 6803ee3..7e0ecdd 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storageeventinit.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_storageeventinit.html
@@ -9,20 +9,17 @@
     <h1>event_session_StorageEventInit</h1>
     <div id="log"></div>
     <script>
-        test(function() {
-            var t = async_test("storageeventinit test");
+        async_test(function(t) {
             function onStorageEvent(event) {
-                t.step(function() {
-                    assert_equals(event.key, 'key');
-                    assert_equals(event.oldValue, 'oldValue');
-                    assert_equals(event.newValue, 'newValue');
-                    assert_equals(event.url, window.location.href);
-                    assert_equals(event.storageArea, window.sessionStorage);
-                });
+                assert_equals(event.key, 'key');
+                assert_equals(event.oldValue, 'oldValue');
+                assert_equals(event.newValue, 'newValue');
+                assert_equals(event.url, window.location.href);
+                assert_equals(event.storageArea, window.sessionStorage);
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var event = new StorageEvent('storage', {
                 key: 'key',
@@ -33,7 +30,7 @@
             });
 
             window.dispatchEvent(event);
-        }, "Storage event is fired due to set values for StorageEventInit.");
+        }, "storageeventinit test - Storage event is fired due to set values for StorageEventInit.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_url.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_url.html
index b389a6b..d6893e99 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_url.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_session_url.html
@@ -4,45 +4,40 @@
   <title>WebStorage Test: sessionStorage event - url</title>
   <script src="../../../resources/testharness.js"></script>
   <script src="../../../resources/testharnessreport.js"></script>
-  <script>
-      function fail(msg) {
-          t.step(function() {
-              assert_unreached(msg);
-          });
-          t.done();
-      }
-  </script>
  </head>
  <body>
     <h1>event_session_url</h1>
     <div id="log"></div>
     <script>
-        var t = async_test("url property test of session event");
-
-        test(function() {
+        async_test(function(t) {
             sessionStorage.clear();
+            t.add_cleanup(function() { sessionStorage.clear() });
+
+            self.fail = t.step_func(function(msg) {
+                assert_unreached(msg);
+                t.done();
+            });
+
             function onStorageEvent(event) {
-                t.step(function() {
-                    var url = window.location.href;
+                var url = window.location.href;
 
-                    var pos = url.lastIndexOf("/");
-                    if (pos != -1) {
-                        url = url.substr(0, pos + 1);
-                        url = url + "resources/session_set_item_iframe.html";
-                    }
+                var pos = url.lastIndexOf("/");
+                if (pos != -1) {
+                    url = url.substr(0, pos + 1);
+                    url = url + "resources/session_set_item_iframe.html";
+                }
 
-                   assert_equals(event.url, url);
-                });
+                assert_equals(event.url, url);
                 t.done();
             }
 
-            window.addEventListener('storage', onStorageEvent, false);
+            window.addEventListener('storage', t.step_func(onStorageEvent), false);
 
             var el = document.createElement("iframe");
             el.setAttribute('id', 'ifrm');
             el.setAttribute('src', 'resources/session_set_item_iframe.html');
             document.body.appendChild(el);
-        }, "Session event is fired due to an invocation of the setItem() method.");
+        }, "url property test of session event - Session event is fired due to an invocation of the setItem() method.");
     </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_setattribute.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_setattribute.js
index a143cd6..9d8e328 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_setattribute.js
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/event_setattribute.js
@@ -4,16 +4,17 @@
         var storage = window[storageString];
         t.add_cleanup(function() { storage.clear() });
 
-        storageEventList = new Array();
-        storage.clear();
+        clearStorage(storageString, t.step_func(step0));
         assert_equals(storage.length, 0, "storage.length");
 
-        iframe.onload = t.step_func(step1);
-        iframe.src = "resources/event_setattribute_handler.html";
+        function step0(msg)
+        {
+            iframe.onload = t.step_func(step1);
+            iframe.src = "resources/event_setattribute_handler.html";
+        }
 
         function step1(msg)
         {
-            storageEventList = new Array();
             storage.setItem('FOO', 'BAR');
 
             runAfterNStorageEvents(t.step_func(step2), 1);
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/local_set_item_remove_iframe.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/local_set_item_remove_iframe.html
index 7a4962f8..7451594 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/local_set_item_remove_iframe.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/local_set_item_remove_iframe.html
@@ -2,7 +2,7 @@
 <html>
  <body>
     <script>
-        parent.t.step(function() {
+        parent.step(function() {
             localStorage.setItem("name", "user1");
             localStorage.removeItem('name');
         });
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/session_set_item_remove_iframe.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/session_set_item_remove_iframe.html
index d2cad3c..60303e7 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/session_set_item_remove_iframe.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/resources/session_set_item_remove_iframe.html
@@ -2,7 +2,7 @@
 <html>
  <body>
      <script>
-        parent.t.step(function() {
+        parent.step(function() {
             sessionStorage.setItem("name", "user1");
             sessionStorage.removeItem('name');
         });
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/html/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/html/css3-modsel-23-expected.txt
new file mode 100644
index 0000000..a86d1cb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/html/css3-modsel-23-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  LayoutBlockFlow {HTML} at (0,0) size 800x76
+    LayoutBlockFlow {BODY} at (8,16) size 784x44
+      LayoutBlockFlow {P} at (0,0) size 784x44
+        LayoutButton {BUTTON} at (0,0) size 256x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,3) size 240x16
+            LayoutText {#text} at (0,0) size 240x16
+              text run at (0,0) width 240: "A button (enabled) with green background"
+        LayoutText {#text} at (256,1) size 4x19
+          text run at (256,1) width 4: " "
+        LayoutBR {BR} at (0,0) size 0x0
+        LayoutTextControl {INPUT} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,41) size 246x16 scrollWidth 253
+  LayoutBlockFlow {DIV} at (2,3) size 246x16
+    LayoutText {#text} at (0,0) size 253x16
+      text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/html/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/html/css3-modsel-69-expected.txt
new file mode 100644
index 0000000..a86d1cb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/html/css3-modsel-69-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  LayoutBlockFlow {HTML} at (0,0) size 800x76
+    LayoutBlockFlow {BODY} at (8,16) size 784x44
+      LayoutBlockFlow {P} at (0,0) size 784x44
+        LayoutButton {BUTTON} at (0,0) size 256x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,3) size 240x16
+            LayoutText {#text} at (0,0) size 240x16
+              text run at (0,0) width 240: "A button (enabled) with green background"
+        LayoutText {#text} at (256,1) size 4x19
+          text run at (256,1) width 4: " "
+        LayoutBR {BR} at (0,0) size 0x0
+        LayoutTextControl {INPUT} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,41) size 246x16 scrollWidth 253
+  LayoutBlockFlow {DIV} at (2,3) size 246x16
+    LayoutText {#text} at (0,0) size 253x16
+      text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xhtml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xhtml/css3-modsel-23-expected.txt
new file mode 100644
index 0000000..ec4ccd1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xhtml/css3-modsel-23-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  LayoutBlockFlow {html} at (0,0) size 800x76
+    LayoutBlockFlow {body} at (8,16) size 784x44
+      LayoutBlockFlow {p} at (0,0) size 784x44
+        LayoutButton {button} at (0,0) size 256x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,3) size 240x16
+            LayoutText {#text} at (0,0) size 240x16
+              text run at (0,0) width 240: "A button (enabled) with green background"
+        LayoutText {#text} at (256,1) size 4x19
+          text run at (256,1) width 4: " "
+        LayoutBR {br} at (0,0) size 0x0
+        LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,41) size 246x16 scrollWidth 253
+  LayoutBlockFlow {div} at (2,3) size 246x16
+    LayoutText {#text} at (0,0) size 253x16
+      text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xhtml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xhtml/css3-modsel-69-expected.txt
new file mode 100644
index 0000000..ec4ccd1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xhtml/css3-modsel-69-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  LayoutBlockFlow {html} at (0,0) size 800x76
+    LayoutBlockFlow {body} at (8,16) size 784x44
+      LayoutBlockFlow {p} at (0,0) size 784x44
+        LayoutButton {button} at (0,0) size 256x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,3) size 240x16
+            LayoutText {#text} at (0,0) size 240x16
+              text run at (0,0) width 240: "A button (enabled) with green background"
+        LayoutText {#text} at (256,1) size 4x19
+          text run at (256,1) width 4: " "
+        LayoutBR {br} at (0,0) size 0x0
+        LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,41) size 246x16 scrollWidth 253
+  LayoutBlockFlow {div} at (2,3) size 246x16
+    LayoutText {#text} at (0,0) size 253x16
+      text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xml/css3-modsel-23-expected.txt
new file mode 100644
index 0000000..00bc282
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xml/css3-modsel-23-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  LayoutBlockFlow {test} at (0,0) size 800x76
+    LayoutBlockFlow {p} at (0,16) size 800x44
+      LayoutButton {button} at (0,0) size 256x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,3) size 240x16
+          LayoutText {#text} at (0,0) size 240x16
+            text run at (0,0) width 240: "A button (enabled) with green background"
+      LayoutText {#text} at (256,1) size 4x19
+        text run at (256,1) width 4: " "
+      LayoutBR {br} at (0,0) size 0x0
+      LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (0,0) size 0x0
+layer at (2,41) size 246x16 scrollWidth 253
+  LayoutBlockFlow {div} at (2,3) size 246x16
+    LayoutText {#text} at (0,0) size 253x16
+      text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xml/css3-modsel-69-expected.txt
new file mode 100644
index 0000000..00bc282
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/selectors3/xml/css3-modsel-69-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  LayoutBlockFlow {test} at (0,0) size 800x76
+    LayoutBlockFlow {p} at (0,16) size 800x44
+      LayoutButton {button} at (0,0) size 256x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,3) size 240x16
+          LayoutText {#text} at (0,0) size 240x16
+            text run at (0,0) width 240: "A button (enabled) with green background"
+      LayoutText {#text} at (256,1) size 4x19
+        text run at (256,1) width 4: " "
+      LayoutBR {br} at (0,0) size 0x0
+      LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (0,0) size 0x0
+layer at (2,41) size 246x16 scrollWidth 253
+  LayoutBlockFlow {div} at (2,3) size 246x16
+    LayoutText {#text} at (0,0) size 253x16
+      text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/android/editing/input/caret-at-the-edge-of-contenteditable-expected.txt b/third_party/WebKit/LayoutTests/platform/android/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
new file mode 100644
index 0000000..d1e0db28
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x58
+  LayoutBlockFlow {HTML} at (0,0) size 800x58
+    LayoutBlockFlow {BODY} at (8,8) size 784x42
+      LayoutBlockFlow {DIV} at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 783x19
+          text run at (0,0) width 783: "When the caret reaches the edge of the input box or content editable div, on the next input if must jump to the center of the control."
+layer at (8,28) size 82x22 clip at (9,29) size 80x20 scrollX 41.00 scrollWidth 336
+  LayoutBlockFlow {DIV} at (0,20) size 82x22 [border: (1px solid #000000)]
+    LayoutText {#text} at (1,1) size 336x19
+      text run at (1,1) width 336: "012345678901012345678901234567890123456789"
+hidden layer at (8,28) size 8x20
+  LayoutBlockFlow (positioned) {SPAN} at (8,28) size 8x20
+    LayoutText {#text} at (0,0) size 8x19
+      text run at (0,0) width 8: "0"
+caret: position 12 of child 0 {#text} of child 5 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/android/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/android/editing/input/caret-at-the-edge-of-input-expected.txt
new file mode 100644
index 0000000..7d8e43e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x58
+  LayoutBlockFlow {HTML} at (0,0) size 800x58
+    LayoutBlockFlow {BODY} at (8,8) size 784x42
+      LayoutBlockFlow {DIV} at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 646x19
+          text run at (0,0) width 646: "When the caret reaches the edge of the input box, on the next input if must jump to the center of the control."
+      LayoutBlockFlow (anonymous) at (0,20) size 784x22
+        LayoutTextControl {INPUT} at (0,0) size 94x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,31) size 90x16 scrollWidth 294
+  LayoutBlockFlow {DIV} at (2,3) size 90x16
+    LayoutText {#text} at (0,0) size 294x16
+      text run at (0,0) width 294: "012345678901012345678901234567890123456789"
+caret: position 12 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/android/editing/input/editable-container-with-word-wrap-normal-expected.txt b/third_party/WebKit/LayoutTests/platform/android/editing/input/editable-container-with-word-wrap-normal-expected.txt
new file mode 100644
index 0000000..c488536
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/editing/input/editable-container-with-word-wrap-normal-expected.txt
@@ -0,0 +1,19 @@
+Testcase for bug http://www.webkit.org/b/89649. The test case checks if caret is drawn properly (especially scrolls properly) inside a editable container having word-wrap:normal.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+To manually test, move the caret to the end of the line. 
+The content must scroll for the caret to reach the end of the editable text.
+PASS editableContainer.scrollLeft > 0 is true
+
+Final caret rect is calculated by following constraints
+1) ScrollWidth = text content width + caret width
+2) Caret rect is always within container bounding box (thus subtracting the scroll left)
+PASS startCaretRect.left + editableContainer.scrollWidth - editableContainer.scrollLeft is finalCaretRect.right
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/clip/outline-overflowClip-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/clip/outline-overflowClip-expected.txt
new file mode 100644
index 0000000..d4a1341
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/clip/outline-overflowClip-expected.txt
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutText {#text} at (0,0) size 773x19
+        text run at (0,0) width 195: "This tests clipping of the outline. "
+        text run at (195,0) width 275: "It should not be clipped by the overflow rect. "
+        text run at (470,0) width 303: "The inner div has a green outline and a red border."
+      LayoutText {#text} at (0,0) size 0x0
+layer at (8,28) size 304x204 backgroundClip at (83,28) size 229x204 clip at (83,28) size 229x204
+  LayoutBlockFlow (positioned) {DIV} at (8,28) size 304x204 [border: (2px solid #0000FF)]
+    LayoutText {#text} at (2,2) size 93x19
+      text run at (2,2) width 93: "text in outer div"
+    LayoutText {#text} at (0,0) size 0x0
+layer at (60,50) size 97x26 backgroundClip at (83,47) size 77x32 clip at (83,53) size 71x20
+  LayoutBlockFlow (positioned) {DIV} at (52,22) size 97x26 [bgcolor=#EEEEEE] [border: (3px solid #FF0000)]
+    LayoutText {#text} at (3,3) size 91x19
+      text run at (3,3) width 91: "text in inner div"
+      text run at (94,3) width 0: " "
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/css/text-overflow-input-expected.txt
new file mode 100644
index 0000000..c0f970d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/css/text-overflow-input-expected.txt
@@ -0,0 +1,246 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x380
+  LayoutBlockFlow {HTML} at (0,0) size 800x380
+    LayoutBlockFlow {BODY} at (8,16) size 784x348
+      LayoutBlockFlow {P} at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 292x19
+          text run at (0,0) width 292: "This test is a basic check for using text-overflow."
+      LayoutBlockFlow {P} at (0,36) size 784x108
+        LayoutText {#text} at (0,0) size 446x19
+          text run at (0,0) width 446: "Apply \"text-overflow:clip\" to inputs. The following input should be clipped:"
+        LayoutBR {BR} at (446,0) size 0x19
+        LayoutTextControl {INPUT} at (0,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (154,21) size 4x19
+          text run at (154,21) width 4: " "
+        LayoutTextControl {INPUT} at (158,20) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (314,21) size 4x19
+          text run at (314,21) width 4: " "
+        LayoutTextControl {INPUT} at (318,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (472,21) size 4x19
+          text run at (472,21) width 4: " "
+        LayoutTextControl {INPUT} at (476,20) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutTextControl {INPUT} at (0,42) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutBR {BR} at (154,43) size 0x19
+        LayoutTextControl {INPUT} at (0,64) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (154,65) size 4x19
+          text run at (154,65) width 4: " "
+        LayoutTextControl {INPUT} at (158,64) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (314,65) size 4x19
+          text run at (314,65) width 4: " "
+        LayoutTextControl {INPUT} at (318,64) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (472,65) size 4x19
+          text run at (472,65) width 4: " "
+        LayoutTextControl {INPUT} at (476,64) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutTextControl {INPUT} at (0,86) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {P} at (0,160) size 784x108
+        LayoutText {#text} at (0,0) size 494x19
+          text run at (0,0) width 494: "Apply \"text-overflow:ellipsis\" to inputs. The following input should show an ellipsis:"
+        LayoutBR {BR} at (494,0) size 0x19
+        LayoutTextControl {INPUT} at (0,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (154,21) size 4x19
+          text run at (154,21) width 4: " "
+        LayoutTextControl {INPUT} at (158,20) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (314,21) size 4x19
+          text run at (314,21) width 4: " "
+        LayoutTextControl {INPUT} at (318,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (472,21) size 4x19
+          text run at (472,21) width 4: " "
+        LayoutTextControl {INPUT} at (476,20) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutTextControl {INPUT} at (0,42) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutBR {BR} at (154,43) size 0x19
+        LayoutTextControl {INPUT} at (0,64) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (154,65) size 4x19
+          text run at (154,65) width 4: " "
+        LayoutTextControl {INPUT} at (158,64) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (314,65) size 4x19
+          text run at (314,65) width 4: " "
+        LayoutTextControl {INPUT} at (318,64) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (472,65) size 4x19
+          text run at (472,65) width 4: " "
+        LayoutTextControl {INPUT} at (476,64) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (3,3) size 150x16
+            LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+            LayoutBlockFlow {DIV} at (1,0) size 136x16
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutTextControl {INPUT} at (0,86) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {P} at (0,284) size 784x64
+        LayoutText {#text} at (0,0) size 218x19
+          text run at (0,0) width 218: "Dynamic style change text-overflow:"
+        LayoutBR {BR} at (218,0) size 0x19
+        LayoutText {#text} at (0,21) size 223x19
+          text run at (0,21) width 223: "Clip to ellipsis (should show ellipsis): "
+        LayoutTextControl {INPUT} at (223,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (377,21) size 4x19
+          text run at (377,21) width 4: " "
+        LayoutTextControl {INPUT} at (381,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (535,21) size 4x19
+          text run at (535,21) width 4: " "
+        LayoutBR {BR} at (0,0) size 0x0
+        LayoutText {#text} at (0,43) size 244x19
+          text run at (0,43) width 244: "Ellipsis to clip (should not show ellipsis): "
+        LayoutTextControl {INPUT} at (244,42) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (398,43) size 4x19
+          text run at (398,43) width 4: " "
+        LayoutTextControl {INPUT} at (402,42) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (556,43) size 4x19
+          text run at (556,43) width 4: " "
+        LayoutBR {BR} at (0,0) size 0x0
+layer at (10,75) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16 [color=#A9A9A9]
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,75) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+layer at (170,75) size 136x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (4,3) size 136x16 [color=#A9A9A9]
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (170,75) size 136x16
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+layer at (328,75) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (488,75) size 136x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,97) size 150x16 scrollWidth 275
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 275x16
+      text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (10,119) size 150x16 scrollX 167.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16 [color=#A9A9A9]
+    LayoutText {#text} at (-167,0) size 317x16
+      text run at (-167,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,119) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+layer at (170,119) size 136x16 scrollX 181.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (4,3) size 136x16 [color=#A9A9A9]
+    LayoutText {#text} at (-181,0) size 317x16
+      text run at (-181,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (170,119) size 136x16
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+layer at (328,119) size 150x16 scrollX 167.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (-167,0) size 317x16
+      text run at (-167,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (488,119) size 136x16 scrollX 181.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+    LayoutText {#text} at (-181,0) size 317x16
+      text run at (-181,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,141) size 150x16 scrollX 125.00 scrollWidth 275
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (-125,0) size 275x16
+      text run at (-125,0) width 275 RTL: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (10,199) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16 [color=#A9A9A9]
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,199) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+layer at (170,199) size 136x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (4,3) size 136x16 [color=#A9A9A9]
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (170,199) size 136x16
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+layer at (328,199) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (488,199) size 136x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,221) size 150x16 scrollWidth 275
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 275x16
+      text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (10,243) size 150x16 scrollX 167.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16 [color=#A9A9A9]
+    LayoutText {#text} at (-167,0) size 317x16
+      text run at (-167,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,243) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+layer at (170,243) size 136x16 scrollX 181.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (4,3) size 136x16 [color=#A9A9A9]
+    LayoutText {#text} at (-181,0) size 317x16
+      text run at (-181,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (170,243) size 136x16
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+layer at (328,243) size 150x16 scrollX 167.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (-167,0) size 317x16
+      text run at (-167,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (488,243) size 136x16 scrollX 181.00 scrollWidth 317
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+    LayoutText {#text} at (-181,0) size 317x16
+      text run at (-181,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (10,265) size 150x16 scrollX 125.00 scrollWidth 275
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (-125,0) size 275x16
+      text run at (-125,0) width 275 RTL: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (233,323) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16 [color=#A9A9A9]
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (233,323) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+layer at (391,323) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (254,345) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16 [color=#A9A9A9]
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (254,345) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+layer at (412,345) size 150x16 scrollWidth 317
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 317x16
+      text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (307,79) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (625,79) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (307,123) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (625,123) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (307,203) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (625,203) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (307,247) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
+layer at (625,247) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-inputs-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-inputs-expected.txt
new file mode 100644
index 0000000..dbd9563e8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-inputs-expected.txt
@@ -0,0 +1,83 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 470x582
+      LayoutBlockFlow (anonymous) at (0,0) size 470x320
+        LayoutText {#text} at (0,0) size 310x19
+          text run at (0,0) width 310: "This tests basic inputs. Here's what you should see: "
+        LayoutBR {BR} at (310,15) size 0x0
+        LayoutBR {BR} at (0,20) size 0x19
+        LayoutText {#text} at (0,40) size 458x59
+          text run at (0,40) width 400: "first line: the letter \"a\" and then a text input field filled with repeating"
+          text run at (0,60) width 79: "\"foobarbaz\", "
+          text run at (79,60) width 379: "then the word \"text\" followed by a disabled text input field filled"
+          text run at (0,80) width 272: "with \"foo\" and then the letter \"b\" and then \"a\" "
+        LayoutBR {BR} at (272,95) size 0x0
+        LayoutBR {BR} at (0,100) size 0x19
+        LayoutText {#text} at (0,120) size 459x59
+          text run at (0,120) width 441: "second line: and then a password input field that's filled and then the word"
+          text run at (0,140) width 459: "\"password\" and then a disabled password field that's filled and then the letter"
+          text run at (0,160) width 22: "\"b\" "
+        LayoutBR {BR} at (22,175) size 0x0
+        LayoutBR {BR} at (0,180) size 0x19
+        LayoutText {#text} at (0,200) size 426x39
+          text run at (0,200) width 426: "third line: the letter \"a\" and then a checkbox (unchecked) with the word"
+          text run at (0,220) width 338: "\"checkbox\" and then a disabled checkbox and letter \"b\" "
+        LayoutBR {BR} at (338,235) size 0x0
+        LayoutBR {BR} at (0,240) size 0x19
+        LayoutText {#text} at (0,260) size 459x39
+          text run at (0,260) width 453: "fourth line: the last line has the letter \"a\" and then a redio button (unselected)"
+          text run at (0,280) width 459: "and then the word \"radio\" and then a disabled radio button and the letter \"b\" "
+        LayoutBR {BR} at (459,295) size 0x0
+        LayoutBR {BR} at (0,300) size 0x19
+      LayoutBlockFlow {DIV} at (10,330) size 450x46 [border: (1px solid #FF0000)]
+        LayoutText {#text} at (1,2) size 7x19
+          text run at (1,2) width 7: "a"
+        LayoutTextControl {INPUT} at (8,1) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (162,2) size 26x19
+          text run at (162,2) width 26: "text "
+        LayoutTextControl {INPUT} at (188,1) size 154x22 [color=#545454] [bgcolor=#EBEBE4] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (342,2) size 19x19
+          text run at (342,2) width 12: "b "
+          text run at (354,2) width 7: "a"
+        LayoutTextControl {INPUT} at (1,23) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (155,24) size 63x19
+          text run at (155,24) width 63: "password "
+        LayoutTextControl {INPUT} at (218,23) size 154x22 [color=#545454] [bgcolor=#EBEBE4] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (372,24) size 8x19
+          text run at (372,24) width 8: "b"
+      LayoutBlockFlow {DIV} at (10,386) size 450x23 [border: (1px solid #FF0000)]
+        LayoutText {#text} at (1,2) size 7x19
+          text run at (1,2) width 7: "a"
+        LayoutBlockFlow {INPUT} at (12,4) size 13x13
+        LayoutText {#text} at (28,2) size 63x19
+          text run at (28,2) width 63: "checkbox "
+        LayoutBlockFlow {INPUT} at (95,4) size 13x13 [color=#545454]
+        LayoutText {#text} at (111,2) size 8x19
+          text run at (111,2) width 8: "b"
+      LayoutBlockFlow {DIV} at (10,419) size 450x23 [border: (1px solid #FF0000)]
+        LayoutText {#text} at (1,2) size 7x19
+          text run at (1,2) width 7: "a"
+        LayoutBlockFlow {INPUT} at (13,4) size 13x13
+        LayoutText {#text} at (29,2) size 35x19
+          text run at (29,2) width 35: "radio "
+        LayoutBlockFlow {INPUT} at (69,4) size 13x13 [color=#545454]
+        LayoutText {#text} at (85,2) size 8x19
+          text run at (85,2) width 8: "b"
+layer at (28,342) size 150x16 scrollWidth 168
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 168x16
+      text run at (0,0) width 168: "foobarbazfoobarbazfoobarbaz"
+layer at (208,342) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 17x16
+      text run at (0,0) width 17: "foo"
+layer at (21,364) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 15x16
+      text run at (0,0) width 15: "\x{2022}\x{2022}\x{2022}"
+layer at (238,364) size 150x16
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 15x16
+      text run at (0,0) width 15: "\x{2022}\x{2022}\x{2022}"
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/control-restrict-line-height-expected.txt
new file mode 100644
index 0000000..c49cf80
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/control-restrict-line-height-expected.txt
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutText {#text} at (0,0) size 494x19
+        text run at (0,0) width 494: "This tests that we don't honor line-height for controls that have restricted font size. "
+      LayoutBR {BR} at (0,0) size 0x0
+      LayoutMenuList {SELECT} at (0,20) size 319x20 [bgcolor=#C0C0C0] [border: (1px solid #A9A9A9)]
+        LayoutBlockFlow (anonymous) at (1,1) size 317x18
+          LayoutText (anonymous) at (4,1) size 294x16
+            text run at (4,1) width 294: "This text should be centered vertically in the button"
+      LayoutText {#text} at (319,20) size 4x19
+        text run at (319,20) width 4: " "
+      LayoutBR {BR} at (0,0) size 0x0
+      LayoutButton {INPUT} at (0,40) size 310x22 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,3) size 294x16
+          LayoutText {#text} at (0,0) size 294x16
+            text run at (0,0) width 294: "This text should be centered vertically in the button"
+      LayoutText {#text} at (310,41) size 4x19
+        text run at (310,41) width 4: " "
+      LayoutBR {BR} at (0,0) size 0x0
+      LayoutTextControl {INPUT} at (0,62) size 156x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutFlexibleBox {DIV} at (3,3) size 150x16
+          LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+          LayoutBlockFlow {DIV} at (1,0) size 136x16
+      LayoutText {#text} at (0,0) size 0x0
+layer at (12,73) size 136x16 scrollWidth 294
+  LayoutBlockFlow {DIV} at (0,0) size 136x16
+    LayoutText {#text} at (0,0) size 294x16
+      text run at (0,0) width 294: "This text should be centered vertically in the button"
+layer at (149,77) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (138,3.50) size 9x9
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-disabled-color-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-disabled-color-expected.txt
new file mode 100644
index 0000000..1220e416
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-disabled-color-expected.txt
@@ -0,0 +1,177 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutText {#text} at (0,0) size 485x19
+        text run at (0,0) width 485: "This tests that the text color changes appropriately when the text field is disabled."
+      LayoutBR {BR} at (485,15) size 0x0
+      LayoutTextControl {INPUT} at (0,20) size 154x22 [color=#545454] [bgcolor=#EBEBE4] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,21) size 4x19
+        text run at (154,21) width 4: " "
+      LayoutTextControl {INPUT} at (158,20) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,36) size 0x0
+      LayoutTextControl {INPUT} at (0,42) size 154x22 [color=#FF0000] [bgcolor=#EBEBE4] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,43) size 4x19
+        text run at (154,43) width 4: " "
+      LayoutTextControl {INPUT} at (158,42) size 154x22 [color=#FF0000] [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,58) size 0x0
+      LayoutTextControl {INPUT} at (0,64) size 154x22 [color=#545454] [bgcolor=#0000FF] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,65) size 4x19
+        text run at (154,65) width 4: " "
+      LayoutTextControl {INPUT} at (158,64) size 154x22 [bgcolor=#0000FF] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,80) size 0x0
+      LayoutTextControl {INPUT} at (0,86) size 154x22 [color=#FF0000] [bgcolor=#0000FF] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,87) size 4x19
+        text run at (154,87) width 4: " "
+      LayoutTextControl {INPUT} at (158,86) size 154x22 [color=#FF0000] [bgcolor=#0000FF] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,102) size 0x0
+      LayoutTextControl {INPUT} at (0,108) size 154x22 [color=#545454] [bgcolor=#000000] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,109) size 4x19
+        text run at (154,109) width 4: " "
+      LayoutTextControl {INPUT} at (158,108) size 154x22 [bgcolor=#000000] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,124) size 0x0
+      LayoutTextControl {INPUT} at (0,130) size 154x22 [color=#FFFFFF] [bgcolor=#000000] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,131) size 4x19
+        text run at (154,131) width 4: " "
+      LayoutTextControl {INPUT} at (158,130) size 154x22 [color=#FFFFFF] [bgcolor=#000000] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,146) size 0x0
+      LayoutTextControl {INPUT} at (0,152) size 154x22 [color=#545454] [bgcolor=#808080] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,153) size 4x19
+        text run at (154,153) width 4: " "
+      LayoutTextControl {INPUT} at (158,152) size 154x22 [bgcolor=#808080] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,168) size 0x0
+      LayoutTextControl {INPUT} at (0,174) size 154x22 [color=#FFFFFF] [bgcolor=#A9A9A9] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,175) size 4x19
+        text run at (154,175) width 4: " "
+      LayoutTextControl {INPUT} at (158,174) size 154x22 [color=#FFFFFF] [bgcolor=#A9A9A9] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,190) size 0x0
+      LayoutTextControl {INPUT} at (0,196) size 154x22 [color=#808080] [bgcolor=#000000] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,197) size 4x19
+        text run at (154,197) width 4: " "
+      LayoutTextControl {INPUT} at (158,196) size 154x22 [color=#808080] [bgcolor=#000000] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,212) size 0x0
+      LayoutTextControl {INPUT} at (0,218) size 154x22 [color=#FF0000] [bgcolor=#808080] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,219) size 4x19
+        text run at (154,219) width 4: " "
+      LayoutTextControl {INPUT} at (158,218) size 154x22 [color=#FF0000] [bgcolor=#808080] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,234) size 0x0
+      LayoutTextControl {INPUT} at (0,240) size 154x22 [color=#808080] [bgcolor=#FF0000] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,241) size 4x19
+        text run at (154,241) width 4: " "
+      LayoutTextControl {INPUT} at (158,240) size 154x22 [color=#808080] [bgcolor=#FF0000] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,256) size 0x0
+      LayoutTextControl {INPUT} at (0,262) size 154x22 [color=#FF0000] [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,263) size 4x19
+        text run at (154,263) width 4: " "
+      LayoutTextControl {INPUT} at (158,262) size 154x22 [color=#FF0000] [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,278) size 0x0
+      LayoutTextControl {INPUT} at (0,284) size 154x22 [color=#FF0000] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (154,285) size 4x19
+        text run at (154,285) width 4: " "
+      LayoutTextControl {INPUT} at (158,284) size 154x22 [color=#FF0000] [border: (2px inset #EEEEEE)]
+      LayoutBR {BR} at (312,300) size 0x0
+layer at (10,31) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,31) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,53) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,53) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,75) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,75) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,97) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,97) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,119) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,119) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,141) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,141) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,163) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,163) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,185) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,185) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,207) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,207) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,229) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,229) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,251) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,251) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,273) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,273) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
+layer at (10,295) size 150x16 scrollWidth 378
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 378x16
+      text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
+layer at (168,295) size 150x16 scrollWidth 165
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 165x16
+      text run at (0,0) width 165: "This text field is not disabled"
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-scroll-left-on-blur-expected.png
new file mode 100644
index 0000000..8be023ad
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-scroll-left-on-blur-expected.txt
new file mode 100644
index 0000000..532782c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -0,0 +1,31 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x576
+      LayoutBlockFlow (anonymous) at (0,0) size 784x22
+        LayoutTextControl {INPUT} at (0,0) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (154,1) size 4x19
+          text run at (154,1) width 4: " "
+        LayoutTextControl {INPUT} at (158,0) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (312,1) size 4x19
+          text run at (312,1) width 4: " "
+        LayoutTextControl {INPUT} at (316,0) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {P} at (0,38) size 784x40
+        LayoutText {#text} at (0,0) size 740x39
+          text run at (0,0) width 740: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and third"
+          text run at (0,20) width 119: "scrolled to the right."
+layer at (10,11) size 150x16 scrollWidth 337
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 337x16
+      text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
+layer at (168,11) size 150x16 scrollX 187.00 scrollWidth 337
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (-187,0) size 337x16
+      text run at (-187,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
+layer at (326,11) size 150x16 scrollX 187.00 scrollWidth 337
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 337x16
+      text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
+caret: position 66 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 4 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-word-wrap-expected.txt
new file mode 100644
index 0000000..e980121
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-text-word-wrap-expected.txt
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow {P} at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 108x19
+          text run at (0,0) width 108: "This tests that the "
+        LayoutInline {CODE} at (0,0) size 72x16
+          LayoutText {#text} at (108,3) size 72x16
+            text run at (108,3) width 72: "word-wrap"
+        LayoutText {#text} at (180,0) size 284x19
+          text run at (180,0) width 284: " property is ignored for single-line text controls."
+      LayoutBlockFlow (anonymous) at (0,36) size 784x40
+        LayoutTextControl {INPUT} at (0,0) size 154x40 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,56) size 150x16 scrollWidth 280
+  LayoutBlockFlow {DIV} at (2,12) size 150x16
+    LayoutText {#text} at (0,0) size 280x16
+      text run at (0,0) width 280: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-type-text-min-width-expected.txt
new file mode 100644
index 0000000..eeeb737
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/input-type-text-min-width-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutText {#text} at (0,0) size 760x39
+        text run at (0,0) width 760: "This test checks if correct min width is applied to \"input type=text\". To match IE and Firefox, the input field below should show"
+        text run at (0,20) width 547: "\"1987\", with the 7 slightly truncated. See https://bugs.webkit.org/show_bug.cgi?id=15312 ."
+      LayoutBR {BR} at (546,35) size 1x0
+      LayoutTextControl {INPUT} at (0,40) size 40x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (0,0) size 0x0
+layer at (10,51) size 36x16 scrollWidth 42
+  LayoutBlockFlow {DIV} at (2,3) size 36x16
+    LayoutText {#text} at (0,0) size 42x16
+      text run at (0,0) width 42: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/minWidthPercent-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/minWidthPercent-expected.txt
new file mode 100644
index 0000000..c48d035
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/minWidthPercent-expected.txt
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow {DIV} at (0,0) size 116.19x28 [bgcolor=#C3D9FF]
+        LayoutTable {TABLE} at (0,0) size 116x28
+          LayoutTableSection {TBODY} at (0,0) size 116x28
+            LayoutTableRow {TR} at (0,2) size 116x24
+              LayoutTableCell {TD} at (2,2) size 112x24 [r=0 c=0 rs=1 cs=1]
+                LayoutTextControl {INPUT} at (1,1) size 110x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutText {#text} at (0,0) size 0x0
+layer at (13,14) size 106x16 scrollWidth 121
+  LayoutBlockFlow {DIV} at (2,3) size 106x16
+    LayoutText {#text} at (0,0) size 121x16
+      text run at (0,0) width 121: "Should fit in blue box"
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/forms/textfield-outline-expected.txt
new file mode 100644
index 0000000..05d985b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/textfield-outline-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutText {#text} at (0,0) size 522x19
+        text run at (0,0) width 522: "This tests that a negative outline-offset won't get in the way of a cursor in a text control."
+      LayoutBR {BR} at (521,15) size 1x0
+      LayoutTextControl {INPUT} at (0,20) size 227x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+      LayoutText {#text} at (0,0) size 0x0
+layer at (9,30) size 225x24 scrollWidth 535
+  LayoutBlockFlow {DIV} at (1,2) size 225x24
+    LayoutText {#text} at (0,0) size 535x23
+      text run at (0,0) width 535: "abcThis tests that typing doesn't cut holes in the focus outline"
+caret: position 3 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/overflow/overflow-focus-ring-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/overflow/overflow-focus-ring-expected.txt
new file mode 100644
index 0000000..f467dd9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/overflow/overflow-focus-ring-expected.txt
@@ -0,0 +1,48 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow (anonymous) at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 473x19
+          text run at (0,0) width 473: "The focus ring of the following div should not extend beyond the size of the div."
+layer at (8,28) size 500x400 scrollHeight 720
+  LayoutBlockFlow {DIV} at (0,20) size 500x400
+    LayoutText {#text} at (0,0) size 500x719
+      text run at (0,0) width 500: "............................................................................................................................."
+      text run at (0,20) width 500: "............................................................................................................................."
+      text run at (0,40) width 500: "............................................................................................................................."
+      text run at (0,60) width 500: "............................................................................................................................."
+      text run at (0,80) width 500: "............................................................................................................................."
+      text run at (0,100) width 500: "............................................................................................................................."
+      text run at (0,120) width 500: "............................................................................................................................."
+      text run at (0,140) width 500: "............................................................................................................................."
+      text run at (0,160) width 500: "............................................................................................................................."
+      text run at (0,180) width 500: "............................................................................................................................."
+      text run at (0,200) width 500: "............................................................................................................................."
+      text run at (0,220) width 500: "............................................................................................................................."
+      text run at (0,240) width 500: "............................................................................................................................."
+      text run at (0,260) width 500: "............................................................................................................................."
+      text run at (0,280) width 500: "............................................................................................................................."
+      text run at (0,300) width 500: "............................................................................................................................."
+      text run at (0,320) width 500: "............................................................................................................................."
+      text run at (0,340) width 500: "............................................................................................................................."
+      text run at (0,360) width 500: "............................................................................................................................."
+      text run at (0,380) width 500: "............................................................................................................................."
+      text run at (0,400) width 500: "............................................................................................................................."
+      text run at (0,420) width 500: "............................................................................................................................."
+      text run at (0,440) width 500: "............................................................................................................................."
+      text run at (0,460) width 500: "............................................................................................................................."
+      text run at (0,480) width 500: "............................................................................................................................."
+      text run at (0,500) width 500: "............................................................................................................................."
+      text run at (0,520) width 500: "............................................................................................................................."
+      text run at (0,540) width 500: "............................................................................................................................."
+      text run at (0,560) width 500: "............................................................................................................................."
+      text run at (0,580) width 500: "............................................................................................................................."
+      text run at (0,600) width 500: "............................................................................................................................."
+      text run at (0,620) width 500: "............................................................................................................................."
+      text run at (0,640) width 500: "............................................................................................................................."
+      text run at (0,660) width 500: "............................................................................................................................."
+      text run at (0,680) width 500: "............................................................................................................................."
+      text run at (0,700) width 212: "....................................................."
+caret: position 0 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..8a498e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [381, 10, 3, 18],
+        [378, 10, 3, 18]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-searchfield-expected.txt
new file mode 100644
index 0000000..3ae6585
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-searchfield-expected.txt
@@ -0,0 +1,89 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow (anonymous) at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 212x19
+          text run at (0,0) width 212: "These textfields should not overlap."
+      LayoutTable {TABLE} at (0,20) size 784x26
+        LayoutTableSection {TBODY} at (0,0) size 784x26
+          LayoutTableRow {TR} at (0,1) size 784x24
+            LayoutTableCell {TD} at (1,1) size 8x24 [r=0 c=0 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 6x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutFlexibleBox {DIV} at (3,3) size 0x16
+                  LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+                  LayoutBlockFlow {DIV} at (1,0) size 0x16
+            LayoutTableCell {TD} at (10,1) size 8x24 [r=0 c=1 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 6x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutFlexibleBox {DIV} at (3,3) size 0x16
+                  LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+                  LayoutBlockFlow {DIV} at (1,0) size 0x16
+            LayoutTableCell {TD} at (19,1) size 8x24 [r=0 c=2 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 6x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutFlexibleBox {DIV} at (3,3) size 0x16
+                  LayoutBlockFlow {DIV} at (0,2.50) size 1x11
+                  LayoutBlockFlow {DIV} at (1,0) size 0x16
+            LayoutTableCell {TD} at (28,2) size 755x22 [r=0 c=3 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 4x19
+                text run at (1,1) width 4: " "
+      LayoutBlockFlow (anonymous) at (0,46) size 784x40
+        LayoutBR {BR} at (0,0) size 0x19
+        LayoutBR {BR} at (0,20) size 0x19
+      LayoutTable {TABLE} at (0,86) size 784x26
+        LayoutTableSection {TBODY} at (0,0) size 784x26
+          LayoutTableRow {TR} at (0,1) size 784x24
+            LayoutTableCell {TD} at (1,1) size 8x24 [r=0 c=0 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 6x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutFlexibleBox {DIV} at (3,3) size 0x16
+                  LayoutBlockFlow {DIV} at (2,1.50) size 13x13
+                  LayoutBlockFlow {DIV} at (18,0) size 0x16
+            LayoutTableCell {TD} at (10,1) size 8x24 [r=0 c=1 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 6x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutFlexibleBox {DIV} at (3,3) size 0x16
+                  LayoutBlockFlow {DIV} at (2,1.50) size 13x13
+                  LayoutBlockFlow {DIV} at (18,0) size 0x16
+            LayoutTableCell {TD} at (19,1) size 8x24 [r=0 c=2 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 6x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutFlexibleBox {DIV} at (3,3) size 0x16
+                  LayoutBlockFlow {DIV} at (2,1.50) size 13x13
+                  LayoutBlockFlow {DIV} at (18,0) size 0x16
+            LayoutTableCell {TD} at (28,2) size 755x22 [r=0 c=3 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 4x19
+                text run at (1,1) width 4: " "
+layer at (14,33) size 0x16 scrollWidth 53
+  LayoutBlockFlow {DIV} at (0,0) size 0x16
+    LayoutText {#text} at (0,0) size 53x16
+      text run at (0,0) width 53: "New Mail"
+layer at (23,33) size 0x16 scrollWidth 33
+  LayoutBlockFlow {DIV} at (0,0) size 0x16
+    LayoutText {#text} at (0,0) size 33x16
+      text run at (0,0) width 33: "Reply"
+layer at (32,33) size 0x16 scrollWidth 52
+  LayoutBlockFlow {DIV} at (0,0) size 0x16
+    LayoutText {#text} at (0,0) size 52x16
+      text run at (0,0) width 52: "Reply All"
+layer at (31,99) size 0x16 scrollWidth 53
+  LayoutBlockFlow {DIV} at (0,0) size 0x16
+    LayoutText {#text} at (0,0) size 53x16
+      text run at (0,0) width 53: "New Mail"
+layer at (40,99) size 0x16 scrollWidth 33
+  LayoutBlockFlow {DIV} at (0,0) size 0x16
+    LayoutText {#text} at (0,0) size 33x16
+      text run at (0,0) width 33: "Reply"
+layer at (49,99) size 0x16 scrollWidth 52
+  LayoutBlockFlow {DIV} at (0,0) size 0x16
+    LayoutText {#text} at (0,0) size 52x16
+      text run at (0,0) width 52: "Reply All"
+layer at (15,37) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (2,3.50) size 9x9
+layer at (24,37) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (2,3.50) size 9x9
+layer at (33,37) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (2,3.50) size 9x9
+layer at (32,103) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (19,3.50) size 9x9
+layer at (41,103) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (19,3.50) size 9x9
+layer at (50,103) size 9x9 transparent
+  LayoutBlockFlow {DIV} at (19,3.50) size 9x9
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-textfield-expected.txt
new file mode 100644
index 0000000..df18636
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-textfield-expected.txt
@@ -0,0 +1,59 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutBlockFlow (anonymous) at (0,0) size 784x20
+        LayoutText {#text} at (0,0) size 212x19
+          text run at (0,0) width 212: "These textfields should not overlap."
+      LayoutTable {TABLE} at (0,20) size 784x26
+        LayoutTableSection {TBODY} at (0,0) size 784x26
+          LayoutTableRow {TR} at (0,1) size 784x24
+            LayoutTableCell {TD} at (1,1) size 6x24 [r=0 c=0 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 4x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutTableCell {TD} at (8,1) size 6x24 [r=0 c=1 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 4x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutTableCell {TD} at (15,1) size 6x24 [r=0 c=2 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 4x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutTableCell {TD} at (22,2) size 761x22 [r=0 c=3 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 4x19
+                text run at (1,1) width 4: " "
+      LayoutBlockFlow (anonymous) at (0,46) size 784x40
+        LayoutBR {BR} at (0,0) size 0x19
+        LayoutBR {BR} at (0,20) size 0x19
+      LayoutTable {TABLE} at (0,86) size 784x26
+        LayoutTableSection {TBODY} at (0,0) size 784x26
+          LayoutTableRow {TR} at (0,1) size 784x24
+            LayoutTableCell {TD} at (1,1) size 6x24 [r=0 c=0 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 4x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutTableCell {TD} at (8,1) size 6x24 [r=0 c=1 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 4x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutTableCell {TD} at (15,1) size 6x24 [r=0 c=2 rs=1 cs=1]
+              LayoutTextControl {INPUT} at (1,1) size 4x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutTableCell {TD} at (22,2) size 761x22 [r=0 c=3 rs=1 cs=1]
+              LayoutText {#text} at (1,1) size 4x19
+                text run at (1,1) width 4: " "
+layer at (12,33) size 0x16 scrollWidth 53
+  LayoutBlockFlow {DIV} at (2,3) size 0x16
+    LayoutText {#text} at (0,0) size 53x16
+      text run at (0,0) width 53: "New Mail"
+layer at (19,33) size 0x16 scrollWidth 33
+  LayoutBlockFlow {DIV} at (2,3) size 0x16
+    LayoutText {#text} at (0,0) size 33x16
+      text run at (0,0) width 33: "Reply"
+layer at (26,33) size 0x16 scrollWidth 52
+  LayoutBlockFlow {DIV} at (2,3) size 0x16
+    LayoutText {#text} at (0,0) size 52x16
+      text run at (0,0) width 52: "Reply All"
+layer at (12,99) size 0x16 scrollWidth 53
+  LayoutBlockFlow {DIV} at (2,3) size 0x16
+    LayoutText {#text} at (0,0) size 53x16
+      text run at (0,0) width 53: "New Mail"
+layer at (19,99) size 0x16 scrollWidth 33
+  LayoutBlockFlow {DIV} at (2,3) size 0x16
+    LayoutText {#text} at (0,0) size 33x16
+      text run at (0,0) width 33: "Reply"
+layer at (26,99) size 0x16 scrollWidth 52
+  LayoutBlockFlow {DIV} at (2,3) size 0x16
+    LayoutText {#text} at (0,0) size 52x16
+      text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/android/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/android/tables/mozilla/bugs/bug59354-expected.txt
new file mode 100644
index 0000000..2d03fdb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/tables/mozilla/bugs/bug59354-expected.txt
@@ -0,0 +1,60 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutTable {TABLE} at (0,0) size 443x151 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 441x149
+          LayoutTableRow {TR} at (0,0) size 441x149
+            LayoutTableCell {TD} at (0,0) size 441x149 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (1,1) size 439x147 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 437x145
+                  LayoutTableRow {TR} at (0,1) size 437x30
+                    LayoutTableCell {TD} at (1,1) size 132x30 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (5,5) size 122x19
+                        text run at (5,5) width 122: "General Preferences"
+                    LayoutTableCell {TD} at (134,1) size 138x30 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+                      LayoutInline {A} at (0,0) size 128x19 [color=#0000EE]
+                        LayoutText {#text} at (5,5) size 128x19
+                          text run at (5,5) width 128: "Groups / Permissions"
+                    LayoutTableCell {TD} at (273,1) size 70x30 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+                      LayoutInline {A} at (0,0) size 60x19 [color=#0000EE]
+                        LayoutText {#text} at (5,5) size 60x19
+                          text run at (5,5) width 60: "Password"
+                    LayoutTableCell {TD} at (344,1) size 43x30 [border: (1px inset #808080)] [r=0 c=3 rs=1 cs=1]
+                      LayoutInline {A} at (0,0) size 33x19 [color=#0000EE]
+                        LayoutText {#text} at (5,5) size 33x19
+                          text run at (5,5) width 33: "Email"
+                    LayoutTableCell {TD} at (388,1) size 48x30 [border: (1px inset #808080)] [r=0 c=4 rs=1 cs=1]
+                      LayoutText {#text} at (5,5) size 38x19
+                        text run at (5,5) width 38: "Views"
+                  LayoutTableRow {TR} at (0,32) size 437x112
+                    LayoutTableCell {TD} at (1,32) size 435x112 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=5]
+                      LayoutBlockFlow (anonymous) at (5,5) size 425x20
+                        LayoutBR {BR} at (212,0) size 1x19
+                      LayoutTable {TABLE} at (70,25) size 295x82
+                        LayoutTableSection {TBODY} at (0,0) size 295x82
+                          LayoutTableRow {TR} at (0,2) size 295x78
+                            LayoutTableCell {TD} at (2,2) size 291x78 [r=0 c=0 rs=1 cs=1]
+                              LayoutBlockFlow {FORM} at (1,1) size 289x60
+                                LayoutTable {TABLE} at (0,0) size 289x60 [border: (1px outset #808080)]
+                                  LayoutTableSection {TBODY} at (1,1) size 287x58
+                                    LayoutTableRow {TR} at (0,0) size 287x58
+                                      LayoutTableCell {TD} at (0,0) size 287x58 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                                        LayoutBlockFlow (anonymous) at (1,1) size 285x20
+                                          LayoutText {#text} at (90,0) size 105x19
+                                            text run at (90,0) width 105: "User Preferences"
+                                        LayoutTable {TABLE} at (1,21) size 285x36 [border: (1px outset #808080)]
+                                          LayoutTableSection {TBODY} at (1,1) size 283x34
+                                            LayoutTableRow {TR} at (0,1) size 283x32
+                                              LayoutTableCell {TH} at (1,2) size 116x30 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                                                LayoutInline {NOBR} at (0,0) size 106x19
+                                                  LayoutText {#text} at (5,5) size 106x19
+                                                    text run at (5,5) width 106: "Email Address :"
+                                              LayoutTableCell {TD} at (118,1) size 164x32 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+                                                LayoutTextControl {INPUT} at (5,5) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                                                LayoutText {#text} at (0,0) size 0x0
+layer at (213,103) size 150x16 scrollWidth 209
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 209x16
+      text run at (0,0) width 209: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/android/tables/mozilla/bugs/bug96334-expected.txt b/third_party/WebKit/LayoutTests/platform/android/tables/mozilla/bugs/bug96334-expected.txt
new file mode 100644
index 0000000..4b14524
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/tables/mozilla/bugs/bug96334-expected.txt
@@ -0,0 +1,45 @@
+layer at (0,0) size 800x600 scrollWidth 984
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x600
+    LayoutBlockFlow {BODY} at (8,8) size 784x584
+      LayoutTable {TABLE} at (0,0) size 976x148 [border: (2px solid #0000FF)]
+        LayoutTableSection {TBODY} at (2,2) size 972x144
+          LayoutTableRow {TR} at (0,2) size 972x140
+            LayoutTableCell {TD} at (2,2) size 234x140 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (2,2) size 230x136 [border: (2px solid #008000)]
+                LayoutTableSection {TBODY} at (2,2) size 226x132
+                  LayoutTableRow {TR} at (0,2) size 226x90
+                    LayoutTableCell {TD} at (2,2) size 222x90 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+                      LayoutTable {TABLE} at (2,2) size 166x34 [border: (2px solid #FF0000)]
+                        LayoutTableSection {TBODY} at (2,2) size 162x30
+                          LayoutTableRow {TR} at (0,2) size 162x26
+                            LayoutTableCell {TD} at (2,2) size 158x26 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+                              LayoutTextControl {INPUT} at (2,2) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                              LayoutText {#text} at (0,0) size 0x0
+                      LayoutTable {TABLE} at (2,36) size 218x52 [border: (2px solid #FF0000)]
+                        LayoutTableSection {TBODY} at (2,2) size 214x48
+                          LayoutTableRow {TR} at (0,2) size 214x44
+                            LayoutTableCell {TD} at (2,2) size 210x44 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+                              LayoutText {#text} at (2,2) size 187x39
+                                text run at (2,2) width 187: "THIS TABLE NEEDS TO BE"
+                                text run at (2,22) width 39: "HERE"
+                  LayoutTableRow {TR} at (0,94) size 226x36
+                    LayoutTableCell {TD} at (2,94) size 222x36 [border: (1px solid #C0C0C0)] [r=1 c=0 rs=1 cs=1]
+                      LayoutTable {TABLE} at (2,2) size 218x32 [border: (2px solid #FF0000)]
+                        LayoutTableSection {TBODY} at (2,2) size 214x28
+                          LayoutTableRow {TR} at (0,2) size 214x24
+                            LayoutTableCell {TD} at (2,2) size 210x24 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+                              LayoutMenuList {SELECT} at (2,2) size 206x20 [bgcolor=#C0C0C0] [border: (1px solid #A9A9A9)]
+                                LayoutBlockFlow (anonymous) at (1,1) size 204x18
+                                  LayoutText (anonymous) at (4,1) size 181x16
+                                    text run at (4,1) width 181: "USE THIS JAVASCRIPT HERE"
+                              LayoutText {#text} at (0,0) size 0x0
+            LayoutTableCell {TD} at (238,2) size 732x44 [border: (1px solid #C0C0C0)] [r=0 c=1 rs=1 cs=1]
+              LayoutText {#text} at (2,2) size 728x39
+                text run at (2,2) width 728: "KEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLEooKEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLE"
+                text run at (2,22) width 580: "THIS SIMULATES THE PROBLEM ON THE WWW.MAPBLAST.COM/ \"CREATE MAP\""
+layer at (28,29) size 150x16 scrollWidth 155
+  LayoutBlockFlow {DIV} at (2,3) size 150x16
+    LayoutText {#text} at (0,0) size 155x16
+      text run at (0,0) width 155: "THIS NEEDS THIS VALUE"
diff --git a/third_party/WebKit/LayoutTests/platform/android/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/android/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..8a498e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [381, 10, 3, 18],
+        [378, 10, 3, 18]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-23-expected.txt
index a86d1cb..89c859e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-23-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 246x16 scrollWidth 253
+layer at (10,41) size 246x16 scrollWidth 254
   LayoutBlockFlow {DIV} at (2,3) size 246x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-69-expected.txt
index a86d1cb..89c859e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/html/css3-modsel-69-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 246x16 scrollWidth 253
+layer at (10,41) size 246x16 scrollWidth 254
   LayoutBlockFlow {DIV} at (2,3) size 246x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-23-expected.txt
index ec4ccd1..55777ae 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-23-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 246x16 scrollWidth 253
+layer at (10,41) size 246x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 246x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-69-expected.txt
index ec4ccd1..55777ae 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xhtml/css3-modsel-69-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 246x16 scrollWidth 253
+layer at (10,41) size 246x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 246x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-23-expected.txt
index 00bc282..eb5e8bd9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-23-expected.txt
@@ -12,7 +12,7 @@
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (2,41) size 246x16 scrollWidth 253
+layer at (2,41) size 246x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 246x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-69-expected.txt
index 00bc282..eb5e8bd9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/selectors3/xml/css3-modsel-69-expected.txt
@@ -12,7 +12,7 @@
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 250x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (2,41) size 246x16 scrollWidth 253
+layer at (2,41) size 246x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 246x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-contenteditable-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
index d1e0db28..1f75dac 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
@@ -6,7 +6,7 @@
       LayoutBlockFlow {DIV} at (0,0) size 784x20
         LayoutText {#text} at (0,0) size 783x19
           text run at (0,0) width 783: "When the caret reaches the edge of the input box or content editable div, on the next input if must jump to the center of the control."
-layer at (8,28) size 82x22 clip at (9,29) size 80x20 scrollX 41.00 scrollWidth 336
+layer at (8,28) size 82x22 clip at (9,29) size 80x20 scrollX 41.00 scrollWidth 337
   LayoutBlockFlow {DIV} at (0,20) size 82x22 [border: (1px solid #000000)]
     LayoutText {#text} at (1,1) size 336x19
       text run at (1,1) width 336: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-input-expected.txt
index 7d8e43e..3df08d3e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -10,7 +10,7 @@
         LayoutTextControl {INPUT} at (0,0) size 94x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,31) size 90x16 scrollWidth 294
+layer at (10,31) size 90x16 scrollWidth 295
   LayoutBlockFlow {DIV} at (2,3) size 90x16
     LayoutText {#text} at (0,0) size 294x16
       text run at (0,0) width 294: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/clip/outline-overflowClip-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/clip/outline-overflowClip-expected.txt
index d4a1341..1f24edeb9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/clip/outline-overflowClip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/clip/outline-overflowClip-expected.txt
@@ -13,7 +13,7 @@
     LayoutText {#text} at (2,2) size 93x19
       text run at (2,2) width 93: "text in outer div"
     LayoutText {#text} at (0,0) size 0x0
-layer at (60,50) size 97x26 backgroundClip at (83,47) size 77x32 clip at (83,53) size 71x20
+layer at (60,50) size 97x26 backgroundClip at (83,47) size 77x32 clip at (83,53) size 71x20 scrollWidth 92
   LayoutBlockFlow (positioned) {DIV} at (52,22) size 97x26 [bgcolor=#EEEEEE] [border: (3px solid #FF0000)]
     LayoutText {#text} at (3,3) size 91x19
       text run at (3,3) width 91: "text in inner div"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/css/text-overflow-input-expected.txt
index c0f970d..fdc087d 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/css/text-overflow-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/css/text-overflow-input-expected.txt
@@ -124,15 +124,15 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (170,75) size 136x16
   LayoutBlockFlow {DIV} at (0,0) size 136x16
-layer at (328,75) size 150x16 scrollWidth 317
+layer at (328,75) size 150x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (488,75) size 136x16 scrollWidth 317
+layer at (488,75) size 136x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (0,0) size 136x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (10,97) size 150x16 scrollWidth 275
+layer at (10,97) size 150x16 scrollWidth 276
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 275x16
       text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -172,15 +172,15 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (170,199) size 136x16
   LayoutBlockFlow {DIV} at (0,0) size 136x16
-layer at (328,199) size 150x16 scrollWidth 317
+layer at (328,199) size 150x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (488,199) size 136x16 scrollWidth 317
+layer at (488,199) size 136x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (0,0) size 136x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (10,221) size 150x16 scrollWidth 275
+layer at (10,221) size 150x16 scrollWidth 276
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 275x16
       text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -214,7 +214,7 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (233,323) size 150x16
   LayoutBlockFlow {DIV} at (2,3) size 150x16
-layer at (391,323) size 150x16 scrollWidth 317
+layer at (391,323) size 150x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
@@ -224,7 +224,7 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (254,345) size 150x16
   LayoutBlockFlow {DIV} at (2,3) size 150x16
-layer at (412,345) size 150x16 scrollWidth 317
+layer at (412,345) size 150x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-inputs-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-inputs-expected.txt
index dbd9563e8..663f861 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-inputs-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-inputs-expected.txt
@@ -65,7 +65,7 @@
         LayoutBlockFlow {INPUT} at (69,4) size 13x13 [color=#545454]
         LayoutText {#text} at (85,2) size 8x19
           text run at (85,2) width 8: "b"
-layer at (28,342) size 150x16 scrollWidth 168
+layer at (28,342) size 150x16 scrollWidth 169
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 168x16
       text run at (0,0) width 168: "foobarbazfoobarbazfoobarbaz"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/control-restrict-line-height-expected.txt
index c49cf80..a6ec8b3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/control-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/control-restrict-line-height-expected.txt
@@ -25,7 +25,7 @@
           LayoutBlockFlow {DIV} at (0,2.50) size 1x11
           LayoutBlockFlow {DIV} at (1,0) size 136x16
       LayoutText {#text} at (0,0) size 0x0
-layer at (12,73) size 136x16 scrollWidth 294
+layer at (12,73) size 136x16 scrollWidth 295
   LayoutBlockFlow {DIV} at (0,0) size 136x16
     LayoutText {#text} at (0,0) size 294x16
       text run at (0,0) width 294: "This text should be centered vertically in the button"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-disabled-color-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-disabled-color-expected.txt
index 1220e416..80b9be1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-disabled-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-disabled-color-expected.txt
@@ -75,7 +75,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,31) size 150x16 scrollWidth 165
+layer at (168,31) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -83,7 +83,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,53) size 150x16 scrollWidth 165
+layer at (168,53) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -91,7 +91,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,75) size 150x16 scrollWidth 165
+layer at (168,75) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -99,7 +99,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,97) size 150x16 scrollWidth 165
+layer at (168,97) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -107,7 +107,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,119) size 150x16 scrollWidth 165
+layer at (168,119) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -115,7 +115,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,141) size 150x16 scrollWidth 165
+layer at (168,141) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -123,7 +123,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,163) size 150x16 scrollWidth 165
+layer at (168,163) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -131,7 +131,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,185) size 150x16 scrollWidth 165
+layer at (168,185) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -139,7 +139,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,207) size 150x16 scrollWidth 165
+layer at (168,207) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -147,7 +147,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,229) size 150x16 scrollWidth 165
+layer at (168,229) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -155,7 +155,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,251) size 150x16 scrollWidth 165
+layer at (168,251) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -163,7 +163,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,273) size 150x16 scrollWidth 165
+layer at (168,273) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -171,7 +171,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (168,295) size 150x16 scrollWidth 165
+layer at (168,295) size 150x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.png
index 8be023ad..ae773cd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.txt
index 532782c..a82a1e4 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -16,7 +16,7 @@
         LayoutText {#text} at (0,0) size 740x39
           text run at (0,0) width 740: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and third"
           text run at (0,20) width 119: "scrolled to the right."
-layer at (10,11) size 150x16 scrollWidth 337
+layer at (10,11) size 150x16 scrollWidth 338
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 337x16
       text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
@@ -24,7 +24,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (-187,0) size 337x16
       text run at (-187,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
-layer at (326,11) size 150x16 scrollX 187.00 scrollWidth 337
+layer at (326,11) size 150x16 scrollX 188.00 scrollWidth 338
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 337x16
       text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-word-wrap-expected.txt
index e980121..cea8a23 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-word-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-text-word-wrap-expected.txt
@@ -14,7 +14,7 @@
       LayoutBlockFlow (anonymous) at (0,36) size 784x40
         LayoutTextControl {INPUT} at (0,0) size 154x40 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,56) size 150x16 scrollWidth 280
+layer at (10,56) size 150x16 scrollWidth 281
   LayoutBlockFlow {DIV} at (2,12) size 150x16
     LayoutText {#text} at (0,0) size 280x16
       text run at (0,0) width 280: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-type-text-min-width-expected.txt
index eeeb737..c5207c3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-type-text-min-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/input-type-text-min-width-expected.txt
@@ -9,7 +9,7 @@
       LayoutBR {BR} at (546,35) size 1x0
       LayoutTextControl {INPUT} at (0,40) size 40x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (10,51) size 36x16 scrollWidth 42
+layer at (10,51) size 36x16 scrollWidth 43
   LayoutBlockFlow {DIV} at (2,3) size 36x16
     LayoutText {#text} at (0,0) size 42x16
       text run at (0,0) width 42: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/minWidthPercent-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/minWidthPercent-expected.txt
index c48d035..f27918c 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/minWidthPercent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/minWidthPercent-expected.txt
@@ -10,7 +10,7 @@
               LayoutTableCell {TD} at (2,2) size 112x24 [r=0 c=0 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 110x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (0,0) size 0x0
-layer at (13,14) size 106x16 scrollWidth 121
+layer at (13,14) size 106x16 scrollWidth 122
   LayoutBlockFlow {DIV} at (2,3) size 106x16
     LayoutText {#text} at (0,0) size 121x16
       text run at (0,0) width 121: "Should fit in blue box"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textfield-outline-expected.txt
index 05d985b..a07ac05b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textfield-outline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textfield-outline-expected.txt
@@ -8,7 +8,7 @@
       LayoutBR {BR} at (521,15) size 1x0
       LayoutTextControl {INPUT} at (0,20) size 227x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (9,30) size 225x24 scrollWidth 535
+layer at (9,30) size 225x24 scrollWidth 536
   LayoutBlockFlow {DIV} at (1,2) size 225x24
     LayoutText {#text} at (0,0) size 535x23
       text run at (0,0) width 535: "abcThis tests that typing doesn't cut holes in the focus outline"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-focus-ring-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-focus-ring-expected.txt
index f467dd9..d14404d 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-focus-ring-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-focus-ring-expected.txt
@@ -6,7 +6,7 @@
       LayoutBlockFlow (anonymous) at (0,0) size 784x20
         LayoutText {#text} at (0,0) size 473x19
           text run at (0,0) width 473: "The focus ring of the following div should not extend beyond the size of the div."
-layer at (8,28) size 500x400 scrollHeight 720
+layer at (8,28) size 500x400 scrollWidth 501 scrollHeight 720
   LayoutBlockFlow {DIV} at (0,20) size 500x400
     LayoutText {#text} at (0,0) size 500x719
       text run at (0,0) width 500: "............................................................................................................................."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
index 8a498e5..604c6af 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -6,8 +6,8 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [381, 10, 3, 18],
-        [378, 10, 3, 18]
+        [380, 10, 3, 18],
+        [377, 10, 3, 18]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-searchfield-expected.txt
index 3ae6585..bc492e41 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-searchfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-searchfield-expected.txt
@@ -51,27 +51,27 @@
             LayoutTableCell {TD} at (28,2) size 755x22 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x19
                 text run at (1,1) width 4: " "
-layer at (14,33) size 0x16 scrollWidth 53
+layer at (14,33) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (23,33) size 0x16 scrollWidth 33
+layer at (23,33) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (32,33) size 0x16 scrollWidth 52
+layer at (32,33) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
-layer at (31,99) size 0x16 scrollWidth 53
+layer at (31,99) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (40,99) size 0x16 scrollWidth 33
+layer at (40,99) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (49,99) size 0x16 scrollWidth 52
+layer at (49,99) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textfield-expected.txt
index df18636..1065632 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textfield-expected.txt
@@ -33,27 +33,27 @@
             LayoutTableCell {TD} at (22,2) size 761x22 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x19
                 text run at (1,1) width 4: " "
-layer at (12,33) size 0x16 scrollWidth 53
+layer at (12,33) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (19,33) size 0x16 scrollWidth 33
+layer at (19,33) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (26,33) size 0x16 scrollWidth 52
+layer at (26,33) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
-layer at (12,99) size 0x16 scrollWidth 53
+layer at (12,99) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (19,99) size 0x16 scrollWidth 33
+layer at (19,99) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (26,99) size 0x16 scrollWidth 52
+layer at (26,99) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug59354-expected.txt
index 2d03fdb..7978bef1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug59354-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug59354-expected.txt
@@ -54,7 +54,7 @@
                                               LayoutTableCell {TD} at (118,1) size 164x32 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
                                                 LayoutTextControl {INPUT} at (5,5) size 154x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                                                 LayoutText {#text} at (0,0) size 0x0
-layer at (213,103) size 150x16 scrollWidth 209
+layer at (213,103) size 150x16 scrollWidth 210
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 209x16
       text run at (0,0) width 209: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug96334-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug96334-expected.txt
index 4b14524..12ccb7b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug96334-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug96334-expected.txt
@@ -39,7 +39,7 @@
               LayoutText {#text} at (2,2) size 728x39
                 text run at (2,2) width 728: "KEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLEooKEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLE"
                 text run at (2,22) width 580: "THIS SIMULATES THE PROBLEM ON THE WWW.MAPBLAST.COM/ \"CREATE MAP\""
-layer at (28,29) size 150x16 scrollWidth 155
+layer at (28,29) size 150x16 scrollWidth 156
   LayoutBlockFlow {DIV} at (2,3) size 150x16
     LayoutText {#text} at (0,0) size 155x16
       text run at (0,0) width 155: "THIS NEEDS THIS VALUE"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..604c6af
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [380, 10, 3, 18],
+        [377, 10, 3, 18]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/input-text-scroll-left-on-blur-expected.png
index 44a3dd0..917f560 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-23-expected.txt
index bf76587..39ed3e9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-23-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 203x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 197x13 scrollWidth 237
+layer at (11,41) size 197x13 scrollWidth 238
   LayoutBlockFlow {DIV} at (3,3) size 197x13
     LayoutText {#text} at (0,0) size 237x13
       text run at (0,0) width 237: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-69-expected.txt
index bf76587..39ed3e9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/html/css3-modsel-69-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 203x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 197x13 scrollWidth 237
+layer at (11,41) size 197x13 scrollWidth 238
   LayoutBlockFlow {DIV} at (3,3) size 197x13
     LayoutText {#text} at (0,0) size 237x13
       text run at (0,0) width 237: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-23-expected.txt
index 9830251..11f73498 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-23-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 203x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 197x13 scrollWidth 237
+layer at (11,41) size 197x13 scrollWidth 238
   LayoutBlockFlow {div} at (3,3) size 197x13
     LayoutText {#text} at (0,0) size 237x13
       text run at (0,0) width 237: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-69-expected.txt
index 9830251..11f73498 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xhtml/css3-modsel-69-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 203x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 197x13 scrollWidth 237
+layer at (11,41) size 197x13 scrollWidth 238
   LayoutBlockFlow {div} at (3,3) size 197x13
     LayoutText {#text} at (0,0) size 237x13
       text run at (0,0) width 237: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-23-expected.txt
index b508320a..0f16f07d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-23-expected.txt
@@ -12,7 +12,7 @@
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 203x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (3,41) size 197x13 scrollWidth 237
+layer at (3,41) size 197x13 scrollWidth 238
   LayoutBlockFlow {div} at (3,3) size 197x13
     LayoutText {#text} at (0,0) size 237x13
       text run at (0,0) width 237: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-69-expected.txt
index b508320a..0f16f07d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/css3/selectors3/xml/css3-modsel-69-expected.txt
@@ -12,7 +12,7 @@
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 203x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (3,41) size 197x13 scrollWidth 237
+layer at (3,41) size 197x13 scrollWidth 238
   LayoutBlockFlow {div} at (3,3) size 197x13
     LayoutText {#text} at (0,0) size 237x13
       text run at (0,0) width 237: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/input/caret-at-the-edge-of-input-expected.txt
index e72cf93..36f21ece7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/input/caret-at-the-edge-of-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -10,7 +10,7 @@
         LayoutTextControl {INPUT} at (0,0) size 73x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,29) size 67x13 scrollX 37.00 scrollWidth 292
+layer at (11,29) size 67x13 scrollX 37.00 scrollWidth 293
   LayoutBlockFlow {DIV} at (3,3) size 67x13
     LayoutText {#text} at (0,0) size 293x13
       text run at (0,0) width 293: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/drop-text-without-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/drop-text-without-selection-expected.txt
index ee44d79..e7c7dd59 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/drop-text-without-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/drop-text-without-selection-expected.txt
@@ -33,7 +33,7 @@
             text run at (127,0) width 166: "drop me into the text field"
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,107) size 117x13 scrollWidth 118
+layer at (11,107) size 117x13 scrollWidth 119
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 119x13
       text run at (0,0) width 119: "http://www.ibm.com/"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/input-search-padding-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/input-search-padding-expected.txt
index 0dfffa4..c2801d6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/input-search-padding-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/input-search-padding-expected.txt
@@ -14,7 +14,7 @@
         LayoutFlexibleBox {DIV} at (6,1) size 210x23
           LayoutBlockFlow {DIV} at (0,11.50) size 6x0
           LayoutBlockFlow {DIV} at (6,0) size 189x23
-layer at (17,11) size 400x47 scrollWidth 408
+layer at (17,11) size 400x47 scrollWidth 409
   LayoutBlockFlow {DIV} at (0,0) size 400x47
     LayoutText {#text} at (0,0) size 408x47
       text run at (0,0) width 408: "value jgq not clipped"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/text-overflow-input-expected.txt
index 341a199c..9fcd0bcb 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/text-overflow-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/css/text-overflow-input-expected.txt
@@ -128,15 +128,15 @@
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (144,71) size 100x13
   LayoutBlockFlow {DIV} at (0,0) size 100x13
-layer at (267,71) size 117x13 scrollWidth 295
+layer at (267,71) size 117x13 scrollWidth 296
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 296x13
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (400,71) size 100x13 scrollWidth 295
+layer at (400,71) size 100x13 scrollWidth 296
   LayoutBlockFlow {DIV} at (0,0) size 100x13
     LayoutText {#text} at (0,0) size 296x13
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (523,71) size 117x13 scrollWidth 339
+layer at (523,71) size 117x13 scrollWidth 340
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 340x13
       text run at (0,0) width 340: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -176,15 +176,15 @@
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (144,143) size 100x13
   LayoutBlockFlow {DIV} at (0,0) size 100x13
-layer at (267,143) size 117x13 scrollWidth 295
+layer at (267,143) size 117x13 scrollWidth 296
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 296x13
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (400,143) size 100x13 scrollWidth 295
+layer at (400,143) size 100x13 scrollWidth 296
   LayoutBlockFlow {DIV} at (0,0) size 100x13
     LayoutText {#text} at (0,0) size 296x13
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (523,143) size 117x13 scrollWidth 339
+layer at (523,143) size 117x13 scrollWidth 340
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 340x13
       text run at (0,0) width 340: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -218,7 +218,7 @@
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (257,215) size 117x13
   LayoutBlockFlow {DIV} at (3,3) size 117x13
-layer at (384,215) size 117x13 scrollWidth 295
+layer at (384,215) size 117x13 scrollWidth 296
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 296x13
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
@@ -228,7 +228,7 @@
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (281,234) size 117x13
   LayoutBlockFlow {DIV} at (3,3) size 117x13
-layer at (408,234) size 117x13 scrollWidth 295
+layer at (408,234) size 117x13 scrollWidth 296
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 296x13
       text run at (0,0) width 296: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/events/autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/events/autoscroll-expected.txt
index dc203af..85d6304e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/events/autoscroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/events/autoscroll-expected.txt
@@ -22,7 +22,7 @@
       LayoutBlockFlow {P} at (0,3121) size 769x18
         LayoutText {#text} at (0,0) size 411x18
           text run at (0,0) width 411: "If the bug does not occur, you'll be left down here at the bottom."
-layer at (11,3097) size 117x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 125
+layer at (11,3097) size 117x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 126
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 126x13
       text run at (0,0) width 126: "select some of this text"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/basic-inputs-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/basic-inputs-expected.txt
index bc7c0c09..df855325 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/basic-inputs-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/basic-inputs-expected.txt
@@ -66,7 +66,7 @@
         LayoutBlockFlow {INPUT} at (65.69,4) size 12x13 [color=#545454]
         LayoutText {#text} at (80,1) size 9x18
           text run at (80,1) width 9: "b"
-layer at (29,328) size 117x13 scrollWidth 163
+layer at (29,328) size 117x13 scrollWidth 164
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 164x13
       text run at (0,0) width 164: "foobarbazfoobarbazfoobarbaz"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/control-restrict-line-height-expected.txt
index 1728267b..3c148e0d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/control-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/control-restrict-line-height-expected.txt
@@ -25,7 +25,7 @@
           LayoutBlockFlow {DIV} at (0,6.50) size 5x0
           LayoutBlockFlow {DIV} at (5,0) size 100x13
       LayoutText {#text} at (0,0) size 0x0
-layer at (17,67) size 100x13 scrollWidth 277
+layer at (17,67) size 100x13 scrollWidth 278
   LayoutBlockFlow {DIV} at (0,0) size 100x13
     LayoutText {#text} at (0,0) size 278x13
       text run at (0,0) width 278: "This text should be centered vertically in the button"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-preventDefault-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-preventDefault-expected.txt
index 4a69f2f..4967ca9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-preventDefault-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-preventDefault-expected.txt
@@ -10,7 +10,7 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (10,50) size 123x19
   LayoutTextControl (positioned) {INPUT} at (10,50) size 123x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-layer at (13,53) size 117x13 scrollWidth 128
+layer at (13,53) size 117x13 scrollWidth 129
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 128x13
       text run at (0,0) width 128: "No caret should be here"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-selection-expected.txt
index aadc3cc..64d10a7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-appearance-selection-expected.txt
@@ -74,7 +74,7 @@
           text run at (0,468) width 48: "Passed."
         LayoutBR {BR} at (47,482) size 1x0
       LayoutBlockFlow {P} at (0,571) size 784x0
-layer at (11,45) size 117x13 scrollWidth 130
+layer at (11,45) size 117x13 scrollWidth 131
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 131x13
       text run at (0,0) width 131: "123456789 ABCDEFGHIJ"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-disabled-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-disabled-color-expected.txt
index 1eb24e38..8ea65f2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-disabled-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-disabled-color-expected.txt
@@ -75,7 +75,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,29) size 117x13 scrollWidth 156
+layer at (138,29) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -83,7 +83,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,48) size 117x13 scrollWidth 156
+layer at (138,48) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -91,7 +91,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,67) size 117x13 scrollWidth 156
+layer at (138,67) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -99,7 +99,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,86) size 117x13 scrollWidth 156
+layer at (138,86) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -107,7 +107,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,105) size 117x13 scrollWidth 156
+layer at (138,105) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -115,7 +115,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,124) size 117x13 scrollWidth 156
+layer at (138,124) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -123,7 +123,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,143) size 117x13 scrollWidth 156
+layer at (138,143) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -131,7 +131,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,162) size 117x13 scrollWidth 156
+layer at (138,162) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -139,7 +139,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,181) size 117x13 scrollWidth 156
+layer at (138,181) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -147,7 +147,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,200) size 117x13 scrollWidth 156
+layer at (138,200) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -155,7 +155,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,219) size 117x13 scrollWidth 156
+layer at (138,219) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -163,7 +163,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,238) size 117x13 scrollWidth 156
+layer at (138,238) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
@@ -171,7 +171,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 354x13
       text run at (0,0) width 354: "The text in this disabled field should displayed as dimmed or grey"
-layer at (138,257) size 117x13 scrollWidth 156
+layer at (138,257) size 117x13 scrollWidth 157
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 156x13
       text run at (0,0) width 156: "This text field is not disabled"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-drag-down-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-drag-down-expected.txt
index e73a8ca..b1de957 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-drag-down-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-drag-down-expected.txt
@@ -9,7 +9,7 @@
       LayoutBlockFlow {P} at (0,35) size 784x18
         LayoutText {#text} at (0,0) size 748x18
           text run at (0,0) width 748: "Tests drag-selecting down. If the test succeeds, the text from the center to the end of the text field should be selected."
-layer at (11,11) size 117x13 scrollWidth 123
+layer at (11,11) size 117x13 scrollWidth 124
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 124x13
       text run at (0,0) width 124: "This is a bunch of text."
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.png
index 99a2a61..41c4367 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.txt
index 6bd260c..5afe034 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -16,7 +16,7 @@
         LayoutText {#text} at (0,0) size 765x36
           text run at (0,0) width 765: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and"
           text run at (0,18) width 164: "third scrolled to the right."
-layer at (11,11) size 117x13 scrollWidth 316
+layer at (11,11) size 117x13 scrollWidth 317
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 317x13
       text run at (0,0) width 317: "this text field has a lot of text in it so that it needs to scroll"
@@ -24,7 +24,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (-199,0) size 317x13
       text run at (-199,0) width 316: "this text field has a lot of text in it so that it needs to scroll"
-layer at (265,11) size 117x13 scrollX 199.00 scrollWidth 316
+layer at (265,11) size 117x13 scrollX 200.00 scrollWidth 317
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 317x13
       text run at (0,0) width 317: "this text field has a lot of text in it so that it needs to scroll"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-word-wrap-expected.txt
index ac3a184..f2f1cc9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-word-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-text-word-wrap-expected.txt
@@ -14,7 +14,7 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x33
         LayoutTextControl {INPUT} at (0,0) size 123x33 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,52) size 117x13 scrollWidth 262
+layer at (11,52) size 117x13 scrollWidth 263
   LayoutBlockFlow {DIV} at (3,10) size 117x13
     LayoutText {#text} at (0,0) size 263x13
       text run at (0,0) width 263: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-type-text-min-width-expected.txt
index 313a08b..22b32d7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-type-text-min-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/input-type-text-min-width-expected.txt
@@ -9,7 +9,7 @@
       LayoutBR {BR} at (623,32) size 1x0
       LayoutTextControl {INPUT} at (0,36) size 28x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (11,47) size 22x13 scrollWidth 42
+layer at (11,47) size 22x13 scrollWidth 43
   LayoutBlockFlow {DIV} at (3,3) size 22x13
     LayoutText {#text} at (0,0) size 42x13
       text run at (0,0) width 42: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/minWidthPercent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/minWidthPercent-expected.txt
index 5b84f25..923b4e3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/minWidthPercent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/minWidthPercent-expected.txt
@@ -10,7 +10,7 @@
               LayoutTableCell {TD} at (2,2) size 115x21 [r=0 c=0 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 113x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (0,0) size 0x0
-layer at (14,14) size 107x13 scrollWidth 115
+layer at (14,14) size 107x13 scrollWidth 116
   LayoutBlockFlow {DIV} at (3,3) size 107x13
     LayoutText {#text} at (0,0) size 116x13
       text run at (0,0) width 116: "Should fit in blue box"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/tabbing-input-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/tabbing-input-iframe-expected.txt
index 84fbca6a..bfbb2ad 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/tabbing-input-iframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/tabbing-input-iframe-expected.txt
@@ -22,7 +22,7 @@
     layer at (0,0) size 300x150
       LayoutBlockFlow {HTML} at (0,0) size 300x150
         LayoutBlockFlow {BODY} at (8,8) size 284x134
-layer at (444,167) size 117x13 scrollWidth 123
+layer at (444,167) size 117x13 scrollWidth 124
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 123x13
       text run at (0,0) width 123: "This should have focus"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textfield-outline-expected.txt
index 89c46ad..07a29e3d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textfield-outline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textfield-outline-expected.txt
@@ -8,7 +8,7 @@
       LayoutBR {BR} at (562,14) size 1x0
       LayoutTextControl {INPUT} at (0,18) size 214x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (10,28) size 210x23 scrollWidth 606
+layer at (10,28) size 210x23 scrollWidth 607
   LayoutBlockFlow {DIV} at (2,2) size 210x23
     LayoutText {#text} at (0,0) size 606x23
       text run at (0,0) width 606: "abcThis tests that typing doesn't cut holes in the focus outline"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
index be036f0..25d7eb1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -6,8 +6,8 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [407, 10, 4, 15],
-        [404, 10, 4, 15]
+        [406, 10, 4, 15],
+        [403, 10, 4, 15]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-searchfield-expected.txt
index 9748d9c..ca924de 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-searchfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-searchfield-expected.txt
@@ -51,27 +51,27 @@
             LayoutTableCell {TD} at (34,1) size 749x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (19,31) size 0x13 scrollWidth 48
+layer at (19,31) size 0x13 scrollWidth 49
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 49x13
       text run at (0,0) width 49: "New Mail"
-layer at (30,31) size 0x13 scrollWidth 29
+layer at (30,31) size 0x13 scrollWidth 30
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (41,31) size 0x13 scrollWidth 46
+layer at (41,31) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "Reply All"
-layer at (30,90) size 0x13 scrollWidth 48
+layer at (30,90) size 0x13 scrollWidth 49
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 49x13
       text run at (0,0) width 49: "New Mail"
-layer at (41,90) size 0x13 scrollWidth 29
+layer at (41,90) size 0x13 scrollWidth 30
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (52,90) size 0x13 scrollWidth 46
+layer at (52,90) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-textfield-expected.txt
index abf0e63..8724f71 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-textfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/replaced/width100percent-textfield-expected.txt
@@ -33,27 +33,27 @@
             LayoutTableCell {TD} at (28,1) size 755x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (13,31) size 0x13 scrollWidth 48
+layer at (13,31) size 0x13 scrollWidth 49
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 49x13
       text run at (0,0) width 49: "New Mail"
-layer at (22,31) size 0x13 scrollWidth 29
+layer at (22,31) size 0x13 scrollWidth 30
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (31,31) size 0x13 scrollWidth 46
+layer at (31,31) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "Reply All"
-layer at (13,90) size 0x13 scrollWidth 48
+layer at (13,90) size 0x13 scrollWidth 49
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 49x13
       text run at (0,0) width 49: "New Mail"
-layer at (22,90) size 0x13 scrollWidth 29
+layer at (22,90) size 0x13 scrollWidth 30
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (31,90) size 0x13 scrollWidth 46
+layer at (31,90) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug59354-expected.txt
index 492fb6d..aa02099b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug59354-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug59354-expected.txt
@@ -54,7 +54,7 @@
                                               LayoutTableCell {TD} at (122,1) size 133x29 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
                                                 LayoutTextControl {INPUT} at (5,5) size 123x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                                                 LayoutText {#text} at (0,0) size 0x0
-layer at (245,97) size 117x13 scrollWidth 195
+layer at (245,97) size 117x13 scrollWidth 196
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 196x13
       text run at (0,0) width 196: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug96334-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug96334-expected.txt
index 57bdd4b..de57bc8b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug96334-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug96334-expected.txt
@@ -39,7 +39,7 @@
               LayoutText {#text} at (2,2) size 752x36
                 text run at (2,2) width 752: "KEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLEooKEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLE"
                 text run at (2,20) width 602: "THIS SIMULATES THE PROBLEM ON THE WWW.MAPBLAST.COM/ \"CREATE MAP\""
-layer at (29,29) size 117x13 scrollWidth 127
+layer at (29,29) size 117x13 scrollWidth 128
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 128x13
       text run at (0,0) width 128: "THIS NEEDS THIS VALUE"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/pointerevent/fast/events/autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/pointerevent/fast/events/autoscroll-expected.txt
index dc203af..85d6304e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/pointerevent/fast/events/autoscroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/pointerevent/fast/events/autoscroll-expected.txt
@@ -22,7 +22,7 @@
       LayoutBlockFlow {P} at (0,3121) size 769x18
         LayoutText {#text} at (0,0) size 411x18
           text run at (0,0) width 411: "If the bug does not occur, you'll be left down here at the bottom."
-layer at (11,3097) size 117x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 125
+layer at (11,3097) size 117x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 126
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 126x13
       text run at (0,0) width 126: "select some of this text"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..25d7eb1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [406, 10, 4, 15],
+        [403, 10, 4, 15]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt
index dc203af..85d6304e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt
@@ -22,7 +22,7 @@
       LayoutBlockFlow {P} at (0,3121) size 769x18
         LayoutText {#text} at (0,0) size 411x18
           text run at (0,0) width 411: "If the bug does not occur, you'll be left down here at the bottom."
-layer at (11,3097) size 117x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 125
+layer at (11,3097) size 117x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 126
   LayoutBlockFlow {DIV} at (3,3) size 117x13
     LayoutText {#text} at (0,0) size 126x13
       text run at (0,0) width 126: "select some of this text"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/input-text-scroll-left-on-blur-expected.png
index 0659ed6..3304f70 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/scrollbar-parts-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/scrollbar-parts-expected.txt
deleted file mode 100644
index 2a23159e..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/scrollbar-parts-expected.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "repaintRects": [
-        [93, 8, 15, 55],
-        [8, 93, 55, 15]
-      ],
-      "paintInvalidationClients": [
-        "VerticalScrollbar",
-        "HorizontalScrollbar"
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-contenteditable-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
index d18bed8..de95b159 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
@@ -7,7 +7,7 @@
         LayoutText {#text} at (0,0) size 761x36
           text run at (0,0) width 761: "When the caret reaches the edge of the input box or content editable div, on the next input if must jump to the center of"
           text run at (0,18) width 73: "the control."
-layer at (8,44) size 82x20 clip at (9,45) size 80x18 scrollX 41.00 scrollWidth 336
+layer at (8,44) size 82x20 clip at (9,45) size 80x18 scrollX 41.00 scrollWidth 337
   LayoutBlockFlow {DIV} at (0,36) size 82x20 [border: (1px solid #000000)]
     LayoutText {#text} at (1,1) size 336x18
       text run at (1,1) width 336: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt
index 010473a6..fd2f942 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -10,7 +10,7 @@
         LayoutTextControl {INPUT} at (0,0) size 71x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,29) size 65x13 scrollX 36.00 scrollWidth 261
+layer at (11,29) size 65x13 scrollX 36.00 scrollWidth 262
   LayoutBlockFlow {DIV} at (3,3) size 65x13
     LayoutText {#text} at (0,0) size 262x13
       text run at (0,0) width 262: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/clip/outline-overflowClip-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/clip/outline-overflowClip-expected.txt
index 669e05f..ad217942 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/clip/outline-overflowClip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/clip/outline-overflowClip-expected.txt
@@ -14,7 +14,7 @@
     LayoutText {#text} at (2,2) size 102x18
       text run at (2,2) width 102: "text in outer div"
     LayoutText {#text} at (0,0) size 0x0
-layer at (60,64) size 108x24 backgroundClip at (83,61) size 88x30 clip at (83,67) size 82x18
+layer at (60,64) size 108x24 backgroundClip at (83,61) size 88x30 clip at (83,67) size 82x18 scrollWidth 103
   LayoutBlockFlow (positioned) {DIV} at (52,20) size 107.77x24 [bgcolor=#EEEEEE] [border: (3px solid #FF0000)]
     LayoutText {#text} at (3,3) size 102x18
       text run at (3,3) width 102: "text in inner div"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt
index 8ad40cd2..223250f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt
@@ -128,15 +128,15 @@
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (152,71) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-layer at (283,71) size 125x13 scrollWidth 274
+layer at (283,71) size 125x13 scrollWidth 275
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 274x13
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (424,71) size 108x13 scrollWidth 274
+layer at (424,71) size 108x13 scrollWidth 275
   LayoutBlockFlow {DIV} at (0,0) size 108x13
     LayoutText {#text} at (0,0) size 274x13
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (555,71) size 125x13 scrollWidth 344
+layer at (555,71) size 125x13 scrollWidth 345
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 345x13
       text run at (0,0) width 345: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -176,15 +176,15 @@
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (152,143) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-layer at (283,143) size 125x13 scrollWidth 274
+layer at (283,143) size 125x13 scrollWidth 275
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 274x13
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (424,143) size 108x13 scrollWidth 274
+layer at (424,143) size 108x13 scrollWidth 275
   LayoutBlockFlow {DIV} at (0,0) size 108x13
     LayoutText {#text} at (0,0) size 274x13
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (555,143) size 125x13 scrollWidth 344
+layer at (555,143) size 125x13 scrollWidth 345
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 345x13
       text run at (0,0) width 345: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -218,7 +218,7 @@
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (257,215) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (392,215) size 125x13 scrollWidth 274
+layer at (392,215) size 125x13 scrollWidth 275
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 274x13
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
@@ -228,7 +228,7 @@
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (281,234) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (416,234) size 125x13 scrollWidth 274
+layer at (416,234) size 125x13 scrollWidth 275
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 274x13
       text run at (0,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt
index 7cb0af94..dd20b3f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt
@@ -66,7 +66,7 @@
         LayoutBlockFlow {INPUT} at (65.59,4) size 12x13 [color=#545454]
         LayoutText {#text} at (80,1) size 9x18
           text run at (80,1) width 9: "b"
-layer at (29,328) size 125x13 scrollWidth 151
+layer at (29,328) size 125x13 scrollWidth 152
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 152x13
       text run at (0,0) width 152: "foobarbazfoobarbazfoobarbaz"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
index d7b31b7..4e046cde 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
@@ -25,7 +25,7 @@
           LayoutBlockFlow {DIV} at (0,6.50) size 5x0
           LayoutBlockFlow {DIV} at (5,0) size 108x13
       LayoutText {#text} at (0,0) size 0x0
-layer at (17,67) size 108x13 scrollWidth 255
+layer at (17,67) size 108x13 scrollWidth 256
   LayoutBlockFlow {DIV} at (0,0) size 108x13
     LayoutText {#text} at (0,0) size 256x13
       text run at (0,0) width 256: "This text should be centered vertically in the button"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt
index c6f5f73e..7161f30 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt
@@ -74,7 +74,7 @@
           text run at (0,468) width 48: "Passed."
         LayoutBR {BR} at (47,482) size 1x0
       LayoutBlockFlow {P} at (0,571) size 784x0
-layer at (11,45) size 125x13 scrollWidth 128
+layer at (11,45) size 125x13 scrollWidth 129
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 129x13
       text run at (0,0) width 129: "123456789 ABCDEFGHIJ"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt
index 35c26ee..6c4d9aa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt
@@ -75,7 +75,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,29) size 125x13 scrollWidth 143
+layer at (146,29) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -83,7 +83,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,48) size 125x13 scrollWidth 143
+layer at (146,48) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -91,7 +91,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,67) size 125x13 scrollWidth 143
+layer at (146,67) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -99,7 +99,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,86) size 125x13 scrollWidth 143
+layer at (146,86) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -107,7 +107,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,105) size 125x13 scrollWidth 143
+layer at (146,105) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -115,7 +115,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,124) size 125x13 scrollWidth 143
+layer at (146,124) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -123,7 +123,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,143) size 125x13 scrollWidth 143
+layer at (146,143) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -131,7 +131,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,162) size 125x13 scrollWidth 143
+layer at (146,162) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -139,7 +139,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,181) size 125x13 scrollWidth 143
+layer at (146,181) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -147,7 +147,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,200) size 125x13 scrollWidth 143
+layer at (146,200) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -155,7 +155,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,219) size 125x13 scrollWidth 143
+layer at (146,219) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -163,7 +163,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,238) size 125x13 scrollWidth 143
+layer at (146,238) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
@@ -171,7 +171,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 328x13
       text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,257) size 125x13 scrollWidth 143
+layer at (146,257) size 125x13 scrollWidth 144
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 143x13
       text run at (0,0) width 143: "This text field is not disabled"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png
index fd93aaf..b8bec39 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt
index 5e3edac5..bc067c8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -16,7 +16,7 @@
         LayoutText {#text} at (0,0) size 765x36
           text run at (0,0) width 765: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and"
           text run at (0,18) width 164: "third scrolled to the right."
-layer at (11,11) size 125x13 scrollWidth 288
+layer at (11,11) size 125x13 scrollWidth 289
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 288x13
       text run at (0,0) width 288: "this text field has a lot of text in it so that it needs to scroll"
@@ -24,7 +24,7 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (-162,0) size 288x13
       text run at (-162,0) width 287: "this text field has a lot of text in it so that it needs to scroll"
-layer at (281,11) size 125x13 scrollX 163.00 scrollWidth 288
+layer at (281,11) size 125x13 scrollX 164.00 scrollWidth 289
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 288x13
       text run at (0,0) width 288: "this text field has a lot of text in it so that it needs to scroll"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt
index 4db487ee..6fefd65 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt
@@ -14,7 +14,7 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x33
         LayoutTextControl {INPUT} at (0,0) size 131x33 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,52) size 125x13 scrollWidth 242
+layer at (11,52) size 125x13 scrollWidth 243
   LayoutBlockFlow {DIV} at (3,10) size 125x13
     LayoutText {#text} at (0,0) size 242x13
       text run at (0,0) width 242: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt
index 7c2ef766..43d1c18 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt
@@ -9,7 +9,7 @@
       LayoutBR {BR} at (623,32) size 1x0
       LayoutTextControl {INPUT} at (0,36) size 17x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (11,47) size 11x13 scrollWidth 37
+layer at (11,47) size 11x13 scrollWidth 38
   LayoutBlockFlow {DIV} at (3,3) size 11x13
     LayoutText {#text} at (0,0) size 38x13
       text run at (0,0) width 38: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
index cbf0674..04cda46f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
@@ -8,7 +8,7 @@
       LayoutBR {BR} at (562,14) size 1x0
       LayoutTextControl {INPUT} at (0,18) size 232x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (10,28) size 228x23 scrollWidth 564
+layer at (10,28) size 228x23 scrollWidth 565
   LayoutBlockFlow {DIV} at (2,2) size 228x23
     LayoutText {#text} at (0,0) size 564x23
       text run at (0,0) width 564: "abcThis tests that typing doesn't cut holes in the focus outline"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-focus-ring-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-focus-ring-expected.txt
index a60e5cb8..d3ba510e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-focus-ring-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-focus-ring-expected.txt
@@ -6,7 +6,7 @@
       LayoutBlockFlow (anonymous) at (0,0) size 784x18
         LayoutText {#text} at (0,0) size 515x18
           text run at (0,0) width 515: "The focus ring of the following div should not extend beyond the size of the div."
-layer at (8,26) size 500x400 scrollHeight 648
+layer at (8,26) size 500x400 scrollWidth 501 scrollHeight 648
   LayoutBlockFlow {DIV} at (0,18) size 500x400
     LayoutText {#text} at (0,0) size 500x648
       text run at (0,0) width 500: "............................................................................................................................."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
index 2f5e3ce9..7b95cf5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -6,8 +6,8 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [407, 10, 4, 15],
-        [405, 10, 4, 15]
+        [406, 10, 4, 15],
+        [404, 10, 4, 15]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
index 3d0f69a..1d59f43b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
@@ -51,27 +51,27 @@
             LayoutTableCell {TD} at (34,1) size 749x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (19,31) size 0x13 scrollWidth 46
+layer at (19,31) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "New Mail"
-layer at (30,31) size 0x13 scrollWidth 28
+layer at (30,31) size 0x13 scrollWidth 29
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (41,31) size 0x13 scrollWidth 44
+layer at (41,31) size 0x13 scrollWidth 45
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 44x13
       text run at (0,0) width 44: "Reply All"
-layer at (30,90) size 0x13 scrollWidth 46
+layer at (30,90) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "New Mail"
-layer at (41,90) size 0x13 scrollWidth 28
+layer at (41,90) size 0x13 scrollWidth 29
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (52,90) size 0x13 scrollWidth 44
+layer at (52,90) size 0x13 scrollWidth 45
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 44x13
       text run at (0,0) width 44: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt
index c5a7721..06c4a910 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt
@@ -33,27 +33,27 @@
             LayoutTableCell {TD} at (28,1) size 755x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (13,31) size 0x13 scrollWidth 46
+layer at (13,31) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "New Mail"
-layer at (22,31) size 0x13 scrollWidth 28
+layer at (22,31) size 0x13 scrollWidth 29
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (31,31) size 0x13 scrollWidth 44
+layer at (31,31) size 0x13 scrollWidth 45
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 44x13
       text run at (0,0) width 44: "Reply All"
-layer at (13,90) size 0x13 scrollWidth 46
+layer at (13,90) size 0x13 scrollWidth 47
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 47x13
       text run at (0,0) width 47: "New Mail"
-layer at (22,90) size 0x13 scrollWidth 28
+layer at (22,90) size 0x13 scrollWidth 29
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 29x13
       text run at (0,0) width 29: "Reply"
-layer at (31,90) size 0x13 scrollWidth 44
+layer at (31,90) size 0x13 scrollWidth 45
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 44x13
       text run at (0,0) width 44: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt
index b6e5eef1e..8eb26a5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt
@@ -54,7 +54,7 @@
                                               LayoutTableCell {TD} at (122,1) size 141x29 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
                                                 LayoutTextControl {INPUT} at (5,5) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                                                 LayoutText {#text} at (0,0) size 0x0
-layer at (241,97) size 125x13 scrollWidth 181
+layer at (241,97) size 125x13 scrollWidth 182
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 182x13
       text run at (0,0) width 182: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt
index d0e1a125e..aa84512 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt
@@ -39,7 +39,7 @@
               LayoutText {#text} at (2,2) size 752x36
                 text run at (2,2) width 752: "KEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLEooKEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLE"
                 text run at (2,20) width 602: "THIS SIMULATES THE PROBLEM ON THE WWW.MAPBLAST.COM/ \"CREATE MAP\""
-layer at (29,29) size 125x13 scrollWidth 130
+layer at (29,29) size 125x13 scrollWidth 131
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 131x13
       text run at (0,0) width 131: "THIS NEEDS THIS VALUE"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..7b95cf5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [406, 10, 4, 15],
+        [404, 10, 4, 15]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-23-expected.txt
index 07090c58..5efc5f237 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-23-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 249x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 245x16 scrollWidth 253
+layer at (10,41) size 245x16 scrollWidth 254
   LayoutBlockFlow {DIV} at (2,3) size 245x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-69-expected.txt
index 07090c58..5efc5f237 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/html/css3-modsel-69-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 249x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 245x16 scrollWidth 253
+layer at (10,41) size 245x16 scrollWidth 254
   LayoutBlockFlow {DIV} at (2,3) size 245x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-23-expected.txt
index 4090990..249817c7 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-23-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 249x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 245x16 scrollWidth 253
+layer at (10,41) size 245x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 245x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-69-expected.txt
index 4090990..249817c7 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xhtml/css3-modsel-69-expected.txt
@@ -13,7 +13,7 @@
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 249x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,41) size 245x16 scrollWidth 253
+layer at (10,41) size 245x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 245x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-23-expected.txt
index 612ecaa..b291e0da 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-23-expected.txt
@@ -12,7 +12,7 @@
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 249x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (2,41) size 245x16 scrollWidth 253
+layer at (2,41) size 245x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 245x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-69-expected.txt
index 612ecaa..b291e0da 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/selectors3/xml/css3-modsel-69-expected.txt
@@ -12,7 +12,7 @@
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 249x22 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (2,41) size 245x16 scrollWidth 253
+layer at (2,41) size 245x16 scrollWidth 254
   LayoutBlockFlow {div} at (2,3) size 245x16
     LayoutText {#text} at (0,0) size 253x16
       text run at (0,0) width 253: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-contenteditable-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
index 9981494..0b88ccdd 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
@@ -6,7 +6,7 @@
       LayoutBlockFlow {DIV} at (0,0) size 784x20
         LayoutText {#text} at (0,0) size 784x19
           text run at (0,0) width 784: "When the caret reaches the edge of the input box or content editable div, on the next input if must jump to the center of the control."
-layer at (8,28) size 82x22 clip at (9,29) size 80x20 scrollX 41.00 scrollWidth 336
+layer at (8,28) size 82x22 clip at (9,29) size 80x20 scrollX 41.00 scrollWidth 337
   LayoutBlockFlow {DIV} at (0,20) size 82x22 [border: (1px solid #000000)]
     LayoutText {#text} at (1,1) size 336x19
       text run at (1,1) width 336: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-input-expected.txt
index b08c79e..b5e2082b 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -10,7 +10,7 @@
         LayoutTextControl {INPUT} at (0,0) size 93x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,31) size 89x16 scrollWidth 294
+layer at (10,31) size 89x16 scrollWidth 295
   LayoutBlockFlow {DIV} at (2,3) size 89x16
     LayoutText {#text} at (0,0) size 294x16
       text run at (0,0) width 294: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/clip/outline-overflowClip-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/clip/outline-overflowClip-expected.txt
index d4a1341..1f24edeb9 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/clip/outline-overflowClip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/clip/outline-overflowClip-expected.txt
@@ -13,7 +13,7 @@
     LayoutText {#text} at (2,2) size 93x19
       text run at (2,2) width 93: "text in outer div"
     LayoutText {#text} at (0,0) size 0x0
-layer at (60,50) size 97x26 backgroundClip at (83,47) size 77x32 clip at (83,53) size 71x20
+layer at (60,50) size 97x26 backgroundClip at (83,47) size 77x32 clip at (83,53) size 71x20 scrollWidth 92
   LayoutBlockFlow (positioned) {DIV} at (52,22) size 97x26 [bgcolor=#EEEEEE] [border: (3px solid #FF0000)]
     LayoutText {#text} at (3,3) size 91x19
       text run at (3,3) width 91: "text in inner div"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/css/text-overflow-input-expected.txt
index adb4edd..bef60cb 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/css/text-overflow-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/css/text-overflow-input-expected.txt
@@ -124,15 +124,15 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (169,75) size 135x16
   LayoutBlockFlow {DIV} at (0,0) size 135x16
-layer at (326,75) size 149x16 scrollWidth 317
+layer at (326,75) size 149x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (485,75) size 135x16 scrollWidth 317
+layer at (485,75) size 135x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (0,0) size 135x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (10,97) size 149x16 scrollWidth 275
+layer at (10,97) size 149x16 scrollWidth 276
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 275x16
       text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -172,15 +172,15 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (169,199) size 135x16
   LayoutBlockFlow {DIV} at (0,0) size 135x16
-layer at (326,199) size 149x16 scrollWidth 317
+layer at (326,199) size 149x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (485,199) size 135x16 scrollWidth 317
+layer at (485,199) size 135x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (0,0) size 135x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (10,221) size 149x16 scrollWidth 275
+layer at (10,221) size 149x16 scrollWidth 276
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 275x16
       text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -214,7 +214,7 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (233,323) size 149x16
   LayoutBlockFlow {DIV} at (2,3) size 149x16
-layer at (390,323) size 149x16 scrollWidth 317
+layer at (390,323) size 149x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
@@ -224,7 +224,7 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (254,345) size 149x16
   LayoutBlockFlow {DIV} at (2,3) size 149x16
-layer at (411,345) size 149x16 scrollWidth 317
+layer at (411,345) size 149x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-inputs-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-inputs-expected.txt
index 97315345..148ee6f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-inputs-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-inputs-expected.txt
@@ -65,7 +65,7 @@
         LayoutBlockFlow {INPUT} at (69,4) size 13x13 [color=#545454]
         LayoutText {#text} at (85,2) size 8x19
           text run at (85,2) width 8: "b"
-layer at (28,342) size 149x16 scrollWidth 168
+layer at (28,342) size 149x16 scrollWidth 169
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 168x16
       text run at (0,0) width 168: "foobarbazfoobarbazfoobarbaz"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/control-restrict-line-height-expected.txt
index 31363be..91b831ac 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/control-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/control-restrict-line-height-expected.txt
@@ -25,7 +25,7 @@
           LayoutBlockFlow {DIV} at (0,2.50) size 1x11
           LayoutBlockFlow {DIV} at (1,0) size 135x16
       LayoutText {#text} at (0,0) size 0x0
-layer at (12,73) size 135x16 scrollWidth 294
+layer at (12,73) size 135x16 scrollWidth 295
   LayoutBlockFlow {DIV} at (0,0) size 135x16
     LayoutText {#text} at (0,0) size 294x16
       text run at (0,0) width 294: "This text should be centered vertically in the button"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-disabled-color-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-disabled-color-expected.txt
index 62c09e45..b97af44 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-disabled-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-disabled-color-expected.txt
@@ -75,7 +75,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,31) size 149x16 scrollWidth 165
+layer at (167,31) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -83,7 +83,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,53) size 149x16 scrollWidth 165
+layer at (167,53) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -91,7 +91,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,75) size 149x16 scrollWidth 165
+layer at (167,75) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -99,7 +99,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,97) size 149x16 scrollWidth 165
+layer at (167,97) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -107,7 +107,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,119) size 149x16 scrollWidth 165
+layer at (167,119) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -115,7 +115,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,141) size 149x16 scrollWidth 165
+layer at (167,141) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -123,7 +123,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,163) size 149x16 scrollWidth 165
+layer at (167,163) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -131,7 +131,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,185) size 149x16 scrollWidth 165
+layer at (167,185) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -139,7 +139,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,207) size 149x16 scrollWidth 165
+layer at (167,207) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -147,7 +147,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,229) size 149x16 scrollWidth 165
+layer at (167,229) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -155,7 +155,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,251) size 149x16 scrollWidth 165
+layer at (167,251) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -163,7 +163,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,273) size 149x16 scrollWidth 165
+layer at (167,273) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
@@ -171,7 +171,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 378x16
       text run at (0,0) width 378: "The text in this disabled field should displayed as dimmed or grey"
-layer at (167,295) size 149x16 scrollWidth 165
+layer at (167,295) size 149x16 scrollWidth 166
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 165x16
       text run at (0,0) width 165: "This text field is not disabled"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.png
index 219b234e..c67e73cd 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.txt
index c3a4601..cbcfb647 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -16,7 +16,7 @@
         LayoutText {#text} at (0,0) size 741x39
           text run at (0,0) width 741: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and third"
           text run at (0,20) width 119: "scrolled to the right."
-layer at (10,11) size 149x16 scrollWidth 337
+layer at (10,11) size 149x16 scrollWidth 338
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 337x16
       text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
@@ -24,7 +24,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (-188,0) size 337x16
       text run at (-188,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
-layer at (324,11) size 149x16 scrollX 188.00 scrollWidth 337
+layer at (324,11) size 149x16 scrollX 189.00 scrollWidth 338
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 337x16
       text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-word-wrap-expected.txt
index 9ae9a71c..b97da5a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-word-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-text-word-wrap-expected.txt
@@ -14,7 +14,7 @@
       LayoutBlockFlow (anonymous) at (0,36) size 784x40
         LayoutTextControl {INPUT} at (0,0) size 153x40 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,56) size 149x16 scrollWidth 280
+layer at (10,56) size 149x16 scrollWidth 281
   LayoutBlockFlow {DIV} at (2,12) size 149x16
     LayoutText {#text} at (0,0) size 280x16
       text run at (0,0) width 280: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-type-text-min-width-expected.txt
index 72d99e0..1f460e7f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-type-text-min-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/input-type-text-min-width-expected.txt
@@ -9,7 +9,7 @@
       LayoutBR {BR} at (547,35) size 0x0
       LayoutTextControl {INPUT} at (0,40) size 39x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (10,51) size 35x16 scrollWidth 42
+layer at (10,51) size 35x16 scrollWidth 43
   LayoutBlockFlow {DIV} at (2,3) size 35x16
     LayoutText {#text} at (0,0) size 42x16
       text run at (0,0) width 42: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/minWidthPercent-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/minWidthPercent-expected.txt
index c48d035..f27918c 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/minWidthPercent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/minWidthPercent-expected.txt
@@ -10,7 +10,7 @@
               LayoutTableCell {TD} at (2,2) size 112x24 [r=0 c=0 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 110x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (0,0) size 0x0
-layer at (13,14) size 106x16 scrollWidth 121
+layer at (13,14) size 106x16 scrollWidth 122
   LayoutBlockFlow {DIV} at (2,3) size 106x16
     LayoutText {#text} at (0,0) size 121x16
       text run at (0,0) width 121: "Should fit in blue box"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textfield-outline-expected.txt
index 36c6f9aa4..fb0ae08e 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textfield-outline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textfield-outline-expected.txt
@@ -8,7 +8,7 @@
       LayoutBR {BR} at (522,15) size 0x0
       LayoutTextControl {INPUT} at (0,20) size 226x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (9,30) size 224x24 scrollWidth 535
+layer at (9,30) size 224x24 scrollWidth 536
   LayoutBlockFlow {DIV} at (1,2) size 224x24
     LayoutText {#text} at (0,0) size 535x23
       text run at (0,0) width 535: "abcThis tests that typing doesn't cut holes in the focus outline"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-focus-ring-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-focus-ring-expected.txt
index 5b6f270..b6dd767 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-focus-ring-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-focus-ring-expected.txt
@@ -6,7 +6,7 @@
       LayoutBlockFlow (anonymous) at (0,0) size 784x20
         LayoutText {#text} at (0,0) size 474x19
           text run at (0,0) width 474: "The focus ring of the following div should not extend beyond the size of the div."
-layer at (8,28) size 500x400 scrollHeight 720
+layer at (8,28) size 500x400 scrollWidth 501 scrollHeight 720
   LayoutBlockFlow {DIV} at (0,20) size 500x400
     LayoutText {#text} at (0,0) size 500x719
       text run at (0,0) width 500: "............................................................................................................................."
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
index 8a498e5..604c6af 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -6,8 +6,8 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [381, 10, 3, 18],
-        [378, 10, 3, 18]
+        [380, 10, 3, 18],
+        [377, 10, 3, 18]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-searchfield-expected.txt
index 3ae6585..bc492e41 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-searchfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-searchfield-expected.txt
@@ -51,27 +51,27 @@
             LayoutTableCell {TD} at (28,2) size 755x22 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x19
                 text run at (1,1) width 4: " "
-layer at (14,33) size 0x16 scrollWidth 53
+layer at (14,33) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (23,33) size 0x16 scrollWidth 33
+layer at (23,33) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (32,33) size 0x16 scrollWidth 52
+layer at (32,33) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
-layer at (31,99) size 0x16 scrollWidth 53
+layer at (31,99) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (40,99) size 0x16 scrollWidth 33
+layer at (40,99) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (49,99) size 0x16 scrollWidth 52
+layer at (49,99) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textfield-expected.txt
index df18636..1065632 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textfield-expected.txt
@@ -33,27 +33,27 @@
             LayoutTableCell {TD} at (22,2) size 761x22 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x19
                 text run at (1,1) width 4: " "
-layer at (12,33) size 0x16 scrollWidth 53
+layer at (12,33) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (19,33) size 0x16 scrollWidth 33
+layer at (19,33) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (26,33) size 0x16 scrollWidth 52
+layer at (26,33) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
-layer at (12,99) size 0x16 scrollWidth 53
+layer at (12,99) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (19,99) size 0x16 scrollWidth 33
+layer at (19,99) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (26,99) size 0x16 scrollWidth 52
+layer at (26,99) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
new file mode 100644
index 0000000..b1c32773
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
@@ -0,0 +1,213 @@
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 22 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 22 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please enter a URL. sub-message=
+ValidationMessageClient: main-message=Please enter a URL. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+CONSOLE WARNING: The specified value "a" is not a valid email address.
+CONSOLE WARNING: The specified value "a" is not a valid email address.
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+CONSOLE WARNING: The specified value "abc" is not a valid email address.
+ValidationMessageClient: main-message=Please include an '@' in the email address. 'abc' is missing an '@'. sub-message=
+ValidationMessageClient: main-message=Please include an '@' in the email address. 'abc' is missing an '@'. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be 01/01/2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be 01/01/2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be 01/01/2001 or later. sub-message=
+ValidationMessageClient: main-message=Value must be 01/01/2001 or later. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 01/01/1970. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 01/01/1970. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be January, 2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be January, 2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be January, 2001 or later. sub-message=
+ValidationMessageClient: main-message=Value must be January, 2001 or later. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be Week 01, 2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be Week 01, 2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be Week 01, 2001 or later. sub-message=
+ValidationMessageClient: main-message=Value must be Week 01, 2001 or later. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is Week 01, 1970. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is Week 01, 1970. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be 12:00 PM or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be 12:00 PM or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be 12:00 PM or later. sub-message=
+ValidationMessageClient: main-message=Value must be 12:00 PM or later. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 12:00 AM. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 12:00 AM. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be less than or equal to 5. sub-message=
+ValidationMessageClient: main-message=Value must be less than or equal to 5. sub-message=
+ValidationMessageClient: main-message=Value must be greater than or equal to 5. sub-message=
+ValidationMessageClient: main-message=Value must be greater than or equal to 5. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The two nearest valid values are 2 and 4. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The two nearest valid values are 2 and 4. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please check this box if you want to proceed. sub-message=
+ValidationMessageClient: main-message=Please check this box if you want to proceed. sub-message=
+ValidationMessageClient: main-message=Please select one of these options. sub-message=
+ValidationMessageClient: main-message=Please select one of these options. sub-message=
+ValidationMessageClient: main-message=Please select a file. sub-message=
+ValidationMessageClient: main-message=Please select a file. sub-message=
+ValidationMessageClient: main-message=Please select an item in the list. sub-message=
+ValidationMessageClient: main-message=Please select an item in the list. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+This is a testharness.js-based test.
+PASS [INPUT in TEXT status] no constraint 
+PASS [INPUT in TEXT status] no constraint (in a form) 
+PASS [INPUT in TEXT status] suffering from being too long 
+PASS [INPUT in TEXT status] suffering from being too long (in a form) 
+PASS [INPUT in TEXT status] suffering from a pattern mismatch 
+PASS [INPUT in TEXT status] suffering from a pattern mismatch (in a form) 
+PASS [INPUT in TEXT status] suffering from being missing 
+PASS [INPUT in TEXT status] suffering from being missing (in a form) 
+PASS [INPUT in SEARCH status] no constraint 
+PASS [INPUT in SEARCH status] no constraint (in a form) 
+PASS [INPUT in SEARCH status] suffering from being too long 
+PASS [INPUT in SEARCH status] suffering from being too long (in a form) 
+PASS [INPUT in SEARCH status] suffering from a pattern mismatch 
+PASS [INPUT in SEARCH status] suffering from a pattern mismatch (in a form) 
+PASS [INPUT in SEARCH status] suffering from being missing 
+PASS [INPUT in SEARCH status] suffering from being missing (in a form) 
+PASS [INPUT in TEL status] no constraint 
+PASS [INPUT in TEL status] no constraint (in a form) 
+PASS [INPUT in TEL status] suffering from being too long 
+PASS [INPUT in TEL status] suffering from being too long (in a form) 
+PASS [INPUT in TEL status] suffering from a pattern mismatch 
+PASS [INPUT in TEL status] suffering from a pattern mismatch (in a form) 
+PASS [INPUT in TEL status] suffering from being missing 
+PASS [INPUT in TEL status] suffering from being missing (in a form) 
+PASS [INPUT in PASSWORD status] no constraint 
+PASS [INPUT in PASSWORD status] no constraint (in a form) 
+PASS [INPUT in PASSWORD status] suffering from being too long 
+PASS [INPUT in PASSWORD status] suffering from being too long (in a form) 
+PASS [INPUT in PASSWORD status] suffering from a pattern mismatch 
+PASS [INPUT in PASSWORD status] suffering from a pattern mismatch (in a form) 
+PASS [INPUT in PASSWORD status] suffering from being missing 
+PASS [INPUT in PASSWORD status] suffering from being missing (in a form) 
+PASS [INPUT in URL status] no constraint 
+PASS [INPUT in URL status] no constraint (in a form) 
+PASS [INPUT in URL status] suffering from being too long 
+PASS [INPUT in URL status] suffering from being too long (in a form) 
+PASS [INPUT in URL status] suffering from a pattern mismatch 
+PASS [INPUT in URL status] suffering from a pattern mismatch (in a form) 
+PASS [INPUT in URL status] suffering from a type mismatch 
+PASS [INPUT in URL status] suffering from a type mismatch (in a form) 
+PASS [INPUT in URL status] suffering from being missing 
+PASS [INPUT in URL status] suffering from being missing (in a form) 
+PASS [INPUT in EMAIL status] no constraint 
+PASS [INPUT in EMAIL status] no constraint (in a form) 
+FAIL [INPUT in EMAIL status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in EMAIL status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
+PASS [INPUT in EMAIL status] suffering from a pattern mismatch 
+PASS [INPUT in EMAIL status] suffering from a pattern mismatch (in a form) 
+PASS [INPUT in EMAIL status] suffering from a type mismatch 
+PASS [INPUT in EMAIL status] suffering from a type mismatch (in a form) 
+PASS [INPUT in EMAIL status] suffering from being missing 
+PASS [INPUT in EMAIL status] suffering from being missing (in a form) 
+FAIL [INPUT in DATETIME status] The datetime type must be supported. assert_equals: The datetime type should be supported. expected "datetime" but got "text"
+PASS [INPUT in DATE status] no constraint 
+PASS [INPUT in DATE status] no constraint (in a form) 
+PASS [INPUT in DATE status] suffering from an overflow 
+PASS [INPUT in DATE status] suffering from an overflow (in a form) 
+PASS [INPUT in DATE status] suffering from an underflow 
+PASS [INPUT in DATE status] suffering from an underflow (in a form) 
+PASS [INPUT in DATE status] suffering from a step mismatch 
+PASS [INPUT in DATE status] suffering from a step mismatch (in a form) 
+PASS [INPUT in DATE status] suffering from being missing 
+PASS [INPUT in DATE status] suffering from being missing (in a form) 
+PASS [INPUT in MONTH status] no constraint 
+PASS [INPUT in MONTH status] no constraint (in a form) 
+PASS [INPUT in MONTH status] suffering from an overflow 
+PASS [INPUT in MONTH status] suffering from an overflow (in a form) 
+PASS [INPUT in MONTH status] suffering from an underflow 
+PASS [INPUT in MONTH status] suffering from an underflow (in a form) 
+FAIL [INPUT in MONTH status] suffering from a step mismatch assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in MONTH status] suffering from a step mismatch (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
+PASS [INPUT in MONTH status] suffering from being missing 
+PASS [INPUT in MONTH status] suffering from being missing (in a form) 
+PASS [INPUT in WEEK status] no constraint 
+PASS [INPUT in WEEK status] no constraint (in a form) 
+PASS [INPUT in WEEK status] suffering from an overflow 
+PASS [INPUT in WEEK status] suffering from an overflow (in a form) 
+PASS [INPUT in WEEK status] suffering from an underflow 
+PASS [INPUT in WEEK status] suffering from an underflow (in a form) 
+PASS [INPUT in WEEK status] suffering from a step mismatch 
+PASS [INPUT in WEEK status] suffering from a step mismatch (in a form) 
+PASS [INPUT in WEEK status] suffering from being missing 
+PASS [INPUT in WEEK status] suffering from being missing (in a form) 
+PASS [INPUT in TIME status] no constraint 
+PASS [INPUT in TIME status] no constraint (in a form) 
+PASS [INPUT in TIME status] suffering from an overflow 
+PASS [INPUT in TIME status] suffering from an overflow (in a form) 
+PASS [INPUT in TIME status] suffering from an underflow 
+PASS [INPUT in TIME status] suffering from an underflow (in a form) 
+PASS [INPUT in TIME status] suffering from a step mismatch 
+PASS [INPUT in TIME status] suffering from a step mismatch (in a form) 
+PASS [INPUT in TIME status] suffering from being missing 
+PASS [INPUT in TIME status] suffering from being missing (in a form) 
+PASS [INPUT in NUMBER status] suffering from an overflow 
+PASS [INPUT in NUMBER status] suffering from an overflow (in a form) 
+PASS [INPUT in NUMBER status] suffering from an underflow 
+PASS [INPUT in NUMBER status] suffering from an underflow (in a form) 
+PASS [INPUT in NUMBER status] suffering from a step mismatch 
+PASS [INPUT in NUMBER status] suffering from a step mismatch (in a form) 
+PASS [INPUT in NUMBER status] suffering from being missing 
+PASS [INPUT in NUMBER status] suffering from being missing (in a form) 
+PASS [INPUT in CHECKBOX status] no constraint 
+PASS [INPUT in CHECKBOX status] no constraint (in a form) 
+PASS [INPUT in CHECKBOX status] suffering from being missing 
+PASS [INPUT in CHECKBOX status] suffering from being missing (in a form) 
+PASS [INPUT in RADIO status] no constraint 
+PASS [INPUT in RADIO status] no constraint (in a form) 
+PASS [INPUT in RADIO status] suffering from being missing 
+PASS [INPUT in RADIO status] suffering from being missing (in a form) 
+PASS [INPUT in FILE status] no constraint 
+PASS [INPUT in FILE status] no constraint (in a form) 
+PASS [INPUT in FILE status] suffering from being missing 
+PASS [INPUT in FILE status] suffering from being missing (in a form) 
+PASS [select]  no constraint 
+PASS [select]  no constraint (in a form) 
+PASS [select]  suffering from being missing 
+PASS [select]  suffering from being missing (in a form) 
+PASS [textarea]  no constraint 
+PASS [textarea]  no constraint (in a form) 
+PASS [textarea]  suffering from being missing 
+PASS [textarea]  suffering from being missing (in a form) 
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug59354-expected.txt
index b242adb..26d85b8 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug59354-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug59354-expected.txt
@@ -54,7 +54,7 @@
                                               LayoutTableCell {TD} at (118,1) size 163x32 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
                                                 LayoutTextControl {INPUT} at (5,5) size 153x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                                                 LayoutText {#text} at (0,0) size 0x0
-layer at (214,103) size 149x16 scrollWidth 209
+layer at (214,103) size 149x16 scrollWidth 210
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 209x16
       text run at (0,0) width 209: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug96334-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug96334-expected.txt
index 9ba4a94..4c005a0 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug96334-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/tables/mozilla/bugs/bug96334-expected.txt
@@ -39,7 +39,7 @@
               LayoutText {#text} at (2,2) size 730x39
                 text run at (2,2) width 730: "KEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLEooKEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLE"
                 text run at (2,22) width 586: "THIS SIMULATES THE PROBLEM ON THE WWW.MAPBLAST.COM/ \"CREATE MAP\""
-layer at (28,29) size 149x16 scrollWidth 156
+layer at (28,29) size 149x16 scrollWidth 157
   LayoutBlockFlow {DIV} at (2,3) size 149x16
     LayoutText {#text} at (0,0) size 156x16
       text run at (0,0) width 156: "THIS NEEDS THIS VALUE"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..8a498e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [381, 10, 3, 18],
+        [378, 10, 3, 18]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-contenteditable-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
index ebb5ad6..cfd9656 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-contenteditable-expected.txt
@@ -7,7 +7,7 @@
         LayoutText {#text} at (0,0) size 761x35
           text run at (0,0) width 761: "When the caret reaches the edge of the input box or content editable div, on the next input if must jump to the center of"
           text run at (0,18) width 73: "the control."
-layer at (8,44) size 82x20 clip at (9,45) size 80x18 scrollX 41.00 scrollWidth 336
+layer at (8,44) size 82x20 clip at (9,45) size 80x18 scrollX 41.00 scrollWidth 337
   LayoutBlockFlow {DIV} at (0,36) size 82x20 [border: (1px solid #000000)]
     LayoutText {#text} at (1,1) size 336x17
       text run at (1,1) width 336: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-input-expected.txt
index 2819891..82fcffd 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -10,7 +10,7 @@
         LayoutTextControl {INPUT} at (0,0) size 103x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,29) size 99x16 scrollWidth 294
+layer at (10,29) size 99x16 scrollWidth 295
   LayoutBlockFlow {DIV} at (2,3) size 99x16
     LayoutText {#text} at (0,0) size 294x16
       text run at (0,0) width 294: "012345678901012345678901234567890123456789"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/clip/outline-overflowClip-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/clip/outline-overflowClip-expected.txt
index 8c23052..d83b5761 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/clip/outline-overflowClip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/clip/outline-overflowClip-expected.txt
@@ -14,7 +14,7 @@
     LayoutText {#text} at (2,2) size 102x17
       text run at (2,2) width 102: "text in outer div"
     LayoutText {#text} at (0,0) size 0x0
-layer at (60,64) size 108x24 backgroundClip at (83,61) size 88x30 clip at (83,67) size 82x18
+layer at (60,64) size 108x24 backgroundClip at (83,61) size 88x30 clip at (83,67) size 82x18 scrollWidth 103
   LayoutBlockFlow (positioned) {DIV} at (52,20) size 107.77x24 [bgcolor=#EEEEEE] [border: (3px solid #FF0000)]
     LayoutText {#text} at (3,3) size 102x17
       text run at (3,3) width 102: "text in inner div"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/css/text-overflow-input-expected.txt
index 40036eb..28daaf4 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/css/text-overflow-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/css/text-overflow-input-expected.txt
@@ -124,15 +124,15 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (189,71) size 155x16
   LayoutBlockFlow {DIV} at (0,0) size 155x16
-layer at (366,71) size 169x16 scrollWidth 317
+layer at (366,71) size 169x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (545,71) size 155x16 scrollWidth 317
+layer at (545,71) size 155x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (0,0) size 155x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (10,93) size 169x16 scrollWidth 275
+layer at (10,93) size 169x16 scrollWidth 276
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 275x16
       text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -172,15 +172,15 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (189,193) size 155x16
   LayoutBlockFlow {DIV} at (0,0) size 155x16
-layer at (366,193) size 169x16 scrollWidth 317
+layer at (366,193) size 169x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (545,193) size 155x16 scrollWidth 317
+layer at (545,193) size 155x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (0,0) size 155x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (10,215) size 169x16 scrollWidth 275
+layer at (10,215) size 169x16 scrollWidth 276
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 275x16
       text run at (0,0) width 275: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
@@ -214,7 +214,7 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (256,315) size 169x16
   LayoutBlockFlow {DIV} at (2,3) size 169x16
-layer at (433,315) size 169x16 scrollWidth 317
+layer at (433,315) size 169x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
@@ -224,7 +224,7 @@
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (280,337) size 169x16
   LayoutBlockFlow {DIV} at (2,3) size 169x16
-layer at (457,337) size 169x16 scrollWidth 317
+layer at (457,337) size 169x16 scrollWidth 318
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 317x16
       text run at (0,0) width 317: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/control-restrict-line-height-expected.txt
index 3388f5c..04a168b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/control-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/control-restrict-line-height-expected.txt
@@ -25,7 +25,7 @@
           LayoutBlockFlow {DIV} at (0,2.50) size 1x11
           LayoutBlockFlow {DIV} at (1,0) size 155x16
       LayoutText {#text} at (0,0) size 0x0
-layer at (12,71) size 155x16 scrollWidth 294
+layer at (12,71) size 155x16 scrollWidth 295
   LayoutBlockFlow {DIV} at (0,0) size 155x16
     LayoutText {#text} at (0,0) size 294x16
       text run at (0,0) width 294: "This text should be centered vertically in the button"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.png
index 5ff6877..0ea8d2fc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.txt
index fd25472..90f2ccc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -16,7 +16,7 @@
         LayoutText {#text} at (0,0) size 767x35
           text run at (0,0) width 767: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and"
           text run at (0,18) width 164: "third scrolled to the right."
-layer at (10,11) size 169x16 scrollWidth 337
+layer at (10,11) size 169x16 scrollWidth 338
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 337x16
       text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
@@ -24,7 +24,7 @@
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (-168,0) size 337x16
       text run at (-168,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
-layer at (364,11) size 169x16 scrollX 168.00 scrollWidth 337
+layer at (364,11) size 169x16 scrollX 169.00 scrollWidth 338
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 337x16
       text run at (0,0) width 337: "this text field has a lot of text in it so that it needs to scroll"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-word-wrap-expected.txt
index 0c9adaf..ef154975 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-word-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-text-word-wrap-expected.txt
@@ -14,7 +14,7 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x40
         LayoutTextControl {INPUT} at (0,0) size 173x40 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (10,54) size 169x16 scrollWidth 280
+layer at (10,54) size 169x16 scrollWidth 281
   LayoutBlockFlow {DIV} at (2,12) size 169x16
     LayoutText {#text} at (0,0) size 280x16
       text run at (0,0) width 280: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-type-text-min-width-expected.txt
index 24a63e5a..d28dfc43 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-type-text-min-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/input-type-text-min-width-expected.txt
@@ -9,7 +9,7 @@
       LayoutBR {BR} at (623,32) size 1x0
       LayoutTextControl {INPUT} at (0,36) size 40x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (10,47) size 36x16 scrollWidth 42
+layer at (10,47) size 36x16 scrollWidth 43
   LayoutBlockFlow {DIV} at (2,3) size 36x16
     LayoutText {#text} at (0,0) size 42x16
       text run at (0,0) width 42: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/minWidthPercent-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/minWidthPercent-expected.txt
index 4a4ddb3..f5d58e4 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/minWidthPercent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/minWidthPercent-expected.txt
@@ -10,7 +10,7 @@
               LayoutTableCell {TD} at (2,2) size 114x24 [r=0 c=0 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 112x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (0,0) size 0x0
-layer at (13,14) size 108x16 scrollWidth 121
+layer at (13,14) size 108x16 scrollWidth 122
   LayoutBlockFlow {DIV} at (2,3) size 108x16
     LayoutText {#text} at (0,0) size 121x16
       text run at (0,0) width 121: "Should fit in blue box"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/forms/textfield-outline-expected.txt
index 6587f31..a86bf20 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/textfield-outline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/textfield-outline-expected.txt
@@ -8,7 +8,7 @@
       LayoutBR {BR} at (562,14) size 1x0
       LayoutTextControl {INPUT} at (0,18) size 245x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (9,28) size 243x23 scrollWidth 543
+layer at (9,28) size 243x23 scrollWidth 544
   LayoutBlockFlow {DIV} at (1,2) size 243x23
     LayoutText {#text} at (0,0) size 544x22
       text run at (0,0) width 544: "abcThis tests that typing doesn't cut holes in the focus outline"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-focus-ring-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-focus-ring-expected.txt
index f945b8f3..dd5a3517 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-focus-ring-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-focus-ring-expected.txt
@@ -6,7 +6,7 @@
       LayoutBlockFlow (anonymous) at (0,0) size 784x18
         LayoutText {#text} at (0,0) size 515x17
           text run at (0,0) width 515: "The focus ring of the following div should not extend beyond the size of the div."
-layer at (8,26) size 500x400 scrollHeight 648
+layer at (8,26) size 500x400 scrollWidth 501 scrollHeight 648
   LayoutBlockFlow {DIV} at (0,18) size 500x400
     LayoutText {#text} at (0,0) size 500x647
       text run at (0,0) width 500: "............................................................................................................................."
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
index f8abebb..1751e41 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -6,8 +6,8 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [406, 10, 4, 18],
-        [403, 10, 4, 18]
+        [405, 10, 4, 18],
+        [402, 10, 4, 18]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-searchfield-expected.txt
index 3f6a38e..00102e54 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-searchfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-searchfield-expected.txt
@@ -51,27 +51,27 @@
             LayoutTableCell {TD} at (28,3) size 755x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x17
                 text run at (1,1) width 4: " "
-layer at (14,31) size 0x16 scrollWidth 53
+layer at (14,31) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (23,31) size 0x16 scrollWidth 33
+layer at (23,31) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (32,31) size 0x16 scrollWidth 52
+layer at (32,31) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
-layer at (31,93) size 0x16 scrollWidth 53
+layer at (31,93) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (40,93) size 0x16 scrollWidth 33
+layer at (40,93) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (49,93) size 0x16 scrollWidth 52
+layer at (49,93) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (0,0) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textfield-expected.txt
index 040e1e7..98d153a 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textfield-expected.txt
@@ -33,27 +33,27 @@
             LayoutTableCell {TD} at (22,3) size 761x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x17
                 text run at (1,1) width 4: " "
-layer at (12,31) size 0x16 scrollWidth 53
+layer at (12,31) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (19,31) size 0x16 scrollWidth 33
+layer at (19,31) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (26,31) size 0x16 scrollWidth 52
+layer at (26,31) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
-layer at (12,93) size 0x16 scrollWidth 53
+layer at (12,93) size 0x16 scrollWidth 54
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 53x16
       text run at (0,0) width 53: "New Mail"
-layer at (19,93) size 0x16 scrollWidth 33
+layer at (19,93) size 0x16 scrollWidth 34
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 33x16
       text run at (0,0) width 33: "Reply"
-layer at (26,93) size 0x16 scrollWidth 52
+layer at (26,93) size 0x16 scrollWidth 53
   LayoutBlockFlow {DIV} at (2,3) size 0x16
     LayoutText {#text} at (0,0) size 52x16
       text run at (0,0) width 52: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug59354-expected.txt
index 406368e..51a5eef8 100644
--- a/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug59354-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug59354-expected.txt
@@ -54,7 +54,7 @@
                                               LayoutTableCell {TD} at (122,1) size 183x32 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
                                                 LayoutTextControl {INPUT} at (5,5) size 173x22 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                                                 LayoutText {#text} at (0,0) size 0x0
-layer at (219,97) size 169x16 scrollWidth 209
+layer at (219,97) size 169x16 scrollWidth 210
   LayoutBlockFlow {DIV} at (2,3) size 169x16
     LayoutText {#text} at (0,0) size 209x16
       text run at (0,0) width 209: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..1751e41
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/syncpaint/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [405, 10, 4, 18],
+        [402, 10, 4, 18]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
index b1c32773..c3b448e8 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
@@ -1,29 +1,19 @@
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 6 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 22 characters). sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 22 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please enter a URL. sub-message=
@@ -90,40 +80,40 @@
 This is a testharness.js-based test.
 PASS [INPUT in TEXT status] no constraint 
 PASS [INPUT in TEXT status] no constraint (in a form) 
-PASS [INPUT in TEXT status] suffering from being too long 
-PASS [INPUT in TEXT status] suffering from being too long (in a form) 
+FAIL [INPUT in TEXT status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in TEXT status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in TEXT status] suffering from a pattern mismatch 
 PASS [INPUT in TEXT status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in TEXT status] suffering from being missing 
 PASS [INPUT in TEXT status] suffering from being missing (in a form) 
 PASS [INPUT in SEARCH status] no constraint 
 PASS [INPUT in SEARCH status] no constraint (in a form) 
-PASS [INPUT in SEARCH status] suffering from being too long 
-PASS [INPUT in SEARCH status] suffering from being too long (in a form) 
+FAIL [INPUT in SEARCH status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in SEARCH status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch 
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in SEARCH status] suffering from being missing 
 PASS [INPUT in SEARCH status] suffering from being missing (in a form) 
 PASS [INPUT in TEL status] no constraint 
 PASS [INPUT in TEL status] no constraint (in a form) 
-PASS [INPUT in TEL status] suffering from being too long 
-PASS [INPUT in TEL status] suffering from being too long (in a form) 
+FAIL [INPUT in TEL status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in TEL status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in TEL status] suffering from a pattern mismatch 
 PASS [INPUT in TEL status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in TEL status] suffering from being missing 
 PASS [INPUT in TEL status] suffering from being missing (in a form) 
 PASS [INPUT in PASSWORD status] no constraint 
 PASS [INPUT in PASSWORD status] no constraint (in a form) 
-PASS [INPUT in PASSWORD status] suffering from being too long 
-PASS [INPUT in PASSWORD status] suffering from being too long (in a form) 
+FAIL [INPUT in PASSWORD status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in PASSWORD status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch 
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in PASSWORD status] suffering from being missing 
 PASS [INPUT in PASSWORD status] suffering from being missing (in a form) 
 PASS [INPUT in URL status] no constraint 
 PASS [INPUT in URL status] no constraint (in a form) 
-PASS [INPUT in URL status] suffering from being too long 
-PASS [INPUT in URL status] suffering from being too long (in a form) 
+FAIL [INPUT in URL status] suffering from being too long assert_false: The reportValidity method should be false. expected false got true
+FAIL [INPUT in URL status] suffering from being too long (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
 PASS [INPUT in URL status] suffering from a pattern mismatch 
 PASS [INPUT in URL status] suffering from a pattern mismatch (in a form) 
 PASS [INPUT in URL status] suffering from a type mismatch 
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
index 45a917ac..858f7e5 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
@@ -19,11 +19,11 @@
 #include "core/testing/GarbageCollectedScriptWrappable.h"
 #include "core/testing/RefCountedScriptWrappable.h"
 #include "platform/heap/Handle.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 #include <v8.h>
 
 using namespace blink;
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp
index 9bbb487..2a6908f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp
@@ -12,8 +12,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/testing/DummyPageHolder.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp
index 839d936c2..1861056a9 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp
@@ -37,8 +37,7 @@
 #include "bindings/core/v8/V8BindingForTesting.h"
 #include "core/dom/DOMException.h"
 #include "core/dom/ExceptionCode.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
index 6c49a69a..c46fdd37 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -19,8 +19,7 @@
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebScheduler.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueTest.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueTest.cpp
index 700d4f7..e77d1f38 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueTest.cpp
@@ -13,7 +13,7 @@
 #include "core/fileapi/File.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp b/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
index f1fa351..fc2314a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
@@ -10,8 +10,8 @@
 #include "core/testing/GarbageCollectedScriptWrappable.h"
 #include "core/testing/RefCountedScriptWrappable.h"
 #include "platform/heap/Heap.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 #include <limits>
 
 #define TEST_TOV8(expected, value) testToV8(expected, value, __FILE__, __LINE__)
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp b/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
index 42f9b6b..0ad96db43 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
@@ -8,8 +8,8 @@
 #include "bindings/core/v8/ExceptionState.h"
 #include "bindings/core/v8/ToV8.h"
 #include "bindings/core/v8/V8BindingForTesting.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp
index 84807113..86c5c0b 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunnerTest.cpp
@@ -10,7 +10,7 @@
 #include "core/fetch/CachedMetadataHandler.h"
 #include "core/fetch/ScriptResource.h"
 #include "platform/heap/Handle.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
index 25033dc..9d10fc4 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
@@ -32,7 +32,7 @@
 #include "bindings/modules/v8/ToV8ForModules.h"
 #include "modules/indexeddb/IDBKey.h"
 #include "modules/indexeddb/IDBKeyPath.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 using namespace blink;
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp
index f28a927b..0c5384d 100644
--- a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "core/animation/AnimationClock.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationEffectTest.cpp b/third_party/WebKit/Source/core/animation/AnimationEffectTest.cpp
index 75633855..eb507d3c 100644
--- a/third_party/WebKit/Source/core/animation/AnimationEffectTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationEffectTest.cpp
@@ -32,7 +32,7 @@
 #include "core/animation/AnimationEffect.h"
 
 #include "core/animation/ComputedTimingProperties.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp b/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp
index f97b41a3..3f4f718b 100644
--- a/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp
@@ -6,8 +6,7 @@
 #include "core/animation/AnimationInputHelpers.h"
 
 #include "platform/animation/TimingFunction.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
index bb2bb9e..cd43e85 100644
--- a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
@@ -12,7 +12,7 @@
 #include "core/animation/LegacyStyleInterpolation.h"
 #include "core/animation/animatable/AnimatableDouble.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTest.cpp
index 78db28e..da9fad8 100644
--- a/third_party/WebKit/Source/core/animation/AnimationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationTest.cpp
@@ -40,7 +40,7 @@
 #include "core/dom/QualifiedName.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/weborigin/KURL.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp
index 79447c5..854bb1a 100644
--- a/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp
@@ -40,9 +40,8 @@
 #include "core/dom/QualifiedName.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/weborigin/KURL.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/AnimationTranslationUtilTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTranslationUtilTest.cpp
index a81e9b3..e088464 100644
--- a/third_party/WebKit/Source/core/animation/AnimationTranslationUtilTest.cpp
+++ b/third_party/WebKit/Source/core/animation/AnimationTranslationUtilTest.cpp
@@ -33,9 +33,9 @@
 #include "platform/transforms/TranslateTransformOperation.h"
 #include "public/platform/WebFilterOperations.h"
 #include "public/platform/WebTransformOperations.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
index 917b4b2..7e6d27e 100644
--- a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
+++ b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
@@ -51,15 +51,14 @@
 #include "platform/transforms/TransformOperations.h"
 #include "platform/transforms/TranslateTransformOperation.h"
 #include "public/platform/WebCompositorAnimation.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/HashFunctions.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
 namespace blink {
 
 using ::testing::ExpectationSet;
diff --git a/third_party/WebKit/Source/core/animation/DeferredLegacyStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/DeferredLegacyStyleInterpolationTest.cpp
index 53218feae..2b7b50bc 100644
--- a/third_party/WebKit/Source/core/animation/DeferredLegacyStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/DeferredLegacyStyleInterpolationTest.cpp
@@ -10,8 +10,7 @@
 #include "core/css/CSSValueList.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/parser/CSSParser.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/DoubleStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/DoubleStyleInterpolationTest.cpp
index e2384288..8220ee9 100644
--- a/third_party/WebKit/Source/core/animation/DoubleStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/DoubleStyleInterpolationTest.cpp
@@ -8,10 +8,9 @@
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValueList.h"
 #include "core/css/StylePropertySet.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/MathExtras.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 class AnimationDoubleStyleInterpolationTest : public ::testing::Test {
diff --git a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
index a0ec514..0b5ba0e9 100644
--- a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
+++ b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
@@ -13,7 +13,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/FilterStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/FilterStyleInterpolationTest.cpp
index a8a0148..4393e356 100644
--- a/third_party/WebKit/Source/core/animation/FilterStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/FilterStyleInterpolationTest.cpp
@@ -6,8 +6,7 @@
 #include "core/animation/FilterStyleInterpolation.h"
 
 #include "core/css/CSSPrimitiveValue.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp
index c6c67309..9d4ec0c 100644
--- a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp
+++ b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/animation/Interpolation.h"
 #include "core/animation/PropertyHandle.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp b/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp
index e632658..b76e500 100644
--- a/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp
+++ b/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/animation/InterpolationEffect.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp
index d60fa10..af67fb7 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModelTest.cpp
@@ -36,7 +36,7 @@
 #include "core/animation/animatable/AnimatableUnknown.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/dom/Element.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
index 938f5c3b..c2cd0396 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
@@ -18,7 +18,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/LengthBoxStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/LengthBoxStyleInterpolationTest.cpp
index ecbf795..adebc2e 100644
--- a/third_party/WebKit/Source/core/animation/LengthBoxStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/LengthBoxStyleInterpolationTest.cpp
@@ -9,8 +9,7 @@
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSQuadValue.h"
 #include "core/css/StylePropertySet.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/LengthPairStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/LengthPairStyleInterpolationTest.cpp
index 90de099..c23d630 100644
--- a/third_party/WebKit/Source/core/animation/LengthPairStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/LengthPairStyleInterpolationTest.cpp
@@ -9,8 +9,7 @@
 #include "core/css/CSSValue.h"
 #include "core/css/CSSValuePair.h"
 #include "core/css/StylePropertySet.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/LengthStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/LengthStyleInterpolationTest.cpp
index 7f36f7e..e6186b7 100644
--- a/third_party/WebKit/Source/core/animation/LengthStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/LengthStyleInterpolationTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/StylePropertySet.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/ListStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/ListStyleInterpolationTest.cpp
index 1e08c68..3f23b0c 100644
--- a/third_party/WebKit/Source/core/animation/ListStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/ListStyleInterpolationTest.cpp
@@ -6,8 +6,7 @@
 #include "core/animation/ListStyleInterpolation.h"
 
 #include "core/animation/LengthStyleInterpolation.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp b/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
index 4ce9ff4..c649cf4 100644
--- a/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
+++ b/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/SVGNames.h"
 #include "core/XLinkNames.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/SVGStrokeDasharrayStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/SVGStrokeDasharrayStyleInterpolationTest.cpp
index 8672d17..44d61c4 100644
--- a/third_party/WebKit/Source/core/animation/SVGStrokeDasharrayStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/SVGStrokeDasharrayStyleInterpolationTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValueList.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/TimingCalculationsTest.cpp b/third_party/WebKit/Source/core/animation/TimingCalculationsTest.cpp
index 2b1897f..fdc8a99 100644
--- a/third_party/WebKit/Source/core/animation/TimingCalculationsTest.cpp
+++ b/third_party/WebKit/Source/core/animation/TimingCalculationsTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/animation/TimingCalculations.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/TimingInputTest.cpp b/third_party/WebKit/Source/core/animation/TimingInputTest.cpp
index b0c7a428..8304d90 100644
--- a/third_party/WebKit/Source/core/animation/TimingInputTest.cpp
+++ b/third_party/WebKit/Source/core/animation/TimingInputTest.cpp
@@ -9,7 +9,7 @@
 #include "bindings/core/v8/V8KeyframeEffectOptions.h"
 #include "core/animation/AnimationEffectTiming.h"
 #include "core/animation/AnimationTestHelper.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/VisibilityStyleInterpolationTest.cpp b/third_party/WebKit/Source/core/animation/VisibilityStyleInterpolationTest.cpp
index 8c03b7e..c233595 100644
--- a/third_party/WebKit/Source/core/animation/VisibilityStyleInterpolationTest.cpp
+++ b/third_party/WebKit/Source/core/animation/VisibilityStyleInterpolationTest.cpp
@@ -3,8 +3,7 @@
 
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/StylePropertySet.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableColorTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableColorTest.cpp
index 2d4a4a8..c2d472a77 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableColorTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableColorTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/animation/animatable/AnimatableColor.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleAndBoolTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleAndBoolTest.cpp
index 3652c091..fe306e4 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleAndBoolTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleAndBoolTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/animation/animatable/AnimatableDoubleAndBool.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleTest.cpp
index 7bab3b08..ad69f387 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/animation/animatable/AnimatableDouble.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp
index fd65448..caba8d4b 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp
@@ -6,7 +6,7 @@
 #include "core/animation/animatable/AnimatableLength.h"
 
 #include "platform/CalculationValue.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp
index dfec141..cf848a8 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/animation/animatable/AnimatableNeutral.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableStrokeDasharrayListTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableStrokeDasharrayListTest.cpp
index d640205..8b23dfad 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableStrokeDasharrayListTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableStrokeDasharrayListTest.cpp
@@ -32,7 +32,7 @@
 #include "core/animation/animatable/AnimatableStrokeDasharrayList.h"
 
 #include "core/style/SVGComputedStyleDefs.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableUnknownTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableUnknownTest.cpp
index 390625d..c3cb247 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableUnknownTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableUnknownTest.cpp
@@ -33,7 +33,7 @@
 
 #include "core/animation/animatable/AnimatableNeutral.h"
 #include "core/css/CSSValuePool.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableValueTestHelperTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableValueTestHelperTest.cpp
index b2067a4..f1ff0a2 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableValueTestHelperTest.cpp
+++ b/third_party/WebKit/Source/core/animation/animatable/AnimatableValueTestHelperTest.cpp
@@ -35,8 +35,8 @@
 #include "core/style/BasicShapes.h"
 #include "platform/transforms/ScaleTransformOperation.h"
 #include "platform/transforms/TranslateTransformOperation.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include <sstream>
 #include <string>
 
diff --git a/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp b/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp
index 54bf87f2..4a73a4b 100644
--- a/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp
+++ b/third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp
@@ -8,7 +8,7 @@
 #include "core/clipboard/DataObjectItem.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index 7211e741..d64b19f 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -3816,6 +3816,7 @@
             'dom/StyleElementTest.cpp',
             'dom/TreeScopeStyleSheetCollectionTest.cpp',
             'dom/TreeScopeTest.cpp',
+            'dom/URLSearchParamsTest.cpp',
             'dom/shadow/ComposedTreeTraversalTest.cpp',
             'editing/EditingStrategyTest.cpp',
             'editing/EditingTestBase.cpp',
@@ -3863,6 +3864,7 @@
             'html/HTMLImageElementTest.cpp',
             'html/HTMLInputElementTest.cpp',
             'html/HTMLLinkElementSizesAttributeTest.cpp',
+            'html/HTMLOutputElementTest.cpp',
             'html/HTMLSelectElementTest.cpp',
             'html/HTMLTableRowElementTest.cpp',
             'html/HTMLTextFormControlElementTest.cpp',
diff --git a/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp b/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp
index a5da2fd..5928cf6 100644
--- a/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp
+++ b/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp
@@ -13,7 +13,7 @@
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLElement.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/CSSCalculationValueTest.cpp b/third_party/WebKit/Source/core/css/CSSCalculationValueTest.cpp
index 278764a..c7d2c88 100644
--- a/third_party/WebKit/Source/core/css/CSSCalculationValueTest.cpp
+++ b/third_party/WebKit/Source/core/css/CSSCalculationValueTest.cpp
@@ -36,9 +36,7 @@
 #include "core/css/StylePropertySet.h"
 #include "core/style/ComputedStyle.h"
 #include "core/style/StyleInheritedData.h"
-
-#include <gtest/gtest.h>
-
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/CSSFontFaceTest.cpp b/third_party/WebKit/Source/core/css/CSSFontFaceTest.cpp
index c377ad2..13fab49 100644
--- a/third_party/WebKit/Source/core/css/CSSFontFaceTest.cpp
+++ b/third_party/WebKit/Source/core/css/CSSFontFaceTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/css/CSSFontFace.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/CSSGridTemplateAreasValue.cpp b/third_party/WebKit/Source/core/css/CSSGridTemplateAreasValue.cpp
index f5ea076..42e0bad47 100644
--- a/third_party/WebKit/Source/core/css/CSSGridTemplateAreasValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSGridTemplateAreasValue.cpp
@@ -51,13 +51,13 @@
 
     for (const auto& item : gridAreaMap) {
         const GridCoordinate& coordinate = item.value;
-        if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row <= coordinate.rows.resolvedFinalPosition.toInt())
+        if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row < coordinate.rows.resolvedFinalPosition.toInt())
             candidates.append(item.key);
     }
 
     for (const auto& item : gridAreaMap) {
         const GridCoordinate& coordinate = item.value;
-        if (column >= coordinate.columns.resolvedInitialPosition.toInt() && column <= coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(item.key))
+        if (column >= coordinate.columns.resolvedInitialPosition.toInt() && column < coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(item.key))
             return item.key;
     }
 
diff --git a/third_party/WebKit/Source/core/css/CSSSelectorTest.cpp b/third_party/WebKit/Source/core/css/CSSSelectorTest.cpp
index f58c33bf..44afc9d45 100644
--- a/third_party/WebKit/Source/core/css/CSSSelectorTest.cpp
+++ b/third_party/WebKit/Source/core/css/CSSSelectorTest.cpp
@@ -6,7 +6,7 @@
 #include "core/css/CSSTestHelper.h"
 #include "core/css/RuleSet.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/CSSTestHelper.cpp b/third_party/WebKit/Source/core/css/CSSTestHelper.cpp
index 1efd9cf..200c4b2 100644
--- a/third_party/WebKit/Source/core/css/CSSTestHelper.cpp
+++ b/third_party/WebKit/Source/core/css/CSSTestHelper.cpp
@@ -35,10 +35,9 @@
 #include "core/css/RuleSet.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/Document.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/WTFString.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 CSSTestHelper::~CSSTestHelper()
diff --git a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
index 63685dd..a816f122 100644
--- a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
+++ b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
@@ -10,7 +10,7 @@
 #include "core/html/HTMLElement.h"
 #include "core/layout/LayoutObject.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
index 99a0cf2..6770c7e4 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
@@ -10,11 +10,10 @@
 #include "core/css/MediaValuesCached.h"
 #include "core/frame/FrameView.h"
 #include "core/testing/DummyPageHolder.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringBuilder.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 typedef struct {
diff --git a/third_party/WebKit/Source/core/css/MediaQueryListTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryListTest.cpp
index 33cb50b2..ce876454 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryListTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryListTest.cpp
@@ -9,7 +9,7 @@
 #include "core/css/MediaQueryListListener.h"
 #include "core/css/MediaQueryMatcher.h"
 #include "core/dom/Document.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp
index 6f6f8aa..3ce59b6 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp
@@ -8,8 +8,7 @@
 #include "core/MediaTypeNames.h"
 #include "core/css/MediaList.h"
 #include "core/testing/DummyPageHolder.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp b/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp
index 6a0cb2a..19d7f85 100644
--- a/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp
@@ -6,11 +6,10 @@
 #include "core/css/MediaQuery.h"
 
 #include "core/css/MediaList.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringBuilder.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 typedef struct {
diff --git a/third_party/WebKit/Source/core/css/MediaValuesTest.cpp b/third_party/WebKit/Source/core/css/MediaValuesTest.cpp
index 096fa01..789e102 100644
--- a/third_party/WebKit/Source/core/css/MediaValuesTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaValuesTest.cpp
@@ -6,10 +6,9 @@
 #include "core/css/MediaValues.h"
 
 #include "core/css/CSSPrimitiveValue.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/StringBuilder.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 struct TestCase {
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.cpp b/third_party/WebKit/Source/core/css/RuleFeature.cpp
index 0deb51645..afb5849ee 100644
--- a/third_party/WebKit/Source/core/css/RuleFeature.cpp
+++ b/third_party/WebKit/Source/core/css/RuleFeature.cpp
@@ -296,6 +296,8 @@
         case CSSSelector::PseudoOptional:
         case CSSSelector::PseudoPlaceholderShown:
         case CSSSelector::PseudoRequired:
+        case CSSSelector::PseudoReadOnly:
+        case CSSSelector::PseudoReadWrite:
         case CSSSelector::PseudoValid:
         case CSSSelector::PseudoInvalid:
         case CSSSelector::PseudoIndeterminate:
diff --git a/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp b/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
index 91f90bc..f4928ad 100644
--- a/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
+++ b/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
@@ -16,7 +16,7 @@
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLHtmlElement.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/RuleSetTest.cpp b/third_party/WebKit/Source/core/css/RuleSetTest.cpp
index 59d61f7..c0189bcf 100644
--- a/third_party/WebKit/Source/core/css/RuleSetTest.cpp
+++ b/third_party/WebKit/Source/core/css/RuleSetTest.cpp
@@ -31,8 +31,7 @@
 #include "core/css/RuleSet.h"
 
 #include "core/css/CSSTestHelper.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/invalidation/InvalidationSetTest.cpp b/third_party/WebKit/Source/core/css/invalidation/InvalidationSetTest.cpp
index b8b3c67..79523e5 100644
--- a/third_party/WebKit/Source/core/css/invalidation/InvalidationSetTest.cpp
+++ b/third_party/WebKit/Source/core/css/invalidation/InvalidationSetTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/css/invalidation/InvalidationSet.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserValuesTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserValuesTest.cpp
index 47664e92f..546ffe52 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserValuesTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserValuesTest.cpp
@@ -33,7 +33,7 @@
 
 #include "core/css/parser/CSSParserTokenRange.h"
 #include "core/css/parser/CSSTokenizer.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp
index dc58ef3e..c73ef9f 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/css/CSSValueList.h"
 #include "core/css/parser/CSSParser.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp
index 1d33aab..70dfc56 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/css/CSSSelectorList.h"
 #include "core/css/parser/CSSTokenizer.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp
index 4481a6f..567aa11 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp
@@ -7,8 +7,8 @@
 
 #include "core/css/parser/CSSParserTokenRange.h"
 #include "core/css/parser/MediaQueryBlockWatcher.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Partitions.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 3055b69..4a95d79 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -2970,20 +2970,20 @@
 
         // We handle several grid areas with the same name at once to simplify the validation code.
         size_t lookAheadCol;
-        for (lookAheadCol = currentCol; lookAheadCol < (columnCount - 1); ++lookAheadCol) {
-            if (columnNames[lookAheadCol + 1] != gridAreaName)
+        for (lookAheadCol = currentCol + 1; lookAheadCol < columnCount; ++lookAheadCol) {
+            if (columnNames[lookAheadCol] != gridAreaName)
                 break;
         }
 
         NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName);
         if (gridAreaIt == gridAreaMap.end()) {
-            gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan(rowCount, rowCount), GridSpan(currentCol, lookAheadCol)));
+            gridAreaMap.add(gridAreaName, GridCoordinate(GridSpan(rowCount, rowCount + 1), GridSpan(currentCol, lookAheadCol)));
         } else {
             GridCoordinate& gridCoordinate = gridAreaIt->value;
 
             // The following checks test that the grid area is a single filled-in rectangle.
             // 1. The new row is adjacent to the previously parsed row.
-            if (rowCount != gridCoordinate.rows.resolvedFinalPosition.next().toInt())
+            if (rowCount != gridCoordinate.rows.resolvedFinalPosition.toInt())
                 return false;
 
             // 2. The new area starts at the same position as the previously parsed area.
@@ -2996,7 +2996,7 @@
 
             ++gridCoordinate.rows.resolvedFinalPosition;
         }
-        currentCol = lookAheadCol;
+        currentCol = lookAheadCol - 1;
     }
 
     m_valueList->next();
diff --git a/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp b/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp
index 7ffdcaa..0bad5458 100644
--- a/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp
@@ -8,11 +8,10 @@
 #include "core/css/MediaQuery.h"
 #include "core/css/parser/CSSTokenizer.h"
 #include "core/css/parser/MediaQueryParser.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringBuilder.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 typedef struct {
diff --git a/third_party/WebKit/Source/core/css/parser/SizesAttributeParserTest.cpp b/third_party/WebKit/Source/core/css/parser/SizesAttributeParserTest.cpp
index f5a0dd39..2f43208 100644
--- a/third_party/WebKit/Source/core/css/parser/SizesAttributeParserTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/SizesAttributeParserTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/MediaTypeNames.h"
 #include "core/css/MediaValuesCached.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/parser/SizesCalcParserTest.cpp b/third_party/WebKit/Source/core/css/parser/SizesCalcParserTest.cpp
index b43a1fd3..037a5303 100644
--- a/third_party/WebKit/Source/core/css/parser/SizesCalcParserTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/SizesCalcParserTest.cpp
@@ -10,8 +10,7 @@
 #include "core/css/MediaValuesCached.h"
 #include "core/css/parser/CSSParser.h"
 #include "core/css/parser/CSSTokenizer.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp
index 99e51168..f68e4189 100644
--- a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp
@@ -12,8 +12,7 @@
 #include "core/style/ComputedStyle.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/text/LocaleToScriptMapping.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp b/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp
index 811ad21..5b72c2e 100644
--- a/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/MatchResultTest.cpp
@@ -6,7 +6,7 @@
 #include "core/css/resolver/MatchResult.h"
 
 #include "core/css/StylePropertySet.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
index ccdd337..4b0fbc24 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -526,7 +526,7 @@
         }
         {
             NamedGridLinesMap::AddResult endResult = namedGridLines.add(namedGridAreaEntry.key + "-end", Vector<size_t>());
-            endResult.storedValue->value.append(areaSpan.resolvedFinalPosition.toInt() + 1);
+            endResult.storedValue->value.append(areaSpan.resolvedFinalPosition.toInt());
             std::sort(endResult.storedValue->value.begin(), endResult.storedValue->value.end());
         }
     }
diff --git a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
index e87a6391..4ff6770 100644
--- a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
+++ b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
@@ -32,8 +32,8 @@
 
 #include "core/dom/Document.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/AttrTest.cpp b/third_party/WebKit/Source/core/dom/AttrTest.cpp
index 85fce9a..842f435 100644
--- a/third_party/WebKit/Source/core/dom/AttrTest.cpp
+++ b/third_party/WebKit/Source/core/dom/AttrTest.cpp
@@ -6,8 +6,8 @@
 #include "core/dom/Attr.h"
 
 #include "core/dom/Document.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/CrossThreadTaskTest.cpp b/third_party/WebKit/Source/core/dom/CrossThreadTaskTest.cpp
index 428e4e73..2a74e26 100644
--- a/third_party/WebKit/Source/core/dom/CrossThreadTaskTest.cpp
+++ b/third_party/WebKit/Source/core/dom/CrossThreadTaskTest.cpp
@@ -6,7 +6,7 @@
 #include "core/dom/CrossThreadTask.h"
 
 #include "platform/heap/Handle.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/DOMImplementationTest.cpp b/third_party/WebKit/Source/core/dom/DOMImplementationTest.cpp
index f6c8b764..797b569 100644
--- a/third_party/WebKit/Source/core/dom/DOMImplementationTest.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMImplementationTest.cpp
@@ -30,8 +30,8 @@
 #include "config.h"
 #include "core/dom/DOMImplementation.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
index fcf1213..97f1095 100644
--- a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
+++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
@@ -12,11 +12,10 @@
 #include "core/html/HTMLLinkElement.h"
 #include "core/testing/DummyPageHolder.h"
 #include "public/platform/WebDistillability.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/StringBuilder.h"
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
 namespace blink {
 
 // Saturate the length of a paragraph to save time.
diff --git a/third_party/WebKit/Source/core/dom/DocumentTest.cpp b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
index 6cf14d3..40f3fe3 100644
--- a/third_party/WebKit/Source/core/dom/DocumentTest.cpp
+++ b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
@@ -39,8 +39,8 @@
 #include "platform/heap/Handle.h"
 #include "platform/weborigin/ReferrerPolicy.h"
 #include "platform/weborigin/SecurityOrigin.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp b/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp
index 082fdf3..e2e9f37 100644
--- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp
+++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp
@@ -32,10 +32,10 @@
 #include "core/testing/NullExecutionContext.h"
 #include "platform/heap/Handle.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Forward.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp b/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp
index 34bbb4a..946b030 100644
--- a/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp
+++ b/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp
@@ -8,7 +8,7 @@
 #include "core/dom/Document.h"
 #include "core/html/HTMLElement.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/RangeTest.cpp b/third_party/WebKit/Source/core/dom/RangeTest.cpp
index 58629bd..88d5d40 100644
--- a/third_party/WebKit/Source/core/dom/RangeTest.cpp
+++ b/third_party/WebKit/Source/core/dom/RangeTest.cpp
@@ -14,10 +14,10 @@
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "platform/heap/Handle.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Compiler.h"
 #include "wtf/RefPtr.h"
 #include "wtf/text/AtomicString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
index 857c4a4a..b9668ec 100644
--- a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
@@ -12,8 +12,8 @@
 #include "platform/scheduler/CancellableTaskFactory.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebViewScheduler.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using ::testing::Invoke;
 using ::testing::ElementsAre;
diff --git a/third_party/WebKit/Source/core/dom/StyleElementTest.cpp b/third_party/WebKit/Source/core/dom/StyleElementTest.cpp
index 400de285..2e15ecb 100644
--- a/third_party/WebKit/Source/core/dom/StyleElementTest.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleElementTest.cpp
@@ -9,7 +9,7 @@
 #include "core/dom/Comment.h"
 #include "core/html/HTMLStyleElement.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollectionTest.cpp b/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollectionTest.cpp
index 17a3731..cf020719 100644
--- a/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollectionTest.cpp
+++ b/third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollectionTest.cpp
@@ -8,7 +8,7 @@
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/css/parser/CSSParserMode.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/TreeScopeTest.cpp b/third_party/WebKit/Source/core/dom/TreeScopeTest.cpp
index 9239828..cdebb83 100644
--- a/third_party/WebKit/Source/core/dom/TreeScopeTest.cpp
+++ b/third_party/WebKit/Source/core/dom/TreeScopeTest.cpp
@@ -8,7 +8,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/shadow/ShadowRoot.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/URLSearchParams.cpp b/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
index 141aab146..b8108c7 100644
--- a/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
+++ b/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
@@ -5,6 +5,7 @@
 #include "config.h"
 #include "core/dom/URLSearchParams.h"
 
+#include "platform/network/FormDataEncoder.h"
 #include "platform/weborigin/KURL.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/TextEncoding.h"
@@ -176,6 +177,16 @@
         append(name, value);
 }
 
+PassRefPtr<EncodedFormData> URLSearchParams::encodeFormData() const
+{
+    RefPtr<EncodedFormData> data = EncodedFormData::create();
+    Vector<char> encodedData;
+    for (const auto& param : m_params)
+        FormDataEncoder::addKeyValuePairAsFormData(encodedData, param.first.utf8(), param.second.utf8(), EncodedFormData::FormURLEncoded);
+    data->appendData(encodedData.data(), encodedData.size());
+    return data.release();
+}
+
 DEFINE_TRACE(URLSearchParams)
 {
 }
diff --git a/third_party/WebKit/Source/core/dom/URLSearchParams.h b/third_party/WebKit/Source/core/dom/URLSearchParams.h
index 7eb3dfb..18677ee 100644
--- a/third_party/WebKit/Source/core/dom/URLSearchParams.h
+++ b/third_party/WebKit/Source/core/dom/URLSearchParams.h
@@ -9,6 +9,7 @@
 #include "bindings/core/v8/ScriptWrappable.h"
 #include "bindings/core/v8/UnionTypesCore.h"
 #include "platform/heap/Handle.h"
+#include "platform/network/EncodedFormData.h"
 #include "wtf/Forward.h"
 #include "wtf/text/WTFString.h"
 #include <utility>
@@ -43,9 +44,14 @@
     void set(const String& name, const String& value);
     void setInput(const String&);
 
+    // Internal helpers
+    PassRefPtr<EncodedFormData> encodeFormData() const;
+
     DECLARE_TRACE();
 
 private:
+    friend class URLSearchParamsTest_EncodedFormData_Test;
+
     explicit URLSearchParams(const String&);
     explicit URLSearchParams(URLSearchParams*);
     Vector<std::pair<String, String>> m_params;
diff --git a/third_party/WebKit/Source/core/dom/URLSearchParamsTest.cpp b/third_party/WebKit/Source/core/dom/URLSearchParamsTest.cpp
new file mode 100644
index 0000000..9f883473
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/URLSearchParamsTest.cpp
@@ -0,0 +1,26 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/dom/URLSearchParams.h"
+
+#include <gtest/gtest.h>
+
+namespace blink {
+
+using URLSearchParamsTest = ::testing::Test;
+
+TEST_F(URLSearchParamsTest, EncodedFormData)
+{
+    URLSearchParams* params = new URLSearchParams(String());
+    EXPECT_EQ("", params->encodeFormData()->flattenToString());
+
+    params->append("name", "value");
+    EXPECT_EQ("name=value", params->encodeFormData()->flattenToString());
+
+    params->append("another name", "another value");
+    EXPECT_EQ("name=value&another+name=another+value", params->encodeFormData()->flattenToString());
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversalTest.cpp b/third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversalTest.cpp
index faf40e9c..66fb250 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversalTest.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversalTest.cpp
@@ -16,13 +16,13 @@
 #include "core/html/HTMLElement.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/geometry/IntSize.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Compiler.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/editing/EditingBehavior.h b/third_party/WebKit/Source/core/editing/EditingBehavior.h
index 2a500e34..2c4cce6 100644
--- a/third_party/WebKit/Source/core/editing/EditingBehavior.h
+++ b/third_party/WebKit/Source/core/editing/EditingBehavior.h
@@ -47,6 +47,11 @@
         return m_type != EditingWindowsBehavior && m_type != EditingAndroidBehavior;
     }
 
+    bool shouldSelectReplacement() const
+    {
+        return m_type == EditingAndroidBehavior;
+    }
+
     // On Windows, selections should always be considered as directional, regardless if it is
     // mouse-based or keyboard-based.
     bool shouldConsiderSelectionAsDirectional() const { return m_type != EditingMacBehavior; }
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
index f76a5ec..3f382d4 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -18,11 +18,11 @@
 #include "core/testing/DummyPageHolder.h"
 #include "platform/graphics/paint/DrawingRecorder.h"
 #include "platform/graphics/paint/PaintController.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/StdLibExtras.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp
index 0e866b57..8b8c8af 100644
--- a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp
+++ b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp
@@ -16,11 +16,11 @@
 #include "core/html/HTMLDocument.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/heap/Handle.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/StdLibExtras.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
index 2fc9e242..a263acb6 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -12,7 +12,7 @@
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp
index 052cdfc..a524b4d 100644
--- a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp
+++ b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp
@@ -12,7 +12,7 @@
 #include "core/editing/VisibleSelection.h"
 #include "core/html/HTMLElement.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp
index fc068d6..33772ff 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp
@@ -39,9 +39,9 @@
 #include "core/editing/markers/RenderedDocumentMarker.h"
 #include "core/html/HTMLElement.h"
 #include "core/testing/DummyPageHolder.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/events/EventPathTest.cpp b/third_party/WebKit/Source/core/events/EventPathTest.cpp
index 653b0823..776e833 100644
--- a/third_party/WebKit/Source/core/events/EventPathTest.cpp
+++ b/third_party/WebKit/Source/core/events/EventPathTest.cpp
@@ -10,7 +10,7 @@
 #include "core/dom/PseudoElement.h"
 #include "core/style/ComputedStyleConstants.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp b/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
index 31e1b78..5d9ae1960 100644
--- a/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
+++ b/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/dom/DOMException.h"
 #include "core/dom/ExceptionCode.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
index 260b95f..99066f6 100644
--- a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -39,9 +39,9 @@
 #include "core/fetch/ResourcePtr.h"
 #include "platform/network/ResourceRequest.h"
 #include "public/platform/Platform.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fetch/ClientHintsPreferencesTest.cpp b/third_party/WebKit/Source/core/fetch/ClientHintsPreferencesTest.cpp
index 285ec4a..33f0405b 100644
--- a/third_party/WebKit/Source/core/fetch/ClientHintsPreferencesTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ClientHintsPreferencesTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/fetch/ClientHintsPreferences.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fetch/FetchUtilsTest.cpp b/third_party/WebKit/Source/core/fetch/FetchUtilsTest.cpp
index b13dd347..5c0a642 100644
--- a/third_party/WebKit/Source/core/fetch/FetchUtilsTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/FetchUtilsTest.cpp
@@ -5,10 +5,9 @@
 #include "config.h"
 #include "core/fetch/FetchUtils.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/WTFString.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 namespace {
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
index 78a1ca6..3aac6a4 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -47,8 +47,7 @@
 #include "public/platform/WebURL.h"
 #include "public/platform/WebURLResponse.h"
 #include "public/platform/WebUnitTestSupport.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
index fc41bf8..2cd0334 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
@@ -37,10 +37,9 @@
 #include "platform/network/ResourceRequest.h"
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/platform/Platform.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 class MemoryCacheTest : public ::testing::Test {
diff --git a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp b/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp
index 6c15a45..cf3bead5 100644
--- a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp
+++ b/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp
@@ -7,8 +7,7 @@
 
 #include "core/fetch/ImageResource.h"
 #include "core/fetch/ResourcePtr.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp b/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
index 09551e3..e16c9b3 100644
--- a/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResourceTest.cpp
@@ -42,8 +42,7 @@
 #include "public/platform/WebURL.h"
 #include "public/platform/WebURLResponse.h"
 #include "public/platform/WebUnitTestSupport.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
index d41fcba..73210de 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -44,7 +44,7 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebURLResponse.h"
 #include "public/platform/WebUnitTestSupport.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoaderOptionsTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoaderOptionsTest.cpp
index 6789351..c166ffe0f 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceLoaderOptionsTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceLoaderOptionsTest.cpp
@@ -5,10 +5,9 @@
 #include "config.h"
 #include "core/fetch/ResourceLoaderOptions.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/TypeTraits.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 namespace {
diff --git a/third_party/WebKit/Source/core/fetch/ResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceTest.cpp
index 6ad9f3c..143d942f 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceTest.cpp
@@ -10,8 +10,8 @@
 #include "platform/network/ResourceResponse.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "public/platform/Platform.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fileapi/FileListTest.cpp b/third_party/WebKit/Source/core/fileapi/FileListTest.cpp
index 23c26630..66317380 100644
--- a/third_party/WebKit/Source/core/fileapi/FileListTest.cpp
+++ b/third_party/WebKit/Source/core/fileapi/FileListTest.cpp
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 #include "config.h"
-#include "FileList.h"
+#include "core/fileapi/FileList.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/fileapi/FileTest.cpp b/third_party/WebKit/Source/core/fileapi/FileTest.cpp
index d4945777..7bb89c1 100644
--- a/third_party/WebKit/Source/core/fileapi/FileTest.cpp
+++ b/third_party/WebKit/Source/core/fileapi/FileTest.cpp
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 #include "config.h"
-#include "File.h"
+#include "core/fileapi/File.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
index bae0e24..64a96d1 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -44,12 +44,11 @@
 #include "platform/graphics/StaticBitmapImage.h"
 #include "platform/heap/Handle.h"
 #include "platform/network/ResourceRequest.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkImage.h"
 #include "third_party/skia/include/core/SkSurface.h"
 #include "wtf/OwnPtr.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 class ImageBitmapTest : public ::testing::Test {
diff --git a/third_party/WebKit/Source/core/frame/OriginsUsingFeaturesTest.cpp b/third_party/WebKit/Source/core/frame/OriginsUsingFeaturesTest.cpp
index 797ef15..c023c68 100644
--- a/third_party/WebKit/Source/core/frame/OriginsUsingFeaturesTest.cpp
+++ b/third_party/WebKit/Source/core/frame/OriginsUsingFeaturesTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/frame/OriginsUsingFeatures.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
index cf5dc16..4f2d491c 100644
--- a/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
+++ b/third_party/WebKit/Source/core/frame/RootFrameViewportTest.cpp
@@ -3,15 +3,13 @@
 // found in the LICENSE file.
 
 #include "config.h"
-
 #include "core/frame/RootFrameViewport.h"
 
 #include "core/layout/ScrollAlignment.h"
 #include "platform/geometry/DoubleRect.h"
 #include "platform/geometry/LayoutRect.h"
 #include "platform/scroll/ScrollableArea.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 #define EXPECT_POINT_EQ(expected, actual) \
     do { \
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index 7197833..4d29392 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -884,6 +884,7 @@
         CSSFilterBlur = 1023,
         CSSFilterDropShadow = 1024,
         BackgroundSyncRegister = 1025,
+        BorderImageWithBorderStyleNone = 1026,
 
         // Add new features immediately above this line. Don't change assigned
         // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/WebKit/Source/core/frame/UseCounterTest.cpp b/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
index 8db0aa8..8d244b1 100644
--- a/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
+++ b/third_party/WebKit/Source/core/frame/UseCounterTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/frame/UseCounter.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
index 106e8e7..ba4118f 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp
@@ -11,7 +11,7 @@
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SchemeRegistry.h"
 #include "platform/weborigin/SecurityOrigin.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
index 0fbe817..11b239b 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
@@ -9,7 +9,7 @@
 #include "core/frame/csp/ContentSecurityPolicy.h"
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityOrigin.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
index ab4974b..7c92d2b 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
@@ -12,7 +12,7 @@
 #include "platform/network/ResourceRequest.h"
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityOrigin.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/FormDataTest.cpp b/third_party/WebKit/Source/core/html/FormDataTest.cpp
index 3e69279..c7b21a08 100644
--- a/third_party/WebKit/Source/core/html/FormDataTest.cpp
+++ b/third_party/WebKit/Source/core/html/FormDataTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/FormData.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLDimensionTest.cpp b/third_party/WebKit/Source/core/html/HTMLDimensionTest.cpp
index c049f5d..f990832 100644
--- a/third_party/WebKit/Source/core/html/HTMLDimensionTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLDimensionTest.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "core/html/HTMLDimension.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
index 54d22d6..d4d2c49 100644
--- a/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp
@@ -172,7 +172,8 @@
         m_isReadOnly = !value.isNull();
         if (wasReadOnly != m_isReadOnly) {
             setNeedsWillValidateCheck();
-            setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAttribute(name));
+            pseudoStateChanged(CSSSelector::PseudoReadOnly);
+            pseudoStateChanged(CSSSelector::PseudoReadWrite);
             if (layoutObject())
                 LayoutTheme::theme().controlStateChanged(*layoutObject(), ReadOnlyControlState);
         }
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp
index 5f02e88..2e26776 100644
--- a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp
@@ -11,7 +11,7 @@
 #include "core/layout/LayoutObject.h"
 #include "core/loader/EmptyClients.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp
index d453af7..51046607 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp
@@ -8,7 +8,7 @@
 #include "core/dom/Document.h"
 #include "core/frame/FrameView.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
index c3dd8a6..36c8593 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
@@ -9,7 +9,7 @@
 #include "core/html/HTMLBodyElement.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp
index c0d4163..9586d35 100644
--- a/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp
@@ -8,7 +8,7 @@
 #include "core/HTMLNames.h"
 #include "core/dom/DOMSettableTokenList.h"
 #include "core/dom/Document.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLOutputElement.cpp b/third_party/WebKit/Source/core/html/HTMLOutputElement.cpp
index 896bf121..22aaf4a7 100644
--- a/third_party/WebKit/Source/core/html/HTMLOutputElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLOutputElement.cpp
@@ -40,10 +40,17 @@
     : HTMLFormControlElement(HTMLNames::outputTag, document, form)
     , m_isDefaultValueMode(true)
     , m_defaultValue("")
-    , m_tokens(DOMSettableTokenList::create())
+    , m_tokens(DOMSettableTokenList::create(this))
 {
 }
 
+HTMLOutputElement::~HTMLOutputElement()
+{
+#if !ENABLE(OILPAN)
+    m_tokens->setObserver(nullptr);
+#endif
+}
+
 PassRefPtrWillBeRawPtr<HTMLOutputElement> HTMLOutputElement::create(Document& document, HTMLFormElement* form)
 {
     return adoptRefWillBeNoop(new HTMLOutputElement(document, form));
@@ -111,6 +118,11 @@
     setTextContent(value);
 }
 
+void HTMLOutputElement::valueWasSet()
+{
+    setSynchronizedLazyAttribute(HTMLNames::forAttr, m_tokens->value());
+}
+
 String HTMLOutputElement::defaultValue() const
 {
     return m_defaultValue;
@@ -132,6 +144,7 @@
 {
     visitor->trace(m_tokens);
     HTMLFormControlElement::trace(visitor);
+    DOMSettableTokenListObserver::trace(visitor);
 }
 
 } // namespace
diff --git a/third_party/WebKit/Source/core/html/HTMLOutputElement.h b/third_party/WebKit/Source/core/html/HTMLOutputElement.h
index 5a811b8..cb905f0 100644
--- a/third_party/WebKit/Source/core/html/HTMLOutputElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLOutputElement.h
@@ -36,10 +36,12 @@
 
 namespace blink {
 
-class HTMLOutputElement final : public HTMLFormControlElement {
+class CORE_EXPORT HTMLOutputElement final : public HTMLFormControlElement, private DOMSettableTokenListObserver {
     DEFINE_WRAPPERTYPEINFO();
+    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLOutputElement);
 public:
     static PassRefPtrWillBeRawPtr<HTMLOutputElement> create(Document&, HTMLFormElement*);
+    ~HTMLOutputElement() override;
 
     bool willValidate() const override { return false; }
 
@@ -65,6 +67,8 @@
     void childrenChanged(const ChildrenChange&) override;
     void resetImpl() override;
 
+    void valueWasSet() final;
+
     bool m_isDefaultValueMode;
     String m_defaultValue;
     RefPtrWillBeMember<DOMSettableTokenList> m_tokens;
diff --git a/third_party/WebKit/Source/core/html/HTMLOutputElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLOutputElementTest.cpp
new file mode 100644
index 0000000..55f809e
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/HTMLOutputElementTest.cpp
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/html/HTMLOutputElement.h"
+
+#include "core/HTMLNames.h"
+#include "core/dom/DOMSettableTokenList.h"
+#include "core/dom/Document.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(HTMLLinkElementSizesAttributeTest, setHTMLForProperty_updatesForAttribute)
+{
+    RefPtrWillBeRawPtr<Document> document = Document::create();
+    RefPtrWillBeRawPtr<HTMLOutputElement> element = HTMLOutputElement::create(*document, /* form: */ nullptr);
+    EXPECT_EQ(nullAtom, element->getAttribute(HTMLNames::forAttr));
+    element->htmlFor()->setValue("  strawberry ");
+    EXPECT_EQ("  strawberry ", element->getAttribute(HTMLNames::forAttr));
+}
+
+TEST(HTMLOutputElementTest, setForAttribute_updatesHTMLForPropertyValue)
+{
+    RefPtrWillBeRawPtr<Document> document = Document::create();
+    RefPtrWillBeRawPtr<HTMLOutputElement> element = HTMLOutputElement::create(*document, nullptr);
+    RefPtrWillBeRawPtr<DOMSettableTokenList> forTokens = element->htmlFor();
+    EXPECT_EQ(nullAtom, forTokens->value());
+    element->setAttribute(HTMLNames::forAttr, "orange grape");
+    EXPECT_EQ("orange grape", forTokens->value());
+}
+
+}
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
index bd0b72e..0a7a25ce 100644
--- a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
@@ -10,7 +10,7 @@
 #include "core/html/forms/FormController.h"
 #include "core/loader/EmptyClients.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLTableRowElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLTableRowElementTest.cpp
index f89f252..221f7b6 100644
--- a/third_party/WebKit/Source/core/html/HTMLTableRowElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTableRowElementTest.cpp
@@ -8,7 +8,7 @@
 #include "core/dom/Document.h"
 #include "core/html/HTMLParagraphElement.h"
 #include "core/html/HTMLTableElement.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
 
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp
index 935452d..2ff8c82 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp
@@ -21,8 +21,8 @@
 #include "core/page/SpellCheckerClient.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp b/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp
index d8d679b..36af255 100644
--- a/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp
+++ b/third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp
@@ -32,8 +32,8 @@
 #include "core/html/LinkRelAttribute.h"
 
 #include "platform/RuntimeEnabledFeatures.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/CString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/TimeRangesTest.cpp b/third_party/WebKit/Source/core/html/TimeRangesTest.cpp
index ed2a928..cf30053 100644
--- a/third_party/WebKit/Source/core/html/TimeRangesTest.cpp
+++ b/third_party/WebKit/Source/core/html/TimeRangesTest.cpp
@@ -32,7 +32,7 @@
 #include "core/html/TimeRanges.h"
 
 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <sstream>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp
index abd0994..6245573 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp
@@ -5,7 +5,6 @@
 #include "config.h"
 #include "core/html/canvas/CanvasFontCache.h"
 
-
 #include "core/frame/FrameView.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/canvas/CanvasContextCreationAttributes.h"
@@ -13,8 +12,8 @@
 #include "core/loader/EmptyClients.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using ::testing::Mock;
 
diff --git a/third_party/WebKit/Source/core/html/forms/EmailInputTypeTest.cpp b/third_party/WebKit/Source/core/html/forms/EmailInputTypeTest.cpp
index 5c1a6569..8286283 100644
--- a/third_party/WebKit/Source/core/html/forms/EmailInputTypeTest.cpp
+++ b/third_party/WebKit/Source/core/html/forms/EmailInputTypeTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/forms/EmailInputType.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/forms/FileInputTypeTest.cpp b/third_party/WebKit/Source/core/html/forms/FileInputTypeTest.cpp
index f5b96b4..cb1e012 100644
--- a/third_party/WebKit/Source/core/html/forms/FileInputTypeTest.cpp
+++ b/third_party/WebKit/Source/core/html/forms/FileInputTypeTest.cpp
@@ -3,15 +3,15 @@
 // found in the LICENSE file.
 
 #include "config.h"
-#include "FileInputType.h"
+#include "core/html/forms/FileInputType.h"
 
 #include "core/clipboard/DataObject.h"
 #include "core/dom/Document.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/page/DragData.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/DateMath.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp b/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
index ccdf0c6..5d0a083 100644
--- a/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
+++ b/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/forms/StepRange.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/AtomicHTMLTokenTest.cpp b/third_party/WebKit/Source/core/html/parser/AtomicHTMLTokenTest.cpp
index 2dcaaf3a..c6ac43a 100644
--- a/third_party/WebKit/Source/core/html/parser/AtomicHTMLTokenTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/AtomicHTMLTokenTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/parser/AtomicHTMLToken.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp b/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp
index f35767b..4946e11 100644
--- a/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/parser/CompactHTMLToken.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLEntityParserTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLEntityParserTest.cpp
index 6f393e32..dde8f8d5 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLEntityParserTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLEntityParserTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/parser/HTMLEntityParser.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserThreadTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserThreadTest.cpp
index c1385bf..1380023 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserThreadTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserThreadTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/parser/HTMLParserThread.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
index c6cadc1..6c16b92 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
@@ -13,7 +13,7 @@
 #include "core/html/parser/HTMLParserOptions.h"
 #include "core/html/parser/HTMLResourcePreloader.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp
index 7922052..f85cd86 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/html/parser/PreloadRequest.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLSrcsetParserTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLSrcsetParserTest.cpp
index 9b9b063..9fbef79 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLSrcsetParserTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLSrcsetParserTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/html/parser/HTMLSrcsetParser.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <limits.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
index fb0c417..b94fc84 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -12,7 +12,7 @@
 #include "core/html/HTMLVideoElement.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/heap/Handle.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/track/vtt/BufferedLineReaderTest.cpp b/third_party/WebKit/Source/core/html/track/vtt/BufferedLineReaderTest.cpp
index 067abae8..b5e6458 100644
--- a/third_party/WebKit/Source/core/html/track/vtt/BufferedLineReaderTest.cpp
+++ b/third_party/WebKit/Source/core/html/track/vtt/BufferedLineReaderTest.cpp
@@ -31,10 +31,10 @@
 #include "config.h"
 #include "core/html/track/vtt/BufferedLineReader.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/CharacterNames.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTScannerTest.cpp b/third_party/WebKit/Source/core/html/track/vtt/VTTScannerTest.cpp
index 3c8a4fd3..9c4ae80 100644
--- a/third_party/WebKit/Source/core/html/track/vtt/VTTScannerTest.cpp
+++ b/third_party/WebKit/Source/core/html/track/vtt/VTTScannerTest.cpp
@@ -30,8 +30,8 @@
 #include "config.h"
 #include "core/html/track/vtt/VTTScanner.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
index 8c4fbca..5b70070 100644
--- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -16,7 +16,7 @@
 #include "core/page/Page.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/PlatformMouseEvent.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
index fb1482f..8109767 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -528,41 +528,37 @@
     m_inspectorResourceContentLoader->ensureResourcesContentLoaded(bind(&InspectorPageAgent::getResourceContentAfterResourcesContentLoaded, this, frameId, url, callback));
 }
 
-static bool textContentForResource(Resource* cachedResource, String* result)
+void InspectorPageAgent::searchContentAfterResourcesContentLoaded(const String& frameId, const String& url, const String& query, bool caseSensitive, bool isRegex, PassRefPtrWillBeRawPtr<SearchInResourceCallback> callback)
 {
-    if (hasTextContent(cachedResource)) {
-        String content;
-        bool base64Encoded;
-        if (InspectorPageAgent::cachedResourceContent(cachedResource, result, &base64Encoded)) {
-            ASSERT(!base64Encoded);
-            return true;
-        }
-    }
-    return false;
-}
-
-void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>>& results)
-{
-    results = TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>::create();
+    if (!callback->isActive())
+        return;
 
     LocalFrame* frame = IdentifiersFactory::frameById(m_inspectedFrames, frameId);
-    KURL kurl(ParsedURLString, url);
-
-    FrameLoader* frameLoader = frame ? &frame->loader() : nullptr;
-    DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : nullptr;
-    if (!loader)
+    if (!frame) {
+        callback->sendFailure("No frame for given id found");
         return;
-
+    }
+    ErrorString errorString;
     String content;
-    bool success = false;
-    Resource* resource = cachedResource(frame, kurl);
-    if (resource)
-        success = textContentForResource(resource, &content);
-
-    if (!success)
+    bool base64Encoded;
+    resourceContent(&errorString, frame, KURL(ParsedURLString, url), &content, &base64Encoded);
+    if (!errorString.isEmpty()) {
+        callback->sendFailure(errorString);
         return;
+    }
 
-    results = ContentSearchUtils::searchInTextByLines(content, query, asBool(optionalCaseSensitive), asBool(optionalIsRegex));
+    RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>> results;
+    results = ContentSearchUtils::searchInTextByLines(content, query, caseSensitive, isRegex);
+    callback->sendSuccess(results);
+}
+
+void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, PassRefPtrWillBeRawPtr<SearchInResourceCallback> callback)
+{
+    if (!m_enabled) {
+        callback->sendFailure("Agent is not enabled.");
+        return;
+    }
+    m_inspectorResourceContentLoader->ensureResourcesContentLoaded(bind(&InspectorPageAgent::searchContentAfterResourcesContentLoaded, this, frameId, url, query, asBool(optionalCaseSensitive), asBool(optionalIsRegex), callback));
 }
 
 void InspectorPageAgent::setDocumentContent(ErrorString* errorString, const String& frameId, const String& html)
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.h b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.h
index 2255b9a5..1f4f4e5 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.h
@@ -101,7 +101,7 @@
     void navigate(ErrorString*, const String& url, String* frameId) override;
     void getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>&) override;
     void getResourceContent(ErrorString*, const String& frameId, const String& url, PassRefPtrWillBeRawPtr<GetResourceContentCallback>) override;
-    void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>>&) override;
+    void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, PassRefPtrWillBeRawPtr<SearchInResourceCallback>) override;
     void setDocumentContent(ErrorString*, const String& frameId, const String& html) override;
     void startScreencast(ErrorString*, const String* format, const int* quality, const int* maxWidth, const int* maxHeight) override;
     void stopScreencast(ErrorString*) override;
@@ -136,6 +136,7 @@
 
     void finishReload();
     void getResourceContentAfterResourcesContentLoaded(const String& frameId, const String& url, PassRefPtrWillBeRawPtr<GetResourceContentCallback>);
+    void searchContentAfterResourcesContentLoaded(const String& frameId, const String& url, const String& query, bool caseSensitive, bool isRegex, PassRefPtrWillBeRawPtr<SearchInResourceCallback>);
 
     static bool dataContent(const char* data, unsigned size, const String& textEncodingName, bool withBase64Encode, String* result);
 
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
index bd1fbe0..08222b2 100644
--- a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
+++ b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
@@ -9,8 +9,7 @@
 #include "core/layout/LayoutTestHelper.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/paint/PaintController.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
index d1f0bd9..38a2249 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/layout/LayoutBlockFlow.h"
 #include "core/layout/LayoutTestHelper.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index 840777d..1f24ae7 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -209,7 +209,7 @@
         const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_grid.size() : m_grid[0].size();
         for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex) {
             if (checkEmptyCells(rowSpan, columnSpan)) {
-                OwnPtr<GridCoordinate> result = adoptPtr(new GridCoordinate(GridSpan(m_rowIndex, m_rowIndex + rowSpan - 1), GridSpan(m_columnIndex, m_columnIndex + columnSpan - 1)));
+                OwnPtr<GridCoordinate> result = adoptPtr(new GridCoordinate(GridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan(m_columnIndex, m_columnIndex + columnSpan)));
                 // Advance the iterator to avoid an infinite loop where we would return the same grid area over and over.
                 ++varyingTrackIndex;
                 return result.release();
@@ -536,7 +536,7 @@
     // 4. Grow all Grid tracks having a fraction as the MaxTrackSizingFunction.
     double flexFraction = 0;
     if (hasDefiniteFreeSpace) {
-        flexFraction = findFlexFactorUnitSize(tracks, GridSpan(0, tracks.size() - 1), direction, initialFreeSpace);
+        flexFraction = findFlexFactorUnitSize(tracks, GridSpan(0, tracks.size()), direction, initialFreeSpace);
     } else {
         for (const auto& trackIndex : flexibleSizedTracksIndex)
             flexFraction = std::max(flexFraction, normalizedFlexFraction(tracks[trackIndex], gridTrackSize(direction, trackIndex).maxTrackBreadth().flex()));
@@ -784,10 +784,7 @@
 
 bool LayoutGrid::spanningItemCrossesFlexibleSizedTracks(const GridSpan& span, GridTrackSizingDirection direction) const
 {
-    const GridResolvedPosition initialTrackPosition = span.resolvedInitialPosition;
-    const GridResolvedPosition finalTrackPosition = span.resolvedFinalPosition;
-
-    for (GridResolvedPosition trackPosition = initialTrackPosition; trackPosition <= finalTrackPosition; ++trackPosition) {
+    for (const auto& trackPosition : span) {
         const GridTrackSize& trackSize = gridTrackSize(direction, trackPosition.toInt());
         if (trackSize.minTrackBreadth().isFlex() || trackSize.maxTrackBreadth().isFlex())
             return true;
@@ -1091,18 +1088,18 @@
 }
 #endif
 
-void LayoutGrid::ensureGridSize(size_t maximumRowIndex, size_t maximumColumnIndex)
+void LayoutGrid::ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize)
 {
     const size_t oldRowSize = gridRowCount();
-    if (maximumRowIndex >= oldRowSize) {
-        m_grid.grow(maximumRowIndex + 1);
+    if (maximumRowSize > oldRowSize) {
+        m_grid.grow(maximumRowSize);
         for (size_t row = oldRowSize; row < gridRowCount(); ++row)
             m_grid[row].grow(gridColumnCount());
     }
 
-    if (maximumColumnIndex >= gridColumnCount()) {
+    if (maximumColumnSize > gridColumnCount()) {
         for (size_t row = 0; row < gridRowCount(); ++row)
-            m_grid[row].grow(maximumColumnIndex + 1);
+            m_grid[row].grow(maximumColumnSize);
     }
 }
 
@@ -1181,19 +1178,19 @@
 
         // |positions| is 0 if we need to run the auto-placement algorithm.
         if (rowPositions) {
-            maximumRowIndex = std::max<size_t>(maximumRowIndex, rowPositions->resolvedFinalPosition.next().toInt());
+            maximumRowIndex = std::max<size_t>(maximumRowIndex, rowPositions->resolvedFinalPosition.toInt());
         } else {
             // Grow the grid for items with a definite row span, getting the largest such span.
             GridSpan positions = GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(*style(), *child, ForRows, GridResolvedPosition(0));
-            maximumRowIndex = std::max<size_t>(maximumRowIndex, positions.resolvedFinalPosition.next().toInt());
+            maximumRowIndex = std::max<size_t>(maximumRowIndex, positions.resolvedFinalPosition.toInt());
         }
 
         if (columnPositions) {
-            maximumColumnIndex = std::max<size_t>(maximumColumnIndex, columnPositions->resolvedFinalPosition.next().toInt());
+            maximumColumnIndex = std::max<size_t>(maximumColumnIndex, columnPositions->resolvedFinalPosition.toInt());
         } else {
             // Grow the grid for items with a definite column span, getting the largest such span.
             GridSpan positions = GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(*style(), *child, ForColumns, GridResolvedPosition(0));
-            maximumColumnIndex = std::max<size_t>(maximumColumnIndex, positions.resolvedFinalPosition.next().toInt());
+            maximumColumnIndex = std::max<size_t>(maximumColumnIndex, positions.resolvedFinalPosition.toInt());
         }
     }
 
@@ -1286,7 +1283,7 @@
                 // Check that it fits in the minor axis direction, as we shouldn't grow in that direction here (it was already managed in populateExplicitGridAndOrderIterator()).
                 GridResolvedPosition minorAxisFinalPositionIndex = autoPlacementMinorAxisDirection() == ForColumns ? emptyGridArea->columns.resolvedFinalPosition : emptyGridArea->rows.resolvedFinalPosition;
                 const size_t endOfMinorAxis = autoPlacementMinorAxisDirection() == ForColumns ? gridColumnCount() : gridRowCount();
-                if (minorAxisFinalPositionIndex.toInt() < endOfMinorAxis)
+                if (minorAxisFinalPositionIndex.toInt() <= endOfMinorAxis)
                     break;
 
                 // Discard empty grid area as it does not fit in the minor axis direction.
@@ -1481,12 +1478,12 @@
         || (positions->resolvedInitialPosition.toInt() > lastTrackIndex);
     bool endIsAuto = endPosition.isAuto()
         || (endPosition.isNamedGridArea() && !GridResolvedPosition::isValidNamedLineOrArea(endPosition.namedGridLine(), styleRef(), GridResolvedPosition::finalPositionSide(direction)))
-        || (positions->resolvedFinalPosition.toInt() > lastTrackIndex);
+        || (positions->resolvedFinalPosition.prev().toInt() > lastTrackIndex);
 
     GridResolvedPosition firstPosition = GridResolvedPosition(0);
     GridResolvedPosition initialPosition = startIsAuto ? firstPosition : positions->resolvedInitialPosition;
     GridResolvedPosition lastPosition = GridResolvedPosition(lastTrackIndex);
-    GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->resolvedFinalPosition;
+    GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->resolvedFinalPosition.prev();
 
     // Positioned children do not grow the grid, so we need to clamp the positions to avoid ending up outside of it.
     initialPosition = std::min<GridResolvedPosition>(initialPosition, lastPosition);
@@ -1551,9 +1548,9 @@
     const GridSpan& span = cachedGridSpan(child, direction);
     const Vector<LayoutUnit>& linePositions = (direction == ForColumns) ? m_columnPositions : m_rowPositions;
     LayoutUnit initialTrackPosition = linePositions[span.resolvedInitialPosition.toInt()];
-    LayoutUnit finalTrackPosition = linePositions[span.resolvedFinalPosition.toInt()];
+    LayoutUnit finalTrackPosition = linePositions[span.resolvedFinalPosition.prev().toInt()];
     // Track Positions vector stores the 'start' grid line of each track, so w have to add last track's baseSize.
-    return finalTrackPosition - initialTrackPosition + tracks[span.resolvedFinalPosition.toInt()].baseSize();
+    return finalTrackPosition - initialTrackPosition + tracks[span.resolvedFinalPosition.prev().toInt()].baseSize();
 }
 
 void LayoutGrid::populateGridPositions(GridSizingData& sizingData)
@@ -1871,7 +1868,7 @@
         return startPosition;
     case GridAxisEnd:
     case GridAxisCenter: {
-        size_t childEndLine = rowsSpan.resolvedFinalPosition.next().toInt();
+        size_t childEndLine = rowsSpan.resolvedFinalPosition.toInt();
         LayoutUnit endOfRow = m_rowPositions[childEndLine];
         // m_rowPositions include gutters so we need to substract them to get the actual end position for a given
         // row (this does not have to be done for the last track as there are no more m_rowPositions after it)
@@ -1903,7 +1900,7 @@
         return startPosition;
     case GridAxisEnd:
     case GridAxisCenter: {
-        size_t childEndLine = columnsSpan.resolvedFinalPosition.next().toInt();
+        size_t childEndLine = columnsSpan.resolvedFinalPosition.toInt();
         LayoutUnit endOfColumn = m_columnPositions[childEndLine];
         // m_columnPositions include gutters so we need to substract them to get the actual end position for a given
         // column (this does not have to be done for the last track as there are no more m_columnPositions after it)
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.h b/third_party/WebKit/Source/core/layout/LayoutGrid.h
index 36c10be..c7885c8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.h
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.h
@@ -115,7 +115,7 @@
     LayoutUnit computeUsedBreadthOfMaxLength(const GridLength&, LayoutUnit usedBreadth, LayoutUnit maxBreadth) const;
     void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection, GridSizingData&);
 
-    void ensureGridSize(size_t maximumRowIndex, size_t maximumColumnIndex);
+    void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize);
     void insertItemIntoGrid(LayoutBox&, const GridCoordinate&);
     void placeItemsOnGrid();
     void populateExplicitGridAndOrderIterator();
diff --git a/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp b/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp
index e8c898c..d707ec0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp
@@ -6,7 +6,7 @@
 #include "core/layout/LayoutInline.h"
 
 #include "core/layout/LayoutTestHelper.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp
index ede3338..e9230344 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp
@@ -3,14 +3,12 @@
 // found in the LICENSE file.
 
 #include "config.h"
-
 #include "core/layout/LayoutMultiColumnFlowThread.h"
 
 #include "core/layout/LayoutMultiColumnSet.h"
 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
 #include "core/layout/LayoutTestHelper.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp
index 9e27aa5..fc8066f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp
@@ -6,7 +6,7 @@
 #include "core/layout/LayoutObject.h"
 
 #include "core/layout/LayoutTestHelper.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutPartTest.cpp b/third_party/WebKit/Source/core/layout/LayoutPartTest.cpp
index 9cc67a3..8fb0d7f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutPartTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutPartTest.cpp
@@ -8,7 +8,7 @@
 #include "core/html/HTMLElement.h"
 #include "core/layout/ImageQualityController.h"
 #include "core/layout/LayoutTestHelper.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableRowTest.cpp b/third_party/WebKit/Source/core/layout/LayoutTableRowTest.cpp
index 1c1b4693..0bcecd0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableRowTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableRowTest.cpp
@@ -27,7 +27,7 @@
 #include "core/layout/LayoutTableRow.h"
 
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
index 983974d..90fe0b50 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
@@ -14,7 +14,7 @@
 #include "core/style/ComputedStyle.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/graphics/Color.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroupTest.cpp b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroupTest.cpp
index be23ba79..c5c8710e 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroupTest.cpp
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroupTest.cpp
@@ -3,14 +3,12 @@
 // found in the LICENSE file.
 
 #include "config.h"
-
 #include "core/layout/MultiColumnFragmentainerGroup.h"
 
 #include "core/layout/LayoutMultiColumnFlowThread.h"
 #include "core/layout/LayoutMultiColumnSet.h"
 #include "core/layout/LayoutTestHelper.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp b/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp
index ccca93b..50a5037b 100644
--- a/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp
+++ b/third_party/WebKit/Source/core/layout/OverflowModelTest.cpp
@@ -32,7 +32,7 @@
 #include "core/layout/OverflowModel.h"
 
 #include "platform/geometry/LayoutRect.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/core/layout/PaginationTest.cpp b/third_party/WebKit/Source/core/layout/PaginationTest.cpp
index cfcbe9b..a6beec61 100644
--- a/third_party/WebKit/Source/core/layout/PaginationTest.cpp
+++ b/third_party/WebKit/Source/core/layout/PaginationTest.cpp
@@ -7,7 +7,7 @@
 #include "core/layout/LayoutMultiColumnFlowThread.h"
 
 #include "core/layout/LayoutTestHelper.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
index 57e923cf..106acd3 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -10,7 +10,7 @@
 #include "core/layout/LayoutTestHelper.h"
 #include "core/layout/LayoutView.h"
 #include "core/paint/PaintLayer.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
index adb8446..96a1058 100644
--- a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
+++ b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
@@ -31,7 +31,7 @@
 #include "core/layout/shapes/BoxShape.h"
 
 #include "platform/geometry/FloatRoundedRect.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
index 9e12e0e2..f92f535 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
@@ -43,7 +43,7 @@
 #include "core/testing/DummyPageHolder.h"
 #include "platform/network/ResourceRequest.h"
 #include "platform/weborigin/KURL.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/loader/LinkHeaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkHeaderTest.cpp
index aec730f..b40d9b3c 100644
--- a/third_party/WebKit/Source/core/loader/LinkHeaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkHeaderTest.cpp
@@ -5,8 +5,8 @@
 #include "config.h"
 #include "core/loader/LinkHeader.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include <base/macros.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
index 364cc3f..f1e04492 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -13,9 +13,8 @@
 #include "core/loader/NetworkHintsInterface.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/network/ResourceLoadPriority.h"
-
+#include "testing/gtest/include/gtest/gtest.h"
 #include <base/macros.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
index fb371f2d..4291c0a 100644
--- a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
+++ b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
@@ -8,10 +8,9 @@
 #include "core/testing/DummyPageHolder.h"
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
-
 #include <base/macros.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
index a51d702..da23863c 100644
--- a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
+++ b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
@@ -12,8 +12,8 @@
 #include "core/html/HTMLElement.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/ContextMenu.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifierTest.cpp b/third_party/WebKit/Source/core/page/NetworkStateNotifierTest.cpp
index 9f62907..6aaa0d23 100644
--- a/third_party/WebKit/Source/core/page/NetworkStateNotifierTest.cpp
+++ b/third_party/WebKit/Source/core/page/NetworkStateNotifierTest.cpp
@@ -36,8 +36,8 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebConnectionType.h"
 #include "public/platform/WebThread.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Functional.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
index 2377b94..db2f708 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -129,13 +129,12 @@
 
     ASSERT(!allPages().contains(this));
     allPages().add(this);
-    memoryPurgeController().registerClient(this);
 }
 
 Page::~Page()
 {
 #if !ENABLE(OILPAN)
-    memoryPurgeController().unregisterClient(this);
+    ASSERT(!ordinaryPages().contains(this));
 #endif
     // willBeDestroyed() must be called before Page destruction.
     ASSERT(!m_mainFrame);
@@ -145,6 +144,7 @@
 {
     ASSERT(!ordinaryPages().contains(this));
     ordinaryPages().add(this);
+    memoryPurgeController().registerClient(this);
 }
 
 ViewportDescription Page::viewportDescription() const
@@ -395,11 +395,11 @@
     // TODO(alexclarke): Move throttling of timers to chromium.
     if (visibilityState == PageVisibilityStateVisible) {
         setTimerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval());
-        m_memoryPurgeController->pageBecameActive();
+        memoryPurgeController().pageBecameActive();
     } else {
         setTimerAlignmentInterval(DOMTimer::hiddenPageAlignmentInterval());
         if (!isInitialState)
-            m_memoryPurgeController->pageBecameInactive();
+            memoryPurgeController().pageBecameInactive();
     }
 
     if (!isInitialState)
@@ -595,6 +595,10 @@
     ASSERT(allPages().contains(this));
     allPages().remove(this);
     ordinaryPages().remove(this);
+#if !ENABLE(OILPAN)
+    if (m_memoryPurgeController)
+        m_memoryPurgeController->unregisterClient(this);
+#endif
 
     if (m_scrollingCoordinator)
         m_scrollingCoordinator->willBeDestroyed();
diff --git a/third_party/WebKit/Source/core/page/PagePopupClientTest.cpp b/third_party/WebKit/Source/core/page/PagePopupClientTest.cpp
index 9c2232f..68cf5109 100644
--- a/third_party/WebKit/Source/core/page/PagePopupClientTest.cpp
+++ b/third_party/WebKit/Source/core/page/PagePopupClientTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/page/PagePopupClient.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <string>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/page/PrintContextTest.cpp b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
index c51acd4..aff4ca46 100644
--- a/third_party/WebKit/Source/core/page/PrintContextTest.cpp
+++ b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
@@ -20,7 +20,7 @@
 #include "platform/scroll/ScrollbarTheme.h"
 #include "platform/testing/SkiaForCoreTesting.h"
 #include "platform/text/TextStream.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
index fec8709..5c95d96a 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/paint/GridPainter.cpp b/third_party/WebKit/Source/core/paint/GridPainter.cpp
index 4860e06..c029941c 100644
--- a/third_party/WebKit/Source/core/paint/GridPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/GridPainter.cpp
@@ -24,7 +24,8 @@
     if (endGridAreaIndex > 0)
         --endGridAreaIndex;
 
-    return GridSpan(startGridAreaIndex, endGridAreaIndex);
+    // GridSpan stores lines' indexes (not tracks' indexes).
+    return GridSpan(startGridAreaIndex, endGridAreaIndex + 1);
 }
 
 class GridItemsSorter {
diff --git a/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp b/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp
index 6f8c1aa..db539a1 100644
--- a/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp
@@ -13,7 +13,7 @@
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/paint/PaintController.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
index 1743803..befffc9 100644
--- a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
@@ -13,7 +13,7 @@
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/paint/DrawingDisplayItem.h"
 #include "platform/graphics/paint/PaintController.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/paint/NinePieceImageGridTest.cpp b/third_party/WebKit/Source/core/paint/NinePieceImageGridTest.cpp
index c1e2a2c..4ae8b91 100644
--- a/third_party/WebKit/Source/core/paint/NinePieceImageGridTest.cpp
+++ b/third_party/WebKit/Source/core/paint/NinePieceImageGridTest.cpp
@@ -10,7 +10,7 @@
 #include "core/style/ComputedStyle.h"
 #include "core/style/NinePieceImage.h"
 #include "core/style/StyleGeneratedImage.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp b/third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp
index c72e025..a963d65 100644
--- a/third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp
+++ b/third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp
@@ -5,6 +5,7 @@
 #include "config.h"
 #include "core/paint/NinePieceImagePainter.h"
 
+#include "core/frame/UseCounter.h"
 #include "core/layout/ImageQualityController.h"
 #include "core/layout/LayoutBoxModelObject.h"
 #include "core/paint/BoxPainter.h"
@@ -35,6 +36,14 @@
     if (!styleImage->canRender(m_layoutObject, style.effectiveZoom()))
         return false;
 
+    // Find out if the hasImage() check in ComputedStyle::border*Width had any affect, i.e. if a border is non-zero while border-style is
+    // none or hidden.
+    if ((style.borderLeftWidth() && (style.borderLeft().style() == BNONE || style.borderLeft().style() == BHIDDEN))
+        || (style.borderRightWidth() && (style.borderRight().style() == BNONE || style.borderRight().style() == BHIDDEN))
+        || (style.borderTopWidth() && (style.borderTop().style() == BNONE || style.borderTop().style() == BHIDDEN))
+        || (style.borderBottomWidth() && (style.borderBottom().style() == BNONE || style.borderBottom().style() == BHIDDEN)))
+        UseCounter::count(m_layoutObject.document(), UseCounter::BorderImageWithBorderStyleNone);
+
     // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function
     // doesn't have any understanding of the zoom that is in effect on the tile.
     LayoutRect rectWithOutsets = rect;
diff --git a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
index 5bc9f77bd..4163d24 100644
--- a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/paint/PaintInfo.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 6ad7cf19..ada05d91 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -12,9 +12,9 @@
 #include "platform/text/TextStream.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/HashMap.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/paint/TextPainterTest.cpp b/third_party/WebKit/Source/core/paint/TextPainterTest.cpp
index 033fa441..e8b43a0 100644
--- a/third_party/WebKit/Source/core/paint/TextPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/TextPainterTest.cpp
@@ -14,7 +14,7 @@
 #include "core/paint/PaintInfo.h"
 #include "core/style/ShadowData.h"
 #include "core/style/ShadowList.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp
index f17985e..7448071a 100644
--- a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp
+++ b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp
@@ -16,7 +16,7 @@
 #include "core/streams/ReadableStreamImpl.h"
 #include "core/streams/UnderlyingSource.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp
index 746ca78..af1f1879 100644
--- a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp
+++ b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp
@@ -17,9 +17,9 @@
 #include "core/streams/ReadableStreamReader.h"
 #include "core/streams/UnderlyingSource.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gmock/gmock-more-actions.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock-more-actions.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp b/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp
index 3b3b08c4..ac35ea4 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/layout/ClipPathOperation.h"
 #include "core/style/ShapeValue.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/style/GridCoordinate.h b/third_party/WebKit/Source/core/style/GridCoordinate.h
index ae3e8941..3a1e5b6 100644
--- a/third_party/WebKit/Source/core/style/GridCoordinate.h
+++ b/third_party/WebKit/Source/core/style/GridCoordinate.h
@@ -44,8 +44,8 @@
 const size_t kGridMaxTracks = 1000000;
 
 // A span in a single direction (either rows or columns). Note that |resolvedInitialPosition|
-// and |resolvedFinalPosition| are grid areas' indexes, NOT grid lines'. Iterating over the
-// span should include both |resolvedInitialPosition| and |resolvedFinalPosition| to be correct.
+// and |resolvedFinalPosition| are grid lines' indexes.
+// Iterating over the span shouldn't include |resolvedFinalPosition| to be correct.
 struct GridSpan {
     USING_FAST_MALLOC(GridSpan);
 public:
@@ -56,10 +56,11 @@
 
     static PassOwnPtr<GridSpan> createWithSpanAgainstOpposite(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide side)
     {
-        // 'span 1' is contained inside a single grid track regardless of the direction.
-        // That's why the CSS span value is one more than the offset we apply.
-        size_t positionOffset = position.spanPosition() - 1;
+        size_t positionOffset = position.spanPosition();
         if (side == ColumnStartSide || side == RowStartSide) {
+            if (resolvedOppositePosition == 0)
+                return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition.next());
+
             GridResolvedPosition initialResolvedPosition = GridResolvedPosition(std::max<int>(0, resolvedOppositePosition.toInt() - positionOffset));
             return GridSpan::create(initialResolvedPosition, resolvedOppositePosition);
         }
@@ -77,21 +78,17 @@
 
     static PassOwnPtr<GridSpan> createWithInitialNamedSpanAgainstOpposite(const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines)
     {
-        // The grid line inequality needs to be strict (which doesn't match the after / end case) because |resolvedOppositePosition|
-        // is already converted to an index in our grid representation (ie one was removed from the grid line to account for the side).
+        if (resolvedOppositePosition == 0)
+            return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition.next());
+
         size_t firstLineBeforeOppositePositionIndex = 0;
         const size_t* firstLineBeforeOppositePosition = std::lower_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition.toInt());
-        if (firstLineBeforeOppositePosition != gridLines.end()) {
-            if (*firstLineBeforeOppositePosition > resolvedOppositePosition.toInt() && firstLineBeforeOppositePosition != gridLines.begin())
-                --firstLineBeforeOppositePosition;
-
+        if (firstLineBeforeOppositePosition != gridLines.end())
             firstLineBeforeOppositePositionIndex = firstLineBeforeOppositePosition - gridLines.begin();
-        }
-
-        size_t gridLineIndex = std::max<int>(0, firstLineBeforeOppositePositionIndex - position.spanPosition() + 1);
+        size_t gridLineIndex = std::max<int>(0, firstLineBeforeOppositePositionIndex - position.spanPosition());
         GridResolvedPosition resolvedGridLinePosition = GridResolvedPosition(gridLines[gridLineIndex]);
-        if (resolvedGridLinePosition > resolvedOppositePosition)
-            resolvedGridLinePosition = resolvedOppositePosition;
+        if (resolvedGridLinePosition >= resolvedOppositePosition)
+            resolvedGridLinePosition = resolvedOppositePosition.prev();
         return GridSpan::create(resolvedGridLinePosition, resolvedOppositePosition);
     }
 
@@ -101,11 +98,11 @@
         const size_t* firstLineAfterOppositePosition = std::upper_bound(gridLines.begin(), gridLines.end(), resolvedOppositePosition.toInt());
         if (firstLineAfterOppositePosition != gridLines.end())
             firstLineAfterOppositePositionIndex = firstLineAfterOppositePosition - gridLines.begin();
-
         size_t gridLineIndex = std::min(gridLines.size() - 1, firstLineAfterOppositePositionIndex + position.spanPosition() - 1);
-        GridResolvedPosition resolvedGridLinePosition = GridResolvedPosition::adjustGridPositionForAfterEndSide(gridLines[gridLineIndex]);
-        if (resolvedGridLinePosition < resolvedOppositePosition)
-            resolvedGridLinePosition = resolvedOppositePosition;
+        GridResolvedPosition resolvedGridLinePosition = gridLines[gridLineIndex];
+        if (resolvedGridLinePosition <= resolvedOppositePosition)
+            resolvedGridLinePosition = resolvedOppositePosition.next();
+
         return GridSpan::create(resolvedOppositePosition, resolvedGridLinePosition);
     }
 
@@ -113,7 +110,7 @@
         : resolvedInitialPosition(std::min(resolvedInitialPosition.toInt(), kGridMaxTracks - 1))
         , resolvedFinalPosition(std::min(resolvedFinalPosition.toInt(), kGridMaxTracks))
     {
-        ASSERT(resolvedInitialPosition <= resolvedFinalPosition);
+        ASSERT(resolvedInitialPosition < resolvedFinalPosition);
     }
 
     bool operator==(const GridSpan& o) const
@@ -123,7 +120,7 @@
 
     size_t integerSpan() const
     {
-        return resolvedFinalPosition.toInt() - resolvedInitialPosition.toInt() + 1;
+        return resolvedFinalPosition.toInt() - resolvedInitialPosition.toInt();
     }
 
     GridResolvedPosition resolvedInitialPosition;
@@ -138,7 +135,7 @@
 
     iterator end() const
     {
-        return resolvedFinalPosition.next();
+        return resolvedFinalPosition;
     }
 };
 
@@ -148,8 +145,8 @@
 public:
     // HashMap requires a default constuctor.
     GridCoordinate()
-        : columns(0, 0)
-        , rows(0, 0)
+        : columns(0, 1)
+        , rows(0, 1)
     {
     }
 
diff --git a/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp b/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp
index 9108080..a8d5b70 100644
--- a/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp
+++ b/third_party/WebKit/Source/core/style/GridResolvedPosition.cpp
@@ -72,7 +72,7 @@
     // This method will only be used when both positions need to be resolved against the opposite one.
     ASSERT(initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPosition.shouldBeResolvedAgainstOppositePosition());
 
-    GridResolvedPosition resolvedFinalPosition = resolvedInitialPosition;
+    GridResolvedPosition resolvedFinalPosition = resolvedInitialPosition.next();
 
     if (initialPosition.isSpan())
         return *resolveGridPositionAgainstOppositePosition(gridContainerStyle, resolvedInitialPosition, initialPosition, finalSide);
@@ -111,8 +111,8 @@
     GridResolvedPosition resolvedFinalPosition = resolveGridPositionFromStyle(gridContainerStyle, finalPosition, finalSide);
 
     // If 'grid-after' specifies a line at or before that specified by 'grid-before', it computes to 'span 1'.
-    if (resolvedFinalPosition < resolvedInitialPosition)
-        resolvedFinalPosition = resolvedInitialPosition;
+    if (resolvedFinalPosition <= resolvedInitialPosition)
+        resolvedFinalPosition = resolvedInitialPosition.next();
 
     return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition));
 }
@@ -142,7 +142,7 @@
         if (position.isPositive())
             return GridResolvedPosition(0);
         const size_t lastLine = explicitGridSizeForSide(gridContainerStyle, side);
-        return adjustGridPositionForSide(lastLine, side);
+        return lastLine;
     }
 
     size_t namedGridLineIndex;
@@ -150,7 +150,7 @@
         namedGridLineIndex = std::min<size_t>(position.integerPosition(), it->value.size()) - 1;
     else
         namedGridLineIndex = std::max<int>(it->value.size() - abs(position.integerPosition()), 0);
-    return adjustGridPositionForSide(it->value[namedGridLineIndex], side);
+    return it->value[namedGridLineIndex];
 }
 
 GridResolvedPosition GridResolvedPosition::resolveGridPositionFromStyle(const ComputedStyle& gridContainerStyle, const GridPosition& position, GridPositionSide side)
@@ -164,7 +164,7 @@
 
         // Handle <integer> explicit position.
         if (position.isPositive())
-            return adjustGridPositionForSide(position.integerPosition() - 1, side);
+            return position.integerPosition() - 1;
 
         size_t resolvedPosition = abs(position.integerPosition()) - 1;
         const size_t endOfTrack = explicitGridSizeForSide(gridContainerStyle, side);
@@ -173,7 +173,7 @@
         if (endOfTrack < resolvedPosition)
             return GridResolvedPosition(0);
 
-        return adjustGridPositionForSide(endOfTrack - resolvedPosition, side);
+        return endOfTrack - resolvedPosition;
     }
     case NamedGridAreaPosition:
     {
@@ -186,13 +186,13 @@
         const NamedGridLinesMap& gridLineNames = gridLinesForSide(gridContainerStyle, side);
         NamedGridLinesMap::const_iterator implicitLineIter = gridLineNames.find(implicitNamedGridLineForSide(namedGridLine, side));
         if (implicitLineIter != gridLineNames.end())
-            return adjustGridPositionForSide(implicitLineIter->value[0], side);
+            return implicitLineIter->value[0];
 
         // Otherwise, if there is a named line with the specified name, contributes the first such line to the grid
         // item's placement.
         NamedGridLinesMap::const_iterator explicitLineIter = gridLineNames.find(namedGridLine);
         if (explicitLineIter != gridLineNames.end())
-            return adjustGridPositionForSide(explicitLineIter->value[0], side);
+            return explicitLineIter->value[0];
 
         // If none of the above works specs mandate us to treat it as auto BUT we should have detected it before calling
         // this function in GridResolvedPosition::resolveGridPositionsFromStyle(). We should be also covered by the
@@ -212,8 +212,11 @@
 
 PassOwnPtr<GridSpan> GridResolvedPosition::resolveGridPositionAgainstOppositePosition(const ComputedStyle& gridContainerStyle, const GridResolvedPosition& resolvedOppositePosition, const GridPosition& position, GridPositionSide side)
 {
-    if (position.isAuto())
-        return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition);
+    if (position.isAuto()) {
+        if ((side == ColumnStartSide || side == RowStartSide) && resolvedOppositePosition.toInt())
+            return GridSpan::create(resolvedOppositePosition.prev(), resolvedOppositePosition);
+        return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition.next());
+    }
 
     ASSERT(position.isSpan());
     ASSERT(position.spanPosition() > 0);
@@ -238,8 +241,11 @@
 
     // If there is no named grid line of that name, we resolve the position to 'auto' (which is equivalent to 'span 1' in this case).
     // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html.
-    if (it == gridLinesNames.end())
-        return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition);
+    if (it == gridLinesNames.end()) {
+        if ((side == ColumnStartSide || side == RowStartSide) && resolvedOppositePosition.toInt())
+            return GridSpan::create(resolvedOppositePosition.prev(), resolvedOppositePosition);
+        return GridSpan::create(resolvedOppositePosition, resolvedOppositePosition.next());
+    }
 
     return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition, position, side, it->value);
 }
diff --git a/third_party/WebKit/Source/core/style/GridResolvedPosition.h b/third_party/WebKit/Source/core/style/GridResolvedPosition.h
index 184d312..4ac11e7 100644
--- a/third_party/WebKit/Source/core/style/GridResolvedPosition.h
+++ b/third_party/WebKit/Source/core/style/GridResolvedPosition.h
@@ -26,24 +26,11 @@
     ForRows
 };
 
-// This class represents an index into one of the dimensions of the grid array.
+// This class represents a line index into one of the dimensions of the grid array.
 // Wraps a size_t integer just for the purpose of knowing what we manipulate in the grid code.
 class GridResolvedPosition {
     DISALLOW_NEW();
 public:
-    static GridResolvedPosition adjustGridPositionForAfterEndSide(size_t resolvedPosition)
-    {
-        return resolvedPosition ? GridResolvedPosition(resolvedPosition - 1) : GridResolvedPosition(0);
-    }
-
-    static GridResolvedPosition adjustGridPositionForSide(size_t resolvedPosition, GridPositionSide side)
-    {
-        // An item finishing on the N-th line belongs to the N-1-th cell.
-        if (side == ColumnEndSide || side == RowEndSide)
-            return adjustGridPositionForAfterEndSide(resolvedPosition);
-
-        return GridResolvedPosition(resolvedPosition);
-    }
 
     static bool isValidNamedLineOrArea(const String& lineName, const ComputedStyle&, GridPositionSide);
     static GridPositionSide initialPositionSide(GridTrackSizingDirection);
@@ -61,14 +48,6 @@
     {
     }
 
-    GridResolvedPosition(const GridPosition& position, GridPositionSide side)
-    {
-        ASSERT(position.integerPosition());
-        size_t integerPosition = position.integerPosition() - 1;
-
-        m_integerPosition = adjustGridPositionForSide(integerPosition, side).toInt();
-    }
-
     GridResolvedPosition& operator*()
     {
         return *this;
@@ -120,6 +99,11 @@
         return GridResolvedPosition(m_integerPosition + 1);
     }
 
+    GridResolvedPosition prev() const
+    {
+        return GridResolvedPosition(m_integerPosition > 0 ? m_integerPosition - 1 : 0);
+    }
+
     static size_t explicitGridColumnCount(const ComputedStyle&);
     static size_t explicitGridRowCount(const ComputedStyle&);
 
diff --git a/third_party/WebKit/Source/core/style/OutlineValueTest.cpp b/third_party/WebKit/Source/core/style/OutlineValueTest.cpp
index aa980ee6..ff210bfb 100644
--- a/third_party/WebKit/Source/core/style/OutlineValueTest.cpp
+++ b/third_party/WebKit/Source/core/style/OutlineValueTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/style/OutlineValue.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/style/SVGComputedStyleTest.cpp b/third_party/WebKit/Source/core/style/SVGComputedStyleTest.cpp
index a4191af..e4844bd 100644
--- a/third_party/WebKit/Source/core/style/SVGComputedStyleTest.cpp
+++ b/third_party/WebKit/Source/core/style/SVGComputedStyleTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "core/style/SVGComputedStyle.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/svg/SVGPathParserTest.cpp b/third_party/WebKit/Source/core/svg/SVGPathParserTest.cpp
index 3914f93..1b5762b 100644
--- a/third_party/WebKit/Source/core/svg/SVGPathParserTest.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGPathParserTest.cpp
@@ -7,8 +7,7 @@
 
 #include "core/svg/SVGPathStringBuilder.h"
 #include "core/svg/SVGPathStringSource.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp b/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp
index 4219db55..46916e3a 100644
--- a/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp
+++ b/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp
@@ -24,10 +24,10 @@
 #include "core/testing/DummyPageHolder.h"
 #include "platform/geometry/IntSize.h"
 #include "platform/weborigin/KURL.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
 #include "wtf/text/AtomicString.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 // Test that SVG content with JavaScript URLs is sanitized by removing
 // the URLs. This sanitization happens when the content is pasted or
diff --git a/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp b/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp
index 9a51da7d..1245c6d 100644
--- a/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp
+++ b/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp
@@ -10,8 +10,7 @@
 #include "bindings/core/v8/V8BindingForTesting.h"
 #include "bindings/core/v8/V8PrivateScriptTest.h"
 #include "core/testing/DummyPageHolder.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 // PrivateScriptTest.js is available only in debug builds.
 #ifndef NDEBUG
diff --git a/third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp b/third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp
index 0b22803..65d74c0 100644
--- a/third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp
+++ b/third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/timing/MemoryInfo.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
index d396cd1..04248476 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -12,8 +12,8 @@
 #include "platform/NotImplemented.h"
 #include "public/platform/WebScheduler.h"
 #include "public/platform/WebWaitableEvent.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using testing::_;
 using testing::AtMost;
diff --git a/third_party/WebKit/Source/core/xml/parser/SharedBufferReaderTest.cpp b/third_party/WebKit/Source/core/xml/parser/SharedBufferReaderTest.cpp
index e543f63..39f060f 100644
--- a/third_party/WebKit/Source/core/xml/parser/SharedBufferReaderTest.cpp
+++ b/third_party/WebKit/Source/core/xml/parser/SharedBufferReaderTest.cpp
@@ -32,10 +32,9 @@
 #include "core/xml/parser/SharedBufferReader.h"
 
 #include "platform/SharedBuffer.h"
-
+#include "testing/gtest/include/gtest/gtest.h"
 #include <algorithm>
 #include <cstdlib>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes b/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes
index 03cffbb..0f3bbf2e 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes
+++ b/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes
@@ -2,7 +2,7 @@
     "breakpointConditional.svg": "4cf90210b2af2ed84db2f60b07bcde28",
     "errorWave.svg": "e183fa242a22ed4784a92f6becbc2c45",
     "settingsListRemove.svg": "ce9e7c5c5cdaef28e6ee51d9478d5485",
-    "toolbarButtonGlyphs.svg": "e05c1b87ef35c651c24b10ca4a2cdfe9",
+    "toolbarButtonGlyphs.svg": "c497b79c6f651c337029cd115b42840b",
     "breakpoint.svg": "69cd92d807259c022791112809b97799",
     "responsiveDesign.svg": "1d6e963f88e5e448a7cff85f75a0e6b0"
 }
\ No newline at end of file
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes b/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes
index 03cffbb..0f3bbf2e 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes
+++ b/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes
@@ -2,7 +2,7 @@
     "breakpointConditional.svg": "4cf90210b2af2ed84db2f60b07bcde28",
     "errorWave.svg": "e183fa242a22ed4784a92f6becbc2c45",
     "settingsListRemove.svg": "ce9e7c5c5cdaef28e6ee51d9478d5485",
-    "toolbarButtonGlyphs.svg": "e05c1b87ef35c651c24b10ca4a2cdfe9",
+    "toolbarButtonGlyphs.svg": "c497b79c6f651c337029cd115b42840b",
     "breakpoint.svg": "69cd92d807259c022791112809b97799",
     "responsiveDesign.svg": "1d6e963f88e5e448a7cff85f75a0e6b0"
 }
\ No newline at end of file
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/src/toolbarButtonGlyphs.svg b/third_party/WebKit/Source/devtools/front_end/Images/src/toolbarButtonGlyphs.svg
index 7bc3f2e..cb3d845 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/src/toolbarButtonGlyphs.svg
+++ b/third_party/WebKit/Source/devtools/front_end/Images/src/toolbarButtonGlyphs.svg
@@ -21,9 +21,9 @@
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
      showgrid="true"
      id="namedview3397"
-     inkscape:zoom="5.6568543"
-     inkscape:cx="252.34011"
-     inkscape:cy="35.78127"
+     inkscape:zoom="4"
+     inkscape:cx="207.75144"
+     inkscape:cy="84.559849"
      inkscape:window-width="1920"
      inkscape:window-height="1122"
      inkscape:window-x="0"
@@ -721,15 +721,7 @@
      d="m 250.99,105.42 c 1.66,0 3,-0.71 3,-1.59 0,-0.88 -1.34,-1.59 -3,-1.59 -1.66,0 -3,0.71 -3,1.59 0,0.88 1.34,1.59 3,1.59 z"
      id="path3737"
      inkscape:connector-curvature="0"
-     style="fill:url(#y)" /><rect
-     height="12"
-     rx="0.25"
-     ry="0.25"
-     style="fill-opacity:0.38000016;stroke:#000000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:0"
-     width="8"
-     x="268"
-     y="102"
-     id="rect3739" /><path
+     style="fill:url(#y)" /><path
      d="m 218,107 c -2.76,0 -5,2.24 -5,5 0,2.76 2.24,5 5,5 2.76,0 5,-2.24 5,-5 0,-2.76 -2.24,-5 -5,-5"
      id="path3741"
      inkscape:connector-curvature="0"
@@ -741,15 +733,7 @@
      d="m 216.93,109.14 c -0.03,-0.53 0.55,-0.97 1.06,-0.83 0.5,0.12 0.79,0.73 0.56,1.18 -0.2,0.44 -0.79,0.61 -1.2,0.36 -0.26,-0.14 -0.42,-0.42 -0.42,-0.71 z m 1.7,5.46 c 0.22,0 0.45,0 0.67,0 0,0.18 0,0.35 0,0.53 -0.96,0 -1.93,0 -2.89,0 0,-0.18 0,-0.35 0,-0.53 0.22,0 0.44,0 0.66,0 0,-1.2 0,-2.41 0,-3.61 -0.22,0 -0.44,0 -0.66,0 0,-0.18 0,-0.35 0,-0.53 0.74,0 1.48,0 2.22,0 0,1.38 0,2.76 0,4.14 z"
      id="path3745"
      inkscape:connector-curvature="0"
-     style="fill:#ffffff" /><rect
-     height="8"
-     rx="0.25"
-     ry="0.25"
-     style="fill-opacity:0.38000016;stroke:#000000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:0"
-     width="12"
-     x="298"
-     y="104"
-     id="rect3747" /><path
+     style="fill:#ffffff" /><path
      d="m 12.25,125 c -0.68,0 -1.25,0.57 -1.25,1.25 l 0,9.69 2,-3.31 0,-5.63 3.38,0 1.19,-2 -5.31,0 z m 8.75,3.06 -2,3.31 0,5.63 -3.38,0 -1.19,2 5.31,0 c 0.68,0 1.25,-0.57 1.25,-1.25 l 0,-9.69 z"
      id="path3749"
      inkscape:connector-curvature="0"
@@ -1081,4 +1065,10 @@
      d="M 307.42857,148.007 299.57143,148 C 298.70715,148 298,148.65455 298,149.45455 l 0,13.09091 c 0,0.8 0.70715,1.45454 1.57143,1.45454 l 7.85714,0 C 308.29285,164 309,163.34546 309,162.54546 l 0,-13.09091 c 0,-0.8 -0.70715,-1.44728 -1.57143,-1.44728 l 0,0 z M 307,160.99968 l -7,0 0,-10 7,0 z"
      id="device-mode-4"
      sketch:type="MSShapeGroup"
-     sodipodi:nodetypes="ccsssssscccccccc" /></svg>
\ No newline at end of file
+     sodipodi:nodetypes="ccsssssscccccccc" /><path
+     inkscape:connector-curvature="0"
+     d="m 267,110 h -2 v 5 h 5 v -2 h -3 v -3 z m -2,-4 h 2 v -3 h 3 v -2 h -5 v 5 z m 12,7 h -3 v 2 h 5 v -5 h -2 v 3 z m -3,-12 v 2 h 3 v 3 h 2 v -5 h -5 z"
+     id="path6-6" /><path
+     inkscape:connector-curvature="0"
+     d="m 297,112 h 3 v 3 h 2 v -5 h -5 v 2 z m 3,-8 h -3 v 2 h 5 v -5 h -2 v 3 z m 6,11 h 2 v -3 h 3 v -2 h -5 v 5 z m 2,-11 v -3 h -2 v 5 h 5 v -2 h -3 z"
+     id="path6-65" /></svg>
\ No newline at end of file
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs.png b/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs.png
index eebd4e9..89cc4bb 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs.png
+++ b/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs.png
Binary files differ
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs_2x.png b/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs_2x.png
index eebc374..2c61ece0 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs_2x.png
+++ b/third_party/WebKit/Source/devtools/front_end/Images/toolbarButtonGlyphs_2x.png
Binary files differ
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
index 458a752..4f51a59 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
@@ -415,6 +415,14 @@
     scale: function(scale)
     {
         return new WebInspector.Rect(this.left * scale, this.top * scale, this.width * scale, this.height * scale);
+    },
+
+    /**
+     * @return {!Size}
+     */
+    size: function()
+    {
+        return new Size(this.width, this.height);
     }
 }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/components/Drawer.js b/third_party/WebKit/Source/devtools/front_end/components/Drawer.js
index 3d24102..7d6fad3 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Drawer.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Drawer.js
@@ -45,6 +45,12 @@
     this._tabbedPane.element.id = "drawer-tabbed-pane";
     this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this);
 
+    var toolbar = new WebInspector.Toolbar("drawer-close-toolbar");
+    var closeButton = new WebInspector.ToolbarButton(WebInspector.UIString("Close drawer"), "delete-toolbar-item");
+    closeButton.addEventListener("click", this.closeDrawer.bind(this));
+    toolbar.appendToolbarItem(closeButton);
+    this._tabbedPane.appendAfterTabStrip(toolbar.element);
+
     this._extensibleTabbedPaneController = new WebInspector.ExtensibleTabbedPaneController(this._tabbedPane, "drawer-view");
     this._extensibleTabbedPaneController.enableMoreTabsButton();
 
diff --git a/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json b/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json
index 1020776..f5b9d82d3 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json
+++ b/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json
@@ -667,7 +667,7 @@
         {
             "type": "emulated-device",
             "device": {
-                "show-by-default": false,
+                "show-by-default": true,
                 "title": "iPad",
                 "screen": {
                     "horizontal": {
@@ -812,7 +812,7 @@
             "type": "emulated-device",
             "device": {
                 "show-by-default": true,
-                "title": "Galaxy Note 3",
+                "title": "Galaxy Note",
                 "screen": {
                     "horizontal": {
                         "width": 640,
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
index ae27d37..deca907 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
@@ -12,23 +12,26 @@
     this._updateCallback = updateCallback;
     this._screenRect = new WebInspector.Rect(0, 0, 1, 1);
     this._visiblePageRect = new WebInspector.Rect(0, 0, 1, 1);
-    this._fitScale = 1;
     this._availableSize = new Size(1, 1);
     this._deviceMetricsThrottler = new WebInspector.Throttler(0);
     this._appliedDeviceSize = new Size(1, 1);
     this._currentDeviceScaleFactor = window.devicePixelRatio;
     this._appliedDeviceScaleFactor = 0;
 
-    // Zero means "fit", positive number is a scale itself.
-    this._fitSetting = WebInspector.settings.createSetting("emulation.deviceFit", 0);
-    this._fitSetting.addChangeListener(this._fitSettingChanged, this);
+    // Zero means "fit".
+    this._scaleSetting = WebInspector.settings.createSetting("emulation.deviceScale", 1);
+    this._scaleSetting.addChangeListener(this._scaleSettingChanged, this);
     this._widthSetting = WebInspector.settings.createSetting("emulation.deviceWidth", 400);
     this._widthSetting.addChangeListener(this._widthSettingChanged, this);
+    this._heightSetting = WebInspector.settings.createSetting("emulation.deviceHeight", 700);
+    this._heightSetting.addChangeListener(this._heightSettingChanged, this);
+    this._mobileSetting = WebInspector.settings.createSetting("emulation.deviceMobile", true);
+    this._mobileSetting.addChangeListener(this._mobileSettingChanged, this);
     this._deviceScaleFactorSetting = WebInspector.settings.createSetting("emulation.deviceScaleFactor", 0);
     this._deviceScaleFactorSetting.addChangeListener(this._deviceScaleFactorSettingChanged, this);
 
     /** @type {!WebInspector.DeviceModeModel.Type} */
-    this._type = WebInspector.DeviceModeModel.Type.Desktop;
+    this._type = WebInspector.DeviceModeModel.Type.None;
     /** @type {?WebInspector.EmulatedDevice} */
     this._device = null;
     /** @type {?WebInspector.EmulatedDevice.Mode} */
@@ -40,7 +43,7 @@
     /** @type {string} */
     this._screenOrientation = "";
     /** @type {number} */
-    this._fixedFitScale = 0;
+    this._fixedScale = 0;
 
     /** @type {?WebInspector.Target} */
     this._target = null;
@@ -49,8 +52,8 @@
 
 /** @enum {string} */
 WebInspector.DeviceModeModel.Type = {
-    Desktop: "Desktop",
-    Mobile: "Mobile",
+    None: "None",
+    Responsive: "Responsive",
     Device: "Device"
 }
 
@@ -67,17 +70,6 @@
     return WebInspector.UIString("Value must be positive integer");
 }
 
-/**
- * @param {string} value
- * @return {string}
- */
-WebInspector.DeviceModeModel.deviceScaleFactorValidator = function(value)
-{
-    if (!value || (/^[\d]+(\.\d+)?|\.\d+$/.test(value) && value >= 0 && value <= 10))
-        return "";
-    return WebInspector.UIString("Value must be non-negative float");
-}
-
 WebInspector.DeviceModeModel._touchEventsScriptIdSymbol = Symbol("DeviceModeModel.touchEventsScriptIdSymbol");
 WebInspector.DeviceModeModel._defaultMobileUserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36";
 WebInspector.DeviceModeModel._defaultMobileScaleFactor = 2;
@@ -86,7 +78,7 @@
     /**
      * @param {!Size} size
      */
-    availableSizeChanged: function(size)
+    setAvailableSize: function(size)
     {
         this._availableSize = size;
         this._calculateAndEmulate(false);
@@ -108,11 +100,6 @@
         } else {
             this._device = null;
             this._mode = null;
-            if (type === WebInspector.DeviceModeModel.Type.Desktop) {
-                this._fitSetting.removeChangeListener(this._fitSettingChanged, this);
-                this._fitSetting.set(0);
-                this._fitSetting.addChangeListener(this._fitSettingChanged, this);
-            }
         }
 
         this._calculateAndEmulate(true);
@@ -169,9 +156,20 @@
     /**
      * @return {number}
      */
-    fitScale: function()
+    scale: function()
     {
-        return this._fitScale;
+        return this._scale;
+    },
+
+    suspendScaleChanges: function()
+    {
+        ++this._fixedScale;
+    },
+
+    resumeScaleChanges: function()
+    {
+        if (!--this._fixedScale)
+            this._calculateAndEmulate(false);
     },
 
     /**
@@ -191,19 +189,11 @@
     },
 
     /**
-     * @return {boolean}
-     */
-    isResizable: function()
-    {
-        return this._type === WebInspector.DeviceModeModel.Type.Mobile || (this._type === WebInspector.DeviceModeModel.Type.Desktop && this._fitSetting.get());
-    },
-
-    /**
      * @return {!WebInspector.Setting}
      */
-    fitSetting: function()
+    scaleSetting: function()
     {
-        return this._fitSetting;
+        return this._scaleSetting;
     },
 
     /**
@@ -217,6 +207,22 @@
     /**
      * @return {!WebInspector.Setting}
      */
+    heightSetting: function()
+    {
+        return this._heightSetting;
+    },
+
+    /**
+     * @return {!WebInspector.Setting}
+     */
+    mobileSetting: function()
+    {
+        return this._mobileSetting;
+    },
+
+    /**
+     * @return {!WebInspector.Setting}
+     */
     deviceScaleFactorSetting: function()
     {
         return this._deviceScaleFactorSetting;
@@ -227,30 +233,21 @@
      */
     defaultDeviceScaleFactor: function()
     {
-        if (this._type === WebInspector.DeviceModeModel.Type.Mobile)
-            return WebInspector.DeviceModeModel._defaultMobileScaleFactor;
+        if (this._type === WebInspector.DeviceModeModel.Type.Responsive)
+            return this._mobileSetting.get() ? WebInspector.DeviceModeModel._defaultMobileScaleFactor : this._currentDeviceScaleFactor;
         else if (this._type === WebInspector.DeviceModeModel.Type.Device)
             return this._device.deviceScaleFactor;
         else
             return this._currentDeviceScaleFactor;
     },
 
-    suspendFitScaleChanges: function()
-    {
-        ++this._fixedFitScale;
-    },
-
-    resumeFitScaleChanges: function()
-    {
-        if (!--this._fixedFitScale)
-            this._calculateAndEmulate(false);
-    },
-
     reset: function()
     {
         this._deviceScaleFactorSetting.set(0);
-        this._fitSetting.set(0);
+        this._scaleSetting.set(0);
         this._widthSetting.set(400);
+        this._heightSetting.set(700);
+        this._mobileSetting.set(true);
     },
 
     /**
@@ -279,10 +276,10 @@
 
         if (this._type === WebInspector.DeviceModeModel.Type.Device)
             this._applyTouch(this._device.touch(), this._device.mobile());
-        else if (this._type === WebInspector.DeviceModeModel.Type.Desktop)
+        else if (this._type === WebInspector.DeviceModeModel.Type.None)
             this._applyTouch(false, false);
-        else if (this._type === WebInspector.DeviceModeModel.Type.Mobile)
-            this._applyTouch(true, true);
+        else if (this._type === WebInspector.DeviceModeModel.Type.Responsive)
+            this._applyTouch(this._mobileSetting.get(), this._mobileSetting.get());
     },
 
     /**
@@ -295,9 +292,9 @@
             this._target = null;
     },
 
-    _fitSettingChanged: function()
+    _scaleSettingChanged: function()
     {
-        this._calculateAndEmulate(false);
+        this._calculateAndEmulate(true);
     },
 
     _widthSettingChanged: function()
@@ -305,6 +302,16 @@
         this._calculateAndEmulate(false);
     },
 
+    _heightSettingChanged: function()
+    {
+        this._calculateAndEmulate(false);
+    },
+
+    _mobileSettingChanged: function()
+    {
+        this._calculateAndEmulate(true);
+    },
+
     _deviceScaleFactorSettingChanged: function()
     {
         this._calculateAndEmulate(false);
@@ -324,21 +331,19 @@
             this._applyUserAgent(this._device.userAgent);
             this._applyTouch(this._device.touch(), this._device.mobile());
             this._applyScreenOrientation(this._mode.orientation == WebInspector.EmulatedDevice.Horizontal ? "landscapePrimary" : "portraitPrimary");
-        } else if (this._type === WebInspector.DeviceModeModel.Type.Desktop) {
-            var screenWidth = this._fitSetting.get() ? this._widthSetting.get() : this._availableSize.width;
-            var scale = this._calculateScale(screenWidth, 0);
-            var screenHeight = Math.floor(this._availableSize.height / scale);
-            this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), scale, this._deviceScaleFactorSetting.get(), false, resetScrollAndPageScale);
+        } else if (this._type === WebInspector.DeviceModeModel.Type.None) {
+            this._applyDeviceMetrics(this._availableSize, new Insets(0, 0, 0, 0), 1, 0, false, resetScrollAndPageScale);
             this._applyUserAgent("");
             this._applyTouch(false, false);
             this._applyScreenOrientation("");
-        } else if (this._type === WebInspector.DeviceModeModel.Type.Mobile) {
+        } else if (this._type === WebInspector.DeviceModeModel.Type.Responsive) {
             var screenWidth = this._widthSetting.get();
-            var scale = this._calculateScale(screenWidth, 0);
-            var screenHeight = Math.floor(this._availableSize.height / scale);
-            this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), scale, this._deviceScaleFactorSetting.get() || WebInspector.DeviceModeModel._defaultMobileScaleFactor, true, resetScrollAndPageScale);
-            this._applyUserAgent(WebInspector.DeviceModeModel._defaultMobileUserAgent);
-            this._applyTouch(true, true);
+            var screenHeight = this._heightSetting.get();
+            var scale = this._calculateScale(screenWidth, screenHeight);
+            var mobile = this._mobileSetting.get();
+            this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), scale, this._deviceScaleFactorSetting.get() || WebInspector.DeviceModeModel._defaultMobileScaleFactor, mobile, resetScrollAndPageScale);
+            this._applyUserAgent(mobile ? WebInspector.DeviceModeModel._defaultMobileUserAgent : "");
+            this._applyTouch(mobile, mobile);
             this._applyScreenOrientation(screenHeight >= screenWidth ? "portraitPrimary" : "landscapePrimary");
         }
         this._updateCallback.call(null);
@@ -351,13 +356,13 @@
      */
     _calculateScale: function(screenWidth, screenHeight)
     {
-        var scale = this._fitSetting.get();
+        var scale = this._scaleSetting.get();
         if (!scale) {
-            if (!screenHeight && this._fixedFitScale) {
-                scale = this._fitScale;
+            if (this._fixedScale) {
+                scale = this._scale;
             } else {
                 scale = 1;
-                while (this._availableSize.width < screenWidth * scale || (screenHeight && this._availableSize.height < screenHeight * scale))
+                while (this._availableSize.width < screenWidth * scale || this._availableSize.height < screenHeight * scale)
                     scale *= 0.8;
             }
         }
@@ -390,7 +395,7 @@
         this._appliedDeviceSize = screenSize;
         this._screenRect = new WebInspector.Rect(
             Math.max(0, (this._availableSize.width - screenSize.width * scale) / 2),
-            Math.max(0, (this._availableSize.height - screenSize.height * scale) / 2),
+            this._type === WebInspector.DeviceModeModel.Type.Device ? Math.max(0, (this._availableSize.height - screenSize.height * scale) / 2) : 0,
             screenSize.width * scale,
             screenSize.height * scale);
         this._visiblePageRect = new WebInspector.Rect(
@@ -398,7 +403,7 @@
             positionY * scale,
             Math.min(pageWidth * scale, this._availableSize.width - this._screenRect.left - positionX * scale),
             Math.min(pageHeight * scale, this._availableSize.height - this._screenRect.top - positionY * scale));
-        this._fitScale = scale;
+        this._scale = scale;
         this._appliedDeviceScaleFactor = deviceScaleFactor;
 
         if (scale === 1 && this._availableSize.width >= screenSize.width && this._availableSize.height >= screenSize.height) {
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
index fcfb04d..732d209 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
@@ -18,14 +18,11 @@
     this._model = new WebInspector.DeviceModeModel(this._updateUI.bind(this));
     this._mediaInspector = new WebInspector.MediaQueryInspector(this._model.widthSetting());
     // TODO(dgozman): remove CountUpdated event.
-    // TODO(dgozman): better media inspector UI.
-    this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.Events.HeightUpdated, this.onResize.bind(this));
     this._showMediaInspectorSetting = WebInspector.settings.createSetting("showMediaQueryInspector", false);
-    this._showMediaInspectorSetting.addChangeListener(this._showMediaInspectorSettingChanged, this);
+    this._showMediaInspectorSetting.addChangeListener(this._updateUI, this);
 
     this._inspectedPagePlaceholder = inspectedPagePlaceholder;
     this._createUI();
-    this._updateMediaInspector();
     WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._updateUI, this);
 };
 
@@ -35,8 +32,9 @@
         this._toolbar = new WebInspector.DeviceModeView.Toolbar(this._model, this._showMediaInspectorSetting);
         this.contentElement.appendChild(this._toolbar.element());
 
-        this._mediaInspectorContainer = this.contentElement.createChild("div", "device-mode-media-container");
-        this._contentArea = this.contentElement.createChild("div", "device-mode-content-area");
+        var contentClip = this.contentElement.createChild("div", "device-mode-content-clip vbox");
+        this._mediaInspectorContainer = contentClip.createChild("div", "device-mode-media-container");
+        this._contentArea = contentClip.createChild("div", "device-mode-content-area");
 
         this._screenArea = this._contentArea.createChild("div", "device-mode-screen-area");
         this._screenImage = this._screenArea.createChild("img", "device-mode-screen-image hidden");
@@ -45,41 +43,36 @@
 
         this._screenArea.appendChild(this._toolbar.screenOptionsElement());
 
-        this._resizerElement = this._screenArea.createChild("div", "device-mode-resizer");
-        this._resizerElement.createChild("div", "");
-        this._createResizer(this._resizerElement);
+        this._cornerResizerElement = this._screenArea.createChild("div", "device-mode-resizer device-mode-corner-resizer");
+        this._cornerResizerElement.createChild("div", "");
+        this._createResizer(this._cornerResizerElement, true, true);
+
+        this._widthResizerElement = this._screenArea.createChild("div", "device-mode-resizer device-mode-width-resizer");
+        this._widthResizerElement.createChild("div", "");
+        this._createResizer(this._widthResizerElement, true, false);
+
+        this._heightResizerElement = this._screenArea.createChild("div", "device-mode-resizer device-mode-height-resizer");
+        this._heightResizerElement.createChild("div", "");
+        this._createResizer(this._heightResizerElement, false, true);
 
         this._pageArea = this._screenArea.createChild("div", "device-mode-page-area");
         this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
         this._inspectedPagePlaceholder.show(this._pageArea);
     },
 
-    _showMediaInspectorSettingChanged: function()
-    {
-        this._updateMediaInspector();
-        this.onResize();
-    },
-
-    _updateMediaInspector: function()
-    {
-        var show = this._showMediaInspectorSetting.get();
-        if (this._mediaInspector.isShowing() && !show)
-            this._mediaInspector.detach();
-        if (!this._mediaInspector.isShowing() && show)
-            this._mediaInspector.show(this._mediaInspectorContainer);
-    },
-
     /**
      * @param {!Element} element
+     * @param {boolean} width
+     * @param {boolean} height
      * @return {!WebInspector.ResizerWidget}
      */
-    _createResizer: function(element)
+    _createResizer: function(element, width, height)
     {
         var resizer = new WebInspector.ResizerWidget();
         resizer.addElement(element);
-        resizer.setCursor("ew-resize");
+        resizer.setCursor(width && height ? "nwse-resize" : (width ? "ew-resize" : "ns-resize"));
         resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeStart, this._onResizeStart, this);
-        resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeUpdate, this._onResizeUpdate, this);
+        resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeUpdate, this._onResizeUpdate.bind(this, width, height));
         resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeEnd, this._onResizeEnd, this);
         return resizer;
     },
@@ -90,27 +83,43 @@
     _onResizeStart: function(event)
     {
         this._slowPositionStart = null;
-        this._resizeStart = this._model.screenRect().width;
-        this._model.suspendFitScaleChanges();
+        /** @type {!Size} */
+        this._resizeStart = this._model.screenRect().size();
+        this._model.suspendScaleChanges();
     },
 
     /**
+     * @param {boolean} width
+     * @param {boolean} height
      * @param {!WebInspector.Event} event
      */
-    _onResizeUpdate: function(event)
+    _onResizeUpdate: function(width, height, event)
     {
         if (event.data.shiftKey !== !!this._slowPositionStart)
-            this._slowPositionStart = event.data.shiftKey ? event.data.currentX : null;
+            this._slowPositionStart = event.data.shiftKey ? {x: event.data.currentX, y: event.data.currentY} : null;
 
-        var cssOffset = event.data.currentX - event.data.startX;
-        if (this._slowPositionStart)
-            cssOffset = (event.data.currentX - this._slowPositionStart) / 10 + this._slowPositionStart - event.data.startX;
-        var dipOffset = cssOffset * WebInspector.zoomManager.zoomFactor();
+        var cssOffsetX = event.data.currentX - event.data.startX;
+        var cssOffsetY = event.data.currentY - event.data.startY;
+        if (this._slowPositionStart) {
+            cssOffsetX = (event.data.currentX - this._slowPositionStart.x) / 10 + this._slowPositionStart.x - event.data.startX;
+            cssOffsetY = (event.data.currentY - this._slowPositionStart.y) / 10 + this._slowPositionStart.y - event.data.startY;
+        }
 
-        var newWidth = this._resizeStart + dipOffset * 2;
-        newWidth = Math.round(newWidth / this._model.fitScale());
-        newWidth = Math.max(Math.min(newWidth, WebInspector.DeviceModeModel.MaxDeviceSize), 1);
-        this._model.widthSetting().set(newWidth);
+        if (width) {
+            var dipOffsetX = cssOffsetX * WebInspector.zoomManager.zoomFactor();
+            var newWidth = this._resizeStart.width + dipOffsetX * 2;
+            newWidth = Math.round(newWidth / this._model.scale());
+            newWidth = Math.max(Math.min(newWidth, WebInspector.DeviceModeModel.MaxDeviceSize), 1);
+            this._model.widthSetting().set(newWidth);
+        }
+
+        if (height) {
+            var dipOffsetY = cssOffsetY * WebInspector.zoomManager.zoomFactor();
+            var newHeight = this._resizeStart.height + dipOffsetY;
+            newHeight = Math.round(newHeight / this._model.scale());
+            newHeight = Math.max(Math.min(newHeight, WebInspector.DeviceModeModel.MaxDeviceSize), 1);
+            this._model.heightSetting().set(newHeight);
+        }
     },
 
     /**
@@ -119,7 +128,7 @@
     _onResizeEnd: function(event)
     {
         delete this._resizeStart;
-        this._model.resumeFitScaleChanges();
+        this._model.resumeScaleChanges();
     },
 
     updatePageResizer: function()
@@ -134,6 +143,7 @@
 
         var zoomFactor = WebInspector.zoomManager.zoomFactor();
         var resizePagePlaceholder = false;
+        var resizeSelf = false;
 
         var cssScreenRect = this._model.screenRect().scale(1 / zoomFactor);
         if (!cssScreenRect.isEqual(this._cachedCssScreenRect)) {
@@ -155,17 +165,32 @@
             this._cachedCssVisiblePageRect = cssVisiblePageRect;
         }
 
-        var resizable = this._model.isResizable();
+        var resizable = this._model.type() === WebInspector.DeviceModeModel.Type.Responsive;
         if (resizable !== this._cachedResizable) {
-            this._resizerElement.classList.toggle("hidden", !resizable);
+            this._widthResizerElement.classList.toggle("hidden", !resizable);
+            this._heightResizerElement.classList.toggle("hidden", !resizable);
+            this._cornerResizerElement.classList.toggle("hidden", !resizable);
             this._cachedResizable = resizable;
         }
 
+        var mediaInspectorVisible = this._showMediaInspectorSetting.get() && this._model.type() !== WebInspector.DeviceModeModel.Type.None;
+        if (mediaInspectorVisible !== this._cachedMediaInspectorVisible) {
+            if (mediaInspectorVisible)
+                this._mediaInspector.show(this._mediaInspectorContainer);
+            else
+                this._mediaInspector.detach();
+            resizePagePlaceholder = true;
+            resizeSelf = true;
+            this._cachedMediaInspectorVisible = mediaInspectorVisible;
+        }
+
         this._toolbar.update();
         this._loadScreenImage(this._model.screenImage());
         if (resizePagePlaceholder)
             this._inspectedPagePlaceholder.onResize();
-        this._mediaInspector.setAxisTransform(-cssScreenRect.left / this._model.fitScale(), this._model.fitScale());
+        this._mediaInspector.setAxisTransform(-cssScreenRect.left / this._model.scale(), this._model.scale());
+        if (resizeSelf)
+            this.onResize();
     },
 
     /**
@@ -193,9 +218,12 @@
      */
     onResize: function()
     {
+        if (!this.isShowing())
+            return;
+
         var zoomFactor = WebInspector.zoomManager.zoomFactor();
         var rect = this._contentArea.getBoundingClientRect();
-        this._model.availableSizeChanged(new Size(Math.max(rect.width * zoomFactor, 1), Math.max(rect.height * zoomFactor, 1)));
+        this._model.setAvailableSize(new Size(Math.max(rect.width * zoomFactor, 1), Math.max(rect.height * zoomFactor, 1)));
     },
 
     /**
@@ -242,54 +270,70 @@
     var buttonsToolbarContainer = this._element.createChild("div", "device-mode-buttons-toolbar");
     buttonsToolbarContainer.createChild("div", "flex-auto");
     var buttonsToolbar = new WebInspector.Toolbar("", buttonsToolbarContainer);
-    this._desktopItem = new WebInspector.ToolbarButton(WebInspector.UIString("Desktop"), "desktop-toolbar-item");
-    buttonsToolbar.appendToolbarItem(this._desktopItem);
-    this._desktopItem.addEventListener("click", this._desktopButtonClick, this);
-    this._mobileItem = new WebInspector.ToolbarButton(WebInspector.UIString("Mobile"), "emulation-toolbar-item");
-    buttonsToolbar.appendToolbarItem(this._mobileItem);
-    this._mobileItem.addEventListener("click", this._mobileButtonClick, this);
+    this._noneItem = new WebInspector.ToolbarButton(WebInspector.UIString("Full"), "desktop-toolbar-item");
+    buttonsToolbar.appendToolbarItem(this._noneItem);
+    this._noneItem.addEventListener("click", this._noneButtonClick, this);
+    this._responsiveItem = new WebInspector.ToolbarButton(WebInspector.UIString("Responsive"), "enter-fullscreen-toolbar-item");
+    buttonsToolbar.appendToolbarItem(this._responsiveItem);
+    this._responsiveItem.addEventListener("click", this._responsiveButtonClick, this);
+    this._deviceItem = new WebInspector.ToolbarButton(WebInspector.UIString("Device"), "emulation-toolbar-item");
+    buttonsToolbar.appendToolbarItem(this._deviceItem);
+    this._deviceItem.addEventListener("click", this._deviceButtonClick, this);
 
-    this._optionsToolbar = new WebInspector.Toolbar("device-mode-options-toolbar", this._element);
-    this._optionsToolbar.appendSeparator();
+    var optionsContainer = this._element.createChild("div", "device-mode-options-toolbar");
+    var optionsToolbar = new WebInspector.Toolbar("", optionsContainer);
+    optionsToolbar.appendSeparator();
 
     this._deviceSelect = this._createDeviceSelect();
     this._deviceSelectItem = this._wrapToolbarItem(this._deviceSelect);
-    this._optionsToolbar.appendToolbarItem(this._deviceSelectItem);
+    optionsToolbar.appendToolbarItem(this._deviceSelectItem);
 
     var widthInput = createElementWithClass("input", "device-mode-size-input");
     widthInput.maxLength = 5;
     widthInput.title = WebInspector.UIString("Width");
     WebInspector.SettingsUI.bindSettingInputField(widthInput, this._model.widthSetting(), true, WebInspector.DeviceModeModel.deviceSizeValidator, true);
     this._widthItem = this._wrapToolbarItem(widthInput);
-    this._optionsToolbar.appendToolbarItem(this._widthItem);
+    optionsToolbar.appendToolbarItem(this._widthItem);
 
     this._appliedWidthInput = createElementWithClass("input", "device-mode-size-input");
     this._appliedWidthInput.title = WebInspector.UIString("Width");
     this._appliedWidthInput.disabled = true;
     this._appliedWidthItem = this._wrapToolbarItem(this._appliedWidthInput);
-    this._optionsToolbar.appendToolbarItem(this._appliedWidthItem);
+    optionsToolbar.appendToolbarItem(this._appliedWidthItem);
 
     var xElement = createElementWithClass("div", "device-mode-x");
     xElement.textContent = "\u00D7";
-    this._xItem = this._wrapToolbarItem(xElement);
-    this._optionsToolbar.appendToolbarItem(this._xItem);
+    optionsToolbar.appendToolbarItem(this._wrapToolbarItem(xElement));
+
+    var heightInput = createElementWithClass("input", "device-mode-size-input");
+    heightInput.maxLength = 5;
+    heightInput.title = WebInspector.UIString("Height");
+    WebInspector.SettingsUI.bindSettingInputField(heightInput, this._model.heightSetting(), true, WebInspector.DeviceModeModel.deviceSizeValidator, true);
+    this._heightItem = this._wrapToolbarItem(heightInput);
+    optionsToolbar.appendToolbarItem(this._heightItem);
 
     this._appliedHeightInput = createElementWithClass("input", "device-mode-size-input");
     this._appliedHeightInput.title = WebInspector.UIString("Height");
     this._appliedHeightInput.disabled = true;
     this._appliedHeightItem = this._wrapToolbarItem(this._appliedHeightInput);
-    this._optionsToolbar.appendToolbarItem(this._appliedHeightItem);
+    optionsToolbar.appendToolbarItem(this._appliedHeightItem);
 
-    this._deviceScaleFactorItem = new WebInspector.ToolbarText("", "fullscreen-toolbar-item");
+    this._deviceScaleFactorItem = new WebInspector.ToolbarText("", "resize-toolbar-item");
     this._deviceScaleFactorItem.element.title = WebInspector.UIString("Device pixel ratio");
     this._deviceScaleFactorItem.showGlyph();
-    this._optionsToolbar.appendToolbarItem(this._deviceScaleFactorItem);
+    optionsToolbar.appendToolbarItem(this._deviceScaleFactorItem);
 
-    this._optionsToolbar.appendSeparator();
+    optionsToolbar.appendSeparator();
 
-    this._optionsToolbar.appendToolbarItem(new WebInspector.ToolbarMenuButton(WebInspector.UIString("More options"), "menu-toolbar-item", this._appendMenuItems.bind(this)));
+    optionsToolbar.appendToolbarItem(new WebInspector.ToolbarMenuButton(WebInspector.UIString("More options"), "menu-toolbar-item", this._appendMenuItems.bind(this)));
 
-    this._persistenceSetting = WebInspector.settings.createSetting("emulation.deviceModeViewPersistence", {type: WebInspector.DeviceModeModel.Type.Desktop, device: "", orientation: "", mode: ""});
+    optionsContainer.createChild("div", "device-mode-toolbar-spacer");
+    var rightToolbar = new WebInspector.Toolbar("", optionsContainer);
+    this._scaleItem = new WebInspector.ToolbarText(WebInspector.UIString("Zoom"), "");
+    this._scaleItem.makeDimmed();
+    rightToolbar.appendToolbarItem(this._scaleItem);
+
+    this._persistenceSetting = WebInspector.settings.createSetting("emulation.deviceModeViewPersistence", {type: WebInspector.DeviceModeModel.Type.None, device: "", orientation: "", mode: ""});
     this._restored = false;
 }
 
@@ -299,50 +343,55 @@
      */
     _appendMenuItems: function(contextMenu)
     {
-        var fitSetting = this._model.fitSetting();
-        appendFitItem(WebInspector.UIString("Fit"), 0);
-        appendFitItem(WebInspector.UIString("50%"), 0.5);
-        appendFitItem(WebInspector.UIString("100%"), 1);
-        appendFitItem(WebInspector.UIString("200%"), 2);
+        var disabled = this._model.type() === WebInspector.DeviceModeModel.Type.None;
+        var zoomSubmenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Zoom"), false);
+        var scaleSetting = this._model.scaleSetting();
+        appendScaleItem(WebInspector.UIString("Fit"), 0);
+        zoomSubmenu.appendSeparator();
+        appendScaleItem(WebInspector.UIString("25%"), 0.25);
+        appendScaleItem(WebInspector.UIString("50%"), 0.5);
+        appendScaleItem(WebInspector.UIString("100%"), 1);
+        appendScaleItem(WebInspector.UIString("150%"), 1.5);
+        appendScaleItem(WebInspector.UIString("200%"), 2);
 
         /**
          * @param {string} title
          * @param {number} value
          */
-        function appendFitItem(title, value)
+        function appendScaleItem(title, value)
         {
-            contextMenu.appendCheckboxItem(title, fitSetting.set.bind(fitSetting, value), fitSetting.get() === value, false);
+            zoomSubmenu.appendCheckboxItem(title, scaleSetting.set.bind(scaleSetting, value), scaleSetting.get() === value, disabled);
         }
 
+        disabled = this._model.type() !== WebInspector.DeviceModeModel.Type.Responsive;
+        var mobileSetting = this._model.mobileSetting();
+        var mobileSubmenu = contextMenu.appendSubMenuItem(WebInspector.UIString("User agent type"), false);
+        mobileSubmenu.appendCheckboxItem(WebInspector.UIString("Mobile"), mobileSetting.set.bind(mobileSetting, true), mobileSetting.get(), disabled);
+        mobileSubmenu.appendCheckboxItem(WebInspector.UIString("Desktop"), mobileSetting.set.bind(mobileSetting, false), !mobileSetting.get(), disabled);
+
+        disabled = this._model.type() !== WebInspector.DeviceModeModel.Type.Responsive;
+        var dprSubmenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Device pixel ratio"), false);
+        var deviceScaleFactorSetting = this._model.deviceScaleFactorSetting();
+        appendScaleFactorItem(WebInspector.UIString("Default: %f", this._model.defaultDeviceScaleFactor()), 0);
+        dprSubmenu.appendSeparator();
+        appendScaleFactorItem(WebInspector.UIString("1"), 1);
+        appendScaleFactorItem(WebInspector.UIString("2"), 2);
+        appendScaleFactorItem(WebInspector.UIString("3"), 3);
+
+        /**
+         * @param {string} title
+         * @param {number} value
+         */
+        function appendScaleFactorItem(title, value)
+        {
+            dprSubmenu.appendCheckboxItem(title, deviceScaleFactorSetting.set.bind(deviceScaleFactorSetting, value), deviceScaleFactorSetting.get() === value, disabled);
+        }
+
+        contextMenu.appendItem(WebInspector.UIString("Reset to defaults"), this._model.reset.bind(this._model), this._model.type() !== WebInspector.DeviceModeModel.Type.Responsive);
         contextMenu.appendSeparator();
 
-        contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries"), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get(), false);
-
-        var submenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Device pixel ratio"), false);
-        if (this._model.type() === WebInspector.DeviceModeModel.Type.Device) {
-            submenu.appendCheckboxItem(WebInspector.UIString("Default: %f", this._model.device().deviceScaleFactor), function(){}, true, false);
-        } else {
-            var deviceScaleFactorSetting = this._model.deviceScaleFactorSetting();
-
-            /**
-             * @param {string} title
-             * @param {number} value
-             */
-            function appendScaleFactorItem(title, value)
-            {
-                submenu.appendCheckboxItem(title, deviceScaleFactorSetting.set.bind(deviceScaleFactorSetting, value), deviceScaleFactorSetting.get() === value, false);
-            }
-
-            appendScaleFactorItem(WebInspector.UIString("Default: %f", this._model.defaultDeviceScaleFactor()), 0);
-            appendScaleFactorItem(WebInspector.UIString("1"), 1);
-            appendScaleFactorItem(WebInspector.UIString("2"), 2);
-            appendScaleFactorItem(WebInspector.UIString("3"), 3);
-        }
-
+        contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries"), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get(), this._model.type() === WebInspector.DeviceModeModel.Type.None);
         contextMenu.appendItem(WebInspector.UIString("Configure network\u2026"), this._openNetworkConfig.bind(this), false);
-
-        if (this._model.type() !== WebInspector.DeviceModeModel.Type.Device)
-            contextMenu.appendItem(WebInspector.UIString("Reset to default"), this._model.reset.bind(this._model), false);
     },
 
     _toggleMediaInspector: function()
@@ -370,21 +419,27 @@
         return new WebInspector.ToolbarItem(container);
     },
 
-    _desktopButtonClick: function()
+    _noneButtonClick: function()
     {
-        this._model.emulate(WebInspector.DeviceModeModel.Type.Desktop, null, null);
+        this._model.emulate(WebInspector.DeviceModeModel.Type.None, null, null);
     },
 
-    _mobileButtonClick: function()
+    _responsiveButtonClick: function()
     {
-        for (var i = 0; i < this._deviceSelect.options.length; ++i) {
-            var option = this._deviceSelect.options[i];
-            if (option.device === this._lastDevice) {
-                this._emulateDeviceSelectOption(option);
-                return;
-            }
-        }
-        this._emulateDeviceSelectOption(this._deviceSelect.options[0]);
+        this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null);
+    },
+
+    _deviceButtonClick: function()
+    {
+        this._emulateDevice(this._lastDevice || this._deviceSelect.options[0].device || WebInspector.emulatedDevicesList.standard()[0]);
+    },
+
+    /**
+     * @param {!WebInspector.EmulatedDevice} device
+     */
+    _emulateDevice: function(device)
+    {
+        this._model.emulate(WebInspector.DeviceModeModel.Type.Device, device, this._lastMode.get(device) || device.modes[0]);
     },
 
     /**
@@ -406,10 +461,6 @@
         {
             select.removeChildren();
 
-            var defaultGroup = select.createChild("optgroup");
-            defaultGroup.label = WebInspector.UIString("Default");
-            addOption.call(this, defaultGroup, WebInspector.DeviceModeModel.Type.Mobile, null, WebInspector.UIString("Responsive"));
-
             var devicesGroup = select.createChild("optgroup");
             devicesGroup.label = WebInspector.UIString("Devices");
             addGroup.call(this, devicesGroup, WebInspector.emulatedDevicesList.standard());
@@ -432,24 +483,21 @@
             devices = devices.filter(function(d) { return d.show(); });
             devices.sort(WebInspector.EmulatedDevice.compareByTitle);
             for (var device of devices)
-                addOption.call(this, parent, WebInspector.DeviceModeModel.Type.Device, device, device.title);
+                addOption.call(this, parent, device);
         }
 
         /**
          * @param {!Element} parent
-         * @param {!WebInspector.DeviceModeModel.Type} type
-         * @param {?WebInspector.EmulatedDevice} device
-         * @param {string} title
+         * @param {!WebInspector.EmulatedDevice} device
          * @this {WebInspector.DeviceModeView.Toolbar}
          */
-        function addOption(parent, type, device, title)
+        function addOption(parent, device)
         {
-            var option = new Option(title, title);
+            var option = new Option(device.title, device.title);
             option.device = device;
-            option.type = type;
             parent.appendChild(option);
 
-            if (type === this._model.type() && device === this._model.device())
+            if (device === this._model.device())
                 select.selectedIndex = Array.prototype.slice.call(select.options).indexOf(option);
         }
 
@@ -463,7 +511,7 @@
                 WebInspector.emulatedDevicesList.revealCustomSetting();
                 this._updateDeviceSelectedIndex();
             } else {
-                this._emulateDeviceSelectOption(option);
+                this._emulateDevice(option.device);
             }
         }
     },
@@ -477,14 +525,6 @@
     },
 
     /**
-     * @param {!Option} option
-     */
-    _emulateDeviceSelectOption: function(option)
-    {
-        this._model.emulate(option.type, option.device, option.device ? (this._lastMode.get(option.device) || option.device.modes[0]) : null);
-    },
-
-    /**
      * @param {!WebInspector.Event} event
      */
     _modeMenuClicked: function(event)
@@ -561,42 +601,29 @@
         var updatePersistence = false;
 
         if (this._model.type() !== this._cachedModelType) {
-            var isDesktop = this._model.type() === WebInspector.DeviceModeModel.Type.Desktop;
-            this._desktopItem.setToggled(isDesktop);
-            this._mobileItem.setToggled(!isDesktop);
-            this._deviceSelectItem.setVisible(!isDesktop);
+            this._noneItem.setToggled(this._model.type() === WebInspector.DeviceModeModel.Type.None);
+            this._responsiveItem.setToggled(this._model.type() === WebInspector.DeviceModeModel.Type.Responsive);
+            this._deviceItem.setToggled(this._model.type() === WebInspector.DeviceModeModel.Type.Device);
+            this._deviceSelectItem.setVisible(this._model.type() === WebInspector.DeviceModeModel.Type.Device);
             this._cachedModelType = this._model.type();
             updatePersistence = true;
         }
 
-        var resizable = this._model.isResizable();
+        var resizable = this._model.type() === WebInspector.DeviceModeModel.Type.Responsive;
         if (resizable !== this._cachedResizable) {
             this._widthItem.setVisible(resizable);
+            this._heightItem.setVisible(resizable);
+            this._appliedWidthItem.setVisible(!resizable);
+            this._appliedHeightItem.setVisible(!resizable);
             this._cachedResizable = resizable;
         }
 
-        var showWidth = this._model.type() === WebInspector.DeviceModeModel.Type.Device || (this._model.type() === WebInspector.DeviceModeModel.Type.Desktop && !resizable);
-        if (showWidth !== this._cachedShowWidth) {
-            this._appliedWidthItem.setVisible(showWidth);
-            this._cachedShowWidth = showWidth;
-        }
-
-        if (showWidth) {
+        if (!resizable) {
             var width = this._model.appliedDeviceSize().width;
             if (width !== this._cachedWidth) {
                 this._appliedWidthInput.value = width;
                 this._cachedWidth = width;
             }
-        }
-
-        var showHeight = true;
-        if (showHeight !== this._cachedShowHeight) {
-            this._appliedHeightItem.setVisible(showHeight);
-            this._xItem.setVisible(showHeight);
-            this._cachedShowHeight = showHeight;
-        }
-
-        if (showHeight) {
             var height = this._model.appliedDeviceSize().height;
             if (height !== this._cachedHeight) {
                 this._appliedHeightInput.value = height;
@@ -618,6 +645,20 @@
             }
         }
 
+        var showScale = this._model.scale() !== 1;
+        if (showScale !== this._cachedShowScale) {
+            this._scaleItem.setVisible(showScale);
+            this._cachedShowScale = showScale;
+        }
+
+        if (showScale) {
+            var scale = this._model.scale();
+            if (scale !== this._cachedScale) {
+                this._scaleItem.setText(WebInspector.UIString("Zoom: %.2f", scale));
+                this._cachedScale = scale;
+            }
+        }
+
         if (this._model.device() !== this._cachedModelDevice) {
             var device = this._model.device();
 
@@ -629,11 +670,10 @@
             updatePersistence = true;
         }
 
-        if (this._model.device() && this._model.mode())
-            this._lastMode.set(/** @type {!WebInspector.EmulatedDevice} */ (this._model.device()), /** @type {!WebInspector.EmulatedDevice.Mode} */ (this._model.mode()));
-
-        if (this._model.type() !== WebInspector.DeviceModeModel.Type.Desktop)
+        if (this._model.type() === WebInspector.DeviceModeModel.Type.Device) {
             this._lastDevice = this._model.device();
+            this._lastMode.set(/** @type {!WebInspector.EmulatedDevice} */ (this._model.device()), /** @type {!WebInspector.EmulatedDevice.Mode} */ (this._model.mode()));
+        }
 
         if (this._model.mode() !== this._cachedModelMode) {
             this._cachedModelMode = this._model.mode();
@@ -657,8 +697,8 @@
 
         this._restored = true;
         var type = this._persistenceSetting.get().type;
-        if (type === WebInspector.DeviceModeModel.Type.Mobile) {
-            this._model.emulate(WebInspector.DeviceModeModel.Type.Mobile, null, null);
+        if (type === WebInspector.DeviceModeModel.Type.Responsive) {
+            this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null);
         } else if (type === WebInspector.DeviceModeModel.Type.Device) {
             var device = null;
             for (var i = 0; i < this._deviceSelect.options.length; ++i) {
@@ -673,10 +713,10 @@
                 }
                 this._model.emulate(WebInspector.DeviceModeModel.Type.Device, device, mode || device.modes[0]);
             } else {
-                this._model.emulate(WebInspector.DeviceModeModel.Type.Mobile, null, null);
+                this._model.emulate(WebInspector.DeviceModeModel.Type.None, null, null);
             }
         } else {
-            this._model.emulate(WebInspector.DeviceModeModel.Type.Desktop, null, null);
+            this._model.emulate(WebInspector.DeviceModeModel.Type.None, null, null);
         }
     }
 }
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js b/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js
index 85f4641..d8415a8 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/EmulatedDevices.js
@@ -403,7 +403,6 @@
 WebInspector.EmulatedDevicesList = function()
 {
     WebInspector.Object.call(this);
-    WebInspector.settings.createSetting("standardEmulatedDeviceList", []).remove();
 
     /** @type {!WebInspector.Setting} */
     this._standardSetting = WebInspector.settings.createSetting("standardEmulatedDeviceList", []);
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js b/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js
index afc432a..50786b4 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/MediaQueryInspector.js
@@ -37,7 +37,6 @@
 }
 
 WebInspector.MediaQueryInspector.Events = {
-    HeightUpdated: "HeightUpdated",
     CountUpdated: "CountUpdated"
 }
 
@@ -278,9 +277,6 @@
             container.appendChild(bar);
         }
         this.contentElement.scrollTop = scrollTop;
-        this.contentElement.classList.toggle("media-inspector-view-empty", !this.contentElement.children.length);
-        if (this.contentElement.children.length !== oldChildrenCount)
-            this.dispatchEventToListeners(WebInspector.MediaQueryInspector.Events.HeightUpdated);
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/ResponsiveDesignView.js b/third_party/WebKit/Source/devtools/front_end/emulation/ResponsiveDesignView.js
index 56541828..ed63a633 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/ResponsiveDesignView.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/ResponsiveDesignView.js
@@ -105,7 +105,6 @@
         this._increasePageScaleButton.addEventListener("click", this._pageScaleButtonClicked.bind(this, true), false);
 
         this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.Events.CountUpdated, this._updateMediaQueryInspectorButton, this);
-        this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.Events.HeightUpdated, this.onResize, this);
         this._overridesWarningUpdated();
     },
 
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css
index 38546a5..a9de7ee 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeToolbar.css
@@ -7,9 +7,9 @@
 .device-mode-size-input {
     background: hsl(0, 0%, 100%);
     border: none;
-    padding: 2px 4px;
-    width: 45px !important;
-    margin: 0;
+    padding: 2px 0;
+    width: 39px !important;
+    margin: 0 3px;
     text-align: center;
 }
 
@@ -37,3 +37,10 @@
     margin: 0;
     width: 120px;
 }
+
+.device-mode-checkbox {
+    width: 120px;
+    display: flex;
+    flex-direction: row;
+    justify-content: center;
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css
index 45e29b4..fdf92b19 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/deviceModeView.css
@@ -31,6 +31,21 @@
 
 .device-mode-options-toolbar {
     flex: 5 0 0;
+    display: flex;
+    padding-right: 10px;
+}
+
+.device-mode-options-toolbar .toolbar {
+    flex: none;
+}
+
+.device-mode-toolbar-spacer {
+    flex: auto;
+}
+
+.device-mode-content-clip {
+    overflow: hidden;
+    flex: auto;
 }
 
 .device-mode-media-container {
@@ -42,7 +57,6 @@
     flex: auto;
     position: relative;
     margin: 0;
-    overflow: hidden;
 }
 
 .device-mode-screen-area {
@@ -78,15 +92,10 @@
 
 .device-mode-resizer {
     position: absolute;
-    top: 0;
-    bottom: 0;
-    right: -14px;
-    width: 14px;
     display: flex;
     align-items: center;
     justify-content: center;
-    background-color: hsla(0, 0%, 0%, 0.02);
-    transition: background-color 0.2s ease;
+    transition: background-color 0.1s ease;
 }
 
 .device-mode-resizer:hover {
@@ -96,6 +105,41 @@
 .device-mode-resizer > div {
     content: url(Images/toolbarResizerHorizontal.png);
     pointer-events: none;
+    margin: 0 0 0 1px;
+}
+
+.device-mode-width-resizer {
+    top: 0;
+    bottom: 0;
+    right: -14px;
+    width: 14px;
+}
+
+.device-mode-height-resizer {
+    left: 0;
+    right: 0;
+    bottom: -14px;
+    height: 14px;
+}
+
+.device-mode-height-resizer > div {
+    transform: rotate(90deg);
+    margin: 1px 0 0 0;
+}
+
+.device-mode-corner-resizer {
+    left: 0;
+    top: 0;
+    right: -14px;
+    bottom: -14px;
+    background-color: hsla(0, 0%, 0%, 0.02);
+}
+
+.device-mode-corner-resizer > div {
+    position: absolute;
+    right: 2px;
+    bottom: 2px;
+    transform: rotate(45deg);
 }
 
 .device-mode-page-area {
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/mediaQueryInspector.css b/third_party/WebKit/Source/devtools/front_end/emulation/mediaQueryInspector.css
index 7046717e..f422939 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/mediaQueryInspector.css
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/mediaQueryInspector.css
@@ -6,6 +6,10 @@
 
 /* Media query bars */
 
+.media-inspector-view {
+    height: 50px;
+}
+
 .media-inspector-marker-container {
     position: relative;
     height: 14px;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index 65c6a3761..8f5c0014 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -312,6 +312,11 @@
         }
     },
 
+    makeDimmed: function()
+    {
+        this.element.classList.add("toolbar-text-dimmed");
+    },
+
     __proto__: WebInspector.ToolbarItem.prototype
 }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css b/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css
index f53bd1e..7948395f4 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css
+++ b/third_party/WebKit/Source/devtools/front_end/ui/toolbar.css
@@ -64,6 +64,10 @@
     margin: 0 3px 0 -3px;
 }
 
+.toolbar-text-dimmed {
+    color: #777;
+}
+
 .toolbar-item:active {
     position: relative;
     z-index: 200;
@@ -575,6 +579,14 @@
     -webkit-mask-position: -192px -144px;
 }
 
-.fullscreen-toolbar-item .glyph {
+.resize-toolbar-item .glyph {
     -webkit-mask-position: -224px -144px;
 }
+
+.enter-fullscreen-toolbar-item .glyph {
+    -webkit-mask-position: -256px -96px;
+}
+
+.exit-fullscreen-toolbar-item .glyph {
+    -webkit-mask-position: -288px -96px;
+}
diff --git a/third_party/WebKit/Source/devtools/protocol.json b/third_party/WebKit/Source/devtools/protocol.json
index eefed2fe..813bb5d 100644
--- a/third_party/WebKit/Source/devtools/protocol.json
+++ b/third_party/WebKit/Source/devtools/protocol.json
@@ -290,6 +290,7 @@
             },
             {
                 "name": "searchInResource",
+                "async": true,
                 "description": "Searches for given string in resource content.",
                 "parameters": [
                     { "name": "frameId", "$ref": "FrameId", "description": "Frame id for resource to search in." },
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp
index 4bd0084..fde05fb 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp
@@ -8,7 +8,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp
index 663d1a3f..b18ab8f9 100644
--- a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp
+++ b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp
@@ -21,10 +21,10 @@
 #include "modules/fetch/Response.h"
 #include "public/platform/WebURLResponse.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 
 #include <algorithm>
-#include <gtest/gtest.h>
 #include <string>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp
index 48eeb0c..fd27941 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp
@@ -19,8 +19,8 @@
 #include "modules/canvas2d/HitRegionOptions.h"
 #include "modules/webgl/WebGLRenderingContext.h"
 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using ::testing::Mock;
 
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
index 63dc435..2b5eb6b9 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
@@ -19,9 +19,9 @@
 #include "platform/graphics/RecordingImageBufferSurface.h"
 #include "platform/graphics/StaticBitmapImage.h"
 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkSurface.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using ::testing::Mock;
 
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerManagerTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerManagerTest.cpp
index 6c5d3df7..7ad8c52 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerManagerTest.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerManagerTest.cpp
@@ -19,7 +19,7 @@
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebWaitableEvent.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
index 769fc35b..d1ad0c40 100644
--- a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
@@ -8,11 +8,10 @@
 #include "core/testing/DummyPageHolder.h"
 #include "modules/fetch/DataConsumerHandleTestUtil.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
 namespace blink {
 
 namespace {
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp
index 72b6eb38..b2d4d81 100644
--- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp
@@ -13,11 +13,10 @@
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
 #include "public/platform/WebWaitableEvent.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Locker.h"
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
 namespace blink {
 
 namespace {
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
index 531710ab..8743e63 100644
--- a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
@@ -15,10 +15,9 @@
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
 #include "public/platform/WebWaitableEvent.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-
-#include <gtest/gtest.h>
 #include <string.h>
 #include <v8.h>
 
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
index 0ea62fd3..c1f5a2f 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
@@ -17,11 +17,10 @@
 #include "platform/network/ResourceRequest.h"
 #include "platform/network/ResourceResponse.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 #include <string.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp
index 9f41742..5bdb5a2 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp
@@ -6,9 +6,8 @@
 #include "modules/fetch/FetchDataLoader.h"
 
 #include "modules/fetch/DataConsumerHandleTestUtil.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
index f97fb0eb..500b9e71 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
@@ -14,13 +14,12 @@
 #include "platform/network/ResourceResponse.h"
 #include "platform/testing/UnitTestHelpers.h"
 #include "platform/weborigin/KURL.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/TextEncoding.h"
 #include "wtf/text/WTFString.h"
-
-#include <gtest/gtest.h>
 #include <string.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseDataTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchResponseDataTest.cpp
index 707bb27a..9f8ab77 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchResponseDataTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchResponseDataTest.cpp
@@ -9,8 +9,7 @@
 #include "modules/fetch/FetchHeaderList.h"
 #include "platform/blob/BlobData.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/fetch/RequestInit.cpp b/third_party/WebKit/Source/modules/fetch/RequestInit.cpp
index 98b3dea..d041edf 100644
--- a/third_party/WebKit/Source/modules/fetch/RequestInit.cpp
+++ b/third_party/WebKit/Source/modules/fetch/RequestInit.cpp
@@ -11,6 +11,7 @@
 #include "bindings/core/v8/V8Binding.h"
 #include "bindings/core/v8/V8Blob.h"
 #include "bindings/core/v8/V8FormData.h"
+#include "bindings/core/v8/V8URLSearchParams.h"
 #include "core/fileapi/Blob.h"
 #include "core/html/FormData.h"
 #include "modules/fetch/FetchBlobDataConsumerHandle.h"
@@ -78,6 +79,10 @@
         // FormDataEncoder::generateUniqueBoundaryString.
         contentType = AtomicString("multipart/form-data; boundary=", AtomicString::ConstructFromLiteral) + formData->boundary().data();
         body = FetchFormDataConsumerHandle::create(context, formData.release());
+    } else if (V8URLSearchParams::hasInstance(v8Body, isolate)) {
+        RefPtr<EncodedFormData> formData = V8URLSearchParams::toImpl(v8::Local<v8::Object>::Cast(v8Body))->encodeFormData();
+        contentType = AtomicString("application/x-www-form-urlencoded;charset=UTF-8", AtomicString::ConstructFromLiteral);
+        body = FetchFormDataConsumerHandle::create(context, formData.release());
     } else if (v8Body->IsString()) {
         contentType = "text/plain;charset=UTF-8";
         body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState));
diff --git a/third_party/WebKit/Source/modules/fetch/RequestTest.cpp b/third_party/WebKit/Source/modules/fetch/RequestTest.cpp
index 0c6fed4..480cbb0 100644
--- a/third_party/WebKit/Source/modules/fetch/RequestTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/RequestTest.cpp
@@ -12,9 +12,9 @@
 #include "core/testing/DummyPageHolder.h"
 #include "public/platform/WebURLRequest.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/HashMap.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp b/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp
index 80025e9..5401de3 100644
--- a/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp
@@ -18,7 +18,7 @@
 #include "platform/blob/BlobData.h"
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp
index acdc326..fe9f27e4 100644
--- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp
@@ -8,7 +8,7 @@
 #include "core/fileapi/File.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp
index 569f63d..033678e 100644
--- a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp
+++ b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapModuleTest.cpp
@@ -11,8 +11,7 @@
 #include "core/html/HTMLCanvasElement.h"
 #include "modules/canvas2d/CanvasRenderingContext2D.h"
 #include "platform/heap/Handle.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBKeyPathTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBKeyPathTest.cpp
index a6bc0e5..f96a502c 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBKeyPathTest.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBKeyPathTest.cpp
@@ -29,10 +29,9 @@
 #include "bindings/core/v8/SerializedScriptValue.h"
 #include "bindings/modules/v8/V8BindingForModules.h"
 #include "modules/indexeddb/IDBKey.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 namespace {
 
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
index d55ca470..4a23f0062 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
@@ -39,12 +39,12 @@
 #include "modules/indexeddb/IDBValue.h"
 #include "modules/indexeddb/MockWebIDBDatabase.h"
 #include "platform/SharedBuffer.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/dtoa/utils.h"
-#include <gtest/gtest.h>
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
index 45cd516..e36581b 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
@@ -39,7 +39,7 @@
 #include "modules/indexeddb/IDBDatabaseCallbacks.h"
 #include "modules/indexeddb/MockWebIDBDatabase.h"
 #include "platform/SharedBuffer.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp
index ccf38ed06..8927e8a 100644
--- a/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp
+++ b/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp
@@ -8,8 +8,8 @@
 #include "core/dom/Document.h"
 #include "core/testing/DummyPageHolder.h"
 #include "public/platform/modules/mediasession/WebMediaSession.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using ::testing::_;
 using ::testing::Invoke;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp
index fe46097a..72d73f4 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp
@@ -14,9 +14,9 @@
 #include "public/platform/WebRTCDataChannelHandler.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/platform/WebVector.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
index 39b1916c..d446cee 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -10,9 +10,9 @@
 #include "core/testing/NullExecutionContext.h"
 #include "modules/notifications/Notification.h"
 #include "modules/notifications/NotificationOptions.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/HashMap.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityTest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityTest.cpp
index 7f56c10..28301be 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityTest.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationAvailabilityTest.cpp
@@ -12,7 +12,7 @@
 #include "core/testing/DummyPageHolder.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/weborigin/KURL.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp b/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp
index a2f55f6..3e10f1b 100644
--- a/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp
+++ b/third_party/WebKit/Source/modules/push_messaging/PushManager.cpp
@@ -63,7 +63,6 @@
     // different contexts can succeed.
     if (scriptState->executionContext()->isDocument()) {
         Document* document = toDocument(scriptState->executionContext());
-        // FIXME: add test coverage for this condition - https://crbug.com/440431
         if (!document->domWindow() || !document->frame())
             return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Document is detached from window."));
         PushController::clientFrom(document->frame()).subscribe(m_registration->webRegistration(), toWebPushSubscriptionOptions(options), new PushSubscriptionCallbacks(resolver, m_registration));
@@ -87,7 +86,6 @@
 {
     if (scriptState->executionContext()->isDocument()) {
         Document* document = toDocument(scriptState->executionContext());
-        // FIXME: add test coverage for this condition - https://crbug.com/440431
         if (!document->domWindow() || !document->frame())
             return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Document is detached from window."));
     }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
index 52e8095..4fa521d 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
@@ -23,10 +23,10 @@
 #include "public/platform/WebURL.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp
index d83832a..bc863ca 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp
@@ -8,7 +8,7 @@
 #include "core/testing/DummyPageHolder.h"
 #include "modules/webaudio/OfflineAudioContext.h"
 #include "platform/audio/AudioProcessor.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp
index a45a7b2..ac2843a 100644
--- a/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/testing/DummyPageHolder.h"
 #include "modules/webaudio/OfflineAudioContext.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp
index b264917..85c9a36 100644
--- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp
@@ -8,7 +8,7 @@
 #include "core/testing/DummyPageHolder.h"
 #include "modules/webaudio/AbstractAudioContext.h"
 #include "modules/webaudio/OfflineAudioContext.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp
index 9bc2f8a..3bd3ca6 100644
--- a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/testing/DummyPageHolder.h"
 #include "modules/webaudio/OfflineAudioContext.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp
index 8f673a41..4c8b72e 100644
--- a/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/testing/DummyPageHolder.h"
 #include "modules/webaudio/OfflineAudioContext.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
index 9c18c91..a5377ad 100644
--- a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
@@ -16,12 +16,12 @@
 #include "core/frame/ConsoleTypes.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/heap/Handle.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 #include <v8.h>
 
 using testing::_;
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
index 94afbcc..545bfc2 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
@@ -20,14 +20,13 @@
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
 #include "public/platform/WebVector.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
 #include <stdint.h>
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
 using testing::_;
 using testing::InSequence;
 using testing::PrintToString;
diff --git a/third_party/WebKit/Source/platform/ClockTest.cpp b/third_party/WebKit/Source/platform/ClockTest.cpp
index 3616980..5ce8597 100644
--- a/third_party/WebKit/Source/platform/ClockTest.cpp
+++ b/third_party/WebKit/Source/platform/ClockTest.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "platform/Clock.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/DecimalTest.cpp b/third_party/WebKit/Source/platform/DecimalTest.cpp
index 43a79af..aa06a36 100644
--- a/third_party/WebKit/Source/platform/DecimalTest.cpp
+++ b/third_party/WebKit/Source/platform/DecimalTest.cpp
@@ -31,10 +31,10 @@
 #include "config.h"
 #include "platform/Decimal.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/CString.h"
 #include <float.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/DragImageTest.cpp b/third_party/WebKit/Source/platform/DragImageTest.cpp
index a50c0b84..8b8aeb1 100644
--- a/third_party/WebKit/Source/platform/DragImageTest.cpp
+++ b/third_party/WebKit/Source/platform/DragImageTest.cpp
@@ -37,6 +37,7 @@
 #include "platform/graphics/BitmapImage.h"
 #include "platform/graphics/Image.h"
 #include "platform/weborigin/KURL.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "third_party/skia/include/core/SkImage.h"
 #include "third_party/skia/include/core/SkPixelRef.h"
@@ -45,7 +46,6 @@
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/LayoutUnitTest.cpp b/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
index b1f6b5f58..4e471bf 100644
--- a/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
+++ b/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "platform/LayoutUnit.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <limits.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/LifecycleContextTest.cpp b/third_party/WebKit/Source/platform/LifecycleContextTest.cpp
index f29b9a3..0b0ce39 100644
--- a/third_party/WebKit/Source/platform/LifecycleContextTest.cpp
+++ b/third_party/WebKit/Source/platform/LifecycleContextTest.cpp
@@ -29,7 +29,7 @@
 #include "platform/LifecycleNotifier.h"
 #include "platform/LifecycleObserver.h"
 #include "platform/heap/Handle.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/MemoryPurgeController.h b/third_party/WebKit/Source/platform/MemoryPurgeController.h
index 6f671af..9d10d8f2 100644
--- a/third_party/WebKit/Source/platform/MemoryPurgeController.h
+++ b/third_party/WebKit/Source/platform/MemoryPurgeController.h
@@ -60,8 +60,9 @@
 
     void unregisterClient(MemoryPurgeClient* client)
     {
+        // Don't assert m_clients.contains() so that clients can unregister
+        // unconditionally.
         ASSERT(isMainThread());
-        ASSERT(m_clients.contains(client));
         m_clients.remove(client);
     }
 
diff --git a/third_party/WebKit/Source/platform/PODArenaTest.cpp b/third_party/WebKit/Source/platform/PODArenaTest.cpp
index c878266..101b4ae 100644
--- a/third_party/WebKit/Source/platform/PODArenaTest.cpp
+++ b/third_party/WebKit/Source/platform/PODArenaTest.cpp
@@ -27,9 +27,9 @@
 #include "platform/PODArena.h"
 
 #include "platform/testing/ArenaTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
 #include <algorithm>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp b/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp
index a2147a7..b37808b 100644
--- a/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp
+++ b/third_party/WebKit/Source/platform/PODFreeListArenaTest.cpp
@@ -27,9 +27,9 @@
 #include "platform/PODFreeListArena.h"
 
 #include "platform/testing/ArenaTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/PODIntervalTreeTest.cpp b/third_party/WebKit/Source/platform/PODIntervalTreeTest.cpp
index dc98641..1efd6152 100644
--- a/third_party/WebKit/Source/platform/PODIntervalTreeTest.cpp
+++ b/third_party/WebKit/Source/platform/PODIntervalTreeTest.cpp
@@ -30,11 +30,10 @@
 
 #include "platform/Logging.h"
 #include "platform/testing/TreeTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 using TreeTestHelpers::initRandom;
diff --git a/third_party/WebKit/Source/platform/PODRedBlackTreeTest.cpp b/third_party/WebKit/Source/platform/PODRedBlackTreeTest.cpp
index 2ad47fd..a812c2f 100644
--- a/third_party/WebKit/Source/platform/PODRedBlackTreeTest.cpp
+++ b/third_party/WebKit/Source/platform/PODRedBlackTreeTest.cpp
@@ -30,10 +30,9 @@
 
 #include "platform/testing/ArenaTestHelpers.h"
 #include "platform/testing/TreeTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 using ArenaTestHelpers::TrackedAllocator;
diff --git a/third_party/WebKit/Source/platform/PurgeableVectorTest.cpp b/third_party/WebKit/Source/platform/PurgeableVectorTest.cpp
index fe55865..258c36e 100644
--- a/third_party/WebKit/Source/platform/PurgeableVectorTest.cpp
+++ b/third_party/WebKit/Source/platform/PurgeableVectorTest.cpp
@@ -33,10 +33,10 @@
 
 #include "platform/TestingPlatformSupport.h"
 #include "public/platform/WebDiscardableMemory.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
 #include <algorithm>
 #include <cstdlib>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/SharedBufferTest.cpp b/third_party/WebKit/Source/platform/SharedBufferTest.cpp
index 80fdc9b9..7f6696f 100644
--- a/third_party/WebKit/Source/platform/SharedBufferTest.cpp
+++ b/third_party/WebKit/Source/platform/SharedBufferTest.cpp
@@ -33,11 +33,11 @@
 
 #include "platform/TestingPlatformSupport.h"
 #include "public/platform/WebDiscardableMemory.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 #include <algorithm>
 #include <cstdlib>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp
index 6a75618..0b14918e 100644
--- a/third_party/WebKit/Source/platform/TimerTest.cpp
+++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -9,8 +9,8 @@
 #include "public/platform/WebScheduler.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebViewScheduler.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include <queue>
 
 using testing::ElementsAre;
diff --git a/third_party/WebKit/Source/platform/TracedValueTest.cpp b/third_party/WebKit/Source/platform/TracedValueTest.cpp
index 135cbdbe..7341833 100644
--- a/third_party/WebKit/Source/platform/TracedValueTest.cpp
+++ b/third_party/WebKit/Source/platform/TracedValueTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/TracedValue.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/UUIDTest.cpp b/third_party/WebKit/Source/platform/UUIDTest.cpp
index b926b69..6d1870e 100644
--- a/third_party/WebKit/Source/platform/UUIDTest.cpp
+++ b/third_party/WebKit/Source/platform/UUIDTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/UUID.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/WebScreenInfoTest.cpp b/third_party/WebKit/Source/platform/WebScreenInfoTest.cpp
index ce63ce8..e3869fb 100644
--- a/third_party/WebKit/Source/platform/WebScreenInfoTest.cpp
+++ b/third_party/WebKit/Source/platform/WebScreenInfoTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "public/platform/WebScreenInfo.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/WebVectorTest.cpp b/third_party/WebKit/Source/platform/WebVectorTest.cpp
index e103c38..0282159f 100644
--- a/third_party/WebKit/Source/platform/WebVectorTest.cpp
+++ b/third_party/WebKit/Source/platform/WebVectorTest.cpp
@@ -5,8 +5,8 @@
 #include "config.h"
 #include "public/platform/WebVector.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp b/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp
index 7d69cde..41e0b4d7 100644
--- a/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp
+++ b/third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "platform/animation/TimingFunction.h"
 
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/WTFString.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 #include <sstream>
 #include <string>
 
diff --git a/third_party/WebKit/Source/platform/animation/UnitBezierTest.cpp b/third_party/WebKit/Source/platform/animation/UnitBezierTest.cpp
index 0ddc6ee..88185d4f 100644
--- a/third_party/WebKit/Source/platform/animation/UnitBezierTest.cpp
+++ b/third_party/WebKit/Source/platform/animation/UnitBezierTest.cpp
@@ -25,7 +25,7 @@
 #include "config.h"
 #include "platform/animation/UnitBezier.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp
index 04c8120..a4a1f48 100644
--- a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp
+++ b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp
@@ -3,15 +3,13 @@
 // found in the LICENSE file.
 
 #include "config.h"
-
 #include "platform/blob/BlobData.h"
 
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
 namespace blink {
 
 TEST(BlobDataTest, Consolidation)
diff --git a/third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesTest.cpp b/third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesTest.cpp
index 6e3b0e237..1afa369f0 100644
--- a/third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesTest.cpp
+++ b/third_party/WebKit/Source/platform/clipboard/ClipboardUtilitiesTest.cpp
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "platform/clipboard/ClipboardUtilities.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp b/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
index cafdcae1..ae6b2c2 100644
--- a/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
@@ -8,7 +8,7 @@
 #include "platform/fonts/FontDescription.h"
 #include "platform/fonts/SimpleFontData.h"
 #include "public/platform/Platform.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/FontDescriptionTest.cpp b/third_party/WebKit/Source/platform/fonts/FontDescriptionTest.cpp
index b1a92fd..feb59d7 100644
--- a/third_party/WebKit/Source/platform/fonts/FontDescriptionTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontDescriptionTest.cpp
@@ -24,11 +24,10 @@
  */
 
 #include "config.h"
-
 #include "platform/fonts/FontDescription.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/FontPlatformDataTest.cpp b/third_party/WebKit/Source/platform/fonts/FontPlatformDataTest.cpp
index 8e04281..e773a09 100644
--- a/third_party/WebKit/Source/platform/fonts/FontPlatformDataTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontPlatformDataTest.cpp
@@ -34,8 +34,7 @@
 #include "platform/fonts/TestFontSelector.h"
 #include "platform/fonts/TypesettingFeatures.h"
 #include "public/platform/WebUnitTestSupport.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/FontTest.cpp b/third_party/WebKit/Source/platform/fonts/FontTest.cpp
index 9d8a17b..1a19045 100644
--- a/third_party/WebKit/Source/platform/fonts/FontTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontTest.cpp
@@ -26,11 +26,10 @@
 // Tests for the Font class.
 
 #include "config.h"
-
-#include "platform/fonts/Character.h"
 #include "platform/fonts/Font.h"
 
-#include <gtest/gtest.h>
+#include "platform/fonts/Character.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphBufferTest.cpp b/third_party/WebKit/Source/platform/fonts/GlyphBufferTest.cpp
index fa3a49eb..14a57b0 100644
--- a/third_party/WebKit/Source/platform/fonts/GlyphBufferTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/GlyphBufferTest.cpp
@@ -6,9 +6,9 @@
 #include "platform/fonts/GlyphBuffer.h"
 
 #include "platform/fonts/SimpleFontData.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNodeTest.cpp b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNodeTest.cpp
index 27f9ec2..95b24cd 100644
--- a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNodeTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNodeTest.cpp
@@ -7,7 +7,7 @@
 
 #include "platform/fonts/SegmentedFontData.h"
 #include "platform/fonts/SimpleFontData.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp
index fab10b2..a5e063c 100644
--- a/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/OrientationIteratorTest.cpp
@@ -6,8 +6,7 @@
 #include "platform/fonts/OrientationIterator.h"
 
 #include "platform/Logging.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <string>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp
index 5ad70e32..c7beb0f3 100644
--- a/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/ScriptRunIteratorTest.cpp
@@ -6,11 +6,10 @@
 #include "platform/fonts/ScriptRunIterator.h"
 
 #include "platform/Logging.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Assertions.h"
 #include "wtf/Threading.h"
 #include "wtf/text/WTFString.h"
-
-#include <gtest/gtest.h>
 #include <string>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp b/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp
index 14cb453..6b98f65 100644
--- a/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/SmallCapsIteratorTest.cpp
@@ -6,8 +6,7 @@
 #include "platform/fonts/SmallCapsIterator.h"
 
 #include "platform/Logging.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 #include <string>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroidTest.cpp b/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroidTest.cpp
index 031c2ad..02a808a 100644
--- a/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroidTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroidTest.cpp
@@ -6,7 +6,7 @@
 #include "platform/fonts/FontCache.h"
 
 #include "platform/fonts/SimpleFontData.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeVerticalDataTest.cpp b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeVerticalDataTest.cpp
index 2545881..899b97a 100644
--- a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeVerticalDataTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeVerticalDataTest.cpp
@@ -26,8 +26,8 @@
 
 #include "platform/SharedBuffer.h"
 #include "platform/fonts/opentype/OpenTypeTypes.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
index 427fe27c..bbb77b4 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
@@ -3,14 +3,13 @@
 // found in the LICENSE file.
 
 #include "config.h"
-
 #include "platform/fonts/shaping/CachingWordShaper.h"
 
 #include "platform/fonts/FontCache.h"
 #include "platform/fonts/GlyphBuffer.h"
 #include "platform/fonts/shaping/CachingWordShapeIterator.h"
 #include "platform/fonts/shaping/ShapeResultTestInfo.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
index 2d239f4..540b6b3 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp
@@ -10,8 +10,8 @@
 #include "platform/fonts/GlyphPage.h"
 #include "platform/fonts/shaping/ShapeResultTestInfo.h"
 #include "platform/text/TextRun.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 #include <unicode/uscript.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp
index cff64e4..788df52 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp
@@ -7,11 +7,10 @@
 
 #include "platform/Logging.h"
 #include "platform/fonts/OrientationIterator.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Assertions.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
-
-#include <gtest/gtest.h>
 #include <string>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/win/FontFallbackWinTest.cpp b/third_party/WebKit/Source/platform/fonts/win/FontFallbackWinTest.cpp
index cf058718..8108e0e 100644
--- a/third_party/WebKit/Source/platform/fonts/win/FontFallbackWinTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/win/FontFallbackWinTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/fonts/win/FontFallbackWin.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/geometry/FloatBoxTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatBoxTest.cpp
index 1d8ef64..36d5c6a 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatBoxTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatBoxTest.cpp
@@ -26,7 +26,7 @@
 #include "platform/geometry/FloatBox.h"
 
 #include "platform/geometry/FloatBoxTestHelpers.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPointTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatPointTest.cpp
index 001c7a6e..a23dcdd 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatPointTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatPointTest.cpp
@@ -6,7 +6,7 @@
 #include "platform/geometry/FloatPoint.h"
 
 #include "platform/geometry/GeometryTestHelpers.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp
index 5e2f3d6c..fa0a4537 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp
@@ -30,7 +30,7 @@
 #include "config.h"
 #include "platform/geometry/FloatPolygon.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRoundedRectTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatRoundedRectTest.cpp
index f398b53f..2a61512 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatRoundedRectTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatRoundedRectTest.cpp
@@ -30,7 +30,7 @@
 #include "config.h"
 #include "platform/geometry/FloatRoundedRect.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/geometry/FloatSizeTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatSizeTest.cpp
index 56e2deb..003d5ee 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatSizeTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatSizeTest.cpp
@@ -6,7 +6,7 @@
 #include "platform/geometry/FloatSize.h"
 
 #include "platform/geometry/GeometryTestHelpers.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp b/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp
index 400f9b39..a00a791 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/geometry/LayoutRectOutsets.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/platform/geometry/RegionTest.cpp b/third_party/WebKit/Source/platform/geometry/RegionTest.cpp
index 5ee401b7..04d19ff 100644
--- a/third_party/WebKit/Source/platform/geometry/RegionTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/RegionTest.cpp
@@ -25,7 +25,7 @@
 #include "config.h"
 #include "platform/geometry/Region.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
index 5220867..8f6a2118 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
@@ -36,8 +36,7 @@
 #include "platform/graphics/ImageObserver.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
-
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
index 9d0d1c3e..9e5c474 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -32,12 +32,12 @@
 #include "public/platform/WebExternalBitmap.h"
 #include "public/platform/WebGraphicsContext3DProvider.h"
 #include "public/platform/WebThread.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkDevice.h"
 #include "third_party/skia/include/gpu/GrContext.h"
 #include "third_party/skia/include/gpu/gl/SkNullGLContext.h"
 #include "wtf/RefPtr.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using testing::InSequence;
 using testing::Return;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp b/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
index 55fdb1b4..d8b33f8 100644
--- a/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
@@ -5,9 +5,9 @@
 #include "config.h"
 #include "platform/graphics/ContiguousContainer.h"
 
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/TypeTraits.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
index bd53872..f874bc2 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -38,11 +38,11 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkImage.h"
 #include "third_party/skia/include/core/SkPixmap.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp
index 56f0517..39e547b 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp
@@ -27,11 +27,11 @@
 
 #include "platform/graphics/BitmapImage.h"
 #include "platform/graphics/paint/PaintController.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkPicture.h"
 #include "third_party/skia/include/core/SkShader.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
index f535eea..f05d080b 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -40,8 +40,8 @@
 #include "public/platform/WebLayer.h"
 #include "public/platform/WebLayerTreeView.h"
 #include "public/platform/WebUnitTestSupport.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassOwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp
index ca3edaa..dcf5163 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp
@@ -29,7 +29,7 @@
 #include "platform/SharedBuffer.h"
 #include "platform/graphics/ImageFrameGenerator.h"
 #include "platform/graphics/test/MockImageDecoder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp
index af36e763..e03e803 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp
@@ -34,7 +34,7 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp
index 61f05d9a..378ea99 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp
@@ -26,10 +26,10 @@
 #include "platform/graphics/Image.h"
 
 #include "platform/graphics/GraphicsLayer.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkImage.h"
 #include "third_party/skia/include/core/SkSurface.h"
 #include "wtf/PassOwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
index a6fd744..4187ec2b 100644
--- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
@@ -13,13 +13,13 @@
 #include "public/platform/WebTaskRunner.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkPictureRecorder.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using testing::Test;
 
diff --git a/third_party/WebKit/Source/platform/graphics/ThreadSafeDataTransportTest.cpp b/third_party/WebKit/Source/platform/graphics/ThreadSafeDataTransportTest.cpp
index 9d8ff3e..5bb116f 100644
--- a/third_party/WebKit/Source/platform/graphics/ThreadSafeDataTransportTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ThreadSafeDataTransportTest.cpp
@@ -27,7 +27,7 @@
 #include "platform/graphics/ThreadSafeDataTransport.h"
 
 #include "platform/SharedBuffer.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FilterOperationsTest.cpp b/third_party/WebKit/Source/platform/graphics/filters/FilterOperationsTest.cpp
index ecb74cc..0199765 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/FilterOperationsTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/FilterOperationsTest.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "platform/graphics/filters/FilterOperations.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp b/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp
index 32d5abb2..66d2ed1 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/ImageFilterBuilderTest.cpp
@@ -32,7 +32,7 @@
 #include "platform/graphics/filters/FilterOperations.h"
 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
 #include "platform/graphics/filters/SourceGraphic.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 using testing::Test;
 
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
index 5d5c9c4..ace81a1 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -38,9 +38,9 @@
 #include "platform/graphics/test/MockWebGraphicsContext3D.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebExternalTextureMailbox.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/RefPtr.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using testing::Test;
 using testing::_;
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemTest.cpp
index 5a6b5129..9e830e17 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/graphics/paint/DisplayItem.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvasTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvasTest.cpp
index 9e1698f..a1c29e1 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvasTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvasTest.cpp
@@ -9,6 +9,8 @@
 #include "platform/graphics/paint/DrawingDisplayItem.h"
 #include "platform/graphics/paint/PaintArtifact.h"
 #include "platform/transforms/TransformationMatrix.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "third_party/skia/include/core/SkMatrix.h"
@@ -16,8 +18,6 @@
 #include "third_party/skia/include/core/SkPicture.h"
 #include "third_party/skia/include/core/SkPictureRecorder.h"
 #include "third_party/skia/include/core/SkRect.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using testing::_;
 using testing::Eq;
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
index d1b0d67..58dbe49 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp
@@ -6,8 +6,8 @@
 #include "platform/graphics/paint/PaintChunker.h"
 
 #include "platform/RuntimeEnabledFeatures.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using testing::ElementsAre;
 
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
index ec904277..ecd9e62d 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -13,7 +13,7 @@
 #include "platform/graphics/paint/DrawingDisplayItem.h"
 #include "platform/graphics/paint/DrawingRecorder.h"
 #include "platform/graphics/paint/SubsequenceRecorder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProviderTest.cpp b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProviderTest.cpp
index 3d5be02..5ca3a5ad 100644
--- a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProviderTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProviderTest.cpp
@@ -7,10 +7,9 @@
 
 #include "public/platform/Platform.h"
 #include "public/platform/WebProcessMemoryDump.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Threading.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 TEST(BlinkGCDumpProviderTest, MemoryDump)
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
index 1bec0e5..071b252 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -41,11 +41,10 @@
 #include "platform/heap/Visitor.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebTraceLocation.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/HashTraits.h"
 #include "wtf/LinkedHashSet.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 static void preciselyCollectGarbage()
diff --git a/third_party/WebKit/Source/platform/image-decoders/FastSharedBufferReaderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/FastSharedBufferReaderTest.cpp
index 3479ac1..7da3513c 100644
--- a/third_party/WebKit/Source/platform/image-decoders/FastSharedBufferReaderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/FastSharedBufferReaderTest.cpp
@@ -29,10 +29,9 @@
  */
 
 #include "config.h"
-
 #include "platform/image-decoders/FastSharedBufferReader.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp
index 40b8f2b60..b0195eb 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp
@@ -32,10 +32,10 @@
 #include "platform/image-decoders/ImageDecoder.h"
 
 #include "platform/image-decoders/ImageFrame.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
index a0baa6d2..82758688 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
@@ -10,9 +10,9 @@
 #include "platform/image-decoders/ImageFrame.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/StringHasher.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
index 970b1ba..f04f31c8 100644
--- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
@@ -7,7 +7,7 @@
 
 #include "platform/SharedBuffer.h"
 #include "platform/image-decoders/ImageDecoderTestHelpers.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
index 7b878dd7..b7a206a 100644
--- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -35,10 +35,10 @@
 #include "platform/image-decoders/ImageDecoderTestHelpers.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
index 9668023..064a692 100644
--- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
@@ -36,9 +36,9 @@
 #include "platform/image-decoders/ImageDecoderTestHelpers.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
index 6b5a993..60bb9dc 100644
--- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
@@ -36,11 +36,11 @@
 #include "platform/image-decoders/ImageDecoderTestHelpers.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/dtoa/utils.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp b/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp
index e8a48d9..240f745fe 100644
--- a/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp
+++ b/third_party/WebKit/Source/platform/network/EncodedFormDataTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/network/EncodedFormData.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp b/third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp
index ab57dfc..09d551d5 100644
--- a/third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp
+++ b/third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp
@@ -3,13 +3,12 @@
 // found in the LICENSE file.
 
 #include "config.h"
-#include "HTTPParsers.h"
+#include "platform/network/HTTPParsers.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/AtomicString.h"
 
-#include <gtest/gtest.h>
-
 namespace blink {
 
 namespace {
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp b/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp
index a875a3e..19e4583 100644
--- a/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp
+++ b/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp
@@ -3,14 +3,14 @@
 // found in the LICENSE file.
 
 #include "config.h"
-#include "ResourceRequest.h"
+#include "platform/network/ResourceRequest.h"
 
 #include "platform/network/EncodedFormData.h"
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/Referrer.h"
 #include "public/platform/WebURLRequest.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/AtomicString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
index f4d5546..57147ee 100644
--- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
+++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/scheduler/CancellableTaskFactory.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
index 243b080..4e4099a 100644
--- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
@@ -71,7 +71,10 @@
 {
     m_startTime = 0.0;
     m_targetOffset = offset;
-    m_animationCurve = adoptPtr(Platform::current()->compositorSupport()->createScrollOffsetAnimationCurve(m_targetOffset, WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut));
+    m_animationCurve = adoptPtr(Platform::current()->compositorSupport()->createScrollOffsetAnimationCurve(
+        m_targetOffset,
+        WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut,
+        WebScrollOffsetAnimationCurve::ScrollDurationDeltaBased));
 
     m_animationCurve->setInitialValue(FloatPoint(m_scrollableArea->scrollPosition()));
     m_scrollableArea->registerForAnimation();
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
index e1c1ea1..a4c13be 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
@@ -33,8 +33,8 @@
 #include "platform/geometry/IntRect.h"
 #include "platform/scroll/ScrollAnimatorBase.h"
 #include "platform/scroll/ScrollableArea.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
index 08e9840..c7800f7 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
@@ -9,8 +9,8 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebScheduler.h"
 #include "public/platform/WebThread.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
index 51abdaa..e1eb25c 100644
--- a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
+++ b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
@@ -33,9 +33,9 @@
 
 #include "platform/text/BidiTestHarness.h"
 #include "platform/text/TextRunIterator.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include <fstream>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp b/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp
index da9a7da..c8183fa2 100644
--- a/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp
+++ b/third_party/WebKit/Source/platform/text/DateTimeFormatTest.cpp
@@ -27,9 +27,9 @@
 #include "platform/text/DateTimeFormat.h"
 
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp
index d20063f..86be643 100644
--- a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp
+++ b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "platform/text/LocaleICU.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringBuilder.h"
-#include <gtest/gtest.h>
 #include <unicode/uvernum.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp
index 0a968a50..d28c72b 100644
--- a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp
+++ b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp
@@ -29,11 +29,11 @@
 #include "platform/DateComponents.h"
 #include "platform/TestingPlatformSupport.h"
 #include "public/platform/Platform.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/DateMath.h"
 #include "wtf/MathExtras.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/CString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp
index 658bc2d..d1c72486 100644
--- a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp
+++ b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp
@@ -32,11 +32,11 @@
 #include "platform/text/LocaleWin.h"
 
 #include "platform/DateComponents.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/DateMath.h"
 #include "wtf/MathExtras.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/CString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/text/SegmentedStringTest.cpp b/third_party/WebKit/Source/platform/text/SegmentedStringTest.cpp
index 5aec779..775a64a 100644
--- a/third_party/WebKit/Source/platform/text/SegmentedStringTest.cpp
+++ b/third_party/WebKit/Source/platform/text/SegmentedStringTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "platform/text/SegmentedString.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/text/UnicodeUtilitiesTest.cpp b/third_party/WebKit/Source/platform/text/UnicodeUtilitiesTest.cpp
index 8179a7d5..4f36620 100644
--- a/third_party/WebKit/Source/platform/text/UnicodeUtilitiesTest.cpp
+++ b/third_party/WebKit/Source/platform/text/UnicodeUtilitiesTest.cpp
@@ -31,10 +31,10 @@
 #include "config.h"
 #include "platform/text/UnicodeUtilities.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/Vector.h"
 #include "wtf/text/CharacterNames.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 #include <unicode/uchar.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp b/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
index b7c9eb94..3464b25 100644
--- a/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
+++ b/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
@@ -35,7 +35,7 @@
 #include "platform/transforms/ScaleTransformOperation.h"
 #include "platform/transforms/SkewTransformOperation.h"
 #include "platform/transforms/TranslateTransformOperation.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/transforms/TransformationMatrixTest.cpp b/third_party/WebKit/Source/platform/transforms/TransformationMatrixTest.cpp
index 311b608..bd0b70d 100644
--- a/third_party/WebKit/Source/platform/transforms/TransformationMatrixTest.cpp
+++ b/third_party/WebKit/Source/platform/transforms/TransformationMatrixTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/transforms/TransformationMatrix.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/weborigin/DatabaseIdentifierTest.cpp b/third_party/WebKit/Source/platform/weborigin/DatabaseIdentifierTest.cpp
index 3307ca4..7d34f0e 100644
--- a/third_party/WebKit/Source/platform/weborigin/DatabaseIdentifierTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/DatabaseIdentifierTest.cpp
@@ -33,7 +33,7 @@
 
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityOrigin.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
index 813cb91..8f242f3 100644
--- a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
@@ -34,9 +34,9 @@
 #include "config.h"
 #include "platform/weborigin/KURL.h"
 
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/weborigin/KnownPortsTest.cpp b/third_party/WebKit/Source/platform/weborigin/KnownPortsTest.cpp
index 1c6287e7f..916bf49 100644
--- a/third_party/WebKit/Source/platform/weborigin/KnownPortsTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/KnownPortsTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/weborigin/KnownPorts.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
index c689ab65..549248e 100644
--- a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
@@ -35,7 +35,7 @@
 #include "platform/weborigin/SecurityOrigin.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebPublicSuffixList.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
index 957ac7b..bfc88ee9 100644
--- a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
@@ -5,7 +5,7 @@
 #include "config.h"
 #include "platform/weborigin/SchemeRegistry.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
index a4765df..364cad7b 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -35,9 +35,9 @@
 #include "platform/blob/BlobURL.h"
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityPolicy.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp
index fbd6a72..6d29ab1 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp
@@ -33,7 +33,7 @@
 
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityOrigin.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp b/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp
index 03c6845fb..09d4abe 100644
--- a/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp
+++ b/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp
@@ -44,10 +44,10 @@
 #include "public/web/WebFrame.h"
 #include "public/web/WebURLLoaderOptions.h"
 #include "public/web/WebView.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
-#include <gtest/gtest.h>
 
 using blink::URLTestHelpers::toKURL;
 using blink::testing::runPendingTasks;
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
index 0534a69..bf13b9d 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
+++ b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
@@ -20,9 +20,9 @@
 #include "public/web/WebExternalPopupMenu.h"
 #include "public/web/WebPopupMenuInfo.h"
 #include "public/web/WebSettings.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
index 185af6a..4ac463f 100644
--- a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
+++ b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
@@ -42,12 +42,12 @@
 #include "public/web/WebFrameClient.h"
 #include "public/web/WebInputEvent.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebInputEventConversion.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/PassOwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/PageOverlayTest.cpp b/third_party/WebKit/Source/web/PageOverlayTest.cpp
index 8713240..a0f5536 100644
--- a/third_party/WebKit/Source/web/PageOverlayTest.cpp
+++ b/third_party/WebKit/Source/web/PageOverlayTest.cpp
@@ -15,6 +15,8 @@
 #include "public/platform/WebCanvas.h"
 #include "public/platform/WebThread.h"
 #include "public/web/WebSettings.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkColor.h"
@@ -22,8 +24,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using testing::_;
 using testing::AtLeast;
diff --git a/third_party/WebKit/Source/web/WebDragDataTest.cpp b/third_party/WebKit/Source/web/WebDragDataTest.cpp
index dba92d1..cf2aca7 100644
--- a/third_party/WebKit/Source/web/WebDragDataTest.cpp
+++ b/third_party/WebKit/Source/web/WebDragDataTest.cpp
@@ -7,7 +7,7 @@
 
 #include "core/clipboard/DataObject.h"
 #include "public/platform/WebVector.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebElementTest.cpp b/third_party/WebKit/Source/web/WebElementTest.cpp
index 9bdae0f..f1a010f5 100644
--- a/third_party/WebKit/Source/web/WebElementTest.cpp
+++ b/third_party/WebKit/Source/web/WebElementTest.cpp
@@ -9,7 +9,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
index 3483eef..4ae921b 100644
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
@@ -13,8 +13,8 @@
 #include "public/web/WebEmbeddedWorkerStartData.h"
 #include "public/web/WebSettings.h"
 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index d0e9bbb..4cb7d027 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -1078,7 +1078,7 @@
 
 void WebLocalFrameImpl::replaceSelection(const WebString& text)
 {
-    bool selectReplacement = false;
+    bool selectReplacement = frame()->editor().behavior().shouldSelectReplacement();
     bool smartReplace = true;
     frame()->editor().replaceSelectionWithText(text, selectReplacement, smartReplace);
 }
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
index 152854a..79165d0 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -149,7 +149,6 @@
     void dispatchWillSendRequest(WebURLRequest&) override;
     WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions&) override;
     unsigned unloadListenerCount() const override;
-    void replaceSelection(const WebString&) override;
     void insertText(const WebString&) override;
     void setMarkedText(const WebString&, unsigned location, unsigned length) override;
     void unmarkText() override;
@@ -255,6 +254,7 @@
     void requestRunTask(WebSuspendableTask*) const override;
     void didCallAddSearchProvider() override;
     void didCallIsSearchProviderInstalled() override;
+    void replaceSelection(const WebString&) override;
 
     void willBeDetached();
     void willDetachParent();
diff --git a/third_party/WebKit/Source/web/WebNodeTest.cpp b/third_party/WebKit/Source/web/WebNodeTest.cpp
index 32288ca..af8f8be 100644
--- a/third_party/WebKit/Source/web/WebNodeTest.cpp
+++ b/third_party/WebKit/Source/web/WebNodeTest.cpp
@@ -10,7 +10,7 @@
 #include "core/testing/DummyPageHolder.h"
 #include "public/web/WebElement.h"
 #include "public/web/WebElementCollection.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp b/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
index a9190ea6..60f6c2b2 100644
--- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
@@ -376,11 +376,6 @@
     return 0;
 }
 
-void WebRemoteFrameImpl::replaceSelection(const WebString&)
-{
-    ASSERT_NOT_REACHED();
-}
-
 void WebRemoteFrameImpl::insertText(const WebString&)
 {
     ASSERT_NOT_REACHED();
@@ -452,11 +447,6 @@
     ASSERT_NOT_REACHED();
 }
 
-void WebRemoteFrameImpl::replaceMisspelledRange(const WebString&)
-{
-    ASSERT_NOT_REACHED();
-}
-
 void WebRemoteFrameImpl::removeSpellingMarkers()
 {
     ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
index 45858b2..2c2a59f 100644
--- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
+++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -94,7 +94,6 @@
     void dispatchWillSendRequest(WebURLRequest&) override;
     WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions&) override;
     unsigned unloadListenerCount() const override;
-    void replaceSelection(const WebString&) override;
     void insertText(const WebString&) override;
     void setMarkedText(const WebString&, unsigned location, unsigned length) override;
     void unmarkText() override;
@@ -108,7 +107,6 @@
     void enableContinuousSpellChecking(bool) override;
     bool isContinuousSpellCheckingEnabled() const override;
     void requestTextChecking(const WebElement&) override;
-    void replaceMisspelledRange(const WebString&) override;
     void removeSpellingMarkers() override;
     bool hasSelection() const override;
     WebRange selectionRange() const override;
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index a66ca85..f0b5215 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -1917,7 +1917,10 @@
     if (!mainFrameImpl())
         return;
 
-    PageWidgetDelegate::updateLifecycleToCompositingCleanPlusScrolling(*m_page, *mainFrameImpl()->frame());
+    if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled())
+        PageWidgetDelegate::updateLifecycleToCompositingCleanPlusScrolling(*m_page, *mainFrameImpl()->frame());
+    else
+        PageWidgetDelegate::updateAllLifecyclePhases(*m_page, *mainFrameImpl()->frame());
 
     updateLayerTreeBackgroundColor();
 
@@ -1949,7 +1952,9 @@
         }
     }
 
-    PageWidgetDelegate::updateAllLifecyclePhases(*m_page, *mainFrameImpl()->frame());
+    // TODO(wangxianzhu): Avoid traversing frame tree for phases (style, layout, etc.) that we are sure no need to update.
+    if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled())
+        PageWidgetDelegate::updateAllLifecyclePhases(*m_page, *mainFrameImpl()->frame());
 }
 
 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
diff --git a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
index f0f67ca3..83a3d91 100644
--- a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
@@ -4,16 +4,16 @@
 
 #include "config.h"
 
-#include "FrameTestHelpers.h"
 #include "bindings/core/v8/ScriptController.h"
 #include "bindings/core/v8/ScriptSourceCode.h"
 #include "bindings/core/v8/V8Binding.h"
 #include "bindings/core/v8/V8DOMActivityLogger.h"
 #include "public/web/WebCache.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
+#include "web/tests/FrameTestHelpers.h"
 #include "wtf/Forward.h"
 #include "wtf/text/Base64.h"
-#include <gtest/gtest.h>
 #include <v8.h>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp b/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
index d3d34f2f..cbd2cec 100644
--- a/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
@@ -36,9 +36,9 @@
 #include "public/web/WebLocalFrame.h"
 #include "public/web/WebView.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
index f656972..e9193e5 100644
--- a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
+++ b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
@@ -8,10 +8,10 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebURLLoaderClient.h"
 #include "public/platform/WebUnitTestSupport.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/TemporaryChange.h"
-#include <gtest/gtest.h>
 #include <queue>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp b/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
index 1effde6..d248084 100644
--- a/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/DocumentLoadingRenderingTest.cpp
@@ -6,11 +6,11 @@
 
 #include "core/dom/Document.h"
 #include "core/html/HTMLIFrameElement.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/FrameLoaderClientImplTest.cpp b/third_party/WebKit/Source/web/tests/FrameLoaderClientImplTest.cpp
index 4fe1d6e..f51e4a41 100644
--- a/third_party/WebKit/Source/web/tests/FrameLoaderClientImplTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameLoaderClientImplTest.cpp
@@ -36,12 +36,12 @@
 #include "public/web/WebFrameClient.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebView.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 using testing::_;
 using testing::Mock;
diff --git a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
index dd09b2d..3cf525b 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -10,11 +10,11 @@
 #include "core/html/HTMLIFrameElement.h"
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/web/WebHitTestResult.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp b/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp
index 8f8dd26..7e6ce6f 100644
--- a/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp
@@ -13,9 +13,9 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebDocument.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 using blink::FrameTestHelpers::loadFrame;
 using blink::testing::runPendingTasks;
diff --git a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp b/third_party/WebKit/Source/web/tests/KeyboardTest.cpp
index f1ec242..19c56ce 100644
--- a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp
+++ b/third_party/WebKit/Source/web/tests/KeyboardTest.cpp
@@ -37,8 +37,8 @@
 #include "core/frame/Settings.h"
 #include "platform/KeyboardCodes.h"
 #include "public/web/WebInputEvent.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebInputEventConversion.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp b/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp
index 618f854..9e02e44 100644
--- a/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp
+++ b/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp
@@ -38,9 +38,9 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebFrameClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/ListenerLeakTest.cpp b/third_party/WebKit/Source/web/tests/ListenerLeakTest.cpp
index d4b30034..f909090 100644
--- a/third_party/WebKit/Source/web/tests/ListenerLeakTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ListenerLeakTest.cpp
@@ -34,8 +34,8 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebView.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 #include <v8/include/v8-profiler.h>
 #include <v8/include/v8.h>
 
diff --git a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
index b15370d..0b7c53e 100644
--- a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
+++ b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
@@ -48,8 +48,8 @@
 #include "public/web/WebDocument.h"
 #include "public/web/WebFrame.h"
 #include "public/web/WebView.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 using blink::URLTestHelpers::toKURL;
 
diff --git a/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp b/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
index 6cbf3fdc..242012d 100644
--- a/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
@@ -44,11 +44,11 @@
 #include "public/platform/WebURLResponse.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebSettings.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/Vector.h"
-#include <gtest/gtest.h>
 
 using blink::URLTestHelpers::toKURL;
 using blink::URLTestHelpers::registerMockedURLLoad;
diff --git a/third_party/WebKit/Source/web/tests/PaintAggregatorTest.cpp b/third_party/WebKit/Source/web/tests/PaintAggregatorTest.cpp
index 6ec9323..a04857c 100644
--- a/third_party/WebKit/Source/web/tests/PaintAggregatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/PaintAggregatorTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "web/painting/PaintAggregator.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 using namespace blink;
 
diff --git a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
index 8458c4c..ca415b1c 100644
--- a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
@@ -43,11 +43,11 @@
 #include "public/web/WebScriptSource.h"
 #include "public/web/WebView.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/OwnPtr.h"
 #include <functional>
-#include <gtest/gtest.h>
 #include <list>
 
 using namespace blink;
diff --git a/third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp b/third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp
index 22685a1..8c2fddc 100644
--- a/third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp
@@ -14,10 +14,10 @@
 #include "public/web/WebScriptSource.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebView.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp
index 3aa55318..35fdaa2 100644
--- a/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp
@@ -15,9 +15,9 @@
 #include "public/platform/WebPageVisibilityState.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/platform/modules/wake_lock/WebWakeLockClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace {
 
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index 4908645..6ea2e41 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -40,10 +40,10 @@
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
index 8fc8c57d..18abef9 100644
--- a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
+++ b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
@@ -36,9 +36,9 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
index 0d657a3..a9ebd81 100644
--- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
+++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -17,11 +17,11 @@
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/platform/Platform.h"
 #include "public/web/WebDocument.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/FindInPageCoordinates.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/OwnPtr.h"
-#include <gtest/gtest.h>
 
 using blink::testing::runPendingTasks;
 
diff --git a/third_party/WebKit/Source/web/tests/TopControlsTest.cpp b/third_party/WebKit/Source/web/tests/TopControlsTest.cpp
index 789de568..79e39cb 100644
--- a/third_party/WebKit/Source/web/tests/TopControlsTest.cpp
+++ b/third_party/WebKit/Source/web/tests/TopControlsTest.cpp
@@ -39,10 +39,10 @@
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebSettings.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/TouchActionTest.cpp b/third_party/WebKit/Source/web/tests/TouchActionTest.cpp
index bc0269e..0719ecf 100644
--- a/third_party/WebKit/Source/web/tests/TouchActionTest.cpp
+++ b/third_party/WebKit/Source/web/tests/TouchActionTest.cpp
@@ -53,9 +53,9 @@
 #include "public/web/WebView.h"
 #include "public/web/WebViewClient.h"
 #include "public/web/WebWidgetClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 using blink::testing::runPendingTasks;
 
diff --git a/third_party/WebKit/Source/web/tests/ViewportTest.cpp b/third_party/WebKit/Source/web/tests/ViewportTest.cpp
index 8e7310e..386e459 100644
--- a/third_party/WebKit/Source/web/tests/ViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ViewportTest.cpp
@@ -49,8 +49,8 @@
 #include "public/web/WebScriptSource.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
index 17e046a..9d2e7f75 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -31,10 +31,10 @@
 #include "public/web/WebScriptSource.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 #include <string>
 
diff --git a/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp b/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp
index ca1f19a..475d5690 100644
--- a/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebDocumentTest.cpp
@@ -19,8 +19,8 @@
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/weborigin/SchemeRegistry.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index b58ad9d5..4104032 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -119,14 +119,14 @@
 #include "public/web/WebTextCheckingCompletion.h"
 #include "public/web/WebTextCheckingResult.h"
 #include "public/web/WebViewClient.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebRemoteFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
 #include "wtf/Forward.h"
 #include "wtf/dtoa/utils.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 #include <map>
 #include <stdarg.h>
 #include <v8.h>
diff --git a/third_party/WebKit/Source/web/tests/WebHelperPluginTest.cpp b/third_party/WebKit/Source/web/tests/WebHelperPluginTest.cpp
index c6ed454..04e3e2f62 100644
--- a/third_party/WebKit/Source/web/tests/WebHelperPluginTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebHelperPluginTest.cpp
@@ -8,9 +8,9 @@
 #include "platform/testing/UnitTestHelpers.h"
 #include "public/web/WebFrameClient.h"
 #include "public/web/WebLocalFrame.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FakeWebPlugin.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebImageTest.cpp b/third_party/WebKit/Source/web/tests/WebImageTest.cpp
index 6979f91..181a026 100644
--- a/third_party/WebKit/Source/web/tests/WebImageTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebImageTest.cpp
@@ -36,7 +36,7 @@
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
 #include "public/platform/WebUnitTestSupport.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
index fe14f50..b03fd3c 100644
--- a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
@@ -46,9 +46,9 @@
 #include "platform/testing/URLTestHelpers.h"
 #include "public/web/WebFrame.h"
 #include "public/web/WebSettings.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp b/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
index 53bc713..7543eed 100644
--- a/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
@@ -6,11 +6,11 @@
 
 #include "core/dom/Document.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp
index 0eab234d..f4227865 100644
--- a/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp
@@ -42,8 +42,8 @@
 #include "public/web/WebFrame.h"
 #include "public/web/WebPageSerializerClient.h"
 #include "public/web/WebView.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 using blink::Document;
 using blink::URLTestHelpers::toKURL;
diff --git a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
index 5759dfe5..abe1920 100644
--- a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
@@ -49,13 +49,13 @@
 #include "public/web/WebPrintParams.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebView.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkPictureRecorder.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FakeWebPlugin.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 using blink::testing::runPendingTasks;
 
diff --git a/third_party/WebKit/Source/web/tests/WebScopedWindowFocusAllowedIndicatorTest.cpp b/third_party/WebKit/Source/web/tests/WebScopedWindowFocusAllowedIndicatorTest.cpp
index 5c7100a5..16678b16 100644
--- a/third_party/WebKit/Source/web/tests/WebScopedWindowFocusAllowedIndicatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebScopedWindowFocusAllowedIndicatorTest.cpp
@@ -33,7 +33,7 @@
 
 #include "core/dom/Document.h"
 #include "public/web/WebDocument.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp b/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
index dccc4e3a..5225707 100644
--- a/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
@@ -36,9 +36,9 @@
 #include "public/platform/WebUnitTestSupport.h"
 #include "public/web/WebDocument.h"
 #include "public/web/WebFrame.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebSelectorTest.cpp b/third_party/WebKit/Source/web/tests/WebSelectorTest.cpp
index 28b8f7ad..2e910df8 100644
--- a/third_party/WebKit/Source/web/tests/WebSelectorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebSelectorTest.cpp
@@ -33,7 +33,7 @@
 
 #include "public/platform/WebString.h"
 #include "public/platform/WebUnitTestSupport.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp b/third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp
index 8218cd6..f8695fe2 100644
--- a/third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebURLRequestTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "public/platform/WebURLRequest.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebURLResponseTest.cpp b/third_party/WebKit/Source/web/tests/WebURLResponseTest.cpp
index a2f95a75..0738ad6 100644
--- a/third_party/WebKit/Source/web/tests/WebURLResponseTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebURLResponseTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "public/platform/WebURLResponse.h"
 
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebUserGestureTokenTest.cpp b/third_party/WebKit/Source/web/tests/WebUserGestureTokenTest.cpp
index df77a11..9ae0e4cc 100644
--- a/third_party/WebKit/Source/web/tests/WebUserGestureTokenTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebUserGestureTokenTest.cpp
@@ -34,7 +34,7 @@
 #include "platform/UserGestureIndicator.h"
 #include "public/web/WebScopedUserGesture.h"
 #include "public/web/WebUserGestureIndicator.h"
-#include <gtest/gtest.h>
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 0d1b595..393e0b5f 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -87,13 +87,13 @@
 #include "public/web/WebViewClient.h"
 #include "public/web/WebWidget.h"
 #include "public/web/WebWidgetClient.h"
+#include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include <gtest/gtest.h>
 
 using blink::FrameTestHelpers::loadFrame;
 using blink::URLTestHelpers::toKURL;
diff --git a/third_party/WebKit/Source/wtf/Functional.h b/third_party/WebKit/Source/wtf/Functional.h
index 9475043..6035e827 100644
--- a/third_party/WebKit/Source/wtf/Functional.h
+++ b/third_party/WebKit/Source/wtf/Functional.h
@@ -308,6 +308,38 @@
     typename ParamStorageTraits<P6>::StorageType m_p6;
 };
 
+template<typename FunctionWrapper, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename... UnboundParams>
+class PartBoundFunctionImpl<7, FunctionWrapper, R(P1, P2, P3, P4, P5, P6, P7, UnboundParams...)> final : public Function<typename FunctionWrapper::ResultType(UnboundParams...)> {
+public:
+    PartBoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6, const P7& p7)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+        , m_p2(ParamStorageTraits<P2>::wrap(p2))
+        , m_p3(ParamStorageTraits<P3>::wrap(p3))
+        , m_p4(ParamStorageTraits<P4>::wrap(p4))
+        , m_p5(ParamStorageTraits<P5>::wrap(p5))
+        , m_p6(ParamStorageTraits<P6>::wrap(p6))
+        , m_p7(ParamStorageTraits<P7>::wrap(p7))
+    {
+    }
+
+    typename FunctionWrapper::ResultType operator()(UnboundParams... params) override
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStorageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3), ParamStorageTraits<P4>::unwrap(m_p4), ParamStorageTraits<P5>::unwrap(m_p5), ParamStorageTraits<P6>::unwrap(m_p6), ParamStorageTraits<P7>::unwrap(m_p7), params...);
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+    typename ParamStorageTraits<P2>::StorageType m_p2;
+    typename ParamStorageTraits<P3>::StorageType m_p3;
+    typename ParamStorageTraits<P4>::StorageType m_p4;
+    typename ParamStorageTraits<P5>::StorageType m_p5;
+    typename ParamStorageTraits<P6>::StorageType m_p6;
+    typename ParamStorageTraits<P7>::StorageType m_p7;
+};
+
+
 template<typename... UnboundArgs, typename FunctionType, typename... BoundArgs>
 PassOwnPtr<Function<typename FunctionWrapper<FunctionType>::ResultType(UnboundArgs...)>> bind(FunctionType function, const BoundArgs&... boundArgs)
 {
diff --git a/third_party/WebKit/public/platform/WebCompositorSupport.h b/third_party/WebKit/public/platform/WebCompositorSupport.h
index 7b6adaf9..8abf6ef 100644
--- a/third_party/WebKit/public/platform/WebCompositorSupport.h
+++ b/third_party/WebKit/public/platform/WebCompositorSupport.h
@@ -31,12 +31,12 @@
 #include "WebCompositorAnimationCurve.h"
 #include "WebFloatPoint.h"
 #include "WebLayerTreeView.h"
+#include "WebScrollOffsetAnimationCurve.h"
 #include "WebScrollbar.h"
 #include "WebScrollbarThemePainter.h"
 
 namespace blink {
 
-class WebCompositorAnimationCurve;
 class WebCompositorAnimationPlayer;
 class WebCompositorAnimationTimeline;
 class WebContentLayer;
@@ -51,7 +51,6 @@
 class WebLayer;
 class WebScrollbarLayer;
 class WebScrollbarThemeGeometry;
-class WebScrollOffsetAnimationCurve;
 class WebTransformAnimationCurve;
 class WebTransformOperations;
 
@@ -81,7 +80,10 @@
 
     virtual WebFloatAnimationCurve* createFloatAnimationCurve() { return nullptr; }
 
-    virtual WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(WebFloatPoint targetValue, WebCompositorAnimationCurve::TimingFunctionType) { return nullptr; }
+    virtual WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(
+        WebFloatPoint targetValue,
+        WebCompositorAnimationCurve::TimingFunctionType,
+        WebScrollOffsetAnimationCurve::ScrollDurationBehavior) { return nullptr; }
 
     virtual WebTransformAnimationCurve* createTransformAnimationCurve() { return nullptr; }
 
diff --git a/third_party/WebKit/public/platform/WebScrollOffsetAnimationCurve.h b/third_party/WebKit/public/platform/WebScrollOffsetAnimationCurve.h
index 06e46be..a3d0b48 100644
--- a/third_party/WebKit/public/platform/WebScrollOffsetAnimationCurve.h
+++ b/third_party/WebKit/public/platform/WebScrollOffsetAnimationCurve.h
@@ -14,9 +14,16 @@
 public:
     virtual ~WebScrollOffsetAnimationCurve() { }
 
+    enum ScrollDurationBehavior {
+        ScrollDurationDeltaBased = 0,
+        ScrollDurationConstant
+    };
+
     virtual void setInitialValue(WebFloatPoint) = 0;
     virtual WebFloatPoint getValue(double time) const = 0;
     virtual double duration() const = 0;
+    virtual WebFloatPoint targetValue() const = 0;
+    virtual void updateTarget(double time, WebFloatPoint newTarget) = 0;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/public/web/WebFrame.h b/third_party/WebKit/public/web/WebFrame.h
index 1b62231..bbecd55 100644
--- a/third_party/WebKit/public/web/WebFrame.h
+++ b/third_party/WebKit/public/web/WebFrame.h
@@ -431,9 +431,6 @@
 
     // Editing -------------------------------------------------------------
 
-    // Replaces the selection with the given text.
-    virtual void replaceSelection(const WebString& text) = 0;
-
     virtual void insertText(const WebString& text) = 0;
 
     virtual void setMarkedText(const WebString& text, unsigned location, unsigned length) = 0;
@@ -461,7 +458,6 @@
     virtual void enableContinuousSpellChecking(bool) = 0;
     virtual bool isContinuousSpellCheckingEnabled() const = 0;
     virtual void requestTextChecking(const WebElement&) = 0;
-    virtual void replaceMisspelledRange(const WebString&) = 0;
     virtual void removeSpellingMarkers() = 0;
 
     // Selection -----------------------------------------------------------
diff --git a/third_party/WebKit/public/web/WebLocalFrame.h b/third_party/WebKit/public/web/WebLocalFrame.h
index efaa90e..c412834 100644
--- a/third_party/WebKit/public/web/WebLocalFrame.h
+++ b/third_party/WebKit/public/web/WebLocalFrame.h
@@ -157,6 +157,11 @@
     // selection to collapse. If the new extent is set to the same position as
     // the current base, this function will do nothing.
     virtual void moveRangeSelectionExtent(const WebPoint&) = 0;
+    // Replaces the selection with the input string.
+    virtual void replaceSelection(const WebString&) = 0;
+
+    // Spell-checking support -------------------------------------------------
+    virtual void replaceMisspelledRange(const WebString&) = 0;
 
     // Content Settings -------------------------------------------------------
 
diff --git a/tools/ipc_fuzzer/fuzzer/fuzzer.cc b/tools/ipc_fuzzer/fuzzer/fuzzer.cc
index 9ab2b39..d49c7bc6 100644
--- a/tools/ipc_fuzzer/fuzzer/fuzzer.cc
+++ b/tools/ipc_fuzzer/fuzzer/fuzzer.cc
@@ -762,7 +762,7 @@
   static bool Fuzz(cc::RenderPassList* p, Fuzzer* fuzzer) {
     if (!fuzzer->ShouldGenerate()) {
       for (size_t i = 0; i < p->size(); ++i) {
-        if (!FuzzParam(p->at(i), fuzzer))
+        if (!FuzzParam(p->at(i).get(), fuzzer))
           return false;
       }
       return true;
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 6686fa3..0d99c05 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -59445,6 +59445,7 @@
   <int value="389" label="EASY_UNLOCK_PRIVATE_ON_CONNECTION_STATUS_CHANGED"/>
   <int value="390" label="EASY_UNLOCK_PRIVATE_ON_DATA_RECEIVED"/>
   <int value="391" label="EASY_UNLOCK_PRIVATE_ON_SEND_COMPLETED"/>
+  <int value="392" label="DISPLAY_SOURCE_ON_SINKS_UPDATED"/>
 </enum>
 
 <enum name="ExtensionFileWriteResult" type="int">
@@ -60588,6 +60589,8 @@
   <int value="1095" label="SETTINGSPRIVATE_SETDEFAULTZOOMPERCENTFUNCTION"/>
   <int value="1096" label="BLUETOOTHPRIVATE_CONNECT"/>
   <int value="1097" label="BLUETOOTHPRIVATE_FORGETDEVICE"/>
+  <int value="1098" label="DISPLAYSOURCE_GETAVAILABLESINKS"/>
+  <int value="1099" label="DISPLAYSOURCE_REQUESTAUTHENTICATION"/>
 </enum>
 
 <enum name="ExtensionInstallCause" type="int">
@@ -76333,7 +76336,7 @@
 
 <enum name="VariationsFirstRunResult" type="int">
   <int value="0" label="Seed imported successfully"/>
-  <int value="1" label="Seed import failed - no callback"/>
+  <int value="1" label="Seed import failed - no callback (Obsolete)"/>
   <int value="2" label="Seed import failed - no first run seed"/>
   <int value="3" label="Seed import failed - failed to store seed"/>
 </enum>
diff --git a/tools/perf/bootstrap_deps b/tools/perf/bootstrap_deps
index 35ae49f..1923a6e 100644
--- a/tools/perf/bootstrap_deps
+++ b/tools/perf/bootstrap_deps
@@ -26,10 +26,8 @@
         "https://src.chromium.org/chrome/trunk/src/tools/variations",
     "src/testing/variations":
         "https://src.chromium.org/chrome/trunk/src/testing/variations",
-}
-
-# tools/perf depends on Telemetry, so pull in the Telemetry deps, too.
-deps_includes = {
-    "src/tools/telemetry/bootstrap_deps":
-        "https://src.chromium.org/chrome/trunk/src/tools/telemetry/bootstrap_deps",
+    "src/tools/telemetry":
+        "https://src.chromium.org/chrome/trunk/src/tools/telemetry",
+    "src/third_party/catapult":
+        "https://src.chromium.org/chrome/trunk/src/third_party/catapult",
 }
diff --git a/tools/telemetry/bootstrap_deps b/tools/telemetry/bootstrap_deps
deleted file mode 100644
index 145defe..0000000
--- a/tools/telemetry/bootstrap_deps
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This file specifies dependencies required to bootstrap Telemetry. It is in a
-# minimal version of the format used by other DEPS files that gclient can read,
-# but it should only be used to bootstrap Telemetry *outside* of a normal
-# Chrome checkout. In particular, the normal 'value' part of the python
-# dict is not used and hence does not contain real URLs for the repos.
-
-deps = {
-    "src/tools/telemetry": "",
-    "src/third_party/catapult": "",
-}
diff --git a/tools/telemetry/telemetry/internal/util/find_dependencies.py b/tools/telemetry/telemetry/internal/util/find_dependencies.py
index 9d03cf9..bb0673f9 100644
--- a/tools/telemetry/telemetry/internal/util/find_dependencies.py
+++ b/tools/telemetry/telemetry/internal/util/find_dependencies.py
@@ -153,7 +153,6 @@
   dependencies |= FindPythonDependencies(os.path.realpath(
     os.path.join(path.GetTelemetryDir(),
                  'telemetry', 'testing', 'run_tests.py')))
-  dependencies |= FindBootstrapDependencies(path.GetTelemetryDir())
 
   # Add dependencies.
   for target_path in target_paths:
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 52517dbe..b794982 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -538,10 +538,10 @@
    fun:_ZN7content45ManifestParserTest_IconDensityParseRules_Test8TestBodyEv
 }
 {
-   bug_512466
+   bug_415092
    Memcheck:Leak
    fun:_Znw*
-   fun:_ZN4base22PosixDynamicThreadPool13AddTaskNoLockEPNS_11PendingTaskE
+   fun:_ZN4base22PosixDynamicThreadPool7AddTaskEPNS_11PendingTaskE
    fun:_ZN4base22PosixDynamicThreadPool8PostTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEE
    fun:_ZN4base12_GLOBAL__N_114WorkerPoolImpl8PostTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEEb
    fun:_ZN4base10WorkerPool8PostTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEEb
@@ -3421,3 +3421,9 @@
    fun:_ZN7content21RenderProcessHostImpl4InitEv
    fun:_ZN7content22RenderFrameHostManager14InitRenderViewEPNS_18RenderViewHostImplEPNS_20RenderFrameProxyHostE
 }
+{
+   bug_557778
+   Memcheck:Uninitialized
+   fun:vp9_pick_inter_mode
+   fun:nonrd_pick_sb_modes
+}
diff --git a/ui/base/ime/chromeos/component_extension_ime_manager.cc b/ui/base/ime/chromeos/component_extension_ime_manager.cc
index 5e7ac6a..97ed38c6 100644
--- a/ui/base/ime/chromeos/component_extension_ime_manager.cc
+++ b/ui/base/ime/chromeos/component_extension_ime_manager.cc
@@ -33,7 +33,6 @@
   "es(cat)",
   "fi",
   "fr",
-  "fr(bepo)",
   "fr(oss)",
   "gb(dvorak)",
   "gb(extd)",
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 36d56f26..5242838 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -13,7 +13,6 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/trace_event/trace_event.h"
-#include "cc/base/scoped_ptr_algorithm.h"
 #include "cc/layers/delegated_renderer_layer.h"
 #include "cc/layers/nine_patch_layer.h"
 #include "cc/layers/picture_layer.h"
@@ -983,22 +982,6 @@
     pending_threaded_animations_.push_back(animation.Pass());
 }
 
-namespace{
-
-struct HasAnimationId {
-  HasAnimationId(int id): id_(id) {
-  }
-
-  bool operator()(cc::Animation* animation) const {
-    return animation->id() == id_;
-  }
-
- private:
-  int id_;
-};
-
-}
-
 void Layer::RemoveThreadedAnimation(int animation_id) {
   DCHECK(cc_layer_);
   if (pending_threaded_animations_.size() == 0) {
@@ -1007,10 +990,12 @@
   }
 
   pending_threaded_animations_.erase(
-      cc::remove_if(&pending_threaded_animations_,
-                    pending_threaded_animations_.begin(),
-                    pending_threaded_animations_.end(),
-                    HasAnimationId(animation_id)),
+      std::remove_if(
+          pending_threaded_animations_.begin(),
+          pending_threaded_animations_.end(),
+          [animation_id](const scoped_ptr<cc::Animation>& animation) {
+            return animation->id() == animation_id;
+          }),
       pending_threaded_animations_.end());
 }
 
@@ -1020,16 +1005,12 @@
 }
 
 void Layer::SendPendingThreadedAnimations() {
-  for (cc::ScopedPtrVector<cc::Animation>::iterator it =
-           pending_threaded_animations_.begin();
-       it != pending_threaded_animations_.end();
-       ++it)
-    cc_layer_->AddAnimation(pending_threaded_animations_.take(it));
-
+  for (auto& animation : pending_threaded_animations_)
+    cc_layer_->AddAnimation(std::move(animation));
   pending_threaded_animations_.clear();
 
-  for (size_t i = 0; i < children_.size(); ++i)
-    children_[i]->SendPendingThreadedAnimations();
+  for (auto* child : children_)
+    child->SendPendingThreadedAnimations();
 }
 
 void Layer::CreateCcLayer() {
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h
index 187a3d9f..d6f593a 100644
--- a/ui/compositor/layer.h
+++ b/ui/compositor/layer.h
@@ -15,7 +15,6 @@
 #include "cc/animation/animation_events.h"
 #include "cc/animation/layer_animation_event_observer.h"
 #include "cc/base/region.h"
-#include "cc/base/scoped_ptr_vector.h"
 #include "cc/layers/content_layer_client.h"
 #include "cc/layers/layer_client.h"
 #include "cc/layers/surface_layer.h"
@@ -505,7 +504,7 @@
 
   // Animations that are passed to AddThreadedAnimation before this layer is
   // added to a tree.
-  cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_;
+  std::vector<scoped_ptr<cc::Animation>> pending_threaded_animations_;
 
   // Ownership of the layer is held through one of the strongly typed layer
   // pointers, depending on which sort of layer this is.
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc
index 184a8ac..afed9df 100644
--- a/ui/views/bubble/bubble_delegate.cc
+++ b/ui/views/bubble/bubble_delegate.cc
@@ -67,9 +67,8 @@
   UpdateColorsFromTheme(GetNativeTheme());
 }
 
-BubbleDelegateView::BubbleDelegateView(
-    View* anchor_view,
-    BubbleBorder::Arrow arrow)
+BubbleDelegateView::BubbleDelegateView(View* anchor_view,
+                                       BubbleBorder::Arrow arrow)
     : close_on_esc_(true),
       close_on_deactivate_(true),
       anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()),
@@ -81,7 +80,8 @@
       accept_events_(true),
       border_accepts_events_(true),
       adjust_if_offscreen_(true),
-      parent_window_(NULL) {
+      parent_window_(NULL),
+      close_reason_(CloseReason::UNKNOWN) {
   SetAnchorView(anchor_view);
   AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
   UpdateColorsFromTheme(GetNativeTheme());
@@ -151,6 +151,14 @@
   return kViewClassName;
 }
 
+void BubbleDelegateView::OnWidgetClosing(Widget* widget) {
+  DCHECK(GetBubbleFrameView());
+  if (widget == GetWidget() && close_reason_ == CloseReason::UNKNOWN &&
+      GetBubbleFrameView()->close_button_clicked()) {
+    close_reason_ = CloseReason::CLOSE_BUTTON;
+  }
+}
+
 void BubbleDelegateView::OnWidgetDestroying(Widget* widget) {
   if (anchor_widget() == widget)
     SetAnchorView(NULL);
@@ -175,8 +183,11 @@
 
 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
                                                    bool active) {
-  if (close_on_deactivate() && widget == GetWidget() && !active)
+  if (close_on_deactivate() && widget == GetWidget() && !active) {
+    if (close_reason_ == CloseReason::UNKNOWN)
+      close_reason_ = CloseReason::DEACTIVATION;
     GetWidget()->Close();
+  }
 }
 
 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget,
@@ -221,6 +232,7 @@
     const ui::Accelerator& accelerator) {
   if (!close_on_esc() || accelerator.key_code() != ui::VKEY_ESCAPE)
     return false;
+  close_reason_ = CloseReason::ESCAPE;
   GetWidget()->Close();
   return true;
 }
diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h
index 3bc73f8..1bd96340 100644
--- a/ui/views/bubble/bubble_delegate.h
+++ b/ui/views/bubble/bubble_delegate.h
@@ -28,6 +28,13 @@
   // Internal class name.
   static const char kViewClassName[];
 
+  enum class CloseReason {
+    DEACTIVATION,
+    ESCAPE,
+    CLOSE_BUTTON,
+    UNKNOWN,
+  };
+
   BubbleDelegateView();
   BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow);
   ~BubbleDelegateView() override;
@@ -44,6 +51,7 @@
   const char* GetClassName() const override;
 
   // WidgetObserver overrides:
+  void OnWidgetClosing(Widget* widget) override;
   void OnWidgetDestroying(Widget* widget) override;
   void OnWidgetVisibilityChanging(Widget* widget, bool visible) override;
   void OnWidgetVisibilityChanged(Widget* widget, bool visible) override;
@@ -93,6 +101,8 @@
   bool adjust_if_offscreen() const { return adjust_if_offscreen_; }
   void set_adjust_if_offscreen(bool adjust) { adjust_if_offscreen_ = adjust; }
 
+  CloseReason close_reason() const { return close_reason_; }
+
   // Get the arrow's anchor rect in screen space.
   virtual gfx::Rect GetAnchorRect() const;
 
@@ -192,6 +202,8 @@
   // Parent native window of the bubble.
   gfx::NativeView parent_window_;
 
+  CloseReason close_reason_;
+
   DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
 };
 
diff --git a/ui/views/bubble/bubble_delegate_unittest.cc b/ui/views/bubble/bubble_delegate_unittest.cc
index 16f14c59..1ec4e395 100644
--- a/ui/views/bubble/bubble_delegate_unittest.cc
+++ b/ui/views/bubble/bubble_delegate_unittest.cc
@@ -3,8 +3,10 @@
 // found in the LICENSE file.
 
 #include "ui/base/hit_test.h"
+#include "ui/events/event_utils.h"
 #include "ui/views/bubble/bubble_delegate.h"
 #include "ui/views/bubble/bubble_frame_view.h"
+#include "ui/views/controls/button/label_button.h"
 #include "ui/views/test/test_widget_observer.h"
 #include "ui/views/test/views_test_base.h"
 #include "ui/views/widget/widget.h"
@@ -36,6 +38,10 @@
   View* GetInitiallyFocusedView() override { return view_; }
   gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); }
 
+  BubbleFrameView* GetBubbleFrameViewForTest() const {
+    return GetBubbleFrameView();
+  }
+
  private:
   View* view_;
 
@@ -261,4 +267,53 @@
   EXPECT_FALSE(bubble_widget->CanActivate());
 }
 
+TEST_F(BubbleDelegateTest, CloseReasons) {
+  {
+    scoped_ptr<Widget> anchor_widget(CreateTestWidget());
+    BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
+        anchor_widget->GetContentsView(), BubbleBorder::NONE);
+    bubble_delegate->set_close_on_deactivate(true);
+    Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
+    bubble_widget->Show();
+    anchor_widget->Activate();
+    EXPECT_TRUE(bubble_widget->IsClosed());
+    EXPECT_EQ(BubbleDelegateView::CloseReason::DEACTIVATION,
+              bubble_delegate->close_reason());
+  }
+
+  {
+    scoped_ptr<Widget> anchor_widget(CreateTestWidget());
+    BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
+        anchor_widget->GetContentsView(), BubbleBorder::NONE);
+    bubble_delegate->set_close_on_esc(true);
+    Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
+    bubble_widget->Show();
+    // Cast as a test hack to access AcceleratorPressed() (which is protected
+    // in BubbleDelegate).
+    static_cast<View*>(bubble_delegate)
+        ->AcceleratorPressed(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
+    EXPECT_TRUE(bubble_widget->IsClosed());
+    EXPECT_EQ(BubbleDelegateView::CloseReason::ESCAPE,
+              bubble_delegate->close_reason());
+  }
+
+  {
+    scoped_ptr<Widget> anchor_widget(CreateTestWidget());
+    TestBubbleDelegateView* bubble_delegate =
+        new TestBubbleDelegateView(anchor_widget->GetContentsView());
+    Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
+    bubble_widget->Show();
+    BubbleFrameView* frame_view = bubble_delegate->GetBubbleFrameViewForTest();
+    LabelButton* close_button = frame_view->close_;
+    ASSERT_TRUE(close_button);
+    frame_view->ButtonPressed(
+        close_button,
+        ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0),
+                       ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE));
+    EXPECT_TRUE(bubble_widget->IsClosed());
+    EXPECT_EQ(BubbleDelegateView::CloseReason::CLOSE_BUTTON,
+              bubble_delegate->close_reason());
+  }
+}
+
 }  // namespace views
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index 88025b0..c9fcd40 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -70,7 +70,8 @@
       title_icon_(new views::ImageView()),
       title_(nullptr),
       close_(nullptr),
-      titlebar_extra_view_(nullptr) {
+      titlebar_extra_view_(nullptr),
+      close_button_clicked_(false) {
   AddChildView(title_icon_);
 
   ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
@@ -321,8 +322,10 @@
 }
 
 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) {
-  if (sender == close_)
+  if (sender == close_) {
+    close_button_clicked_ = true;
     GetWidget()->Close();
+  }
 }
 
 void BubbleFrameView::SetBubbleBorder(scoped_ptr<BubbleBorder> border) {
diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h
index b21215c..28750c3 100644
--- a/ui/views/bubble/bubble_frame_view.h
+++ b/ui/views/bubble/bubble_frame_view.h
@@ -84,6 +84,8 @@
                                    gfx::Size client_size,
                                    bool adjust_if_offscreen);
 
+  bool close_button_clicked() const { return close_button_clicked_; }
+
  protected:
   // Returns the available screen bounds if the frame were to show in |rect|.
   virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const;
@@ -93,6 +95,7 @@
 
  private:
   FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView);
+  FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CloseReasons);
 
   // Mirrors the bubble's arrow location on the |vertical| or horizontal axis,
   // if the generated window bounds don't fit in the monitor bounds.
@@ -123,6 +126,9 @@
   // (x) close button.
   View* titlebar_extra_view_;
 
+  // Whether the close button was clicked.
+  bool close_button_clicked_;
+
   DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
 };
 
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index 66f38d4..578c9ea 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -251,6 +251,9 @@
 
 void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
   ownership_ = params.ownership;
+  window_->SetCanFocus(params.activatable ==
+                       Widget::InitParams::ACTIVATABLE_YES);
+
   // WindowTreeHost creates the compositor using the ContextFactory from
   // aura::Env. Install |context_factory_| there so that |context_factory_| is
   // picked up.