Import Cobalt 12.78263
diff --git a/src/base/allocator/allocator.gyp b/src/base/allocator/allocator.gyp
index f5bda73..7ab45bd 100644
--- a/src/base/allocator/allocator.gyp
+++ b/src/base/allocator/allocator.gyp
@@ -26,6 +26,9 @@
         '<(tcmalloc_dir)/src',
         '../..',
       ],
+      'defines': [
+        'NO_HEAP_CHECK',
+      ],
       'direct_dependent_settings': {
         'configurations': {
           'Common_Base': {
@@ -120,8 +123,6 @@
         '<(tcmalloc_dir)/src/gperftools/profiler.h',
         '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
         '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
-        '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
-        '<(tcmalloc_dir)/src/heap-checker.cc',
         '<(tcmalloc_dir)/src/heap-profile-table.cc',
         '<(tcmalloc_dir)/src/heap-profile-table.h',
         '<(tcmalloc_dir)/src/heap-profiler.cc',
@@ -376,8 +377,6 @@
             '<(tcmalloc_dir)/src/base/thread_lister.h',
             '<(tcmalloc_dir)/src/deep-heap-profile.cc',
             '<(tcmalloc_dir)/src/deep-heap-profile.h',
-            '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
-            '<(tcmalloc_dir)/src/heap-checker.cc',
             '<(tcmalloc_dir)/src/heap-profiler.cc',
             '<(tcmalloc_dir)/src/heap-profile-table.cc',
             '<(tcmalloc_dir)/src/heap-profile-table.h',
@@ -434,30 +433,6 @@
             '-fvtable-verify=preinit',
           ],
         }],
-        [ 'linux_keep_shadow_stacks==1', {
-          'sources': [
-            '<(tcmalloc_dir)/src/linux_shadow_stacks.cc',
-            '<(tcmalloc_dir)/src/linux_shadow_stacks.h',
-            '<(tcmalloc_dir)/src/stacktrace_shadow-inl.h',
-          ],
-          'cflags': [
-            '-finstrument-functions',
-          ],
-          'defines': [
-            'KEEP_SHADOW_STACKS',
-          ],
-        }],
-        [ 'linux_use_heapchecker==0', {
-          # Do not compile and link the heapchecker source.
-          'sources!': [
-            '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
-            '<(tcmalloc_dir)/src/heap-checker.cc',
-          ],
-          # Disable the heap checker in tcmalloc.
-          'defines': [
-            'NO_HEAP_CHECK',
-           ],
-        }],
         [ 'clang==1', {
           'cflags': [
             '-Wno-non-literal-null-conversion',
diff --git a/src/base/base_untrusted.gyp b/src/base/base_untrusted.gyp
index 8b64c7d..df90bb2 100644
--- a/src/base/base_untrusted.gyp
+++ b/src/base/base_untrusted.gyp
@@ -11,7 +11,7 @@
     'base.gypi',
   ],
   'conditions': [
-    ['disable_nacl==0 and disable_nacl_untrusted==0', {
+    ['disable_nacl==0', {
       'targets': [
         {
           'target_name': 'base_untrusted',
diff --git a/src/build/common.gypi b/src/build/common.gypi
index 6f02d54..c72e66b 100644
--- a/src/build/common.gypi
+++ b/src/build/common.gypi
@@ -9,96 +9,18 @@
   # Variables expected to be overriden in the platform's gyp_configuration.gypi.
   'variables': {
     # Putting a variables dict inside another variables dict looks kind of
-    # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as
-    # variables within the outer variables dict here.  This is necessary
-    # to get these variables defined for the conditions within this variables
-    # dict that operate on these variables.
+    # weird.  This is done so that 'host_arch', 'android_build_type', etc are
+    # defined as variables within the outer variables dict here.  This is
+    # necessary to get these variables defined for the conditions within this
+    # variables dict that operate on these variables.
     'variables': {
       'variables': {
         'variables': {
-          'variables': {
-            # Whether we're building a ChromeOS build.
-            'chromeos%': 0,
-
-            # Whether or not we are using the Aura windowing framework.
-            'use_aura%': 0,
-
-            # Whether or not we are building the Ash shell.
-            'use_ash%': 0,
-          },
-          # Copy conditionally-set variables out one scope.
-          'chromeos%': '<(chromeos)',
-          'use_aura%': '<(use_aura)',
-          'use_ash%': '<(use_ash)',
-
-          # Whether we are using Views Toolkit
-          'toolkit_views%': 0,
-
-          # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
-          'use_openssl%': 0,
-
-          'use_ibus%': 0,
-
-          # Disable viewport meta tag by default.
-          'enable_viewport%': 0,
-
-          # Enable HiDPI support.
-          'enable_hidpi%': 0,
-
-          # Enable touch optimized art assets and metrics.
-          'enable_touch_ui%': 0,
-
-          # Override buildtype to select the desired build flavor.
-          # Dev - everyday build for development/testing
-          # Official - release build (generally implies additional processing)
-          # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
-          # conversion is done), some of the things which are now controlled by
-          # 'branding', such as symbol generation, will need to be refactored
-          # based on 'buildtype' (i.e. we don't care about saving symbols for
-          # non-Official # builds).
-          'buildtype%': 'Dev',
-
-          'conditions': [
-            # ChromeOS implies ash.
-            ['chromeos==1', {
-              'use_ash%': 1,
-              'use_aura%': 1,
-            }],
-
-            # For now, Windows builds that |use_aura| should also imply using
-            # ash. This rule should be removed for the future when Windows is
-            # using the aura windows without the ash interface.
-            ['use_aura==1 and OS=="win"', {
-              'use_ash%': 1,
-            }],
-            ['use_ash==1', {
-              'use_aura%': 1,
-            }],
-
-            # Compute the architecture that we're building on.
-            ['OS=="win" or OS=="mac" or OS=="ios"', {
-              'host_arch%': 'ia32',
-            }, {
-              # This handles the Unix platforms for which there is some support.
-              # Anything else gets passed through, which probably won't work
-              # very well; such hosts should pass an explicit target_arch to
-              # gyp.
-              'host_arch%':
-                '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")',
-            }],
-          ],
+          'host_arch%':
+            '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")',
         },
 
         # Copy conditionally-set variables out one scope.
-        'chromeos%': '<(chromeos)',
-        'use_aura%': '<(use_aura)',
-        'use_ash%': '<(use_ash)',
-        'use_openssl%': '<(use_openssl)',
-        'use_ibus%': '<(use_ibus)',
-        'enable_viewport%': '<(enable_viewport)',
-        'enable_hidpi%': '<(enable_hidpi)',
-        'enable_touch_ui%': '<(enable_touch_ui)',
-        'buildtype%': '<(buildtype)',
         'host_arch%': '<(host_arch)',
 
         # Default architecture we're building for is the architecture we're
@@ -109,90 +31,16 @@
         # Ant, value 0), or as part of the Android system (and hence with the
         # Android build system, value 1).
         'android_build_type%': 0,
-
-        'conditions': [
-          # Set default value of toolkit_views based on OS.
-          ['OS=="win" or chromeos==1 or use_aura==1', {
-            'toolkit_views%': 1,
-          }, {
-            'toolkit_views%': 0,
-          }],
-
-          # Set toolkit_uses_gtk for the Chromium browser on Linux.
-          ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', {
-            'toolkit_uses_gtk%': 1,
-          }, {
-            'toolkit_uses_gtk%': 0,
-          }],
-
-          # Enable HiDPI on Mac OS and Chrome OS.
-          ['OS=="mac" or chromeos==1', {
-            'enable_hidpi%': 1,
-          }],
-
-          # Enable touch UI on Metro.
-          ['OS=="win"', {
-            'enable_touch_ui%': 1,
-          }],
-
-          # Enable App Launcher only on ChromeOS and Windows for now.
-          ['use_ash==1 or OS=="win"', {
-            'enable_app_list%': 1,
-          }, {
-            'enable_app_list%': 0,
-          }],
-
-          ['use_aura==1 or (OS!="win" and OS!="mac" and OS!="ios" and OS!="android")', {
-            'use_default_render_theme%': 1,
-          }, {
-            'use_default_render_theme%': 0,
-          }],
-        ],
       },
 
       # Copy conditionally-set variables out one scope.
-      'chromeos%': '<(chromeos)',
       'host_arch%': '<(host_arch)',
       'target_arch%': '<(target_arch)',
-      'toolkit_views%': '<(toolkit_views)',
-      'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
-      'use_aura%': '<(use_aura)',
-      'use_ash%': '<(use_ash)',
-      'use_openssl%': '<(use_openssl)',
-      'use_ibus%': '<(use_ibus)',
-      'enable_viewport%': '<(enable_viewport)',
-      'enable_hidpi%': '<(enable_hidpi)',
-      'enable_touch_ui%': '<(enable_touch_ui)',
       'android_build_type%': '<(android_build_type)',
-      'enable_app_list%': '<(enable_app_list)',
-      'use_default_render_theme%': '<(use_default_render_theme)',
-      'buildtype%': '<(buildtype)',
-
-      # We used to provide a variable for changing how libraries were built.
-      # This variable remains until we can clean up all the users.
-      # This needs to be one nested variables dict in so that dependent
-      # gyp files can make use of it in their outer variables.  (Yikes!)
-      # http://code.google.com/p/chromium/issues/detail?id=83308
-      'library%': 'static_library',
-
-      # Override branding to select the desired branding flavor.
-      'branding%': 'Chromium',
-
-      # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
-      # are built under a chromium full build (1) or a webkit.org chromium
-      # build (0).
-      'inside_chromium_build%': 1,
-
-      # Set to 1 to enable fast builds. It disables debug info for fastest
-      # compilation.
-      'fastbuild%': 0,
 
       # Set to 1 to enable dcheck in release without having to use the flag.
       'dcheck_always_on%': 0,
 
-      # Disable file manager component extension by default.
-      'file_manager_extension%': 0,
-
       # Python version.
       'python_ver%': '2.6',
 
@@ -205,12 +53,6 @@
       # The system root for cross-compiles. Default: none.
       'sysroot%': '',
 
-      # The system libdir used for this ABI.
-      'system_libdir%': 'lib',
-
-      # On Linux, we build with sse2 for Chromium builds.
-      'disable_sse2%': 0,
-
       # Use libjpeg-turbo as the JPEG codec used by Chromium.
       'use_libjpeg_turbo%': 1,
 
@@ -225,39 +67,6 @@
       # it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
       'component%': 'static_library',
 
-      # Set to select the Title Case versions of strings in GRD files.
-      'use_titlecase_in_grd_files%': 0,
-
-      # Use translations provided by volunteers at launchpad.net.  This
-      # currently only works on Linux.
-      'use_third_party_translations%': 0,
-
-      # Remoting compilation is enabled by default. Set to 0 to disable.
-      'remoting%': 1,
-
-      # Configuration policy is enabled by default. Set to 0 to disable.
-      'configuration_policy%': 1,
-
-      # Variable safe_browsing is used to control the build time configuration
-      # for safe browsing feature. Safe browsing can be compiled in 3 different
-      # levels: 0 disables it, 1 enables it fully, and 2 enables only UI and
-      # reporting features without enabling phishing and malware detection. This
-      # is useful to integrate a third party phishing/malware detection to
-      # existing safe browsing logic.
-      'safe_browsing%': 1,
-
-      # Speech input is compiled in by default. Set to 0 to disable.
-      'input_speech%': 1,
-
-      # Notifications are compiled in by default. Set to 0 to disable.
-      'notifications%' : 1,
-
-      # If this is set, the clang plugins used on the buildbot will be used.
-      # Run tools/clang/scripts/update.sh to make sure they are compiled.
-      # This causes 'clang_chrome_plugins_flags' to be set.
-      # Has no effect if 'clang' is not set as well.
-      'clang_use_chrome_plugins%': 1,
-
       # Enable building with ASAN (Clang's -fsanitize=address option).
       # -fsanitize=address only works with clang, but asan=1 implies clang=1
       # See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer
@@ -267,7 +76,6 @@
       # -fsanitize=thread only works with clang, but tsan=1 implies clang=1
       # See http://clang.llvm.org/docs/ThreadSanitizer.html
       'tsan%': 0,
-      'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.txt',
 
       # Use a modified version of Clang to intercept allocated types and sizes
       # for allocated objects. clang_type_profiler=1 implies clang=1.
@@ -279,356 +87,16 @@
       # See src/third_party/cygprofile/cyg-profile.cc for details.
       'order_profiling%': 0,
 
-      # Use the provided profiled order file to link Chrome image with it.
-      # This makes Chrome faster by better using CPU cache when executing code.
-      # This is known as PGO (profile guided optimization).
-      # See https://sites.google.com/a/google.com/chrome-msk/dev/boot-speed-up-effort
-      'order_text_section%' : "",
-
-      # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
-      # libraries on linux x86-64 and arm, plus ASLR.
-      'linux_fpic%': 1,
-
-      # Whether one-click signin is enabled or not.
-      'enable_one_click_signin%': 0,
-
-      # Enable Web Intents support in WebKit.
-      'enable_web_intents%': 1,
-
-      # Enable Chrome browser extensions
-      'enable_extensions%': 1,
-
-      # Enable browser automation.
-      'enable_automation%': 1,
-
-      # Enable Google Now.
-      'enable_google_now%': 1,
-
-      # Enable language detection.
-      'enable_language_detection%': 1,
-
-      # Enable printing support and UI.
-      'enable_printing%': 1,
-
-      # Enable Web Intents web content registration via HTML element
-      # and WebUI managing such registrations.
-      'enable_web_intents_tag%': 0,
-
-      # Webrtc compilation is enabled by default. Set to 0 to disable.
-      'enable_webrtc%': 1,
-
-      # PPAPI by default does not support plugins making calls off the main
-      # thread. Set to 1 to turn on experimental support for out-of-process
-      # plugins to make call of the main thread.
-      'enable_pepper_threading%': 1,
-
-      # Enables use of the session service, which is enabled by default.
-      # Support for disabling depends on the platform.
-      'enable_session_service%': 1,
-
-      # Enables theme support, which is enabled by default.  Support for
-      # disabling depends on the platform.
-      'enable_themes%': 1,
-
-      # Uses OEM-specific wallpaper resources on Chrome OS.
-      'use_oem_wallpaper%': 0,
-
-      # Enables support for background apps.
-      'enable_background%': 1,
-
-      # Enable the task manager by default.
-      'enable_task_manager%': 1,
-
-      # Enable FTP support by default.
-      'disable_ftp_support%': 0,
-
-      # XInput2 multitouch support is disabled by default (use_xi2_mt=0).
-      # Setting to non-zero value enables XI2 MT. When XI2 MT is enabled,
-      # the input value also defines the required XI2 minor minimum version.
-      # For example, use_xi2_mt=2 means XI2.2 or above version is required.
-      'use_xi2_mt%': 0,
-
-      # Use of precompiled headers on Windows.
-      #
-      # This is on by default in VS 2010, but off by default for VS
-      # 2008 because of complications that it can cause with our
-      # trybots etc.
-      #
-      # This variable may be explicitly set to 1 (enabled) or 0
-      # (disabled) in ~/.gyp/include.gypi or via the GYP command line.
-      # This setting will override the default.
-      #
-      # Note that a setting of 1 is probably suitable for most or all
-      # Windows developers using VS 2008, since precompiled headers
-      # provide a build speedup of 20-25%.  There are a couple of
-      # small workarounds you may need to use when using VS 2008 (but
-      # not 2010), see
-      # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
-      # for details.
-      'chromium_win_pch%': 0,
-
       # Set this to true when building with Clang.
       # See http://code.google.com/p/chromium/wiki/Clang for details.
       'clang%': 0,
 
-      # Enable plug-in installation by default.
-      'enable_plugin_installation%': 1,
-
-      # Enable PPAPI and NPAPI by default.
-      # TODO(nileshagrawal): Make this flag enable/disable NPAPI as well
-      # as PPAPI; see crbug.com/162667.
-      'enable_plugins%': 1,
-
-      # Specifies whether to use canvas_skia.cc in place of platform
-      # specific implementations of gfx::Canvas. Affects text drawing in the
-      # Chrome UI.
-      # TODO(asvitkine): Enable this on all platforms and delete this flag.
-      #                  http://crbug.com/105550
-      'use_canvas_skia%': 0,
-
       # Set to "tsan", "memcheck", or "drmemory" to configure the build to work
       # with one of those tools.
       'build_for_tool%': '',
 
-      # Whether tests targets should be run, archived or just have the
-      # dependencies verified. All the tests targets have the '_run' suffix,
-      # e.g. base_unittests_run runs the target base_unittests. The test target
-      # always calls tools/swarm_client/isolate.py. See the script's --help for
-      # more information and the valid --mode values. Meant to be overriden with
-      # GYP_DEFINES.
-      # TODO(maruel): Converted the default from 'check' to 'noop' so work can
-      # be done while the builders are being reconfigured to check out test data
-      # files.
-      'test_isolation_mode%': 'noop',
-      # It must not be '<(PRODUCT_DIR)' alone, the '/' is necessary otherwise
-      # gyp will remove duplicate flags, causing isolate.py to be confused.
-      'test_isolation_outdir%': '<(PRODUCT_DIR)/isolate',
-
-      'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/x86',
-      'wix_path%': '<(DEPTH)/third_party/wix',
-
-      'use_harfbuzz_ng%': 0,
-
-      'conditions': [
-        # TODO(epoger): Figure out how to set use_skia=1 for Mac outside of
-        # the 'conditions' clause.  Initial attempts resulted in chromium and
-        # webkit disagreeing on its setting.
-        ['OS=="mac"', {
-          'use_skia%': 1,
-        }, {
-          'use_skia%': 1,
-        }],
-
-        # A flag for POSIX platforms
-        ['OS=="win" or OS=="starboard"', {
-          'os_posix%': 0,
-        }, {
-          'os_posix%': 1,
-        }],
-
-        # A flag for BSD platforms
-        ['OS=="freebsd" or OS=="openbsd"', {
-          'os_bsd%': 1,
-        }, {
-          'os_bsd%': 0,
-        }],
-
-        # NSS usage.
-        ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
-          'use_nss%': 1,
-        }, {
-          'use_nss%': 0,
-        }],
-
-        # Flags to use X11 on non-Mac POSIX platforms
-        ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or OS=="lb_shell" or OS=="starboard"', {
-          'use_glib%': 0,
-          'use_x11%': 0,
-        }, {
-          'use_glib%': 1,
-          'use_x11%': 1,
-        }],
-
-        # We always use skia text rendering in Aura on Windows, since GDI
-        # doesn't agree with our BackingStore.
-        # TODO(beng): remove once skia text rendering is on by default.
-        ['use_aura==1 and OS=="win"', {
-          'enable_skia_text%': 1,
-        }],
-
-        # A flag to enable or disable our compile-time dependency
-        # on gnome-keyring. If that dependency is disabled, no gnome-keyring
-        # support will be available. This option is useful
-        # for Linux distributions and for Aura.
-        ['chromeos==1 or use_aura==1', {
-          'use_gnome_keyring%': 0,
-        }, {
-          'use_gnome_keyring%': 1,
-        }],
-
-        ['toolkit_uses_gtk==1 or OS=="mac" or OS=="ios"', {
-          # GTK+, Mac and iOS want Title Case strings
-          'use_titlecase_in_grd_files%': 1,
-        }],
-
-        # Enable file manager extension on Chrome OS.
-        ['chromeos==1', {
-          'file_manager_extension%': 1,
-        }, {
-          'file_manager_extension%': 0,
-        }],
-
-        ['OS=="win" or OS=="mac" or (OS=="linux" and use_aura==0)', {
-          'enable_one_click_signin%': 1,
-        }],
-
-        ['OS=="android"', {
-          'enable_extensions%': 0,
-          'enable_google_now%': 0,
-          'enable_language_detection%': 0,
-          'enable_printing%': 0,
-          'enable_themes%': 0,
-          'enable_webrtc%': 0,
-          'proprietary_codecs%': 1,
-          'remoting%': 0,
-        }],
-
-        ['OS=="ios"', {
-          'configuration_policy%': 0,
-          'disable_ftp_support%': 1,
-          'enable_automation%': 0,
-          'enable_extensions%': 0,
-          'enable_google_now%': 0,
-          'enable_language_detection%': 0,
-          'enable_printing%': 0,
-          'enable_session_service%': 0,
-          'enable_themes%': 0,
-          'enable_webrtc%': 0,
-          'notifications%': 0,
-          'remoting%': 0,
-          'safe_browsing%': 0,
-        }],
-
-        # Use GPU accelerated cross process image transport by default
-        # on linux builds with the Aura window manager
-        ['use_aura==1 and OS=="linux"', {
-          'ui_compositor_image_transport%': 1,
-        }, {
-          'ui_compositor_image_transport%': 0,
-        }],
-
-        # Turn precompiled headers on by default for VS 2010.
-        ['OS=="win" and MSVS_VERSION=="2010" and buildtype!="Official"', {
-          'chromium_win_pch%': 1
-        }],
-
-        ['use_aura==1 or chromeos==1 or OS=="android"', {
-          'enable_plugin_installation%': 0,
-        }, {
-          'enable_plugin_installation%': 1,
-        }],
-
-        ['OS=="android" or OS=="ios"', {
-          'enable_plugins%': 0,
-        }, {
-          'enable_plugins%': 1,
-        }],
-
-        # linux_use_gold_binary: whether to use the binary checked into
-        # third_party/gold.
-        ['OS=="linux"', {
-          'linux_use_gold_binary%': 1,
-        }, {
-          'linux_use_gold_binary%': 0,
-        }],
-
-        # linux_use_gold_flags: whether to use build flags that rely on gold.
-        # On by default for x64 Linux.  Temporarily off for ChromeOS as
-        # it failed on a buildbot.
-        ['OS=="linux" and chromeos==0', {
-          'linux_use_gold_flags%': 1,
-        }, {
-          'linux_use_gold_flags%': 0,
-        }],
-
-        ['OS=="android" or OS=="ios"', {
-          'enable_captive_portal_detection%': 0,
-        }, {
-          'enable_captive_portal_detection%': 1,
-        }],
-
-        # Enable Skia UI text drawing incrementally on different platforms.
-        # http://crbug.com/105550
-        #
-        # On Aura, this allows per-tile painting to be used in the browser
-        # compositor.
-        ['OS!="mac" and OS!="android"', {
-          'use_canvas_skia%': 1,
-        }],
-
-        ['chromeos==1', {
-          # When building for ChromeOS we dont want Chromium to use libjpeg_turbo.
-          'use_libjpeg_turbo%': 0,
-        }],
-
-        ['OS=="android"', {
-          # When building as part of the Android system, use system libraries
-          # where possible to reduce ROM size.
-          'use_system_libjpeg%': '<(android_build_type)',
-        }],
-
-        # Enable Settings App only on Windows.
-        ['enable_app_list==1 and OS=="win"', {
-          'enable_settings_app%': 1,
-        }, {
-          'enable_settings_app%': 0,
-        }],
-
-        ['OS=="linux" and target_arch=="arm" and chromeos==0', {
-          # Set some defaults for arm/linux chrome builds
-          'armv7%': 1,
-          'linux_breakpad%': 0,
-          'linux_use_tcmalloc%': 0,
-          'linux_use_gold_flags%': 0,
-          # sysroot needs to be an absolute path otherwise it generates
-          # incorrect results when passed to pkg-config
-          'sysroot%': '<!(cd <(DEPTH) && pwd -P)/arm-sysroot',
-        }], # OS=="linux" and target_arch=="arm" and chromeos==0
-      ],
-
-      # Set this to 1 to use the Google-internal file containing
-      # official API keys for Google Chrome even in a developer build.
-      # Setting this variable explicitly to 1 will cause your build to
-      # fail if the internal file is missing.
-      #
-      # Set this to 0 to not use the internal file, even when it
-      # exists in your checkout.
-      #
-      # Leave set to 2 to have this variable implicitly set to 1 if
-      # you have src/google_apis/internal/google_chrome_api_keys.h in
-      # your checkout, and implicitly set to 0 if not.
-      #
-      # Note that official builds always behave as if this variable
-      # was explicitly set to 1, i.e. they always use official keys,
-      # and will fail to build if the internal file is missing.
-      'use_official_google_api_keys%': 2,
-
-      # Set these to bake the specified API keys and OAuth client
-      # IDs/secrets into your build.
-      #
-      # If you create a build without values baked in, you can instead
-      # set environment variables to provide the keys at runtime (see
-      # src/google_apis/google_api_keys.h for details).  Features that
-      # require server-side APIs may fail to work if no keys are
-      # provided.
-      #
-      # Note that if you are building an official build or if
-      # use_official_google_api_keys has been set to 1 (explicitly or
-      # implicitly), these values will be ignored and the official
-      # keys will be used instead.
-      'google_api_key%': '',
-      'google_default_client_id%': '',
-      'google_default_client_secret%': '',
+      'os_posix%': 0,
+      'os_bsd%': 0,
     },
 
     # Make sure that cobalt is defined. This is needed in
@@ -637,160 +105,32 @@
     'cobalt%': 0,
 
     # Copy conditionally-set variables out one scope.
-    'branding%': '<(branding)',
-    'buildtype%': '<(buildtype)',
     'target_arch%': '<(target_arch)',
     'host_arch%': '<(host_arch)',
     'library%': 'static_library',
-    'toolkit_views%': '<(toolkit_views)',
-    'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
-    'use_aura%': '<(use_aura)',
-    'use_ash%': '<(use_ash)',
-    'use_openssl%': '<(use_openssl)',
-    'use_ibus%': '<(use_ibus)',
-    'use_nss%': '<(use_nss)',
     'os_bsd%': '<(os_bsd)',
     'os_posix%': '<(os_posix)',
-    'use_glib%': '<(use_glib)',
-    'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
-    'use_skia%': '<(use_skia)',
-    'use_x11%': '<(use_x11)',
-    'use_gnome_keyring%': '<(use_gnome_keyring)',
-    'linux_fpic%': '<(linux_fpic)',
-    'enable_pepper_threading%': '<(enable_pepper_threading)',
-    'chromeos%': '<(chromeos)',
-    'enable_viewport%': '<(enable_viewport)',
-    'enable_hidpi%': '<(enable_hidpi)',
-    'enable_touch_ui%': '<(enable_touch_ui)',
-    'use_xi2_mt%':'<(use_xi2_mt)',
-    'file_manager_extension%': '<(file_manager_extension)',
-    'inside_chromium_build%': '<(inside_chromium_build)',
-    'fastbuild%': '<(fastbuild)',
     'dcheck_always_on%': '<(dcheck_always_on)',
     'python_ver%': '<(python_ver)',
     'armv7%': '<(armv7)',
     'arm_neon%': '<(arm_neon)',
     'sysroot%': '<(sysroot)',
-    'system_libdir%': '<(system_libdir)',
     'component%': '<(component)',
-    'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
-    'use_third_party_translations%': '<(use_third_party_translations)',
-    'remoting%': '<(remoting)',
-    'enable_one_click_signin%': '<(enable_one_click_signin)',
-    'enable_webrtc%': '<(enable_webrtc)',
-    'chromium_win_pch%': '<(chromium_win_pch)',
-    'configuration_policy%': '<(configuration_policy)',
-    'safe_browsing%': '<(safe_browsing)',
-    'input_speech%': '<(input_speech)',
-    'notifications%': '<(notifications)',
-    'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
     'asan%': '<(asan)',
     'tsan%': '<(tsan)',
-    'tsan_blacklist%': '<(tsan_blacklist)',
     'clang_type_profiler%': '<(clang_type_profiler)',
     'order_profiling%': '<(order_profiling)',
-    'order_text_section%': '<(order_text_section)',
-    'enable_extensions%': '<(enable_extensions)',
-    'enable_web_intents%': '<(enable_web_intents)',
-    'enable_web_intents_tag%': '<(enable_web_intents_tag)',
-    'enable_plugin_installation%': '<(enable_plugin_installation)',
-    'enable_plugins%': '<(enable_plugins)',
-    'enable_session_service%': '<(enable_session_service)',
-    'enable_themes%': '<(enable_themes)',
-    'use_oem_wallpaper%': '<(use_oem_wallpaper)',
-    'enable_background%': '<(enable_background)',
-    'linux_use_gold_binary%': '<(linux_use_gold_binary)',
-    'linux_use_gold_flags%': '<(linux_use_gold_flags)',
-    'use_canvas_skia%': '<(use_canvas_skia)',
-    'test_isolation_mode%': '<(test_isolation_mode)',
-    'test_isolation_outdir%': '<(test_isolation_outdir)',
-    'enable_automation%': '<(enable_automation)',
-    'enable_printing%': '<(enable_printing)',
-    'enable_google_now%': '<(enable_google_now)',
-    'enable_language_detection%': '<(enable_language_detection)',
-    'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
-    'disable_ftp_support%': '<(disable_ftp_support)',
-    'enable_task_manager%': '<(enable_task_manager)',
-    'sas_dll_path%': '<(sas_dll_path)',
-    'wix_path%': '<(wix_path)',
     'use_libjpeg_turbo%': '<(use_libjpeg_turbo)',
     'use_system_libjpeg%': '<(use_system_libjpeg)',
     'android_build_type%': '<(android_build_type)',
-    'enable_app_list%': '<(enable_app_list)',
-    'use_default_render_theme%': '<(use_default_render_theme)',
-    'enable_settings_app%': '<(enable_settings_app)',
-    'use_official_google_api_keys%': '<(use_official_google_api_keys)',
-    'google_api_key%': '<(google_api_key)',
-    'google_default_client_id%': '<(google_default_client_id)',
-    'google_default_client_secret%': '<(google_default_client_secret)',
-    'use_harfbuzz_ng%': '<(use_harfbuzz_ng)',
 
     # Use system protobuf instead of bundled one.
     'use_system_protobuf%': 0,
 
-    # Use system yasm instead of bundled one.
-    'use_system_yasm%': 0,
-
-    # Default to enabled PIE; this is important for ASLR but we may need to be
-    # able to turn it off for various reasons.
-    'linux_disable_pie%': 0,
-
-    # The release channel that this build targets. This is used to restrict
-    # channel-specific build options, like which installer packages to create.
-    # The default is 'all', which does no channel-specific filtering.
-    'channel%': 'all',
-
-    # Override chromium_mac_pch and set it to 0 to suppress the use of
-    # precompiled headers on the Mac.  Prefix header injection may still be
-    # used, but prefix headers will not be precompiled.  This is useful when
-    # using distcc to distribute a build to compile slaves that don't
-    # share the same compiler executable as the system driving the compilation,
-    # because precompiled headers rely on pointers into a specific compiler
-    # executable's image.  Setting this to 0 is needed to use an experimental
-    # Linux-Mac cross compiler distcc farm.
-    'chromium_mac_pch%': 1,
-
-    # The default value for mac_strip in target_defaults. This cannot be
-    # set there, per the comment about variable% in a target_defaults.
-    'mac_strip_release%': 1,
-
-    # Set to 1 to enable code coverage.  In addition to build changes
-    # (e.g. extra CFLAGS), also creates a new target in the src/chrome
-    # project file called "coverage".
-    # Currently ignored on Windows.
-    'coverage%': 0,
-
-    # Set to 1 to force Visual C++ to use legacy debug information format /Z7.
-    # This is useful for parallel compilation tools which can't support /Zi.
-    # Only used on Windows.
-    'win_z7%' : 0,
-
-    # Although base/allocator lets you select a heap library via an
-    # environment variable, the libcmt shim it uses sometimes gets in
-    # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
-    #  'win_use_allocator_shim': 0,
-    #  'win_release_RuntimeLibrary': 2
-    # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
-    'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
-
-    # Whether usage of OpenMAX is enabled.
-    'enable_openmax%': 0,
-
     # Whether proprietary audio/video codecs are assumed to be included with
     # this build (only meaningful if branding!=Chrome).
     'proprietary_codecs%': 0,
 
-    # TODO(bradnelson): eliminate this when possible.
-    # To allow local gyp files to prevent release.vsprops from being included.
-    # Yes(1) means include release.vsprops.
-    # Once all vsprops settings are migrated into gyp, this can go away.
-    'msvs_use_common_release%': 1,
-
-    # TODO(bradnelson): eliminate this when possible.
-    # To allow local gyp files to override additional linker options for msvs.
-    # Yes(1) means set use the common linker options.
-    'msvs_use_common_linker_extras%': 1,
-
     # TODO(sgk): eliminate this if possible.
     # It would be nicer to support this via a setting in 'target_defaults'
     # in chrome/app/locales/locales.gypi overriding the setting in the
@@ -798,29 +138,6 @@
     # but that doesn't work as we'd like.
     'msvs_debug_link_incremental%': '2',
 
-    # Needed for some of the largest modules.
-    'msvs_debug_link_nonincremental%': '1',
-
-    # Turns on Use Library Dependency Inputs for linking chrome.dll on Windows
-    # to get incremental linking to be faster in debug builds.
-    'incremental_chrome_dll%': '0',
-
-    # The default settings for third party code for treating
-    # warnings-as-errors. Ideally, this would not be required, however there
-    # is some third party code that takes a long time to fix/roll. So, this
-    # flag allows us to have warnings as errors in general to prevent
-    # regressions in most modules, while working on the bits that are
-    # remaining.
-    'win_third_party_warn_as_error%': 'true',
-
-    # This is the location of the sandbox binary. Chrome looks for this before
-    # running the zygote process. If found, and SUID, it will be used to
-    # sandbox the zygote process and, thus, all renderer processes.
-    'linux_sandbox_path%': '',
-
-    # Set this to true to enable SELinux support.
-    'selinux%': 0,
-
     # Clang stuff.
     'clang%': '<(clang)',
     'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
@@ -834,40 +151,10 @@
     'clang_load%': '',
     'clang_add_plugin%': '',
 
-    # The default type of gtest.
-    'gtest_target_type%': 'executable',
-
     # Enable sampling based profiler.
     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
     'profiling%': '0',
 
-    # Enable strict glibc debug mode.
-    'glibcxx_debug%': 0,
-
-    # Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
-    'linux_breakpad%': 0,
-    # And if we want to dump symbols for Breakpad-enabled builds.
-    'linux_dump_symbols%': 0,
-    # And if we want to strip the binary after dumping symbols.
-    'linux_strip_binary%': 0,
-    # Strip the test binaries needed for Linux reliability tests.
-    'linux_strip_reliability_tests%': 0,
-
-    # Enable TCMalloc.
-    'linux_use_tcmalloc%': 1,
-
-    # Disable TCMalloc's heapchecker.
-    'linux_use_heapchecker%': 0,
-
-    # Disable shadow stack keeping used by heapcheck to unwind the stacks
-    # better.
-    'linux_keep_shadow_stacks%': 0,
-
-    # Set to 1 to link against libgnome-keyring instead of using dlopen().
-    'linux_link_gnome_keyring%': 0,
-    # Set to 1 to link against gsettings APIs instead of using dlopen().
-    'linux_link_gsettings%': 0,
-
     # Set Thumb compilation flags.
     'arm_thumb%': 0,
 
@@ -878,16 +165,6 @@
     # Set ARM float abi compilation flag.
     'arm_float_abi%': 'softfp',
 
-    # Enable new NPDevice API.
-    'enable_new_npdevice_api%': 0,
-
-    # Enable EGLImage support in OpenMAX
-    'enable_eglimage%': 1,
-
-    # Enable a variable used elsewhere throughout the GYP files to determine
-    # whether to compile in the sources for the GPU plugin / process.
-    'enable_gpu%': 1,
-
     # .gyp files or targets should set chromium_code to 1 if they build
     # Chromium-specific code, as opposed to external code.  This variable is
     # used to control such things as the set of warnings to enable, and
@@ -899,160 +176,18 @@
     # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
     'enable_wexit_time_destructors%': 0,
 
-    # Set to 1 to compile with the built in pdf viewer.
-    'internal_pdf%': 0,
-
-    # Set to 1 to compile with the OpenGL ES 2.0 conformance tests.
-    'internal_gles2_conform_tests%': 0,
-
-    # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
-    # so Cocoa is happy (http://crbug.com/20441).
-    'locales': [
-      'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
-      'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
-      'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
-      'ml', 'mr', 'ms', 'nb', 'nl', 'pl', 'pt-PT', 'ro', 'ru',
-      'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
-      'vi', 'zh-CN', 'zh-TW',
-    ],
-
-    # Pseudo locales are special locales which are used for testing and
-    # debugging. They don't get copied to the final app. For more info,
-    # check out https://sites.google.com/a/chromium.org/dev/Home/fake-bidi
-    'pseudo_locales': [
-      'fake-bidi',
-    ],
-
-    'grit_defines': [],
-
-    # If debug_devtools is set to 1, JavaScript files for DevTools are
-    # stored as is and loaded from disk. Otherwise, a concatenated file
-    # is stored in resources.pak. It is still possible to load JS files
-    # from disk by passing --debug-devtools cmdline switch.
-    'debug_devtools%': 0,
-
-    # The Java Bridge is not compiled in by default.
-    'java_bridge%': 0,
-
-    # Code signing for iOS binaries.  The bots need to be able to disable this.
-    'chromium_ios_signing%': 1,
-
-    # This flag is only used when disable_nacl==0 and disables all those
-    # subcomponents which would require the installation of a native_client
-    # untrusted toolchain.
-    'disable_nacl_untrusted%': 0,
-
-    # Disable Dart by default.
-    'enable_dart%': 0,
-
-    # The desired version of Windows SDK can be set in ~/.gyp/include.gypi.
-    'msbuild_toolset%': '',
-
     # Native Client is enabled by default.
     'disable_nacl%': 0,
 
-    # Whether to build full debug version for Debug configuration on Android.
-    # Compared to full debug version, the default Debug configuration on Android
-    # has no full v8 debug, has size optimization and linker gc section, so that
-    # we can build a debug version with acceptable size and performance.
-    'android_full_debug%': 0,
-
     # Sets the default version name and code for Android app, by default we
     # do a developer build.
     'android_app_version_name%': 'Developer Build',
     'android_app_version_code%': 0,
 
-    'sas_dll_exists': '<!(python <(DEPTH)/build/dir_exists.py <(sas_dll_path))',
-    'wix_exists': '<!(python <(DEPTH)/build/dir_exists.py <(wix_path))',
-
     'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/10',
-    'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files',
-
-    # Whether we are using the rlz library or not.  Platforms like Android send
-    # rlz codes for searches but do not use the library.
-    'enable_rlz%': 0,
 
     'conditions': [
-      ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(directx_sdk_default_path))"=="True"', {
-        'directx_sdk_path%': '<(directx_sdk_default_path)',
-      }, {
-        'directx_sdk_path%': '$(DXSDK_DIR)',
-      }],
-      ['OS=="win"', {
-        'windows_driver_kit_path%': '$(WDK_DIR)',
-      }],
-      # If use_official_google_api_keys is already set (to 0 or 1), we
-      # do none of the implicit checking.  If it is set to 1 and the
-      # internal keys file is missing, the build will fail at compile
-      # time.  If it is set to 0 and keys are not provided by other
-      # means, a warning will be printed at compile time.
-      ['use_official_google_api_keys==2', {
-        'use_official_google_api_keys%':
-            '<!(python <(DEPTH)/google_apis/build/check_internal.py <(DEPTH)/google_apis/internal/google_chrome_api_keys.h)',
-      }],
-      ['os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell"', {
-        # Figure out the python architecture to decide if we build pyauto.
-        'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/<(system_libdir)/libpython<(python_ver).so.1.0)',
-        'conditions': [
-          # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
-          # that it takes effect here.
-          ['clang==0 and asan==0 and tsan==0', {
-            # This will set gcc_version to XY if you are running gcc X.Y.*.
-            # This is used to tweak build flags for gcc 4.5.
-            'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
-          }, {
-            'gcc_version%': 0,
-          }],
-          ['branding=="Chrome"', {
-            'linux_breakpad%': 1,
-          }],
-          # All Chrome builds have breakpad symbols, but only process the
-          # symbols from official builds.
-          ['(branding=="Chrome" and buildtype=="Official")', {
-            'linux_dump_symbols%': 1,
-          }],
-        ],
-      }],  # os_posix==1 and OS!="mac" and OS!="ios"
-      ['OS=="ios"', {
-        'disable_nacl%': 1,
-        'enable_background%': 0,
-        'enable_gpu%': 0,
-        'enable_task_manager%': 0,
-        'icu_use_data_file_flag%': 1,
-        'use_system_bzip2%': 1,
-        'use_system_libxml%': 1,
-        'use_system_sqlite%': 1,
-
-        # The Mac SDK is set for iOS builds and passed through to Mac
-        # sub-builds. This allows the Mac sub-build SDK in an iOS build to be
-        # overridden from the command line the same way it is for a Mac build.
-        'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py 10.6)',
-
-        # iOS SDK and deployment target support.  The iOS 5.0 SDK is actually
-        # what is required, but the value is left blank so when it is set in
-        # the project files it will be the "current" iOS SDK.  Forcing 5.0
-        # even though it is "current" causes Xcode to spit out a warning for
-        # every single project file for not using the "current" SDK.
-        'ios_sdk%': '',
-        'ios_sdk_path%': '',
-        'ios_deployment_target%': '4.3',
-
-        'conditions': [
-          # ios_product_name is set to the name of the .app bundle as it should
-          # appear on disk.
-          ['branding=="Chrome"', {
-            'ios_product_name%': 'Chrome',
-          }, { # else: branding!="Chrome"
-            'ios_product_name%': 'Chromium',
-          }],
-          ['branding=="Chrome" and buildtype=="Official"', {
-            'ios_breakpad%': 1,
-          }, { # else: branding!="Chrome" or buildtype!="Official"
-            'ios_breakpad%': 0,
-          }],
-        ],
-      }],  # OS=="ios"
-      ['OS=="android" or ((OS=="lb_shell" or OS=="starboard") and target_arch=="android")', {
+      ['target_arch=="android"', {
         # Location of Android NDK.
         'variables': {
           'variables': {
@@ -1094,195 +229,22 @@
         # to specify the output directory for Ant in the Android build.
         'ant_build_out': '`cd <(PRODUCT_DIR) && pwd -P`',
 
-        # Uses Android's crash report system
-        'linux_breakpad%': 0,
-
-        # Always uses openssl.
-        'use_openssl%': 1,
-
         'proprietary_codecs%': '<(proprietary_codecs)',
-        'enable_task_manager%': 0,
-        'safe_browsing%': 2,
-        'configuration_policy%': 0,
-        'input_speech%': 0,
-        'enable_web_intents%': 0,
-        'enable_automation%': 0,
-        'java_bridge%': 1,
-        'build_ffmpegsumo%': 0,
-        'linux_use_tcmalloc%': 0,
 
         # Disable Native Client.
         'disable_nacl%': 1,
 
-        # Android does not support background apps.
-        'enable_background%': 0,
-
-        # Sessions are store separately in the Java side.
-        'enable_session_service%': 0,
-
-        # Set to 1 once we have a notification system for Android.
-        # http://crbug.com/115320
-        'notifications%': 0,
-
-        'p2p_apis%' : 0,
-
-        # TODO(jrg): when 'gtest_target_type'=='shared_library' and
-        # OS==android, make all gtest_targets depend on
-        # testing/android/native_test.gyp:native_test_apk.
-        'gtest_target_type%': 'shared_library',
-
-        # Uses system APIs for decoding audio and video.
-        'use_libffmpeg%': '0',
-
-        # Always use the chromium skia.
-        'use_system_skia%': '0',
-
-        # Configure crash reporting and build options based on release type.
-        'conditions': [
-          ['buildtype=="Official"', {
-            # Only report crash dumps for Official builds.
-            'linux_breakpad%': 1,
-          }, {
-            'linux_breakpad%': 0,
-          }],
-        ],
-
         # When building as part of the Android system, use system libraries
         # where possible to reduce ROM size.
         # TODO(steveblock): Investigate using the system version of sqlite.
         'use_system_sqlite%': 0,  # '<(android_build_type)',
-        'use_system_expat%': '<(android_build_type)',
         'use_system_icu%': '<(android_build_type)',
         'use_system_stlport%': '<(android_build_type)',
 
         # Copy it out one scope.
         'android_build_type%': '<(android_build_type)',
-      }],  # OS=="android"
-      ['OS=="mac"', {
-        'variables': {
-          # Mac OS X SDK and deployment target support.  The SDK identifies
-          # the version of the system headers that will be used, and
-          # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
-          # macro.  "Maximum allowed" refers to the operating system version
-          # whose APIs are available in the headers.  The deployment target
-          # identifies the minimum system version that the built products are
-          # expected to function on.  It corresponds to the
-          # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
-          # macros are available, #include <AvailabilityMacros.h>.  Additional
-          # documentation on these macros is available at
-          # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
-          # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
-          # deployment target to 10.6.  Other projects, such as O3D, may
-          # override these defaults.
+      }],  # target_arch=="android"
 
-          # Normally, mac_sdk_min is used to find an SDK that Xcode knows
-          # about that is at least the specified version. In official builds,
-          # the SDK must match mac_sdk_min exactly. If the SDK is installed
-          # someplace that Xcode doesn't know about, set mac_sdk_path to the
-          # path to the SDK; when set to a non-empty string, SDK detection
-          # based on mac_sdk_min will be bypassed entirely.
-          'mac_sdk_min%': '10.6',
-          'mac_sdk_path%': '',
-
-          'mac_deployment_target%': '10.6',
-        },
-
-        'mac_sdk_min': '<(mac_sdk_min)',
-        'mac_sdk_path': '<(mac_sdk_path)',
-        'mac_deployment_target': '<(mac_deployment_target)',
-
-        # Enable clang on mac by default!
-        'clang%': 1,
-
-        # Compile in Breakpad support by default so that it can be
-        # tested, even if it is not enabled by default at runtime.
-        'mac_breakpad_compiled_in%': 1,
-        'conditions': [
-          # mac_product_name is set to the name of the .app bundle as it should
-          # appear on disk.  This duplicates data from
-          # chrome/app/theme/chromium/BRANDING and
-          # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
-          # these names into the build system.
-          ['OS!="lb_shell"', {
-            'default_configuration': 'Debug',
-          }],
-          ['branding=="Chrome"', {
-            'mac_product_name%': 'Google Chrome',
-          }, { # else: branding!="Chrome"
-            'mac_product_name%': 'Chromium',
-          }],
-
-          ['branding=="Chrome" and buildtype=="Official"', {
-            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
-            # Enable uploading crash dumps.
-            'mac_breakpad_uploads%': 1,
-            # Enable dumping symbols at build time for use by Mac Breakpad.
-            'mac_breakpad%': 1,
-            # Enable Keystone auto-update support.
-            'mac_keystone%': 1,
-          }, { # else: branding!="Chrome" or buildtype!="Official"
-            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
-            'mac_breakpad_uploads%': 0,
-            'mac_breakpad%': 0,
-            'mac_keystone%': 0,
-          }],
-        ],
-      }],  # OS=="mac"
-      ['OS=="win"', {
-        'conditions': [
-          ['component=="shared_library"', {
-            'win_use_allocator_shim%': 0,
-          }],
-          ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
-            # Only enabled by default for ninja because it's buggy in VS.
-            # Not enabled for component=static_library because some targets
-            # are too large and the toolchain fails due to the size of the
-            # .obj files.
-            'incremental_chrome_dll%': 1,
-          }],
-          # Don't do incremental linking for large modules on 32-bit.
-          ['MSVS_OS_BITS==32', {
-            'msvs_large_module_debug_link_mode%': '1',  # No
-          },{
-            'msvs_large_module_debug_link_mode%': '2',  # Yes
-          }],
-          ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', {
-            'msvs_express%': 1,
-            'secure_atl%': 0,
-          },{
-            'msvs_express%': 0,
-            'secure_atl%': 1,
-          }],
-        ],
-        'nacl_win64_defines': [
-          # This flag is used to minimize dependencies when building
-          # Native Client loader for 64-bit Windows.
-          'NACL_WIN64',
-        ],
-      }],
-
-      ['os_posix==1 and chromeos==0 and OS!="android" and OS!="ios"', {
-        'use_cups%': 1,
-      }, {
-        'use_cups%': 0,
-      }],
-
-      # Native Client glibc toolchain is enabled by default except on arm.
-      ['target_arch=="arm"', {
-        'disable_glibc%': 1,
-      }, {
-        'disable_glibc%': 0,
-      }],
-
-      # Disable SSE2 when building for ARM or MIPS.
-      ['target_arch=="arm" or target_arch=="mipsel"', {
-        'disable_sse2%': 1,
-      }, {
-        'disable_sse2%': '<(disable_sse2)',
-      }],
-
-      # Set the relative path from this file to the GYP file of the JPEG
-      # library used by Chromium.
       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
         # Configuration for using the system libjeg is here.
         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
@@ -1290,120 +252,13 @@
         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
       }],
 
-      # Options controlling the use of GConf (the classic GNOME configuration
-      # system) and GIO, which contains GSettings (the new GNOME config system).
-      ['chromeos==1', {
-        'use_gconf%': 0,
-        'use_gio%': 0,
-      }, {
-        'use_gconf%': 1,
-        'use_gio%': 1,
-      }],
-
-      # Set up -D and -E flags passed into grit.
-      ['branding=="Chrome"', {
-        # TODO(mmoss) The .grd files look for _google_chrome, but for
-        # consistency they should look for google_chrome_build like C++.
-        'grit_defines': ['-D', '_google_chrome',
-                         '-E', 'CHROMIUM_BUILD=google_chrome'],
-      }, {
-        'grit_defines': ['-D', '_chromium',
-                         '-E', 'CHROMIUM_BUILD=chromium'],
-      }],
-      ['chromeos==1', {
-        'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
-      }],
-      ['toolkit_views==1', {
-        'grit_defines': ['-D', 'toolkit_views'],
-      }],
-      ['use_aura==1', {
-        'grit_defines': ['-D', 'use_aura'],
-      }],
-      ['use_ash==1', {
-        'grit_defines': ['-D', 'use_ash'],
-      }],
-      ['use_nss==1', {
-        'grit_defines': ['-D', 'use_nss'],
-      }],
-      ['file_manager_extension==1', {
-        'grit_defines': ['-D', 'file_manager_extension'],
-      }],
-      ['remoting==1', {
-        'grit_defines': ['-D', 'remoting'],
-      }],
-      ['use_titlecase_in_grd_files==1', {
-        'grit_defines': ['-D', 'use_titlecase'],
-      }],
-      ['use_third_party_translations==1', {
-        'grit_defines': ['-D', 'use_third_party_translations'],
-        'locales': [
-          'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
-          'ka', 'ku', 'kw', 'ms', 'ug'
-        ],
-      }],
-      ['OS=="android"', {
-        'grit_defines': ['-D', 'android'],
-      }],
-      ['OS=="mac"', {
-        'grit_defines': ['-D', 'scale_factors=2x'],
-      }],
-      ['OS == "ios"', {
-        'grit_defines': [
-          # define for iOS specific resources.
-          '-D', 'ios',
-          # iOS uses a whitelist to filter resources.
-          '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
-        ],
-        # iOS uses pt instead of pt-BR.
-        'locales': ['pt'],
-      }, {  # OS != "ios"
-        'locales': ['pt-BR'],
-      }],
-      ['enable_extensions==1', {
-        'grit_defines': ['-D', 'enable_extensions'],
-      }],
-      ['enable_printing==1', {
-        'grit_defines': ['-D', 'enable_printing'],
-      }],
-      ['enable_themes==1', {
-        'grit_defines': ['-D', 'enable_themes'],
-      }],
-      ['use_oem_wallpaper==1', {
-        'grit_defines': ['-D', 'use_oem_wallpaper'],
-      }],
-      ['enable_app_list==1', {
-        'grit_defines': ['-D', 'enable_app_list'],
-      }],
-      ['enable_settings_app==1', {
-        'grit_defines': ['-D', 'enable_settings_app'],
-      }],
-      ['clang_use_chrome_plugins==1 and OS!="win"', {
-        'clang_chrome_plugins_flags': [
-          '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
-        ],
-      }],
-
-      ['enable_web_intents_tag==1', {
-        'grit_defines': ['-D', 'enable_web_intents_tag'],
-      }],
-
       ['asan==1 and OS!="win"', {
         'clang%': 1,
       }],
-      ['asan==1 and OS=="mac"', {
-        # See http://crbug.com/145503.
-        'component': "static_library",
-      }],
       ['tsan==1', {
         'clang%': 1,
       }],
 
-      ['OS=="linux" and clang_type_profiler==1', {
-        'clang%': 1,
-        'clang_use_chrome_plugins%': 0,
-        'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
-      }],
-
       # On valgrind bots, override the optimizer settings so we don't inline too
       # much and make the stacks harder to figure out.
       #
@@ -1456,33 +311,6 @@
         # Keep the code under #ifndef NVALGRIND.
         'release_valgrind_build': 1,
       }],
-
-      # Enable RLZ on Win, Mac and ChromeOS.
-      ['branding=="Chrome" and (OS=="win" or OS=="mac" or chromeos==1)', {
-        'enable_rlz%': 1,
-      }],
-    ],
-
-    # List of default apps to install in new profiles.  The first list contains
-    # the source files as found in svn.  The second list, used only for linux,
-    # contains the destination location for each of the files.  When a crx
-    # is added or removed from the list, the chrome/browser/resources/
-    # default_apps/external_extensions.json file must also be updated.
-    'default_apps_list': [
-      'browser/resources/default_apps/external_extensions.json',
-      'browser/resources/default_apps/gmail.crx',
-      'browser/resources/default_apps/search.crx',
-      'browser/resources/default_apps/youtube.crx',
-      'browser/resources/default_apps/drive.crx',
-      'browser/resources/default_apps/docs.crx',
-    ],
-    'default_apps_list_linux_dest': [
-      '<(PRODUCT_DIR)/default_apps/external_extensions.json',
-      '<(PRODUCT_DIR)/default_apps/gmail.crx',
-      '<(PRODUCT_DIR)/default_apps/search.crx',
-      '<(PRODUCT_DIR)/default_apps/youtube.crx',
-      '<(PRODUCT_DIR)/default_apps/drive.crx',
-      '<(PRODUCT_DIR)/default_apps/docs.crx',
     ],
   },
   'target_defaults': {
@@ -1553,376 +381,30 @@
         '-Wno-unnamed-type-template-args',
       ],
 
-      'conditions': [
-        ['OS=="win" and component=="shared_library"', {
-          # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
-          'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
-          'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
-        }, {
-          # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
-          'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
-          'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
-        }],
-        ['OS=="ios"', {
-          # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
-          'mac_release_optimization%': 's', # Use -Os unless overridden
-          'mac_debug_optimization%': '0',   # Use -O0 unless overridden
-        }, {
-          # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
-          'mac_release_optimization%': '3', # Use -O3 unless overridden
-          'mac_debug_optimization%': '0',   # Use -O0 unless overridden
-        }],
-      ],
+      # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
+      'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
+      'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
+
+      # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
+      'mac_release_optimization%': '3', # Use -O3 unless overridden
+      'mac_debug_optimization%': '0',   # Use -O0 unless overridden
     },
+    'defines': [
+      'USE_OPENSSL=1',
+    ],
     'conditions': [
-      ['OS=="linux" and linux_use_tcmalloc==1 and clang_type_profiler==1', {
-        'cflags_cc!': ['-fno-rtti'],
-        'cflags_cc+': [
-          '-frtti',
-          '-gline-tables-only',
-          '-fintercept-allocation-functions',
-        ],
-        'defines': ['TYPE_PROFILING'],
-        'dependencies': [
-          '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
-        ],
-      }],
-      ['OS=="win" and "<(msbuild_toolset)"!=""', {
-        'msbuild_toolset': '<(msbuild_toolset)',
-      }],
-      ['branding=="Chrome"', {
-        'defines': ['GOOGLE_CHROME_BUILD'],
-      }, {  # else: branding!="Chrome"
-        'defines': ['CHROMIUM_BUILD'],
-      }],
-      ['OS=="mac" and component=="shared_library"', {
-        'xcode_settings': {
-          'DYLIB_INSTALL_NAME_BASE': '@rpath',
-          'LD_RUNPATH_SEARCH_PATHS': [
-            # For unbundled binaries.
-            '@loader_path/.',
-            # For bundled binaries, to get back from Binary.app/Contents/MacOS.
-            '@loader_path/../../..',
-          ],
-        },
-      }],
-      ['enable_rlz==1', {
-        'defines': ['ENABLE_RLZ'],
-      }],
       ['component=="shared_library"', {
         'defines': ['COMPONENT_BUILD'],
       }],
-      ['toolkit_views==1', {
-        'defines': ['TOOLKIT_VIEWS=1'],
-      }],
-      ['ui_compositor_image_transport==1', {
-        'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
-      }],
-      ['use_aura==1', {
-        'defines': ['USE_AURA=1'],
-      }],
-      ['use_ash==1', {
-        'defines': ['USE_ASH=1'],
-      }],
-      ['use_default_render_theme==1', {
-        'defines': ['USE_DEFAULT_RENDER_THEME=1'],
-      }],
-      ['use_libjpeg_turbo==1', {
-        'defines': ['USE_LIBJPEG_TURBO=1'],
-      }],
-      ['use_nss==1', {
-        'defines': ['USE_NSS=1'],
-      }],
-      ['enable_one_click_signin==1', {
-        'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
-      }],
-      ['toolkit_uses_gtk==1 and toolkit_views==0', {
-        # TODO(erg): We are progressively sealing up use of deprecated features
-        # in gtk in preparation for an eventual porting to gtk3.
-        'defines': ['GTK_DISABLE_SINGLE_INCLUDES=1'],
-      }],
-      ['chromeos==1', {
-        'defines': ['OS_CHROMEOS=1'],
-      }],
-      ['use_xi2_mt!=0', {
-        'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
-      }],
-      ['file_manager_extension==1', {
-        'defines': ['FILE_MANAGER_EXTENSION=1'],
-      }],
       ['profiling==1', {
         'defines': ['ENABLE_PROFILING=1'],
       }],
-      ['OS=="linux" and glibcxx_debug==1', {
-        'defines': ['_GLIBCXX_DEBUG=1',],
-        'cflags_cc+': ['-g'],
-      }],
-      ['remoting==1', {
-        'defines': ['ENABLE_REMOTING=1'],
-      }],
-      ['enable_webrtc==1', {
-        'defines': ['ENABLE_WEBRTC=1'],
-      }],
       ['proprietary_codecs==1', {
         'defines': ['USE_PROPRIETARY_CODECS'],
       }],
-      ['enable_pepper_threading==1', {
-        'defines': ['ENABLE_PEPPER_THREADING'],
-      }],
-      ['enable_viewport==1', {
-        'defines': ['ENABLE_VIEWPORT'],
-      }],
-      ['configuration_policy==1', {
-        'defines': ['ENABLE_CONFIGURATION_POLICY'],
-      }],
-      ['input_speech==1', {
-        'defines': ['ENABLE_INPUT_SPEECH'],
-      }],
-      ['notifications==1', {
-        'defines': ['ENABLE_NOTIFICATIONS'],
-      }],
-      ['enable_hidpi==1', {
-        'defines': ['ENABLE_HIDPI=1'],
-      }],
-      ['fastbuild!=0', {
-        # Clang creates chubby debug information, which makes linking very
-        # slow. For now, don't create debug information with clang.  See
-        # http://crbug.com/70000
-        'conditions': [
-          ['clang==1', {
-            'conditions': [
-              ['OS=="linux"', {
-                'variables': {
-                  'debug_extra_cflags': '-g0',
-                },
-              }],
-              # Android builds symbols on release by default, disable them.
-              ['OS=="android"', {
-                'variables': {
-                  'debug_extra_cflags': '-g0',
-                  'release_extra_cflags': '-g0',
-                },
-              }],
-            ],
-          }, { # else clang!=1
-            'conditions': [
-              # For Windows and Mac, we don't genererate debug information.
-              ['OS=="win"', {
-                'msvs_settings': {
-                  'VCLinkerTool': {
-                    'GenerateDebugInformation': 'false',
-                  },
-                  'VCCLCompilerTool': {
-                    'DebugInformationFormat': '0',
-                  },
-                },
-              }],
-              ['OS=="mac"', {
-                'xcode_settings': {
-                  'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
-                },
-              }],
-              ['OS=="linux"', {
-                'variables': {
-                  'debug_extra_cflags': '-g1',
-                },
-              }],
-              ['OS=="android"', {
-                'variables': {
-                  'debug_extra_cflags': '-g1',
-                  'release_extra_cflags': '-g1',
-                },
-              }],
-            ],
-          }], # clang!=1
-        ],
-      }],  # fastbuild!=0
       ['dcheck_always_on!=0', {
         'defines': ['DCHECK_ALWAYS_ON=1'],
       }],  # dcheck_always_on!=0
-      ['selinux==1', {
-        'defines': ['CHROMIUM_SELINUX=1'],
-      }],
-      ['win_use_allocator_shim==0', {
-        'conditions': [
-          ['OS=="win"', {
-            'defines': ['NO_TCMALLOC'],
-          }],
-        ],
-      }],
-      ['enable_gpu==1', {
-        'defines': [
-          'ENABLE_GPU=1',
-        ],
-      }],
-      ['use_openssl==1', {
-        'defines': [
-          'USE_OPENSSL=1',
-        ],
-      }],
-      ['enable_eglimage==1', {
-        'defines': [
-          'ENABLE_EGLIMAGE=1',
-        ],
-      }],
-      ['use_skia==1', {
-        'defines': [
-          'USE_SKIA=1',
-        ],
-      }],
-      ['asan==1 and OS=="win"', {
-        # Since asan on windows uses Syzygy, we need /PROFILE turned on to
-        # produce appropriate pdbs.
-        'msvs_settings': {
-          'VCLinkerTool': {
-            'Profile': 'true',
-          },
-        },
-        'defines': ['ADDRESS_SANITIZER'],
-      }],  # asan==1 and OS=="win"
-      ['coverage!=0', {
-        'conditions': [
-          ['OS=="mac" or OS=="ios"', {
-            'xcode_settings': {
-              'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
-              'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
-            },
-          }],
-          ['OS=="mac"', {
-            # Add -lgcov for types executable, shared_library, and
-            # loadable_module; not for static_library.
-            # This is a delayed conditional.
-            'target_conditions': [
-              ['_type!="static_library"', {
-                'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
-              }],
-            ],
-          }],
-          ['OS=="linux" or OS=="android"', {
-            'cflags': [ '-ftest-coverage',
-                        '-fprofile-arcs' ],
-            'link_settings': { 'libraries': [ '-lgcov' ] },
-          }],
-          ['OS=="win"', {
-            'variables': {
-              # Disable incremental linking for all modules.
-              # 0: inherit, 1: disabled, 2: enabled.
-              'msvs_debug_link_incremental': '1',
-              'msvs_large_module_debug_link_mode': '1',
-            },
-            'defines': [
-              # Disable iterator debugging (huge speed boost without any
-              # change in coverage results).
-              '_HAS_ITERATOR_DEBUGGING=0',
-            ],
-            'msvs_settings': {
-              'VCLinkerTool': {
-                # Enable profile information (necessary for coverage
-                # instrumentation). This is incompatible with incremental
-                # linking.
-                'Profile': 'true',
-              },
-            }
-         }],  # OS==win
-        ],  # conditions for coverage
-      }],  # coverage!=0
-      ['OS=="win"', {
-        'defines': [
-          '__STD_C',
-          '_CRT_SECURE_NO_DEPRECATE',
-          '_SCL_SECURE_NO_DEPRECATE',
-          # This define is required to pull in the new Win8 interfaces from
-          # system headers like ShObjIdl.h.
-          'NTDDI_VERSION=0x06020000',
-        ],
-        'include_dirs': [
-          '<(DEPTH)/third_party/wtl/include',
-        ],
-        'conditions': [
-          ['win_z7!=0', {
-            'msvs_settings': {
-              # Generates debug info when win_z7=1
-              # even if fastbuild=1 (that makes GenerateDebugInformation false).
-              'VCLinkerTool': {
-                'GenerateDebugInformation': 'true',
-              },
-              'VCCLCompilerTool': {
-                'DebugInformationFormat': '1',
-              }
-            }
-          }],
-          ['"<(GENERATOR)"=="msvs"', {
-            'msvs_settings': {
-              'VCLinkerTool': {
-                # Make the pdb name sane. Otherwise foo.exe and foo.dll both
-                # have foo.pdb. The ninja generator already defaults to this and
-                # can't handle the $(TargetPath) macro.
-                'ProgramDatabaseFile': '$(TargetPath).pdb',
-              }
-            },
-          }],
-        ],  # win_z7!=0
-      }],  # OS==win
-      ['enable_task_manager==1', {
-        'defines': [
-          'ENABLE_TASK_MANAGER=1',
-        ],
-      }],
-      ['enable_web_intents==1', {
-        'defines': [
-          'ENABLE_WEB_INTENTS=1',
-        ],
-      }],
-      ['enable_extensions==1', {
-        'defines': [
-          'ENABLE_EXTENSIONS=1',
-        ],
-      }],
-      ['OS=="win" and branding=="Chrome"', {
-        'defines': ['ENABLE_SWIFTSHADER'],
-      }],
-      ['enable_dart==1', {
-        'defines': ['WEBKIT_USING_DART=1'],
-      }],
-      ['enable_plugin_installation==1', {
-        'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
-      }],
-      ['enable_plugins==1', {
-        'defines': ['ENABLE_PLUGINS=1'],
-      }],
-      ['enable_session_service==1', {
-        'defines': ['ENABLE_SESSION_SERVICE=1'],
-      }],
-      ['enable_themes==1', {
-        'defines': ['ENABLE_THEMES=1'],
-      }],
-      ['enable_background==1', {
-        'defines': ['ENABLE_BACKGROUND=1'],
-      }],
-      ['enable_automation==1', {
-        'defines': ['ENABLE_AUTOMATION=1'],
-      }],
-      ['enable_google_now==1', {
-        'defines': ['ENABLE_GOOGLE_NOW=1'],
-      }],
-      ['enable_language_detection==1', {
-        'defines': ['ENABLE_LANGUAGE_DETECTION=1'],
-      }],
-      ['enable_printing==1', {
-        'defines': ['ENABLE_PRINTING=1'],
-      }],
-      ['enable_captive_portal_detection==1', {
-        'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
-      }],
-      ['enable_app_list==1', {
-        'defines': ['ENABLE_APP_LIST=1'],
-      }],
-      ['enable_settings_app==1', {
-        'defines': ['ENABLE_SETTINGS_APP=1'],
-      }],
-      ['disable_ftp_support==1', {
-        'defines': ['DISABLE_FTP_SUPPORT=1'],
-      }],
     ],  # conditions for 'target_defaults'
     'target_conditions': [
       ['enable_wexit_time_destructors==1', {
@@ -1939,74 +421,7 @@
           }],
         ],
       }],
-      ['chromium_code==0', {
-        'conditions': [
-          [ 'os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell"', {
-            # We don't want to get warnings from third-party code,
-            # so remove any existing warning-enabling flags like -Wall.
-            'cflags!': [
-              '-Wall',
-              '-Wextra',
-            ],
-            'cflags_cc': [
-              # Don't warn about hash_map in third-party code.
-              '-Wno-deprecated',
-            ],
-            'cflags': [
-              # Don't warn about printf format problems.
-              # This is off by default in gcc but on in Ubuntu's gcc(!).
-              '-Wno-format',
-            ],
-            'cflags_cc!': [
-              # TODO(fischman): remove this.
-              # http://code.google.com/p/chromium/issues/detail?id=90453
-              '-Wsign-compare',
-            ]
-          }],
-          # TODO: Fix all warnings on chromeos too.
-          [ 'os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell" and (clang!=1 or chromeos==1)', {
-            'cflags!': [
-              '-Werror',
-            ],
-          }],
-          [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android" and OS!="lb_shell"', {
-            'cflags': [
-              # Don't warn about ignoring the return value from e.g. close().
-              # This is off by default in some gccs but on by default in others.
-              # BSD systems do not support this option, since they are usually
-              # using gcc 4.2.1, which does not have this flag yet.
-              '-Wno-unused-result',
-            ],
-          }],
-          # TODO(darin): Unfortunately, some third_party code depends on base.
-          [ 'target_os=="win" and component=="shared_library"', {
-            'msvs_disabled_warnings': [
-              4251,  # class 'std::xx' needs to have dll-interface.
-            ],
-          }],
-          [ 'OS=="mac" or OS=="ios"', {
-            'xcode_settings': {
-              'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
-            },
-            'conditions': [
-              ['buildtype=="Official"', {
-                'xcode_settings': {
-                  'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
-                },
-              }],
-            ],
-          }],
-          [ 'OS=="ios"', {
-            'xcode_settings': {
-              # TODO(ios): Fix remaining warnings in third-party code, then
-              # remove this; the Mac cleanup didn't get everything that's
-              # flagged in an iOS build.
-              'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
-              'RUN_CLANG_STATIC_ANALYZER': 'NO',
-            },
-          }],
-        ],
-      }, {
+      ['chromium_code!=0', {
         'includes': [
            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
           'filename_rules.gypi',
@@ -2142,15 +557,6 @@
           },
         },
         'conditions': [
-          ['OS=="linux" or OS=="android"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '<@(debug_extra_cflags)',
-                ],
-              }],
-            ],
-          }],
           # Disabled on iOS because it was causing a crash on startup.
           # TODO(michelea): investigate, create a reduced test and possibly
           # submit a radar.
@@ -2176,13 +582,8 @@
         'msvs_settings': {
           'VCCLCompilerTool': {
             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
+            'Optimization': '<(win_release_Optimization)',
             'conditions': [
-              # In official builds, each target will self-select
-              # an optimization level.
-              ['buildtype!="Official"', {
-                  'Optimization': '<(win_release_Optimization)',
-                },
-              ],
               # According to MSVS, InlineFunctionExpansion=0 means
               # "default inlining", not "/Ob0".
               # Thus, we have to handle InlineFunctionExpansion==0 separately.
@@ -2235,1570 +636,11 @@
               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
             ],
           }],
-          ['win_use_allocator_shim==0', {
-            'defines': ['NO_TCMALLOC'],
-          }],
-          ['os_posix==1 and chromium_code==1', {
-            # Non-chromium code is not guaranteed to compile cleanly
-            # with _FORTIFY_SOURCE. Also, fortified build may fail
-            # when optimizations are disabled, so only do that for Release
-            # build.
-            'defines': [
-              '_FORTIFY_SOURCE=2',
-            ],
-          }],
-          ['OS=="linux" or OS=="android"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '<@(release_extra_cflags)',
-                ],
-              }],
-            ],
-          }],
         ],
       },
-      'conditions': [
-        [ 'OS=="win"', {
-          # TODO(bradnelson): add a gyp mechanism to make this more graceful.
-          'Debug_x64': {
-            'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
-          },
-          'Release_x64': {
-            'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
-          },
-        }],
-      ],
     },
   },
   'conditions': [
-    ['os_posix==1 and OS!="lb_shell"', {
-      'target_defaults': {
-        'cflags': [
-          # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc
-          # supports it.
-          '-fstack-protector',
-          '--param=ssp-buffer-size=4',
-        ],
-        'ldflags': [
-          '-Wl,-z,now',
-          '-Wl,-z,relro',
-        ],
-      },
-    }],
-    ['os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell"', {
-      'target_defaults': {
-        # Enable -Werror by default, but put it in a variable so it can
-        # be disabled in ~/.gyp/include.gypi on the valgrind builders.
-        'variables': {
-          'werror%': '-Werror',
-          'libraries_for_target%': '',
-        },
-        'defines': [
-          '_FILE_OFFSET_BITS=64',
-        ],
-        'cflags': [
-          '<(werror)',  # See note above about the werror variable.
-          '-pthread',
-          '-fno-exceptions',
-          '-fno-strict-aliasing',  # See http://crbug.com/32204
-          '-Wall',
-          # TODO(evan): turn this back on once all the builds work.
-          # '-Wextra',
-          # Don't warn about unused function params.  We use those everywhere.
-          '-Wno-unused-parameter',
-          # Don't warn about the "struct foo f = {0};" initialization pattern.
-          '-Wno-missing-field-initializers',
-          # Don't export any symbols (for example, to plugins we dlopen()).
-          # Note: this is *required* to make some plugins work.
-          '-fvisibility=hidden',
-          '-pipe',
-        ],
-        'cflags_cc': [
-          '-fno-rtti',
-          '-fno-threadsafe-statics',
-          # Make inline functions have hidden visiblity by default.
-          # Surprisingly, not covered by -fvisibility=hidden.
-          '-fvisibility-inlines-hidden',
-          # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
-          # so we specify it explicitly.
-          # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it.
-          # http://code.google.com/p/chromium/issues/detail?id=90453
-          '-Wsign-compare',
-        ],
-        'ldflags': [
-          '-pthread', '-Wl,-z,noexecstack',
-        ],
-        'libraries' : [
-          '<(libraries_for_target)',
-        ],
-        'configurations': {
-          'Debug_Base': {
-            'variables': {
-              'debug_optimize%': '0',
-            },
-            'defines': [
-              '_DEBUG',
-            ],
-            'cflags': [
-              '-O>(debug_optimize)',
-              '-g',
-            ],
-            'conditions' : [
-              ['OS=="android" and android_full_debug==0', {
-                # Some configurations are copied from Release_Base to reduce
-                # the binary size.
-                'variables': {
-                  'debug_optimize%': 's',
-                },
-                'cflags': [
-                  '-fomit-frame-pointer',
-                  '-fdata-sections',
-                  '-ffunction-sections',
-                ],
-                'ldflags': [
-                  '-Wl,-O1',
-                  '-Wl,--as-needed',
-                  '-Wl,--gc-sections',
-                ],
-              }],
-            ],
-          },
-          'Release_Base': {
-            'variables': {
-              'release_optimize%': '2',
-              # Binaries become big and gold is unable to perform GC
-              # and remove unused sections for some of test targets
-              # on 32 bit platform.
-              # (This is currently observed only in chromeos valgrind bots)
-              # The following flag is to disable --gc-sections linker
-              # option for these bots.
-              'no_gc_sections%': 0,
-
-              # TODO(bradnelson): reexamine how this is done if we change the
-              # expansion of configurations
-              'release_valgrind_build%': 0,
-            },
-            'cflags': [
-              '-O<(release_optimize)',
-              # Don't emit the GCC version ident directives, they just end up
-              # in the .comment section taking up binary size.
-              '-fno-ident',
-              # Put data and code in their own sections, so that unused symbols
-              # can be removed at link time with --gc-sections.
-              '-fdata-sections',
-              '-ffunction-sections',
-            ],
-            'ldflags': [
-              # Specifically tell the linker to perform optimizations.
-              # See http://lwn.net/Articles/192624/ .
-              '-Wl,-O1',
-              '-Wl,--as-needed',
-            ],
-            'conditions' : [
-              ['no_gc_sections==0', {
-                'ldflags': [
-                  '-Wl,--gc-sections',
-                ],
-              }],
-              ['OS=="android"', {
-                'variables': {
-                  'release_optimize%': 's',
-                },
-                'cflags': [
-                  '-fomit-frame-pointer',
-                ],
-              }],
-              ['clang==1', {
-                'cflags!': [
-                  '-fno-ident',
-                ],
-              }],
-              ['profiling==1', {
-                'cflags': [
-                  '-fno-omit-frame-pointer',
-                  '-g',
-                ],
-              }],
-            ],
-          },
-        },
-        'variants': {
-          'coverage': {
-            'cflags': ['-fprofile-arcs', '-ftest-coverage'],
-            'ldflags': ['-fprofile-arcs'],
-          },
-          'profile': {
-            'cflags': ['-pg', '-g'],
-            'ldflags': ['-pg'],
-          },
-          'symbols': {
-            'cflags': ['-g'],
-          },
-        },
-        'conditions': [
-          ['target_arch=="ia32"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'asflags': [
-                  # Needed so that libs with .s files (e.g. libicudata.a)
-                  # are compatible with the general 32-bit-ness.
-                  '-32',
-                ],
-                # All floating-point computations on x87 happens in 80-bit
-                # precision.  Because the C and C++ language standards allow
-                # the compiler to keep the floating-point values in higher
-                # precision than what's specified in the source and doing so
-                # is more efficient than constantly rounding up to 64-bit or
-                # 32-bit precision as specified in the source, the compiler,
-                # especially in the optimized mode, tries very hard to keep
-                # values in x87 floating-point stack (in 80-bit precision)
-                # as long as possible. This has important side effects, that
-                # the real value used in computation may change depending on
-                # how the compiler did the optimization - that is, the value
-                # kept in 80-bit is different than the value rounded down to
-                # 64-bit or 32-bit. There are possible compiler options to
-                # make this behavior consistent (e.g. -ffloat-store would keep
-                # all floating-values in the memory, thus force them to be
-                # rounded to its original precision) but they have significant
-                # runtime performance penalty.
-                #
-                # -mfpmath=sse -msse2 makes the compiler use SSE instructions
-                # which keep floating-point values in SSE registers in its
-                # native precision (32-bit for single precision, and 64-bit
-                # for double precision values). This means the floating-point
-                # value used during computation does not change depending on
-                # how the compiler optimized the code, since the value is
-                # always kept in its specified precision.
-                'conditions': [
-                  ['branding=="Chromium" and disable_sse2==0', {
-                    'cflags': [
-                      '-march=pentium4',
-                      '-msse2',
-                      '-mfpmath=sse',
-                    ],
-                  }],
-                  # ChromeOS targets Pinetrail, which is sse3, but most of the
-                  # benefit comes from sse2 so this setting allows ChromeOS
-                  # to build on other CPUs.  In the future -march=atom would
-                  # help but requires a newer compiler.
-                  ['chromeos==1 and disable_sse2==0', {
-                    'cflags': [
-                      '-msse2',
-                    ],
-                  }],
-                  # Install packages have started cropping up with
-                  # different headers between the 32-bit and 64-bit
-                  # versions, so we have to shadow those differences off
-                  # and make sure a 32-bit-on-64-bit build picks up the
-                  # right files.
-                  # For android build, use NDK headers instead of host headers
-                  ['host_arch!="ia32" and OS!="android"', {
-                    'include_dirs+': [
-                      '/usr/include32',
-                    ],
-                  }],
-                ],
-                # -mmmx allows mmintrin.h to be used for mmx intrinsics.
-                # video playback is mmx and sse2 optimized.
-                'cflags': [
-                  '-m32',
-                  '-mmmx',
-                ],
-                'ldflags': [
-                  '-m32',
-                ],
-              }],
-            ],
-          }],
-          ['target_arch=="arm"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags_cc': [
-                  # The codesourcery arm-2009q3 toolchain warns at that the ABI
-                  # has changed whenever it encounters a varargs function. This
-                  # silences those warnings, as they are not helpful and
-                  # clutter legitimate warnings.
-                  '-Wno-abi',
-                ],
-                'conditions': [
-                  ['arm_thumb==1', {
-                    'cflags': [
-                    '-mthumb',
-                    ]
-                  }],
-                  ['armv7==1', {
-                    'cflags': [
-                      '-march=armv7-a',
-                      '-mtune=cortex-a8',
-                      '-mfloat-abi=<(arm_float_abi)',
-                    ],
-                    'conditions': [
-                      ['arm_neon==1', {
-                        'cflags': [ '-mfpu=neon', ],
-                      }, {
-                        'cflags': [ '-mfpu=<(arm_fpu)', ],
-                      }],
-                    ],
-                  }],
-                  ['OS=="android"', {
-                    # Most of the following flags are derived from what Android
-                    # uses by default when building for arm, reference for which
-                    # can be found in the following file in the Android NDK:
-                    # toolchains/arm-linux-androideabi-4.4.3/setup.mk
-                    'cflags': [
-                      # The tree-sra optimization (scalar replacement for
-                      # aggregates enabling subsequent optimizations) leads to
-                      # invalid code generation when using the Android NDK's
-                      # compiler (r5-r7). This can be verified using
-                      # TestWebKitAPI's WTF.Checked_int8_t test.
-                      '-fno-tree-sra',
-                      '-fuse-ld=gold',
-                      '-Wno-psabi',
-                    ],
-                    # Android now supports .relro sections properly.
-                    # NOTE: While these flags enable the generation of .relro
-                    # sections, the generated libraries can still be loaded on
-                    # older Android platform versions.
-                    'ldflags': [
-                        '-Wl,-z,relro',
-                        '-Wl,-z,now',
-                        '-fuse-ld=gold',
-                    ],
-                    'conditions': [
-                      ['arm_thumb==1', {
-                        # Android toolchain doesn't support -mimplicit-it=thumb
-                        'cflags!': [ '-Wa,-mimplicit-it=thumb' ],
-                        'cflags': [ '-mthumb-interwork' ],
-                      }],
-                      ['armv7==0', {
-                        # Flags suitable for Android emulator
-                        'cflags': [
-                          '-march=armv5te',
-                          '-mtune=xscale',
-                          '-msoft-float',
-                        ],
-                        'defines': [
-                          '__ARM_ARCH_5__',
-                          '__ARM_ARCH_5T__',
-                          '__ARM_ARCH_5E__',
-                          '__ARM_ARCH_5TE__',
-                        ],
-                      }],
-                      ['profiling==1', {
-                        'cflags': [
-                          '-marm', # Probably reduntant, but recommend by "perf" docs.
-                          '-mapcs-frame', # Seems required by -fno-omit-frame-pointer.
-                        ],
-                      }],
-                      ['clang==1', {
-                        'cflags!': [
-                          # Clang does not support the following options.
-                          '-mthumb-interwork',
-                          '-finline-limit=64',
-                          '-fno-tree-sra',
-                          '-fuse-ld=gold',
-                          '-Wno-psabi',
-                        ],
-                      }],
-                    ],
-                    'target_conditions': [
-                      # ndk-build copies .a's around the filesystem, breaking
-                      # relative paths in thin archives.  Disable using thin
-                      # archives to avoid problems until one of these is fixed:
-                      # http://code.google.com/p/android/issues/detail?id=40302
-                      # http://code.google.com/p/android/issues/detail?id=40303
-                      ['_type=="static_library"', {
-                        'standalone_static_library': 1,
-                      }],
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['linux_fpic==1', {
-            'cflags': [
-              '-fPIC',
-            ],
-            'ldflags': [
-              '-fPIC',
-            ],
-          }],
-          ['sysroot!=""', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '--sysroot=<(sysroot)',
-                ],
-                'ldflags': [
-                  '--sysroot=<(sysroot)',
-                ],
-              }]]
-          }],
-          ['clang==1', {
-            'cflags': [
-              '-Wheader-hygiene',
-              # Clang spots more unused functions.
-              '-Wno-unused-function',
-              # Don't die on dtoa code that uses a char as an array index.
-              '-Wno-char-subscripts',
-              # Especially needed for gtest macros using enum values from Mac
-              # system headers.
-              # TODO(pkasting): In C++11 this is legal, so this should be
-              # removed when we change to that.  (This is also why we don't
-              # bother fixing all these cases today.)
-              '-Wno-unnamed-type-template-args',
-              # This (rightfully) complains about 'override', which we use
-              # heavily.
-              '-Wno-c++11-extensions',
-
-              # Warns on switches on enums that cover all enum values but
-              # also contain a default: branch. Chrome is full of that.
-              '-Wno-covered-switch-default',
-            ],
-            'cflags!': [
-              # Clang doesn't seem to know know this flag.
-              '-mfpmath=sse',
-            ],
-          }],
-          ['clang==1 and clang_use_chrome_plugins==1', {
-            'cflags': [
-              '<@(clang_chrome_plugins_flags)',
-            ],
-          }],
-          ['clang==1 and clang_load!=""', {
-            'cflags': [
-              '-Xclang', '-load', '-Xclang', '<(clang_load)',
-            ],
-          }],
-          ['clang==1 and clang_add_plugin!=""', {
-            'cflags': [
-              '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
-            ],
-          }],
-          ['clang==1 and "<(GENERATOR)"=="ninja"', {
-            'cflags': [
-              # See http://crbug.com/110262
-              '-fcolor-diagnostics',
-            ],
-          }],
-          ['asan==1', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '-fsanitize=address',
-                  '-fno-omit-frame-pointer',
-                  '-w',  # http://crbug.com/162783
-                ],
-                'ldflags': [
-                  '-fsanitize=address',
-                ],
-                'defines': [
-                  'ADDRESS_SANITIZER',
-                ],
-              }],
-            ],
-          }],
-          ['tsan==1', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '-fsanitize=thread',
-                  '-fno-omit-frame-pointer',
-                  '-fPIE',
-                  '-mllvm', '-tsan-blacklist=<(tsan_blacklist)',
-                ],
-                'ldflags': [
-                  '-fsanitize=thread',
-                ],
-                'defines': [
-                  'THREAD_SANITIZER',
-                  'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
-                  'WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1',
-                ],
-                'target_conditions': [
-                  ['_type=="executable"', {
-                    'ldflags': [
-                      '-pie',
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', {
-            'target_conditions' : [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '-finstrument-functions',
-                  # Allow mmx intrinsics to inline, so that the
-                  # compiler can expand the intrinsics.
-                  '-finstrument-functions-exclude-file-list=mmintrin.h',
-                ],
-              }],
-            ],
-          }],
-          ['linux_breakpad==1', {
-            'cflags': [ '-g' ],
-            'defines': ['USE_LINUX_BREAKPAD'],
-            'conditions': [
-              ['target_arch=="ia32"', {
-                'target_conditions': [
-                  ['_toolset=="target"', {
-                    'ldflags': [
-                      # Workaround for linker OOM. http://crbug.com/160253.
-                      '-Wl,--no-keep-files-mapped',
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['linux_use_heapchecker==1', {
-            'variables': {'linux_use_tcmalloc%': 1},
-            'defines': ['USE_HEAPCHECKER'],
-          }],
-          ['linux_use_tcmalloc==0', {
-            'defines': ['NO_TCMALLOC'],
-          }],
-          ['linux_keep_shadow_stacks==1', {
-            'defines': ['KEEP_SHADOW_STACKS'],
-            'cflags': [
-              '-finstrument-functions',
-              # Allow mmx intrinsics to inline, so that the compiler can expand
-              # the intrinsics.
-              '-finstrument-functions-exclude-file-list=mmintrin.h',
-            ],
-          }],
-          ['linux_use_gold_flags==1', {
-            'ldflags': [
-              # Experimentation found that using four linking threads
-              # saved ~20% of link time.
-              # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
-              '-Wl,--threads',
-              '-Wl,--thread-count=4',
-            ],
-            'conditions': [
-              ['release_valgrind_build==0', {
-                'target_conditions': [
-                  ['_toolset=="target"', {
-                    'ldflags': [
-                      # There seems to be a conflict of --icf and -pie
-                      # in gold which can generate crashy binaries. As
-                      # a security measure, -pie takes precendence for
-                      # now.
-                      #'-Wl,--icf=safe',
-                      '-Wl,--icf=none',
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['linux_use_gold_binary==1', {
-            'variables': {
-              'conditions': [
-                ['inside_chromium_build==1', {
-                  # We pass the path to gold to the compiler.  gyp leaves
-                  # unspecified what the cwd is when running the compiler,
-                  # so the normal gyp path-munging fails us.  This hack
-                  # gets the right path.
-                  'gold_path': '<(PRODUCT_DIR)/../../third_party/gold',
-                }, {
-                  'gold_path': '<(PRODUCT_DIR)/../../Source/WebKit/chromium/third_party/gold',
-                }]
-              ]
-            },
-            'ldflags': [
-              # Put our gold binary in the search path for the linker.
-              '-B<(gold_path)',
-            ],
-          }],
-        ],
-      },
-    }],
-    # FreeBSD-specific options; note that most FreeBSD options are set above,
-    # with Linux.
-    ['OS=="freebsd"', {
-      'target_defaults': {
-        'ldflags': [
-          '-Wl,--no-keep-memory',
-        ],
-      },
-    }],
-    # Android-specific options; note that most are set above with Linux.
-    ['OS=="android"', {
-      'variables': {
-        # This is a unique identifier for a given build. It's used for
-        # identifying various build artifacts corresponding to a particular
-        # build of chrome (e.g. where to find archived symbols).
-        'chrome_build_id%': '',
-        'conditions': [
-          # Use shared stlport library when system one used.
-          # Figure this out early since it needs symbols from libgcc.a, so it
-          # has to be before that in the set of libraries.
-          ['use_system_stlport==1', {
-            'android_stlport_library': 'stlport',
-          }, {
-            'conditions': [
-              ['component=="shared_library"', {
-                  'android_stlport_library': 'stlport_shared',
-              }, {
-                  'android_stlport_library': 'stlport_static',
-              }],
-            ],
-          }],
-        ],
-
-        # Placing this variable here prevents from forking libvpx, used
-        # by remoting.  Remoting is off, so it needn't built,
-        # so forking it's deps seems like overkill.
-        # But this variable need defined to properly run gyp.
-        # A proper solution is to have an OS==android conditional
-        # in third_party/libvpx/libvpx.gyp to define it.
-        'libvpx_path': 'lib/linux/arm',
-      },
-      'target_defaults': {
-        'variables': {
-          'release_extra_cflags%': '',
-        },
-
-        'target_conditions': [
-          # Settings for building device targets using Android's toolchain.
-          # These are based on the setup.mk file from the Android NDK.
-          #
-          # The NDK Android executable link step looks as follows:
-          #  $LDFLAGS
-          #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
-          #  $(PRIVATE_OBJECTS)            <-- The .o that we built
-          #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
-          #  $(TARGET_LIBGCC)              <-- libgcc.a
-          #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
-          #  $(PRIVATE_LDLIBS)             <-- System .so
-          #  $(TARGET_CRTEND_O)            <-- crtend.o
-          #
-          # For now the above are approximated for executables by adding
-          # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
-          # of 'libraries'.
-          #
-          # The NDK Android shared library link step looks as follows:
-          #  $LDFLAGS
-          #  $(PRIVATE_OBJECTS)            <-- The .o that we built
-          #  -l,--whole-archive
-          #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
-          #  -l,--no-whole-archive
-          #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
-          #  $(TARGET_LIBGCC)              <-- libgcc.a
-          #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
-          #  $(PRIVATE_LDLIBS)             <-- System .so
-          #
-          # For now, assume that whole static libraries are not needed.
-          #
-          # For both executables and shared libraries, add the proper
-          # libgcc.a to the start of libraries which puts it in the
-          # proper spot after .o and .a files get linked in.
-          #
-          # TODO: The proper thing to do longer-tem would be proper gyp
-          # support for a custom link command line.
-          ['_toolset=="target"', {
-            'cflags!': [
-              '-pthread',  # Not supported by Android toolchain.
-            ],
-            'cflags': [
-              '-ffunction-sections',
-              '-funwind-tables',
-              '-g',
-              '-fstack-protector',
-              '-fno-short-enums',
-              '-finline-limit=64',
-              '-Wa,--noexecstack',
-              '<@(release_extra_cflags)',
-            ],
-            'defines': [
-              'ANDROID',
-              '__GNU_SOURCE=1',  # Necessary for clone()
-              'USE_STLPORT=1',
-              '_STLP_USE_PTR_SPECIALIZATIONS=1',
-              'CHROME_BUILD_ID="<(chrome_build_id)"',
-            ],
-            'ldflags!': [
-              '-pthread',  # Not supported by Android toolchain.
-            ],
-            'ldflags': [
-              '-nostdlib',
-              '-Wl,--no-undefined',
-              # Don't export symbols from statically linked libraries.
-              '-Wl,--exclude-libs=ALL',
-            ],
-            'libraries': [
-              '-l<(android_stlport_library)',
-              # Manually link the libgcc.a that the cross compiler uses.
-              '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
-              '-lc',
-              '-ldl',
-              '-lstdc++',
-              '-lm',
-            ],
-            'conditions': [
-              ['component=="shared_library"', {
-                'libraries': [
-                  '-lgnustl_shared',
-                ],
-                'ldflags!': [
-                  '-Wl,--exclude-libs=ALL',
-                ],
-              }],
-              ['clang==1', {
-                'cflags': [
-                  # Work around incompatibilities between bionic and clang
-                  # headers.
-                  '-D__compiler_offsetof=__builtin_offsetof',
-                  '-Dnan=__builtin_nan',
-                ],
-                'conditions': [
-                  ['target_arch=="arm"', {
-                    'cflags': [
-                      '-target arm-linux-androideabi',
-                      '-mllvm -arm-enable-ehabi',
-                    ],
-                    'ldflags': [
-                      '-target arm-linux-androideabi',
-                    ],
-                  }],
-                  ['target_arch=="ia32"', {
-                    'cflags': [
-                      '-target x86-linux-androideabi',
-                    ],
-                    'ldflags': [
-                      '-target x86-linux-androideabi',
-                    ],
-                  }],
-                ],
-              }],
-              ['asan==1', {
-                'cflags': [
-                  # Android build relies on -Wl,--gc-sections removing
-                  # unreachable code. ASan instrumentation for globals inhibits
-                  # this and results in a library with unresolvable relocations.
-                  # TODO(eugenis): find a way to reenable this.
-                  '-mllvm -asan-globals=0',
-                ],
-              }],
-              ['android_build_type==0', {
-                'defines': [
-                  # The NDK has these things, but doesn't define the constants
-                  # to say that it does. Define them here instead.
-                  'HAVE_SYS_UIO_H',
-                ],
-                'cflags': [
-                  '--sysroot=<(android_ndk_sysroot)',
-                ],
-                'ldflags': [
-                  '--sysroot=<(android_ndk_sysroot)',
-                ],
-              }],
-              ['android_build_type==1', {
-                'include_dirs': [
-                  # OpenAL headers from the Android tree.
-                  '<(android_src)/frameworks/wilhelm/include',
-                ],
-                'cflags': [
-                  # Android predefines this as 1; undefine it here so Chromium
-                  # can redefine it later to be 2 for chromium code and unset
-                  # for third party code. This works because cflags are added
-                  # before defines.
-                  '-U_FORTIFY_SOURCE',
-                  # Chromium builds its own (non-third-party) code with
-                  # -Werror to make all warnings into errors. However, Android
-                  # enables warnings that Chromium doesn't, so some of these
-                  # extra warnings trip and break things.
-                  # For now, we leave these warnings enabled but prevent them
-                  # from being treated as errors.
-                  #
-                  # Things that are part of -Wextra:
-                  '-Wno-error=extra', # Enabled by -Wextra, but no specific flag
-                  '-Wno-error=ignored-qualifiers',
-                  '-Wno-error=type-limits',
-                  # Other things unrelated to -Wextra:
-                  '-Wno-error=non-virtual-dtor',
-                  '-Wno-error=sign-promo',
-                ],
-                'cflags_cc': [
-                  # Disabling c++0x-compat should be handled in WebKit, but
-                  # this currently doesn't work because gcc_version is not set
-                  # correctly when building with the Android build system.
-                  # TODO(torne): Fix this in WebKit.
-                  '-Wno-error=c++0x-compat',
-                ],
-              }],
-              ['android_build_type==1 and chromium_code==0', {
-                'cflags': [
-                  # There is a class of warning which:
-                  #  1) Android always enables and also treats as errors
-                  #  2) Chromium ignores in third party code
-                  # For now, I am leaving these warnings enabled but preventing
-                  # them from being treated as errors here.
-                  '-Wno-error=address',
-                  '-Wno-error=format-security',
-                  '-Wno-error=non-virtual-dtor',
-                  '-Wno-error=return-type',
-                  '-Wno-error=sequence-point',
-                ],
-              }],
-              ['target_arch == "arm"', {
-                'ldflags': [
-                  # Enable identical code folding to reduce size.
-                  '-Wl,--icf=safe',
-                ],
-              }],
-              # NOTE: The stlport header include paths below are specified in
-              # cflags rather than include_dirs because they need to come
-              # after include_dirs. Think of them like system headers, but
-              # don't use '-isystem' because the arm-linux-androideabi-4.4.3
-              # toolchain (circa Gingerbread) will exhibit strange errors.
-              # The include ordering here is important; change with caution.
-              ['use_system_stlport==1', {
-                'cflags': [
-                  # For libstdc++/include, which is used by stlport.
-                  '-I<(android_src)/bionic',
-                  '-I<(android_src)/external/stlport/stlport',
-                ],
-              }, { # else: use_system_stlport!=1
-                'cflags': [
-                  '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport',
-                  '-I<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/include',
-                ],
-                'conditions': [
-                  ['target_arch=="arm" and armv7==1', {
-                    'ldflags': [
-                      '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7a',
-                      '-L<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a',
-                    ],
-                  }],
-                  ['target_arch=="arm" and armv7==0', {
-                    'ldflags': [
-                      '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi',
-                      '-L<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi',
-                    ],
-                  }],
-                  ['target_arch=="ia32"', {
-                    'ldflags': [
-                      '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86',
-                      '-L<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86',
-                    ],
-                  }],
-                ],
-              }],
-              ['target_arch=="ia32"', {
-                # The x86 toolchain currently has problems with stack-protector.
-                'cflags!': [
-                  '-fstack-protector',
-                ],
-                'cflags': [
-                  '-fno-stack-protector',
-                ],
-              }],
-            ],
-            'target_conditions': [
-              ['_type=="executable"', {
-                'ldflags': [
-                  '-Bdynamic',
-                  '-Wl,-dynamic-linker,/system/bin/linker',
-                  '-Wl,--gc-sections',
-                  '-Wl,-z,nocopyreloc',
-                  # crtbegin_dynamic.o should be the last item in ldflags.
-                  '<(android_ndk_lib)/crtbegin_dynamic.o',
-                ],
-                'libraries': [
-                  # crtend_android.o needs to be the last item in libraries.
-                  # Do not add any libraries after this!
-                  '<(android_ndk_lib)/crtend_android.o',
-                ],
-                'conditions': [
-                  ['asan==1', {
-                    'cflags': [
-                      '-fPIE',
-                    ],
-                    'ldflags': [
-                      '-pie',
-                    ],
-                  }],
-                ],
-              }],
-              ['_type=="shared_library" or _type=="loadable_module"', {
-                'ldflags': [
-                  '-Wl,-shared,-Bsymbolic',
-                  # crtbegin_so.o should be the last item in ldflags.
-                  '<(android_ndk_lib)/crtbegin_so.o',
-                ],
-                'libraries': [
-                  # crtend_so.o needs to be the last item in libraries.
-                  # Do not add any libraries after this!
-                  '<(android_ndk_lib)/crtend_so.o',
-                ],
-              }],
-            ],
-          }],
-          # Settings for building host targets using the system toolchain.
-          ['_toolset=="host"', {
-            'cflags!': [
-              # Due to issues in Clang build system, using ASan on 32-bit
-              # binaries on x86_64 host is problematic.
-              # TODO(eugenis): re-enable.
-              '-fsanitize=address',
-              '-w',  # http://crbug.com/162783
-            ],
-            'ldflags!': [
-              '-fsanitize=address',
-              '-Wl,-z,noexecstack',
-              '-Wl,--gc-sections',
-              '-Wl,-O1',
-              '-Wl,--as-needed',
-            ],
-            'sources/': [
-              ['exclude', '_android(_unittest)?\\.cc$'],
-              ['exclude', '(^|/)android/']
-            ],
-          }],
-        ],
-      },
-    }],
-    ['OS=="solaris"', {
-      'cflags!': ['-fvisibility=hidden'],
-      'cflags_cc!': ['-fvisibility-inlines-hidden'],
-    }],
-    ['OS=="mac" or OS=="ios"', {
-      'target_defaults': {
-        'mac_bundle': 0,
-        'xcode_settings': {
-          'ALWAYS_SEARCH_USER_PATHS': 'NO',
-          # Don't link in libarclite_macosx.a, see http://crbug.com/156530.
-          'CLANG_LINK_OBJC_RUNTIME': 'NO',          # -fno-objc-link-runtime
-          'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
-          'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
-          'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
-          'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
-          'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
-          # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
-          'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
-          'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
-          'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
-          'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
-          'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
-          'GCC_VERSION': '4.2',
-          'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
-          'USE_HEADERMAP': 'NO',
-          'WARNING_CFLAGS': [
-            '-Wall',
-            '-Wendif-labels',
-            '-Wextra',
-            # Don't warn about unused function parameters.
-            '-Wno-unused-parameter',
-            # Don't warn about the "struct foo f = {0};" initialization
-            # pattern.
-            '-Wno-missing-field-initializers',
-          ],
-          'conditions': [
-            ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
-                                 {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
-            ],
-            # Note that the prebuilt Clang binaries should not be used for iOS
-            # development except for ASan builds.
-            ['clang==1', {
-              'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
-              'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
-
-              # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
-              # when building with clang. This warning is triggered when the
-              # override keyword is used via the OVERRIDE macro from
-              # base/compiler_specific.h.
-              'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
-              # Warn if automatic synthesis is triggered with
-              # the -Wobjc-missing-property-synthesis flag.
-              'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
-              'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
-              'WARNING_CFLAGS': [
-                '-Wheader-hygiene',
-
-                # This warns on using ints as initializers for floats in
-                # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
-                # which happens in several places in chrome code. Not sure if
-                # this is worth fixing.
-                '-Wno-c++11-narrowing',
-
-                # This warns about code like |"0x%08"NACL_PRIxPTR| -- with C++11
-                # user-defined literals, this is now a string literal with a UD
-                # suffix. However, this is used heavily in NaCl code, so disable
-                # the warning for now.
-                '-Wno-reserved-user-defined-literal',
-
-                # Don't die on dtoa code that uses a char as an array index.
-                # This is required solely for base/third_party/dmg_fp/dtoa.cc.
-                '-Wno-char-subscripts',
-                # Clang spots more unused functions.
-                '-Wno-unused-function',
-
-                # Warns on switches on enums that cover all enum values but
-                # also contain a default: branch. Chrome is full of that.
-                '-Wno-covered-switch-default',
-              ],
-              'OTHER_CPLUSPLUSFLAGS': [
-                # gnu++11 instead of c++11 so that __ANSI_C__ doesn't get
-                # defined.  (Else e.g. finite() in base/float_util.h needs to
-                # be isfinite() which doesn't exist on the android bots.)
-                # typeof() is also disabled in c++11 (but we could use
-                # decltype() instead).
-                # TODO(thakis): Use CLANG_CXX_LANGUAGE_STANDARD instead once all
-                # bots use xcode 4 -- http://crbug.com/147515).
-                # TODO(thakis): Eventually switch this to c++11 instead of
-                # gnu++11 (once typeof can be removed, which is blocked on c++11
-                # being available everywhere).
-                '$(inherited)', '-std=gnu++11',
-              ],
-            }],
-            ['clang==1 and clang_use_chrome_plugins==1', {
-              'OTHER_CFLAGS': [
-                '<@(clang_chrome_plugins_flags)',
-              ],
-            }],
-            ['clang==1 and clang_load!=""', {
-              'OTHER_CFLAGS': [
-                '-Xclang', '-load', '-Xclang', '<(clang_load)',
-              ],
-            }],
-            ['clang==1 and clang_add_plugin!=""', {
-              'OTHER_CFLAGS': [
-                '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
-              ],
-            }],
-            ['clang==1 and "<(GENERATOR)"=="ninja"', {
-              'OTHER_CFLAGS': [
-                # See http://crbug.com/110262
-                '-fcolor-diagnostics',
-              ],
-            }],
-          ],
-        },
-        'conditions': [
-          ['clang==1', {
-            'variables': {
-              'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
-            },
-          }],
-          ['asan==1', {
-            'xcode_settings': {
-              'OTHER_CFLAGS': [
-                '-fsanitize=address',
-                '-w',  # http://crbug.com/162783
-              ],
-            },
-            'defines': [
-              'ADDRESS_SANITIZER',
-            ],
-          }],
-        ],
-        'target_conditions': [
-          ['_type!="static_library"', {
-            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
-            'conditions': [
-              ['asan==1', {
-                'xcode_settings': {
-                  'OTHER_LDFLAGS': [
-                    '-fsanitize=address',
-                  ],
-                },
-              }],
-            ],
-          }],
-          ['_mac_bundle', {
-            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
-          }],
-        ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="mac" or OS=="ios"
-    ['OS=="mac"', {
-      'target_defaults': {
-        'variables': {
-          # These should end with %, but there seems to be a bug with % in
-          # variables that are intended to be set to different values in
-          # different targets, like these.
-          'mac_pie': 1,        # Most executables can be position-independent.
-          'mac_real_dsym': 0,  # Fake .dSYMs are fine in most cases.
-          # Strip debugging symbols from the target.
-          'mac_strip': '<(mac_strip_release)',
-        },
-        'xcode_settings': {
-          'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
-                                                    # (Equivalent to -fPIC)
-          # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
-          'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
-          # Keep pch files below xcodebuild/.
-          'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
-          'OTHER_CFLAGS': [
-            '-fno-strict-aliasing',  # See http://crbug.com/32204
-          ],
-        },
-        'target_conditions': [
-          ['_type=="executable"', {
-            'postbuilds': [
-              {
-                # Arranges for data (heap) pages to be protected against
-                # code execution when running on Mac OS X 10.7 ("Lion"), and
-                # ensures that the position-independent executable (PIE) bit
-                # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
-                'variables': {
-                  # Define change_mach_o_flags in a variable ending in _path
-                  # so that GYP understands it's a path and performs proper
-                  # relativization during dict merging.
-                  'change_mach_o_flags_path':
-                      'mac/change_mach_o_flags_from_xcode.sh',
-                  'change_mach_o_flags_options%': [
-                  ],
-                  'target_conditions': [
-                    ['mac_pie==0 or release_valgrind_build==1', {
-                      # Don't enable PIE if it's unwanted. It's unwanted if
-                      # the target specifies mac_pie=0 or if building for
-                      # Valgrind, because Valgrind doesn't understand slide.
-                      # See the similar mac_pie/release_valgrind_build check
-                      # below.
-                      'change_mach_o_flags_options': [
-                        '--no-pie',
-                      ],
-                    }],
-                  ],
-                },
-                'postbuild_name': 'Change Mach-O Flags',
-                'action': [
-                  '<(change_mach_o_flags_path)',
-                  '>@(change_mach_o_flags_options)',
-                ],
-              },
-            ],
-            'conditions': [
-              ['asan==1', {
-                'variables': {
-                 'asan_saves_file': 'asan.saves',
-                },
-                'xcode_settings': {
-                  'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
-                },
-              }],
-            ],
-            'target_conditions': [
-              ['mac_pie==1 and release_valgrind_build==0', {
-                # Turn on position-independence (ASLR) for executables. When
-                # PIE is on for the Chrome executables, the framework will
-                # also be subject to ASLR.
-                # Don't do this when building for Valgrind, because Valgrind
-                # doesn't understand slide. TODO: Make Valgrind on Mac OS X
-                # understand slide, and get rid of the Valgrind check.
-                'xcode_settings': {
-                  'OTHER_LDFLAGS': [
-                    '-Wl,-pie',  # Position-independent executable (MH_PIE)
-                  ],
-                },
-              }],
-            ],
-          }],
-          ['(_type=="executable" or _type=="shared_library" or \
-             _type=="loadable_module") and mac_strip!=0', {
-            'target_conditions': [
-              ['mac_real_dsym == 1', {
-                # To get a real .dSYM bundle produced by dsymutil, set the
-                # debug information format to dwarf-with-dsym.  Since
-                # strip_from_xcode will not be used, set Xcode to do the
-                # stripping as well.
-                'configurations': {
-                  'Release_Base': {
-                    'xcode_settings': {
-                      'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
-                      'DEPLOYMENT_POSTPROCESSING': 'YES',
-                      'STRIP_INSTALLED_PRODUCT': 'YES',
-                      'target_conditions': [
-                        ['_type=="shared_library" or _type=="loadable_module"', {
-                          # The Xcode default is to strip debugging symbols
-                          # only (-S).  Local symbols should be stripped as
-                          # well, which will be handled by -x.  Xcode will
-                          # continue to insert -S when stripping even when
-                          # additional flags are added with STRIPFLAGS.
-                          'STRIPFLAGS': '-x',
-                        }],  # _type=="shared_library" or _type=="loadable_module"'
-                      ],  # target_conditions
-                    },  # xcode_settings
-                  },  # configuration "Release"
-                },  # configurations
-              }, {  # mac_real_dsym != 1
-                # To get a fast fake .dSYM bundle, use a post-build step to
-                # produce the .dSYM and strip the executable.  strip_from_xcode
-                # only operates in the Release configuration.
-                'postbuilds': [
-                  {
-                    'variables': {
-                      # Define strip_from_xcode in a variable ending in _path
-                      # so that gyp understands it's a path and performs proper
-                      # relativization during dict merging.
-                      'strip_from_xcode_path': 'mac/strip_from_xcode',
-                    },
-                    'postbuild_name': 'Strip If Needed',
-                    'action': ['<(strip_from_xcode_path)'],
-                  },
-                ],  # postbuilds
-              }],  # mac_real_dsym
-            ],  # target_conditions
-          }],  # (_type=="executable" or _type=="shared_library" or
-               #  _type=="loadable_module") and mac_strip!=0
-        ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="mac"
-    ['OS=="ios"', {
-      'target_defaults': {
-        'xcode_settings' : {
-          'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
-
-          # This next block is mostly common with the 'mac' section above,
-          # but keying off (or setting) 'clang' isn't valid for iOS as it
-          # also seems to mean using the custom build of clang.
-
-          # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
-          # when building with clang. This warning is triggered when the
-          # override keyword is used via the OVERRIDE macro from
-          # base/compiler_specific.h.
-          'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
-          # Warn if automatic synthesis is triggered with
-          # the -Wobjc-missing-property-synthesis flag.
-          'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
-          'WARNING_CFLAGS': [
-            '-Wheader-hygiene',
-            # Don't die on dtoa code that uses a char as an array index.
-            # This is required solely for base/third_party/dmg_fp/dtoa.cc.
-            '-Wno-char-subscripts',
-            # Clang spots more unused functions.
-            '-Wno-unused-function',
-            # See comments on this flag higher up in this file.
-            '-Wno-unnamed-type-template-args',
-            # This (rightfully) complains about 'override', which we use
-            # heavily.
-            '-Wno-c++11-extensions',
-          ],
-        },
-        'target_conditions': [
-          ['_type=="executable"', {
-            'configurations': {
-              'Release_Base': {
-                'xcode_settings': {
-                  'DEPLOYMENT_POSTPROCESSING': 'YES',
-                  'STRIP_INSTALLED_PRODUCT': 'YES',
-                },
-              },
-              'Debug_Base': {
-                'xcode_settings': {
-                  # Remove dSYM to reduce build time.
-                  'DEBUG_INFORMATION_FORMAT': 'dwarf',
-                },
-              },
-            },
-            'xcode_settings': {
-              'conditions': [
-                ['chromium_ios_signing', {
-                  # iOS SDK wants everything for device signed.
-                  'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
-                }, {
-                  'CODE_SIGNING_REQUIRED': 'NO',
-                  'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
-                }],
-              ],
-            },
-          }],
-        ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="ios"
-    ['OS=="win"', {
-      'target_defaults': {
-        'defines': [
-          '_WIN32_WINNT=0x0602',
-          'WINVER=0x0602',
-          'WIN32',
-          '_WINDOWS',
-          'NOMINMAX',
-          'PSAPI_VERSION=1',
-          '_CRT_RAND_S',
-          'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
-          'WIN32_LEAN_AND_MEAN',
-          '_ATL_NO_OPENGL',
-        ],
-        'conditions': [
-          ['buildtype=="Official"', {
-              # In official builds, targets can self-select an optimization
-              # level by defining a variable named 'optimize', and setting it
-              # to one of
-              # - "size", optimizes for minimal code size - the default.
-              # - "speed", optimizes for speed over code size.
-              # - "max", whole program optimization and link-time code
-              #   generation. This is very expensive and should be used
-              #   sparingly.
-              'variables': {
-                'optimize%': 'size',
-              },
-              'target_conditions': [
-                ['optimize=="size"', {
-                    'msvs_settings': {
-                      'VCCLCompilerTool': {
-                        # 1, optimizeMinSpace, Minimize Size (/O1)
-                        'Optimization': '1',
-                        # 2, favorSize - Favor small code (/Os)
-                        'FavorSizeOrSpeed': '2',
-                      },
-                    },
-                  },
-                ],
-                ['optimize=="speed"', {
-                    'msvs_settings': {
-                      'VCCLCompilerTool': {
-                        # 2, optimizeMaxSpeed, Maximize Speed (/O2)
-                        'Optimization': '2',
-                        # 1, favorSpeed - Favor fast code (/Ot)
-                        'FavorSizeOrSpeed': '1',
-                      },
-                    },
-                  },
-                ],
-                ['optimize=="max"', {
-                    'msvs_settings': {
-                      'VCCLCompilerTool': {
-                        # 2, optimizeMaxSpeed, Maximize Speed (/O2)
-                        'Optimization': '2',
-                        # 1, favorSpeed - Favor fast code (/Ot)
-                        'FavorSizeOrSpeed': '1',
-                        # This implies link time code generation.
-                        'WholeProgramOptimization': 'true',
-                      },
-                    },
-                  },
-                ],
-              ],
-            },
-          ],
-          ['component=="static_library"', {
-            'defines': [
-              '_HAS_EXCEPTIONS=0',
-            ],
-          }],
-          ['MSVS_VERSION=="2008"', {
-            'defines': [
-              '_HAS_TR1=0',
-            ],
-          }],
-          ['secure_atl', {
-            'defines': [
-              '_SECURE_ATL',
-            ],
-          }],
-          ['msvs_express', {
-            'configurations': {
-              'x86_Base': {
-                'msvs_settings': {
-                  'VCLinkerTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/i386'],
-                  },
-                  'VCLibrarianTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/i386'],
-                  },
-                },
-              },
-              'x64_Base': {
-                'msvs_settings': {
-                  'VCLibrarianTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/amd64'],
-                  },
-                  'VCLinkerTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/amd64'],
-                  },
-                },
-              },
-            },
-            'msvs_settings': {
-              'VCLinkerTool': {
-                # Explicitly required when using the ATL with express
-                'AdditionalDependencies': ['atlthunk.lib'],
-
-                # ATL 8.0 included in WDK 7.1 makes the linker to generate
-                # almost eight hundred LNK4254 and LNK4078 warnings:
-                #   - warning LNK4254: section 'ATL' (50000040) merged into
-                #     '.rdata' (40000040) with different attributes
-                #   - warning LNK4078: multiple 'ATL' sections found with
-                #     different attributes
-                'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
-              },
-            },
-            'msvs_system_include_dirs': [
-              '<(windows_driver_kit_path)/inc/atl71',
-              '<(windows_driver_kit_path)/inc/mfc42',
-            ],
-          }],
-        ],
-        'msvs_system_include_dirs': [
-          '<(windows_sdk_path)/Include/shared',
-          '<(windows_sdk_path)/Include/um',
-          '<(windows_sdk_path)/Include/winrt',
-          '<(directx_sdk_path)/Include',
-          '$(VSInstallDir)/VC/atlmfc/include',
-        ],
-        'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
-        'msvs_disabled_warnings': [4351, 4396, 4503, 4819,
-          # TODO(maruel): These warnings are level 4. They will be slowly
-          # removed as code is fixed.
-          4100, 4121, 4125, 4127, 4130, 4131, 4189, 4201, 4238, 4244, 4245,
-          4310, 4355, 4428, 4481, 4505, 4510, 4512, 4530, 4610, 4611, 4701,
-          4702, 4706,
-        ],
-        'msvs_settings': {
-          'VCCLCompilerTool': {
-            'AdditionalOptions': ['/MP'],
-            'MinimalRebuild': 'false',
-            'BufferSecurityCheck': 'true',
-            'EnableFunctionLevelLinking': 'true',
-            'RuntimeTypeInfo': 'false',
-            'WarningLevel': '4',
-            'WarnAsError': 'true',
-            'DebugInformationFormat': '3',
-            'conditions': [
-              ['component=="shared_library"', {
-                'ExceptionHandling': '1',  # /EHsc
-              }, {
-                'ExceptionHandling': '0',
-              }],
-            ],
-          },
-          'VCLibrarianTool': {
-            'AdditionalOptions': ['/ignore:4221'],
-            'AdditionalLibraryDirectories': [
-              '<(directx_sdk_path)/Lib/x86',
-              '<(windows_sdk_path)/Lib/win8/um/x86',
-            ],
-          },
-          'VCLinkerTool': {
-            'AdditionalDependencies': [
-              'wininet.lib',
-              'dnsapi.lib',
-              'version.lib',
-              'msimg32.lib',
-              'ws2_32.lib',
-              'usp10.lib',
-              'psapi.lib',
-              'dbghelp.lib',
-              'winmm.lib',
-              'shlwapi.lib',
-            ],
-
-            'conditions': [
-              ['MSVS_VERSION=="2005e"', {
-                # Non-express versions link automatically to these
-                'AdditionalDependencies': [
-                  'advapi32.lib',
-                  'comdlg32.lib',
-                  'ole32.lib',
-                  'shell32.lib',
-                  'user32.lib',
-                  'winspool.lib',
-                ],
-              }],
-            ],
-            'AdditionalLibraryDirectories': [
-              '<(directx_sdk_path)/Lib/x86',
-              '<(windows_sdk_path)/Lib/win8/um/x86',
-            ],
-            'GenerateDebugInformation': 'true',
-            'MapFileName': '$(OutDir)\\$(TargetName).map',
-            'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
-            'FixedBaseAddress': '1',
-            # SubSystem values:
-            #   0 == not set
-            #   1 == /SUBSYSTEM:CONSOLE
-            #   2 == /SUBSYSTEM:WINDOWS
-            # Most of the executables we'll ever create are tests
-            # and utilities with console output.
-            'SubSystem': '1',
-          },
-          'VCMIDLTool': {
-            'GenerateStublessProxies': 'true',
-            'TypeLibraryName': '$(InputName).tlb',
-            'OutputDirectory': '$(IntDir)',
-            'HeaderFileName': '$(InputName).h',
-            'DLLDataFileName': '$(InputName).dlldata.c',
-            'InterfaceIdentifierFileName': '$(InputName)_i.c',
-            'ProxyFileName': '$(InputName)_p.c',
-          },
-          'VCResourceCompilerTool': {
-            'Culture' : '1033',
-            'AdditionalIncludeDirectories': [
-              '<(DEPTH)',
-              '<(SHARED_INTERMEDIATE_DIR)',
-            ],
-          },
-        },
-      },
-    }],
-    ['disable_nacl==1', {
-      'target_defaults': {
-        'defines': [
-          'DISABLE_NACL',
-        ],
-      },
-    }],
-    ['OS=="win" and msvs_use_common_linker_extras', {
-      'target_defaults': {
-        'msvs_settings': {
-          'VCLinkerTool': {
-            'DelayLoadDLLs': [
-              'dbghelp.dll',
-              'dwmapi.dll',
-              'shell32.dll',
-              'uxtheme.dll',
-            ],
-          },
-        },
-        'configurations': {
-          'x86_Base': {
-            'msvs_settings': {
-              'VCLinkerTool': {
-                'AdditionalOptions': [
-                  '/safeseh',
-                  '/dynamicbase',
-                  '/ignore:4199',
-                  '/ignore:4221',
-                  '/nxcompat',
-                ],
-              },
-            },
-          },
-          'x64_Base': {
-            'msvs_settings': {
-              'VCLinkerTool': {
-                'AdditionalOptions': [
-                  # safeseh is not compatible with x64
-                  '/dynamicbase',
-                  '/ignore:4199',
-                  '/ignore:4221',
-                  '/nxcompat',
-                ],
-              },
-            },
-          },
-        },
-      },
-    }],
-    ['enable_new_npdevice_api==1', {
-      'target_defaults': {
-        'defines': [
-          'ENABLE_NEW_NPDEVICE_API',
-        ],
-      },
-    }],
     ['clang==1', {
       'conditions': [
         ['OS=="android"', {
@@ -3823,18 +665,6 @@
         }],
       ],
     }],
-    ['OS=="android" and clang==0', {
-      # Hardcode the compiler names in the Makefile so that
-      # it won't depend on the environment at make time.
-      'make_global_settings': [
-        ['CC', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)'],
-        ['CXX', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-g++)'],
-        ['LINK', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)'],
-        ['CC.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which gcc))'],
-        ['CXX.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which g++))'],
-        ['LINK.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which g++))'],
-      ],
-    }],
   ],
   'xcode_settings': {
     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
@@ -3842,39 +672,6 @@
     # file.  It's almost always wrong to put things here.  Specify your
     # custom xcode_settings in target_defaults to add them to targets instead.
 
-    'conditions': [
-      # In an Xcode Project Info window, the "Base SDK for All Configurations"
-      # setting sets the SDK on a project-wide basis. In order to get the
-      # configured SDK to show properly in the Xcode UI, SDKROOT must be set
-      # here at the project level.
-      ['OS=="mac"', {
-        'conditions': [
-          ['mac_sdk_path==""', {
-            'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
-          }, {
-            'SDKROOT': '<(mac_sdk_path)',  # -isysroot
-          }],
-        ],
-      }],
-      ['OS=="ios"', {
-        'conditions': [
-          ['ios_sdk_path==""', {
-            'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
-          }, {
-            'SDKROOT': '<(ios_sdk_path)',  # -isysroot
-          }],
-        ],
-      }],
-      ['OS=="ios"', {
-        'ARCHS': '$(ARCHS_UNIVERSAL_IPHONE_OS)',
-        # Just build armv7, until armv7s is correctly tested.
-        'VALID_ARCHS': 'armv7 i386',
-        'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
-        # Target both iPhone and iPad.
-        'TARGETED_DEVICE_FAMILY': '1,2',
-      }],
-    ],
-
     # The Xcode generator will look for an xcode_settings section at the root
     # of each dict and use it to apply settings on a file-wide basis.  Most
     # settings should not be here, they should be in target-specific
diff --git a/src/build/filename_rules.gypi b/src/build/filename_rules.gypi
index 9fd40db..6ae44dc 100644
--- a/src/build/filename_rules.gypi
+++ b/src/build/filename_rules.gypi
@@ -57,7 +57,7 @@
         ['exclude', '(^|/)posix/'],
       ],
     }],
-    ['<(chromeos)!=1 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_chromeos(_unittest)?\\.(h|cc)$'] ]
     }],
     ['>(nacl_untrusted_build)==0', {
@@ -70,35 +70,35 @@
         ['exclude', '_xdg(_unittest)?\\.(h|cc)$'],
       ],
     }],
-    ['<(use_x11)!=1 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [
         ['exclude', '_(x|x11)(_unittest)?\\.(h|cc)$'],
         ['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],
       ],
     }],
-    ['<(toolkit_uses_gtk)!=1 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [
         ['exclude', '_gtk(_browsertest|_unittest)?\\.(h|cc)$'],
         ['exclude', '(^|/)gtk/'],
         ['exclude', '(^|/)gtk_[^/]*\\.(h|cc)$'],
       ],
     }],
-    ['<(toolkit_views)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
     }],
-    ['<(use_aura)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_aura(_unittest)?\\.(h|cc)$'],
                     ['exclude', '_aura(_browsertest)?\\.(h|cc)$'],
                     ['exclude', '(^|/)aura/'],
       ]
     }],
-    ['<(use_aura)==0 or <(use_x11)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_aurax11\\.(h|cc)$'] ]
     }],
-    ['<(use_aura)==0 or OS!="win" or >(nacl_untrusted_build)==1', {
+    ['OS!="win" or >(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_aurawin\\.(h|cc)$'] ]
     }],
-    ['<(use_ash)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_ash(_browsertest|_unittest)?\\.(h|cc)$'],
                     ['exclude', '(^|/)ash/'],
       ]
diff --git a/src/cobalt/CHANGELOG.md b/src/cobalt/CHANGELOG.md
index 3deb938..57b1de8 100644
--- a/src/cobalt/CHANGELOG.md
+++ b/src/cobalt/CHANGELOG.md
@@ -76,3 +76,9 @@
    command line option "--fps_stdout".  The frame rate statistics will be
    updated each time an animation ends, or after 60 frames have been processed.
    Both command line flags are available in Gold builds.
+
+ - **Add support for rendering `kSbDecodeTargetFormat1PlaneUYVY` (YUV 422)**
+
+   Decode targets with the format `kSbDecodeTargetFormat1PlaneUYVY` will now
+   be rendered by Cobalt.  This will allow decoders that produce YUV 422 UYVY
+   video frames to now efficiently support 360 video.
\ No newline at end of file
diff --git a/src/cobalt/accessibility/screen_reader_tests.cc b/src/cobalt/accessibility/screen_reader_tests.cc
index 1319c0d..2814b21 100644
--- a/src/cobalt/accessibility/screen_reader_tests.cc
+++ b/src/cobalt/accessibility/screen_reader_tests.cc
@@ -139,6 +139,7 @@
   GURL url(std::string("file:///cobalt/accessibility/testdata/live_region/" +
                        GetParam().html_file_name));
   const math::Size kDefaultViewportSize(1280, 720);
+  const float kDefaultVideoPixelRatio = 1.0f;
   const float kRefreshRate = 60.0f;
 
   network::NetworkModule network_module((network::NetworkModule::Options()));
@@ -167,7 +168,7 @@
       base::Bind(&LiveRegionMutationTest::Quit, base::Unretained(this)),
       base::Closure(), /* window_minimize_callback */
       NULL /* media_module */, &network_module, kDefaultViewportSize,
-      &resource_provider, NULL /* system_window */, kRefreshRate,
+      kDefaultVideoPixelRatio, &resource_provider, kRefreshRate,
       web_module_options);
 
   // Wait for the test to quit.
diff --git a/src/cobalt/system_window/application_event.h b/src/cobalt/base/application_event.h
similarity index 61%
rename from src/cobalt/system_window/application_event.h
rename to src/cobalt/base/application_event.h
index eb0f1dd..a36210c 100644
--- a/src/cobalt/system_window/application_event.h
+++ b/src/cobalt/base/application_event.h
@@ -12,36 +12,25 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef COBALT_SYSTEM_WINDOW_APPLICATION_EVENT_H_
-#define COBALT_SYSTEM_WINDOW_APPLICATION_EVENT_H_
+#ifndef COBALT_BASE_APPLICATION_EVENT_H_
+#define COBALT_BASE_APPLICATION_EVENT_H_
 
 #include "cobalt/base/event.h"
+#include "starboard/event.h"
 
-namespace cobalt {
-namespace system_window {
+namespace base {
 
 class ApplicationEvent : public base::Event {
  public:
-  enum Type {
-    kPause,
-    kPreload,
-    kQuit,
-    kResume,
-    kStart,
-    kSuspend,
-    kUnpause,
-  };
-
-  explicit ApplicationEvent(Type type) : type_(type) {}
-  Type type() const { return type_; }
+  explicit ApplicationEvent(SbEventType type) : type_(type) {}
+  SbEventType type() const { return type_; }
 
   BASE_EVENT_SUBCLASS(ApplicationEvent);
 
  private:
-  Type type_;
+  SbEventType type_;
 };
 
-}  // namespace system_window
-}  // namespace cobalt
+}  // namespace base
 
-#endif  // COBALT_SYSTEM_WINDOW_APPLICATION_EVENT_H_
+#endif  // COBALT_BASE_APPLICATION_EVENT_H_
diff --git a/src/cobalt/base/c_val_collection_entry_stats.h b/src/cobalt/base/c_val_collection_entry_stats.h
index faf7ad1..6f353de 100644
--- a/src/cobalt/base/c_val_collection_entry_stats.h
+++ b/src/cobalt/base/c_val_collection_entry_stats.h
@@ -30,6 +30,41 @@
 namespace base {
 namespace CValDetail {
 
+// This struct contains the data generated by flushes of
+// CValCollectionEntryStats for use with callbacks.
+template <typename EntryType>
+struct CValCollectionEntryStatsFlushResults {
+  typedef base::Callback<void(const CValCollectionEntryStatsFlushResults&)>
+      OnFlushCallback;
+
+  CValCollectionEntryStatsFlushResults(size_t sample_count, EntryType average,
+                                       EntryType minimum, EntryType maximum,
+                                       EntryType standard_deviation,
+                                       EntryType percentile_25th,
+                                       EntryType percentile_50th,
+                                       EntryType percentile_75th,
+                                       EntryType percentile_95th)
+      : sample_count(sample_count),
+        average(average),
+        minimum(minimum),
+        maximum(maximum),
+        standard_deviation(standard_deviation),
+        percentile_25th(percentile_25th),
+        percentile_50th(percentile_50th),
+        percentile_75th(percentile_75th),
+        percentile_95th(percentile_95th) {}
+
+  size_t sample_count;
+  EntryType average;
+  EntryType minimum;
+  EntryType maximum;
+  EntryType standard_deviation;
+  EntryType percentile_25th;
+  EntryType percentile_50th;
+  EntryType percentile_75th;
+  EntryType percentile_95th;
+};
+
 // This class tracks a collection of entries, which it retains in memory. When
 // either the max size of the collection is reached or Flush() is manually
 // called, the count, average, minimum, maximum, 25th, 50th, 75th and 95th
@@ -51,33 +86,8 @@
  public:
   static const size_t kNoMaxSize = 0;
 
-  struct FlushResults {
-    FlushResults(size_t sample_count, EntryType average, EntryType minimum,
-                 EntryType maximum, EntryType standard_deviation,
-                 EntryType percentile_25th, EntryType percentile_50th,
-                 EntryType percentile_75th, EntryType percentile_95th)
-        : sample_count(sample_count),
-          average(average),
-          minimum(minimum),
-          maximum(maximum),
-          standard_deviation(standard_deviation),
-          percentile_25th(percentile_25th),
-          percentile_50th(percentile_50th),
-          percentile_75th(percentile_75th),
-          percentile_95th(percentile_95th) {}
-
-    size_t sample_count;
-    EntryType average;
-    EntryType minimum;
-    EntryType maximum;
-    EntryType standard_deviation;
-    EntryType percentile_25th;
-    EntryType percentile_50th;
-    EntryType percentile_75th;
-    EntryType percentile_95th;
-  };
-
-  typedef base::Callback<void(const FlushResults&)> OnFlushCallback;
+  typedef CValCollectionEntryStatsFlushResults<EntryType> FlushResults;
+  typedef typename FlushResults::OnFlushCallback OnFlushCallback;
 
   CValCollectionEntryStatsImpl(
       const std::string& name, size_t max_size = kNoMaxSize,
@@ -305,14 +315,19 @@
 template <typename EntryType>
 class CValCollectionEntryStatsStub {
  public:
+  typedef CValCollectionEntryStatsFlushResults<EntryType> FlushResults;
+  typedef typename FlushResults::OnFlushCallback OnFlushCallback;
+
   explicit CValCollectionEntryStatsStub(const std::string& name) {
     UNREFERENCED_PARAMETER(name);
   }
-  CValCollectionEntryStatsStub(const std::string& name, size_t max_size,
-                               bool enable_entry_list_c_val) {
+  CValCollectionEntryStatsStub(
+      const std::string& name, size_t max_size, bool enable_entry_list_c_val,
+      const OnFlushCallback& on_flush = OnFlushCallback()) {
     UNREFERENCED_PARAMETER(name);
     UNREFERENCED_PARAMETER(max_size);
     UNREFERENCED_PARAMETER(enable_entry_list_c_val);
+    UNREFERENCED_PARAMETER(on_flush);
   }
 
   void AddEntry(const EntryType& value) { UNREFERENCED_PARAMETER(value); }
diff --git a/src/cobalt/base/c_val_collection_timer_stats.h b/src/cobalt/base/c_val_collection_timer_stats.h
index a40fb20..bee81ee 100644
--- a/src/cobalt/base/c_val_collection_timer_stats.h
+++ b/src/cobalt/base/c_val_collection_timer_stats.h
@@ -21,6 +21,11 @@
 
 namespace base {
 
+typedef CValDetail::CValCollectionEntryStatsFlushResults<TimeDelta>
+    CValCollectionTimerStatsFlushResults;
+typedef typename CValCollectionTimerStatsFlushResults::OnFlushCallback
+    CValCollectionTimerStatsOnFlushCallback;
+
 // This class is a wrapper around |CValCollectionEntryStats|.
 // |CValCollectionTimerStats| calculates the time elapsed between calls to
 // Start() and Stop() and adds it as an entry to |CValCollectionEntryStats|. It
@@ -31,10 +36,7 @@
 template <typename Visibility = CValDebug>
 class CValCollectionTimerStats {
  public:
-  typedef typename base::CValCollectionEntryStats<
-      base::TimeDelta, Visibility>::OnFlushCallback OnFlushCallback;
-  typedef typename base::CValCollectionEntryStats<
-      base::TimeDelta, Visibility>::FlushResults FlushResults;
+  typedef CValCollectionTimerStatsOnFlushCallback OnFlushCallback;
 
   explicit CValCollectionTimerStats(const std::string& name)
       : entry_stats_(name) {}
diff --git a/src/cobalt/base/clock.h b/src/cobalt/base/clock.h
index 01d5442..b3d418b 100644
--- a/src/cobalt/base/clock.h
+++ b/src/cobalt/base/clock.h
@@ -70,6 +70,22 @@
   const base::TimeDelta origin_;
 };
 
+// Simple clock that needs to be manually advanced.
+class ManualAdvanceClock : public base::Clock {
+ public:
+  base::TimeDelta Now() OVERRIDE { return value_; }
+
+  void Advance(const base::TimeDelta& advance_amount) {
+    DCHECK_GE(advance_amount, base::TimeDelta());
+    value_ += advance_amount;
+  }
+
+ private:
+  ~ManualAdvanceClock() OVERRIDE {}
+
+  base::TimeDelta value_;
+};
+
 }  // namespace base
 
 #endif  // COBALT_BASE_CLOCK_H_
diff --git a/src/cobalt/base/wrap_main.h b/src/cobalt/base/wrap_main.h
index 86114e8..35daf04 100644
--- a/src/cobalt/base/wrap_main.h
+++ b/src/cobalt/base/wrap_main.h
@@ -119,6 +119,13 @@
 #define COBALT_WRAP_EVENT_MAIN(start_function, event_function, stop_function) \
   COBALT_WRAP_BASE_MAIN(start_function, stop_function)
 
+// The generic main wrapper that initializes the main MessageLoop and
+// AtExitManager, supports a preload function, start function, event handler,
+// and stop function.
+#define COBALT_WRAP_MAIN(preload_function, start_function, event_function, \
+                         stop_function)                                    \
+  COBALT_WRAP_BASE_MAIN(start_function, stop_function)
+
 }  // namespace wrap_main
 }  // namespace cobalt
 
diff --git a/src/cobalt/base/wrap_main_starboard.h b/src/cobalt/base/wrap_main_starboard.h
index 17d8d40..aa57397 100644
--- a/src/cobalt/base/wrap_main_starboard.h
+++ b/src/cobalt/base/wrap_main_starboard.h
@@ -29,15 +29,18 @@
 namespace wrap_main {
 
 // Starboard implementation of the "Base Main" use case.
-template <StartFunction start_function, EventFunction event_function,
-          StopFunction stop_function>
+template <StartFunction preload_function, StartFunction start_function,
+          EventFunction event_function, StopFunction stop_function>
 void BaseEventHandler(const SbEvent* event) {
   static base::AtExitManager* g_at_exit = NULL;
   static MessageLoopForUI* g_loop = NULL;
+  static bool g_started = false;
   switch (event->type) {
-    case kSbEventTypeStart: {
+#if SB_API_VERSION >= SB_PRELOAD_API_VERSION
+    case kSbEventTypePreload: {
       SbEventStartData* data = static_cast<SbEventStartData*>(event->data);
 
+      DCHECK(!g_started);
       DCHECK(!g_at_exit);
       g_at_exit = new base::AtExitManager();
       InitCobalt(data->argument_count, data->argument_values, data->link);
@@ -47,11 +50,34 @@
       g_loop->set_thread_name("Main");
       g_loop->Start();
 
+      preload_function(data->argument_count, data->argument_values, data->link,
+                       base::Bind(&SbSystemRequestStop, 0));
+      g_started = true;
+      break;
+    }
+#endif  // SB_API_VERSION >= SB_PRELOAD_API_VERSION
+    case kSbEventTypeStart: {
+      SbEventStartData* data = static_cast<SbEventStartData*>(event->data);
+
+      if (!g_started) {
+        DCHECK(!g_at_exit);
+        g_at_exit = new base::AtExitManager();
+
+        InitCobalt(data->argument_count, data->argument_values, data->link);
+
+        DCHECK(!g_loop);
+        g_loop = new MessageLoopForUI();
+        g_loop->set_thread_name("Main");
+        g_loop->Start();
+      }
+
       start_function(data->argument_count, data->argument_values, data->link,
                      base::Bind(&SbSystemRequestStop, 0));
+      g_started = true;
       break;
     }
     case kSbEventTypeStop: {
+      DCHECK(g_started);
       DCHECK(g_at_exit);
       DCHECK(g_loop);
 
@@ -83,25 +109,34 @@
 }  // namespace wrap_main
 }  // namespace cobalt
 
-// Calls |main_function| at startup, creates an AtExitManager and calls
-// InitCobalt, and terminates once it is completed.
-#define COBALT_WRAP_SIMPLE_MAIN(main_function)                          \
-  STARBOARD_WRAP_SIMPLE_MAIN(                                           \
-      ::cobalt::wrap_main::CobaltMainAddOns<main_function>);
+// The generic main wrapper that initializes the main MessageLoop and
+// AtExitManager, supports a preload function, start function, event handler,
+// and stop function.
+#define COBALT_WRAP_MAIN(preload_function, start_function, event_function, \
+                         stop_function)                                    \
+  void SbEventHandle(const SbEvent* event) {                               \
+    return ::cobalt::wrap_main::BaseEventHandler<                          \
+        preload_function, start_function, event_function, stop_function>(  \
+        event);                                                            \
+  }
 
 // Like COBALT_WRAP_BASE_MAIN, but supports an event_function to forward
 // non-application events to.
 #define COBALT_WRAP_EVENT_MAIN(start_function, event_function, stop_function) \
-  void SbEventHandle(const SbEvent* event) {                                  \
-    return ::cobalt::wrap_main::BaseEventHandler<                             \
-        start_function, event_function, stop_function>(event);                \
-  }
+  COBALT_WRAP_MAIN(::cobalt::wrap_main::NoopStartFunction, start_function,    \
+                   event_function, stop_function)
 
 // Creates a MessageLoop and an AtExitManager, calls |start_function|, and
 // terminates once the MessageLoop terminates, calling |stop_function| on the
 // way out.
-#define COBALT_WRAP_BASE_MAIN(start_function, stop_function) \
-  COBALT_WRAP_EVENT_MAIN(                                    \
-      start_function, ::cobalt::wrap_main::NoopEventFunction, stop_function)
+#define COBALT_WRAP_BASE_MAIN(start_function, stop_function)               \
+  COBALT_WRAP_MAIN(::cobalt::wrap_main::NoopStartFunction, start_function, \
+                   ::cobalt::wrap_main::NoopEventFunction, stop_function)
+
+// Calls |main_function| at startup, creates an AtExitManager and calls
+// InitCobalt, and terminates once it is completed.
+#define COBALT_WRAP_SIMPLE_MAIN(main_function) \
+  STARBOARD_WRAP_SIMPLE_MAIN(                  \
+      ::cobalt::wrap_main::CobaltMainAddOns<main_function>);
 
 #endif  // COBALT_BASE_WRAP_MAIN_STARBOARD_H_
diff --git a/src/cobalt/bindings/code_generator_cobalt.py b/src/cobalt/bindings/code_generator_cobalt.py
index 043bad1..7227af8 100644
--- a/src/cobalt/bindings/code_generator_cobalt.py
+++ b/src/cobalt/bindings/code_generator_cobalt.py
@@ -596,6 +596,9 @@
                                             context['named_property_getter'] or
                                             context['named_property_deleter'])
 
+    names = sorted([key for key in interfaces_info])
+    context['unique_id'] = names.index(interface.name)
+
     return context
 
 
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
index b5178c9..eee757a 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/test_dictionary.h"
 
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
index 9740597..9c7df9d 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
@@ -283,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc
index ea95c8f..a810666 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc
@@ -242,7 +242,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
index e47a9ed..a972552 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
@@ -281,7 +281,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -346,7 +345,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
index 59c48e9..5c0218b 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
@@ -367,7 +367,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -432,7 +431,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -497,7 +495,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -562,7 +559,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -627,7 +623,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
index f52a434..09b1d08 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
@@ -285,7 +285,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -350,7 +349,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
index 90e79e7..fc0d3f4 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
@@ -370,7 +370,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -419,7 +418,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
index 6ba4eeb..ed56d9f 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
@@ -509,7 +509,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -580,7 +579,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -657,7 +655,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
index cc0512e..ca7f7ce 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
@@ -246,7 +246,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
index d9c7928..1b341be 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
@@ -285,7 +285,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -350,7 +349,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
index 5b3a925..c3cbbef 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
@@ -283,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
index e66d97c..17e8569 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
@@ -285,7 +285,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
index 9ec5d55..f4b2722 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
@@ -283,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
index 36681ea..1ff02f5 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
@@ -281,7 +281,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -330,7 +329,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
index 5e4454a..acafd45 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
index d9a2ece..a884585 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
@@ -346,7 +346,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -411,7 +410,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -482,7 +480,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
index cfe8949..07aeddb 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
@@ -201,7 +201,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -254,7 +253,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
index 12df01c..81ab465 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
@@ -306,7 +306,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -371,7 +370,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -442,7 +440,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
index 7b5593e..e242258 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
@@ -505,7 +505,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -576,7 +575,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -653,7 +651,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -724,7 +721,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -801,7 +797,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
index b52697e..b9144d2 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
@@ -531,7 +531,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -596,7 +595,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -649,7 +647,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -714,7 +711,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -767,7 +763,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -832,7 +827,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -885,7 +879,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -950,7 +943,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
index 728b36e..5a27ac4 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
@@ -1675,7 +1675,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1740,7 +1739,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1793,7 +1791,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1858,7 +1855,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1911,7 +1907,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1976,7 +1971,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2041,7 +2035,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2094,7 +2087,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2147,7 +2139,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2212,7 +2203,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2265,7 +2255,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2330,7 +2319,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2383,7 +2371,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2448,7 +2435,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2501,7 +2487,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2566,7 +2551,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2631,7 +2615,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2684,7 +2667,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2737,7 +2719,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2802,7 +2783,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
index e30f3c5..838dd0b 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
@@ -203,7 +203,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -256,7 +255,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -309,7 +307,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -372,7 +369,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -489,7 +485,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -566,7 +561,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -613,7 +607,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -678,7 +671,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -743,7 +735,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -832,7 +823,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -991,7 +981,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1056,7 +1045,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1155,7 +1143,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1208,7 +1195,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1275,7 +1261,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1380,7 +1365,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1445,7 +1429,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1492,7 +1475,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1557,7 +1539,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
index 61d37cb..4993d19 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -246,7 +245,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -299,7 +297,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -352,7 +349,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -405,7 +401,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
index 69655e2..e05d81c 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
@@ -205,7 +205,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -258,7 +257,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -311,7 +309,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -364,7 +361,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -417,7 +413,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -470,7 +465,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -523,7 +517,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -576,7 +569,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -641,7 +633,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -706,7 +697,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -771,7 +761,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -836,7 +825,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -901,7 +889,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -966,7 +953,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
index f4ede71..56b185e 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
@@ -29,6 +29,7 @@
 #include "cobalt/script/mozjs/mozjs_callback_interface.h"
 #include "cobalt/script/mozjs/util/exception_helpers.h"
 #include "cobalt/script/mozjs/util/stack_trace_helpers.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/src/jsapi.h"
 #include "third_party/mozjs/js/src/jscntxt.h"
 
@@ -68,7 +69,7 @@
   bool success = false;
   base::optional<int32_t > cobalt_return_value;
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  AutoSaveExceptionState auto_save_exception_state(context_);
   ENABLE_JS_STACK_TRACE_IN_SCOPE(context_);
 
   // This could be set to NULL if it was garbage collected.
@@ -112,7 +113,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return cobalt_return_value;
 }
 
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
index 345a16f..5813a8f 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
@@ -199,15 +199,43 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAnonymousOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAnonymousOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAnonymousOperationInterface* impl =
       wrapper_private->wrappable<StringifierAnonymousOperationInterface>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
index 4afb9bc..8dc7f73 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
@@ -281,15 +281,43 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAttributeInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAttributeInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAttributeInterface* impl =
       wrapper_private->wrappable<StringifierAttributeInterface>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
index bba0eb7..d9fa758 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -252,15 +251,43 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierOperationInterface* impl =
       wrapper_private->wrappable<StringifierOperationInterface>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc
index 50d9053..c509b91 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -246,7 +245,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc
index bba75f7..ea34cc4 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc
@@ -609,7 +609,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -664,7 +663,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -772,7 +770,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h
index 4c36160..97ffad7 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/arbitrary_interface.h"
 
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
index b5178c9..eee757a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/test_dictionary.h"
 
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
index b06defe..4fedd30 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
@@ -408,20 +408,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 0;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
index 680c83a..99c1120 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
@@ -361,20 +361,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 1;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
index 52b9f5d..e2bbf8b 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
@@ -505,20 +505,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 2;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
index 2051e93..34b1625 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
@@ -276,7 +276,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -420,20 +419,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 3;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
index 278db4a..ae10c81 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
@@ -229,7 +229,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -373,20 +372,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 4;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
index 60e62a8..9eef1ad 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
@@ -275,7 +275,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -340,7 +339,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -484,20 +482,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 5;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
index 287ca7e..d4dd89a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
@@ -369,7 +369,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -434,7 +433,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -499,7 +497,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -564,7 +561,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -629,7 +625,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -800,20 +795,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 6;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
index c8d4f23..19ff19e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
@@ -279,7 +279,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -344,7 +343,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -482,20 +480,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 7;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
index 8aa44f7..7d8ae8d 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
@@ -372,7 +372,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -421,7 +420,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -578,20 +576,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 8;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
index 9fc7f7f..12749e6 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
@@ -321,20 +321,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 9;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
index 12948a7..eb15fb1 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
@@ -274,20 +274,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 10;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
index d7e4244..a309c05 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
@@ -421,20 +421,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 11;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
index d346835..0574f01 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
@@ -514,7 +514,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -585,7 +584,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -662,7 +660,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -809,20 +806,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 13;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
index 8971ca7..82deddc 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
@@ -233,7 +233,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -377,20 +376,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 14;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
index d2278fb..ac2592b 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
@@ -279,7 +279,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -344,7 +343,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -500,20 +498,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 15;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
index 59f0f29..dba9f4e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
@@ -277,7 +277,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -412,20 +411,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 17;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
index dcece70..f26ffc4 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
@@ -746,20 +746,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 12;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
index e5b771e..1b4b7c3 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
@@ -278,7 +278,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -438,20 +437,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 18;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
index b24c533..f6bb0dd 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
@@ -366,20 +366,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 19;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
index cd6f023..64559ee 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
@@ -276,7 +276,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -420,20 +419,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 20;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
index 82699e1..4789a3a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
@@ -275,7 +275,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -324,7 +323,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -480,20 +478,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 21;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
index e13c005..f597106 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
@@ -470,20 +470,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 22;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
index cd39673..a9d6b66 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -314,20 +313,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 23;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
index 77f6e6f..6effd9d 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
@@ -338,7 +338,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -403,7 +402,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -474,7 +472,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -645,20 +642,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 25;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
index 85578ca..5943475 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
@@ -186,7 +186,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -239,7 +238,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -398,20 +396,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 26;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
index bf9a3d0..024a736 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
@@ -313,20 +313,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 27;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
index a719c77..a013300 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
@@ -274,20 +274,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 28;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
index 0367daa..e183554 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
@@ -297,7 +297,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -362,7 +361,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -433,7 +431,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -598,20 +595,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 29;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
index 5dea1d5..513dd5a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
@@ -510,7 +510,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -581,7 +580,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -658,7 +656,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -729,7 +726,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -806,7 +802,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -959,20 +954,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 30;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
index 108fc17..243e148 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
@@ -386,20 +386,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 31;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
index 35d8aae..5940907 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
@@ -264,20 +264,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 32;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
index d7bae5a..bafa068 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
@@ -227,20 +227,15 @@
 
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 33;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
index 7b18b10..8e96f5a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
@@ -549,7 +549,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -614,7 +613,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -667,7 +665,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -732,7 +729,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -785,7 +781,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -850,7 +845,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -903,7 +897,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -968,7 +961,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1148,20 +1140,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 34;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
index 48dd07b..a06e9d8 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
@@ -1805,7 +1805,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1870,7 +1869,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1923,7 +1921,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1988,7 +1985,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2041,7 +2037,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2106,7 +2101,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2171,7 +2165,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2224,7 +2217,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2277,7 +2269,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2342,7 +2333,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2395,7 +2385,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2460,7 +2449,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2513,7 +2501,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2578,7 +2565,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2631,7 +2617,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2696,7 +2681,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2761,7 +2745,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2814,7 +2797,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2867,7 +2849,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2932,7 +2913,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -3232,20 +3212,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 35;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
index 11db14d..d80da47 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
@@ -613,20 +613,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 36;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
index 78ee810..213d6bf 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
@@ -189,7 +189,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -242,7 +241,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -295,7 +293,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -358,7 +355,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -475,7 +471,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -552,7 +547,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -599,7 +593,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -664,7 +657,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -729,7 +721,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -818,7 +809,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -977,7 +967,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1042,7 +1031,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1141,7 +1129,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1194,7 +1181,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1261,7 +1247,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1366,7 +1351,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1431,7 +1415,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1478,7 +1461,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1543,7 +1525,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1835,20 +1816,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 37;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
index bc07a75..62a9828 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -232,7 +231,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -285,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -338,7 +335,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -391,7 +387,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -538,20 +533,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 38;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
index b139037..a4bbd60 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
@@ -435,20 +435,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 39;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
index 4473e30..fa79d52 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
@@ -190,7 +190,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -243,7 +242,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -296,7 +294,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -349,7 +346,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -402,7 +398,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -455,7 +450,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -508,7 +502,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -561,7 +554,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -626,7 +618,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -691,7 +682,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -756,7 +746,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -821,7 +810,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -886,7 +874,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -951,7 +938,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1146,20 +1132,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 40;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
index 3b0c942..bb92da0 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
@@ -67,7 +67,7 @@
   bool success = false;
   base::optional<int32_t > cobalt_return_value;
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  JS::AutoSaveExceptionState auto_save_exception_state(context_);
 
   // This could be set to NULL if it was garbage collected.
   JS::RootedObject implementing_object(context_, implementing_object_.GetObject());
@@ -107,7 +107,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return cobalt_return_value;
 }
 
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
index d03a770..c51a115 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
@@ -570,20 +570,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 42;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
index 0699d67..dfb6793 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
@@ -186,15 +186,43 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAnonymousOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAnonymousOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAnonymousOperationInterface* impl =
       wrapper_private->wrappable<StringifierAnonymousOperationInterface>().get();
   if (!impl) {
@@ -297,20 +325,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 43;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
index bd3097d..e861ff7 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
@@ -276,15 +276,43 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAttributeInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAttributeInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAttributeInterface* impl =
       wrapper_private->wrappable<StringifierAttributeInterface>().get();
   if (!impl) {
@@ -393,20 +421,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 44;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
index da67d25..d0f28bd 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -239,15 +238,43 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierOperationInterface* impl =
       wrapper_private->wrappable<StringifierOperationInterface>().get();
   if (!impl) {
@@ -353,20 +380,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 45;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
index f0da3bc..92e30b5 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -232,7 +231,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -364,20 +362,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 46;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
index 9d1fe7b..a9026b2 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
@@ -656,20 +656,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 48;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
index 1414c2c..f0b91a4 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
@@ -613,7 +613,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -668,7 +667,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -776,7 +774,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -929,20 +926,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 50;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h
index 4c36160..97ffad7 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/arbitrary_interface.h"
 
diff --git a/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template b/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template
index f3031f9..aee4a88 100644
--- a/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template
+++ b/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template
@@ -24,6 +24,7 @@
 #include "cobalt/script/mozjs/mozjs_callback_interface.h"
 #include "cobalt/script/mozjs/util/exception_helpers.h"
 #include "cobalt/script/mozjs/util/stack_trace_helpers.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/src/jsapi.h"
 #include "third_party/mozjs/js/src/jscntxt.h"
 {% endblock includes %}
@@ -67,7 +68,7 @@
   {{overload.type}} cobalt_return_value;
 {% endif %}
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  AutoSaveExceptionState auto_save_exception_state(context_);
   ENABLE_JS_STACK_TRACE_IN_SCOPE(context_);
 
   // This could be set to NULL if it was garbage collected.
@@ -115,7 +116,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
 {% if overload.type != 'void' %}
   return cobalt_return_value;
 {% endif %}
diff --git a/src/cobalt/bindings/mozjs/templates/interface.cc.template b/src/cobalt/bindings/mozjs/templates/interface.cc.template
index 99ca683..323e665 100644
--- a/src/cobalt/bindings/mozjs/templates/interface.cc.template
+++ b/src/cobalt/bindings/mozjs/templates/interface.cc.template
@@ -497,15 +497,25 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+  {{ check_if_object_implements_interface() }}
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   {{impl_class}}* impl =
       wrapper_private->wrappable<{{impl_class}}>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/mozjs/templates/macros.cc.template b/src/cobalt/bindings/mozjs/templates/macros.cc.template
index 4436475..8cb1fee 100644
--- a/src/cobalt/bindings/mozjs/templates/macros.cc.template
+++ b/src/cobalt/bindings/mozjs/templates/macros.cc.template
@@ -54,7 +54,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template b/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template
index 04f6ccd..129ff1c 100644
--- a/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template
+++ b/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template
@@ -66,7 +66,7 @@
   {{overload.type}} cobalt_return_value;
 {% endif %}
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  JS::AutoSaveExceptionState auto_save_exception_state(context_);
 
   // This could be set to NULL if it was garbage collected.
   JS::RootedObject implementing_object(context_, implementing_object_.GetObject());
@@ -110,7 +110,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
 {% if overload.type != 'void' %}
   return cobalt_return_value;
 {% endif %}
diff --git a/src/cobalt/bindings/mozjs45/templates/interface.cc.template b/src/cobalt/bindings/mozjs45/templates/interface.cc.template
index abe82f9..00e5080 100644
--- a/src/cobalt/bindings/mozjs45/templates/interface.cc.template
+++ b/src/cobalt/bindings/mozjs45/templates/interface.cc.template
@@ -516,15 +516,25 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+  {{ check_if_object_implements_interface() }}
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   {{impl_class}}* impl =
       wrapper_private->wrappable<{{impl_class}}>().get();
   if (!impl) {
@@ -755,20 +765,15 @@
 {% endif %}
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = {{unique_id}};
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/mozjs45/templates/macros.cc.template b/src/cobalt/bindings/mozjs45/templates/macros.cc.template
index 6adbab7..a7ab728 100644
--- a/src/cobalt/bindings/mozjs45/templates/macros.cc.template
+++ b/src/cobalt/bindings/mozjs45/templates/macros.cc.template
@@ -54,7 +54,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
diff --git a/src/cobalt/browser/application.cc b/src/cobalt/browser/application.cc
index 02597f5..4948758 100644
--- a/src/cobalt/browser/application.cc
+++ b/src/cobalt/browser/application.cc
@@ -22,11 +22,14 @@
 #include "base/debug/trace_event.h"
 #include "base/lazy_instance.h"
 #include "base/logging.h"
+#include "base/optional.h"
 #include "base/path_service.h"
 #include "base/string_number_conversions.h"
 #include "base/string_split.h"
+#include "base/string_util.h"
 #include "base/time.h"
 #include "build/build_config.h"
+#include "cobalt/base/application_event.h"
 #include "cobalt/base/cobalt_paths.h"
 #include "cobalt/base/deep_link_event.h"
 #include "cobalt/base/init_cobalt.h"
@@ -34,9 +37,7 @@
 #include "cobalt/base/localized_strings.h"
 #include "cobalt/base/startup_timer.h"
 #include "cobalt/base/user_log.h"
-#include "cobalt/browser/memory_settings/auto_mem.h"
-#include "cobalt/browser/memory_settings/checker.h"
-#include "cobalt/browser/memory_settings/pretty_print.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_tracker/tool.h"
 #include "cobalt/browser/switches.h"
 #include "cobalt/loader/image/image_decoder.h"
@@ -46,7 +47,6 @@
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
 #include "cobalt/storage/savegame_fake.h"
 #endif
-#include "cobalt/system_window/application_event.h"
 #include "cobalt/trace_event/scoped_trace_to_file.h"
 #include "googleurl/src/gurl.h"
 #if defined(__LB_SHELL__)
@@ -66,6 +66,10 @@
 
 const char kDefaultURL[] = "https://www.youtube.com/tv";
 
+bool IsStringNone(const std::string& str) {
+  return !base::strcasecmp(str.c_str(), "none");
+}
+
 #if defined(ENABLE_REMOTE_DEBUGGING)
 int GetRemoteDebuggingPort() {
 #if defined(SB_OVERRIDE_DEFAULT_REMOTE_DEBUGGING_PORT)
@@ -140,13 +144,36 @@
     if (url.is_valid()) {
       return url;
     } else {
-      DLOG(INFO) << "URL from parameter is not valid, using default URL.";
+      DLOG(ERROR) << "URL from parameter " << command_line
+                  << " is not valid, using default URL.";
     }
   }
 
   return GURL(kDefaultURL);
 }
 
+base::optional<GURL> GetSplashScreenURL() {
+  CommandLine* command_line = CommandLine::ForCurrentProcess();
+  std::string splash_screen_string;
+  if (command_line->HasSwitch(switches::kFallbackSplashScreenURL)) {
+    splash_screen_string =
+        command_line->GetSwitchValueASCII(switches::kFallbackSplashScreenURL);
+  } else {
+    splash_screen_string = COBALT_FALLBACK_SPLASH_SCREEN_URL;
+  }
+  if (IsStringNone(splash_screen_string)) {
+    return base::optional<GURL>();
+  }
+  base::optional<GURL> splash_screen_url = GURL(splash_screen_string);
+  if (!splash_screen_url->is_valid() ||
+      !(StartsWithASCII(splash_screen_string, "file:///", false) ||
+        StartsWithASCII(splash_screen_string, "h5vcc-embedded://", false))) {
+    LOG(FATAL) << "Ignoring invalid fallback splash screen: "
+               << splash_screen_string;
+  }
+  return splash_screen_url;
+}
+
 base::TimeDelta GetTimedTraceDuration() {
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
   CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -193,6 +220,32 @@
 }
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
+#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
+base::optional<math::Size> GetVideoOutputResolutionOverride(
+    CommandLine* command_line) {
+  DCHECK(command_line);
+  if (command_line->HasSwitch(switches::kVideoContainerSizeOverride)) {
+    std::string size_override = command_line->GetSwitchValueASCII(
+        browser::switches::kVideoContainerSizeOverride);
+    DLOG(INFO) << "Set video container size override from command line to "
+               << size_override;
+    // Override string should be something like "1920x1080".
+    int32 width, height;
+    std::vector<std::string> tokens;
+    base::SplitString(size_override, 'x', &tokens);
+    if (tokens.size() == 2 && base::StringToInt32(tokens[0], &width) &&
+        base::StringToInt32(tokens[1], &height)) {
+      return math::Size(width, height);
+    }
+
+    DLOG(WARNING) << "Invalid size specified for video container: "
+                  << size_override;
+  }
+
+  return base::nullopt;
+}
+#endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
+
 // Represents a parsed int.
 struct ParsedIntValue {
  public:
@@ -202,6 +255,7 @@
   int value_;
   bool error_;  // true if there was a parse error.
 };
+
 // Parses a string like "1234x5678" to vector of parsed int values.
 std::vector<ParsedIntValue> ParseDimensions(const std::string& value_str) {
   std::vector<ParsedIntValue> output;
@@ -217,6 +271,51 @@
   return output;
 }
 
+base::optional<math::Size> GetRequestedViewportSize(CommandLine* command_line) {
+  DCHECK(command_line);
+  if (!command_line->HasSwitch(browser::switches::kViewport)) {
+    return base::nullopt;
+  }
+
+  const std::string switchValue =
+      command_line->GetSwitchValueASCII(browser::switches::kViewport);
+  std::vector<ParsedIntValue> parsed_ints = ParseDimensions(switchValue);
+  if (parsed_ints.size() < 1) {
+    return base::nullopt;
+  }
+
+  const ParsedIntValue parsed_width = parsed_ints[0];
+  if (parsed_width.error_) {
+    DLOG(ERROR) << "Invalid value specified for viewport width: " << switchValue
+                << ". Using default viewport size.";
+    return base::nullopt;
+  }
+
+  const ParsedIntValue* parsed_height_ptr = NULL;
+  if (parsed_ints.size() >= 2) {
+    parsed_height_ptr = &parsed_ints[1];
+  }
+
+  if (!parsed_height_ptr) {
+    // Allow shorthand specification of the viewport by only giving the
+    // width. This calculates the height at 4:3 aspect ratio for smaller
+    // viewport widths, and 16:9 for viewports 1280 pixels wide or larger.
+    if (parsed_width.value_ >= 1280) {
+      return math::Size(parsed_width.value_, 9 * parsed_width.value_ / 16);
+    }
+
+    return math::Size(parsed_width.value_, 3 * parsed_width.value_ / 4);
+  }
+
+  if (parsed_height_ptr->error_) {
+    DLOG(ERROR) << "Invalid value specified for viewport height: "
+                << switchValue << ". Using default viewport size.";
+    return base::nullopt;
+  }
+
+  return math::Size(parsed_width.value_, parsed_height_ptr->value_);
+}
+
 std::string GetMinLogLevelString() {
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
   CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -322,44 +421,7 @@
 int Application::network_connect_count_ = 0;
 int Application::network_disconnect_count_ = 0;
 
-void ApplyAutoMemSettings(const memory_settings::AutoMem& auto_mem,
-                          BrowserModule::Options* options) {
-  std::stringstream ss;
-  const bool enable_color = SbLogIsTty();
-  ss << "\n\n" << auto_mem.ToPrettyPrintString(enable_color) << "\n\n";
-  SB_LOG(INFO) << ss.str();
-
-  options->web_module_options.image_cache_capacity =
-      static_cast<int>(auto_mem.image_cache_size_in_bytes()->value());
-
-  options->renderer_module_options.skia_cache_size_in_bytes =
-      static_cast<int>(auto_mem.skia_cache_size_in_bytes()->value());
-
-  const memory_settings::TextureDimensions skia_glyph_atlas_texture_dimensions =
-      auto_mem.skia_atlas_texture_dimensions()->value();
-
-  // Right now the bytes_per_pixel is assumed in the engine. Any other value
-  // is currently forbidden.
-  if (skia_glyph_atlas_texture_dimensions.bytes_per_pixel() > 0) {
-    DCHECK_EQ(2, skia_glyph_atlas_texture_dimensions.bytes_per_pixel());
-    options->renderer_module_options.skia_glyph_texture_atlas_dimensions =
-        math::Size(skia_glyph_atlas_texture_dimensions.width(),
-                   skia_glyph_atlas_texture_dimensions.height());
-  }
-
-  options->web_module_options.remote_typeface_cache_capacity =
-      static_cast<int>(
-          auto_mem.remote_typeface_cache_size_in_bytes()->value());
-
-  options->web_module_options.javascript_options.gc_threshold_bytes =
-      static_cast<size_t>(auto_mem.javascript_gc_threshold_in_bytes()->value());
-
-  options->renderer_module_options.software_surface_cache_size_in_bytes =
-      static_cast<int>(
-          auto_mem.software_surface_cache_size_in_bytes()->value());
-}
-
-Application::Application(const base::Closure& quit_closure)
+Application::Application(const base::Closure& quit_closure, bool should_preload)
     : message_loop_(MessageLoop::current()),
       quit_closure_(quit_closure),
       stats_update_timer_(true, true) {
@@ -392,12 +454,18 @@
   GURL initial_url = GetInitialURL();
   DLOG(INFO) << "Initial URL: " << initial_url;
 
+  // Get the splash screen URL.
+  base::optional<GURL> splash_screen_url = GetSplashScreenURL();
+  DLOG(INFO) << "Splash screen URL: "
+             << (splash_screen_url ? splash_screen_url->spec() : "none");
+
   // Get the system language and initialize our localized strings.
   std::string language = base::GetSystemLanguage();
   base::LocalizedStrings::GetInstance()->Initialize(language);
 
   CommandLine* command_line = CommandLine::ForCurrentProcess();
-  math::Size window_size = InitSystemWindow(command_line);
+  base::optional<math::Size> requested_viewport_size =
+      GetRequestedViewportSize(command_line);
 
   WebModule::Options web_options;
   // Create the main components of our browser.
@@ -406,6 +474,10 @@
   options.language = language;
   options.initial_deep_link = GetInitialDeepLink();
   options.network_module_options.preferred_language = language;
+  options.command_line_auto_mem_settings =
+      memory_settings::GetSettings(*command_line);
+  options.build_auto_mem_settings = memory_settings::GetDefaultBuildSettings();
+  options.splash_screen_url = splash_screen_url;
 
   if (command_line->HasSwitch(browser::switches::kFPSPrint)) {
     options.renderer_module_options.enable_fps_stdout = true;
@@ -420,14 +492,6 @@
     options.web_module_options.javascript_options.disable_jit = true;
   }
 
-  auto_mem_.reset(
-      new memory_settings::AutoMem(
-          window_size,
-          *command_line,
-          memory_settings::GetDefaultBuildSettings()));
-
-  ApplyAutoMemSettings(*auto_mem_, &options);
-
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
   if (command_line->HasSwitch(browser::switches::kNullSavegame)) {
     options.storage_manager_options.savegame_options.factory =
@@ -505,12 +569,18 @@
     DLOG(INFO) << "Use ShellRawVideoDecoderStub";
     options.media_module_options.use_video_decoder_stub = true;
   }
+  options.media_module_options.output_resolution_override =
+      GetVideoOutputResolutionOverride(command_line);
   if (command_line->HasSwitch(switches::kMemoryTracker)) {
     std::string command_arg =
         command_line->GetSwitchValueASCII(switches::kMemoryTracker);
     memory_tracker_tool_ =
         memory_tracker::CreateMemoryTrackerTool(command_arg);
   }
+
+  if (command_line->HasSwitch(switches::kDisableImageAnimations)) {
+    options.web_module_options.enable_image_animations = false;
+  }
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
   if (command_line->HasSwitch(browser::switches::kDisableNavigationWhitelist)) {
@@ -520,13 +590,16 @@
     options.web_module_options.location_policy = "h5vcc-location-src *";
   }
 
+  options.requested_viewport_size = requested_viewport_size;
   account_manager_.reset(new account::AccountManager());
   browser_module_.reset(
-      new BrowserModule(initial_url, base::kApplicationStateStarted,
-                        system_window_.get(), account_manager_.get(), options));
+      new BrowserModule(initial_url,
+                        (should_preload ? base::kApplicationStatePreloading
+                                        : base::kApplicationStateStarted),
+                        &event_dispatcher_, account_manager_.get(), options));
   UpdateAndMaybeRegisterUserAgent();
 
-  app_status_ = kRunningAppStatus;
+  app_status_ = (should_preload ? kPreloadingAppStatus : kRunningAppStatus);
 
   // Register event callbacks.
   network_event_callback_ =
@@ -535,8 +608,9 @@
                                      network_event_callback_);
   application_event_callback_ =
       base::Bind(&Application::OnApplicationEvent, base::Unretained(this));
-  event_dispatcher_.AddEventCallback(system_window::ApplicationEvent::TypeId(),
+  event_dispatcher_.AddEventCallback(base::ApplicationEvent::TypeId(),
                                      application_event_callback_);
+
   deep_link_event_callback_ =
       base::Bind(&Application::OnDeepLinkEvent, base::Unretained(this));
   event_dispatcher_.AddEventCallback(base::DeepLinkEvent::TypeId(),
@@ -592,14 +666,31 @@
   // Unregister event callbacks.
   event_dispatcher_.RemoveEventCallback(network::NetworkEvent::TypeId(),
                                         network_event_callback_);
-  event_dispatcher_.RemoveEventCallback(
-      system_window::ApplicationEvent::TypeId(), application_event_callback_);
+  event_dispatcher_.RemoveEventCallback(base::ApplicationEvent::TypeId(),
+                                        application_event_callback_);
   event_dispatcher_.RemoveEventCallback(
       base::DeepLinkEvent::TypeId(), deep_link_event_callback_);
 
   app_status_ = kShutDownAppStatus;
 }
 
+void Application::Start() {
+  if (MessageLoop::current() != message_loop_) {
+    message_loop_->PostTask(
+        FROM_HERE, base::Bind(&Application::Start, base::Unretained(this)));
+    return;
+  }
+
+  if (app_status_ != kPreloadingAppStatus) {
+    NOTREACHED() << __FUNCTION__ << ": Redundant call.";
+    return;
+  }
+
+  event_dispatcher_.DispatchEvent(make_scoped_ptr<base::Event>(
+      new base::ApplicationEvent(kSbEventTypeStart)));
+  app_status_ = kRunningAppStatus;
+}
+
 void Application::Quit() {
   if (MessageLoop::current() != message_loop_) {
     message_loop_->PostTask(
@@ -639,29 +730,29 @@
 void Application::OnApplicationEvent(const base::Event* event) {
   TRACE_EVENT0("cobalt::browser", "Application::OnApplicationEvent()");
   DCHECK(application_event_thread_checker_.CalledOnValidThread());
-  const system_window::ApplicationEvent* app_event =
-      base::polymorphic_downcast<const system_window::ApplicationEvent*>(event);
-  if (app_event->type() == system_window::ApplicationEvent::kQuit) {
+  const base::ApplicationEvent* app_event =
+      base::polymorphic_downcast<const base::ApplicationEvent*>(event);
+  if (app_event->type() == kSbEventTypeStop) {
     DLOG(INFO) << "Got quit event.";
     app_status_ = kWillQuitAppStatus;
     Quit();
-  } else if (app_event->type() == system_window::ApplicationEvent::kPause) {
+  } else if (app_event->type() == kSbEventTypePause) {
     DLOG(INFO) << "Got pause event.";
     app_status_ = kPausedAppStatus;
     ++app_pause_count_;
     browser_module_->Pause();
-  } else if (app_event->type() == system_window::ApplicationEvent::kUnpause) {
+  } else if (app_event->type() == kSbEventTypeUnpause) {
     DLOG(INFO) << "Got unpause event.";
     app_status_ = kRunningAppStatus;
     ++app_unpause_count_;
     browser_module_->Unpause();
-  } else if (app_event->type() == system_window::ApplicationEvent::kSuspend) {
+  } else if (app_event->type() == kSbEventTypeSuspend) {
     DLOG(INFO) << "Got suspend event.";
     app_status_ = kSuspendedAppStatus;
     ++app_suspend_count_;
     browser_module_->Suspend();
     DLOG(INFO) << "Finished suspending.";
-  } else if (app_event->type() == system_window::ApplicationEvent::kResume) {
+  } else if (app_event->type() == kSbEventTypeResume) {
     DLOG(INFO) << "Got resume event.";
     app_status_ = kPausedAppStatus;
     ++app_resume_count_;
@@ -759,57 +850,6 @@
   }
 }
 
-math::Size Application::InitSystemWindow(CommandLine* command_line) {
-  base::optional<math::Size> viewport_size;
-  if (command_line->HasSwitch(browser::switches::kViewport)) {
-    const std::string switchValue =
-        command_line->GetSwitchValueASCII(browser::switches::kViewport);
-
-    std::vector<ParsedIntValue> parsed_ints = ParseDimensions(switchValue);
-
-    if (parsed_ints.size() >= 1) {
-      const ParsedIntValue parsed_width = parsed_ints[0];
-      if (!parsed_width.error_) {
-        const ParsedIntValue* parsed_height_ptr = NULL;
-        if (parsed_ints.size() >= 2) {
-          parsed_height_ptr = &parsed_ints[1];
-        }
-
-        if (!parsed_height_ptr) {
-          // Allow shorthand specification of the viewport by only giving the
-          // width. This calculates the height at 4:3 aspect ratio for smaller
-          // viewport widths, and 16:9 for viewports 1280 pixels wide or larger.
-          if (parsed_width.value_ >= 1280) {
-            viewport_size.emplace(parsed_width.value_,
-                                  9 * parsed_width.value_ / 16);
-          } else {
-            viewport_size.emplace(parsed_width.value_,
-                                  3 * parsed_width.value_ / 4);
-          }
-        } else if (!parsed_height_ptr->error_) {
-          viewport_size.emplace(parsed_width.value_,
-                                parsed_height_ptr->value_);
-        } else {
-          DLOG(ERROR) << "Invalid value specified for viewport height: "
-                      << switchValue << ". Using default viewport size.";
-        }
-      } else {
-        DLOG(ERROR) << "Invalid value specified for viewport width: "
-                    << switchValue << ". Using default viewport size.";
-      }
-    }
-  }
-
-  system_window_.reset(
-      new system_window::SystemWindow(&event_dispatcher_, viewport_size));
-
-  math::Size window_size = system_window_->GetWindowSize();
-  if (viewport_size) {
-    DCHECK_EQ(viewport_size, window_size);
-  }
-  return window_size;
-}
-
 void Application::UpdatePeriodicStats() {
   TRACE_EVENT0("cobalt::browser", "Application::UpdatePeriodicStats()");
   c_val_stats_.app_lifetime = base::StartupTimer::TimeElapsed();
@@ -834,8 +874,7 @@
   c_val_stats_.js_reserved_memory =
       script::JavaScriptEngine::UpdateMemoryStatsAndReturnReserved();
 
-  memory_settings_checker_.RunChecks(
-      *auto_mem_, used_cpu_memory, used_gpu_memory);
+  browser_module_->CheckMemory(used_cpu_memory, used_gpu_memory);
 }
 
 }  // namespace browser
diff --git a/src/cobalt/browser/application.h b/src/cobalt/browser/application.h
index 6da8a33..a8a5597 100644
--- a/src/cobalt/browser/application.h
+++ b/src/cobalt/browser/application.h
@@ -22,8 +22,6 @@
 #include "cobalt/account/account_manager.h"
 #include "cobalt/base/event_dispatcher.h"
 #include "cobalt/browser/browser_module.h"
-#include "cobalt/browser/memory_settings/auto_mem.h"
-#include "cobalt/browser/memory_settings/checker.h"
 #include "cobalt/browser/memory_tracker/tool.h"
 #include "cobalt/system_window/system_window.h"
 
@@ -46,10 +44,12 @@
  public:
   virtual ~Application();
 
+  // Start from a preloaded state.
+  void Start();
   void Quit();
 
  protected:
-  explicit Application(const base::Closure& quit_closure);
+  Application(const base::Closure& quit_closure, bool should_preload);
 
   MessageLoop* message_loop() { return message_loop_; }
 
@@ -75,11 +75,6 @@
   // A conduit for system events.
   base::EventDispatcher event_dispatcher_;
 
-  // The main system window for our application.
-  // This routes event callbacks, and provides a native window handle
-  // on desktop systems.
-  scoped_ptr<system_window::SystemWindow> system_window_;
-
   // Account manager.
   scoped_ptr<account::AccountManager> account_manager_;
 
@@ -110,6 +105,7 @@
  private:
   enum AppStatus {
     kUninitializedAppStatus,
+    kPreloadingAppStatus,
     kRunningAppStatus,
     kPausedAppStatus,
     kSuspendedAppStatus,
@@ -151,8 +147,6 @@
 
   void UpdatePeriodicStats();
 
-  math::Size InitSystemWindow(CommandLine* command_line);
-
   static ssize_t available_memory_;
   static int64 lifetime_in_ms_;
 
@@ -171,21 +165,18 @@
   base::Timer stats_update_timer_;
 
   scoped_ptr<memory_tracker::Tool> memory_tracker_tool_;
-
-  // Memory configuration tool.
-  scoped_ptr<memory_settings::AutoMem> auto_mem_;
-
-  // Fires memory warning once when memory exceeds specified max cpu/gpu
-  // memory.
-  memory_settings::Checker memory_settings_checker_;
 };
 
-// Factory method for creating an application.  It should be implemented
-// per-platform to allow for platform-specific customization.  The passed
-// in |quit_closure| can be called internally by the application to signal that
-// it would like to quit.
+// Factory method for creating a started application. The passed in
+// |quit_closure| can be called internally by the application to signal that it
+// would like to quit.
 scoped_ptr<Application> CreateApplication(const base::Closure& quit_closure);
 
+// Factory method for creating a preloading application. The passed in
+// |quit_closure| can be called internally by the application to signal that it
+// would like to quit.
+scoped_ptr<Application> PreloadApplication(const base::Closure& quit_closure);
+
 }  // namespace browser
 }  // namespace cobalt
 
diff --git a/src/cobalt/browser/browser.gyp b/src/cobalt/browser/browser.gyp
index 0741ae3..321bc20 100644
--- a/src/cobalt/browser/browser.gyp
+++ b/src/cobalt/browser/browser.gyp
@@ -20,6 +20,9 @@
     {
       'target_name': 'browser',
       'type': 'static_library',
+      'includes': [
+        '../renderer/renderer_parameters_setup.gypi',
+      ],
       'sources': [
         'application.cc',
         'application.h',
@@ -32,8 +35,8 @@
         'lifecycle_observer.h',
         'memory_settings/auto_mem.cc',
         'memory_settings/auto_mem.h',
-        'memory_settings/build_settings.cc',
-        'memory_settings/build_settings.h',
+        'memory_settings/auto_mem_settings.cc',
+        'memory_settings/auto_mem_settings.h',
         'memory_settings/calculations.cc',
         'memory_settings/calculations.h',
         'memory_settings/checker.cc',
@@ -99,12 +102,14 @@
         'web_module_stat_tracker.h',
       ],
       'defines': [
+        'COBALT_FALLBACK_SPLASH_SCREEN_URL="<(fallback_splash_screen_url)"',
         'COBALT_SKIA_CACHE_SIZE_IN_BYTES=<(skia_cache_size_in_bytes)',
         'COBALT_SKIA_GLYPH_ATLAS_WIDTH=<(skia_glyph_atlas_width)',
         'COBALT_SKIA_GLYPH_ATLAS_HEIGHT=<(skia_glyph_atlas_height)',
         'COBALT_IMAGE_CACHE_SIZE_IN_BYTES=<(image_cache_size_in_bytes)',
         'COBALT_REMOTE_TYPEFACE_CACHE_SIZE_IN_BYTES=<(remote_font_cache_size_in_bytes)',
         'COBALT_IMAGE_CACHE_CAPACITY_MULTIPLIER_WHEN_PLAYING_VIDEO=<(image_cache_capacity_multiplier_when_playing_video)',
+        'COBALT_OFFSCREEN_TARGET_CACHE_SIZE_IN_BYTES=<(offscreen_target_cache_size_in_bytes)',
         'COBALT_SOFTWARE_SURFACE_CACHE_SIZE_IN_BYTES=<(software_surface_cache_size_in_bytes)',
         'COBALT_JS_GARBAGE_COLLECTION_THRESHOLD_IN_BYTES=<(mozjs_garbage_collection_threshold_in_bytes)',
         'COBALT_MAX_CPU_USAGE_IN_BYTES=<(max_cobalt_cpu_usage)',
@@ -133,6 +138,7 @@
         '<(DEPTH)/cobalt/renderer/renderer.gyp:renderer',
         '<(DEPTH)/cobalt/script/engine.gyp:engine',
         '<(DEPTH)/cobalt/speech/speech.gyp:speech',
+        '<(DEPTH)/cobalt/sso/sso.gyp:sso',
         '<(DEPTH)/cobalt/system_window/system_window.gyp:system_window',
         '<(DEPTH)/cobalt/trace_event/trace_event.gyp:trace_event',
         '<(DEPTH)/cobalt/webdriver/webdriver.gyp:webdriver',
@@ -225,10 +231,11 @@
       'sources': [
         'storage_upgrade_handler_test.cc',
         'memory_settings/auto_mem_test.cc',
+        'memory_settings/auto_mem_settings_test.cc',
         'memory_settings/calculations_test.cc',
         'memory_settings/constrainer_test.cc',
-        'memory_settings/pretty_print_test.cc',
         'memory_settings/memory_settings_test.cc',
+        'memory_settings/pretty_print_test.cc',
         'memory_settings/table_printer_test.cc',
         'memory_settings/test_common.h',
         'memory_tracker/tool/tool_impl_test.cc',
diff --git a/src/cobalt/browser/browser_bindings_gen.gyp b/src/cobalt/browser/browser_bindings_gen.gyp
index 0ff0e7b..061a5df 100644
--- a/src/cobalt/browser/browser_bindings_gen.gyp
+++ b/src/cobalt/browser/browser_bindings_gen.gyp
@@ -170,6 +170,7 @@
         '../h5vcc/h5vcc_runtime.idl',
         '../h5vcc/h5vcc_runtime_event_target.idl',
         '../h5vcc/h5vcc_settings.idl',
+        '../h5vcc/h5vcc_sso.idl',
         '../h5vcc/h5vcc_storage.idl',
         '../h5vcc/h5vcc_system.idl',
         '../h5vcc/h5vcc_trace_event.idl',
@@ -260,6 +261,7 @@
         '../dom/global_crypto.idl',
         '../dom/global_event_handlers.idl',
         '../dom/html_element_cssom_view.idl',
+        '../dom/mouse_event_cssom_view.idl',
         '../dom/navigator_id.idl',
         '../dom/navigator_language.idl',
         '../dom/navigator_plugins.idl',
diff --git a/src/cobalt/browser/browser_module.cc b/src/cobalt/browser/browser_module.cc
index d5c6719..015dd40 100644
--- a/src/cobalt/browser/browser_module.cc
+++ b/src/cobalt/browser/browser_module.cc
@@ -166,30 +166,6 @@
 
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
-#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
-void GetVideoContainerSizeOverride(math::Size* output_size) {
-  DCHECK(output_size);
-  CommandLine* command_line = CommandLine::ForCurrentProcess();
-  if (command_line->HasSwitch(switches::kVideoContainerSizeOverride)) {
-    std::string size_override = command_line->GetSwitchValueASCII(
-        browser::switches::kVideoContainerSizeOverride);
-    DLOG(INFO) << "Set video container size override from command line to "
-               << size_override;
-    // Override string should be something like "1920x1080".
-    int32 width, height;
-    std::vector<std::string> tokens;
-    base::SplitString(size_override, 'x', &tokens);
-    if (tokens.size() == 2 && base::StringToInt32(tokens[0], &width) &&
-        base::StringToInt32(tokens[1], &height)) {
-      *output_size = math::Size(width, height);
-    } else {
-      DLOG(WARNING) << "Invalid size specified for video container: "
-                    << size_override;
-    }
-  }
-}
-#endif
-
 scoped_refptr<script::Wrappable> CreateH5VCC(
     const h5vcc::H5vcc::Settings& settings,
     const scoped_refptr<dom::Window>& window,
@@ -206,50 +182,73 @@
   return options;  // Copy.
 }
 
+void ApplyAutoMemSettings(const memory_settings::AutoMem& auto_mem,
+                          BrowserModule::Options* options) {
+  SB_LOG(INFO) << "\n\n"
+               << auto_mem.ToPrettyPrintString(SbLogIsTty()) << "\n\n";
+
+  options->web_module_options.image_cache_capacity =
+      static_cast<int>(auto_mem.image_cache_size_in_bytes()->value());
+
+  options->renderer_module_options.skia_cache_size_in_bytes =
+      static_cast<int>(auto_mem.skia_cache_size_in_bytes()->value());
+
+  const memory_settings::TextureDimensions skia_glyph_atlas_texture_dimensions =
+      auto_mem.skia_atlas_texture_dimensions()->value();
+
+  // Right now the bytes_per_pixel is assumed in the engine. Any other value
+  // is currently forbidden.
+  if (skia_glyph_atlas_texture_dimensions.bytes_per_pixel() > 0) {
+    DCHECK_EQ(2, skia_glyph_atlas_texture_dimensions.bytes_per_pixel());
+    options->renderer_module_options.skia_glyph_texture_atlas_dimensions =
+        math::Size(skia_glyph_atlas_texture_dimensions.width(),
+                   skia_glyph_atlas_texture_dimensions.height());
+  }
+
+  options->web_module_options.remote_typeface_cache_capacity =
+      static_cast<int>(auto_mem.remote_typeface_cache_size_in_bytes()->value());
+
+  options->web_module_options.javascript_options.gc_threshold_bytes =
+      static_cast<size_t>(auto_mem.javascript_gc_threshold_in_bytes()->value());
+
+  options->renderer_module_options.software_surface_cache_size_in_bytes =
+      static_cast<int>(
+          auto_mem.software_surface_cache_size_in_bytes()->value());
+  options->renderer_module_options.offscreen_target_cache_size_in_bytes =
+      static_cast<int>(
+          auto_mem.offscreen_target_cache_size_in_bytes()->value());
+}
+
 }  // namespace
 
 BrowserModule::BrowserModule(const GURL& url,
                              base::ApplicationState initial_application_state,
-                             system_window::SystemWindow* system_window,
+                             base::EventDispatcher* event_dispatcher,
                              account::AccountManager* account_manager,
                              const Options& options)
     : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
       ALLOW_THIS_IN_INITIALIZER_LIST(
           weak_this_(weak_ptr_factory_.GetWeakPtr())),
+      options_(options),
       self_message_loop_(MessageLoop::current()),
+      event_dispatcher_(event_dispatcher),
       storage_manager_(
           scoped_ptr<StorageUpgradeHandler>(new StorageUpgradeHandler(url))
               .PassAs<storage::StorageManager::UpgradeHandler>(),
-          options.storage_manager_options),
+          options_.storage_manager_options),
 #if defined(OS_STARBOARD)
       is_rendered_(false),
 #endif  // OS_STARBOARD
-      input_device_manager_(input::InputDeviceManager::CreateFromWindow(
-          base::Bind(&BrowserModule::OnKeyEventProduced,
-                     base::Unretained(this)),
-          base::Bind(&BrowserModule::OnPointerEventProduced,
-                     base::Unretained(this)),
-          base::Bind(&BrowserModule::OnWheelEventProduced,
-                     base::Unretained(this)),
-          system_window)),
-      renderer_module_(system_window, RendererModuleWithCameraOptions(
-                                          options.renderer_module_options,
-                                          input_device_manager_->camera_3d())),
 #if defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
       array_buffer_allocator_(
           new ResourceProviderArrayBufferAllocator(GetResourceProvider())),
       array_buffer_cache_(new dom::ArrayBuffer::Cache(3 * 1024 * 1024)),
 #endif  // defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
-      network_module_(&storage_manager_, system_window->event_dispatcher(),
-                      options.network_module_options),
-      render_tree_combiner_(&renderer_module_,
-                            renderer_module_.render_target()->GetSize()),
-#if defined(ENABLE_SCREENSHOT)
-      screen_shot_writer_(new ScreenShotWriter(renderer_module_.pipeline())),
-#endif  // defined(ENABLE_SCREENSHOT)
+      network_module_(&storage_manager_, event_dispatcher_,
+                      options_.network_module_options),
       web_module_loaded_(true /* manually_reset */,
                          false /* initially_signalled */),
-      web_module_recreated_callback_(options.web_module_recreated_callback),
+      web_module_recreated_callback_(options_.web_module_recreated_callback),
       navigate_time_("Time.Browser.Navigate", 0,
                      "The last time a navigation occurred."),
       on_load_event_time_("Time.Browser.OnLoadEvent", 0,
@@ -270,15 +269,12 @@
           kScreenshotCommandShortHelp, kScreenshotCommandLongHelp)),
 #endif  // defined(ENABLE_SCREENSHOT)
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
-      ALLOW_THIS_IN_INITIALIZER_LIST(h5vcc_url_handler_(this, system_window)),
-      web_module_options_(options.web_module_options),
       has_resumed_(true, false),
 #if defined(COBALT_CHECK_RENDER_TIMEOUT)
       timeout_polling_thread_(kTimeoutPollingThreadName),
       render_timeout_count_(0),
 #endif
       will_quit_(false),
-      system_window_(system_window),
       application_state_(initial_application_state) {
 #if SB_HAS(CORE_DUMP_HANDLER_SUPPORT)
   SbCoreDumpRegisterHandler(BrowserModule::CoreDumpHandler, this);
@@ -297,36 +293,17 @@
       base::TimeDelta::FromSeconds(kRenderTimeOutPollingDelaySeconds));
 #endif
   TRACE_EVENT0("cobalt::browser", "BrowserModule::BrowserModule()");
-  // All allocations for media will be tracked by "Media" memory scope.
-  {
-    TRACK_MEMORY_SCOPE("Media");
-    math::Size output_size = renderer_module_.render_target()->GetSize();
-    if (system_window->GetVideoPixelRatio() != 1.f) {
-      output_size.set_width(
-          static_cast<int>(static_cast<float>(output_size.width()) *
-                           system_window->GetVideoPixelRatio()));
-      output_size.set_height(
-          static_cast<int>(static_cast<float>(output_size.height()) *
-                           system_window->GetVideoPixelRatio()));
-    }
-#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
-    GetVideoContainerSizeOverride(&output_size);
-#endif
-
-    media_module_ = (media::MediaModule::Create(system_window, output_size,
-                                                GetResourceProvider(),
-                                                options.media_module_options));
-  }
 
   // Setup our main web module to have the H5VCC API injected into it.
-  DCHECK(!ContainsKey(web_module_options_.injected_window_attributes, "h5vcc"));
+  DCHECK(!ContainsKey(options_.web_module_options.injected_window_attributes,
+                      "h5vcc"));
   h5vcc::H5vcc::Settings h5vcc_settings;
   h5vcc_settings.media_module = media_module_.get();
   h5vcc_settings.network_module = &network_module_;
   h5vcc_settings.account_manager = account_manager;
-  h5vcc_settings.event_dispatcher = system_window->event_dispatcher();
-  h5vcc_settings.initial_deep_link = options.initial_deep_link;
-  web_module_options_.injected_window_attributes["h5vcc"] =
+  h5vcc_settings.event_dispatcher = event_dispatcher_;
+  h5vcc_settings.initial_deep_link = options_.initial_deep_link;
+  options_.web_module_options.injected_window_attributes["h5vcc"] =
       base::Bind(&CreateH5VCC, h5vcc_settings);
 
 #if defined(ENABLE_DEBUG_CONSOLE) && defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
@@ -341,24 +318,24 @@
   }
 #endif  // ENABLE_DEBUG_CONSOLE && ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
+  if (application_state_ == base::kApplicationStateStarted ||
+      application_state_ == base::kApplicationStatePaused) {
+    InitializeSystemWindow();
+  }
+
 #if defined(ENABLE_DEBUG_CONSOLE)
   debug_console_.reset(new DebugConsole(
       application_state_,
       base::Bind(&BrowserModule::QueueOnDebugConsoleRenderTreeProduced,
                  base::Unretained(this)),
-      media_module_.get(), &network_module_,
-      renderer_module_.render_target()->GetSize(), GetResourceProvider(),
+      &network_module_, GetViewportSize(), GetResourceProvider(),
       kLayoutMaxRefreshFrequencyInHz,
       base::Bind(&BrowserModule::GetDebugServer, base::Unretained(this)),
-      web_module_options_.javascript_options));
+      options_.web_module_options.javascript_options));
   lifecycle_observers_.AddObserver(debug_console_.get());
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
-  // Always render the debug console. It will draw nothing if disabled.
-  // This setting is ignored if ENABLE_DEBUG_CONSOLE is not defined.
-  // TODO: Render tree combiner should probably be refactored.
-  render_tree_combiner_.set_render_debug_console(true);
-
+  splash_screen_url_ = options.splash_screen_url;
   // Synchronously construct our WebModule object.
   NavigateInternal(url);
   DCHECK(web_module_);
@@ -429,22 +406,24 @@
   navigate_time_ = base::TimeTicks::Now().ToInternalValue();
 
   // Show a splash screen while we're waiting for the web page to load.
-  const math::Size& viewport_size = renderer_module_.render_target()->GetSize();
+  const math::Size& viewport_size = GetViewportSize();
   DestroySplashScreen();
-  splash_screen_.reset(
-      new SplashScreen(application_state_,
-                       base::Bind(&BrowserModule::QueueOnRenderTreeProduced,
-                                  base::Unretained(this)),
-                       &network_module_, viewport_size, GetResourceProvider(),
-                       kLayoutMaxRefreshFrequencyInHz));
-  lifecycle_observers_.AddObserver(splash_screen_.get());
+  if (splash_screen_url_) {
+    splash_screen_.reset(
+        new SplashScreen(application_state_,
+                         base::Bind(&BrowserModule::QueueOnRenderTreeProduced,
+                                    base::Unretained(this)),
+                         &network_module_, viewport_size, GetResourceProvider(),
+                         kLayoutMaxRefreshFrequencyInHz, *splash_screen_url_));
+    lifecycle_observers_.AddObserver(splash_screen_.get());
+  }
 
   // Create new WebModule.
 #if !defined(COBALT_FORCE_CSP)
-  web_module_options_.csp_insecure_allowed_token =
+  options_.web_module_options.csp_insecure_allowed_token =
       dom::CspDelegateFactory::GetInsecureAllowedToken();
 #endif
-  WebModule::Options options(web_module_options_);
+  WebModule::Options options(options_.web_module_options);
   options.navigation_callback =
       base::Bind(&BrowserModule::Navigate, base::Unretained(this));
   options.loaded_callbacks.push_back(
@@ -464,7 +443,15 @@
 
   options.image_cache_capacity_multiplier_when_playing_video =
       COBALT_IMAGE_CACHE_CAPACITY_MULTIPLIER_WHEN_PLAYING_VIDEO;
-  options.camera_3d = input_device_manager_->camera_3d();
+  if (input_device_manager_) {
+    options.camera_3d = input_device_manager_->camera_3d();
+  }
+
+  float video_pixel_ratio = 1.0f;
+  if (system_window_) {
+    video_pixel_ratio = system_window_->GetVideoPixelRatio();
+  }
+
   web_module_.reset(new WebModule(
       url, application_state_,
       base::Bind(&BrowserModule::QueueOnRenderTreeProduced,
@@ -472,9 +459,8 @@
       base::Bind(&BrowserModule::OnError, base::Unretained(this)),
       base::Bind(&BrowserModule::OnWindowClose, base::Unretained(this)),
       base::Bind(&BrowserModule::OnWindowMinimize, base::Unretained(this)),
-      media_module_.get(), &network_module_, viewport_size,
-      GetResourceProvider(), system_window_, kLayoutMaxRefreshFrequencyInHz,
-      options));
+      media_module_.get(), &network_module_, viewport_size, video_pixel_ratio,
+      GetResourceProvider(), kLayoutMaxRefreshFrequencyInHz, options));
   lifecycle_observers_.AddObserver(web_module_.get());
   if (!web_module_recreated_callback_.is_null()) {
     web_module_recreated_callback_.Run();
@@ -541,6 +527,9 @@
     const browser::WebModule::LayoutResults& layout_results) {
   TRACE_EVENT0("cobalt::browser", "BrowserModule::OnRenderTreeProduced()");
   DCHECK_EQ(MessageLoop::current(), self_message_loop_);
+  if (!render_tree_combiner_) {
+    return;
+  }
 
   renderer::Submission renderer_submission(layout_results.render_tree,
                                            layout_results.layout_time);
@@ -548,7 +537,7 @@
   renderer_submission.on_rasterized_callback = base::Bind(
       &BrowserModule::OnRendererSubmissionRasterized, base::Unretained(this));
 #endif  // OS_STARBOARD
-  render_tree_combiner_.UpdateMainRenderTree(renderer_submission);
+  render_tree_combiner_->UpdateMainRenderTree(renderer_submission);
 
 #if defined(ENABLE_SCREENSHOT)
   screen_shot_writer_->SetLastPipelineSubmission(renderer::Submission(
@@ -645,13 +634,16 @@
   TRACE_EVENT0("cobalt::browser",
                "BrowserModule::OnDebugConsoleRenderTreeProduced()");
   DCHECK_EQ(MessageLoop::current(), self_message_loop_);
-
-  if (debug_console_->GetMode() == debug::DebugHub::kDebugConsoleOff) {
-    render_tree_combiner_.UpdateDebugConsoleRenderTree(base::nullopt);
+  if (!render_tree_combiner_) {
     return;
   }
 
-  render_tree_combiner_.UpdateDebugConsoleRenderTree(renderer::Submission(
+  if (debug_console_->GetMode() == debug::DebugHub::kDebugConsoleOff) {
+    render_tree_combiner_->UpdateDebugConsoleRenderTree(base::nullopt);
+    return;
+  }
+
+  render_tree_combiner_->UpdateDebugConsoleRenderTree(renderer::Submission(
       layout_results.render_tree, layout_results.layout_time));
 }
 
@@ -918,29 +910,38 @@
   // The screenshot writer may be holding on to a reference to a render tree
   // which could in turn be referencing resources like images, so clear that
   // out.
-  screen_shot_writer_->ClearLastPipelineSubmission();
+  if (screen_shot_writer_) {
+    screen_shot_writer_->ClearLastPipelineSubmission();
+  }
 #endif
 
   // Clear out the render tree combiner so that it doesn't hold on to any
   // render tree resources either.
-  render_tree_combiner_.Reset();
+  if (render_tree_combiner_) {
+    render_tree_combiner_->Reset();
+  }
 
 #if defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
   // Note that the following function call will leak the GPU memory allocated.
-  // This is because after renderer_module_.Suspend() is called it is no longer
+  // This is because after renderer_module_->Suspend() is called it is no longer
   // safe to release the GPU memory allocated.
-  // The following code can call reset() to release the allocated memory but
-  // the memory may still be used by XHR and ArrayBuffer.  As this feature is
-  // only used on platform without Resume() support, it is safer to leak the
-  // memory then to release it.
+  //
+  // The following code can call reset() to release the allocated memory but the
+  // memory may still be used by XHR and ArrayBuffer.  As this feature is only
+  // used on platform without Resume() support, it is safer to leak the memory
+  // then to release it.
   dom::ArrayBuffer::Allocator* allocator = array_buffer_allocator_.release();
 #endif  // defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
 
-  media_module_->Suspend();
+  if (media_module_) {
+    media_module_->Suspend();
+  }
 
-  // Place the renderer module into a suspended state where it releases all its
-  // graphical resources.
-  renderer_module_.Suspend();
+  if (renderer_module_) {
+    // Place the renderer module into a suspended state where it releases all
+    // its graphical resources.
+    renderer_module_->Suspend();
+  }
 
   application_state_ = base::kApplicationStateSuspended;
 }
@@ -949,7 +950,7 @@
   TRACE_EVENT0("cobalt::browser", "BrowserModule::Resume()");
   DCHECK(application_state_ == base::kApplicationStateSuspended);
 
-  renderer_module_.Resume();
+  renderer_module_->Resume();
 
   // Note that at this point, it is probable that this resource provider is
   // different than the one that was managed in the associated call to
@@ -970,6 +971,13 @@
   application_state_ = base::kApplicationStatePaused;
 }
 
+void BrowserModule::CheckMemory(
+    const int64_t& used_cpu_memory,
+    const base::optional<int64_t>& used_gpu_memory) {
+  memory_settings_checker_.RunChecks(*auto_mem_, used_cpu_memory,
+                                     used_gpu_memory);
+}
+
 #if defined(OS_STARBOARD)
 void BrowserModule::OnRendererSubmissionRasterized() {
   TRACE_EVENT0("cobalt::browser",
@@ -1030,7 +1038,77 @@
 #endif
 
 render_tree::ResourceProvider* BrowserModule::GetResourceProvider() {
-  return renderer_module_.resource_provider();
+  if (!renderer_module_) {
+    return NULL;
+  }
+
+  return renderer_module_->resource_provider();
+}
+
+void BrowserModule::InitializeSystemWindow() {
+  system_window_.reset(new system_window::SystemWindow(
+      event_dispatcher_, options_.requested_viewport_size));
+
+  auto_mem_.reset(new memory_settings::AutoMem(
+      GetViewportSize(), options_.command_line_auto_mem_settings,
+      options_.build_auto_mem_settings));
+  ApplyAutoMemSettings(*auto_mem_, &options_);
+
+  input_device_manager_ = input::InputDeviceManager::CreateFromWindow(
+                              base::Bind(&BrowserModule::OnKeyEventProduced,
+                                         base::Unretained(this)),
+                              base::Bind(&BrowserModule::OnPointerEventProduced,
+                                         base::Unretained(this)),
+                              base::Bind(&BrowserModule::OnWheelEventProduced,
+                                         base::Unretained(this)),
+                              system_window_.get())
+                              .Pass();
+  renderer_module_.reset(new renderer::RendererModule(
+      system_window_.get(),
+      RendererModuleWithCameraOptions(options_.renderer_module_options,
+                                      input_device_manager_->camera_3d())));
+
+  render_tree_combiner_.reset(
+      new RenderTreeCombiner(renderer_module_.get(), GetViewportSize()));
+
+  // Always render the debug console. It will draw nothing if disabled.
+  // This setting is ignored if ENABLE_DEBUG_CONSOLE is not defined.
+  // TODO: Render tree combiner should probably be refactored.
+  render_tree_combiner_->set_render_debug_console(true);
+
+#if defined(ENABLE_SCREENSHOT)
+  screen_shot_writer_.reset(new ScreenShotWriter(renderer_module_->pipeline()));
+#endif  // defined(ENABLE_SCREENSHOT)
+  // TODO: Pass in dialog closure instead of system window.
+  h5vcc_url_handler_.reset(new H5vccURLHandler(this, system_window_.get()));
+
+  media_module_ =
+      media::MediaModule::Create(system_window_.get(), GetResourceProvider(),
+                                 options_.media_module_options);
+}
+
+math::Size BrowserModule::GetViewportSize() {
+  // We trust the renderer module the most, if it exists.
+  if (renderer_module_) {
+    return renderer_module_->render_target_size();
+  }
+
+  // If the system window exists, that's almost just as good.
+  if (system_window_) {
+    return system_window_->GetWindowSize();
+  }
+
+  // Otherwise, we assume we'll get the viewport size that was requested.
+  if (options_.requested_viewport_size) {
+    return *options_.requested_viewport_size;
+  }
+
+  // TODO: Allow platforms to define the default window size and return that
+  // here.
+
+  // No window and no viewport size was requested, so we return a conservative
+  // default.
+  return math::Size(1280, 720);
 }
 
 }  // namespace browser
diff --git a/src/cobalt/browser/browser_module.h b/src/cobalt/browser/browser_module.h
index 2f12650..066aa04 100644
--- a/src/cobalt/browser/browser_module.h
+++ b/src/cobalt/browser/browser_module.h
@@ -28,6 +28,8 @@
 #include "cobalt/base/message_queue.h"
 #include "cobalt/browser/h5vcc_url_handler.h"
 #include "cobalt/browser/lifecycle_observer.h"
+#include "cobalt/browser/memory_settings/auto_mem.h"
+#include "cobalt/browser/memory_settings/checker.h"
 #include "cobalt/browser/render_tree_combiner.h"
 #include "cobalt/browser/screen_shot_writer.h"
 #include "cobalt/browser/splash_screen.h"
@@ -66,7 +68,11 @@
   // setup reasonable default options.
   struct Options {
     explicit Options(const WebModule::Options& web_options)
-        : web_module_options(web_options) {}
+        : web_module_options(web_options),
+          command_line_auto_mem_settings(
+              memory_settings::AutoMemSettings::kTypeCommandLine),
+          build_auto_mem_settings(
+              memory_settings::AutoMemSettings::kTypeBuild) {}
     network::NetworkModule::Options network_module_options;
     renderer::RendererModule::Options renderer_module_options;
     storage::StorageManager::Options storage_manager_options;
@@ -75,6 +81,10 @@
     std::string language;
     std::string initial_deep_link;
     base::Closure web_module_recreated_callback;
+    memory_settings::AutoMemSettings command_line_auto_mem_settings;
+    memory_settings::AutoMemSettings build_auto_mem_settings;
+    base::optional<GURL> splash_screen_url;
+    base::optional<math::Size> requested_viewport_size;
   };
 
   // Type for a collection of URL handler callbacks that can potentially handle
@@ -83,7 +93,7 @@
 
   BrowserModule(const GURL& url,
                 base::ApplicationState initial_application_state,
-                system_window::SystemWindow* system_window,
+                base::EventDispatcher* event_dispatcher,
                 account::AccountManager* account_manager,
                 const Options& options);
   ~BrowserModule();
@@ -130,6 +140,9 @@
   void Suspend();
   void Resume();
 
+  void CheckMemory(const int64_t& used_cpu_memory,
+                   const base::optional<int64_t>& used_gpu_memory);
+
  private:
 #if SB_HAS(CORE_DUMP_HANDLER_SUPPORT)
   static void CoreDumpHandler(void* browser_module_as_void);
@@ -237,11 +250,9 @@
       scoped_ptr<webdriver::WindowDriver>* out_window_driver);
 #endif
 
-#if defined(OS_STARBOARD)
   // Called when a renderer submission has been rasterized. Used to hide the
   // system splash screen after the first render has completed.
   void OnRendererSubmissionRasterized();
-#endif  // OS_STARBOARD
 
   // Process all messages queued into the |render_tree_submission_queue_|.
   void ProcessRenderTreeSubmissionQueue();
@@ -251,8 +262,19 @@
   void OnPollForRenderTimeout(const GURL& url);
 #endif
 
+  // Gets the current resource provider.
   render_tree::ResourceProvider* GetResourceProvider();
 
+  // Initializes the system window, and all components that require it.
+  void InitializeSystemWindow();
+
+  // Gets a viewport size to use for now. This may change depending on the
+  // current application state. While preloading, this returns the requested
+  // viewport size. If there was no requested viewport size, it returns a
+  // default viewport size of 1280x720 (720p). Once a system window is created,
+  // it returns the confirmed size of the window.
+  math::Size GetViewportSize();
+
   // TODO:
   //     WeakPtr usage here can be avoided if BrowserModule has a thread to
   //     own where it can ensure that its tasks are all resolved when it is
@@ -271,6 +293,12 @@
   // |weak_ptr_factory_.GetWeakPtr() which is not).
   base::WeakPtr<BrowserModule> weak_this_;
 
+  // Memory configuration tool.
+  scoped_ptr<memory_settings::AutoMem> auto_mem_;
+
+  // A copy of the BrowserModule Options passed into the constructor.
+  Options options_;
+
   // The browser module runs on this message loop.
   MessageLoop* const self_message_loop_;
 
@@ -278,13 +306,17 @@
   // using it to initialize a new WebModule.
   URLHandlerCollection url_handlers_;
 
+  base::EventDispatcher* event_dispatcher_;
+
   storage::StorageManager storage_manager_;
 
-#if defined(OS_STARBOARD)
   // Whether the browser module has yet rendered anything. On the very first
   // render, we hide the system splash screen.
   bool is_rendered_;
-#endif  // OS_STARBOARD
+
+  // The main system window for our application. This routes input event
+  // callbacks, and provides a native window handle on desktop systems.
+  scoped_ptr<system_window::SystemWindow> system_window_;
 
   // Wraps input device and produces input events that can be passed into
   // the web module.
@@ -292,7 +324,7 @@
 
   // Sets up everything to do with graphics, from backend objects like the
   // display and graphics context to the rasterizer and rendering pipeline.
-  renderer::RendererModule renderer_module_;
+  scoped_ptr<renderer::RendererModule> renderer_module_;
 
   // Optional memory allocator used by ArrayBuffer.
   scoped_ptr<dom::ArrayBuffer::Allocator> array_buffer_allocator_;
@@ -307,7 +339,7 @@
   network::NetworkModule network_module_;
 
   // Manages the two render trees, combines and renders them.
-  RenderTreeCombiner render_tree_combiner_;
+  scoped_ptr<RenderTreeCombiner> render_tree_combiner_;
 
 #if defined(ENABLE_SCREENSHOT)
   // Helper object to create screen shots of the last layout tree.
@@ -366,10 +398,7 @@
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
   // Handler object for h5vcc URLs.
-  H5vccURLHandler h5vcc_url_handler_;
-
-  // WebModule options.
-  WebModule::Options web_module_options_;
+  scoped_ptr<H5vccURLHandler> h5vcc_url_handler_;
 
   // The splash screen. The pointer wrapped here should be non-NULL iff
   // the splash screen is currently displayed.
@@ -395,13 +424,19 @@
   // ensure synchronous access.
   base::Lock quit_lock_;
 
-  system_window::SystemWindow* system_window_;
-
   // The current application state.
   base::ApplicationState application_state_;
 
   // The list of LifecycleObserver that need to be managed.
   ObserverList<LifecycleObserver> lifecycle_observers_;
+
+  // Fires memory warning once when memory exceeds specified max cpu/gpu
+  // memory.
+  memory_settings::Checker memory_settings_checker_;
+
+  // The URL to the splash screen. If empty (the default), no splash
+  // screen will be displayed.
+  base::optional<GURL> splash_screen_url_;
 };
 
 }  // namespace browser
diff --git a/src/cobalt/browser/debug_console.cc b/src/cobalt/browser/debug_console.cc
index eaa2b2d..0813095 100644
--- a/src/cobalt/browser/debug_console.cc
+++ b/src/cobalt/browser/debug_console.cc
@@ -162,8 +162,7 @@
     base::ApplicationState initial_application_state,
     const WebModule::OnRenderTreeProducedCallback&
         render_tree_produced_callback,
-    media::MediaModule* media_module, network::NetworkModule* network_module,
-    const math::Size& window_dimensions,
+    network::NetworkModule* network_module, const math::Size& window_dimensions,
     render_tree::ResourceProvider* resource_provider, float layout_refresh_rate,
     const debug::Debugger::GetDebugServerCallback& get_debug_server_callback,
     const script::JavaScriptEngine::Options& js_options) {
@@ -187,14 +186,15 @@
       base::Bind(&CreateDebugHub,
                  base::Bind(&DebugConsole::GetMode, base::Unretained(this)),
                  get_debug_server_callback);
-  web_module_.reset(new WebModule(
-      GURL(kInitialDebugConsoleUrl), initial_application_state,
-      render_tree_produced_callback,
-      base::Bind(&DebugConsole::OnError, base::Unretained(this)),
-      base::Closure(), /* window_close_callback */
-      base::Closure(), /* window_minimize_callback */
-      media_module, network_module, window_dimensions, resource_provider,
-      media_module->system_window(), layout_refresh_rate, web_module_options));
+  web_module_.reset(
+      new WebModule(GURL(kInitialDebugConsoleUrl), initial_application_state,
+                    render_tree_produced_callback,
+                    base::Bind(&DebugConsole::OnError, base::Unretained(this)),
+                    base::Closure(), /* window_close_callback */
+                    base::Closure(), /* window_minimize_callback */
+                    &stub_media_module_, network_module, window_dimensions,
+                    1.f /*video_pixel_ratio*/, resource_provider,
+                    layout_refresh_rate, web_module_options));
 }
 
 DebugConsole::~DebugConsole() {}
diff --git a/src/cobalt/browser/debug_console.h b/src/cobalt/browser/debug_console.h
index 0a55b35..3782f40 100644
--- a/src/cobalt/browser/debug_console.h
+++ b/src/cobalt/browser/debug_console.h
@@ -21,11 +21,12 @@
 
 #include "base/callback.h"
 #include "base/logging.h"
-#include "cobalt/browser/lifecycle_observer.h"
 #include "cobalt/base/token.h"
+#include "cobalt/browser/lifecycle_observer.h"
 #include "cobalt/browser/web_module.h"
 #include "cobalt/debug/debug_hub.h"
 #include "cobalt/dom/keyboard_event_init.h"
+#include "cobalt/media/media_module_stub.h"
 #include "googleurl/src/gurl.h"
 
 namespace cobalt {
@@ -39,7 +40,7 @@
       base::ApplicationState initial_application_state,
       const WebModule::OnRenderTreeProducedCallback&
           render_tree_produced_callback,
-      media::MediaModule* media_module, network::NetworkModule* network_module,
+      network::NetworkModule* network_module,
       const math::Size& window_dimensions,
       render_tree::ResourceProvider* resource_provider,
       float layout_refresh_rate,
@@ -78,6 +79,8 @@
     LOG(ERROR) << error;
   }
 
+  media::MediaModuleStub stub_media_module_;
+
   // The current console visibility mode.  The mutex is required since the debug
   // console's visibility mode may be accessed from both the WebModule thread
   // and the DebugConsole's host thread.
diff --git a/src/cobalt/browser/main.cc b/src/cobalt/browser/main.cc
index 69af9ba..f237b47 100644
--- a/src/cobalt/browser/main.cc
+++ b/src/cobalt/browser/main.cc
@@ -24,10 +24,21 @@
 
 cobalt::browser::Application* g_application = NULL;
 
+void PreloadApplication(int /*argc*/, char** /*argv*/, const char* /*link*/,
+                        const base::Closure& quit_closure) {
+  DCHECK(!g_application);
+  g_application = cobalt::browser::PreloadApplication(quit_closure).release();
+  DCHECK(g_application);
+}
+
 void StartApplication(int /*argc*/, char** /*argv*/, const char* /*link*/,
                       const base::Closure& quit_closure) {
-  DCHECK(!g_application);
-  g_application = cobalt::browser::CreateApplication(quit_closure).release();
+  if (!g_application) {
+    g_application = cobalt::browser::CreateApplication(quit_closure).release();
+  } else {
+    g_application->Start();
+  }
+
   DCHECK(g_application);
 }
 
@@ -40,9 +51,8 @@
 }  // namespace
 
 #if defined(OS_STARBOARD)
-COBALT_WRAP_EVENT_MAIN(StartApplication,
-                       cobalt::browser::EventHandler::HandleEvent,
-                       StopApplication);
+COBALT_WRAP_MAIN(PreloadApplication, StartApplication,
+                 cobalt::browser::EventHandler::HandleEvent, StopApplication);
 #else
 COBALT_WRAP_BASE_MAIN(StartApplication, StopApplication);
 #endif
diff --git a/src/cobalt/browser/memory_settings/auto_mem.cc b/src/cobalt/browser/memory_settings/auto_mem.cc
index f17ec05..2d5df3a 100644
--- a/src/cobalt/browser/memory_settings/auto_mem.cc
+++ b/src/cobalt/browser/memory_settings/auto_mem.cc
@@ -26,7 +26,7 @@
 #include "base/string_number_conversions.h"
 #include "base/string_split.h"
 #include "base/stringprintf.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_settings/calculations.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/browser/memory_settings/constrainer.h"
@@ -42,23 +42,22 @@
 namespace memory_settings {
 namespace {
 
-// Determines if the string value signals "autoset".
-bool StringValueSignalsAutoset(const std::string& value) {
-  std::string value_lower_case = value;
-  std::transform(value_lower_case.begin(), value_lower_case.end(),
-                 value_lower_case.begin(), ::tolower);
-  bool is_autoset = (value_lower_case == "auto") ||
-                    (value_lower_case == "autoset") ||
-                    (value_lower_case == "-1");
-  return is_autoset;
+// Determines if the value signals "autoset".
+template <typename ValueType>
+bool SignalsAutoset(const ValueType& value) {
+  return (value < 0);
+}
+
+template <>
+bool SignalsAutoset(const TextureDimensions& value) {
+  return value.IsAutoset();
 }
 
 template <typename MemorySettingType, typename ValueType>
-void SetMemorySetting(
-    const CommandLine& cmd_line,  // Optional.
-    const base::optional<ValueType>& build_setting,
-    const ValueType& autoset_value,
-    MemorySettingType* setting) {
+void SetMemorySetting(const base::optional<ValueType>& command_line_setting,
+                      const base::optional<ValueType>& build_setting,
+                      const ValueType& autoset_value,
+                      MemorySettingType* setting) {
   const std::string setting_name = setting->name();
 
   // True when the command line explicitly requests the variable to be autoset.
@@ -67,13 +66,13 @@
   // The value is set according to importance:
   // 1) Command line switches are the most important, so set those if they
   //    exist.
-  if (cmd_line.HasSwitch(setting_name)) {
-    std::string value = cmd_line.GetSwitchValueNative(setting_name);
-    if (StringValueSignalsAutoset(value)) {
-      force_autoset = true;
-    } else if (setting->TryParseValue(MemorySetting::kCmdLine, value)) {
+  if (command_line_setting) {
+    if (!SignalsAutoset(*command_line_setting)) {
+      setting->set_value(MemorySetting::kCmdLine, *command_line_setting);
       return;
     }
+
+    force_autoset = true;
   }
 
   // 2) Is there a build setting? Then set to build_setting, unless the command
@@ -86,32 +85,30 @@
   }
 }
 
-// Creates the specified memory setting type and binds it to (1) command line
-// or else (2) build setting or else (3) an auto_set value.
+// Creates the specified memory setting type and binds it to (1) command line or
+// else (2) build setting or else (3) an auto_set value.
 template <typename MemorySettingType, typename ValueType>
 scoped_ptr<MemorySettingType> CreateMemorySetting(
     const char* setting_name,
-    const CommandLine& cmd_line,  // Optional.
+    const base::optional<ValueType>& command_line_setting,
     const base::optional<ValueType>& build_setting,
     const ValueType& autoset_value) {
   scoped_ptr<MemorySettingType> output(new MemorySettingType(setting_name));
-  SetMemorySetting(cmd_line, build_setting, autoset_value, output.get());
+  SetMemorySetting(command_line_setting, build_setting, autoset_value,
+                   output.get());
   return output.Pass();
 }
 
 scoped_ptr<IntSetting> CreateSystemMemorySetting(
-    const char* setting_name,
-    MemorySetting::MemoryType memory_type,
-    const CommandLine& command_line,
+    const char* setting_name, MemorySetting::MemoryType memory_type,
+    const base::optional<int64_t>& command_line_setting,
     const base::optional<int64_t>& build_setting,
     const base::optional<int64_t>& starboard_value) {
   scoped_ptr<IntSetting> setting(new IntSetting(setting_name));
   setting->set_memory_type(memory_type);
-  if (command_line.HasSwitch(setting_name)) {
-    const std::string value = command_line.GetSwitchValueNative(setting_name);
-    if (setting->TryParseValue(MemorySetting::kCmdLine, value)) {
-      return setting.Pass();
-    }
+  if (command_line_setting) {
+    setting->set_value(MemorySetting::kCmdLine, *command_line_setting);
+    return setting.Pass();
   }
 
   if (build_setting) {
@@ -178,35 +175,31 @@
 // Creates the GPU setting.
 // This setting is unique because it may not be defined by command line, or
 // build. In this was, it can be unset.
-scoped_ptr<IntSetting> CreateGpuSetting(const CommandLine& command_line,
-                                        const BuildSettings& build_settings) {
+scoped_ptr<IntSetting> CreateGpuSetting(
+    const AutoMemSettings& command_line_settings,
+    const AutoMemSettings& build_settings) {
   // Bind to the starboard api, if applicable.
   base::optional<int64_t> starboard_setting;
   if (SbSystemHasCapability(kSbSystemCapabilityCanQueryGPUMemoryStats)) {
     starboard_setting = SbSystemGetTotalGPUMemory();
   }
 
-  scoped_ptr<IntSetting> gpu_setting =
-      CreateSystemMemorySetting(
-          switches::kMaxCobaltGpuUsage,
-          MemorySetting::kGPU,
-          command_line,
-          build_settings.max_gpu_in_bytes,
-          starboard_setting);
+  scoped_ptr<IntSetting> gpu_setting = CreateSystemMemorySetting(
+      switches::kMaxCobaltGpuUsage, MemorySetting::kGPU,
+      command_line_settings.max_gpu_in_bytes, build_settings.max_gpu_in_bytes,
+      starboard_setting);
 
   EnsureValuePositive(gpu_setting.get());
   return gpu_setting.Pass();
 }
 
-scoped_ptr<IntSetting> CreateCpuSetting(const CommandLine& command_line,
-                                        const BuildSettings& build_settings) {
-  scoped_ptr<IntSetting> cpu_setting =
-      CreateSystemMemorySetting(
-          switches::kMaxCobaltCpuUsage,
-          MemorySetting::kCPU,
-          command_line,
-          build_settings.max_cpu_in_bytes,
-          SbSystemGetTotalCPUMemory());
+scoped_ptr<IntSetting> CreateCpuSetting(
+    const AutoMemSettings& command_line_settings,
+    const AutoMemSettings& build_settings) {
+  scoped_ptr<IntSetting> cpu_setting = CreateSystemMemorySetting(
+      switches::kMaxCobaltCpuUsage, MemorySetting::kCPU,
+      command_line_settings.max_cpu_in_bytes, build_settings.max_cpu_in_bytes,
+      SbSystemGetTotalCPUMemory());
 
   EnsureValuePositive(cpu_setting.get());
   return cpu_setting.Pass();
@@ -275,9 +268,9 @@
 }  // namespace
 
 AutoMem::AutoMem(const math::Size& ui_resolution,
-                 const CommandLine& command_line,
-                 const BuildSettings& build_settings) {
-  ConstructSettings(ui_resolution, command_line, build_settings);
+                 const AutoMemSettings& command_line_settings,
+                 const AutoMemSettings& build_settings) {
+  ConstructSettings(ui_resolution, command_line_settings, build_settings);
 
   const int64_t target_cpu_memory =
       GenerateTargetMemoryBytes(max_cpu_bytes_->value(),
@@ -329,6 +322,10 @@
   return software_surface_cache_size_in_bytes_.get();
 }
 
+const IntSetting* AutoMem::offscreen_target_cache_size_in_bytes() const {
+  return offscreen_target_cache_size_in_bytes_.get();
+}
+
 const IntSetting* AutoMem::max_cpu_bytes() const {
   return max_cpu_bytes_.get();
 }
@@ -356,6 +353,7 @@
   all_settings.push_back(javascript_gc_threshold_in_bytes_.get());
   all_settings.push_back(misc_cobalt_cpu_size_in_bytes_.get());
   all_settings.push_back(misc_cobalt_gpu_size_in_bytes_.get());
+  all_settings.push_back(offscreen_target_cache_size_in_bytes_.get());
   all_settings.push_back(remote_typeface_cache_size_in_bytes_.get());
   all_settings.push_back(skia_atlas_texture_dimensions_.get());
   all_settings.push_back(skia_cache_size_in_bytes_.get());
@@ -419,30 +417,25 @@
   return SumMemoryConsumption(memory_type, AllMemorySettings());
 }
 
-void AutoMem::ConstructSettings(
-    const math::Size& ui_resolution,
-    const CommandLine& command_line,
-    const BuildSettings& build_settings) {
-  max_cpu_bytes_ = CreateCpuSetting(command_line, build_settings);
-  max_gpu_bytes_ = CreateGpuSetting(command_line, build_settings);
+void AutoMem::ConstructSettings(const math::Size& ui_resolution,
+                                const AutoMemSettings& command_line_settings,
+                                const AutoMemSettings& build_settings) {
+  max_cpu_bytes_ = CreateCpuSetting(command_line_settings, build_settings);
+  max_gpu_bytes_ = CreateGpuSetting(command_line_settings, build_settings);
 
   reduced_cpu_bytes_ = CreateSystemMemorySetting(
-      switches::kReduceCpuMemoryBy,
-      MemorySetting::kCPU,
-      command_line,
-      build_settings.reduce_cpu_memory_by,
-      -1);
+      switches::kReduceCpuMemoryBy, MemorySetting::kCPU,
+      command_line_settings.reduce_cpu_memory_by,
+      build_settings.reduce_cpu_memory_by, -1);
   if (reduced_cpu_bytes_->value() == -1) {
     // This effectively disables the value from being used in the constrainer.
     reduced_cpu_bytes_->set_value(MemorySetting::kUnset, 0);
   }
 
   reduced_gpu_bytes_ = CreateSystemMemorySetting(
-      switches::kReduceGpuMemoryBy,
-      MemorySetting::kGPU,
-      command_line,
-      build_settings.reduce_gpu_memory_by,
-      -1);
+      switches::kReduceGpuMemoryBy, MemorySetting::kGPU,
+      command_line_settings.reduce_gpu_memory_by,
+      build_settings.reduce_gpu_memory_by, -1);
   if (reduced_cpu_bytes_->value() == -1) {
     // This effectively disables the value from being used in the constrainer.
     reduced_gpu_bytes_->set_value(MemorySetting::kUnset, 0);
@@ -451,7 +444,7 @@
   // Set the ImageCache
   image_cache_size_in_bytes_ = CreateMemorySetting<IntSetting, int64_t>(
       switches::kImageCacheSizeInBytes,
-      command_line,
+      command_line_settings.cobalt_image_cache_size_in_bytes,
       build_settings.cobalt_image_cache_size_in_bytes,
       CalculateImageCacheSize(ui_resolution));
   EnsureValuePositive(image_cache_size_in_bytes_.get());
@@ -465,10 +458,9 @@
   // Set javascript gc threshold
   JavaScriptGcThresholdSetting* js_setting = new JavaScriptGcThresholdSetting;
   SetMemorySetting<IntSetting, int64_t>(
-      command_line,
+      command_line_settings.javascript_garbage_collection_threshold_in_bytes,
       build_settings.javascript_garbage_collection_threshold_in_bytes,
-      kDefaultJsGarbageCollectionThresholdSize,
-      js_setting);
+      kDefaultJsGarbageCollectionThresholdSize, js_setting);
   EnsureValuePositive(js_setting);
   js_setting->PostInit();
   javascript_gc_threshold_in_bytes_.reset(js_setting);
@@ -489,15 +481,15 @@
   // Set remote_type_face_cache size.
   remote_typeface_cache_size_in_bytes_ =
       CreateMemorySetting<IntSetting, int64_t>(
-        switches::kRemoteTypefaceCacheSizeInBytes,
-        command_line,
-        build_settings.remote_typeface_cache_capacity_in_bytes,
-        kDefaultRemoteTypeFaceCacheSize);
+          switches::kRemoteTypefaceCacheSizeInBytes,
+          command_line_settings.remote_typeface_cache_capacity_in_bytes,
+          build_settings.remote_typeface_cache_capacity_in_bytes,
+          kDefaultRemoteTypeFaceCacheSize);
   EnsureValuePositive(remote_typeface_cache_size_in_bytes_.get());
 
   // Skia atlas texture dimensions.
   skia_atlas_texture_dimensions_.reset(new SkiaGlyphAtlasTextureSetting());
-  SetMemorySetting(command_line,
+  SetMemorySetting(command_line_settings.skia_texture_atlas_dimensions,
                    build_settings.skia_texture_atlas_dimensions,
                    CalculateSkiaGlyphAtlasTextureSize(ui_resolution),
                    skia_atlas_texture_dimensions_.get());
@@ -517,7 +509,7 @@
   // Set skia_cache_size_in_bytes
   skia_cache_size_in_bytes_ = CreateMemorySetting<IntSetting, int64_t>(
       switches::kSkiaCacheSizeInBytes,
-      command_line,
+      command_line_settings.skia_cache_size_in_bytes,
       build_settings.skia_cache_size_in_bytes,
       CalculateSkiaCacheSize(ui_resolution));
   // Not available for blitter platforms.
@@ -533,7 +525,7 @@
   software_surface_cache_size_in_bytes_ =
       CreateMemorySetting<IntSetting, int64_t>(
           switches::kSoftwareSurfaceCacheSizeInBytes,
-          command_line,
+          command_line_settings.software_surface_cache_size_in_bytes,
           build_settings.software_surface_cache_size_in_bytes,
           CalculateSoftwareSurfaceCacheSizeInBytes(ui_resolution));
   // Blitter only feature.
@@ -543,6 +535,24 @@
   }
   EnsureValuePositive(software_surface_cache_size_in_bytes_.get());
 
+  // Set offscreen_target_cache_size_in_bytes (relevant to the direct-gles
+  // rasterizer).
+  offscreen_target_cache_size_in_bytes_ =
+      CreateMemorySetting<IntSetting, int64_t>(
+          switches::kOffscreenTargetCacheSizeInBytes,
+          command_line_settings.offscreen_target_cache_size_in_bytes,
+          build_settings.offscreen_target_cache_size_in_bytes,
+          CalculateOffscreenTargetCacheSizeInBytes(ui_resolution));
+  offscreen_target_cache_size_in_bytes_->set_memory_scaling_function(
+      MakeLinearMemoryScaler(0.25, 1.0));
+#if defined(COBALT_FORCE_DIRECT_GLES_RASTERIZER)
+  offscreen_target_cache_size_in_bytes_->set_memory_type(MemorySetting::kGPU);
+#else
+  offscreen_target_cache_size_in_bytes_->set_memory_type(
+      MemorySetting::kNotApplicable);
+#endif
+  EnsureValuePositive(offscreen_target_cache_size_in_bytes_.get());
+
   // Final stage: Check that all constraining functions are monotonically
   // increasing.
   const std::vector<const MemorySetting*> all_memory_settings =
diff --git a/src/cobalt/browser/memory_settings/auto_mem.h b/src/cobalt/browser/memory_settings/auto_mem.h
index 66101e4..a04a5d9 100644
--- a/src/cobalt/browser/memory_settings/auto_mem.h
+++ b/src/cobalt/browser/memory_settings/auto_mem.h
@@ -17,14 +17,13 @@
 #ifndef COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_H_
 #define COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_H_
 
-#include <map>
 #include <string>
 #include <vector>
 
 #include "base/command_line.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_settings/memory_settings.h"
 #include "cobalt/math/size.h"
 #include "testing/gtest/include/gtest/gtest_prod.h"
@@ -39,8 +38,8 @@
 class AutoMem {
  public:
   explicit AutoMem(const math::Size& ui_resolution,
-                   const CommandLine& command_line,
-                   const BuildSettings& build_settings);
+                   const AutoMemSettings& command_line_settings,
+                   const AutoMemSettings& build_settings);
   ~AutoMem();
 
   const IntSetting* image_cache_size_in_bytes() const;
@@ -53,6 +52,7 @@
   const DimensionSetting* skia_atlas_texture_dimensions() const;
   const IntSetting* skia_cache_size_in_bytes() const;
   const IntSetting* software_surface_cache_size_in_bytes() const;
+  const IntSetting* offscreen_target_cache_size_in_bytes() const;
 
   // max_cpu/gpu_bytes represents the maximum amount of memory that should
   // be consumed by the engine. These values can be set by the command line
@@ -71,8 +71,8 @@
 
  private:
   void ConstructSettings(const math::Size& ui_resolution,
-                         const CommandLine& command_line,
-                         const BuildSettings& build_settings);
+                         const AutoMemSettings& command_line_settings,
+                         const AutoMemSettings& build_settings);
 
   // AllMemorySettings - does not include cpu & gpu max memory.
   std::vector<const MemorySetting*> AllMemorySettings() const;
@@ -87,6 +87,7 @@
   scoped_ptr<DimensionSetting> skia_atlas_texture_dimensions_;
   scoped_ptr<IntSetting> skia_cache_size_in_bytes_;
   scoped_ptr<IntSetting> software_surface_cache_size_in_bytes_;
+  scoped_ptr<IntSetting> offscreen_target_cache_size_in_bytes_;
 
   // These settings are used for constraining the memory and are NOT included
   // in AllMemorySettings().
diff --git a/src/cobalt/browser/memory_settings/auto_mem_settings.cc b/src/cobalt/browser/memory_settings/auto_mem_settings.cc
new file mode 100644
index 0000000..c5ecee4
--- /dev/null
+++ b/src/cobalt/browser/memory_settings/auto_mem_settings.cc
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
+
+#include <algorithm>
+#include <string>
+#include <vector>
+
+#include "base/optional.h"
+#include "base/string_number_conversions.h"
+#include "base/string_split.h"
+#include "cobalt/browser/memory_settings/constants.h"
+#include "cobalt/browser/switches.h"
+#include "nb/lexical_cast.h"
+
+namespace cobalt {
+namespace browser {
+namespace memory_settings {
+namespace {
+bool HasBlitter() {
+#if SB_HAS(BLITTER)
+  const bool has_blitter = true;
+#else
+  const bool has_blitter = false;
+#endif
+  return has_blitter;
+}
+
+base::optional<int64_t> MakeValidIfGreaterThanOrEqualToZero(int64_t value) {
+  base::optional<int64_t> output;
+  if (value >= 0) {
+    output = value;
+  }
+  return output;
+}
+
+base::optional<TextureDimensions> MakeDimensionsIfValid(TextureDimensions td) {
+  base::optional<TextureDimensions> output;
+  if ((td.width() > 0) && (td.height() > 0) && td.bytes_per_pixel() > 0) {
+    output = td;
+  }
+  return output;
+}
+
+char ToLowerCharTypesafe(int c) { return static_cast<char>(::tolower(c)); }
+
+std::string ToLower(const std::string& input) {
+  std::string value_str = input;
+  std::transform(value_str.begin(), value_str.end(), value_str.begin(),
+                 ToLowerCharTypesafe);
+
+  return value_str;
+}
+
+bool StringValueSignalsAutoset(const std::string& value) {
+  std::string value_lower_case = ToLower(value);
+  return ((value_lower_case == "auto") || (value_lower_case == "autoset") ||
+          (value_lower_case == "-1"));
+}
+
+struct ParsedIntValue {
+ public:
+  ParsedIntValue() : value_(0), error_(false) {}
+  ParsedIntValue(const ParsedIntValue& other)
+      : value_(other.value_), error_(other.error_) {}
+  int value_;
+  bool error_;  // true if there was a parse error.
+};
+
+// Parses a string like "1234x5678" to vector of parsed int values.
+std::vector<ParsedIntValue> ParseDimensions(const std::string& input) {
+  std::string value_str = ToLower(input);
+  std::vector<ParsedIntValue> output;
+
+  std::vector<std::string> lengths;
+  base::SplitString(value_str, 'x', &lengths);
+
+  for (size_t i = 0; i < lengths.size(); ++i) {
+    ParsedIntValue parsed_value;
+    parsed_value.error_ = !base::StringToInt(lengths[i], &parsed_value.value_);
+    output.push_back(parsed_value);
+  }
+  return output;
+}
+
+bool StringEndsWith(const std::string& value, const std::string& ending) {
+  if (ending.size() > value.size()) {
+    return false;
+  }
+  // Reverse search through the back of the string.
+  return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
+}
+
+// Handles bytes: "12435"
+// Handles kilobytes: "128KB"
+// Handles megabytes: "64MB"
+// Handles gigabytes: "1GB"
+// Handles fractional units for kilo/mega/gigabytes
+int64_t ParseMemoryValue(const std::string& value, bool* parse_ok) {
+  // nb::lexical_cast<> will parse out the number but it will ignore the
+  // unit part, such as "kb" or "mb".
+  double numerical_value = nb::lexical_cast<double>(value, parse_ok);
+  if (!(*parse_ok)) {
+    return static_cast<int64_t>(numerical_value);
+  }
+
+  // Lowercasing the string makes the units easier to detect.
+  std::string value_lower_case = ToLower(value);
+
+  if (StringEndsWith(value_lower_case, "kb")) {
+    numerical_value *= 1024;  // convert kb -> bytes.
+  } else if (StringEndsWith(value_lower_case, "mb")) {
+    numerical_value *= 1024 * 1024;  // convert mb -> bytes.
+  } else if (StringEndsWith(value_lower_case, "gb")) {
+    numerical_value *= 1024 * 1024 * 1024;  // convert gb -> bytes.
+  }
+  return static_cast<int64_t>(numerical_value);
+}
+
+template <typename ValueType>
+bool TryParseValue(base::optional<ValueType>* destination,
+                   const std::string& string_value);
+
+template <>
+bool TryParseValue<int64_t>(base::optional<int64_t>* destination,
+                            const std::string& string_value) {
+  bool parse_ok = false;
+  int64_t int_value = ParseMemoryValue(string_value, &parse_ok);
+
+  if (parse_ok) {
+    *destination = int_value;
+    return true;
+  }
+
+  LOG(ERROR) << "Invalid value for command line setting: " << string_value;
+  return false;
+}
+
+template <>
+bool TryParseValue<TextureDimensions>(
+    base::optional<TextureDimensions>* destination,
+    const std::string& string_value) {
+  std::vector<ParsedIntValue> int_values = ParseDimensions(string_value);
+
+  if ((int_values.size() < 2) || (int_values.size() > 3)) {
+    LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
+    return false;  // Parse failed.
+  }
+
+  for (size_t i = 0; i < int_values.size(); ++i) {
+    if (int_values[i].error_) {
+      LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
+      return false;  // Parse failed.
+    }
+  }
+
+  const int bytes_per_pixel = int_values.size() == 3
+                                  ? int_values[2].value_
+                                  : kSkiaGlyphAtlasTextureBytesPerPixel;
+
+  TextureDimensions tex_dimensions(int_values[0].value_, int_values[1].value_,
+                                   bytes_per_pixel);
+
+  *destination = tex_dimensions;
+  return true;
+}
+
+template <typename ValueType>
+ValueType GetAutosetValue();
+
+template <>
+int64_t GetAutosetValue() {
+  return -1;
+}
+
+template <>
+TextureDimensions GetAutosetValue() {
+  return TextureDimensions(-1, -1, -1);
+}
+
+template <typename ValueType>
+bool Set(const CommandLine& command_line, base::optional<ValueType>* setting,
+         const char* setting_name) {
+  if (!command_line.HasSwitch(setting_name)) {
+    return true;
+  }
+
+  std::string value = command_line.GetSwitchValueNative(setting_name);
+  if (StringValueSignalsAutoset(value)) {
+    *setting = GetAutosetValue<ValueType>();
+    return true;
+  }
+
+  return TryParseValue(setting, value);
+}
+}  // namespace
+
+AutoMemSettings GetDefaultBuildSettings() {
+  AutoMemSettings settings(AutoMemSettings::kTypeBuild);
+  settings.has_blitter = HasBlitter();
+
+  settings.cobalt_image_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_IMAGE_CACHE_SIZE_IN_BYTES);
+  settings.javascript_garbage_collection_threshold_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_JS_GARBAGE_COLLECTION_THRESHOLD_IN_BYTES);
+  settings.remote_typeface_cache_capacity_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_REMOTE_TYPEFACE_CACHE_SIZE_IN_BYTES);
+  settings.skia_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_SKIA_CACHE_SIZE_IN_BYTES);
+  settings.skia_texture_atlas_dimensions =
+      MakeDimensionsIfValid(TextureDimensions(
+          COBALT_SKIA_GLYPH_ATLAS_WIDTH, COBALT_SKIA_GLYPH_ATLAS_HEIGHT,
+          kSkiaGlyphAtlasTextureBytesPerPixel));
+
+  // Render tree node cache settings for various rasterizers.
+  settings.software_surface_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_SOFTWARE_SURFACE_CACHE_SIZE_IN_BYTES);
+  settings.offscreen_target_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_OFFSCREEN_TARGET_CACHE_SIZE_IN_BYTES);
+
+  settings.max_cpu_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_CPU_USAGE_IN_BYTES);
+  settings.max_gpu_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_GPU_USAGE_IN_BYTES);
+
+  settings.reduce_cpu_memory_by =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_CPU_MEMORY_BY);
+  settings.reduce_gpu_memory_by =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_GPU_MEMORY_BY);
+
+  return settings;
+}
+
+AutoMemSettings GetSettings(const CommandLine& command_line) {
+  AutoMemSettings settings(AutoMemSettings::kTypeCommandLine);
+  settings.has_blitter = HasBlitter();
+
+  Set(command_line, &settings.cobalt_image_cache_size_in_bytes,
+      switches::kImageCacheSizeInBytes);
+  Set(command_line, &settings.javascript_garbage_collection_threshold_in_bytes,
+      switches::kJavaScriptGcThresholdInBytes);
+  Set(command_line, &settings.remote_typeface_cache_capacity_in_bytes,
+      switches::kRemoteTypefaceCacheSizeInBytes);
+  Set(command_line, &settings.skia_cache_size_in_bytes,
+      switches::kSkiaCacheSizeInBytes);
+  Set(command_line, &settings.skia_texture_atlas_dimensions,
+      switches::kSkiaTextureAtlasDimensions);
+  Set(command_line, &settings.software_surface_cache_size_in_bytes,
+      switches::kSoftwareSurfaceCacheSizeInBytes);
+  Set(command_line, &settings.offscreen_target_cache_size_in_bytes,
+      switches::kOffscreenTargetCacheSizeInBytes);
+  Set(command_line, &settings.max_cpu_in_bytes, switches::kMaxCobaltCpuUsage);
+  Set(command_line, &settings.max_gpu_in_bytes, switches::kMaxCobaltGpuUsage);
+  Set(command_line, &settings.reduce_cpu_memory_by,
+      switches::kReduceCpuMemoryBy);
+  Set(command_line, &settings.reduce_gpu_memory_by,
+      switches::kReduceGpuMemoryBy);
+
+  return settings;
+}
+
+}  // namespace memory_settings
+}  // namespace browser
+}  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/build_settings.h b/src/cobalt/browser/memory_settings/auto_mem_settings.h
similarity index 70%
rename from src/cobalt/browser/memory_settings/build_settings.h
rename to src/cobalt/browser/memory_settings/auto_mem_settings.h
index ea29197..10f5bd8 100644
--- a/src/cobalt/browser/memory_settings/build_settings.h
+++ b/src/cobalt/browser/memory_settings/auto_mem_settings.h
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-#ifndef COBALT_BROWSER_MEMORY_SETTINGS_BUILD_SETTINGS_H_
-#define COBALT_BROWSER_MEMORY_SETTINGS_BUILD_SETTINGS_H_
+#ifndef COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_SETTINGS_H_
+#define COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_SETTINGS_H_
 
+#include "base/command_line.h"
 #include "base/optional.h"
 #include "cobalt/browser/memory_settings/texture_dimensions.h"
 #include "cobalt/math/size.h"
@@ -26,8 +27,19 @@
 namespace browser {
 namespace memory_settings {
 
-struct BuildSettings {
-  BuildSettings() : has_blitter(false), max_cpu_in_bytes(0) {}
+struct AutoMemSettings {
+  enum Type {
+    kTypeBuild,
+    kTypeCommandLine,
+  };
+
+  explicit AutoMemSettings(Type type) : type(type), has_blitter(false) {
+    if (type == kTypeBuild) {
+      max_cpu_in_bytes = 0;
+    }
+  }
+
+  Type type;
   bool has_blitter;
   base::optional<int64_t> cobalt_image_cache_size_in_bytes;
   base::optional<int64_t> javascript_garbage_collection_threshold_in_bytes;
@@ -35,6 +47,7 @@
   base::optional<int64_t> skia_cache_size_in_bytes;
   base::optional<TextureDimensions> skia_texture_atlas_dimensions;
   base::optional<int64_t> software_surface_cache_size_in_bytes;
+  base::optional<int64_t> offscreen_target_cache_size_in_bytes;
 
   base::optional<int64_t> max_cpu_in_bytes;
   base::optional<int64_t> max_gpu_in_bytes;
@@ -42,10 +55,11 @@
   base::optional<int64_t> reduce_gpu_memory_by;
 };
 
-BuildSettings GetDefaultBuildSettings();
+AutoMemSettings GetDefaultBuildSettings();
+AutoMemSettings GetSettings(const CommandLine& command_line);
 
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
 
-#endif  // COBALT_BROWSER_MEMORY_SETTINGS_BUILD_SETTINGS_H_
+#endif  // COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_SETTINGS_H_
diff --git a/src/cobalt/browser/memory_settings/auto_mem_settings_test.cc b/src/cobalt/browser/memory_settings/auto_mem_settings_test.cc
new file mode 100644
index 0000000..06bd7d2
--- /dev/null
+++ b/src/cobalt/browser/memory_settings/auto_mem_settings_test.cc
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
+
+#include <algorithm>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "cobalt/browser/memory_settings/test_common.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace cobalt {
+namespace browser {
+namespace memory_settings {
+namespace {
+CommandLine MakeCommandLine(const std::string& name, const std::string& value) {
+  CommandLine command_line(CommandLine::NO_PROGRAM);
+  command_line.AppendSwitchASCII(name, value);
+  return command_line;
+}
+
+void TestParseInt(const base::optional<int64_t>& expected,
+                  const std::string& value, const std::string& name,
+                  base::optional<int64_t>* setting) {
+#define TEST_EXTRAS                            \
+  "expected=" << expected << ", "              \
+              << "name=\"" << name << "\", "   \
+              << "value=\"" << value << "\", " \
+              << "setting=" << *setting
+
+  if (!expected) {
+    EXPECT_FALSE(*setting) << TEST_EXTRAS;
+    return;
+  }
+
+  EXPECT_TRUE(*setting) << TEST_EXTRAS;
+  if (!*setting) {
+    // Check and quit so we can continue on failure without a crash.
+    return;
+  }
+  EXPECT_EQ(expected, **setting) << TEST_EXTRAS;
+#undef TEST_EXTRAS
+}
+
+void TestAllParseInt(const base::optional<int64_t>& expected,
+                     const std::string& value) {
+#define TEST_PARSE_INT(expected, value, switch_name, field_name)      \
+  {                                                                   \
+    AutoMemSettings settings =                                        \
+        GetSettings(MakeCommandLine(switch_name, value));             \
+    TestParseInt(expected, value, switch_name, &settings.field_name); \
+  }
+
+  TEST_PARSE_INT(expected, value, switches::kImageCacheSizeInBytes,
+                 cobalt_image_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kJavaScriptGcThresholdInBytes,
+                 javascript_garbage_collection_threshold_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kRemoteTypefaceCacheSizeInBytes,
+                 remote_typeface_cache_capacity_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kSkiaCacheSizeInBytes,
+                 skia_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kSoftwareSurfaceCacheSizeInBytes,
+                 software_surface_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kOffscreenTargetCacheSizeInBytes,
+                 offscreen_target_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kMaxCobaltCpuUsage,
+                 max_cpu_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kMaxCobaltGpuUsage,
+                 max_gpu_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kReduceCpuMemoryBy,
+                 reduce_cpu_memory_by);
+  TEST_PARSE_INT(expected, value, switches::kReduceGpuMemoryBy,
+                 reduce_gpu_memory_by);
+#undef TEST_PARSE_INT
+}
+
+void TestParseDimensions(const base::optional<TextureDimensions>& expected,
+                         const std::string& value) {
+  CommandLine command_line(CommandLine::NO_PROGRAM);
+  command_line.AppendSwitchASCII(switches::kSkiaTextureAtlasDimensions, value);
+  AutoMemSettings settings = GetSettings(command_line);
+  if (!expected) {
+    EXPECT_FALSE(settings.skia_texture_atlas_dimensions);
+    return;
+  }
+  EXPECT_TRUE(settings.skia_texture_atlas_dimensions)
+      << " value=\"" << value << "\", expected=" << expected;
+  if (!settings.skia_texture_atlas_dimensions) {
+    return;
+  }
+  EXPECT_EQ(expected->width(), settings.skia_texture_atlas_dimensions->width())
+      << " value=\"" << value << "\", expected=" << expected;
+  EXPECT_EQ(expected->height(),
+            settings.skia_texture_atlas_dimensions->height())
+      << " value=\"" << value << "\", expected=" << expected;
+  EXPECT_EQ(expected->bytes_per_pixel(),
+            settings.skia_texture_atlas_dimensions->bytes_per_pixel())
+      << " value=\"" << value << "\", expected=" << expected;
+}
+}  // namespace
+
+TEST(AutoMemSettingsTest, InitialState) {
+  AutoMemSettings settings(AutoMemSettings::kTypeCommandLine);
+  EXPECT_EQ(AutoMemSettings::kTypeCommandLine, settings.type);
+  EXPECT_FALSE(settings.cobalt_image_cache_size_in_bytes);
+  EXPECT_FALSE(settings.javascript_garbage_collection_threshold_in_bytes);
+  EXPECT_FALSE(settings.remote_typeface_cache_capacity_in_bytes);
+  EXPECT_FALSE(settings.skia_cache_size_in_bytes);
+  EXPECT_FALSE(settings.skia_texture_atlas_dimensions);
+  EXPECT_FALSE(settings.software_surface_cache_size_in_bytes);
+  EXPECT_FALSE(settings.offscreen_target_cache_size_in_bytes);
+  EXPECT_FALSE(settings.max_cpu_in_bytes);
+  EXPECT_FALSE(settings.max_gpu_in_bytes);
+  EXPECT_FALSE(settings.reduce_cpu_memory_by);
+  EXPECT_FALSE(settings.reduce_gpu_memory_by);
+
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  EXPECT_EQ(AutoMemSettings::kTypeBuild, build_settings.type);
+  EXPECT_TRUE(build_settings.max_cpu_in_bytes);
+  EXPECT_EQ(0, *build_settings.max_cpu_in_bytes);
+}
+
+// Tests the expectation that numerous string variations (whole numbers vs
+// fractions vs units) parse correctly.
+TEST(AutoMemSettingsTest, ParseIntegers) {
+  // Autoset
+  TestAllParseInt(-1, "-1");
+  TestAllParseInt(-1, "auto");
+  TestAllParseInt(-1, "Auto");
+  TestAllParseInt(-1, "AUTO");
+  TestAllParseInt(-1, "autoset");
+  TestAllParseInt(-1, "AutoSet");
+  TestAllParseInt(-1, "AUTOSET");
+
+  // Bytes.
+  TestAllParseInt(1, "1");
+  TestAllParseInt(1, "1B");
+  TestAllParseInt(1, "1b");
+  TestAllParseInt(1, "1B");
+  TestAllParseInt(1, "1b");
+
+  // Kilobytes and fractional amounts.
+  TestAllParseInt(1024, "1KB");
+  TestAllParseInt(1024, "1Kb");
+  TestAllParseInt(1024, "1kB");
+  TestAllParseInt(1024, "1kb");
+
+  TestAllParseInt(512, ".5kb");
+  TestAllParseInt(512, "0.5kb");
+  TestAllParseInt(1536, "1.5kb");
+  TestAllParseInt(1536, "1.50kb");
+
+  // Megabytes and fractional amounts.
+  TestAllParseInt(1024 * 1024, "1MB");
+  TestAllParseInt(1024 * 1024, "1Mb");
+  TestAllParseInt(1024 * 1024, "1mB");
+  TestAllParseInt(1024 * 1024, "1mb");
+
+  TestAllParseInt(512 * 1024, ".5mb");
+  TestAllParseInt(512 * 1024, "0.5mb");
+  TestAllParseInt(1536 * 1024, "1.5mb");
+  TestAllParseInt(1536 * 1024, "1.50mb");
+
+  // Gigabytes and fractional amounts.
+  TestAllParseInt(1024 * 1024 * 1024, "1GB");
+  TestAllParseInt(1024 * 1024 * 1024, "1Gb");
+  TestAllParseInt(1024 * 1024 * 1024, "1gB");
+  TestAllParseInt(1024 * 1024 * 1024, "1gb");
+
+  TestAllParseInt(512 * 1024 * 1024, ".5gb");
+  TestAllParseInt(1536 * 1024 * 1024, "1.50gb");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsLower) {
+  TestParseDimensions(TextureDimensions(1234, 5678, 2), "1234x5678");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsOne) {
+  TestParseDimensions(base::nullopt, "1234");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsOneX) {
+  TestParseDimensions(base::nullopt, "1234x");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsTwoX) {
+  TestParseDimensions(base::nullopt, "1234x5678x");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsBadNum1) {
+  TestParseDimensions(base::nullopt, "ABCDx1234");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsBadNum2) {
+  TestParseDimensions(base::nullopt, "1234xABCD");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsUpper) {
+  TestParseDimensions(TextureDimensions(1234, 5678, 2), "1234X5678");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsBpp) {
+  TestParseDimensions(TextureDimensions(1234, 5678, 12), "1234X5678X12");
+  TestParseDimensions(TextureDimensions(1234, 5678, 1), "1234X5678x1");
+  TestParseDimensions(TextureDimensions(1234, 5678, 2), "1234x5678x2");
+  TestParseDimensions(TextureDimensions(1234, 5678, 3), "1234x5678X3");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsAuto) {
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "-1");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "auto");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "Auto");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "AUTO");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "autoset");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "AutoSet");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "AUTOSET");
+}
+
+}  // namespace memory_settings
+}  // namespace browser
+}  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/auto_mem_test.cc b/src/cobalt/browser/memory_settings/auto_mem_test.cc
index 1e289e7..9982a6f 100644
--- a/src/cobalt/browser/memory_settings/auto_mem_test.cc
+++ b/src/cobalt/browser/memory_settings/auto_mem_test.cc
@@ -20,7 +20,7 @@
 #include <vector>
 
 #include "base/optional.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_settings/calculations.h"
 #include "cobalt/browser/memory_settings/test_common.h"
 #include "cobalt/browser/switches.h"
@@ -47,13 +47,17 @@
   EXPECT_EQ(SOURCE, SETTING->source_type()) << " failure for "              \
                                             << SETTING->name();
 
+AutoMemSettings EmptyCommandLine() {
+  return AutoMemSettings(AutoMemSettings::kTypeCommandLine);
+}
+
 scoped_ptr<AutoMem> CreateDefaultAutoMem() {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   scoped_ptr<AutoMem> auto_mem(
-      new AutoMem(kResolution1080p, empty_command_line, build_settings));
+      new AutoMem(kResolution1080p, EmptyCommandLine(), build_settings));
   return auto_mem.Pass();
 }
+
 }  // namespace.
 
 // Tests the expectation that the command-line overrides will be applied.
@@ -61,21 +65,20 @@
 // also tested.
 TEST(AutoMem, CommandLineOverrides) {
   // Load up command line settings of command lines.
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kImageCacheSizeInBytes, "1234");
-  command_line.AppendSwitchASCII(switches::kJavaScriptGcThresholdInBytes,
-                                 "2345");
-  command_line.AppendSwitchASCII(switches::kSkiaCacheSizeInBytes, "3456");
-  command_line.AppendSwitchASCII(switches::kSkiaTextureAtlasDimensions,
-                                 "1234x5678");
-  command_line.AppendSwitchASCII(switches::kSoftwareSurfaceCacheSizeInBytes,
-                                 "4567");
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.cobalt_image_cache_size_in_bytes = 1234;
+  command_line_settings.javascript_garbage_collection_threshold_in_bytes = 2345;
+  command_line_settings.skia_cache_size_in_bytes = 3456;
+  command_line_settings.skia_texture_atlas_dimensions =
+      TextureDimensions(1234, 5678, 2);
+  command_line_settings.software_surface_cache_size_in_bytes = 4567;
+  command_line_settings.offscreen_target_cache_size_in_bytes = 5678;
 
   for (int i = 0; i <= 1; ++i) {
-    BuildSettings build_settings = GetDefaultBuildSettings();
+    AutoMemSettings build_settings = GetDefaultBuildSettings();
     build_settings.has_blitter = (i == 0);
 
-    AutoMem auto_mem(kResolution1080p, command_line, build_settings);
+    AutoMem auto_mem(kResolution1080p, command_line_settings, build_settings);
 
     // image_cache_size_in_bytes and javascript_gc_threshold_in_bytes settings
     // ignore the blitter type.
@@ -85,6 +88,11 @@
     EXPECT_MEMORY_SETTING(auto_mem.javascript_gc_threshold_in_bytes(),
                           MemorySetting::kCmdLine, MemorySetting::kCPU, 2345);
 
+    if (auto_mem.offscreen_target_cache_size_in_bytes()->valid()) {
+      EXPECT_MEMORY_SETTING(auto_mem.offscreen_target_cache_size_in_bytes(),
+                            MemorySetting::kCmdLine, MemorySetting::kGPU, 5678);
+    }
+
     // Certain features are only available for the blitter, and some features
     // are disabled, vice versa.
     if (build_settings.has_blitter) {
@@ -123,12 +131,12 @@
 // Tests the expectation that if the command line specifies that the variable
 // is "autoset" that the builtin setting is overriden.
 TEST(AutoMem, CommandLineSpecifiesAutoset) {
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kImageCacheSizeInBytes, "autoset");
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.cobalt_image_cache_size_in_bytes = -1;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.cobalt_image_cache_size_in_bytes = 1234;
 
-  AutoMem auto_mem(kResolution1080p, command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, command_line_settings, build_settings);
 
   EXPECT_MEMORY_SETTING(auto_mem.image_cache_size_in_bytes(),
                         MemorySetting::kAutoSet, MemorySetting::kGPU,
@@ -138,15 +146,14 @@
 // Tests that skia atlas texture will be bind to the built in value, iff it has
 // been set.
 TEST(AutoMem, SkiaGlyphAtlasTextureSize) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
-  BuildSettings build_settings_with_default;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMemSettings build_settings_with_default(AutoMemSettings::kTypeBuild);
 
   build_settings_with_default.skia_texture_atlas_dimensions =
       TextureDimensions(1234, 5678, 2);
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
-  AutoMem auto_mem_with_default(kResolution1080p, empty_command_line,
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
+  AutoMem auto_mem_with_default(kResolution1080p, EmptyCommandLine(),
                                 build_settings_with_default);
 
   // Expect that when the skia_atlas_texture_dimensions is specified in the
@@ -166,16 +173,15 @@
 // Tests that software surface cache will be bind to the built in value, iff
 // it has been set.
 TEST(AutoMem, SoftwareSurfaceCacheSizeInBytes) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
-  BuildSettings build_settings_with_default;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMemSettings build_settings_with_default(AutoMemSettings::kTypeBuild);
   // Enable the setting by enabling the blitter.
   build_settings.has_blitter = true;
   build_settings_with_default.has_blitter = true;
   build_settings_with_default.software_surface_cache_size_in_bytes = 1234;
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
-  AutoMem auto_mem_with_surface_cache(kResolution1080p, empty_command_line,
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
+  AutoMem auto_mem_with_surface_cache(kResolution1080p, EmptyCommandLine(),
                                       build_settings_with_default);
 
   // Expect that when the software_surface_cache_size_in_bytes is specified in
@@ -194,13 +200,12 @@
 // Tests that skia cache will be bind to the built in value, iff
 // it has been set.
 TEST(AutoMem, SkiaCacheSizeInBytes) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
-  BuildSettings build_settings_with_default;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMemSettings build_settings_with_default(AutoMemSettings::kTypeBuild);
   build_settings_with_default.skia_cache_size_in_bytes = 1234;
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
-  AutoMem auto_mem_with_skia_cache(kResolution1080p, empty_command_line,
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
+  AutoMem auto_mem_with_skia_cache(kResolution1080p, EmptyCommandLine(),
                                    build_settings_with_default);
 
   EXPECT_MEMORY_SETTING(auto_mem.skia_cache_size_in_bytes(),
@@ -213,10 +218,9 @@
 }
 
 TEST(AutoMem, AllMemorySettingsAreOrderedByName) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
 
   std::vector<const MemorySetting*> settings = auto_mem.AllMemorySettings();
 
@@ -228,29 +232,27 @@
 // Tests the expectation that constraining the CPU memory to kSmallEngineSize
 // will result in AutoMem reducing to the expected memory footprint.
 TEST(AutoMem, ConstrainedCPUEnvironment) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.max_cpu_in_bytes = kSmallEngineCpuMemorySize;
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
 
   const int64_t cpu_memory_consumption =
       auto_mem.SumAllMemoryOfType(MemorySetting::kCPU);
   EXPECT_LE(cpu_memory_consumption, kSmallEngineCpuMemorySize);
 }
 
-// Tests the expectation that constraining the CPU memory to 40MB will result
+// Tests the expectation that constraining the GPU memory will result
 // in AutoMem reducing the the memory footprint.
 TEST(AutoMem, ConstrainedGPUEnvironment) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.max_gpu_in_bytes = 57 * 1024 * 1024;
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
 
   std::vector<const MemorySetting*> settings = auto_mem.AllMemorySettings();
   const int64_t gpu_memory_consumption =
       SumMemoryConsumption(MemorySetting::kGPU, settings);
-  EXPECT_LE(gpu_memory_consumption, 57 * 1024 * 1024);
+  EXPECT_LE(gpu_memory_consumption, *build_settings.max_gpu_in_bytes);
 }
 
 // Tests the expectation that constraining the CPU memory to 40MB will result
@@ -260,13 +262,13 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "5MB");
-  BuildSettings build_settings;
-  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line,
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.reduce_cpu_memory_by = 5 * 1024 * 1024;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line_settings,
                                       build_settings);
 
-  EXPECT_EQ(5*1024*1024,
+  EXPECT_EQ(5 * 1024 * 1024,
             reduced_cpu_memory_auto_mem.reduced_cpu_bytes_->value());
 
   const int64_t original_memory_consumption =
@@ -274,7 +276,7 @@
   const int64_t reduced_memory_consumption =
       reduced_cpu_memory_auto_mem.SumAllMemoryOfType(MemorySetting::kCPU);
 
-  EXPECT_LE(5*1024*1024,
+  EXPECT_LE(5 * 1024 * 1024,
             original_memory_consumption - reduced_memory_consumption);
 }
 
@@ -285,12 +287,12 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kReduceGpuMemoryBy, "5MB");
-  BuildSettings build_settings;
-  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line,
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.reduce_gpu_memory_by = 5 * 1024 * 1024;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line_settings,
                                       build_settings);
-  EXPECT_EQ(5*1024*1024,
+  EXPECT_EQ(5 * 1024 * 1024,
             reduced_cpu_memory_auto_mem.reduced_gpu_bytes_->value());
 
   const int64_t original_memory_consumption =
@@ -298,7 +300,7 @@
   const int64_t reduced_memory_consumption =
       reduced_cpu_memory_auto_mem.SumAllMemoryOfType(MemorySetting::kGPU);
 
-  EXPECT_LE(5*1024*1024,
+  EXPECT_LE(5 * 1024 * 1024,
             original_memory_consumption - reduced_memory_consumption);
 }
 
@@ -309,14 +311,14 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "5MB");
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.reduce_cpu_memory_by = 5 * 1024 * 1024;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.max_cpu_in_bytes = 1;
-  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line,
+  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line_settings,
                                       build_settings);
 
-  EXPECT_EQ(5*1024*1024,
+  EXPECT_EQ(5 * 1024 * 1024,
             reduced_cpu_memory_auto_mem.reduced_cpu_bytes_->value());
 
   const int64_t original_memory_consumption =
@@ -326,7 +328,7 @@
 
   // Max_cpu_in_bytes specifies one byte of memory, but reduce must override
   // this for this test to pass.
-  EXPECT_LE(5*1024*1024,
+  EXPECT_LE(5 * 1024 * 1024,
             original_memory_consumption - reduced_memory_consumption);
 }
 
@@ -337,15 +339,15 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "0" will
   // override the max_cpu_in_bytes setting.
   build_settings.max_cpu_in_bytes = 1;
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "0");
+  command_line_settings.reduce_cpu_memory_by = 0;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
 
   const int64_t original_memory_consumption =
@@ -365,15 +367,15 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "0" will
   // override the max_cpu_in_bytes setting.
   build_settings.max_gpu_in_bytes = 1;
-  command_line.AppendSwitchASCII(switches::kReduceGpuMemoryBy, "0");
+  command_line_settings.reduce_gpu_memory_by = 0;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
 
   const int64_t original_memory_consumption =
@@ -390,16 +392,16 @@
 // will be effectively disabled and --max_cpu_bytes be used as the memory
 // reduction means.
 TEST(AutoMem, MaxCpuIsEnabledWhenReduceCpuMemoryIsExplicitlyDisabled) {
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "-1"
   // passed to the command line will cause max_cpu_in_bytes to be the
   // dominating memory reduction mechanism.
   build_settings.max_cpu_in_bytes = kSmallEngineGpuMemorySize;
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "-1");
+  command_line_settings.reduce_cpu_memory_by = -1;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
   const int64_t memory_consumption =
       auto_mem_no_reduce_cpu.SumAllMemoryOfType(MemorySetting::kCPU);
@@ -412,16 +414,16 @@
 // will be effectively disabled and --max_gpu_bytes be used as the memory
 // reduction means.
 TEST(AutoMem, MaxGpuIsEnabledWhenReduceCpuMemoryIsExplicitlyDisabled) {
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "-1"
   // passed to the command line will cause max_cpu_in_bytes to be the
   // dominating memory reduction mechanism.
-  build_settings.max_cpu_in_bytes = kSmallEngineGpuMemorySize;
-  command_line.AppendSwitchASCII(switches::kReduceGpuMemoryBy, "-1");
+  build_settings.max_gpu_in_bytes = kSmallEngineGpuMemorySize;
+  command_line_settings.reduce_gpu_memory_by = -1;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
   const int64_t memory_consumption =
       auto_mem_no_reduce_cpu.SumAllMemoryOfType(MemorySetting::kGPU);
diff --git a/src/cobalt/browser/memory_settings/build_settings.cc b/src/cobalt/browser/memory_settings/build_settings.cc
deleted file mode 100644
index 1019eab..0000000
--- a/src/cobalt/browser/memory_settings/build_settings.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2017 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "cobalt/browser/memory_settings/build_settings.h"
-
-#include "base/optional.h"
-#include "cobalt/browser/memory_settings/constants.h"
-
-namespace cobalt {
-namespace browser {
-namespace memory_settings {
-namespace {
-bool HasBlitter() {
-#if SB_HAS(BLITTER)
-  const bool has_blitter = true;
-#else
-  const bool has_blitter = false;
-#endif
-  return has_blitter;
-}
-
-base::optional<int64_t> MakeValidIfGreaterThanOrEqualToZero(int64_t value) {
-  base::optional<int64_t> output;
-  if (value >= 0) {
-    output = value;
-  }
-  return output;
-}
-
-base::optional<TextureDimensions> MakeDimensionsIfValid(TextureDimensions td) {
-  base::optional<TextureDimensions> output;
-  if ((td.width() > 0) && (td.height() > 0) && td.bytes_per_pixel() > 0) {
-    output = td;
-  }
-  return output;
-}
-
-}  // namespace
-
-BuildSettings GetDefaultBuildSettings() {
-  BuildSettings settings;
-  settings.has_blitter = HasBlitter();
-
-  settings.cobalt_image_cache_size_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_IMAGE_CACHE_SIZE_IN_BYTES);
-  settings.javascript_garbage_collection_threshold_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(
-          COBALT_JS_GARBAGE_COLLECTION_THRESHOLD_IN_BYTES);
-  settings.remote_typeface_cache_capacity_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(
-          COBALT_REMOTE_TYPEFACE_CACHE_SIZE_IN_BYTES);
-  settings.skia_cache_size_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_SKIA_CACHE_SIZE_IN_BYTES);
-  settings.skia_texture_atlas_dimensions =
-      MakeDimensionsIfValid(
-          TextureDimensions(COBALT_SKIA_GLYPH_ATLAS_WIDTH,
-                            COBALT_SKIA_GLYPH_ATLAS_HEIGHT,
-                            kSkiaGlyphAtlasTextureBytesPerPixel));
-  settings.software_surface_cache_size_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(
-          COBALT_SOFTWARE_SURFACE_CACHE_SIZE_IN_BYTES);
-
-  settings.max_cpu_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_CPU_USAGE_IN_BYTES);
-  settings.max_gpu_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_GPU_USAGE_IN_BYTES);
-
-  settings.reduce_cpu_memory_by =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_CPU_MEMORY_BY);
-  settings.reduce_gpu_memory_by =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_GPU_MEMORY_BY);
-
-  return settings;
-}
-
-}  // namespace memory_settings
-}  // namespace browser
-}  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/calculations.cc b/src/cobalt/browser/memory_settings/calculations.cc
index 8474f65..9976132 100644
--- a/src/cobalt/browser/memory_settings/calculations.cc
+++ b/src/cobalt/browser/memory_settings/calculations.cc
@@ -18,7 +18,6 @@
 
 #include <algorithm>
 
-#include "cobalt/browser/memory_settings/build_settings.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/math/clamp.h"
 #include "cobalt/math/size.h"
@@ -28,6 +27,26 @@
 namespace memory_settings {
 namespace {
 
+int32_t NextPowerOf2(int32_t num) {
+  // Return the smallest power of 2 that is greater than or equal to num.
+  // This flips on all bits <= num, then num+1 will be the next power of 2.
+  --num;
+  num |= num >> 1;
+  num |= num >> 2;
+  num |= num >> 4;
+  num |= num >> 8;
+  num |= num >> 16;
+  return num + 1;
+}
+
+int32_t NearestPowerOf2(int32_t num) {
+  int32_t nearest = NextPowerOf2(num);
+  if (static_cast<float>(nearest) / num > 1.5f) {
+    nearest /= 2;
+  }
+  return nearest;
+}
+
 double DisplayScaleTo1080p(const math::Size& dimensions) {
   static const double kNumReferencePixels = 1920. * 1080.;
   const double num_pixels = static_cast<double>(dimensions.width()) *
@@ -137,6 +156,17 @@
   return surface_cache_size_in_bytes;
 }
 
+int64_t CalculateOffscreenTargetCacheSizeInBytes(
+    const math::Size& ui_resolution) {
+  // The offscreen target cache size should be at least half the ui_resolution
+  // rounded to the nearest power of 2.
+  int width = NearestPowerOf2(ui_resolution.width());
+  int height = NearestPowerOf2(ui_resolution.height());
+
+  // The surface cache uses RGBA format so requires 4 bytes per pixel.
+  return (width * height / 2) * 4;
+}
+
 int64_t CalculateSkiaCacheSize(const math::Size& ui_resolution) {
   // This is normalized return 4MB @ 1080p and scales accordingly.
   LinearRemap remap(0, 1920 * 1080, 0, 4 * 1024 * 1024);
diff --git a/src/cobalt/browser/memory_settings/calculations.h b/src/cobalt/browser/memory_settings/calculations.h
index bc4a65a..421313f 100644
--- a/src/cobalt/browser/memory_settings/calculations.h
+++ b/src/cobalt/browser/memory_settings/calculations.h
@@ -49,6 +49,12 @@
 int64_t CalculateSoftwareSurfaceCacheSizeInBytes(
     const math::Size& ui_resolution);
 
+// Calculates the offscreen target cache size from the ui_resolution. This is
+// similar to the software surface cache, but it is specific to the direct-GLES
+// rasterizer.
+int64_t CalculateOffscreenTargetCacheSizeInBytes(
+    const math::Size& ui_resolution);
+
 // Calculates the SkiaCachSize from the ui_resolution. This is normalized
 // to be 4MB @ 1080p and scales accordingly.
 int64_t CalculateSkiaCacheSize(const math::Size& ui_resolution);
diff --git a/src/cobalt/browser/memory_settings/calculations_test.cc b/src/cobalt/browser/memory_settings/calculations_test.cc
index 3b7f62c..c8ce086 100644
--- a/src/cobalt/browser/memory_settings/calculations_test.cc
+++ b/src/cobalt/browser/memory_settings/calculations_test.cc
@@ -16,14 +16,8 @@
 
 #include "cobalt/browser/memory_settings/calculations.h"
 
-#include <algorithm>
-#include <sstream>
-#include <string>
-#include <vector>
-
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/browser/memory_settings/test_common.h"
 #include "cobalt/browser/switches.h"
diff --git a/src/cobalt/browser/memory_settings/constrainer.cc b/src/cobalt/browser/memory_settings/constrainer.cc
index 9e7a985..176463e 100644
--- a/src/cobalt/browser/memory_settings/constrainer.cc
+++ b/src/cobalt/browser/memory_settings/constrainer.cc
@@ -91,6 +91,11 @@
                        int64_t old_memory_consumption,
                        int64_t new_memory_consumption,
                        double constraining_value) {
+  if (old_memory_consumption == 0) {
+    // If the system is already using no memory, then it can't use any less.
+    return;
+  }
+
   // Represents 1% allowed difference.
   static const double kErrorThreshold = 0.01;
 
diff --git a/src/cobalt/browser/memory_settings/memory_settings.cc b/src/cobalt/browser/memory_settings/memory_settings.cc
index caabaf3..51ee2f9 100644
--- a/src/cobalt/browser/memory_settings/memory_settings.cc
+++ b/src/cobalt/browser/memory_settings/memory_settings.cc
@@ -24,91 +24,14 @@
 #include "base/bind.h"
 #include "base/compiler_specific.h"
 #include "base/logging.h"
-#include "base/string_number_conversions.h"
-#include "base/string_split.h"
 #include "base/stringprintf.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/browser/switches.h"
 #include "cobalt/math/linear_interpolator.h"
-#include "nb/lexical_cast.h"
 
 namespace cobalt {
 namespace browser {
 namespace memory_settings {
-namespace {
-
-struct ParsedIntValue {
- public:
-  ParsedIntValue() : value_(0), error_(false) {}
-  ParsedIntValue(const ParsedIntValue& other)
-      : value_(other.value_), error_(other.error_) {}
-  int value_;
-  bool error_;  // true if there was a parse error.
-};
-
-char ToLowerCharTypesafe(int c) {
-  return static_cast<char>(::tolower(c));
-}
-
-std::string ToLower(const std::string& input) {
-  std::string value_str = input;
-  std::transform(value_str.begin(), value_str.end(),
-                 value_str.begin(), ToLowerCharTypesafe);
-
-  return value_str;
-}
-
-// Parses a string like "1234x5678" to vector of parsed int values.
-std::vector<ParsedIntValue> ParseDimensions(const std::string& input) {
-  std::string value_str = ToLower(input);
-  std::vector<ParsedIntValue> output;
-
-  std::vector<std::string> lengths;
-  base::SplitString(value_str, 'x', &lengths);
-
-  for (size_t i = 0; i < lengths.size(); ++i) {
-    ParsedIntValue parsed_value;
-    parsed_value.error_ = !base::StringToInt(lengths[i], &parsed_value.value_);
-    output.push_back(parsed_value);
-  }
-  return output;
-}
-
-bool StringEndsWith(const std::string& value, const std::string& ending) {
-  if (ending.size() > value.size()) {
-    return false;
-  }
-  // Reverse search through the back of the string.
-  return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
-}
-
-// Handles bytes: "12435"
-// Handles kilobytes: "128KB"
-// Handles megabytes: "64MB"
-// Handles gigabytes: "1GB"
-// Handles fractional units for kilo/mega/gigabytes
-int64_t ParseMemoryValue(const std::string& value, bool* parse_ok) {
-  // nb::lexical_cast<> will parse out the number but it will ignore the
-  // unit part, such as "kb" or "mb".
-  double numerical_value = nb::lexical_cast<double>(value, parse_ok);
-  if (!(*parse_ok)) {
-    return static_cast<int64_t>(numerical_value);
-  }
-
-  // Lowercasing the string makes the units easier to detect.
-  std::string value_lower_case = ToLower(value);
-
-  if (StringEndsWith(value_lower_case, "kb")) {
-    numerical_value *= 1024;  // convert kb -> bytes.
-  } else if (StringEndsWith(value_lower_case, "mb")) {
-    numerical_value *= 1024 * 1024;  // convert mb -> bytes.
-  } else if (StringEndsWith(value_lower_case, "gb")) {
-    numerical_value *= 1024 * 1024 * 1024;  // convert gb -> bytes.
-  }
-  return static_cast<int64_t>(numerical_value);
-}
-}  // namespace
 
 void MemorySetting::set_memory_scaling_function(ScalingFunction function) {
   memory_scaling_function_ = function;
@@ -148,20 +71,6 @@
   set_value(MemorySetting::kAutosetConstrained, new_value);
 }
 
-bool IntSetting::TryParseValue(SourceType source_type,
-                               const std::string& string_value) {
-  bool parse_ok = false;
-  int64_t int_value = ParseMemoryValue(string_value, &parse_ok);
-
-  if (parse_ok) {
-    set_value(source_type, int_value);
-    return true;
-  } else {
-    LOG(ERROR) << "Invalid value for command line setting: " << string_value;
-    return false;
-  }
-}
-
 DimensionSetting::DimensionSetting(const std::string& name)
     : MemorySetting(kDimensions, name) {}
 
@@ -177,33 +86,6 @@
   return value().TotalBytes();
 }
 
-bool DimensionSetting::TryParseValue(SourceType source_type,
-                                     const std::string& string_value) {
-  std::vector<ParsedIntValue> int_values = ParseDimensions(string_value);
-
-  if ((int_values.size() < 2) || (int_values.size() > 3)) {
-    LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
-    return false;  // Parse failed.
-  }
-
-  for (size_t i = 0; i < int_values.size(); ++i) {
-    if (int_values[i].error_) {
-      LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
-      return false;  // Parse failed.
-    }
-  }
-
-  const int bytes_per_pixel =
-      int_values.size() == 3 ?
-      int_values[2].value_ : kSkiaGlyphAtlasTextureBytesPerPixel;
-
-  TextureDimensions tex_dimensions(int_values[0].value_, int_values[1].value_,
-                                   bytes_per_pixel);
-
-  set_value(source_type, tex_dimensions);
-  return true;
-}
-
 SkiaGlyphAtlasTextureSetting::SkiaGlyphAtlasTextureSetting()
     : DimensionSetting(switches::kSkiaTextureAtlasDimensions) {
   set_memory_scaling_function(MakeSkiaGlyphAtlasMemoryScaler());
diff --git a/src/cobalt/browser/memory_settings/memory_settings.h b/src/cobalt/browser/memory_settings/memory_settings.h
index 52406e8..d1b3b69 100644
--- a/src/cobalt/browser/memory_settings/memory_settings.h
+++ b/src/cobalt/browser/memory_settings/memory_settings.h
@@ -50,10 +50,6 @@
 
   // Stringify's the value of this memory setting.
   virtual std::string ValueToString() const = 0;
-  // Returns true if the TryParseValue() succeeded when converting the string
-  // into the internal value. If false, then the object should not be changed.
-  virtual bool TryParseValue(SourceType source_type,
-                             const std::string& string_value) = 0;
 
   // Returns the memory consumption (in bytes) that the memory setting will
   // be allocated.
@@ -128,8 +124,7 @@
     source_type_ = source_type;
     value_ = val;
   }
-  bool TryParseValue(SourceType source_type,
-                     const std::string& string_value) OVERRIDE;
+
  private:
   int64_t value_;
 
@@ -158,8 +153,6 @@
     source_type_ = source_type;
     value_ = val;
   }
-  bool TryParseValue(SourceType source_type,
-                     const std::string& string_value) OVERRIDE;
 
  private:
   TextureDimensions value_;
diff --git a/src/cobalt/browser/memory_settings/memory_settings_test.cc b/src/cobalt/browser/memory_settings/memory_settings_test.cc
index 2ca54ea..69ee8e5 100644
--- a/src/cobalt/browser/memory_settings/memory_settings_test.cc
+++ b/src/cobalt/browser/memory_settings/memory_settings_test.cc
@@ -16,10 +16,7 @@
 
 #include "cobalt/browser/memory_settings/memory_settings.h"
 
-#include <algorithm>
-#include <sstream>
 #include <string>
-#include <vector>
 
 #include "base/memory/scoped_ptr.h"
 #include "cobalt/browser/memory_settings/test_common.h"
@@ -28,92 +25,25 @@
 namespace cobalt {
 namespace browser {
 namespace memory_settings {
-namespace {
-int64_t TestIntSettingParse(const std::string& value) {
-  IntSetting int_setting("dummy");
-  EXPECT_TRUE(int_setting.TryParseValue(MemorySetting::kCmdLine, value));
-  return int_setting.value();
-}
-}  // namespace
 
-TEST(IntSetting, ParseFromString) {
+TEST(MemorySettingsTest, IntSetting) {
   scoped_ptr<IntSetting> int_setting(new IntSetting("dummy"));
   EXPECT_EQ(std::string("dummy"), int_setting->name());
-  ASSERT_TRUE(int_setting->TryParseValue(MemorySetting::kCmdLine, "123"));
+  int_setting->set_value(MemorySetting::kCmdLine, 123);
   EXPECT_EQ(123, int_setting->value());
   EXPECT_EQ(MemorySetting::kCmdLine, int_setting->source_type());
   EXPECT_EQ(std::string("123"), int_setting->ValueToString());
 }
 
-// Tests the expectation that numerous string variations (whole numbers vs
-// fractions vs units) parse correctly.
-TEST(IntSetting, ParseFromStrings) {
-  // Bytes.
-  EXPECT_EQ(1, TestIntSettingParse("1"));
-  EXPECT_EQ(1, TestIntSettingParse("1B"));
-  EXPECT_EQ(1, TestIntSettingParse("1b"));
-  EXPECT_EQ(1, TestIntSettingParse("1B"));
-  EXPECT_EQ(1, TestIntSettingParse("1b"));
-
-  // Kilobytes and fractional amounts.
-  EXPECT_EQ(1024, TestIntSettingParse("1KB"));
-  EXPECT_EQ(1024, TestIntSettingParse("1Kb"));
-  EXPECT_EQ(1024, TestIntSettingParse("1kB"));
-  EXPECT_EQ(1024, TestIntSettingParse("1kb"));
-
-  EXPECT_EQ(512, TestIntSettingParse(".5kb"));
-  EXPECT_EQ(512, TestIntSettingParse("0.5kb"));
-  EXPECT_EQ(1536, TestIntSettingParse("1.5kb"));
-  EXPECT_EQ(1536, TestIntSettingParse("1.50kb"));
-
-  // Megabytes and fractional amounts.
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1MB"));
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1Mb"));
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1mB"));
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1mb"));
-
-  EXPECT_EQ(512*1024, TestIntSettingParse(".5mb"));
-  EXPECT_EQ(512*1024, TestIntSettingParse("0.5mb"));
-  EXPECT_EQ(1536*1024, TestIntSettingParse("1.5mb"));
-  EXPECT_EQ(1536*1024, TestIntSettingParse("1.50mb"));
-
-  // Gigabytes and fractional amounts.
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1GB"));
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1Gb"));
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1gB"));
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1gb"));
-
-  EXPECT_EQ(512*1024*1024, TestIntSettingParse(".5gb"));
-  EXPECT_EQ(1536*1024*1024, TestIntSettingParse("1.50gb"));
-}
-
-TEST(DimensionSetting, ParseFromString) {
+TEST(MemorySettingsTest, DimensionSetting) {
   scoped_ptr<DimensionSetting> rect_setting(new TestDimensionSetting("dummy"));
-  ASSERT_TRUE(
-      rect_setting->TryParseValue(MemorySetting::kCmdLine, "1234x5678"));
+  rect_setting->set_value(MemorySetting::kCmdLine,
+                          TextureDimensions(1234, 5678, 2));
   EXPECT_EQ(TextureDimensions(1234, 5678, 2), rect_setting->value());
   EXPECT_EQ(MemorySetting::kCmdLine, rect_setting->source_type());
   EXPECT_EQ(std::string("1234x5678x2"), rect_setting->ValueToString());
 }
 
-TEST(DimensionSetting, ParseFromStringCaseInsensitive) {
-  scoped_ptr<DimensionSetting> rect_setting(new TestDimensionSetting("dummy"));
-  ASSERT_TRUE(
-      rect_setting->TryParseValue(MemorySetting::kCmdLine, "1234X5678"));
-  EXPECT_EQ(TextureDimensions(1234, 5678, 2), rect_setting->value());
-  EXPECT_EQ(MemorySetting::kCmdLine, rect_setting->source_type());
-  EXPECT_EQ(std::string("1234x5678x2"), rect_setting->ValueToString());
-}
-
-TEST(DimensionSetting, ParseFromStringWithBytesPerPixel) {
-  scoped_ptr<DimensionSetting> rect_setting(new TestDimensionSetting("dummy"));
-  ASSERT_TRUE(
-      rect_setting->TryParseValue(MemorySetting::kCmdLine, "1234x5678x12"));
-  EXPECT_EQ(TextureDimensions(1234, 5678, 12), rect_setting->value());
-  EXPECT_EQ(MemorySetting::kCmdLine, rect_setting->source_type());
-  EXPECT_EQ(std::string("1234x5678x12"), rect_setting->ValueToString());
-}
-
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/test_common.h b/src/cobalt/browser/memory_settings/test_common.h
index 9078573..203566c 100644
--- a/src/cobalt/browser/memory_settings/test_common.h
+++ b/src/cobalt/browser/memory_settings/test_common.h
@@ -70,26 +70,21 @@
   TestSettingGroup() {}
 
   void LoadDefault() {
-    MakeSetting(MemorySetting::kInt, MemorySetting::kCmdLine,
-                MemorySetting::kGPU, switches::kImageCacheSizeInBytes,
-                "1234");
+    MakeSetting(MemorySetting::kCmdLine, MemorySetting::kGPU,
+                switches::kImageCacheSizeInBytes, 1234);
 
-    MakeSetting(MemorySetting::kInt, MemorySetting::kAutoSet,
-                MemorySetting::kCPU, switches::kJavaScriptGcThresholdInBytes,
-                "1112");
+    MakeSetting(MemorySetting::kAutoSet, MemorySetting::kCPU,
+                switches::kJavaScriptGcThresholdInBytes, 1112);
 
-    MakeSetting(MemorySetting::kDimensions, MemorySetting::kCmdLine,
-                MemorySetting::kGPU, switches::kSkiaTextureAtlasDimensions,
-                "1234x4567");
+    MakeSetting(MemorySetting::kCmdLine, MemorySetting::kGPU,
+                switches::kSkiaTextureAtlasDimensions,
+                TextureDimensions(1234, 4567, 2));
 
-    MakeSetting(MemorySetting::kInt, MemorySetting::kCmdLine,
-                MemorySetting::kGPU, switches::kSkiaCacheSizeInBytes,
-                "12345678");
+    MakeSetting(MemorySetting::kCmdLine, MemorySetting::kGPU,
+                switches::kSkiaCacheSizeInBytes, 12345678);
 
-    MakeSetting(MemorySetting::kInt, MemorySetting::kBuildSetting,
-                MemorySetting::kNotApplicable,
-                switches::kSoftwareSurfaceCacheSizeInBytes,
-                "8910");
+    MakeSetting(MemorySetting::kBuildSetting, MemorySetting::kNotApplicable,
+                switches::kSoftwareSurfaceCacheSizeInBytes, 8910);
   }
 
   ~TestSettingGroup() {
@@ -99,16 +94,14 @@
   }
 
   // The memory setting is owned internally.
-  void MakeSetting(
-      MemorySetting::ClassType class_type,
-      MemorySetting::SourceType source_type,
-      MemorySetting::MemoryType memory_type,
-      const std::string& name, const std::string& value) {
+  template <typename ValueType>
+  void MakeSetting(MemorySetting::SourceType source_type,
+                   MemorySetting::MemoryType memory_type,
+                   const std::string& name, const ValueType& value) {
     const bool found = (map_.find(name) !=  map_.end());
 
     ASSERT_FALSE(found);
-    map_[name] =
-        CreateMemorySetting(class_type, source_type, memory_type, name, value);
+    map_[name] = CreateMemorySetting(source_type, memory_type, name, value);
   }
 
   std::vector<const MemorySetting*> AsConstVector() const {
@@ -128,29 +121,14 @@
   }
 
  private:
+  template <typename ValueType>
   static MemorySetting* CreateMemorySetting(
-      MemorySetting::ClassType class_type,
       MemorySetting::SourceType source_type,
       MemorySetting::MemoryType memory_type, const std::string& name,
-      const std::string& value) {
-    MemorySetting* memory_setting = NULL;
-    switch (class_type) {
-      case MemorySetting::kInt: {
-        memory_setting = new IntSetting(name);
-        break;
-      }
-      case MemorySetting::kDimensions: {
-        memory_setting = new TestDimensionSetting(name);
-        break;
-      }
-      default: {
-        EXPECT_TRUE(false) << "Unexpected type " << class_type;
-        memory_setting = new IntSetting(name);
-        break;
-      }
-    }
-    EXPECT_TRUE(memory_setting->TryParseValue(source_type, value));
+      const ValueType& value) {
+    IntSetting* memory_setting = new IntSetting(name);
     memory_setting->set_memory_type(memory_type);
+    memory_setting->set_value(source_type, value);
     return memory_setting;
   }
 
@@ -158,6 +136,20 @@
   MemoryMap map_;
 };
 
+// Specialization for TextureDimensions.
+
+// static
+template <>
+inline MemorySetting* TestSettingGroup::CreateMemorySetting(
+    MemorySetting::SourceType source_type,
+    MemorySetting::MemoryType memory_type, const std::string& name,
+    const TextureDimensions& value) {
+  TestDimensionSetting* memory_setting = new TestDimensionSetting(name);
+  memory_setting->set_memory_type(memory_type);
+  memory_setting->set_value(source_type, value);
+  return memory_setting;
+}
+
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/texture_dimensions.h b/src/cobalt/browser/memory_settings/texture_dimensions.h
index 0e6b9f7..4b73f84 100644
--- a/src/cobalt/browser/memory_settings/texture_dimensions.h
+++ b/src/cobalt/browser/memory_settings/texture_dimensions.h
@@ -17,6 +17,8 @@
 #ifndef COBALT_BROWSER_MEMORY_SETTINGS_TEXTURE_DIMENSIONS_H_
 #define COBALT_BROWSER_MEMORY_SETTINGS_TEXTURE_DIMENSIONS_H_
 
+#include <iosfwd>
+
 #include "starboard/types.h"
 
 namespace cobalt {
@@ -42,6 +44,10 @@
     return !(*this == other);
   }
 
+  // Defining an "autoset" TextureDimensions as one where either component is
+  // negative.
+  bool IsAutoset() const { return width_ < 0 || height_ < 0; }
+
   int width() const { return width_; }
   int height() const { return height_; }
   int bytes_per_pixel() const { return bytes_per_pixel_; }
@@ -63,6 +69,13 @@
   int bytes_per_pixel_;
 };
 
+inline std::ostream& operator<<(std::ostream& stream,
+                                const TextureDimensions& dimensions) {
+  stream << dimensions.width() << "x" << dimensions.height() << "x"
+         << dimensions.bytes_per_pixel();
+  return stream;
+}
+
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
diff --git a/src/cobalt/browser/splash_screen.cc b/src/cobalt/browser/splash_screen.cc
index d2b8e12..531ab13 100644
--- a/src/cobalt/browser/splash_screen.cc
+++ b/src/cobalt/browser/splash_screen.cc
@@ -20,18 +20,13 @@
 namespace cobalt {
 namespace browser {
 
-// Static
-const char SplashScreen::Options::kDefaultSplashScreenURL[] =
-    "h5vcc-embedded://splash_screen.html";
-
 SplashScreen::SplashScreen(base::ApplicationState initial_application_state,
                            const WebModule::OnRenderTreeProducedCallback&
                                render_tree_produced_callback,
                            network::NetworkModule* network_module,
                            const math::Size& window_dimensions,
                            render_tree::ResourceProvider* resource_provider,
-                           float layout_refresh_rate,
-                           const SplashScreen::Options& options)
+                           float layout_refresh_rate, const GURL& url)
     : render_tree_produced_callback_(render_tree_produced_callback),
       is_ready_(true, false) {
   WebModule::Options web_module_options;
@@ -45,13 +40,13 @@
       base::kThreadPriority_High;
 
   web_module_.reset(new WebModule(
-      options.url, initial_application_state,
+      url, initial_application_state,
       base::Bind(&SplashScreen::OnRenderTreeProduced, base::Unretained(this)),
       base::Bind(&SplashScreen::OnError, base::Unretained(this)),
       base::Bind(&SplashScreen::OnWindowClosed, base::Unretained(this)),
       base::Closure(),  // window_minimize_callback
-      &stub_media_module_, network_module, window_dimensions, resource_provider,
-      stub_media_module_.system_window(), layout_refresh_rate,
+      &stub_media_module_, network_module, window_dimensions,
+      1.f /*video_pixel_ratio*/, resource_provider, layout_refresh_rate,
       web_module_options));
 }
 
diff --git a/src/cobalt/browser/splash_screen.h b/src/cobalt/browser/splash_screen.h
index 8ca9ba5..e775e2a 100644
--- a/src/cobalt/browser/splash_screen.h
+++ b/src/cobalt/browser/splash_screen.h
@@ -32,19 +32,13 @@
 //
 class SplashScreen : public LifecycleObserver {
  public:
-  struct Options {
-    Options() : url(kDefaultSplashScreenURL) {}
-    static const char kDefaultSplashScreenURL[];
-    GURL url;
-  };
-
   SplashScreen(base::ApplicationState initial_application_state,
                const WebModule::OnRenderTreeProducedCallback&
                    render_tree_produced_callback,
                network::NetworkModule* network_module,
                const math::Size& window_dimensions,
                render_tree::ResourceProvider* resource_provider,
-               float layout_refresh_rate, const Options& options = Options());
+               float layout_refresh_rate, const GURL& url);
   ~SplashScreen();
 
   // LifecycleObserver implementation.
diff --git a/src/cobalt/browser/starboard/application.cc b/src/cobalt/browser/starboard/application.cc
index 0409a90..1c3e5fe 100644
--- a/src/cobalt/browser/starboard/application.cc
+++ b/src/cobalt/browser/starboard/application.cc
@@ -23,9 +23,9 @@
 
 class ApplicationStarboard : public Application {
  public:
-  explicit ApplicationStarboard(const base::Closure& quit_closure)
-      : Application(quit_closure), event_handler_(&event_dispatcher_) {}
-  ~ApplicationStarboard() OVERRIDE {}
+  ApplicationStarboard(const base::Closure& quit_closure, bool should_preload)
+      : Application(quit_closure, should_preload),
+        event_handler_(&event_dispatcher_) {}
 
  private:
   // Event handler to receive Starboard events, convert to Cobalt events
@@ -34,7 +34,13 @@
 };
 
 scoped_ptr<Application> CreateApplication(const base::Closure& quit_closure) {
-  return scoped_ptr<Application>(new ApplicationStarboard(quit_closure));
+  return scoped_ptr<Application>(
+      new ApplicationStarboard(quit_closure, false /*should_preload*/));
+}
+
+scoped_ptr<Application> PreloadApplication(const base::Closure& quit_closure) {
+  return scoped_ptr<Application>(
+      new ApplicationStarboard(quit_closure, true /*should_preload*/));
 }
 
 }  // namespace browser
diff --git a/src/cobalt/browser/starboard/event_handler.cc b/src/cobalt/browser/starboard/event_handler.cc
index a8ad309..dab7e1b 100644
--- a/src/cobalt/browser/starboard/event_handler.cc
+++ b/src/cobalt/browser/starboard/event_handler.cc
@@ -17,9 +17,9 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "cobalt/base/accessibility_settings_changed_event.h"
+#include "cobalt/base/application_event.h"
 #include "cobalt/base/deep_link_event.h"
 #include "cobalt/network/network_event.h"
-#include "cobalt/system_window/application_event.h"
 #include "cobalt/system_window/input_event.h"
 
 namespace cobalt {
@@ -58,20 +58,11 @@
   // Create a Cobalt event from the Starboard event, if recognized.
   switch (starboard_event->type) {
     case kSbEventTypePause:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kPause));
-      break;
     case kSbEventTypeUnpause:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kUnpause));
-      break;
     case kSbEventTypeSuspend:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kSuspend));
-      break;
     case kSbEventTypeResume:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kResume));
+    case kSbEventTypeStart:
+      DispatchEventInternal(new base::ApplicationEvent(starboard_event->type));
       break;
     case kSbEventTypeNetworkConnect:
       DispatchEventInternal(
diff --git a/src/cobalt/browser/switches.cc b/src/cobalt/browser/switches.cc
index 0232dff..2c107df 100644
--- a/src/cobalt/browser/switches.cc
+++ b/src/cobalt/browser/switches.cc
@@ -115,6 +115,9 @@
 // Enables memory tracking by installing the memory tracker on startup.
 const char kMemoryTracker[] = "memory_tracker";
 
+// Enables/disables animations on animated images (e.g. animated WebP).
+const char kDisableImageAnimations[] = "disable_image_animations";
+
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
 // If toggled, framerate statistics will be printed to stdout after each
@@ -167,12 +170,32 @@
 const char kSoftwareSurfaceCacheSizeInBytes[] =
     "software_surface_cache_size_in_bytes";
 
+// Setting this switch defines the splash screen URL that Cobalt will
+// use in absence of a web cache. The referenced url should be a
+// content file (for example file:///foobar.html) or an embedded file
+// (for example h5vcc-embedded://foobar.html) and all files referenced
+// must be content or embedded files as well. If "none" is passed
+// (case-insensitive), no splash screen will be constructed. If no
+// value is set, the URL in gyp_configuration.gypi or base.gypi will
+// be used.
+const char kFallbackSplashScreenURL[] = "fallback_splash_screen_url";
+
 // Determines the capacity of the surface cache.  The surface cache tracks which
 // render tree nodes are being re-used across frames and stores the nodes that
 // are most CPU-expensive to render into surfaces.  While it depends on the
 // platform, this setting may affect GPU memory usage.
 const char kSurfaceCacheSizeInBytes[] = "surface_cache_size_in_bytes";
 
+// Determines the amount of GPU memory the offscreen target atlases will
+// use. This is specific to the direct-GLES rasterizer and serves a similar
+// purpose as the surface_cache_size_in_bytes, but caches any render tree
+// nodes which require skia for rendering. Two atlases will be allocated
+// from this memory or multiple atlases of the frame size if the limit
+// allows. It is recommended that enough memory be reserved for two RGBA
+// atlases about a quarter of the frame size.
+const char kOffscreenTargetCacheSizeInBytes[] =
+    "offscreen_target_cache_size_in_bytes";
+
 // Specifies the viewport size: width ['x' height]
 const char kViewport[] = "viewport";
 
diff --git a/src/cobalt/browser/switches.h b/src/cobalt/browser/switches.h
index 6f03782..4470c4e 100644
--- a/src/cobalt/browser/switches.h
+++ b/src/cobalt/browser/switches.h
@@ -46,6 +46,7 @@
 extern const char kVideoDecoderStub[];
 extern const char kWebDriverListenIp[];
 extern const char kWebDriverPort[];
+extern const char kDisableImageAnimations[];
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
 extern const char kDisableNavigationWhitelist[];
@@ -53,10 +54,12 @@
 extern const char kFPSOverlay[];
 extern const char kImageCacheSizeInBytes[];
 extern const char kInitialURL[];
+extern const char kOffscreenTargetCacheSizeInBytes[];
 extern const char kRemoteTypefaceCacheSizeInBytes[];
 extern const char kScratchSurfaceCacheSizeInBytes[];
 extern const char kSkiaCacheSizeInBytes[];
 extern const char kSoftwareSurfaceCacheSizeInBytes[];
+extern const char kFallbackSplashScreenURL[];
 extern const char kSurfaceCacheSizeInBytes[];
 extern const char kViewport[];
 extern const char kDisableJavaScriptJit[];
diff --git a/src/cobalt/browser/web_module.cc b/src/cobalt/browser/web_module.cc
index 059c85c..48094a9 100644
--- a/src/cobalt/browser/web_module.cc
+++ b/src/cobalt/browser/web_module.cc
@@ -20,6 +20,7 @@
 #include "base/command_line.h"
 #include "base/debug/trace_event.h"
 #include "base/logging.h"
+#include "base/memory/weak_ptr.h"
 #include "base/message_loop_proxy.h"
 #include "base/optional.h"
 #include "base/stringprintf.h"
@@ -51,7 +52,6 @@
 #include "cobalt/page_visibility/visibility_state.h"
 #include "cobalt/script/javascript_engine.h"
 #include "cobalt/storage/storage_manager.h"
-#include "cobalt/system_window/system_window.h"
 #include "starboard/accessibility.h"
 #include "starboard/log.h"
 
@@ -151,6 +151,8 @@
   void CreateDebugServerIfNull();
 #endif  // ENABLE_DEBUG_CONSOLE
 
+  void SetSize(math::Size window_dimensions, float video_pixel_ratio);
+
   // Sets the application state, asserts preconditions to transition to that
   // state, and dispatches any precipitate web events.
   void SetApplicationState(base::ApplicationState state);
@@ -326,7 +328,7 @@
 
   scoped_ptr<media_session::MediaSessionClient> media_session_client_;
 
-  layout::TopmostEventTarget topmost_event_target_;
+  scoped_ptr<layout::TopmostEventTarget> topmost_event_target_;
 };
 
 class WebModule::Impl::DocumentLoadedObserver : public dom::DocumentObserver {
@@ -456,8 +458,8 @@
 
   window_ = new dom::Window(
       data.window_dimensions.width(), data.window_dimensions.height(),
-      data.initial_application_state, css_parser_.get(), dom_parser_.get(),
-      fetcher_factory_.get(), &resource_provider_,
+      data.video_pixel_ratio, data.initial_application_state, css_parser_.get(),
+      dom_parser_.get(), fetcher_factory_.get(), &resource_provider_,
       animated_image_tracker_.get(), image_cache_.get(),
       reduced_image_cache_capacity_manager_.get(), remote_typeface_cache_.get(),
       mesh_cache_.get(), local_storage_database_.get(), data.media_module,
@@ -474,10 +476,17 @@
       base::Bind(&WebModule::Impl::OnRanAnimationFrameCallbacks,
                  base::Unretained(this)),
       data.window_close_callback, data.window_minimize_callback,
-      data.system_window_, data.options.camera_3d,
-      media_session_client_->GetMediaSession(),
+      data.options.camera_3d, media_session_client_->GetMediaSession(),
       data.options.csp_insecure_allowed_token, data.dom_max_element_depth,
-      data.options.video_playback_rate_multiplier);
+      data.options.video_playback_rate_multiplier,
+#if defined(ENABLE_TEST_RUNNER)
+      data.options.layout_trigger == layout::LayoutManager::kTestRunnerMode
+          ? dom::Window::kClockTypeTestRunner
+          : dom::Window::kClockTypeSystemTime
+#else
+      dom::Window::kClockTypeSystemTime
+#endif
+      );  // NOLINT(whitespace/parens)
   DCHECK(window_);
 
   window_weak_ = base::AsWeakPtr(window_.get());
@@ -506,6 +515,7 @@
       base::Bind(&WebModule::Impl::HandlePointerEvents, base::Unretained(this)),
       data.options.layout_trigger, data.dom_max_element_depth,
       data.layout_refresh_rate, data.network_module->preferred_language(),
+      data.options.enable_image_animations,
       web_module_stat_tracker_->layout_stat_tracker()));
   DCHECK(layout_manager_);
 
@@ -557,6 +567,7 @@
   // crash when the callback attempts to access a stale Document pointer.
   DisableCallbacksInResourceCaches();
 
+  topmost_event_target_.reset();
   layout_manager_.reset();
   environment_settings_.reset();
   window_weak_.reset();
@@ -571,8 +582,8 @@
   local_storage_database_.reset();
   mesh_cache_.reset();
   remote_typeface_cache_.reset();
-  animated_image_tracker_.reset();
   image_cache_.reset();
+  animated_image_tracker_.reset();
   fetcher_factory_.reset();
   dom_parser_.reset();
   css_parser_.reset();
@@ -750,6 +761,11 @@
   }
 }
 
+void WebModule::Impl::SetSize(math::Size /*window_dimensions*/,
+                              float /*video_pixel_ratio*/) {
+  NOTIMPLEMENTED();
+}
+
 void WebModule::Impl::SetApplicationState(base::ApplicationState state) {
   window_->SetApplicationState(state);
 }
@@ -791,6 +807,9 @@
   // Clear out the loader factory's resource provider, possibly aborting any
   // in-progress loads.
   loader_factory_->Suspend();
+
+  // Clear out any currently tracked animating images.
+  animated_image_tracker_->Reset();
 }
 
 void WebModule::Impl::FinishSuspend() {
@@ -887,7 +906,8 @@
       thread_priority(base::kThreadPriority_Normal),
       loader_thread_priority(base::kThreadPriority_Low),
       animated_image_decode_thread_priority(base::kThreadPriority_Low),
-      video_playback_rate_multiplier(1.f) {}
+      video_playback_rate_multiplier(1.f),
+      enable_image_animations(true) {}
 
 WebModule::WebModule(
     const GURL& initial_url, base::ApplicationState initial_application_state,
@@ -896,16 +916,15 @@
     const base::Closure& window_close_callback,
     const base::Closure& window_minimize_callback,
     media::MediaModule* media_module, network::NetworkModule* network_module,
-    const math::Size& window_dimensions,
-    render_tree::ResourceProvider* resource_provider,
-    system_window::SystemWindow* system_window, float layout_refresh_rate,
+    const math::Size& window_dimensions, float video_pixel_ratio,
+    render_tree::ResourceProvider* resource_provider, float layout_refresh_rate,
     const Options& options)
     : thread_(options.name.c_str()) {
   ConstructionData construction_data(
       initial_url, initial_application_state, render_tree_produced_callback,
       error_callback, window_close_callback, window_minimize_callback,
-      media_module, network_module, window_dimensions, resource_provider,
-      kDOMMaxElementDepth, system_window, layout_refresh_rate, options);
+      media_module, network_module, window_dimensions, video_pixel_ratio,
+      resource_provider, kDOMMaxElementDepth, layout_refresh_rate, options);
 
   // Start the dedicated thread and create the internal implementation
   // object on that thread.
@@ -1083,6 +1102,14 @@
 }
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
+void WebModule::SetSize(const math::Size& window_dimensions,
+                        float video_pixel_ratio) {
+  message_loop()->PostTask(
+      FROM_HERE,
+      base::Bind(&WebModule::Impl::SetSize, base::Unretained(impl_.get()),
+                 window_dimensions, video_pixel_ratio));
+}
+
 void WebModule::Start(render_tree::ResourceProvider* resource_provider) {
   // Must only be called by a thread external from the WebModule thread.
   DCHECK_NE(MessageLoop::current(), message_loop());
@@ -1157,7 +1184,10 @@
           window_ ==
           base::polymorphic_downcast<const dom::UIEvent* const>(event.get())
               ->view());
-      topmost_event_target_.MaybeSendPointerEvents(event, window_);
+      if (!topmost_event_target_) {
+        topmost_event_target_.reset(new layout::TopmostEventTarget());
+      }
+      topmost_event_target_->MaybeSendPointerEvents(event);
     }
   } while (event && !layout_manager_->IsNewRenderTreePending());
 }
diff --git a/src/cobalt/browser/web_module.h b/src/cobalt/browser/web_module.h
index 0cc79ce..47c22ee 100644
--- a/src/cobalt/browser/web_module.h
+++ b/src/cobalt/browser/web_module.h
@@ -54,7 +54,6 @@
 #include "cobalt/script/global_environment.h"
 #include "cobalt/script/javascript_engine.h"
 #include "cobalt/script/script_runner.h"
-#include "cobalt/system_window/system_window.h"
 #include "cobalt/webdriver/session_driver.h"
 #include "googleurl/src/gurl.h"
 
@@ -176,6 +175,10 @@
     // The video playback rate will be multiplied with the following value.  Its
     // default value is 1.0.
     float video_playback_rate_multiplier;
+
+    // Allows image animations to be enabled/disabled.  Its default value
+    // is true to enable them.
+    bool enable_image_animations;
   };
 
   typedef layout::LayoutManager::LayoutResults LayoutResults;
@@ -191,9 +194,8 @@
             const base::Closure& window_minimize_callback,
             media::MediaModule* media_module,
             network::NetworkModule* network_module,
-            const math::Size& window_dimensions,
+            const math::Size& window_dimensions, float video_pixel_ratio,
             render_tree::ResourceProvider* resource_provider,
-            system_window::SystemWindow* system_window,
             float layout_refresh_rate, const Options& options);
   ~WebModule();
 
@@ -232,6 +234,11 @@
   debug::DebugServer* GetDebugServer();
 #endif  // ENABLE_DEBUG_CONSOLE
 
+  // Sets the size and pixel ratio of this web module, possibly causing relayout
+  // and re-render with the new parameters. Does nothing if the parameters are
+  // not different from the current parameters.
+  void SetSize(const math::Size& window_dimensions, float video_pixel_ratio);
+
   // LifecycleObserver implementation
   void Start(render_tree::ResourceProvider* resource_provider) OVERRIDE;
   void Pause() OVERRIDE;
@@ -252,10 +259,10 @@
         const base::Closure& window_minimize_callback,
         media::MediaModule* media_module,
         network::NetworkModule* network_module,
-        const math::Size& window_dimensions,
+        const math::Size& window_dimensions, float video_pixel_ratio,
         render_tree::ResourceProvider* resource_provider,
-        int dom_max_element_depth, system_window::SystemWindow* system_window,
-        float layout_refresh_rate, const Options& options)
+        int dom_max_element_depth, float layout_refresh_rate,
+        const Options& options)
         : initial_url(initial_url),
           initial_application_state(initial_application_state),
           render_tree_produced_callback(render_tree_produced_callback),
@@ -265,9 +272,9 @@
           media_module(media_module),
           network_module(network_module),
           window_dimensions(window_dimensions),
+          video_pixel_ratio(video_pixel_ratio),
           resource_provider(resource_provider),
           dom_max_element_depth(dom_max_element_depth),
-          system_window_(system_window),
           layout_refresh_rate(layout_refresh_rate),
           options(options) {}
 
@@ -280,9 +287,9 @@
     media::MediaModule* media_module;
     network::NetworkModule* network_module;
     math::Size window_dimensions;
+    float video_pixel_ratio;
     render_tree::ResourceProvider* resource_provider;
     int dom_max_element_depth;
-    system_window::SystemWindow* system_window_;
     float layout_refresh_rate;
     Options options;
   };
diff --git a/src/cobalt/build/build.id b/src/cobalt/build/build.id
index 66e3496..d7461cb 100644
--- a/src/cobalt/build/build.id
+++ b/src/cobalt/build/build.id
@@ -1 +1 @@
-71685
\ No newline at end of file
+78263
\ No newline at end of file
diff --git a/src/cobalt/build/config/__init__.py b/src/cobalt/build/config/__init__.py
index 68e992a..e741e5b 100644
--- a/src/cobalt/build/config/__init__.py
+++ b/src/cobalt/build/config/__init__.py
@@ -14,7 +14,6 @@
 # limitations under the License.
 """Initialization for the config package."""
 
-
-from base import LoadPlatformConfig
+from base import GetPlatformConfig
 from base import VALID_BUILD_CONFIGS
 from base import VALID_PLATFORMS
diff --git a/src/cobalt/build/config/base.gypi b/src/cobalt/build/config/base.gypi
index 3133cd6..439781f 100644
--- a/src/cobalt/build/config/base.gypi
+++ b/src/cobalt/build/config/base.gypi
@@ -43,6 +43,12 @@
     'sb_enable_lib%': '<(sb_enable_lib)',
     'cobalt_enable_lib': '<(sb_enable_lib)',
 
+    # Directory path to static contents.
+    'sb_static_contents_output_base_dir%': '<(PRODUCT_DIR)/content',
+
+    # Directory path to static contents' data.
+    'sb_static_contents_output_data_dir%': '<(PRODUCT_DIR)/content/data',
+
     # This variable defines what Cobalt's preferred strategy should be for
     # handling internally triggered application exit requests (e.g. the user
     # chooses to back out of the application).
@@ -146,12 +152,19 @@
     # Defines what kind of rasterizer will be used.  This can be adjusted to
     # force a stub graphics implementation or software graphics implementation.
     # It can be one of the following options:
-    #   'hardware' -- As much hardware acceleration of graphics commands as
-    #                 possible. Required for 360 rendering.
-    #   'software' -- Perform most rasterization using the CPU and only interact
-    #                 with the GPU to send the final image to the output window.
-    #   'stub'     -- Stub graphics rasterization.  A rasterizer object will
-    #                 still be available and valid, but it will do nothing.
+    #   'direct-gles' -- Uses a light wrapper over OpenGL ES to handle most
+    #                    draw elements. This will fall back to the skia hardware
+    #                    rasterizer for some render tree node types, but is
+    #                    generally faster on the CPU and GPU. This can handle
+    #                    360 rendering.
+    #   'hardware'    -- As much hardware acceleration of graphics commands as
+    #                    possible. This uses skia to wrap OpenGL ES commands.
+    #                    Required for 360 rendering.
+    #   'software'    -- Perform most rasterization using the CPU and only
+    #                    interact with the GPU to send the final image to the
+    #                    output window.
+    #   'stub'        -- Stub graphics rasterization.  A rasterizer object will
+    #                    still be available and valid, but it will do nothing.
     'rasterizer_type%': 'hardware',
 
     # If set to 1, will enable support for rendering only the regions of the
@@ -188,8 +201,6 @@
     # native code may require an additional packaging step (ex. Android).
     'gtest_target_type%': 'executable',
     'final_executable_type%': 'executable',
-    'posix_emulation_target_type%': 'static_library',
-    'webkit_target_type%': 'static_library',
 
     # Set to 1 to build with DIAL support.
     'in_app_dial%': 0,
@@ -203,6 +214,9 @@
     # Set to 1 to enable H5vccCrashLog.
     'enable_crash_log%': 0,
 
+    # Set to 1 to enable H5vccSSO (Single Sign On).
+    'enable_sso%': 0,
+
     # Set to 1 to compile with SPDY support.
     'enable_spdy%': 0,
 
@@ -248,6 +262,12 @@
     # Temporary indicator for Tizen - should eventually move to feature defines.
     'tizen_os%': 0,
 
+    # URL of default build time splash screen:
+    # TODO: Point this to cobalt_splash_screen.html and override it in
+    # ports' gyp_configuration.gypi (coordinate transition with
+    # partners).
+    'fallback_splash_screen_url%': 'h5vcc-embedded://splash_screen.html',
+
     # Cache parameters
 
     # The following set of parameters define how much memory is reserved for
@@ -283,6 +303,15 @@
     # nodes that are most CPU-expensive to render into surfaces.
     'surface_cache_size_in_bytes%': 0,
 
+    # Determines the amount of GPU memory the offscreen target atlases will
+    # use. This is specific to the direct-GLES rasterizer and serves a similar
+    # purpose as the surface_cache_size_in_bytes, but caches any render tree
+    # nodes which require skia for rendering. Two atlases will be allocated
+    # from this memory or multiple atlases of the frame size if the limit
+    # allows. It is recommended that enough memory be reserved for two RGBA
+    # atlases about a quarter of the frame size.
+    'offscreen_target_cache_size_in_bytes%': -1,
+
     # Determines the capacity of the image cache, which manages image surfaces
     # downloaded from a web page.  While it depends on the platform, often (and
     # ideally) these images are cached within GPU memory.
@@ -420,17 +449,6 @@
     # implementation is a no-op.
     'cobalt_enable_jit%': 0,
 
-    # Customize variables used by Chromium's build/common.gypi.
-
-    # Disable a check that looks for an official google api key.
-    'use_official_google_api_keys': 0,
-    # Prevents common.gypi from running a bash script which is not required
-    # to compile Cobalt.
-    'clang_use_chrome_plugins': 0,
-    # Disables treat warnings as errors.
-    'werror': '',
-    # Cobalt doesn't currently support tcmalloc.
-    'linux_use_tcmalloc': 0,
     # The event polling mechanism available on this platform to support libevent.
     # Platforms may redefine to 'poll' if necessary.
     # Other mechanisms, e.g. devpoll, kqueue, select, are not yet supported.
@@ -568,16 +586,6 @@
           }],
         ],
       }],
-      ['posix_emulation_target_type == "shared_library"', {
-        'defines': [
-          '__LB_BASE_SHARED__=1',
-        ],
-      }],
-      ['webkit_target_type == "shared_library"', {
-        'defines': [
-          'COBALT_WEBKIT_SHARED=1',
-        ],
-      }],
       ['OS == "lb_shell"', {
         'defines': [
           '__LB_SHELL__',
diff --git a/src/cobalt/build/config/base.py b/src/cobalt/build/config/base.py
index d7cd087..612e547 100644
--- a/src/cobalt/build/config/base.py
+++ b/src/cobalt/build/config/base.py
@@ -18,6 +18,7 @@
 import importlib
 import logging
 import os
+import sys
 
 import gyp_utils
 
@@ -98,7 +99,17 @@
     return {}
 
 
-def LoadPlatformConfig(platform):
+def _ModuleLoaded(module_name, module_path):
+  if module_name not in sys.modules:
+    return False
+  # Sometimes one of these has .pyc and the other has .py, but we don't care.
+  extensionless_loaded_path = os.path.splitext(
+      os.path.abspath(sys.modules['platform_module'].__file__))[0]
+  extensionless_module_path = os.path.splitext(os.path.abspath(module_path))[0]
+  return extensionless_loaded_path == extensionless_module_path
+
+
+def _LoadPlatformConfig(platform):
   """Loads a platform specific configuration.
 
   The function will use the provided platform name to load
@@ -117,7 +128,10 @@
     if platform in platforms.keys():
       platform_path = platforms[platform].path
       module_path = os.path.join(platform_path, 'gyp_configuration.py')
-      platform_module = imp.load_source('platform_module', module_path)
+      if not _ModuleLoaded('platform_module', module_path):
+        platform_module = imp.load_source('platform_module', module_path)
+      else:
+        platform_module = sys.modules['platform_module']
     else:
       module_path = 'config/{}.py'.format(platform)
       platform_module = importlib.import_module('config.{}'.format(platform))
@@ -130,3 +144,28 @@
     return None
 
   return platform_module.CreatePlatformConfig()
+
+
+# Global cache of the platform configurations, so that platform config objects
+# are only created once.
+_PLATFORM_CONFIG_DICT = {}
+
+
+def GetPlatformConfig(platform):
+  """Returns a platform specific configuration.
+
+  This function will return a cached platform configuration object, loading it
+  if it doesn't exist via a call to _LoadPlatformConfig().
+
+  Args:
+    platform: Platform name.
+
+  Returns:
+    Instance of a class derived from PlatformConfigBase.
+  """
+
+  global _PLATFORM_CONFIG_DICT
+  if platform not in _PLATFORM_CONFIG_DICT:
+    _PLATFORM_CONFIG_DICT[platform] = _LoadPlatformConfig(platform)
+
+  return _PLATFORM_CONFIG_DICT[platform]
diff --git a/src/cobalt/build/contents_dir.gypi b/src/cobalt/build/contents_dir.gypi
index 64f7608..b3086c0 100644
--- a/src/cobalt/build/contents_dir.gypi
+++ b/src/cobalt/build/contents_dir.gypi
@@ -16,7 +16,5 @@
 {
   'variables': {
     'static_contents_source_dir': '<(DEPTH)/cobalt/content',
-    'static_contents_output_base_dir': '<(PRODUCT_DIR)/content',
-    'static_contents_output_data_dir': '<(PRODUCT_DIR)/content/data',
   },
 }
diff --git a/src/cobalt/build/copy_icu_data.gypi b/src/cobalt/build/copy_icu_data.gypi
index c2bfac3..2b15d2a 100644
--- a/src/cobalt/build/copy_icu_data.gypi
+++ b/src/cobalt/build/copy_icu_data.gypi
@@ -26,12 +26,12 @@
           'little_endian%': 1,
 
           # A directory with loose data files.should be used instead of a
-	  # single .dat file
+          # single .dat file
           'use_icu_dat_file%': 0,
         },
 
         'conditions': [
-          ['target_arch in ["ps3", "wiiu", "x360"]', {
+          ['target_arch in ["ps3"]', {
             'little_endian%': 0,
           }],
         ],
@@ -47,7 +47,7 @@
 
   'copies': [
     {
-      'destination': '<(static_contents_output_data_dir)/',
+      'destination': '<(sb_static_contents_output_data_dir)/',
       'files': [ '<(inputs_icu)' ],
     },
   ],
diff --git a/src/cobalt/build/copy_test_data.gypi b/src/cobalt/build/copy_test_data.gypi
index 13ac050..e5d8dad 100644
--- a/src/cobalt/build/copy_test_data.gypi
+++ b/src/cobalt/build/copy_test_data.gypi
@@ -49,16 +49,17 @@
 # folder.
 
 {
+  'includes': [ 'contents_dir.gypi' ],
   'inputs': [
     '<!@pymod_do_main(starboard.build.copy_data --inputs <(input_files))',
   ],
   'outputs': [
-    '<!@pymod_do_main(starboard.build.copy_data -o <(PRODUCT_DIR)/content/dir_source_root/<(output_dir) --outputs <(input_files))',
+    '<!@pymod_do_main(starboard.build.copy_data -o <(sb_static_contents_output_base_dir)/dir_source_root/<(output_dir) --outputs <(input_files))',
   ],
   'action': [
     'python',
     '<(DEPTH)/starboard/build/copy_data.py',
-    '-o', '<(PRODUCT_DIR)/content/dir_source_root/<(output_dir)',
+    '-o', '<(sb_static_contents_output_base_dir)/dir_source_root/<(output_dir)',
     '<@(input_files)',
   ],
 }
diff --git a/src/cobalt/build/copy_web_data.gypi b/src/cobalt/build/copy_web_data.gypi
index b4f5c98..672ee45 100644
--- a/src/cobalt/build/copy_web_data.gypi
+++ b/src/cobalt/build/copy_web_data.gypi
@@ -49,16 +49,17 @@
 # folder.
 
 {
+  'includes': [ 'contents_dir.gypi' ],
   'inputs': [
     '<!@pymod_do_main(starboard.build.copy_data --inputs <(input_files))',
   ],
   'outputs': [
-    '<!@pymod_do_main(starboard.build.copy_data -o <(PRODUCT_DIR)/content/data/web/<(output_dir) --outputs <(input_files))',
+    '<!@pymod_do_main(starboard.build.copy_data -o <(sb_static_contents_output_data_dir)/web/<(output_dir) --outputs <(input_files))',
   ],
   'action': [
     'python',
     '<(DEPTH)/starboard/build/copy_data.py',
-    '-o', '<(PRODUCT_DIR)/content/data/web/<(output_dir)',
+    '-o', '<(sb_static_contents_output_data_dir)/web/<(output_dir)',
     '<@(input_files)',
   ],
 }
diff --git a/src/cobalt/build/gyp_cobalt b/src/cobalt/build/gyp_cobalt
index 4444e7e..129e0cf 100755
--- a/src/cobalt/build/gyp_cobalt
+++ b/src/cobalt/build/gyp_cobalt
@@ -144,7 +144,7 @@
   def __init__(self, options):
     self.options = options
     self.common_args = []
-    self.platform_config = config.LoadPlatformConfig(options.platform)
+    self.platform_config = config.GetPlatformConfig(options.platform)
     if not self.platform_config:
       raise RuntimeError('Unable to load platform configuration.')
 
diff --git a/src/cobalt/css_parser/border_shorthand_property_parse_structures.h b/src/cobalt/css_parser/border_shorthand_property_parse_structures.h
index 1b220c8..49889b2 100644
--- a/src/cobalt/css_parser/border_shorthand_property_parse_structures.h
+++ b/src/cobalt/css_parser/border_shorthand_property_parse_structures.h
@@ -22,13 +22,13 @@
 namespace css_parser {
 
 // This helps parsing and verifying syntax of border shorthand property values.
-struct BorderShorthand {
-  BorderShorthand() : error(false) {}
+struct BorderOrOutlineShorthand {
+  BorderOrOutlineShorthand() : error(false) {}
 
   bool error;
-  scoped_refptr<cssom::PropertyValue> border_color;
-  scoped_refptr<cssom::PropertyValue> border_style;
-  scoped_refptr<cssom::PropertyValue> border_width;
+  scoped_refptr<cssom::PropertyValue> color;
+  scoped_refptr<cssom::PropertyValue> style;
+  scoped_refptr<cssom::PropertyValue> width;
 };
 
 // This helps parsing and verifying syntax of border color/style/width shorthand
diff --git a/src/cobalt/css_parser/grammar.y b/src/cobalt/css_parser/grammar.y
index 86a9ca0..6e4d467 100644
--- a/src/cobalt/css_parser/grammar.y
+++ b/src/cobalt/css_parser/grammar.y
@@ -131,6 +131,10 @@
 %token kMinHeightToken                        // min-height
 %token kMinWidthToken                         // min-width
 %token kOpacityToken                          // opacity
+%token kOutlineToken                          // outline
+%token kOutlineColorToken                     // outline-color
+%token kOutlineStyleToken                     // outline-style
+%token kOutlineWidthToken                     // outline-width
 %token kOverflowToken                         // overflow
 %token kOverflowWrapToken                     // overflow-wrap
 %token kPaddingBottomToken                    // padding-bottom
@@ -138,6 +142,7 @@
 %token kPaddingRightToken                     // padding-right
 %token kPaddingToken                          // padding
 %token kPaddingTopToken                       // padding-top
+%token kPointerEventsToken                    // pointer-events
 %token kPositionToken                         // position
 %token kRightToken                            // right
 %token kSrcToken                              // src
@@ -559,6 +564,7 @@
                        overflow_property_value
                        overflow_wrap_property_value
                        padding_side_property_value
+                       pointer_events_property_value
                        position_list_element
                        position_property_value
                        positive_length_percent_property_value
@@ -858,9 +864,10 @@
 %type <position_structure> position_list
 %destructor { delete $$; } <position_structure>
 
-%union { BorderShorthand* border_shorthand; }
-%type <border_shorthand> border_property_value border_property_list
-%destructor { delete $$; } <border_shorthand>
+%union { BorderOrOutlineShorthand* border_or_outline_shorthand; }
+%type <border_or_outline_shorthand> border_or_outline_property_value
+                                    border_or_outline_property_list
+%destructor { delete $$; } <border_or_outline_shorthand>
 
 %union { ShadowPropertyInfo* shadow_info; }
 %type <shadow_info> box_shadow_list text_shadow_list
@@ -1490,6 +1497,22 @@
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kOpacityProperty));
   }
+  | kOutlineToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineProperty));
+  }
+  | kOutlineColorToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineColorProperty));
+  }
+  | kOutlineStyleToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineStyleProperty));
+  }
+  | kOutlineWidthToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineWidthProperty));
+  }
   | kOverflowToken {
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kOverflowProperty));
@@ -1518,6 +1541,10 @@
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kPaddingTopProperty));
   }
+  | kPointerEventsToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kPointerEventsProperty));
+  }
   | kPositionToken {
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kPositionProperty));
@@ -3360,53 +3387,54 @@
   }
   ;
 
-// border_property_element represents a component of a single border property.
-// It uses $0 to access its parent's BorderShorthand object and build it, so it
-// should always be used to the right of a border shorthand object.
-// The 'border' property is a shorthand property for setting the same width,
-// color, and style for all four borders of a box. Unlike the shorthand
-// 'margin' and 'padding' properties, the 'border' property cannot set
+// border_or_outline_property_element represents a component of a single border
+// property. It uses $0 to access its parent's BorderOrOutlineShorthand object
+// and build it, so it should always be used to the right of a border shorthand
+// object.
+// The 'border' and 'outline' properties are shorthand properties for setting
+// the same width, color, and style for all four borders of a box. Unlike the
+// shorthand 'margin' and 'padding' properties, the 'border' property cannot set
 // different values on the four borders.
-border_property_element:
+border_or_outline_property_element:
     color {
     scoped_refptr<cssom::PropertyValue> color(MakeScopedRefPtrAndRelease($1));
-    if (!$<border_shorthand>0->border_color) {
-      $<border_shorthand>0->border_color = color;
+    if (!$<border_or_outline_shorthand>0->color) {
+      $<border_or_outline_shorthand>0->color = color;
     } else {
       parser_impl->LogError(
-          @1, "border-color value declared twice in border.");
-      $<border_shorthand>0->error = true;
+          @1, "color value declared twice in border or outline.");
+      $<border_or_outline_shorthand>0->error = true;
     }
   }
   | line_style {
     scoped_refptr<cssom::PropertyValue> line_style =
         MakeScopedRefPtrAndRelease($1);
-    if (!$<border_shorthand>0->border_style) {
-      $<border_shorthand>0->border_style = line_style;
+    if (!$<border_or_outline_shorthand>0->style) {
+      $<border_or_outline_shorthand>0->style = line_style;
     } else {
       parser_impl->LogError(
-          @1, "border-style value declared twice in border.");
-      $<border_shorthand>0->error = true;
+          @1, "style value declared twice in border or outline.");
+      $<border_or_outline_shorthand>0->error = true;
     }
   }
   | positive_length {
     scoped_refptr<cssom::PropertyValue> positive_length =
         MakeScopedRefPtrAndRelease($1);
-    if (!$<border_shorthand>0->border_width) {
-      $<border_shorthand>0->border_width = positive_length;
+    if (!$<border_or_outline_shorthand>0->width) {
+      $<border_or_outline_shorthand>0->width = positive_length;
     } else {
       parser_impl->LogError(
-          @1, "border-width value declared twice in border.");
-      $<border_shorthand>0->error = true;
+          @1, "width value declared twice in border or outline.");
+      $<border_or_outline_shorthand>0->error = true;
     }
   }
   ;
 
-border_property_list:
+border_or_outline_property_list:
     /* empty */ {
-    $$ = new BorderShorthand();
+    $$ = new BorderOrOutlineShorthand();
   }
-  | border_property_list border_property_element {
+  | border_or_outline_property_list border_or_outline_property_element {
     $$ = $1;
   }
   ;
@@ -3417,15 +3445,15 @@
 // various properties define the style ('border-style'), color ('border-color'),
 // and thickness ('border-width') of the border.
 //   https://www.w3.org/TR/css3-background/#borders
-border_property_value:
-    border_property_list
+border_or_outline_property_value:
+    border_or_outline_property_list
   | common_values {
     // Replicate the common value into each of the properties that border is a
     // shorthand for.
-    scoped_ptr<BorderShorthand> border(new BorderShorthand());
-    border->border_color = $1;
-    border->border_style = $1;
-    border->border_width = $1;
+    scoped_ptr<BorderOrOutlineShorthand> border(new BorderOrOutlineShorthand());
+    border->color = $1;
+    border->style = $1;
+    border->width = $1;
     $$ = border.release();
   }
   ;
@@ -4169,6 +4197,23 @@
   }
   ;
 
+// Used to control designation of elements by pointers.
+// While only defined in the SVG spec, the pointer-events property has been
+// proposed an commonly implemented to also apply to HTML elements for
+// values of 'none' (element can not be indicated by a pointer) and 'auto'
+// (element can be indicated by a pointer if the element has 'visibility' set
+// to 'visible').
+//   https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty
+pointer_events_property_value:
+    kAutoToken maybe_whitespace {
+    $$ = AddRef(cssom::KeywordValue::GetAuto().get());
+  }
+  | kNoneToken maybe_whitespace {
+    $$ = AddRef(cssom::KeywordValue::GetNone().get());
+  }
+  | common_values
+  ;
+
 // Determines which of the positioning algorithms is used to calculate
 // the position of a box.
 //   https://www.w3.org/TR/CSS21/visuren.html#choose-position
@@ -5324,8 +5369,17 @@
   | kBackgroundColorToken {
     $$ = cssom::kBackgroundColorProperty;
   }
-  | kBorderRadiusToken {
-    $$ = cssom::kBorderRadiusProperty;
+  | kBorderBottomColorToken {
+    $$ = cssom::kBorderBottomColorProperty;
+  }
+  | kBorderLeftColorToken {
+    $$ = cssom::kBorderLeftColorProperty;
+  }
+  | kBorderRightColorToken {
+    $$ = cssom::kBorderRightColorProperty;
+  }
+  | kBorderTopColorToken {
+    $$ = cssom::kBorderTopColorProperty;
   }
   | kColorToken {
     $$ = cssom::kColorProperty;
@@ -5333,6 +5387,12 @@
   | kOpacityToken {
     $$ = cssom::kOpacityProperty;
   }
+  | kOutlineColorToken {
+    $$ = cssom::kOutlineColorProperty;
+  }
+  | kOutlineWidthToken {
+    $$ = cssom::kOutlineWidthProperty;
+  }
   | kTransformToken {
     $$ = cssom::kTransformProperty;
   }
@@ -5494,9 +5554,9 @@
                                       MakeScopedRefPtrAndRelease($4), $5)
             : NULL;
   }
-  | kBorderToken maybe_whitespace colon border_property_value
+  | kBorderToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5505,44 +5565,44 @@
       // Unpack border color.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopColorProperty, border->border_color));
+              cssom::kBorderTopColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightColorProperty, border->border_color));
+              cssom::kBorderRightColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomColorProperty, border->border_color));
+              cssom::kBorderBottomColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftColorProperty, border->border_color));
+              cssom::kBorderLeftColorProperty, border->color));
 
       // Unpack border style.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopStyleProperty, border->border_style));
+              cssom::kBorderTopStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightStyleProperty, border->border_style));
+              cssom::kBorderRightStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomStyleProperty, border->border_style));
+              cssom::kBorderBottomStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftStyleProperty, border->border_style));
+              cssom::kBorderLeftStyleProperty, border->style));
 
       // Unpack border width.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopWidthProperty, border->border_width));
+              cssom::kBorderTopWidthProperty, border->width));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightWidthProperty, border->border_width));
+              cssom::kBorderRightWidthProperty, border->width));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomWidthProperty, border->border_width));
+              cssom::kBorderBottomWidthProperty, border->width));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftWidthProperty, border->border_width));
+              cssom::kBorderLeftWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5550,9 +5610,9 @@
       $$ = NULL;
     }
   }
-  | kBorderBottomToken maybe_whitespace colon border_property_value
+  | kBorderBottomToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5561,13 +5621,13 @@
       // Unpack border bottom.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomColorProperty, border->border_color));
+              cssom::kBorderBottomColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomStyleProperty, border->border_style));
+              cssom::kBorderBottomStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomWidthProperty, border->border_width));
+              cssom::kBorderBottomWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5628,9 +5688,9 @@
       $$ = NULL;
     }
   }
-  | kBorderLeftToken maybe_whitespace colon border_property_value
+  | kBorderLeftToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5639,13 +5699,13 @@
       // Unpack border left.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftColorProperty, border->border_color));
+              cssom::kBorderLeftColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftStyleProperty, border->border_style));
+              cssom::kBorderLeftStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftWidthProperty, border->border_width));
+              cssom::kBorderLeftWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5677,9 +5737,9 @@
                                       MakeScopedRefPtrAndRelease($4), $5)
             : NULL;
   }
-  | kBorderRightToken maybe_whitespace colon border_property_value
+  | kBorderRightToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5688,13 +5748,13 @@
       // Unpack border right.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightColorProperty, border->border_color));
+              cssom::kBorderRightColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightStyleProperty, border->border_style));
+              cssom::kBorderRightStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightWidthProperty, border->border_width));
+              cssom::kBorderRightWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5755,9 +5815,9 @@
       $$ = NULL;
     }
   }
-  | kBorderTopToken maybe_whitespace colon border_property_value
+  | kBorderTopToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5766,13 +5826,13 @@
       // Unpack border top.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopColorProperty, border->border_color));
+              cssom::kBorderTopColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopStyleProperty, border->border_style));
+              cssom::kBorderTopStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopWidthProperty, border->border_width));
+              cssom::kBorderTopWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -6020,6 +6080,53 @@
                                       MakeScopedRefPtrAndRelease($4), $5)
             : NULL;
   }
+  | kOutlineToken maybe_whitespace colon border_or_outline_property_value
+      maybe_important {
+    scoped_ptr<BorderOrOutlineShorthand> outline($4);
+    DCHECK(outline);
+    if (!outline->error) {
+      scoped_ptr<PropertyDeclaration> property_declaration(
+          new PropertyDeclaration($5));
+
+      // Unpack outline color.
+      property_declaration->property_values.push_back(
+          PropertyDeclaration::PropertyKeyValuePair(
+              cssom::kOutlineColorProperty, outline->color));
+
+      // Unpack outline style.
+      property_declaration->property_values.push_back(
+          PropertyDeclaration::PropertyKeyValuePair(
+              cssom::kOutlineStyleProperty, outline->style));
+
+      // Unpack outline width.
+      property_declaration->property_values.push_back(
+          PropertyDeclaration::PropertyKeyValuePair(
+              cssom::kOutlineWidthProperty, outline->width));
+
+      $$ = property_declaration.release();
+    } else {
+      parser_impl->LogWarning(@1, "invalid outline");
+      $$ = NULL;
+    }
+  }
+  | kOutlineColorToken maybe_whitespace colon color_property_value
+      maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kOutlineColorProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
+  | kOutlineStyleToken maybe_whitespace colon line_style_with_common_values
+      maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kOutlineStyleProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
+  | kOutlineWidthToken maybe_whitespace colon
+      border_width_element_with_common_values maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kOutlineWidthProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
   | kOverflowToken maybe_whitespace colon overflow_property_value
       maybe_important {
     $$ = $4 ? new PropertyDeclaration(cssom::kOverflowProperty,
@@ -6081,6 +6188,12 @@
       $$ = NULL;
     }
   }
+  | kPointerEventsToken maybe_whitespace colon pointer_events_property_value
+      maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kPointerEventsProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
   | kPositionToken maybe_whitespace colon position_property_value
       maybe_important {
     $$ = $4 ? new PropertyDeclaration(cssom::kPositionProperty,
diff --git a/src/cobalt/css_parser/parser_test.cc b/src/cobalt/css_parser/parser_test.cc
index e51b2d0..4a7a792 100644
--- a/src/cobalt/css_parser/parser_test.cc
+++ b/src/cobalt/css_parser/parser_test.cc
@@ -3088,7 +3088,7 @@
             style->GetPropertyValue(cssom::kBorderBottomStyleProperty));
 }
 
-TEST_F(ParserTest, ParsesBorderWithInvaildValue) {
+TEST_F(ParserTest, ParsesBorderWithInvalidValue) {
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:9: warning: unsupported value"));
 
@@ -3098,8 +3098,8 @@
 
 TEST_F(ParserTest, InvalidBorderWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:30: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:30: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:1: warning: invalid border"));
 
@@ -3126,8 +3126,8 @@
 
 TEST_F(ParserTest, InvalidBorderBottomWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:37: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:37: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-bottom"));
@@ -3144,8 +3144,8 @@
 
 TEST_F(ParserTest, InvalidBorderLeftWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:35: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:35: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-left"));
@@ -3162,8 +3162,8 @@
 
 TEST_F(ParserTest, InvalidBorderRightWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:36: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:36: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-right"));
@@ -3180,8 +3180,8 @@
 
 TEST_F(ParserTest, InvalidBorderTopWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:34: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:34: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-right"));
@@ -3198,8 +3198,8 @@
 
 TEST_F(ParserTest, InvalidBorderWithTwoStyles) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:15: error: border-style value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:15: error: style value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:1: warning: invalid border"));
 
@@ -3225,8 +3225,8 @@
 
 TEST_F(ParserTest, InvalidBorderWithTwoWidths) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:7: error: border-width value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:7: error: width value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:1: warning: invalid border"));
 
@@ -5111,6 +5111,211 @@
   EXPECT_FLOAT_EQ(1, opaque->value());
 }
 
+TEST_F(ParserTest, ParsesOutlineWithWidthColorAndStyle) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: .5em #fff solid;",
+                                        source_location_);
+
+  scoped_refptr<cssom::LengthValue> outline_width =
+      dynamic_cast<cssom::LengthValue*>(
+          style->GetPropertyValue(cssom::kOutlineWidthProperty).get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_FLOAT_EQ(0.5f, outline_width->value());
+  EXPECT_EQ(cssom::kFontSizesAkaEmUnit, outline_width->unit());
+
+  scoped_refptr<cssom::RGBAColorValue> outline_color =
+      dynamic_cast<cssom::RGBAColorValue*>(
+          style->GetPropertyValue(cssom::kOutlineColorProperty).get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0xffffffff, outline_color->value());
+
+  EXPECT_EQ(cssom::KeywordValue::GetSolid(),
+            style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineWithInvalidValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:10: warning: unsupported value"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: foo, bar;", source_location_);
+}
+
+TEST_F(ParserTest, InvalidOutlineWithTwoColors) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:31: error: color value declared "
+                      "twice in border or outline."));
+  EXPECT_CALL(parser_observer_,
+              OnWarning("[object ParserTest]:1:1: warning: invalid outline"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline: rgba(255,255,255,.1) rgba(255,255,255,.1)",
+          source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, InvalidOutlineWithTwoStyles) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:16: error: style value declared "
+                      "twice in border or outline."));
+  EXPECT_CALL(parser_observer_,
+              OnWarning("[object ParserTest]:1:1: warning: invalid outline"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: solid hidden",
+                                        source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, InvalidOutlineWithTwoWidths) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:8: error: width value declared "
+                      "twice in border or outline."));
+  EXPECT_CALL(parser_observer_,
+              OnWarning("[object ParserTest]:1:1: warning: invalid outline"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: 10px 20px", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineColorWidth) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: gray 20px;",
+                                        source_location_);
+
+  scoped_refptr<cssom::LengthValue> outline_width =
+      dynamic_cast<cssom::LengthValue*>(
+          style->GetPropertyValue(cssom::kOutlineWidthProperty).get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_FLOAT_EQ(20.0f, outline_width->value());
+  EXPECT_EQ(cssom::kPixelsUnit, outline_width->unit());
+
+  scoped_refptr<cssom::RGBAColorValue> outline_color =
+      dynamic_cast<cssom::RGBAColorValue*>(
+          style->GetPropertyValue(cssom::kOutlineColorProperty).get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0x808080FF, outline_color->value());
+}
+
+TEST_F(ParserTest, ParsesOutlineColor) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-color: rgba(0, 0, 0, .8);",
+                                        source_location_);
+
+  scoped_refptr<cssom::RGBAColorValue> outline_color =
+      dynamic_cast<cssom::RGBAColorValue*>(
+          style->GetPropertyValue(cssom::kOutlineColorProperty).get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0x000000cc, outline_color->value());
+}
+
+TEST_F(ParserTest, ParsesOutlineWidth) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-width: .8em;",
+                                        source_location_);
+
+  scoped_refptr<cssom::LengthValue> outline_width =
+      dynamic_cast<cssom::LengthValue*>(
+          style->GetPropertyValue(cssom::kOutlineWidthProperty).get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_FLOAT_EQ(0.8f, outline_width->value());
+  EXPECT_EQ(cssom::kFontSizesAkaEmUnit, outline_width->unit());
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleSolid) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-style: solid;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetSolid(),
+            style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleHidden) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-style: hidden;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetHidden(),
+            style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineColorWithInvalidNumberOfValues) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:23: error: unrecoverable syntax "
+                      "error"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline-color: maroon green transparent #CdC transparent;",
+          source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineColorWithZeroValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:16: warning: unsupported value"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-color: ;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleWithInvalidNumberOfValues) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnError("[object ParserTest]:1:22: error: unrecoverable syntax error"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline-style: solid hidden none solid hidden;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleWithZeroValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:16: warning: unsupported value"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-style: ;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineWidthWithInvalidNumberOfValues) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnError("[object ParserTest]:1:22: error: unrecoverable syntax error"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline-width: 0.2em 12px 0.8em 10px 0.2em 5px;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineWidthWithZeroValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:16: warning: unsupported value"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-width: ;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
 TEST_F(ParserTest, ParsesBreakWordOverflowWrap) {
   scoped_refptr<cssom::CSSDeclaredStyleData> style =
       parser_.ParseStyleDeclarationList("overflow-wrap: break-word;",
@@ -8695,5 +8900,41 @@
   EXPECT_FALSE(style_data->GetPropertyValue(cssom::kDisplayProperty));
 }
 
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordAuto) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: auto;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetAuto(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordInherit) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: inherit;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetInherit(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordInitial) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: initial;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetInitial(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordNone) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: none;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetNone(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
 }  // namespace css_parser
 }  // namespace cobalt
diff --git a/src/cobalt/css_parser/scanner.cc b/src/cobalt/css_parser/scanner.cc
index 01beaa3..b03a7d8 100644
--- a/src/cobalt/css_parser/scanner.cc
+++ b/src/cobalt/css_parser/scanner.cc
@@ -1367,6 +1367,11 @@
         return true;
       }
       if (IsEqualToCssIdentifier(
+              name.begin, cssom::GetPropertyName(cssom::kOutlineProperty))) {
+        *property_name_token = kOutlineToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
               name.begin, cssom::GetPropertyName(cssom::kPaddingProperty))) {
         *property_name_token = kPaddingToken;
         return true;
@@ -1586,6 +1591,24 @@
       }
       if (IsEqualToCssIdentifier(
               name.begin,
+              cssom::GetPropertyName(cssom::kOutlineColorProperty))) {
+        *property_name_token = kOutlineColorToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
+              cssom::GetPropertyName(cssom::kOutlineStyleProperty))) {
+        *property_name_token = kOutlineStyleToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
+              cssom::GetPropertyName(cssom::kOutlineWidthProperty))) {
+        *property_name_token = kOutlineWidthToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
               cssom::GetPropertyName(cssom::kOverflowWrapProperty))) {
         *property_name_token = kOverflowWrapToken;
         return true;
@@ -1625,6 +1648,12 @@
       }
       if (IsEqualToCssIdentifier(
               name.begin,
+              cssom::GetPropertyName(cssom::kPointerEventsProperty))) {
+        *property_name_token = kPointerEventsToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
               cssom::GetPropertyName(cssom::kTextTransformProperty))) {
         *property_name_token = kTextTransformToken;
         return true;
diff --git a/src/cobalt/cssom/animation_set.cc b/src/cobalt/cssom/animation_set.cc
index 7c999e7..ae3ab51 100644
--- a/src/cobalt/cssom/animation_set.cc
+++ b/src/cobalt/cssom/animation_set.cc
@@ -204,5 +204,12 @@
   return animations_modified;
 }
 
+void AnimationSet::Clear() {
+  for (auto& animation : animations_) {
+    event_handler_->OnAnimationRemoved(animation.second);
+  }
+  animations_.clear();
+}
+
 }  // namespace cssom
 }  // namespace cobalt
diff --git a/src/cobalt/cssom/animation_set.h b/src/cobalt/cssom/animation_set.h
index 73c4718..ce98688 100644
--- a/src/cobalt/cssom/animation_set.h
+++ b/src/cobalt/cssom/animation_set.h
@@ -51,6 +51,12 @@
               const CSSComputedStyleData& style,
               const CSSKeyframesRule::NameMap& keyframes_map);
 
+  // Returns true if there are no animations in this set.
+  bool empty() const { return animations_.empty(); }
+
+  // Clears all animations out of this animation set.
+  void Clear();
+
  private:
   // Our internal collection of animations, mapping 'animation-name' to
   // a Animation object.
diff --git a/src/cobalt/cssom/computed_style.cc b/src/cobalt/cssom/computed_style.cc
index 8cccfe5..c26d8e1 100644
--- a/src/cobalt/cssom/computed_style.cc
+++ b/src/cobalt/cssom/computed_style.cc
@@ -2590,11 +2590,12 @@
 
   // Helper function to return the computed border style for an edge based on
   // border width properties.
-  PropertyValue* GetBorderStyleBasedOnWidth(PropertyKey key);
+  PropertyValue* GetBorderOrOutlineStyleBasedOnWidth(PropertyKey key);
   PropertyValue* GetBorderBottomStyle();
   PropertyValue* GetBorderLeftStyle();
   PropertyValue* GetBorderRightStyle();
   PropertyValue* GetBorderTopStyle();
+  PropertyValue* GetOutlineStyle();
 
   // Helper function to return the computed color.
   RGBAColorValue* GetColor();
@@ -2625,6 +2626,7 @@
   scoped_refptr<PropertyValue> computed_border_top_style_;
   scoped_refptr<PropertyValue> computed_color_;
   scoped_refptr<PropertyValue> computed_font_size_;
+  scoped_refptr<PropertyValue> computed_outline_style_;
   scoped_refptr<PropertyValue> computed_position_;
 };
 
@@ -2671,7 +2673,8 @@
   return viewport_size_;
 }
 
-PropertyValue* CalculateComputedStyleContext::GetBorderStyleBasedOnWidth(
+PropertyValue*
+CalculateComputedStyleContext::GetBorderOrOutlineStyleBasedOnWidth(
     PropertyKey key) {
   if (key == kBorderBottomWidthProperty) {
     return GetBorderBottomStyle();
@@ -2679,9 +2682,11 @@
     return GetBorderLeftStyle();
   } else if (key == kBorderRightWidthProperty) {
     return GetBorderRightStyle();
-  } else {
-    DCHECK_EQ(key, kBorderTopWidthProperty);
+  } else if (key == kBorderTopWidthProperty) {
     return GetBorderTopStyle();
+  } else {
+    DCHECK_EQ(key, kOutlineWidthProperty);
+    return GetOutlineStyle();
   }
 }
 
@@ -2730,6 +2735,15 @@
   return base::polymorphic_downcast<RGBAColorValue*>(computed_color_.get());
 }
 
+PropertyValue* CalculateComputedStyleContext::GetOutlineStyle() {
+  if (!computed_outline_style_) {
+    ComputeValue(kOutlineStyleProperty);
+  }
+
+  DCHECK(computed_outline_style_);
+  return computed_outline_style_.get();
+}
+
 void CalculateComputedStyleContext::ComputeValue(PropertyKey key) {
   if (cascaded_style_->IsDeclared(key)) {
     scoped_refptr<PropertyValue>& cascaded_value =
@@ -2779,6 +2793,7 @@
     case kBorderLeftColorProperty:
     case kBorderRightColorProperty:
     case kBorderTopColorProperty:
+    case kOutlineColorProperty:
     case kTextDecorationColorProperty: {
       if (*value == KeywordValue::GetCurrentColor()) {
         // The computed value of the 'currentColor' keyword is the computed
@@ -2789,10 +2804,11 @@
     case kBorderBottomWidthProperty:
     case kBorderLeftWidthProperty:
     case kBorderRightWidthProperty:
-    case kBorderTopWidthProperty: {
+    case kBorderTopWidthProperty:
+    case kOutlineWidthProperty: {
       ComputedBorderWidthProvider border_width_provider(
           GetFontSize(), GetRootFontSize(), GetViewportSizeOnePercent(),
-          GetBorderStyleBasedOnWidth(key));
+          GetBorderOrOutlineStyleBasedOnWidth(key));
       (*value)->Accept(&border_width_provider);
       *value = border_width_provider.computed_border_width();
     } break;
@@ -2969,8 +2985,10 @@
     case kFontFamilyProperty:
     case kFontStyleProperty:
     case kOpacityProperty:
+    case kOutlineStyleProperty:
     case kOverflowProperty:
     case kOverflowWrapProperty:
+    case kPointerEventsProperty:
     case kPositionProperty:
     case kTextAlignProperty:
     case kTextDecorationLineProperty:
@@ -3001,6 +3019,7 @@
     case kBorderWidthProperty:
     case kFontProperty:
     case kMarginProperty:
+    case kOutlineProperty:
     case kPaddingProperty:
     case kSrcProperty:
     case kTextDecorationProperty:
@@ -3036,6 +3055,9 @@
     case kColorProperty:
       computed_color_ = value;
       break;
+    case kOutlineStyleProperty:
+      computed_outline_style_ = value;
+      break;
 
     case kAllProperty:
     case kAnimationDelayProperty:
@@ -3092,6 +3114,9 @@
     case kMinWidthProperty:
     case kNoneProperty:
     case kOpacityProperty:
+    case kOutlineProperty:
+    case kOutlineColorProperty:
+    case kOutlineWidthProperty:
     case kOverflowProperty:
     case kOverflowWrapProperty:
     case kPaddingBottomProperty:
@@ -3099,6 +3124,7 @@
     case kPaddingProperty:
     case kPaddingRightProperty:
     case kPaddingTopProperty:
+    case kPointerEventsProperty:
     case kRightProperty:
     case kSrcProperty:
     case kTextAlignProperty:
diff --git a/src/cobalt/cssom/computed_style_test.cc b/src/cobalt/cssom/computed_style_test.cc
index 85eb3b3..26e0064 100644
--- a/src/cobalt/cssom/computed_style_test.cc
+++ b/src/cobalt/cssom/computed_style_test.cc
@@ -1105,6 +1105,69 @@
   EXPECT_EQ(KeywordValue::GetNone(), computed_style->box_shadow());
 }
 
+TEST(PromoteToComputedStyle, OutlineColorWithCurrentColorValue) {
+  scoped_refptr<CSSComputedStyleData> computed_style(
+      new CSSComputedStyleData());
+  computed_style->set_outline_color(KeywordValue::GetCurrentColor());
+  computed_style->set_color(RGBAColorValue::GetAqua());
+
+  scoped_refptr<CSSComputedStyleData> parent_computed_style(
+      new CSSComputedStyleData());
+  scoped_refptr<CSSComputedStyleDeclaration> parent_computed_style_declaration(
+      CreateComputedStyleDeclaration(parent_computed_style));
+
+  PromoteToComputedStyle(computed_style, parent_computed_style_declaration,
+                         parent_computed_style, math::Size(), NULL);
+
+  scoped_refptr<RGBAColorValue> outline_color =
+      dynamic_cast<RGBAColorValue*>(computed_style->outline_color().get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0x00FFFFFF, outline_color->value());
+}
+
+TEST(PromoteToComputedStyle, OutlineWidthWithOutlineStyleNone) {
+  scoped_refptr<CSSComputedStyleData> computed_style(
+      new CSSComputedStyleData());
+  computed_style->set_outline_style(KeywordValue::GetNone());
+  computed_style->set_outline_width(new LengthValue(2, kFontSizesAkaEmUnit));
+
+  scoped_refptr<CSSComputedStyleData> parent_computed_style(
+      new CSSComputedStyleData());
+  scoped_refptr<CSSComputedStyleDeclaration> parent_computed_style_declaration(
+      CreateComputedStyleDeclaration(parent_computed_style));
+
+  PromoteToComputedStyle(computed_style, parent_computed_style_declaration,
+                         parent_computed_style, math::Size(), NULL);
+
+  scoped_refptr<LengthValue> outline_width =
+      dynamic_cast<LengthValue*>(computed_style->outline_width().get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_EQ(0, outline_width->value());
+  EXPECT_EQ(kPixelsUnit, outline_width->unit());
+}
+
+TEST(PromoteToComputedStyle, OutlineWidthInEmShouldBeComputedAfterFontSize) {
+  scoped_refptr<CSSComputedStyleData> computed_style(
+      new CSSComputedStyleData());
+  computed_style->set_outline_style(KeywordValue::GetSolid());
+  computed_style->set_font_size(new LengthValue(2, kFontSizesAkaEmUnit));
+  computed_style->set_outline_width(new LengthValue(2, kFontSizesAkaEmUnit));
+
+  scoped_refptr<CSSComputedStyleData> parent_computed_style(
+      new CSSComputedStyleData());
+  parent_computed_style->set_font_size(new LengthValue(100, kPixelsUnit));
+  scoped_refptr<CSSComputedStyleDeclaration> parent_computed_style_declaration(
+      CreateComputedStyleDeclaration(parent_computed_style));
+
+  PromoteToComputedStyle(computed_style, parent_computed_style_declaration,
+                         parent_computed_style, math::Size(), NULL);
+
+  scoped_refptr<LengthValue> outline_width =
+      dynamic_cast<LengthValue*>(computed_style->outline_width().get());
+  EXPECT_EQ(400, outline_width->value());
+  EXPECT_EQ(kPixelsUnit, outline_width->unit());
+}
+
 TEST(PromoteToComputedStyle, TextDecorationWithCurrentColor) {
   scoped_refptr<CSSComputedStyleData> computed_style(
       new CSSComputedStyleData());
diff --git a/src/cobalt/cssom/css_computed_style_data.cc b/src/cobalt/cssom/css_computed_style_data.cc
index bdd7115..e0d75a2 100644
--- a/src/cobalt/cssom/css_computed_style_data.cc
+++ b/src/cobalt/cssom/css_computed_style_data.cc
@@ -122,6 +122,7 @@
     case kBorderRightColorProperty:
     case kBorderBottomColorProperty:
     case kBorderLeftColorProperty:
+    case kOutlineColorProperty:
     case kTextDecorationColorProperty:
       // Note that border color and text decoration color are not inherited.
       // The initial value of border color is 'currentColor' which means the
@@ -133,6 +134,7 @@
     case kBorderRightWidthProperty:
     case kBorderBottomWidthProperty:
     case kBorderLeftWidthProperty:
+    case kOutlineWidthProperty:
       // If the border style is 'none' or 'hidden', border width would be 0.
       //   https://www.w3.org/TR/css3-background/#border-width
       if (IsBorderStyleNoneOrHiddenForAnEdge(key)) {
@@ -202,6 +204,8 @@
     case kMinWidthProperty:
     case kNoneProperty:
     case kOpacityProperty:
+    case kOutlineProperty:
+    case kOutlineStyleProperty:
     case kOverflowProperty:
     case kOverflowWrapProperty:
     case kPaddingBottomProperty:
@@ -209,6 +213,7 @@
     case kPaddingProperty:
     case kPaddingRightProperty:
     case kPaddingTopProperty:
+    case kPointerEventsProperty:
     case kPositionProperty:
     case kRightProperty:
     case kSrcProperty:
@@ -243,15 +248,23 @@
 bool CSSComputedStyleData::IsBorderStyleNoneOrHiddenForAnEdge(
     PropertyKey key) const {
   scoped_refptr<PropertyValue> border_style;
-  if (key == kBorderTopWidthProperty) {
-    border_style = border_top_style();
-  } else if (key == kBorderRightWidthProperty) {
-    border_style = border_right_style();
-  } else if (key == kBorderBottomWidthProperty) {
-    border_style = border_bottom_style();
-  } else {
-    DCHECK_EQ(key, kBorderLeftWidthProperty);
-    border_style = border_left_style();
+  switch (key) {
+    case kBorderTopWidthProperty:
+      border_style = border_top_style();
+      break;
+    case kBorderRightWidthProperty:
+      border_style = border_right_style();
+      break;
+    case kBorderBottomWidthProperty:
+      border_style = border_bottom_style();
+      break;
+    case kBorderLeftWidthProperty:
+      border_style = border_left_style();
+      break;
+    default:
+      DCHECK_EQ(key, kOutlineWidthProperty);
+      border_style = outline_style();
+      break;
   }
 
   if (border_style == KeywordValue::GetNone() ||
diff --git a/src/cobalt/cssom/css_computed_style_data.h b/src/cobalt/cssom/css_computed_style_data.h
index 2f86d8f..ab2c0fc 100644
--- a/src/cobalt/cssom/css_computed_style_data.h
+++ b/src/cobalt/cssom/css_computed_style_data.h
@@ -443,6 +443,27 @@
     SetPropertyValue(kOpacityProperty, opacity);
   }
 
+  const scoped_refptr<PropertyValue>& outline_color() const {
+    return GetPropertyValueReference(kOutlineColorProperty);
+  }
+  void set_outline_color(const scoped_refptr<PropertyValue>& outline_color) {
+    SetPropertyValue(kOutlineColorProperty, outline_color);
+  }
+
+  const scoped_refptr<PropertyValue>& outline_style() const {
+    return GetPropertyValueReference(kOutlineStyleProperty);
+  }
+  void set_outline_style(const scoped_refptr<PropertyValue>& outline_style) {
+    SetPropertyValue(kOutlineStyleProperty, outline_style);
+  }
+
+  const scoped_refptr<PropertyValue>& outline_width() const {
+    return GetPropertyValueReference(kOutlineWidthProperty);
+  }
+  void set_outline_width(const scoped_refptr<PropertyValue>& outline_width) {
+    SetPropertyValue(kOutlineWidthProperty, outline_width);
+  }
+
   const scoped_refptr<PropertyValue>& overflow() const {
     return GetPropertyValueReference(kOverflowProperty);
   }
@@ -485,6 +506,13 @@
     SetPropertyValue(kPaddingTopProperty, padding_top);
   }
 
+  const scoped_refptr<PropertyValue>& pointer_events() const {
+    return GetPropertyValueReference(kPointerEventsProperty);
+  }
+  void set_pointer_events(const scoped_refptr<PropertyValue>& pointer_events) {
+    SetPropertyValue(kPointerEventsProperty, pointer_events);
+  }
+
   const scoped_refptr<PropertyValue>& position() const {
     return GetPropertyValueReference(kPositionProperty);
   }
diff --git a/src/cobalt/cssom/css_computed_style_data_test.cc b/src/cobalt/cssom/css_computed_style_data_test.cc
index 4b96bba..f7b4f0c 100644
--- a/src/cobalt/cssom/css_computed_style_data_test.cc
+++ b/src/cobalt/cssom/css_computed_style_data_test.cc
@@ -143,6 +143,471 @@
             style->GetPropertyValue(kBorderRadiusProperty));
 }
 
+TEST(CSSComputedStyleDataTest, BorderTopColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_top_color(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+
+  style->set_border_top_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_top_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+
+  style->SetPropertyValue(kBorderTopColorProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderTopColorComputedInitialValueIsSameAsColor) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderTopColorProperty),
+            KeywordValue::GetCurrentColor());
+  EXPECT_EQ(style->border_top_color(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+
+  style->set_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_top_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+
+  style->SetPropertyValue(kBorderTopColorProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderRightColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_right_color(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+
+  style->set_border_right_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_right_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+
+  style->SetPropertyValue(kBorderRightColorProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderRightColorComputedInitialValueIsSameAsColor) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderRightColorProperty),
+            KeywordValue::GetCurrentColor());
+  EXPECT_EQ(style->border_right_color(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+
+  style->set_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_right_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+
+  style->SetPropertyValue(kBorderRightColorProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderBottomColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_bottom_color(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+
+  style->set_border_bottom_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_bottom_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+
+  style->SetPropertyValue(kBorderBottomColorProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderBottomColorComputedInitialValueIsSameAsColor) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomColorProperty),
+            KeywordValue::GetCurrentColor());
+  EXPECT_EQ(style->border_bottom_color(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+
+  style->set_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_bottom_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+
+  style->SetPropertyValue(kBorderBottomColorProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderLeftColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_left_color(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+
+  style->set_border_left_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_left_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+
+  style->SetPropertyValue(kBorderLeftColorProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderLeftColorComputedInitialValueIsSameAsColor) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftColorProperty),
+            KeywordValue::GetCurrentColor());
+  EXPECT_EQ(style->border_left_color(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+
+  style->set_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_left_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+
+  style->SetPropertyValue(kBorderLeftColorProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderTopStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderTopStyleProperty),
+            style->border_top_style());
+  EXPECT_EQ(style->border_top_style(),
+            style->GetPropertyValue(kBorderTopStyleProperty));
+
+  style->set_border_top_style(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_top_style());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderTopStyleProperty));
+
+  style->SetPropertyValue(kBorderTopStyleProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_style());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopStyleProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderRightStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderRightStyleProperty),
+            style->border_right_style());
+  EXPECT_EQ(style->border_right_style(),
+            style->GetPropertyValue(kBorderRightStyleProperty));
+
+  style->set_border_right_style(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_right_style());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderRightStyleProperty));
+
+  style->SetPropertyValue(kBorderRightStyleProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_style());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightStyleProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderBottomStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomStyleProperty),
+            style->border_bottom_style());
+  EXPECT_EQ(style->border_bottom_style(),
+            style->GetPropertyValue(kBorderBottomStyleProperty));
+
+  style->set_border_bottom_style(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_bottom_style());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderBottomStyleProperty));
+
+  style->SetPropertyValue(kBorderBottomStyleProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_style());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomStyleProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderLeftStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftStyleProperty),
+            style->border_left_style());
+  EXPECT_EQ(style->border_left_style(),
+            style->GetPropertyValue(kBorderLeftStyleProperty));
+
+  style->set_border_left_style(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_left_style());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderLeftStyleProperty));
+
+  style->SetPropertyValue(kBorderLeftStyleProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_style());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftStyleProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderTopWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  style->set_border_top_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderTopWidthProperty),
+            style->border_top_width());
+  EXPECT_EQ(style->border_top_width(),
+            style->GetPropertyValue(kBorderTopWidthProperty));
+
+  style->set_border_top_width(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_top_width());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderTopWidthProperty));
+
+  style->SetPropertyValue(kBorderTopWidthProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderTopWidthIsZeroWhenStyleIsNoneOrHidden) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_top_width(),
+            style->GetPropertyValue(kBorderTopWidthProperty));
+
+  style->set_border_top_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderTopWidthProperty),
+            style->border_top_width());
+
+  style->set_border_top_style(KeywordValue::GetNone());
+  LengthValue* length_value =
+      dynamic_cast<LengthValue*>(style->border_top_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderTopWidthProperty),
+            style->border_top_width());
+
+  style->set_border_top_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderTopWidthProperty),
+            style->border_top_width());
+
+  style->set_border_top_style(KeywordValue::GetHidden());
+  length_value = dynamic_cast<LengthValue*>(style->border_top_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderTopWidthProperty),
+            style->border_top_width());
+
+  style->SetPropertyValue(kBorderTopWidthProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderRightWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  style->set_border_right_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderRightWidthProperty),
+            style->border_right_width());
+  EXPECT_EQ(style->border_right_width(),
+            style->GetPropertyValue(kBorderRightWidthProperty));
+
+  style->set_border_right_width(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_right_width());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderRightWidthProperty));
+
+  style->SetPropertyValue(kBorderRightWidthProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderRightWidthIsZeroWhenStyleIsNoneOrHidden) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_right_width(),
+            style->GetPropertyValue(kBorderRightWidthProperty));
+
+  style->set_border_right_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderRightWidthProperty),
+            style->border_right_width());
+
+  style->set_border_right_style(KeywordValue::GetNone());
+  LengthValue* length_value =
+      dynamic_cast<LengthValue*>(style->border_right_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderRightWidthProperty),
+            style->border_right_width());
+
+  style->set_border_right_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderRightWidthProperty),
+            style->border_right_width());
+
+  style->set_border_right_style(KeywordValue::GetHidden());
+  length_value = dynamic_cast<LengthValue*>(style->border_right_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderRightWidthProperty),
+            style->border_right_width());
+
+  style->SetPropertyValue(kBorderRightWidthProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest,
+     BorderBottomWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_bottom_width(),
+            style->GetPropertyValue(kBorderBottomWidthProperty));
+
+  style->set_border_bottom_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomWidthProperty),
+            style->border_bottom_width());
+  style->set_border_bottom_width(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_bottom_width());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderBottomWidthProperty));
+
+  style->SetPropertyValue(kBorderBottomWidthProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderBottomWidthIsZeroWhenStyleIsNoneOrHidden) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_bottom_width(),
+            style->GetPropertyValue(kBorderBottomWidthProperty));
+
+  style->set_border_bottom_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomWidthProperty),
+            style->border_bottom_width());
+
+  style->set_border_bottom_style(KeywordValue::GetNone());
+  LengthValue* length_value =
+      dynamic_cast<LengthValue*>(style->border_bottom_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderBottomWidthProperty),
+            style->border_bottom_width());
+
+  style->set_border_bottom_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomWidthProperty),
+            style->border_bottom_width());
+
+  style->set_border_bottom_style(KeywordValue::GetHidden());
+  length_value = dynamic_cast<LengthValue*>(style->border_bottom_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderBottomWidthProperty),
+            style->border_bottom_width());
+
+  style->SetPropertyValue(kBorderBottomWidthProperty,
+                          KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderLeftWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  style->set_border_left_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftWidthProperty),
+            style->border_left_width());
+  EXPECT_EQ(style->border_left_width(),
+            style->GetPropertyValue(kBorderLeftWidthProperty));
+
+  style->set_border_left_width(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->border_left_width());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kBorderLeftWidthProperty));
+
+  style->SetPropertyValue(kBorderLeftWidthProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, BorderLeftWidthIsZeroWhenStyleIsNoneOrHidden) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->border_left_width(),
+            style->GetPropertyValue(kBorderLeftWidthProperty));
+
+  style->set_border_left_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftWidthProperty),
+            style->border_left_width());
+
+  style->set_border_left_style(KeywordValue::GetNone());
+  LengthValue* length_value =
+      dynamic_cast<LengthValue*>(style->border_left_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderLeftWidthProperty),
+            style->border_left_width());
+
+  style->set_border_left_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftWidthProperty),
+            style->border_left_width());
+
+  style->set_border_left_style(KeywordValue::GetHidden());
+  length_value = dynamic_cast<LengthValue*>(style->border_left_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kBorderLeftWidthProperty),
+            style->border_left_width());
+
+  style->SetPropertyValue(kBorderLeftWidthProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftWidthProperty));
+}
+
 TEST(CSSComputedStyleDataTest, ColorSettersAndGettersAreConsistent) {
   scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
 
@@ -194,6 +659,23 @@
             style->GetPropertyValue(kDisplayProperty));
 }
 
+TEST(CSSComputedStyleDataTest, FilterSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kFilterProperty), style->filter());
+  EXPECT_EQ(style->filter(), style->GetPropertyValue(kFilterProperty));
+
+  style->set_filter(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->filter());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kFilterProperty));
+
+  style->SetPropertyValue(kFilterProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->filter());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kFilterProperty));
+}
+
 TEST(CSSComputedStyleDataTest, FontFamilySettersAndGettersAreConsistent) {
   scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
 
@@ -454,6 +936,118 @@
             style->GetPropertyValue(kOpacityProperty));
 }
 
+TEST(CSSComputedStyleDataTest, OutlineColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->outline_color(),
+            style->GetPropertyValue(kOutlineColorProperty));
+
+  style->set_outline_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->outline_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kOutlineColorProperty));
+
+  style->SetPropertyValue(kOutlineColorProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->outline_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest, OutlineColorComputedInitialValueIsSameAsColor) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kOutlineColorProperty),
+            KeywordValue::GetCurrentColor());
+  EXPECT_EQ(style->outline_color(),
+            style->GetPropertyValue(kOutlineColorProperty));
+
+  style->set_color(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->outline_color());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kOutlineColorProperty));
+
+  style->SetPropertyValue(kOutlineColorProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->outline_color());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineColorProperty));
+}
+
+TEST(CSSComputedStyleDataTest, OutlineStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kOutlineStyleProperty),
+            style->outline_style());
+  EXPECT_EQ(style->outline_style(),
+            style->GetPropertyValue(kOutlineStyleProperty));
+
+  style->set_outline_style(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->outline_style());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kOutlineStyleProperty));
+
+  style->SetPropertyValue(kOutlineStyleProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->outline_style());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineStyleProperty));
+}
+
+TEST(CSSComputedStyleDataTest, OutlineWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  style->set_outline_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kOutlineWidthProperty),
+            style->outline_width());
+  EXPECT_EQ(style->outline_width(),
+            style->GetPropertyValue(kOutlineWidthProperty));
+
+  style->set_outline_width(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->outline_width());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kOutlineWidthProperty));
+
+  style->SetPropertyValue(kOutlineWidthProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->outline_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineWidthProperty));
+}
+
+TEST(CSSComputedStyleDataTest, OutlineWidthIsZeroWhenStyleIsNoneOrHidden) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(style->outline_width(),
+            style->GetPropertyValue(kOutlineWidthProperty));
+
+  style->set_outline_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kOutlineWidthProperty),
+            style->outline_width());
+
+  style->set_outline_style(KeywordValue::GetNone());
+  LengthValue* length_value =
+      dynamic_cast<LengthValue*>(style->outline_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kOutlineWidthProperty),
+            style->outline_width());
+
+  style->set_outline_style(KeywordValue::GetSolid());
+  EXPECT_EQ(GetPropertyInitialValue(kOutlineWidthProperty),
+            style->outline_width());
+
+  style->set_outline_style(KeywordValue::GetHidden());
+  length_value = dynamic_cast<LengthValue*>(style->outline_width().get());
+  ASSERT_TRUE(length_value);
+  EXPECT_EQ(0.0f, length_value->value());
+  EXPECT_EQ(kPixelsUnit, length_value->unit());
+  EXPECT_NE(GetPropertyInitialValue(kOutlineWidthProperty),
+            style->outline_width());
+
+  style->SetPropertyValue(kOutlineWidthProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->outline_width());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineWidthProperty));
+}
+
 TEST(CSSComputedStyleDataTest, OverflowSettersAndGettersAreConsistent) {
   scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
 
@@ -564,6 +1158,25 @@
             style->GetPropertyValue(kPaddingTopProperty));
 }
 
+TEST(CSSComputedStyleDataTest, PointerEventsSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+
+  EXPECT_EQ(GetPropertyInitialValue(kPointerEventsProperty),
+            style->pointer_events());
+  EXPECT_EQ(style->pointer_events(),
+            style->GetPropertyValue(kPointerEventsProperty));
+
+  style->set_pointer_events(KeywordValue::GetInitial());
+  EXPECT_EQ(KeywordValue::GetInitial(), style->pointer_events());
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kPointerEventsProperty));
+
+  style->SetPropertyValue(kPointerEventsProperty, KeywordValue::GetInherit());
+  EXPECT_EQ(KeywordValue::GetInherit(), style->pointer_events());
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kPointerEventsProperty));
+}
+
 TEST(CSSComputedStyleDataTest, PositionSettersAndGettersAreConsistent) {
   scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
 
@@ -881,236 +1494,59 @@
             style->GetPropertyValue(kZIndexProperty));
 }
 
-TEST(CSSComputedStyleDataTest,
-     BorderTopColorComputedInitialValueIsSameAsColor) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+TEST(CSSComputedStyleDataTest, TwoComputedStyleDataWithSamePropertiesAreEqual) {
+  scoped_refptr<CSSComputedStyleData> style1 = new CSSComputedStyleData();
+  style1->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
+  scoped_refptr<CSSComputedStyleData> style2 = new CSSComputedStyleData();
+  style2->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
 
-  EXPECT_EQ(GetPropertyInitialValue(kBorderTopColorProperty),
-            KeywordValue::GetCurrentColor());
-  EXPECT_EQ(style->border_top_color(),
-            style->GetPropertyValue(kBorderTopColorProperty));
-
-  style->set_color(KeywordValue::GetInitial());
-  EXPECT_EQ(KeywordValue::GetInitial(), style->border_top_color());
-  EXPECT_EQ(KeywordValue::GetInitial(),
-            style->GetPropertyValue(kBorderTopColorProperty));
-
-  style->SetPropertyValue(kBorderTopColorProperty, KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_color());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderTopColorProperty));
+  ASSERT_TRUE(style1->DoDeclaredPropertiesMatch(style2));
+  ASSERT_TRUE(style2->DoDeclaredPropertiesMatch(style1));
 }
 
 TEST(CSSComputedStyleDataTest,
-     BorderRightColorComputedInitialValueIsSameAsColor) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+     TwoComputedStyleDataWithDifferentPropertiesAreUnequal) {
+  scoped_refptr<CSSComputedStyleData> style1 = new CSSComputedStyleData();
+  style1->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
+  scoped_refptr<CSSComputedStyleData> style2 = new CSSComputedStyleData();
+  style2->SetPropertyValue(kBorderRightWidthProperty,
+                           KeywordValue::GetInherit());
 
-  EXPECT_EQ(GetPropertyInitialValue(kBorderRightColorProperty),
-            KeywordValue::GetCurrentColor());
-  EXPECT_EQ(style->border_right_color(),
-            style->GetPropertyValue(kBorderRightColorProperty));
-
-  style->set_color(KeywordValue::GetInitial());
-  EXPECT_EQ(KeywordValue::GetInitial(), style->border_right_color());
-  EXPECT_EQ(KeywordValue::GetInitial(),
-            style->GetPropertyValue(kBorderRightColorProperty));
-
-  style->SetPropertyValue(kBorderRightColorProperty,
-                          KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_color());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderRightColorProperty));
+  ASSERT_FALSE(style1->DoDeclaredPropertiesMatch(style2));
+  ASSERT_FALSE(style2->DoDeclaredPropertiesMatch(style1));
 }
 
 TEST(CSSComputedStyleDataTest,
-     BorderBottomColorComputedInitialValueIsSameAsColor) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+     ComputedStyleDataIsUnequalToComputedStyleDataWithPropertySuperset) {
+  scoped_refptr<CSSComputedStyleData> style1 = new CSSComputedStyleData();
+  style1->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
+  scoped_refptr<CSSComputedStyleData> style2 = new CSSComputedStyleData();
+  style2->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
+  style2->SetPropertyValue(kBorderRightWidthProperty,
+                           KeywordValue::GetInherit());
 
-  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomColorProperty),
-            KeywordValue::GetCurrentColor());
-  EXPECT_EQ(style->border_bottom_color(),
-            style->GetPropertyValue(kBorderBottomColorProperty));
-
-  style->set_color(KeywordValue::GetInitial());
-  EXPECT_EQ(KeywordValue::GetInitial(), style->border_bottom_color());
-  EXPECT_EQ(KeywordValue::GetInitial(),
-            style->GetPropertyValue(kBorderBottomColorProperty));
-
-  style->SetPropertyValue(kBorderBottomColorProperty,
-                          KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_color());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderBottomColorProperty));
+  ASSERT_FALSE(style1->DoDeclaredPropertiesMatch(style2));
+  ASSERT_FALSE(style2->DoDeclaredPropertiesMatch(style1));
 }
 
 TEST(CSSComputedStyleDataTest,
-     BorderLeftColorComputedInitialValueIsSameAsColor) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
+     ComputedStyleDataIsUnequalToComputedStyleDataWithPropertySubset) {
+  scoped_refptr<CSSComputedStyleData> style1 = new CSSComputedStyleData();
+  style1->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
+  style1->SetPropertyValue(kBorderRightWidthProperty,
+                           KeywordValue::GetInherit());
+  scoped_refptr<CSSComputedStyleData> style2 = new CSSComputedStyleData();
+  style2->SetPropertyValue(kBorderLeftWidthProperty,
+                           KeywordValue::GetInherit());
 
-  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftColorProperty),
-            KeywordValue::GetCurrentColor());
-  EXPECT_EQ(style->border_left_color(),
-            style->GetPropertyValue(kBorderLeftColorProperty));
-
-  style->set_color(KeywordValue::GetInitial());
-  EXPECT_EQ(KeywordValue::GetInitial(), style->border_left_color());
-  EXPECT_EQ(KeywordValue::GetInitial(),
-            style->GetPropertyValue(kBorderLeftColorProperty));
-
-  style->SetPropertyValue(kBorderLeftColorProperty, KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_color());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderLeftColorProperty));
-}
-
-TEST(CSSComputedStyleDataTest, BorderTopWidthIsZeroWhenStyleIsNoneOrHidden) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
-
-  EXPECT_EQ(style->border_top_width(),
-            style->GetPropertyValue(kBorderTopWidthProperty));
-
-  style->set_border_top_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderTopWidthProperty),
-            style->border_top_width());
-
-  style->set_border_top_style(KeywordValue::GetNone());
-  LengthValue* length_value =
-      dynamic_cast<LengthValue*>(style->border_top_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderTopWidthProperty),
-            style->border_top_width());
-
-  style->set_border_top_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderTopWidthProperty),
-            style->border_top_width());
-
-  style->set_border_top_style(KeywordValue::GetHidden());
-  length_value = dynamic_cast<LengthValue*>(style->border_top_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderTopWidthProperty),
-            style->border_top_width());
-
-  style->SetPropertyValue(kBorderTopWidthProperty, KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_top_width());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderTopWidthProperty));
-}
-
-TEST(CSSComputedStyleDataTest, BorderRightWidthIsZeroWhenStyleIsNoneOrHidden) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
-
-  EXPECT_EQ(style->border_right_width(),
-            style->GetPropertyValue(kBorderRightWidthProperty));
-
-  style->set_border_right_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderRightWidthProperty),
-            style->border_right_width());
-
-  style->set_border_right_style(KeywordValue::GetNone());
-  LengthValue* length_value =
-      dynamic_cast<LengthValue*>(style->border_right_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderRightWidthProperty),
-            style->border_right_width());
-
-  style->set_border_right_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderRightWidthProperty),
-            style->border_right_width());
-
-  style->set_border_right_style(KeywordValue::GetHidden());
-  length_value = dynamic_cast<LengthValue*>(style->border_right_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderRightWidthProperty),
-            style->border_right_width());
-
-  style->SetPropertyValue(kBorderRightWidthProperty,
-                          KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_right_width());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderRightWidthProperty));
-}
-
-TEST(CSSComputedStyleDataTest, BorderBottomWidthIsZeroWhenStyleIsNoneOrHidden) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
-
-  EXPECT_EQ(style->border_bottom_width(),
-            style->GetPropertyValue(kBorderBottomWidthProperty));
-
-  style->set_border_bottom_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomWidthProperty),
-            style->border_bottom_width());
-
-  style->set_border_bottom_style(KeywordValue::GetNone());
-  LengthValue* length_value =
-      dynamic_cast<LengthValue*>(style->border_bottom_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderBottomWidthProperty),
-            style->border_bottom_width());
-
-  style->set_border_bottom_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderBottomWidthProperty),
-            style->border_bottom_width());
-
-  style->set_border_bottom_style(KeywordValue::GetHidden());
-  length_value = dynamic_cast<LengthValue*>(style->border_bottom_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderBottomWidthProperty),
-            style->border_bottom_width());
-
-  style->SetPropertyValue(kBorderBottomWidthProperty,
-                          KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_bottom_width());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderBottomWidthProperty));
-}
-
-TEST(CSSComputedStyleDataTest, BorderLeftWidthIsZeroWhenStyleIsNoneOrHidden) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
-
-  EXPECT_EQ(style->border_left_width(),
-            style->GetPropertyValue(kBorderLeftWidthProperty));
-
-  style->set_border_left_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftWidthProperty),
-            style->border_left_width());
-
-  style->set_border_left_style(KeywordValue::GetNone());
-  LengthValue* length_value =
-      dynamic_cast<LengthValue*>(style->border_left_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderLeftWidthProperty),
-            style->border_left_width());
-
-  style->set_border_left_style(KeywordValue::GetSolid());
-  EXPECT_EQ(GetPropertyInitialValue(kBorderLeftWidthProperty),
-            style->border_left_width());
-
-  style->set_border_left_style(KeywordValue::GetHidden());
-  length_value = dynamic_cast<LengthValue*>(style->border_left_width().get());
-  ASSERT_TRUE(length_value);
-  EXPECT_EQ(0.0f, length_value->value());
-  EXPECT_EQ(kPixelsUnit, length_value->unit());
-  EXPECT_NE(GetPropertyInitialValue(kBorderLeftWidthProperty),
-            style->border_left_width());
-
-  style->SetPropertyValue(kBorderLeftWidthProperty, KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->border_left_width());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderLeftWidthProperty));
+  ASSERT_FALSE(style1->DoDeclaredPropertiesMatch(style2));
+  ASSERT_FALSE(style2->DoDeclaredPropertiesMatch(style1));
 }
 
 TEST(CSSComputedStyleDataTest, DisplayIsBlockWhenPositionIsAbsoluteOrFixed) {
@@ -1189,22 +1625,5 @@
   ASSERT_TRUE(style2->DoDeclaredPropertiesMatch(style1));
 }
 
-TEST(CSSComputedStyleDataTest, FilterSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSComputedStyleData> style = new CSSComputedStyleData();
-
-  EXPECT_EQ(GetPropertyInitialValue(kFilterProperty), style->filter());
-  EXPECT_EQ(style->filter(), style->GetPropertyValue(kFilterProperty));
-
-  style->set_filter(KeywordValue::GetInitial());
-  EXPECT_EQ(KeywordValue::GetInitial(), style->filter());
-  EXPECT_EQ(KeywordValue::GetInitial(),
-            style->GetPropertyValue(kFilterProperty));
-
-  style->SetPropertyValue(kFilterProperty, KeywordValue::GetInherit());
-  EXPECT_EQ(KeywordValue::GetInherit(), style->filter());
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kFilterProperty));
-}
-
 }  // namespace cssom
 }  // namespace cobalt
diff --git a/src/cobalt/cssom/css_declared_style_data_test.cc b/src/cobalt/cssom/css_declared_style_data_test.cc
index 8ef723b..ae9a990 100644
--- a/src/cobalt/cssom/css_declared_style_data_test.cc
+++ b/src/cobalt/cssom/css_declared_style_data_test.cc
@@ -93,6 +93,141 @@
             style->GetPropertyValue(kBorderRadiusProperty));
 }
 
+TEST(CSSDeclaredStyleDataTest, BorderTopColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderTopColorProperty));
+
+  style->SetPropertyValueAndImportance(kBorderTopColorProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopColorProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderRightColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderRightColorProperty));
+
+  style->SetPropertyValueAndImportance(kBorderRightColorProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightColorProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest,
+     BorderBottomColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderBottomColorProperty));
+
+  style->SetPropertyValueAndImportance(kBorderBottomColorProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomColorProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderLeftColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderLeftColorProperty));
+
+  style->SetPropertyValueAndImportance(kBorderLeftColorProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftColorProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderTopStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderTopStyleProperty));
+
+  style->SetPropertyValueAndImportance(kBorderTopStyleProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopStyleProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderRightStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderRightStyleProperty));
+
+  style->SetPropertyValueAndImportance(kBorderRightStyleProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightStyleProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest,
+     BorderBottomStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderBottomStyleProperty));
+
+  style->SetPropertyValueAndImportance(kBorderBottomStyleProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomStyleProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderLeftStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderLeftStyleProperty));
+
+  style->SetPropertyValueAndImportance(kBorderLeftStyleProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftStyleProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderTopWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderTopWidthProperty));
+
+  style->SetPropertyValueAndImportance(kBorderTopWidthProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderTopWidthProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderRightWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderRightWidthProperty));
+
+  style->SetPropertyValueAndImportance(kBorderRightWidthProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderRightWidthProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest,
+     BorderBottomWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderBottomWidthProperty));
+
+  style->SetPropertyValueAndImportance(kBorderBottomWidthProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderBottomWidthProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, BorderLeftWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kBorderLeftWidthProperty));
+
+  style->SetPropertyValueAndImportance(kBorderLeftWidthProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kBorderLeftWidthProperty));
+}
+
 TEST(CSSDeclaredStyleDataTest, ColorSettersAndGettersAreConsistent) {
   scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
 
@@ -302,6 +437,39 @@
             style->GetPropertyValue(kOpacityProperty));
 }
 
+TEST(CSSDeclaredStyleDataTest, OutlineColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kOutlineColorProperty));
+
+  style->SetPropertyValueAndImportance(kOutlineColorProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineColorProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, OutlineStyleSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kOutlineStyleProperty));
+
+  style->SetPropertyValueAndImportance(kOutlineStyleProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineStyleProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest, OutlineWidthSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kOutlineWidthProperty));
+
+  style->SetPropertyValueAndImportance(kOutlineWidthProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kOutlineWidthProperty));
+}
+
 TEST(CSSDeclaredStyleDataTest, OverflowSettersAndGettersAreConsistent) {
   scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
 
@@ -368,6 +536,22 @@
             style->GetPropertyValue(kPaddingTopProperty));
 }
 
+TEST(CSSDeclaredStyleDataTest, PointerEventsSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kPointerEventsProperty));
+
+  style->SetPropertyValueAndImportance(kPointerEventsProperty,
+                                       KeywordValue::GetInitial(), false);
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kPointerEventsProperty));
+
+  style->SetPropertyValueAndImportance(kPointerEventsProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kPointerEventsProperty));
+}
+
 TEST(CSSDeclaredStyleDataTest, PositionSettersAndGettersAreConsistent) {
   scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
 
@@ -390,6 +574,40 @@
             style->GetPropertyValue(kTextAlignProperty));
 }
 
+TEST(CSSDeclaredStyleDataTest,
+     TextDecorationColorSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kTextDecorationColorProperty));
+
+  style->SetPropertyValueAndImportance(kTextDecorationColorProperty,
+                                       KeywordValue::GetInitial(), false);
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kTextDecorationColorProperty));
+
+  style->SetPropertyValueAndImportance(kTextDecorationColorProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kTextDecorationColorProperty));
+}
+
+TEST(CSSDeclaredStyleDataTest,
+     TextDecorationLineSettersAndGettersAreConsistent) {
+  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
+
+  EXPECT_FALSE(style->GetPropertyValue(kTextDecorationLineProperty));
+
+  style->SetPropertyValueAndImportance(kTextDecorationLineProperty,
+                                       KeywordValue::GetInitial(), false);
+  EXPECT_EQ(KeywordValue::GetInitial(),
+            style->GetPropertyValue(kTextDecorationLineProperty));
+
+  style->SetPropertyValueAndImportance(kTextDecorationLineProperty,
+                                       KeywordValue::GetInherit(), false);
+  EXPECT_EQ(KeywordValue::GetInherit(),
+            style->GetPropertyValue(kTextDecorationLineProperty));
+}
+
 TEST(CSSDeclaredStyleDataTest, TextIndentSettersAndGettersAreConsistent) {
   scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
 
@@ -552,96 +770,6 @@
   EXPECT_FALSE(style->IsDeclaredPropertyImportant(kVerticalAlignProperty));
 }
 
-TEST(CSSDeclaredStyleDataTest, BorderTopColorSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderTopColorProperty));
-
-  style->SetPropertyValueAndImportance(kBorderTopColorProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderTopColorProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest, BorderRightColorSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderRightColorProperty));
-
-  style->SetPropertyValueAndImportance(kBorderRightColorProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderRightColorProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest,
-     BorderBottomColorSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderBottomColorProperty));
-
-  style->SetPropertyValueAndImportance(kBorderBottomColorProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderBottomColorProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest, BorderLeftColorSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderLeftColorProperty));
-
-  style->SetPropertyValueAndImportance(kBorderLeftColorProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderLeftColorProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest, BorderTopWidthSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderTopWidthProperty));
-
-  style->SetPropertyValueAndImportance(kBorderTopWidthProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderTopWidthProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest, BorderRightWidthSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderRightWidthProperty));
-
-  style->SetPropertyValueAndImportance(kBorderRightWidthProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderRightWidthProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest,
-     BorderBottomWidthSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderBottomWidthProperty));
-
-  style->SetPropertyValueAndImportance(kBorderBottomWidthProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderBottomWidthProperty));
-}
-
-TEST(CSSDeclaredStyleDataTest, BorderLeftWidthSettersAndGettersAreConsistent) {
-  scoped_refptr<CSSDeclaredStyleData> style = new CSSDeclaredStyleData();
-
-  EXPECT_FALSE(style->GetPropertyValue(kBorderLeftWidthProperty));
-
-  style->SetPropertyValueAndImportance(kBorderLeftWidthProperty,
-                                       KeywordValue::GetInherit(), false);
-  EXPECT_EQ(KeywordValue::GetInherit(),
-            style->GetPropertyValue(kBorderLeftWidthProperty));
-}
-
 TEST(CSSDeclaredStyleDataTest, TwoDeclaredStyleDataWithSamePropertiesAreEqual) {
   scoped_refptr<CSSDeclaredStyleData> style1 = new CSSDeclaredStyleData();
   style1->SetPropertyValueAndImportance(kBorderLeftWidthProperty,
diff --git a/src/cobalt/cssom/css_declared_style_declaration_test.cc b/src/cobalt/cssom/css_declared_style_declaration_test.cc
index e1aa0ab..00eb1f1 100644
--- a/src/cobalt/cssom/css_declared_style_declaration_test.cc
+++ b/src/cobalt/cssom/css_declared_style_declaration_test.cc
@@ -455,6 +455,22 @@
   width->set_border_top_width(border_top_width, NULL);
 }
 
+TEST(CSSDeclaredStyleDeclarationTest, BorderWidthSetter) {
+  testing::MockCSSParser css_parser;
+  scoped_refptr<CSSDeclaredStyleDeclaration> width =
+      new CSSDeclaredStyleDeclaration(&css_parser);
+
+  const std::string border_width = "10px";
+  MockMutationObserver observer;
+  width->set_mutation_observer(&observer);
+
+  EXPECT_CALL(css_parser,
+              ParsePropertyIntoDeclarationData(
+                  GetPropertyName(kBorderWidthProperty), border_width, _, _));
+  EXPECT_CALL(observer, OnCSSMutation()).Times(1);
+  width->set_border_width(border_width, NULL);
+}
+
 TEST(CSSDeclaredStyleDeclarationTest, BottomSetter) {
   testing::MockCSSParser css_parser;
   scoped_refptr<CSSDeclaredStyleDeclaration> style =
@@ -834,6 +850,70 @@
   style->set_opacity(opacity, NULL);
 }
 
+TEST(CSSDeclaredStyleDeclarationTest, OutlineSetter) {
+  testing::MockCSSParser css_parser;
+  scoped_refptr<CSSDeclaredStyleDeclaration> style =
+      new CSSDeclaredStyleDeclaration(&css_parser);
+
+  const std::string outline = "100px";
+  MockMutationObserver observer;
+  style->set_mutation_observer(&observer);
+
+  EXPECT_CALL(css_parser,
+              ParsePropertyIntoDeclarationData(
+                  GetPropertyName(kOutlineProperty), outline, _, _));
+  EXPECT_CALL(observer, OnCSSMutation()).Times(1);
+  style->set_outline(outline, NULL);
+}
+
+TEST(CSSDeclaredStyleDeclarationTest, OutlineColorSetter) {
+  testing::MockCSSParser css_parser;
+  scoped_refptr<CSSDeclaredStyleDeclaration> style =
+      new CSSDeclaredStyleDeclaration(&css_parser);
+
+  const std::string outline_color = "#010203";
+  MockMutationObserver observer;
+  style->set_mutation_observer(&observer);
+
+  EXPECT_CALL(css_parser,
+              ParsePropertyIntoDeclarationData(
+                  GetPropertyName(kOutlineColorProperty), outline_color, _, _));
+  EXPECT_CALL(observer, OnCSSMutation()).Times(1);
+  style->set_outline_color(outline_color, NULL);
+}
+
+TEST(CSSDeclaredStyleDeclarationTest, OutlineStyleSetter) {
+  testing::MockCSSParser css_parser;
+  scoped_refptr<CSSDeclaredStyleDeclaration> style =
+      new CSSDeclaredStyleDeclaration(&css_parser);
+
+  const std::string outline_style = "solid";
+  MockMutationObserver observer;
+  style->set_mutation_observer(&observer);
+
+  EXPECT_CALL(css_parser,
+              ParsePropertyIntoDeclarationData(
+                  GetPropertyName(kOutlineStyleProperty), outline_style, _, _));
+  EXPECT_CALL(observer, OnCSSMutation()).Times(1);
+  style->set_outline_style(outline_style, NULL);
+}
+
+TEST(CSSDeclaredStyleDeclarationTest, OutlineWidthSetter) {
+  testing::MockCSSParser css_parser;
+  scoped_refptr<CSSDeclaredStyleDeclaration> width =
+      new CSSDeclaredStyleDeclaration(&css_parser);
+
+  const std::string outline_width = "10px";
+  MockMutationObserver observer;
+  width->set_mutation_observer(&observer);
+
+  EXPECT_CALL(css_parser,
+              ParsePropertyIntoDeclarationData(
+                  GetPropertyName(kOutlineWidthProperty), outline_width, _, _));
+  EXPECT_CALL(observer, OnCSSMutation()).Times(1);
+  width->set_outline_width(outline_width, NULL);
+}
+
 TEST(CSSDeclaredStyleDeclarationTest, OverflowSetter) {
   testing::MockCSSParser css_parser;
   scoped_refptr<CSSDeclaredStyleDeclaration> style =
diff --git a/src/cobalt/cssom/css_style_declaration.cc b/src/cobalt/cssom/css_style_declaration.cc
index 0a3e997..7542e1b 100644
--- a/src/cobalt/cssom/css_style_declaration.cc
+++ b/src/cobalt/cssom/css_style_declaration.cc
@@ -716,6 +716,49 @@
   SetPropertyValueStringByKey(kOpacityProperty, opacity, exception_state);
 }
 
+std::string CSSStyleDeclaration::outline(
+    script::ExceptionState* /*exception_state*/) const {
+  return GetDeclaredPropertyValueStringByKey(kOutlineProperty);
+}
+
+void CSSStyleDeclaration::set_outline(const std::string& outline,
+                                      script::ExceptionState* exception_state) {
+  SetPropertyValueStringByKey(kOutlineProperty, outline, exception_state);
+}
+
+std::string CSSStyleDeclaration::outline_color(
+    script::ExceptionState* /*exception_state*/) const {
+  return GetDeclaredPropertyValueStringByKey(kOutlineColorProperty);
+}
+
+void CSSStyleDeclaration::set_outline_color(
+    const std::string& outline_color, script::ExceptionState* exception_state) {
+  SetPropertyValueStringByKey(kOutlineColorProperty, outline_color,
+                              exception_state);
+}
+
+std::string CSSStyleDeclaration::outline_style(
+    script::ExceptionState* /*exception_state*/) const {
+  return GetDeclaredPropertyValueStringByKey(kOutlineStyleProperty);
+}
+
+void CSSStyleDeclaration::set_outline_style(
+    const std::string& outline_style, script::ExceptionState* exception_state) {
+  SetPropertyValueStringByKey(kOutlineStyleProperty, outline_style,
+                              exception_state);
+}
+
+std::string CSSStyleDeclaration::outline_width(
+    script::ExceptionState* /*exception_state*/) const {
+  return GetDeclaredPropertyValueStringByKey(kOutlineWidthProperty);
+}
+
+void CSSStyleDeclaration::set_outline_width(
+    const std::string& outline_width, script::ExceptionState* exception_state) {
+  SetPropertyValueStringByKey(kOutlineWidthProperty, outline_width,
+                              exception_state);
+}
+
 std::string CSSStyleDeclaration::overflow(
     script::ExceptionState* /*exception_state*/) const {
   return GetDeclaredPropertyValueStringByKey(kOverflowProperty);
@@ -796,6 +839,18 @@
                               exception_state);
 }
 
+std::string CSSStyleDeclaration::pointer_events(
+    script::ExceptionState* /*exception_state*/) const {
+  return GetDeclaredPropertyValueStringByKey(kPointerEventsProperty);
+}
+
+void CSSStyleDeclaration::set_pointer_events(
+    const std::string& pointer_events,
+    script::ExceptionState* exception_state) {
+  SetPropertyValueStringByKey(kPointerEventsProperty, pointer_events,
+                              exception_state);
+}
+
 std::string CSSStyleDeclaration::position(
     script::ExceptionState* /*exception_state*/) const {
   return GetDeclaredPropertyValueStringByKey(kPositionProperty);
diff --git a/src/cobalt/cssom/css_style_declaration.h b/src/cobalt/cssom/css_style_declaration.h
index d6d2b61..42d159d 100644
--- a/src/cobalt/cssom/css_style_declaration.h
+++ b/src/cobalt/cssom/css_style_declaration.h
@@ -286,6 +286,22 @@
   void set_opacity(const std::string& opacity,
                    script::ExceptionState* exception_state);
 
+  std::string outline(script::ExceptionState* exception_state) const;
+  void set_outline(const std::string& outline,
+                   script::ExceptionState* exception_state);
+
+  std::string outline_color(script::ExceptionState* exception_state) const;
+  void set_outline_color(const std::string& outline_color,
+                         script::ExceptionState* exception_state);
+
+  std::string outline_style(script::ExceptionState* exception_state) const;
+  void set_outline_style(const std::string& outline_style,
+                         script::ExceptionState* exception_state);
+
+  std::string outline_width(script::ExceptionState* exception_state) const;
+  void set_outline_width(const std::string& outline_width,
+                         script::ExceptionState* exception_state);
+
   std::string overflow(script::ExceptionState* exception_state) const;
   void set_overflow(const std::string& overflow,
                     script::ExceptionState* exception_state);
@@ -314,6 +330,10 @@
   void set_padding_top(const std::string& padding_top,
                        script::ExceptionState* exception_state);
 
+  std::string pointer_events(script::ExceptionState* exception_state) const;
+  void set_pointer_events(const std::string& pointer_events,
+                          script::ExceptionState* exception_state);
+
   std::string position(script::ExceptionState* exception_state) const;
   void set_position(const std::string& position,
                     script::ExceptionState* exception_state);
diff --git a/src/cobalt/cssom/css_style_declaration.idl b/src/cobalt/cssom/css_style_declaration.idl
index 4a744a7..3a92ed1 100644
--- a/src/cobalt/cssom/css_style_declaration.idl
+++ b/src/cobalt/cssom/css_style_declaration.idl
@@ -75,6 +75,10 @@
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString minHeight;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString minWidth;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString opacity;
+  [TreatNullAs=EmptyString, RaisesException] attribute DOMString outline;
+  [TreatNullAs=EmptyString, RaisesException] attribute DOMString outlineColor;
+  [TreatNullAs=EmptyString, RaisesException] attribute DOMString outlineStyle;
+  [TreatNullAs=EmptyString, RaisesException] attribute DOMString outlineWidth;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString overflow;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString overflowWrap;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString padding;
@@ -82,10 +86,12 @@
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString paddingLeft;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString paddingRight;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString paddingTop;
+  [TreatNullAs=EmptyString, RaisesException] attribute DOMString pointerEvents;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString position;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString right;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString textAlign;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString textDecoration;
+  [TreatNullAs=EmptyString, RaisesException] attribute DOMString textDecorationColor;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString textDecorationLine;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString textIndent;
   [TreatNullAs=EmptyString, RaisesException] attribute DOMString textOverflow;
diff --git a/src/cobalt/cssom/css_transition_set.cc b/src/cobalt/cssom/css_transition_set.cc
index 21455bd..6418e03 100644
--- a/src/cobalt/cssom/css_transition_set.cc
+++ b/src/cobalt/cssom/css_transition_set.cc
@@ -257,6 +257,8 @@
   return transitions_.GetTransitionForProperty(property);
 }
 
+void TransitionSet::Clear() { transitions_.Clear(); }
+
 TransitionSet::TransitionMap::TransitionMap(EventHandler* event_handler)
     : event_handler_(event_handler) {}
 
@@ -306,6 +308,16 @@
   transitions_.erase(found);
 }
 
+void TransitionSet::TransitionMap::Clear() {
+  if (event_handler_ != NULL) {
+    for (auto& transition : transitions_) {
+      event_handler_->OnTransitionRemoved(transition.second);
+    }
+  }
+
+  transitions_.clear();
+}
+
 namespace {
 base::LazyInstance<TransitionSet> g_empty_transition_set =
     LAZY_INSTANCE_INITIALIZER;
diff --git a/src/cobalt/cssom/css_transition_set.h b/src/cobalt/cssom/css_transition_set.h
index fa51e95..4d735ae 100644
--- a/src/cobalt/cssom/css_transition_set.h
+++ b/src/cobalt/cssom/css_transition_set.h
@@ -78,6 +78,9 @@
   // Returns true if there are no animations in this animation set.
   bool empty() const { return transitions_.IsEmpty(); }
 
+  // Clears out all currently running transitions.
+  void Clear();
+
  private:
   void UpdateTransitionForProperty(
       PropertyKey property, const base::TimeDelta& current_time,
@@ -104,6 +107,10 @@
     // already exist in the map.
     void RemoveTransitionForProperty(PropertyKey property);
 
+    // Clears all entries from the map, as if RemoveTransitionForProperty()
+    // had been called on each property.
+    void Clear();
+
     typedef std::map<PropertyKey, Transition> InternalTransitionMap;
     const InternalTransitionMap& GetInternalMap() const { return transitions_; }
 
diff --git a/src/cobalt/cssom/interpolate_property_value.cc b/src/cobalt/cssom/interpolate_property_value.cc
index ba3979c..1eeee9a 100644
--- a/src/cobalt/cssom/interpolate_property_value.cc
+++ b/src/cobalt/cssom/interpolate_property_value.cc
@@ -395,9 +395,12 @@
   }
 }
 
-void InterpolateVisitor::VisitLength(LengthValue* /*start_length_value*/) {
-  NOTIMPLEMENTED();
-  interpolated_value_ = end_value_;
+void InterpolateVisitor::VisitLength(LengthValue* start_length_value) {
+  const LengthValue& end_length_value =
+      *base::polymorphic_downcast<LengthValue*>(end_value_.get());
+  interpolated_value_ = scoped_refptr<PropertyValue>(new LengthValue(
+      Lerp(start_length_value->value(), end_length_value.value(), progress_),
+      cssom::kPixelsUnit));
 }
 
 void InterpolateVisitor::VisitLinearGradient(
diff --git a/src/cobalt/cssom/interpolate_property_value_test.cc b/src/cobalt/cssom/interpolate_property_value_test.cc
index 7768778..d3d996a 100644
--- a/src/cobalt/cssom/interpolate_property_value_test.cc
+++ b/src/cobalt/cssom/interpolate_property_value_test.cc
@@ -56,12 +56,22 @@
 }
 }  // namespace
 
+TEST(InterpolatePropertyValueTest, LengthValuesInterpolate) {
+  scoped_refptr<LengthValue> interpolated =
+      InterpolatePropertyTyped<LengthValue>(0.5f,
+                                            new LengthValue(0.0f, kPixelsUnit),
+                                            new LengthValue(4.0f, kPixelsUnit));
+
+  EXPECT_NEAR(interpolated->value(), 2.0f, kErrorEpsilon);
+  EXPECT_EQ(interpolated->unit(), kPixelsUnit);
+}
+
 TEST(InterpolatePropertyValueTest, NumberValuesInterpolate) {
   scoped_refptr<NumberValue> interpolated =
       InterpolatePropertyTyped<NumberValue>(0.5f, new NumberValue(0.0f),
-                                            new NumberValue(1.0f));
+                                            new NumberValue(4.0f));
 
-  EXPECT_NEAR(interpolated->value(), 0.5f, kErrorEpsilon);
+  EXPECT_NEAR(interpolated->value(), 2.0f, kErrorEpsilon);
 }
 
 TEST(InterpolatePropertyValueTest, RGBAColorValuesInterpolate) {
diff --git a/src/cobalt/cssom/property_definitions.cc b/src/cobalt/cssom/property_definitions.cc
index 865e883..ac7a1cf 100644
--- a/src/cobalt/cssom/property_definitions.cc
+++ b/src/cobalt/cssom/property_definitions.cc
@@ -290,7 +290,7 @@
                         kImpactsBoxSizesNo, kImpactsBoxCrossReferencesNo,
                         KeywordValue::GetCurrentColor());
 
-  //   https://www.w3.org/TR/css3-background/#border-style
+  // https://www.w3.org/TR/css3-background/#border-style
   SetPropertyDefinition(kBorderTopStyleProperty, "border-top-style",
                         kInheritedNo, kAnimatableNo,
                         kImpactsChildDeclaredStyleNo, kImpactsBoxGenerationNo,
@@ -500,11 +500,30 @@
                         kImpactsBoxGenerationNo, kImpactsBoxSizesNo,
                         kImpactsBoxCrossReferencesYes, new NumberValue(1.0f));
 
+  // https://www.w3.org/TR/CSS21/ui.html#propdef-outline-color
+  SetPropertyDefinition(
+      kOutlineColorProperty, "outline-color", kInheritedNo, kAnimatableYes,
+      kImpactsChildDeclaredStyleNo, kImpactsBoxGenerationNo, kImpactsBoxSizesNo,
+      kImpactsBoxCrossReferencesNo, KeywordValue::GetCurrentColor());
+
+  // https://www.w3.org/TR/CSS21/ui.html#propdef-outline-style
+  SetPropertyDefinition(kOutlineStyleProperty, "outline-style", kInheritedNo,
+                        kAnimatableNo, kImpactsChildDeclaredStyleNo,
+                        kImpactsBoxGenerationNo, kImpactsBoxSizesYes,
+                        kImpactsBoxCrossReferencesNo, KeywordValue::GetNone());
+
+  // https://www.w3.org/TR/CSS21/ui.html#propdef-outline-width
+  SetPropertyDefinition(kOutlineWidthProperty, "outline-width", kInheritedNo,
+                        kAnimatableYes, kImpactsChildDeclaredStyleNo,
+                        kImpactsBoxGenerationNo, kImpactsBoxSizesYes,
+                        kImpactsBoxCrossReferencesNo,
+                        new LengthValue(3, kPixelsUnit));
+
   // https://www.w3.org/TR/css-overflow-3/#overflow-properties
   SetPropertyDefinition(kOverflowProperty, "overflow", kInheritedNo,
                         kAnimatableNo, kImpactsChildDeclaredStyleNo,
                         kImpactsBoxGenerationNo, kImpactsBoxSizesYes,
-                        kImpactsBoxCrossReferencesNo,
+                        kImpactsBoxCrossReferencesYes,
                         KeywordValue::GetVisible());
 
   // https://www.w3.org/TR/css-text-3/#overflow-wrap
@@ -542,6 +561,17 @@
                         kImpactsBoxCrossReferencesNo,
                         new LengthValue(0, kPixelsUnit));
 
+  // While only defined in the SVG spec, the pointer-events property has been
+  // proposed an commonly implemented to also apply to HTML elements for
+  // values of 'none' (element can not be indicated by a pointer) and 'auto'
+  // (element can be indicated by a pointer if the element has 'visibility' set
+  // to 'visible').
+  //   https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty
+  SetPropertyDefinition(kPointerEventsProperty, "pointer-events", kInheritedYes,
+                        kAnimatableNo, kImpactsChildDeclaredStyleNo,
+                        kImpactsBoxGenerationNo, kImpactsBoxSizesNo,
+                        kImpactsBoxCrossReferencesNo, KeywordValue::GetAuto());
+
   // https://www.w3.org/TR/css3-positioning/#position-property
   SetPropertyDefinition(kPositionProperty, "position", kInheritedNo,
                         kAnimatableNo, kImpactsChildDeclaredStyleNo,
@@ -804,6 +834,14 @@
   SetShorthandPropertyDefinition(kMarginProperty, "margin",
                                  margin_longhand_properties);
 
+  //   https://www.w3.org/TR/CSS21/ui.html#propdef-outline
+  LonghandPropertySet outline_longhand_properties;
+  outline_longhand_properties.insert(kOutlineColorProperty);
+  outline_longhand_properties.insert(kOutlineStyleProperty);
+  outline_longhand_properties.insert(kOutlineWidthProperty);
+  SetShorthandPropertyDefinition(kOutlineProperty, "outline",
+                                 outline_longhand_properties);
+
   //   https://www.w3.org/TR/CSS21/box.html#propdef-padding
   LonghandPropertySet padding_longhand_properties;
   padding_longhand_properties.insert(kPaddingBottomProperty);
@@ -1034,6 +1072,10 @@
         return kOpacityProperty;
       }
       if (LowerCaseEqualsASCII(property_name,
+                               GetPropertyName(kOutlineProperty))) {
+        return kOutlineProperty;
+      }
+      if (LowerCaseEqualsASCII(property_name,
                                GetPropertyName(kPaddingProperty))) {
         return kPaddingProperty;
       }
@@ -1200,6 +1242,18 @@
         return kMarginBottomProperty;
       }
       if (LowerCaseEqualsASCII(property_name,
+                               GetPropertyName(kOutlineColorProperty))) {
+        return kOutlineColorProperty;
+      }
+      if (LowerCaseEqualsASCII(property_name,
+                               GetPropertyName(kOutlineStyleProperty))) {
+        return kOutlineStyleProperty;
+      }
+      if (LowerCaseEqualsASCII(property_name,
+                               GetPropertyName(kOutlineWidthProperty))) {
+        return kOutlineWidthProperty;
+      }
+      if (LowerCaseEqualsASCII(property_name,
                                GetPropertyName(kOverflowWrapProperty))) {
         return kOverflowWrapProperty;
       }
@@ -1223,6 +1277,10 @@
         return kPaddingBottomProperty;
       }
       if (LowerCaseEqualsASCII(property_name,
+                               GetPropertyName(kPointerEventsProperty))) {
+        return kPointerEventsProperty;
+      }
+      if (LowerCaseEqualsASCII(property_name,
                                GetPropertyName(kTextTransformProperty))) {
         return kTextTransformProperty;
       }
@@ -1391,5 +1449,7 @@
   }
 }  // NOLINT(readability/fn_size)
 
+// NOLINTNEXTLINE(readability/fn_size)
 }  // namespace cssom
+// NOLINTNEXTLINE(readability/fn_size)
 }  // namespace cobalt
diff --git a/src/cobalt/cssom/property_definitions.h b/src/cobalt/cssom/property_definitions.h
index 0718220..8fbddbe 100644
--- a/src/cobalt/cssom/property_definitions.h
+++ b/src/cobalt/cssom/property_definitions.h
@@ -87,12 +87,16 @@
   kMinHeightProperty,
   kMinWidthProperty,
   kOpacityProperty,
+  kOutlineColorProperty,
+  kOutlineStyleProperty,
+  kOutlineWidthProperty,
   kOverflowProperty,
   kOverflowWrapProperty,
   kPaddingBottomProperty,
   kPaddingLeftProperty,
   kPaddingRightProperty,
   kPaddingTopProperty,
+  kPointerEventsProperty,
   kPositionProperty,
   kRightProperty,
   kTextAlignProperty,
@@ -137,6 +141,7 @@
   kBorderWidthProperty,
   kFontProperty,
   kMarginProperty,
+  kOutlineProperty,
   kPaddingProperty,
   kTextDecorationProperty,
   kTransitionProperty,
diff --git a/src/cobalt/doc/memory_tuning.md b/src/cobalt/doc/memory_tuning.md
index 1e9993e..da5f972 100644
--- a/src/cobalt/doc/memory_tuning.md
+++ b/src/cobalt/doc/memory_tuning.md
@@ -18,6 +18,11 @@
 
 Read on for more information.
 
+**IMPORTANT**
+*Setting `--max_cobalt_cpu_usage` and `--max_cobalt_gpu_usage` on the
+command line is a beta feature. When reducing memory, please use
+`--reduce_cpu_memory_by` and `--reduce_gpu_memory_by`.*
+
 ### Memory Settings Table ###
 
 A table similar to the one below, will be printed on startup.
diff --git a/src/cobalt/dom/document.cc b/src/cobalt/dom/document.cc
index 295eb3b..f0cda7e 100644
--- a/src/cobalt/dom/document.cc
+++ b/src/cobalt/dom/document.cc
@@ -29,6 +29,7 @@
 #include "cobalt/cssom/css_rule_list.h"
 #include "cobalt/cssom/css_style_rule.h"
 #include "cobalt/cssom/css_style_sheet.h"
+#include "cobalt/cssom/keyword_value.h"
 #include "cobalt/dom/benchmark_stat_names.h"
 #include "cobalt/dom/comment.h"
 #include "cobalt/dom/csp_delegate.h"
@@ -615,9 +616,9 @@
     if (root) {
       DCHECK_EQ(this, root->parent_node());
       // First update the computed style for root element.
-      root->UpdateComputedStyle(initial_computed_style_declaration_,
-                                initial_computed_style_data_,
-                                style_change_event_time);
+      root->UpdateComputedStyle(
+          initial_computed_style_declaration_, initial_computed_style_data_,
+          style_change_event_time, HTMLElement::kAncestorsAreDisplayed);
 
       // Then update the computed styles for the other elements.
       root->UpdateComputedStyleRecursively(
@@ -669,6 +670,8 @@
   // Update computed styles on the ancestors and the element.
   HTMLElement* previous_element = NULL;
   bool ancestors_were_valid = true;
+  HTMLElement::AncestorsAreDisplayed ancestors_are_displayed =
+      HTMLElement::kAncestorsAreDisplayed;
   scoped_refptr<const cssom::CSSComputedStyleData> root_element_computed_style;
   for (std::vector<HTMLElement*>::reverse_iterator it = ancestors.rbegin();
        it != ancestors.rend(); ++it) {
@@ -684,14 +687,20 @@
                            : initial_computed_style_declaration_,
           root_element_computed_style ? root_element_computed_style
                                       : initial_computed_style_data_,
-          style_change_event_time);
+          style_change_event_time, ancestors_are_displayed);
     }
     if (!root_element_computed_style) {
       DCHECK_EQ(this, current_element->parent_node());
       root_element_computed_style = current_element->computed_style();
     }
+    if (ancestors_are_displayed == HTMLElement::kAncestorsAreDisplayed &&
+        current_element->computed_style()->display() ==
+            cssom::KeywordValue::GetNone()) {
+      ancestors_are_displayed = HTMLElement::kAncestorsAreNotDisplayed;
+    }
     previous_element = current_element;
-    ancestors_were_valid = is_valid;
+    ancestors_were_valid =
+        is_valid && current_element->descendant_computed_styles_valid();
   }
 
   return true;
diff --git a/src/cobalt/dom/html_element.cc b/src/cobalt/dom/html_element.cc
index 215a8be..a539d68 100644
--- a/src/cobalt/dom/html_element.cc
+++ b/src/cobalt/dom/html_element.cc
@@ -254,7 +254,7 @@
 
   // 1. If the element has no associated CSS layout box or if the CSS layout box
   // is inline, return zero.
-  if (!layout_boxes_ || layout_boxes_->IsInlineLevel()) {
+  if (!layout_boxes_ || layout_boxes_->IsInline()) {
     return 0.0f;
   }
   // 2. Return the computed value of the 'border-top-width' property plus the
@@ -272,7 +272,7 @@
 
   // 1. If the element has no associated CSS layout box or if the CSS layout box
   // is inline, return zero.
-  if (!layout_boxes_ || layout_boxes_->IsInlineLevel()) {
+  if (!layout_boxes_ || layout_boxes_->IsInline()) {
     return 0.0f;
   }
   // 2. Return the computed value of the 'border-left-width' property plus the
@@ -290,7 +290,7 @@
 
   // 1. If the element has no associated CSS layout box or if the CSS layout box
   // is inline, return zero.
-  if (!layout_boxes_ || layout_boxes_->IsInlineLevel()) {
+  if (!layout_boxes_ || layout_boxes_->IsInline()) {
     return 0.0f;
   }
 
@@ -312,7 +312,7 @@
 
   // 1. If the element has no associated CSS layout box or if the CSS layout box
   // is inline, return zero.
-  if (!layout_boxes_ || layout_boxes_->IsInlineLevel()) {
+  if (!layout_boxes_ || layout_boxes_->IsInline()) {
     return 0.0f;
   }
 
@@ -648,7 +648,7 @@
       ancestors_were_valid && matching_rules_valid_ && computed_style_valid_;
   if (!is_valid) {
     UpdateComputedStyle(parent_computed_style_declaration, root_computed_style,
-                        style_change_event_time);
+                        style_change_event_time, kAncestorsAreDisplayed);
   }
 
   // Do not update computed style for descendants of "display: none" elements,
@@ -678,14 +678,42 @@
   descendant_computed_styles_valid_ = true;
 }
 
+void HTMLElement::MarkDisplayNoneOnNodeAndDescendants() {
+  // While we do want to clear the animations immediately, we also want to
+  // ensure that they are also reset starting with the next computed style
+  // update.  This ensures that for example a transition will not be triggered
+  // on the next computed style update.
+  ancestors_are_displayed_ = kAncestorsAreNotDisplayed;
+
+  PurgeCachedBackgroundImages();
+
+  if (!css_animations_.empty() || !css_transitions_.empty()) {
+    css_transitions_.Clear();
+    css_animations_.Clear();
+    computed_style_valid_ = false;
+    descendant_computed_styles_valid_ = false;
+  }
+
+  MarkDisplayNoneOnDescendants();
+}
+
 void HTMLElement::PurgeCachedBackgroundImagesOfNodeAndDescendants() {
+  PurgeCachedBackgroundImages();
+  PurgeCachedBackgroundImagesOfDescendants();
+}
+
+void HTMLElement::PurgeCachedBackgroundImages() {
   ClearActiveBackgroundImages();
   if (!cached_background_images_.empty()) {
     cached_background_images_.clear();
     computed_style_valid_ = false;
     descendant_computed_styles_valid_ = false;
   }
-  PurgeCachedBackgroundImagesOfDescendants();
+}
+
+bool HTMLElement::IsDisplayed() const {
+  return ancestors_are_displayed_ == kAncestorsAreDisplayed &&
+         computed_style()->display() != cssom::KeywordValue::GetNone();
 }
 
 void HTMLElement::InvalidateComputedStylesOfNodeAndDescendants() {
@@ -731,6 +759,7 @@
           document->html_element_context()->css_parser())),
       computed_style_valid_(false),
       descendant_computed_styles_valid_(false),
+      ancestors_are_displayed_(kAncestorsAreDisplayed),
       css_computed_style_declaration_(new cssom::CSSComputedStyleDeclaration()),
       ALLOW_THIS_IN_INITIALIZER_LIST(
           transitions_adapter_(new DOMAnimatable(this))),
@@ -830,7 +859,7 @@
   }
   DCHECK(computed_style());
 
-  return computed_style()->display() != cssom::KeywordValue::GetNone() &&
+  return IsDisplayed() &&
          computed_style()->visibility() == cssom::KeywordValue::GetVisible();
 }
 
@@ -947,13 +976,7 @@
     const scoped_refptr<cssom::CSSComputedStyleDeclaration>&
         parent_computed_style_declaration,
     const scoped_refptr<const cssom::CSSComputedStyleData>& root_computed_style,
-    const math::Size& viewport_size,
-    const base::TimeDelta& style_change_event_time,
-    const scoped_refptr<const cssom::CSSComputedStyleData>&
-        previous_computed_style,
-    cssom::TransitionSet* css_transitions, cssom::AnimationSet* css_animations,
-    const cssom::CSSKeyframesRule::NameMap& keyframes_map,
-    bool* animations_modified) {
+    const math::Size& viewport_size) {
   // Select the winning value for each property by performing the cascade,
   // that is, apply values from matching rules on top of inline style, taking
   // into account rule specificity and location in the source file, as well as
@@ -973,31 +996,65 @@
       computed_style, parent_computed_style_declaration, root_computed_style,
       viewport_size, property_key_to_base_url_map);
 
-  if (previous_computed_style) {
-    // Now that we have updated our computed style, compare it to the previous
-    // style and see if we need to adjust our animations.
-    css_transitions->UpdateTransitions(
-        style_change_event_time, *previous_computed_style, *computed_style);
-  }
-  // Update the set of currently running animations and track whether or not the
-  // animations changed.
-  *animations_modified = css_animations->Update(style_change_event_time,
-                                                *computed_style, keyframes_map);
-
   return computed_style;
 }
 
+void PossiblyActivateAnimations(
+    const scoped_refptr<const cssom::CSSComputedStyleData>&
+        previous_computed_style,
+    const scoped_refptr<const cssom::CSSComputedStyleData>& new_computed_style,
+    const base::TimeDelta& style_change_event_time,
+    cssom::TransitionSet* css_transitions, cssom::AnimationSet* css_animations,
+    const cssom::CSSKeyframesRule::NameMap& keyframes_map,
+    HTMLElement::AncestorsAreDisplayed old_ancestors_are_displayed,
+    HTMLElement::AncestorsAreDisplayed new_ancestors_are_displayed,
+    bool* animations_modified) {
+  // Calculate some helper values to help determine if we are transitioning from
+  // not being displayed to being displayed, or vice-versa.  Animations should
+  // not be playing if we are not being displayed.
+  bool old_is_displayed =
+      old_ancestors_are_displayed == HTMLElement::kAncestorsAreDisplayed &&
+      (previous_computed_style &&
+       previous_computed_style->display() != cssom::KeywordValue::GetNone());
+  bool new_is_displayed =
+      new_ancestors_are_displayed == HTMLElement::kAncestorsAreDisplayed &&
+      new_computed_style->display() != cssom::KeywordValue::GetNone();
+
+  if (new_is_displayed) {
+    // Don't start any transitions if we are transitioning from display: none.
+    if (previous_computed_style && old_is_displayed) {
+      // Now that we have updated our computed style, compare it to the previous
+      // style and see if we need to adjust our animations.
+      css_transitions->UpdateTransitions(style_change_event_time,
+                                         *previous_computed_style,
+                                         *new_computed_style);
+    }
+    // Update the set of currently running animations and track whether or not
+    // the animations changed.
+    *animations_modified = css_animations->Update(
+        style_change_event_time, *new_computed_style, keyframes_map);
+  } else {
+    if (old_is_displayed) {
+      css_transitions->Clear();
+      css_animations->Clear();
+    } else {
+      DCHECK(css_transitions->empty());
+      DCHECK(css_animations->empty());
+    }
+  }
+}
+
 // Flags tracking which cached values must be invalidated.
 struct UpdateComputedStyleInvalidationFlags {
   UpdateComputedStyleInvalidationFlags()
-      : purge_cached_background_images_of_descendants(false),
+      : mark_descendants_as_display_none(false),
         invalidate_computed_styles_of_descendants(false),
         invalidate_layout_boxes(false),
         invalidate_sizes(false),
         invalidate_cross_references(false),
         invalidate_render_tree_nodes(false) {}
 
-  bool purge_cached_background_images_of_descendants;
+  bool mark_descendants_as_display_none;
   bool invalidate_computed_styles_of_descendants;
   bool invalidate_layout_boxes;
   bool invalidate_sizes;
@@ -1005,7 +1062,7 @@
   bool invalidate_render_tree_nodes;
 };
 
-bool NewComputedStylePurgesCachedBackgroundImagesOfDescendants(
+bool NewComputedStyleMarksDescendantsAsDisplayNone(
     const scoped_refptr<const cssom::CSSComputedStyleData>& old_computed_style,
     const scoped_refptr<cssom::CSSComputedStyleData>& new_computed_style) {
   return old_computed_style->display() != cssom::KeywordValue::GetNone() &&
@@ -1058,11 +1115,11 @@
     bool animations_modified, IsPseudoElement is_pseudo_element,
     UpdateComputedStyleInvalidationFlags* flags) {
   if (old_computed_style) {
-    if (!flags->purge_cached_background_images_of_descendants &&
+    if (!flags->mark_descendants_as_display_none &&
         is_pseudo_element == kIsNotPseudoElement &&
-        NewComputedStylePurgesCachedBackgroundImagesOfDescendants(
-            old_computed_style, new_computed_style)) {
-      flags->purge_cached_background_images_of_descendants = true;
+        NewComputedStyleMarksDescendantsAsDisplayNone(old_computed_style,
+                                                      new_computed_style)) {
+      flags->mark_descendants_as_display_none = true;
     }
     if (!flags->invalidate_computed_styles_of_descendants &&
         NewComputedStyleInvalidatesComputedStylesOfDescendants(
@@ -1095,13 +1152,52 @@
   }
 }
 
+void DoComputedStyleUpdate(
+    cssom::RulesWithCascadePrecedence* matching_rules,
+    cssom::GURLMap* property_key_to_base_url_map,
+    const scoped_refptr<const cssom::CSSDeclaredStyleData>& inline_style,
+    const scoped_refptr<cssom::CSSComputedStyleDeclaration>&
+        parent_computed_style_declaration,
+    const scoped_refptr<const cssom::CSSComputedStyleData>& root_computed_style,
+    const math::Size& viewport_size,
+    const scoped_refptr<const cssom::CSSComputedStyleData>&
+        previous_computed_style,
+    const base::TimeDelta& style_change_event_time,
+    cssom::TransitionSet* css_transitions, cssom::AnimationSet* css_animations,
+    const cssom::CSSKeyframesRule::NameMap& keyframes_map,
+    HTMLElement::AncestorsAreDisplayed old_ancestors_are_displayed,
+    HTMLElement::AncestorsAreDisplayed new_ancestors_are_displayed,
+    IsPseudoElement is_pseudo_element,
+    UpdateComputedStyleInvalidationFlags* invalidation_flags,
+    cssom::CSSComputedStyleDeclaration* css_computed_style_declaration) {
+  bool animations_modified = false;
+
+  scoped_refptr<cssom::CSSComputedStyleData> new_computed_style =
+      PromoteMatchingRulesToComputedStyle(
+          matching_rules, property_key_to_base_url_map, inline_style,
+          parent_computed_style_declaration, root_computed_style,
+          viewport_size);
+
+  PossiblyActivateAnimations(previous_computed_style, new_computed_style,
+                             style_change_event_time, css_transitions,
+                             css_animations, keyframes_map,
+                             old_ancestors_are_displayed,
+                             new_ancestors_are_displayed, &animations_modified);
+
+  UpdateInvalidationFlagsFromNewComputedStyle(
+      previous_computed_style, new_computed_style, animations_modified,
+      is_pseudo_element, invalidation_flags);
+
+  css_computed_style_declaration->SetData(new_computed_style);
+}
 }  // namespace
 
 void HTMLElement::UpdateComputedStyle(
     const scoped_refptr<cssom::CSSComputedStyleDeclaration>&
         parent_computed_style_declaration,
     const scoped_refptr<const cssom::CSSComputedStyleData>& root_computed_style,
-    const base::TimeDelta& style_change_event_time) {
+    const base::TimeDelta& style_change_event_time,
+    AncestorsAreDisplayed ancestors_are_displayed) {
   Document* document = node_document();
   DCHECK(document) << "Element should be attached to document in order to "
                       "participate in layout.";
@@ -1137,6 +1233,15 @@
     generate_computed_style = true;
   }
 
+  // It is possible for computed style to have been updated on this element even
+  // if its ancestors were set to display: none.  If this has changed, we would
+  // need to update our computed style again, even if nothing else has changed.
+  if (!generate_computed_style &&
+      ancestors_are_displayed_ == kAncestorsAreNotDisplayed &&
+      ancestors_are_displayed == kAncestorsAreDisplayed) {
+    generate_computed_style = true;
+  }
+
   // TODO: It maybe helpful to generalize this mapping framework in the
   // future to allow more data and context about where a cssom::PropertyValue
   // came from.
@@ -1147,23 +1252,19 @@
   // Flags tracking which cached values must be invalidated.
   UpdateComputedStyleInvalidationFlags invalidation_flags;
 
+  // We record this now before we make changes to the computed style and use
+  // it later for the pseudo element computed style updates.
+  bool old_is_displayed = computed_style() && IsDisplayed();
+
   if (generate_computed_style) {
     dom_stat_tracker_->OnGenerateHtmlElementComputedStyle();
-    bool animations_modified = false;
-
-    scoped_refptr<cssom::CSSComputedStyleData> new_computed_style =
-        PromoteMatchingRulesToComputedStyle(
-            matching_rules(), &property_key_to_base_url_map, style_->data(),
-            parent_computed_style_declaration, root_computed_style,
-            document->viewport_size(), style_change_event_time,
-            computed_style(), &css_transitions_, &css_animations_,
-            document->keyframes_map(), &animations_modified);
-
-    UpdateInvalidationFlagsFromNewComputedStyle(
-        computed_style(), new_computed_style, animations_modified,
-        kIsNotPseudoElement, &invalidation_flags);
-
-    css_computed_style_declaration_->SetData(new_computed_style);
+    DoComputedStyleUpdate(
+        matching_rules(), &property_key_to_base_url_map, style_->data(),
+        parent_computed_style_declaration, root_computed_style,
+        document->viewport_size(), computed_style(), style_change_event_time,
+        &css_transitions_, &css_animations_, document->keyframes_map(),
+        ancestors_are_displayed_, ancestors_are_displayed, kIsNotPseudoElement,
+        &invalidation_flags, css_computed_style_declaration_);
 
     // Update cached background images after resolving the urls in
     // background_image CSS property of the computed style, so we have all the
@@ -1175,6 +1276,9 @@
     css_computed_style_declaration_->UpdateInheritedData();
   }
 
+  // Update the displayed status of our ancestors.
+  ancestors_are_displayed_ = ancestors_are_displayed;
+
   // NOTE: Currently, pseudo element's computed styles are always generated. If
   // this becomes a performance bottleneck, change the logic so that it only
   // occurs when needed.
@@ -1184,32 +1288,25 @@
        ++pseudo_element_type) {
     if (pseudo_elements_[pseudo_element_type]) {
       dom_stat_tracker_->OnGeneratePseudoElementComputedStyle();
-      bool animations_modified = false;
-
-      scoped_refptr<cssom::CSSComputedStyleData> pseudo_element_computed_style =
-          PromoteMatchingRulesToComputedStyle(
-              pseudo_elements_[pseudo_element_type]->matching_rules(),
-              &property_key_to_base_url_map, style_->data(),
-              css_computed_style_declaration(), root_computed_style,
-              document->viewport_size(), style_change_event_time,
-              pseudo_elements_[pseudo_element_type]->computed_style(),
-              pseudo_elements_[pseudo_element_type]->css_transitions(),
-              pseudo_elements_[pseudo_element_type]->css_animations(),
-              document->keyframes_map(), &animations_modified);
-
-      UpdateInvalidationFlagsFromNewComputedStyle(
+      DoComputedStyleUpdate(
+          pseudo_elements_[pseudo_element_type]->matching_rules(),
+          &property_key_to_base_url_map, NULL, css_computed_style_declaration(),
+          root_computed_style, document->viewport_size(),
           pseudo_elements_[pseudo_element_type]->computed_style(),
-          pseudo_element_computed_style, animations_modified, kIsPseudoElement,
-          &invalidation_flags);
-
-      pseudo_elements_[pseudo_element_type]
-          ->css_computed_style_declaration()
-          ->SetData(pseudo_element_computed_style);
+          style_change_event_time,
+          pseudo_elements_[pseudo_element_type]->css_transitions(),
+          pseudo_elements_[pseudo_element_type]->css_animations(),
+          document->keyframes_map(),
+          old_is_displayed ? kAncestorsAreDisplayed : kAncestorsAreNotDisplayed,
+          IsDisplayed() ? kAncestorsAreDisplayed : kAncestorsAreNotDisplayed,
+          kIsPseudoElement, &invalidation_flags,
+          pseudo_elements_[pseudo_element_type]
+              ->css_computed_style_declaration());
     }
   }
 
-  if (invalidation_flags.purge_cached_background_images_of_descendants) {
-    PurgeCachedBackgroundImagesOfDescendants();
+  if (invalidation_flags.mark_descendants_as_display_none) {
+    MarkDisplayNoneOnDescendants();
   }
   if (invalidation_flags.invalidate_computed_styles_of_descendants) {
     InvalidateComputedStylesOfDescendants();
@@ -1233,12 +1330,12 @@
   computed_style_valid_ = true;
 }
 
-bool HTMLElement::IsDesignated() {
+bool HTMLElement::IsDesignated() const {
   Document* document = node_document();
   if (document) {
     scoped_refptr<Element> element = document->indicated_element();
     while (element) {
-      if (element == this) {
+      if (element.get() == this) {
         return true;
       }
       // The parent of an element that is :hover is also in that state.
@@ -1249,6 +1346,11 @@
   return false;
 }
 
+bool HTMLElement::CanbeDesignatedByPointerIfDisplayed() const {
+  return computed_style()->pointer_events() != cssom::KeywordValue::GetNone() &&
+         computed_style()->visibility() == cssom::KeywordValue::GetVisible();
+}
+
 void HTMLElement::ClearActiveBackgroundImages() {
   if (html_element_context() &&
       html_element_context()->animated_image_tracker()) {
diff --git a/src/cobalt/dom/html_element.h b/src/cobalt/dom/html_element.h
index 4698fed..e62c335 100644
--- a/src/cobalt/dom/html_element.h
+++ b/src/cobalt/dom/html_element.h
@@ -100,6 +100,11 @@
     FollowingSiblingPotentialNodes following_sibling_potential_nodes;
   };
 
+  enum AncestorsAreDisplayed {
+    kAncestorsAreDisplayed,
+    kAncestorsAreNotDisplayed,
+  };
+
   // Web API: HTMLElement
   //
   std::string dir() const;
@@ -203,6 +208,7 @@
     return css_computed_style_declaration_->data();
   }
 
+  void MarkDisplayNoneOnNodeAndDescendants() OVERRIDE;
   void PurgeCachedBackgroundImagesOfNodeAndDescendants() OVERRIDE;
   void InvalidateComputedStylesOfNodeAndDescendants() OVERRIDE;
   void InvalidateLayoutBoxesOfNodeAndAncestors() OVERRIDE;
@@ -220,21 +226,14 @@
       const base::TimeDelta& style_change_event_time, bool ancestors_were_valid,
       int current_element_depth);
 
-  // Updates the cached computed style of this element and its anecstors.
-  void UpdateComputedStyleAlongAncestors(
-      const scoped_refptr<cssom::CSSComputedStyleDeclaration>&
-          parent_computed_style,
-      const scoped_refptr<const cssom::CSSComputedStyleData>&
-          root_computed_style,
-      const base::TimeDelta& style_change_event_time);
-
   // Updates the cached computed style of this element.
   void UpdateComputedStyle(
       const scoped_refptr<cssom::CSSComputedStyleDeclaration>&
           parent_computed_style_declaration,
       const scoped_refptr<const cssom::CSSComputedStyleData>&
           root_computed_style,
-      const base::TimeDelta& style_change_event_time);
+      const base::TimeDelta& style_change_event_time,
+      AncestorsAreDisplayed ancestor_is_displayed);
 
   // Layout box related methods.
   //
@@ -260,12 +259,18 @@
   }
 
   bool computed_style_valid() const { return computed_style_valid_; }
-
+  bool descendant_computed_styles_valid() const {
+    return descendant_computed_styles_valid_;
+  }
   bool matching_rules_valid() const { return matching_rules_valid_; }
 
   // Returns whether the element has been designated.
   //   https://www.w3.org/TR/selectors4/#hover-pseudo
-  bool IsDesignated();
+  bool IsDesignated() const;
+
+  // Returns whether the element can be designated by a pointer.
+  //   https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty
+  bool CanbeDesignatedByPointerIfDisplayed() const;
 
   DEFINE_WRAPPABLE_TYPE(HTMLElement);
 
@@ -322,6 +327,13 @@
   // https://www.w3.org/TR/html5/semantics.html#the-root-element.
   bool IsRootElement();
 
+  // Purge the cached background images on only this node.
+  void PurgeCachedBackgroundImages();
+
+  // Returns true if this node and all of its ancestors do NOT have display set
+  // to 'none'.
+  bool IsDisplayed() const;
+
   bool locked_for_focus_;
 
   // The directionality of the html element is determined by the 'dir'
@@ -345,6 +357,10 @@
   // out of date or not.
   bool descendant_computed_styles_valid_;
 
+  // Indicates whether this node has an ancestor which has display set to none
+  // or not. This value gets updated when computed style is updated.
+  AncestorsAreDisplayed ancestors_are_displayed_;
+
   scoped_refptr<cssom::CSSComputedStyleDeclaration>
       css_computed_style_declaration_;
 
diff --git a/src/cobalt/dom/html_element_test.cc b/src/cobalt/dom/html_element_test.cc
index 6bbf621..b3f2ebb 100644
--- a/src/cobalt/dom/html_element_test.cc
+++ b/src/cobalt/dom/html_element_test.cc
@@ -69,7 +69,7 @@
   MOCK_CONST_METHOD0(type, Type());
   MOCK_CONST_METHOD0(GetClientRects, scoped_refptr<DOMRectList>());
 
-  MOCK_CONST_METHOD0(IsInlineLevel, bool());
+  MOCK_CONST_METHOD0(IsInline, bool());
 
   MOCK_CONST_METHOD0(GetBorderEdgeLeft, float());
   MOCK_CONST_METHOD0(GetBorderEdgeTop, float());
@@ -124,12 +124,24 @@
   scoped_refptr<HTMLElement> CreateHTMLElementTreeWithMockLayoutBoxes(
       const char* null_terminated_element_names[]);
 
+  void SetElementStyle(const scoped_refptr<cssom::CSSDeclaredStyleData>& data,
+                       HTMLElement* html_element);
+
   cssom::testing::MockCSSParser css_parser_;
   scoped_ptr<DomStatTracker> dom_stat_tracker_;
   HTMLElementContext html_element_context_;
   scoped_refptr<Document> document_;
 };
 
+void HTMLElementTest::SetElementStyle(
+    const scoped_refptr<cssom::CSSDeclaredStyleData>& data,
+    HTMLElement* html_element) {
+  EXPECT_CALL(css_parser_,
+              ParseStyleDeclarationList(kFooBarDeclarationString, _))
+      .WillOnce(Return(data));
+  html_element->SetAttribute("style", kFooBarDeclarationString);
+}
+
 scoped_refptr<HTMLElement>
 HTMLElementTest::CreateHTMLElementTreeWithMockLayoutBoxes(
     const char* null_terminated_element_names[]) {
@@ -227,6 +239,32 @@
   html_element_2->Focus();
   ASSERT_TRUE(document_->active_element());
   EXPECT_EQ(html_element_2, document_->active_element()->AsHTMLElement());
+
+  // Make sure that if we try to focus an element that has display set to none,
+  // it will not take the focus.
+  scoped_refptr<cssom::CSSDeclaredStyleData> display_none_style(
+      new cssom::CSSDeclaredStyleData());
+  display_none_style->SetPropertyValueAndImportance(
+      cssom::kDisplayProperty, cssom::KeywordValue::GetNone(), false);
+  SetElementStyle(display_none_style, html_element_1);
+  html_element_1->Focus();
+  ASSERT_TRUE(document_->active_element());
+  EXPECT_EQ(html_element_2, document_->active_element()->AsHTMLElement());
+
+  // Make sure that if we try to focus an element whose ancestor has display
+  // set to none, it will not take the focus.
+  scoped_refptr<HTMLElement> html_element_3 =
+      document_->CreateElement("div")->AsHTMLElement();
+  scoped_refptr<HTMLElement> html_element_4 =
+      document_->CreateElement("div")->AsHTMLElement();
+  document_->AppendChild(html_element_3);
+  html_element_3->AppendChild(html_element_4);
+
+  html_element_4->set_tab_index(-1);
+  SetElementStyle(display_none_style, html_element_3);
+  html_element_4->Focus();
+  ASSERT_TRUE(document_->active_element());
+  EXPECT_EQ(html_element_2, document_->active_element()->AsHTMLElement());
 }
 
 TEST_F(HTMLElementTest, Blur) {
@@ -319,7 +357,7 @@
   // 1. If the CSS layout box is inline, return zero.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   html_element->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(true));
   EXPECT_FLOAT_EQ(html_element->client_top(), 0.0f);
 
@@ -329,7 +367,7 @@
   // ancestors.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   html_element->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(false));
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   html_element->layout_boxes()),
@@ -353,7 +391,7 @@
   // 1. If the CSS layout box is inline, return zero.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   html_element->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(true));
   EXPECT_FLOAT_EQ(html_element->client_left(), 0.0f);
 
@@ -363,7 +401,7 @@
   // ancestors.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   html_element->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(false));
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   html_element->layout_boxes()),
@@ -390,7 +428,7 @@
   // 1. If the CSS layout box is inline, return zero.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   GetFirstChildAtDepth(root_html_element, 1)->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(true));
   EXPECT_FLOAT_EQ(GetFirstChildAtDepth(root_html_element, 1)->client_width(),
                   0.0f);
@@ -398,7 +436,7 @@
   // 2. If the element is the root element, return the viewport width.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   root_html_element->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(false));
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   root_html_element->layout_boxes()),
@@ -410,7 +448,7 @@
   // to the element and its ancestors.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   GetFirstChildAtDepth(root_html_element, 2)->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(false));
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   GetFirstChildAtDepth(root_html_element, 2)->layout_boxes()),
@@ -438,7 +476,7 @@
   // 1. If the CSS layout box is inline, return zero.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   GetFirstChildAtDepth(root_html_element, 1)->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(true));
   EXPECT_FLOAT_EQ(GetFirstChildAtDepth(root_html_element, 1)->client_height(),
                   0.0f);
@@ -446,7 +484,7 @@
   // 2. If the element is the root element, return the viewport height.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   root_html_element->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(false));
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   root_html_element->layout_boxes()),
@@ -458,7 +496,7 @@
   // to the element and its ancestors.
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   GetFirstChildAtDepth(root_html_element, 2)->layout_boxes()),
-              IsInlineLevel())
+              IsInline())
       .WillOnce(Return(false));
   EXPECT_CALL(*base::polymorphic_downcast<MockLayoutBoxes*>(
                   GetFirstChildAtDepth(root_html_element, 2)->layout_boxes()),
diff --git a/src/cobalt/dom/keyboard_event.h b/src/cobalt/dom/keyboard_event.h
index a0c5433..a29c546 100644
--- a/src/cobalt/dom/keyboard_event.h
+++ b/src/cobalt/dom/keyboard_event.h
@@ -64,18 +64,26 @@
   bool repeat() const { return repeat_; }
   bool is_composing() const { return false; }
 
-  // Non-standard and deprecated.
-  // key code for keydown and keyup, character for keypress
-  //   https://www.w3.org/TR/2016/WD-uievents-20160804/#legacy-key-models
+  // Legacy Key Attributes.
+  //   https://www.w3.org/TR/2016/WD-uievents-20160804/#legacy-key-attributes
   uint32 key_code() const;
   uint32 char_code() const;
-  uint32 which() const;
 
+  // Web API: UIEvent
+  // This holds a system- and implementation-dependent numerical code signifying
+  // the unmodified identifier associated with the key pressed. In most cases,
+  // the value is identical to keyCode.
+  //   https://www.w3.org/TR/2016/WD-uievents-20160804/#dom-keyboardevent-which
+  uint32 which() const OVERRIDE;
+
+  // keyLocation is deprecated and non-standard.
+  //   https://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908/#events-Events-KeyboardEvent-keylocation
   KeyLocationCode key_location() const { return key_location_; }
 
   // keyIdentifier is deprecated and non-standard.
   // Here, we just map it to the standardized key() method, which matches some,
   // but not all browser implementations.
+  //   https://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908/#events-Events-KeyboardEvent-keyIdentifier
   std::string key_identifier() const { return key(); }
 
   // Custom, not in any spec.
diff --git a/src/cobalt/dom/keyboard_event.idl b/src/cobalt/dom/keyboard_event.idl
index e0b6220..69d8677 100644
--- a/src/cobalt/dom/keyboard_event.idl
+++ b/src/cobalt/dom/keyboard_event.idl
@@ -13,6 +13,8 @@
 // limitations under the License.
 
 // https://www.w3.org/TR/2016/WD-uievents-20160804/#interface-keyboardevent
+// https://www.w3.org/TR/2016/WD-uievents-20160804/#legacy-key-attributes
+// https://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908/#events-Events-KeyboardEvent-keylocation
 
 [Constructor(DOMString type, optional KeyboardEventInit eventInitDict)]
 interface KeyboardEvent : UIEvent {
@@ -36,11 +38,11 @@
 
   boolean getModifierState(DOMString text);
 
-  // Deprecated. These features have been removed from the Web standards.
-  //   https://www.w3.org/TR/2016/WD-uievents-20160804/#legacy-key-models
+  // Legacy Key Attributes.
   readonly attribute unsigned long keyCode;
   readonly attribute unsigned long charCode;
-  readonly attribute unsigned long which;
+
+  // Deprecated. These features have been removed from the latest Web standards.
   readonly attribute unsigned long keyLocation;
   readonly attribute DOMString keyIdentifier;
 
diff --git a/src/cobalt/dom/layout_boxes.h b/src/cobalt/dom/layout_boxes.h
index b0db6fc..2785fed 100644
--- a/src/cobalt/dom/layout_boxes.h
+++ b/src/cobalt/dom/layout_boxes.h
@@ -48,7 +48,7 @@
   virtual scoped_refptr<dom::DOMRectList> GetClientRects() const = 0;
 
   // Returns true if the container box level is inline.
-  virtual bool IsInlineLevel() const = 0;
+  virtual bool IsInline() const = 0;
 
   // Returns border edge values.
   // See https://www.w3.org/TR/CSS21/box.html#box-dimensions
diff --git a/src/cobalt/dom/mouse_event.cc b/src/cobalt/dom/mouse_event.cc
index ea882f2..512014f 100644
--- a/src/cobalt/dom/mouse_event.cc
+++ b/src/cobalt/dom/mouse_event.cc
@@ -17,6 +17,7 @@
 #include <string>
 
 #include "cobalt/base/token.h"
+#include "cobalt/dom/html_element.h"
 
 namespace cobalt {
 namespace dom {
@@ -104,5 +105,79 @@
   related_target_ = related_target;
 }
 
+float MouseEvent::page_x() const {
+  // Algorithm for pageX
+  //  https://www.w3.org/TR/2013/WD-cssom-view-20131217/#dom-mouseevent-pagex
+
+  // In Cobalt all steps are equivalent to returning clientX.
+  return static_cast<float>(client_x());
+}
+
+float MouseEvent::page_y() const {
+  // Algorithm for pageY
+  //  https://www.w3.org/TR/2013/WD-cssom-view-20131217/#dom-mouseevent-pagey
+
+  // In Cobalt all steps are equivalent to returning clientY.
+  return static_cast<float>(client_y());
+}
+
+float MouseEvent::offset_x() {
+  // Algorithm for offsetX
+  //  https://www.w3.org/TR/2013/WD-cssom-view-20131217/#dom-mouseevent-offsetx
+
+  // If the event's dispatch flag is set,
+  if (IsBeingDispatched()) {
+    // return the x-coordinate of the position where the event occurred relative
+    // to the origin of the padding edge of the target node, ignoring the
+    // transforms that apply to the element and its ancestors and terminate
+    // these steps.
+    float target_node_padding_edge = 0.0f;
+
+    Node* node = base::polymorphic_downcast<Node*>(target().get());
+    if (node && node->IsElement()) {
+      scoped_refptr<HTMLElement> html_element =
+          node->AsElement()->AsHTMLElement();
+      if (html_element && html_element->layout_boxes()) {
+        target_node_padding_edge =
+            html_element->layout_boxes()->GetPaddingEdgeLeft();
+      }
+    }
+    return client_x() - target_node_padding_edge;
+  }
+
+  // Return the value of the event's pageX attribute.
+  return page_x();
+}
+
+float MouseEvent::offset_y() const {
+  // Algorithm for offsetY
+  //  https://www.w3.org/TR/2013/WD-cssom-view-20131217/#dom-mouseevent-offsety
+
+  // If the event's dispatch flag is set,
+  if (IsBeingDispatched()) {
+    // return the y-coordinate of the position where the event occurred relative
+    // to the origin of the padding edge of the target node, ignoring the
+    // transforms that apply to the element and its ancestors, and terminate
+    // these steps.
+    float target_node_padding_edge = 0.0f;
+
+    Node* node = base::polymorphic_downcast<Node*>(target().get());
+    if (node && node->IsElement()) {
+      scoped_refptr<HTMLElement> html_element =
+          node->AsElement()->AsHTMLElement();
+      if (html_element && html_element->layout_boxes()) {
+        target_node_padding_edge =
+            html_element->layout_boxes()->GetPaddingEdgeTop();
+      }
+    }
+    return client_y() - target_node_padding_edge;
+  }
+
+  // Return the value of the event's pageY attribute.
+  return page_y();
+}
+
+uint32 MouseEvent::which() const { return button_ + 1; }
+
 }  // namespace dom
 }  // namespace cobalt
diff --git a/src/cobalt/dom/mouse_event.h b/src/cobalt/dom/mouse_event.h
index da09013..45c5109 100644
--- a/src/cobalt/dom/mouse_event.h
+++ b/src/cobalt/dom/mouse_event.h
@@ -60,6 +60,16 @@
   int32_t client_x() const { return client_x_; }
   int32_t client_y() const { return client_y_; }
 
+  // Web API: CSSOM View Module: Extensions to the MouseEvent Interface
+  // (partial interface)
+  //   https://www.w3.org/TR/2013/WD-cssom-view-20131217/#extensions-to-the-mouseevent-interface
+  float page_x() const;
+  float page_y() const;
+  float x() const { return static_cast<float>(client_x_); }
+  float y() const { return static_cast<float>(client_y_); }
+  float offset_x();
+  float offset_y() const;
+
   int16_t button() const { return button_; }
   uint16_t buttons() const { return buttons_; }
 
@@ -71,6 +81,11 @@
     return related_target_;
   }
 
+  // Web API: UIEvent
+  // This contains a value equal to the value stored in button+1.
+  //   https://w3c.github.io/uievents/#dom-uievent-which
+  uint32 which() const OVERRIDE;
+
   DEFINE_WRAPPABLE_TYPE(MouseEvent);
 
  protected:
diff --git a/src/starboard/linux/x64x11/cpp11/thread_types_public.h b/src/cobalt/dom/mouse_event_cssom_view.idl
similarity index 64%
copy from src/starboard/linux/x64x11/cpp11/thread_types_public.h
copy to src/cobalt/dom/mouse_event_cssom_view.idl
index 9ab0ac3..a7f874e 100644
--- a/src/starboard/linux/x64x11/cpp11/thread_types_public.h
+++ b/src/cobalt/dom/mouse_event_cssom_view.idl
@@ -12,9 +12,13 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+// https://www.w3.org/TR/2013/WD-cssom-view-20131217/#extensions-to-the-mouseevent-interface
 
-#include "starboard/linux/shared/thread_types_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+partial interface MouseEvent {
+  readonly attribute double pageX;
+  readonly attribute double pageY;
+  readonly attribute double x;
+  readonly attribute double y;
+  readonly attribute double offsetX;
+  readonly attribute double offsetY;
+};
diff --git a/src/cobalt/dom/node.cc b/src/cobalt/dom/node.cc
index 4b46103..6db5f93 100644
--- a/src/cobalt/dom/node.cc
+++ b/src/cobalt/dom/node.cc
@@ -520,6 +520,10 @@
   }
 }
 
+void Node::MarkDisplayNoneOnNodeAndDescendants() {
+  MarkDisplayNoneOnDescendants();
+}
+
 void Node::PurgeCachedBackgroundImagesOfNodeAndDescendants() {
   PurgeCachedBackgroundImagesOfDescendants();
 }
@@ -536,6 +540,14 @@
   InvalidateLayoutBoxesOfDescendants();
 }
 
+void Node::MarkDisplayNoneOnDescendants() {
+  Node* child = first_child_;
+  while (child) {
+    child->MarkDisplayNoneOnNodeAndDescendants();
+    child = child->next_sibling_;
+  }
+}
+
 void Node::PurgeCachedBackgroundImagesOfDescendants() {
   Node* child = first_child_;
   while (child) {
diff --git a/src/cobalt/dom/node.h b/src/cobalt/dom/node.h
index 82cce91..c32f3f1 100644
--- a/src/cobalt/dom/node.h
+++ b/src/cobalt/dom/node.h
@@ -250,6 +250,7 @@
 
   virtual bool IsInDocument() const { return inserted_into_document_; }
 
+  virtual void MarkDisplayNoneOnNodeAndDescendants();
   virtual void PurgeCachedBackgroundImagesOfNodeAndDescendants();
   virtual void InvalidateComputedStylesOfNodeAndDescendants();
   virtual void InvalidateLayoutBoxesOfNodeAndAncestors();
@@ -259,6 +260,7 @@
   virtual void InvalidateLayoutBoxCrossReferences() {}
   virtual void InvalidateLayoutBoxRenderTreeNodes() {}
 
+  void MarkDisplayNoneOnDescendants();
   void PurgeCachedBackgroundImagesOfDescendants();
   void InvalidateComputedStylesOfDescendants();
   void InvalidateLayoutBoxesOfAncestors();
diff --git a/src/cobalt/dom/node_list.h b/src/cobalt/dom/node_list.h
index 90931e4..affd941 100644
--- a/src/cobalt/dom/node_list.h
+++ b/src/cobalt/dom/node_list.h
@@ -48,6 +48,10 @@
  protected:
   ~NodeList() OVERRIDE;
 
+  void ReserveForInternalCollection(int capacity) {
+    collection_.reserve(capacity);
+  }
+
  private:
   std::vector<scoped_refptr<Node> > collection_;
 
diff --git a/src/cobalt/dom/node_list_live.cc b/src/cobalt/dom/node_list_live.cc
index 54627a2..ad12fe5 100644
--- a/src/cobalt/dom/node_list_live.cc
+++ b/src/cobalt/dom/node_list_live.cc
@@ -41,12 +41,24 @@
   if (base_node_generation_ != base_->node_generation()) {
     Clear();
 
+    // The allocations caused by |AppendNode| below show up as hot in
+    // profiles.  In order to mitigate this, we do an initial traversal to
+    // figure out how many nodes we plan on appending, reserve, and then
+    // append.
     NodeChildrenIterator iterator(base_);
     Node* child = iterator.First();
+    int pending_append_count = 0;
+    while (child) {
+      pending_append_count++;
+      child = iterator.Next();
+    }
+    ReserveForInternalCollection(pending_append_count);
+    child = iterator.First();
     while (child) {
       AppendNode(child);
       child = iterator.Next();
     }
+
     base_node_generation_ = base_->node_generation();
   }
 }
diff --git a/src/cobalt/dom/test_runner.cc b/src/cobalt/dom/test_runner.cc
index 2367f76..1b3ea89 100644
--- a/src/cobalt/dom/test_runner.cc
+++ b/src/cobalt/dom/test_runner.cc
@@ -19,7 +19,8 @@
 namespace cobalt {
 namespace dom {
 
-TestRunner::TestRunner() : should_wait_(false) {}
+TestRunner::TestRunner() :
+    should_wait_(false), clock_(new base::ManualAdvanceClock()) {}
 
 void TestRunner::NotifyDone() {
   if (should_wait_) {
@@ -41,6 +42,14 @@
   }
 }
 
+void TestRunner::AdvanceClockByMs(uint64 amount) {
+  clock_->Advance(base::TimeDelta::FromMilliseconds(amount));
+}
+
+scoped_refptr<base::Clock> TestRunner::GetClock() {
+  return clock_;
+}
+
 }  // namespace dom
 }  // namespace cobalt
 
diff --git a/src/cobalt/dom/test_runner.h b/src/cobalt/dom/test_runner.h
index d764f14..97a6dd1 100644
--- a/src/cobalt/dom/test_runner.h
+++ b/src/cobalt/dom/test_runner.h
@@ -18,6 +18,7 @@
 #if defined(ENABLE_TEST_RUNNER)
 
 #include "base/callback.h"
+#include "cobalt/base/clock.h"
 #include "cobalt/script/wrappable.h"
 
 namespace cobalt {
@@ -45,6 +46,13 @@
   // layouts.
   void DoNonMeasuredLayout();
 
+  // Increment's the web page's clock by the specified number of milliseconds.
+  // This will result in the advance of animations.
+  void AdvanceClockByMs(uint64 amount);
+
+  // Returns the clock controlled by test runner.
+  scoped_refptr<base::Clock> GetClock();
+
   // When this callback is called, a layout should be triggered. Not all
   // triggered layouts should be measured, and the callback function should call
   // should_wait() to ensure that measurements are only taken when should_wait()
@@ -63,6 +71,7 @@
 
   bool should_wait_;
   base::Closure trigger_layout_callback_;
+  scoped_refptr<base::ManualAdvanceClock> clock_;
 
   DISALLOW_COPY_AND_ASSIGN(TestRunner);
 };
diff --git a/src/cobalt/dom/test_runner.idl b/src/cobalt/dom/test_runner.idl
index eb3a34c..98eb881 100644
--- a/src/cobalt/dom/test_runner.idl
+++ b/src/cobalt/dom/test_runner.idl
@@ -20,4 +20,8 @@
   void notifyDone();
   void waitUntilDone();
   void DoNonMeasuredLayout();
+
+  // Increment's the web page's clock by the specified number of milliseconds.
+  // This will result in the advance of animations.
+  void AdvanceClockByMs(long long amount);
 };
diff --git a/src/cobalt/dom/testing/stub_window.h b/src/cobalt/dom/testing/stub_window.h
index 39f3115..2b01566 100644
--- a/src/cobalt/dom/testing/stub_window.h
+++ b/src/cobalt/dom/testing/stub_window.h
@@ -52,7 +52,7 @@
     engine_ = script::JavaScriptEngine::CreateEngine();
     global_environment_ = engine_->CreateGlobalEnvironment();
     window_ = new dom::Window(
-        1920, 1080, base::kApplicationStateStarted, css_parser_.get(),
+        1920, 1080, 1.f, base::kApplicationStateStarted, css_parser_.get(),
         dom_parser_.get(), fetcher_factory_.get(), NULL, NULL, NULL, NULL, NULL,
         NULL, &local_storage_database_, stub_media_module_.get(),
         stub_media_module_.get(), NULL, NULL, NULL, NULL,
@@ -63,7 +63,7 @@
         base::Closure() /* csp_policy_changed */,
         base::Closure() /* ran_animation_frame_callbacks */,
         base::Closure() /* window_close */,
-        base::Closure() /* window_minimize */, NULL, NULL, NULL);
+        base::Closure() /* window_minimize */, NULL, NULL);
     global_environment_->CreateGlobalObject(window_, &environment_settings_);
   }
 
diff --git a/src/cobalt/dom/ui_event.h b/src/cobalt/dom/ui_event.h
index 4bba136..46fb6b2 100644
--- a/src/cobalt/dom/ui_event.h
+++ b/src/cobalt/dom/ui_event.h
@@ -49,10 +49,8 @@
   const scoped_refptr<Window>& view() const { return view_; }
   int32 detail() const { return detail_; }
 
-  // The following properties are defined inside UIEvent but are not valid for
-  // all UIEvent subtypes.  Subtypes should override the getters when necessary.
-  virtual int32 page_x() const { return 0; }
-  virtual int32 page_y() const { return 0; }
+  // The following property is defined inside UIEvent but is not valid for all
+  // UIEvent subtypes.  Subtypes should override the getter when necessary.
   virtual uint32 which() const { return which_; }
 
   DEFINE_WRAPPABLE_TYPE(UIEvent);
diff --git a/src/cobalt/dom/ui_event.idl b/src/cobalt/dom/ui_event.idl
index 4a8e0aa..09b0cba 100644
--- a/src/cobalt/dom/ui_event.idl
+++ b/src/cobalt/dom/ui_event.idl
@@ -12,21 +12,14 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// https://www.w3.org/TR/2015/WD-uievents-20151215/#interface-UIEvent
+// https://www.w3.org/TR/2016/WD-uievents-20160804/#interface-uievent
+// https://w3c.github.io/uievents/#legacy-interface-UIEvent
 
 [Constructor(DOMString type, optional UIEventInit eventInitDict)]
 interface UIEvent : Event {
   readonly attribute Window? view;
   readonly attribute long detail;
 
-  // Note that the following properties are not part of any specification but
-  // are commonly implemented and required by Cobalt.
-  // The horizontal coordinate of the event relative to the whole document.
-  readonly attribute long pageX;
-  // The vertical coordinate of the event relative to the whole document.
-  readonly attribute long pageY;
-  // The numeric keyCode of the key pressed, or the character code (charCode)
-  // for an alphanumeric key pressed.
   readonly attribute unsigned long which;
 
   void initUIEvent(DOMString type,
diff --git a/src/cobalt/dom/window.cc b/src/cobalt/dom/window.cc
index 7a089d4..856d46f 100644
--- a/src/cobalt/dom/window.cc
+++ b/src/cobalt/dom/window.cc
@@ -71,7 +71,7 @@
   DISALLOW_COPY_AND_ASSIGN(RelayLoadEvent);
 };
 
-Window::Window(int width, int height,
+Window::Window(int width, int height, float device_pixel_ratio,
                base::ApplicationState initial_application_state,
                cssom::CSSParser* css_parser, Parser* dom_parser,
                loader::FetcherFactory* fetcher_factory,
@@ -101,13 +101,16 @@
                const base::Closure& ran_animation_frame_callbacks_callback,
                const base::Closure& window_close_callback,
                const base::Closure& window_minimize_callback,
-               system_window::SystemWindow* system_window,
                const scoped_refptr<input::Camera3D>& camera_3d,
                const scoped_refptr<MediaSession>& media_session,
                int csp_insecure_allowed_token, int dom_max_element_depth,
-               float video_playback_rate_multiplier)
+               float video_playback_rate_multiplier, ClockType clock_type)
     : width_(width),
       height_(height),
+      device_pixel_ratio_(device_pixel_ratio),
+#if defined(ENABLE_TEST_RUNNER)
+      test_runner_(new TestRunner()),
+#endif  // ENABLE_TEST_RUNNER
       html_element_context_(new HTMLElementContext(
           fetcher_factory, css_parser, dom_parser, can_play_type_handler,
           web_media_player_factory, script_runner, script_value_factory,
@@ -115,7 +118,11 @@
           image_cache, reduced_image_cache_capacity_manager,
           remote_typeface_cache, mesh_cache, dom_stat_tracker, language,
           initial_application_state, video_playback_rate_multiplier)),
-      performance_(new Performance(new base::SystemMonotonicClock())),
+      performance_(new Performance(
+#if defined(ENABLE_TEST_RUNNER)
+          clock_type == kClockTypeTestRunner ? test_runner_->GetClock() :
+#endif
+                                             new base::SystemMonotonicClock())),
       ALLOW_THIS_IN_INITIALIZER_LIST(document_(new Document(
           html_element_context_.get(),
           Document::Options(
@@ -148,26 +155,13 @@
       ran_animation_frame_callbacks_callback_(
           ran_animation_frame_callbacks_callback),
       window_close_callback_(window_close_callback),
-      window_minimize_callback_(window_minimize_callback),
-      system_window_(system_window) {
-#if defined(ENABLE_TEST_RUNNER)
-  test_runner_ = new TestRunner();
-#endif  // ENABLE_TEST_RUNNER
+      window_minimize_callback_(window_minimize_callback) {
+#if !defined(ENABLE_TEST_RUNNER)
+  UNREFERENCED_PARAMETER(clock_type);
+#endif
   document_->AddObserver(relay_on_load_event_.get());
   html_element_context_->page_visibility_state()->AddObserver(this);
 
-  if (system_window_) {
-    SbWindow sb_window = system_window_->GetSbWindow();
-    SbWindowSize size;
-    if (SbWindowGetSize(sb_window, &size)) {
-      device_pixel_ratio_ = size.video_pixel_ratio;
-    } else {
-      device_pixel_ratio_ = 1.0f;
-    }
-  } else {
-      device_pixel_ratio_ = 1.0f;
-  }
-
   // Document load start is deferred from this constructor so that we can be
   // guaranteed that this Window object is fully constructed before document
   // loading begins.
@@ -199,6 +193,7 @@
 
 // https://www.w3.org/TR/html5/browsers.html#dom-window-close
 void Window::Close() {
+  LOG(INFO) << __func__;
   if (!window_close_callback_.is_null()) {
     window_close_callback_.Run();
   }
@@ -216,7 +211,7 @@
     const scoped_refptr<Element>& elt) {
   scoped_refptr<HTMLElement> html_element = elt->AsHTMLElement();
   if (html_element) {
-    document_->UpdateComputedStyles();
+    document_->UpdateComputedStyleOnElementAndAncestor(html_element);
     return html_element->css_computed_style_declaration();
   }
   return NULL;
@@ -235,7 +230,7 @@
   scoped_refptr<HTMLElement> html_element = elt->AsHTMLElement();
   scoped_refptr<cssom::CSSComputedStyleDeclaration> obj;
   if (html_element) {
-    document_->UpdateComputedStyles();
+    document_->UpdateComputedStyleOnElementAndAncestor(html_element);
 
     // 2. Let obj be elt.
     obj = html_element->css_computed_style_declaration();
diff --git a/src/cobalt/dom/window.h b/src/cobalt/dom/window.h
index c405a0e..1ab441c 100644
--- a/src/cobalt/dom/window.h
+++ b/src/cobalt/dom/window.h
@@ -55,7 +55,6 @@
 #include "cobalt/script/execution_state.h"
 #include "cobalt/script/script_runner.h"
 #include "cobalt/script/script_value_factory.h"
-#include "cobalt/system_window/system_window.h"
 #include "googleurl/src/gurl.h"
 #include "starboard/window.h"
 
@@ -103,9 +102,14 @@
       const base::Callback<void(const std::string&)>&)>
       HTMLDecoderCreatorCallback;
   typedef UrlRegistry<MediaSource> MediaSourceRegistry;
+  enum ClockType {
+    kClockTypeTestRunner,
+    kClockTypeSystemTime
+  };
 
   Window(
-      int width, int height, base::ApplicationState initial_application_state,
+      int width, int height, float device_pixel_ratio,
+      base::ApplicationState initial_application_state,
       cssom::CSSParser* css_parser, Parser* dom_parser,
       loader::FetcherFactory* fetcher_factory,
       render_tree::ResourceProvider** resource_provider,
@@ -134,11 +138,11 @@
       const base::Closure& ran_animation_frame_callbacks_callback,
       const base::Closure& window_close_callback,
       const base::Closure& window_minimize_callback,
-      system_window::SystemWindow* system_window,
       const scoped_refptr<input::Camera3D>& camera_3d,
       const scoped_refptr<cobalt::media_session::MediaSession>& media_session,
       int csp_insecure_allowed_token = 0, int dom_max_element_depth = 0,
-      float video_playback_rate_multiplier = 1.f);
+      float video_playback_rate_multiplier = 1.f,
+      ClockType clock_type = kClockTypeSystemTime);
 
   // Web API: Window
   //
@@ -315,6 +319,10 @@
   int height_;
   float device_pixel_ratio_;
 
+#if defined(ENABLE_TEST_RUNNER)
+  scoped_refptr<TestRunner> test_runner_;
+#endif  // ENABLE_TEST_RUNNER
+
   const scoped_ptr<HTMLElementContext> html_element_context_;
   scoped_refptr<Performance> performance_;
   scoped_refptr<Document> document_;
@@ -340,12 +348,6 @@
   const base::Closure window_close_callback_;
   const base::Closure window_minimize_callback_;
 
-  system_window::SystemWindow* system_window_;
-
-#if defined(ENABLE_TEST_RUNNER)
-  scoped_refptr<TestRunner> test_runner_;
-#endif  // ENABLE_TEST_RUNNER
-
   DISALLOW_COPY_AND_ASSIGN(Window);
 };
 
diff --git a/src/cobalt/dom/window_test.cc b/src/cobalt/dom/window_test.cc
index 5fa0db3..a35d5bc 100644
--- a/src/cobalt/dom/window_test.cc
+++ b/src/cobalt/dom/window_test.cc
@@ -51,7 +51,7 @@
         stub_media_module_(new media::MediaModuleStub()),
         url_("about:blank"),
         window_(new Window(
-            1920, 1080, base::kApplicationStateStarted, css_parser_.get(),
+            1920, 1080, 1.f, base::kApplicationStateStarted, css_parser_.get(),
             dom_parser_.get(), fetcher_factory_.get(), NULL, NULL, NULL, NULL,
             NULL, NULL, &local_storage_database_, stub_media_module_.get(),
             stub_media_module_.get(), NULL, NULL, NULL, NULL, NULL, url_, "",
@@ -63,8 +63,7 @@
             base::Closure() /* csp_policy_changed */,
             base::Closure() /* ran_animation_frame_callbacks */,
             base::Closure() /* window_close */,
-            base::Closure() /* window_minimize */,
-            stub_media_module_->system_window(), NULL, NULL)) {}
+            base::Closure() /* window_minimize */, NULL, NULL)) {}
 
   ~WindowTest() OVERRIDE {}
 
diff --git a/src/cobalt/h5vcc/h5vcc.cc b/src/cobalt/h5vcc/h5vcc.cc
index f3617cf..d87d984 100644
--- a/src/cobalt/h5vcc/h5vcc.cc
+++ b/src/cobalt/h5vcc/h5vcc.cc
@@ -14,6 +14,8 @@
 
 #include "cobalt/h5vcc/h5vcc.h"
 
+#include "cobalt/sso/sso_interface.h"
+
 namespace cobalt {
 namespace h5vcc {
 
@@ -28,8 +30,11 @@
   runtime_ =
       new H5vccRuntime(settings.event_dispatcher, settings.initial_deep_link);
   settings_ = new H5vccSettings(settings.media_module);
+#if defined(COBALT_ENABLE_SSO)
+  sso_ = new H5vccSso();
+#endif
   storage_ = new H5vccStorage(settings.network_module);
-  system_ = new H5vccSystem(settings.media_module);
+  system_ = new H5vccSystem();
   trace_event_ = new H5vccTraceEvent();
 }
 
diff --git a/src/cobalt/h5vcc/h5vcc.gyp b/src/cobalt/h5vcc/h5vcc.gyp
index 9b96e06..467e87a 100644
--- a/src/cobalt/h5vcc/h5vcc.gyp
+++ b/src/cobalt/h5vcc/h5vcc.gyp
@@ -89,6 +89,20 @@
             ],
           },
         }],
+        ['enable_sso == 1', {
+          'sources': [
+            'h5vcc_sso.cc',
+            'h5vcc_sso.h',
+          ],
+          'defines': [
+            'COBALT_ENABLE_SSO',
+          ],
+          'direct_dependent_settings': {
+            'defines': [
+              'COBALT_ENABLE_SSO',
+            ],
+          },
+        }],
       ],
       'defines': [
         'COBALT_USER_ON_EXIT_STRATEGY="<(cobalt_user_on_exit_strategy)"',
diff --git a/src/cobalt/h5vcc/h5vcc.h b/src/cobalt/h5vcc/h5vcc.h
index b316784..a3430ce 100644
--- a/src/cobalt/h5vcc/h5vcc.h
+++ b/src/cobalt/h5vcc/h5vcc.h
@@ -27,6 +27,7 @@
 #include "cobalt/h5vcc/h5vcc_crash_log.h"
 #include "cobalt/h5vcc/h5vcc_runtime.h"
 #include "cobalt/h5vcc/h5vcc_settings.h"
+#include "cobalt/h5vcc/h5vcc_sso.h"
 #include "cobalt/h5vcc/h5vcc_storage.h"
 #include "cobalt/h5vcc/h5vcc_system.h"
 #include "cobalt/h5vcc/h5vcc_trace_event.h"
@@ -65,6 +66,9 @@
   const scoped_refptr<H5vccCrashLog>& crash_log() const { return crash_log_; }
   const scoped_refptr<H5vccRuntime>& runtime() const { return runtime_; }
   const scoped_refptr<H5vccSettings>& settings() const { return settings_; }
+#if defined(COBALT_ENABLE_SSO)
+  const scoped_refptr<H5vccSso>& sso() const { return sso_; }
+#endif
   const scoped_refptr<H5vccStorage>& storage() const { return storage_; }
   const scoped_refptr<H5vccSystem>& system() const { return system_; }
   const scoped_refptr<H5vccTraceEvent>& trace_event() const {
@@ -81,6 +85,7 @@
   scoped_refptr<H5vccCrashLog> crash_log_;
   scoped_refptr<H5vccRuntime> runtime_;
   scoped_refptr<H5vccSettings> settings_;
+  scoped_refptr<H5vccSso> sso_;
   scoped_refptr<H5vccStorage> storage_;
   scoped_refptr<H5vccSystem> system_;
   scoped_refptr<H5vccTraceEvent> trace_event_;
diff --git a/src/cobalt/h5vcc/h5vcc.idl b/src/cobalt/h5vcc/h5vcc.idl
index 8738360..11efffe 100644
--- a/src/cobalt/h5vcc/h5vcc.idl
+++ b/src/cobalt/h5vcc/h5vcc.idl
@@ -35,6 +35,8 @@
   readonly attribute H5vccCVal cVal;
   readonly attribute H5vccRuntime runtime;
   readonly attribute H5vccSettings settings;
+  [Conditional=COBALT_ENABLE_SSO]
+      readonly attribute H5vccSso sso;
   readonly attribute H5vccStorage storage;
   readonly attribute H5vccSystem system;
   readonly attribute H5vccTraceEvent traceEvent;
diff --git a/src/cobalt/h5vcc/h5vcc_runtime.cc b/src/cobalt/h5vcc/h5vcc_runtime.cc
index 6f50618..2c6f04d 100644
--- a/src/cobalt/h5vcc/h5vcc_runtime.cc
+++ b/src/cobalt/h5vcc/h5vcc_runtime.cc
@@ -14,9 +14,9 @@
 
 #include "cobalt/h5vcc/h5vcc_runtime.h"
 
+#include "cobalt/base/application_event.h"
 #include "cobalt/base/deep_link_event.h"
 #include "cobalt/base/polymorphic_downcast.h"
-#include "cobalt/system_window/application_event.h"
 
 namespace cobalt {
 namespace h5vcc {
@@ -31,7 +31,7 @@
   DCHECK(event_dispatcher_);
   application_event_callback_ =
       base::Bind(&H5vccRuntime::OnApplicationEvent, base::Unretained(this));
-  event_dispatcher_->AddEventCallback(system_window::ApplicationEvent::TypeId(),
+  event_dispatcher_->AddEventCallback(base::ApplicationEvent::TypeId(),
                                       application_event_callback_);
   deep_link_event_callback_ =
       base::Bind(&H5vccRuntime::OnDeepLinkEvent, base::Unretained(this));
@@ -40,8 +40,8 @@
 }
 
 H5vccRuntime::~H5vccRuntime() {
-  event_dispatcher_->RemoveEventCallback(
-      system_window::ApplicationEvent::TypeId(), application_event_callback_);
+  event_dispatcher_->RemoveEventCallback(base::ApplicationEvent::TypeId(),
+                                         application_event_callback_);
   event_dispatcher_->RemoveEventCallback(base::DeepLinkEvent::TypeId(),
                                          deep_link_event_callback_);
 }
@@ -64,13 +64,11 @@
 }
 
 void H5vccRuntime::OnApplicationEvent(const base::Event* event) {
-  const system_window::ApplicationEvent* app_event =
-      base::polymorphic_downcast<const system_window::ApplicationEvent*>(event);
-  if (app_event->type() == system_window::ApplicationEvent::kPause) {
-    // DLOG(INFO) << "Got pause event.";
+  const base::ApplicationEvent* app_event =
+      base::polymorphic_downcast<const base::ApplicationEvent*>(event);
+  if (app_event->type() == kSbEventTypePause) {
     on_pause()->DispatchEvent();
-  } else if (app_event->type() == system_window::ApplicationEvent::kUnpause) {
-    // DLOG(INFO) << "Got unpause event.";
+  } else if (app_event->type() == kSbEventTypeUnpause) {
     on_resume()->DispatchEvent();
   }
 }
diff --git a/src/cobalt/h5vcc/h5vcc_sso.cc b/src/cobalt/h5vcc/h5vcc_sso.cc
new file mode 100644
index 0000000..ef27c53
--- /dev/null
+++ b/src/cobalt/h5vcc/h5vcc_sso.cc
@@ -0,0 +1,38 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "cobalt/h5vcc/h5vcc_sso.h"
+
+namespace cobalt {
+namespace h5vcc {
+
+H5vccSso::H5vccSso() : sso_(sso::CreateSSO().Pass()) {}
+
+std::string H5vccSso::GetApiKey() {
+  DCHECK(sso_);
+  return sso_->getApiKey();
+}
+
+std::string H5vccSso::GetOauthClientId() {
+  DCHECK(sso_);
+  return sso_->getOauthClientId();
+}
+
+std::string H5vccSso::GetOauthClientSecret() {
+  DCHECK(sso_);
+  return sso_->getOauthClientSecret();
+}
+
+}  // namespace h5vcc
+}  // namespace cobalt
diff --git a/src/cobalt/h5vcc/h5vcc_sso.h b/src/cobalt/h5vcc/h5vcc_sso.h
new file mode 100644
index 0000000..53c6c64
--- /dev/null
+++ b/src/cobalt/h5vcc/h5vcc_sso.h
@@ -0,0 +1,46 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef COBALT_H5VCC_H5VCC_SSO_H_
+#define COBALT_H5VCC_H5VCC_SSO_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "cobalt/script/wrappable.h"
+#include "cobalt/sso/sso_interface.h"
+
+namespace cobalt {
+namespace h5vcc {
+
+class H5vccSso : public script::Wrappable {
+ public:
+  H5vccSso();
+
+  std::string GetApiKey();
+  std::string GetOauthClientId();
+  std::string GetOauthClientSecret();
+
+  DEFINE_WRAPPABLE_TYPE(H5vccSso);
+
+ private:
+  scoped_ptr<sso::SsoInterface> sso_;
+
+  DISALLOW_COPY_AND_ASSIGN(H5vccSso);
+};
+
+}  // namespace h5vcc
+}  // namespace cobalt
+
+#endif  // COBALT_H5VCC_H5VCC_SSO_H_
diff --git a/src/starboard/linux/x64x11/cpp11/atomic_public.h b/src/cobalt/h5vcc/h5vcc_sso.idl
similarity index 73%
rename from src/starboard/linux/x64x11/cpp11/atomic_public.h
rename to src/cobalt/h5vcc/h5vcc_sso.idl
index a2be4c0..28648f0 100644
--- a/src/starboard/linux/x64x11/cpp11/atomic_public.h
+++ b/src/cobalt/h5vcc/h5vcc_sso.idl
@@ -12,9 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef STARBOARD_LINUX_X64X11_CPP11_ATOMIC_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_CPP11_ATOMIC_PUBLIC_H_
-
-#include "starboard/linux/shared/atomic_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_CPP11_ATOMIC_PUBLIC_H_
+[
+    Conditional=COBALT_ENABLE_SSO,
+] interface H5vccSso {
+    DOMString getApiKey();
+    DOMString getOauthClientId();
+    DOMString getOauthClientSecret();
+};
diff --git a/src/cobalt/h5vcc/h5vcc_system.cc b/src/cobalt/h5vcc/h5vcc_system.cc
index 2b96110..59c4f75 100644
--- a/src/cobalt/h5vcc/h5vcc_system.cc
+++ b/src/cobalt/h5vcc/h5vcc_system.cc
@@ -22,11 +22,7 @@
 namespace cobalt {
 namespace h5vcc {
 
-H5vccSystem::H5vccSystem(const media::MediaModule* media_module) {
-  video_container_size_ =
-      base::StringPrintf("%dx%d", media_module->output_size().width(),
-                         media_module->output_size().height());
-}
+H5vccSystem::H5vccSystem() {}
 
 bool H5vccSystem::are_keys_reversed() const {
   return SbSystemHasCapability(kSbSystemCapabilityReversedEnterAndBack);
diff --git a/src/cobalt/h5vcc/h5vcc_system.h b/src/cobalt/h5vcc/h5vcc_system.h
index 5928ed8..3b16638 100644
--- a/src/cobalt/h5vcc/h5vcc_system.h
+++ b/src/cobalt/h5vcc/h5vcc_system.h
@@ -25,7 +25,7 @@
 
 class H5vccSystem : public script::Wrappable {
  public:
-  explicit H5vccSystem(const media::MediaModule* media_module);
+  H5vccSystem();
 
   bool are_keys_reversed() const;
   std::string build_id() const;
diff --git a/src/cobalt/input/input_device_manager_desktop.cc b/src/cobalt/input/input_device_manager_desktop.cc
index 629b820..946c261 100644
--- a/src/cobalt/input/input_device_manager_desktop.cc
+++ b/src/cobalt/input/input_device_manager_desktop.cc
@@ -149,10 +149,10 @@
   UpdateMouseEventInitButton(input_event->key_code(), mouse_event);
   UpdateMouseEventInitButtons(input_event->modifiers(), mouse_event);
 
-  mouse_event->set_screen_x(input_event->position().x());
-  mouse_event->set_screen_y(input_event->position().y());
-  mouse_event->set_client_x(input_event->position().x());
-  mouse_event->set_client_y(input_event->position().y());
+  mouse_event->set_screen_x(static_cast<float>(input_event->position().x()));
+  mouse_event->set_screen_y(static_cast<float>(input_event->position().y()));
+  mouse_event->set_client_x(static_cast<float>(input_event->position().x()));
+  mouse_event->set_client_y(static_cast<float>(input_event->position().y()));
 }
 
 }  // namespace
@@ -183,8 +183,8 @@
   pointer_event.set_width(input_event->size().x());
   pointer_event.set_height(input_event->size().y());
   pointer_event.set_pressure(input_event->pressure());
-  pointer_event.set_tilt_x(input_event->tilt().x());
-  pointer_event.set_tilt_y(input_event->tilt().y());
+  pointer_event.set_tilt_x(static_cast<float>(input_event->tilt().x()));
+  pointer_event.set_tilt_y(static_cast<float>(input_event->tilt().y()));
 #endif
   pointer_event.set_is_primary(true);
   pointer_event_callback_.Run(type, pointer_event);
diff --git a/src/cobalt/layout/anonymous_block_box.cc b/src/cobalt/layout/anonymous_block_box.cc
index 8aa0634..db8843f 100644
--- a/src/cobalt/layout/anonymous_block_box.cc
+++ b/src/cobalt/layout/anonymous_block_box.cc
@@ -60,8 +60,9 @@
 }
 
 void AnonymousBlockBox::RenderAndAnimateContent(
-    render_tree::CompositionNode::Builder* border_node_builder) const {
-  ContainerBox::RenderAndAnimateContent(border_node_builder);
+    render_tree::CompositionNode::Builder* border_node_builder,
+    ContainerBox* stacking_context) const {
+  ContainerBox::RenderAndAnimateContent(border_node_builder, stacking_context);
 
   if (computed_style()->visibility() != cssom::KeywordValue::GetVisible()) {
     return;
diff --git a/src/cobalt/layout/anonymous_block_box.h b/src/cobalt/layout/anonymous_block_box.h
index d865fbf..abaaf20 100644
--- a/src/cobalt/layout/anonymous_block_box.h
+++ b/src/cobalt/layout/anonymous_block_box.h
@@ -45,8 +45,9 @@
 
   bool HasTrailingLineBreak() const OVERRIDE;
 
-  void RenderAndAnimateContent(render_tree::CompositionNode::Builder*
-                                   border_node_builder) const OVERRIDE;
+  void RenderAndAnimateContent(
+      render_tree::CompositionNode::Builder* border_node_builder,
+      ContainerBox* stacking_context) const OVERRIDE;
 
   // From |ContainerBox|.
 
diff --git a/src/cobalt/layout/box.cc b/src/cobalt/layout/box.cc
index 1f12a66..d07fc5f 100644
--- a/src/cobalt/layout/box.cc
+++ b/src/cobalt/layout/box.cc
@@ -68,7 +68,7 @@
       used_style_provider_(used_style_provider),
       layout_stat_tracker_(layout_stat_tracker),
       parent_(NULL),
-      render_sequence_(0) {
+      draw_order_position_in_stacking_context_(0) {
   DCHECK(animations());
   DCHECK(used_style_provider_);
 
@@ -400,25 +400,40 @@
   *is_placement_requirement_met = box_meets_placement_requirement;
 }
 
+void Box::AddBoxAndDescendantsToDrawOrderInStackingContext(
+    ContainerBox* stacking_context) {
+  DCHECK(stacking_context == GetStackingContext());
+  draw_order_position_in_stacking_context_ =
+      stacking_context->AddToDrawOrderInThisStackingContext();
+}
+
 void Box::RenderAndAnimate(
     CompositionNode::Builder* parent_content_node_builder,
-    const math::Vector2dF& offset_from_parent_node) {
+    const math::Vector2dF& offset_from_parent_node,
+    ContainerBox* stacking_context) {
+  DCHECK(stacking_context);
+
   math::Vector2dF border_box_offset(left().toFloat() + margin_left().toFloat(),
                                     top().toFloat() + margin_top().toFloat());
   border_box_offset += offset_from_parent_node;
 
   // If there's a pre-existing cached render tree node that is located at the
-  // border box offset, then simply use it. There's no more work to do.
+  // border box offset, then simply use it. The only work that needs to be done
+  // is adding the box and any ancestors that are contained within the stacking
+  // context to the draw order of the stacking context.
   if (cached_render_tree_node_info_ &&
       cached_render_tree_node_info_->offset_ == border_box_offset) {
     if (cached_render_tree_node_info_->node_) {
       parent_content_node_builder->AddChild(
           cached_render_tree_node_info_->node_);
-      render_sequence_ = parent_content_node_builder->children().size();
     }
+    AddBoxAndDescendantsToDrawOrderInStackingContext(stacking_context);
     return;
   }
 
+  draw_order_position_in_stacking_context_ =
+      stacking_context->AddToDrawOrderInThisStackingContext();
+
   // If this point is reached, then the pre-existing cached render tree node is
   // not being used.
   layout_stat_tracker_->OnRenderAndAnimate();
@@ -482,7 +497,9 @@
   // Furthermore, descendants of the element will be visible if they have
   // 'visibility: visible'.
   //   https://www.w3.org/TR/CSS21/visufx.html#propdef-visibility
-  if (computed_style()->visibility() == cssom::KeywordValue::GetVisible()) {
+  bool box_is_visible =
+      computed_style()->visibility() == cssom::KeywordValue::GetVisible();
+  if (box_is_visible) {
     RenderAndAnimateBackgroundImageResult background_image_result =
         RenderAndAnimateBackgroundImage(padding_rounded_corners);
     // If the background image is opaque, then it will occlude the background
@@ -505,20 +522,29 @@
 
   bool overflow_hidden_needs_to_be_applied = overflow_hidden;
 
+  // If the outline is absent or transparent, there is no need to render it.
+  bool outline_is_visible =
+      box_is_visible &&
+      (computed_style()->outline_style() != cssom::KeywordValue::GetNone() &&
+       computed_style()->outline_style() != cssom::KeywordValue::GetHidden() &&
+       (animations()->IsPropertyAnimated(cssom::kOutlineColorProperty) ||
+        GetUsedColor(computed_style()->outline_color()).a() != 0.0f));
+
   // In order to avoid the creation of a superfluous CompositionNode, we first
   // check to see if there is a need to distinguish between content and
   // background.
   if (!overflow_hidden ||
-      (computed_style()->box_shadow() == cssom::KeywordValue::GetNone() &&
+      (!outline_is_visible &&
+       computed_style()->box_shadow() == cssom::KeywordValue::GetNone() &&
        border_insets_.zero())) {
     // If there's no reason to distinguish between content and background,
     // just add them all to the same composition node.
-    RenderAndAnimateContent(&border_node_builder);
+    RenderAndAnimateContent(&border_node_builder, stacking_context);
   } else {
     CompositionNode::Builder content_node_builder;
     // Otherwise, deal with content specifically so that we can apply overflow:
     // hidden to the content but not the background.
-    RenderAndAnimateContent(&content_node_builder);
+    RenderAndAnimateContent(&content_node_builder, stacking_context);
     if (!content_node_builder.children().empty()) {
       border_node_builder.AddChild(RenderAndAnimateOverflow(
           padding_rounded_corners,
@@ -529,6 +555,10 @@
     overflow_hidden_needs_to_be_applied = false;
   }
 
+  if (outline_is_visible) {
+    RenderAndAnimateOutline(&border_node_builder, &animate_node_builder);
+  }
+
   if (!border_node_builder.children().empty()) {
     scoped_refptr<render_tree::Node> border_node =
         new CompositionNode(border_node_builder.Pass());
@@ -549,7 +579,6 @@
                   new AnimateNode(animate_node_builder, border_node));
 
     parent_content_node_builder->AddChild(cached_render_tree_node_info_->node_);
-    render_sequence_ = parent_content_node_builder->children().size();
   }
 }
 
@@ -560,12 +589,8 @@
   while (ancestor_box && (box != ancestor_box)) {
     box = ancestor_box;
     if (box->cached_render_tree_node_info_) {
-      render_sequence.push_back(box->render_sequence_);
-      if (box->IsPositioned() || box->IsTransformed()) {
-        ancestor_box = box->GetStackingContext();
-      } else {
-        ancestor_box = box->GetContainingBlock();
-      }
+      render_sequence.push_back(box->draw_order_position_in_stacking_context_);
+      ancestor_box = box->GetStackingContext();
     }
   }
   return render_sequence;
@@ -573,12 +598,12 @@
 
 bool Box::IsRenderedLater(RenderSequence render_sequence,
                           RenderSequence other_render_sequence) {
-  for (size_t step = 0; step < render_sequence.size(); ++step) {
-    if (other_render_sequence.size() < 1 + step) {
+  for (size_t step = 1; step <= render_sequence.size(); ++step) {
+    if (other_render_sequence.size() < step) {
       return true;
     }
-    size_t idx = render_sequence.size() - 1 - step;
-    size_t other_idx = other_render_sequence.size() - 1 - step;
+    size_t idx = render_sequence.size() - step;
+    size_t other_idx = other_render_sequence.size() - step;
     if (render_sequence[idx] != other_render_sequence[other_idx]) {
       return render_sequence[idx] > other_render_sequence[other_idx];
     }
@@ -727,6 +752,37 @@
         scoped_ptr<RoundedCorners>(new RoundedCorners(*rounded_corners));
   }
 }
+
+void PopulateBaseStyleForOutlineNode(
+    const scoped_refptr<const cssom::CSSComputedStyleData>& source_style,
+    const scoped_refptr<cssom::CSSComputedStyleData>& destination_style) {
+  // NOTE: Properties set by PopulateBaseStyleForOutlineNode() should match the
+  // properties used by SetupOutlineNodeFromStyle().
+
+  destination_style->set_outline_width(source_style->outline_width());
+  destination_style->set_outline_style(source_style->outline_style());
+  destination_style->set_outline_color(source_style->outline_color());
+}
+
+void SetupOutlineNodeFromStyleWithOutset(
+    const scoped_refptr<const cssom::CSSComputedStyleData>& style,
+    RectNode::Builder* rect_node_builder, float outset_width) {
+  rect_node_builder->rect.Outset(outset_width, outset_width);
+  if (outset_width != 0) {
+    rect_node_builder->border =
+        scoped_ptr<Border>(new Border(render_tree::BorderSide(
+            outset_width, GetRenderTreeBorderStyle(style->outline_style()),
+            GetUsedColor(style->outline_color()))));
+  }
+}
+
+void SetupOutlineNodeFromStyle(
+    const scoped_refptr<const cssom::CSSComputedStyleData>& style,
+    RectNode::Builder* rect_node_builder) {
+  SetupOutlineNodeFromStyleWithOutset(
+      style, rect_node_builder,
+      GetUsedNonNegativeLength(style->outline_width()).toFloat());
+}
 }  // namespace
 
 bool Box::HasNonZeroMarginOrBorderOrPadding() const {
@@ -802,14 +858,19 @@
 
 const ContainerBox* Box::GetStackingContext() const {
   if (!parent_) return AsContainerBox();
-  if (GetZIndex() == 0) {
-    return GetContainingBlock();
+
+  // If the box is an in-flow, non-positioned element, then simply return the
+  // parent as the stacking context.
+  //   https://www.w3.org/TR/CSS21/visuren.html#z-index
+  if (!IsPositioned() && !IsStackingContext()) {
+    return parent_;
   }
-  ContainerBox* containing_block = parent_;
-  while (!containing_block->IsStackingContext()) {
-    containing_block = containing_block->parent_;
+
+  ContainerBox* ancestor = parent_;
+  while (!ancestor->IsStackingContext()) {
+    ancestor = ancestor->parent_;
   }
-  return containing_block;
+  return ancestor;
 }
 
 int Box::GetZIndex() const {
@@ -830,43 +891,131 @@
 }
 
 void Box::UpdateCrossReferencesOfContainerBox(
-    ContainerBox* source_box, bool is_nearest_containing_block,
-    bool is_nearest_absolute_containing_block,
-    bool is_nearest_fixed_containing_block, bool is_nearest_stacking_context) {
-  // Containing blocks and stacking contexts only matter for positioned boxes.
-  if (IsPositioned() || IsTransformed()) {
-    bool is_my_containing_block;
-    // Establish the containing block, as described in
-    // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details.
-    if (computed_style()->position() == cssom::KeywordValue::GetAbsolute()) {
-      // If the element has 'position: absolute', the containing block is
-      // established by the nearest ancestor with a 'position' of 'absolute',
-      // 'relative' or 'fixed'.
-      is_my_containing_block = is_nearest_absolute_containing_block;
-    } else if (computed_style()->position() ==
-               cssom::KeywordValue::GetFixed()) {
+    ContainerBox* source_box, RelationshipToBox nearest_containing_block,
+    RelationshipToBox nearest_absolute_containing_block,
+    RelationshipToBox nearest_fixed_containing_block,
+    RelationshipToBox nearest_stacking_context,
+    StackingContextContainerBoxStack* stacking_context_container_box_stack) {
+  const scoped_refptr<cssom::PropertyValue>& position_property =
+      computed_style()->position();
+  const bool is_positioned =
+      position_property != cssom::KeywordValue::GetStatic();
+
+  RelationshipToBox my_nearest_containing_block = nearest_containing_block;
+
+  // Establish the containing block, as described in
+  // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details.
+  // Containing blocks only matter for descendant positioned boxes.
+  if (is_positioned) {
+    if (position_property == cssom::KeywordValue::GetFixed()) {
       // If the element has 'position: fixed', the containing block is
       // established by the viewport in the case of continuous media or the page
       // area in the case of paged media.
-      is_my_containing_block = is_nearest_fixed_containing_block;
-    } else {
-      // If the element's position is "relative" or "static", the containing
-      // block is formed by the content edge of the nearest block container
-      // ancestor box.
-      is_my_containing_block = is_nearest_containing_block;
+      my_nearest_containing_block = nearest_fixed_containing_block;
+    } else if (position_property == cssom::KeywordValue::GetAbsolute()) {
+      // If the element has 'position: absolute', the containing block is
+      // established by the nearest ancestor with a 'position' of 'absolute',
+      // 'relative' or 'fixed'.
+      my_nearest_containing_block = nearest_absolute_containing_block;
     }
+    // Otherwise, the element's position is "relative"; the containing block is
+    // formed by the content edge of the nearest block container ancestor box,
+    // which is the initial value of |my_nearest_containing_block|.
 
-    // If this box has a z_index of zero, then its containing block is its
-    // stacking context. Otherwise, the nearest stacking context is used.
-    bool is_my_stacking_context =
-        GetZIndex() == 0 ? is_my_containing_block : is_nearest_stacking_context;
-
-    if (is_my_containing_block) {
+    if (my_nearest_containing_block == kIsBox) {
       source_box->AddContainingBlockChild(this);
     }
-    if (is_my_stacking_context) {
-      source_box->AddStackingContextChild(this);
+  }
+
+  // Establish the stacking context, as described in
+  // https://www.w3.org/TR/CSS21/visuren.html#z-index,
+  // https://www.w3.org/TR/css3-color/#transparency, and
+  // https://www.w3.org/TR/css3-transforms/#transform-rendering.
+  // Stacking contexts only matter for descendant positioned boxes and child
+  // stacking contexts.
+  if (nearest_stacking_context == kIsBox &&
+      (is_positioned || IsStackingContext())) {
+    // Fixed position elements cannot have a containing block that is not also
+    // a stacking context, so it is impossible for it to have a containing
+    // block that is closer than the stacking context, although it can be
+    // further away.
+    DCHECK(my_nearest_containing_block != kIsBoxDescendant ||
+           position_property != cssom::KeywordValue::GetFixed());
+
+    // Default to using the stacking context itself as the nearest usable child
+    // container. However, this may change if a usable container is found
+    // further down in the container stack.
+    ContainerBox* nearest_usable_child_container = source_box;
+    RelationshipToBox containing_block_relationship_to_child_container =
+        my_nearest_containing_block;
+    ContainingBlocksWithOverflowHidden overflow_hidden_to_apply;
+
+    int z_index = GetZIndex();
+    // If a fixed position box is encountered that has a z-index of 0, then
+    // all of the containers within the current container stack are no longer
+    // usable as child containers. The reason for this is that the fixed
+    // position box is being added directly to the stacking context and will
+    // resultantly be drawn after all of the boxes in the current container
+    // stack. Given that subsequent boxes with a z-index of 0 should be drawn
+    // after this fixed position box, using any boxes within the current
+    // container stack will produce an incorrect draw order.
+    if (position_property == cssom::KeywordValue::GetFixed() && z_index == 0) {
+      for (StackingContextContainerBoxStack::iterator iter =
+               stacking_context_container_box_stack->begin();
+           iter != stacking_context_container_box_stack->end(); ++iter) {
+        iter->is_usable_as_child_container = false;
+      }
+    } else if (my_nearest_containing_block == kIsBoxDescendant) {
+      bool passed_my_containing_block = false;
+      bool next_containing_block_requires_absolute_containing_block =
+          position_property == cssom::KeywordValue::GetAbsolute();
+
+      // Walk up the container box stack looking for two things:
+      //   1. The nearest usable child container (meaning that it guarantees the
+      //      proper draw order).
+      //   2. All containing blocks with overflow hidden that are passed during
+      //      the walk. Because the box is being added to a child container
+      //      higher in the tree than these blocks, the box's nodes will not be
+      //      descendants of those containing blocks in the render tree and the
+      //      overflow hidden from them will need to be applied manually.
+      for (StackingContextContainerBoxStack::reverse_iterator iter =
+               stacking_context_container_box_stack->rbegin();
+           iter != stacking_context_container_box_stack->rend(); ++iter) {
+        // Only check for a usable child container if the z_index is 0. If it
+        // is not, then the stacking context must be used.
+        if (z_index == 0 && iter->is_usable_as_child_container) {
+          DCHECK(iter->is_absolute_containing_block);
+          nearest_usable_child_container = iter->container_box;
+          containing_block_relationship_to_child_container =
+              passed_my_containing_block ? kIsBoxDescendant : kIsBox;
+          break;
+        }
+
+        // Check for the current container box being the next containing block
+        // in the walk. If it is, then this box's containing block is guaranteed
+        // to have been passed during the walk (since it'll be the first
+        // containing block encountered); additionally, the ancestor containing
+        // block can potentially apply overflow hidden to this box.
+        if (iter->is_absolute_containing_block ||
+            !next_containing_block_requires_absolute_containing_block) {
+          passed_my_containing_block = true;
+          next_containing_block_requires_absolute_containing_block =
+              iter->has_absolute_position;
+          if (iter->has_overflow_hidden) {
+            overflow_hidden_to_apply.push_back(iter->container_box);
+          }
+        }
+      }
+
+      // Reverse the containing blocks with overflow hidden, so that they'll
+      // start with the ones nearest to the child container.
+      std::reverse(overflow_hidden_to_apply.begin(),
+                   overflow_hidden_to_apply.end());
     }
+
+    nearest_usable_child_container->AddStackingContextChild(
+        this, z_index, containing_block_relationship_to_child_container,
+        overflow_hidden_to_apply);
   }
 }
 
@@ -983,6 +1132,11 @@
          animation_set->IsPropertyAnimated(cssom::kBorderLeftColorProperty);
 }
 
+bool HasAnimatedOutline(const web_animations::AnimationSet* animation_set) {
+  return animation_set->IsPropertyAnimated(cssom::kOutlineColorProperty) ||
+         animation_set->IsPropertyAnimated(cssom::kOutlineWidthProperty);
+}
+
 }  // namespace
 
 void Box::RenderAndAnimateBoxShadow(
@@ -1060,9 +1214,11 @@
     const base::optional<RoundedCorners>& rounded_corners,
     CompositionNode::Builder* border_node_builder,
     AnimateNode::Builder* animate_node_builder) {
+  bool has_animated_border = HasAnimatedBorder(animations());
   // If the border is absent or all borders are transparent, there is no need
   // to render border.
-  if (border_insets_.zero() || AreAllBordersTransparent(computed_style())) {
+  if (border_insets_.zero() ||
+      (!has_animated_border && AreAllBordersTransparent(computed_style()))) {
     return;
   }
 
@@ -1082,7 +1238,7 @@
   scoped_refptr<RectNode> border_node(new RectNode(rect_node_builder.Pass()));
   border_node_builder->AddChild(border_node);
 
-  if (HasAnimatedBorder(animations())) {
+  if (has_animated_border) {
     AddAnimations<RectNode>(
         base::Bind(&PopulateBaseStyleForBorderNode),
         base::Bind(&SetupBorderNodeFromStyle, rounded_corners),
@@ -1090,6 +1246,30 @@
   }
 }
 
+void Box::RenderAndAnimateOutline(CompositionNode::Builder* border_node_builder,
+                                  AnimateNode::Builder* animate_node_builder) {
+  math::RectF rect(GetBorderBoxSize());
+  RectNode::Builder rect_node_builder(rect);
+  bool has_animated_outline = HasAnimatedOutline(animations());
+  if (has_animated_outline) {
+    SetupOutlineNodeFromStyleWithOutset(computed_style(), &rect_node_builder,
+                                        0);
+  } else {
+    SetupOutlineNodeFromStyle(computed_style(), &rect_node_builder);
+  }
+
+  scoped_refptr<RectNode> outline_node(new RectNode(rect_node_builder.Pass()));
+
+  border_node_builder->AddChild(outline_node);
+
+  if (has_animated_outline) {
+    AddAnimations<RectNode>(base::Bind(&PopulateBaseStyleForOutlineNode),
+                            base::Bind(&SetupOutlineNodeFromStyle),
+                            *css_computed_style_declaration(), outline_node,
+                            animate_node_builder);
+  }
+}
+
 void Box::RenderAndAnimateBackgroundColor(
     const base::optional<RoundedCorners>& rounded_corners,
     render_tree::CompositionNode::Builder* border_node_builder,
@@ -1227,16 +1407,35 @@
 }
 
 scoped_refptr<render_tree::Node> Box::RenderAndAnimateOverflow(
-    const base::optional<render_tree::RoundedCorners>& rounded_corners,
-    const scoped_refptr<render_tree::Node>& content_node, AnimateNode::Builder*
-    /* animate_node_builder */,
-    const math::Vector2dF& border_node_offset) {
-  bool overflow_hidden =
-      computed_style()->overflow().get() == cssom::KeywordValue::GetHidden();
+    const scoped_refptr<render_tree::Node>& content_node,
+    const math::Vector2dF& border_offset) {
+  UsedBorderRadiusProvider border_radius_provider(GetBorderBoxSize());
+  computed_style()->border_radius()->Accept(&border_radius_provider);
 
-  if (!overflow_hidden) {
-    return content_node;
+  base::optional<RoundedCorners> padding_rounded_corners_if_different;
+  if (border_radius_provider.rounded_corners() && !border_insets_.zero()) {
+    padding_rounded_corners_if_different =
+        border_radius_provider.rounded_corners()->Inset(math::InsetsF(
+            border_insets_.left().toFloat(), border_insets_.top().toFloat(),
+            border_insets_.right().toFloat(),
+            border_insets_.bottom().toFloat()));
   }
+  const base::optional<RoundedCorners>& padding_rounded_corners =
+      padding_rounded_corners_if_different
+          ? padding_rounded_corners_if_different
+          : border_radius_provider.rounded_corners();
+
+  return RenderAndAnimateOverflow(padding_rounded_corners, content_node, NULL,
+                                  border_offset);
+}
+
+scoped_refptr<render_tree::Node> Box::RenderAndAnimateOverflow(
+    const base::optional<render_tree::RoundedCorners>& rounded_corners,
+    const scoped_refptr<render_tree::Node>& content_node,
+    AnimateNode::Builder* /* animate_node_builder */,
+    const math::Vector2dF& border_node_offset) {
+  DCHECK_EQ(computed_style()->overflow().get(),
+            cssom::KeywordValue::GetHidden());
 
   // The "overflow" property specifies whether a box is clipped to its padding
   // edge.  Use a render_tree viewport filter to implement it.
diff --git a/src/cobalt/layout/box.h b/src/cobalt/layout/box.h
index 06e90ea..ddc61a0 100644
--- a/src/cobalt/layout/box.h
+++ b/src/cobalt/layout/box.h
@@ -109,11 +109,46 @@
     kInlineLevel,
   };
 
+  enum RelationshipToBox {
+    kIsBoxAncestor,
+    kIsBox,
+    kIsBoxDescendant,
+  };
+
+  // Info tracked on container boxes encountered when a stacking context is
+  // generating its cross references.
+  struct StackingContextContainerBoxInfo {
+    StackingContextContainerBoxInfo(ContainerBox* container_box,
+                                    bool is_absolute_containing_block,
+                                    bool has_absolute_position,
+                                    bool has_overflow_hidden)
+        : container_box(container_box),
+          is_absolute_containing_block(is_absolute_containing_block),
+          is_usable_as_child_container(is_absolute_containing_block),
+          has_absolute_position(has_absolute_position),
+          has_overflow_hidden(has_overflow_hidden) {}
+
+    ContainerBox* container_box;
+    bool is_absolute_containing_block;
+    bool is_usable_as_child_container;
+    bool has_absolute_position;
+    bool has_overflow_hidden;
+  };
+
+  typedef std::vector<StackingContextContainerBoxInfo>
+      StackingContextContainerBoxStack;
+
+  // List of containing blocks with overflow hidden property. Used by stacking
+  // context children that are added to a stacking context container higher up
+  // the tree than their containing block, so that they can still have the
+  // overflow hidden from those containing blocks applied.
+  typedef std::vector<ContainerBox*> ContainingBlocksWithOverflowHidden;
+
   // The RenderSequence of a box is used to compare the relative drawing order
-  // of boxes. It stores a value for the box's drawing order at each ancestor
-  // composition node up to the root of the render tree. As a result, starting
+  // of boxes. It stores a value for the box's drawing order position at each
+  // stacking context up to the root of the render tree. As a result, starting
   // from the root ancestor, the box for which the render sequence ends first,
-  // or for which the drawing order value at a composition node is lower is
+  // or for which the draw order position at a stacking context is lower is
   // drawn before the other box.
   typedef std::vector<size_t> RenderSequence;
 
@@ -150,7 +185,7 @@
   // Do not confuse with the formatting context that the element may establish.
   virtual Level GetLevel() const = 0;
 
-  // Returns trueif the box is positioned (e.g. position is non-static or
+  // Returns true if the box is positioned (e.g. position is non-static or
   // transform is not None).  Intuitively, this is true if the element does
   // not follow standard layout flow rules for determining its position.
   //   https://www.w3.org/TR/CSS21/visuren.html#positioned-element.
@@ -165,6 +200,14 @@
   //   https://www.w3.org/TR/CSS21/visuren.html#absolutely-positioned
   bool IsAbsolutelyPositioned() const;
 
+  // Returns true if the box serves as a stacking context for descendant
+  // elements. The core stacking context creation criteria is given here
+  // (https://www.w3.org/TR/CSS21/visuren.html#z-index) however it is extended
+  // by various other specification documents such as those describing opacity
+  // (https://www.w3.org/TR/css3-color/#transparency) and transforms
+  // (https://www.w3.org/TR/css3-transforms/#transform-rendering).
+  virtual bool IsStackingContext() const { return false; }
+
   // Updates the size of margin, border, padding, and content boxes. Lays out
   // in-flow descendants, estimates static positions (but not sizes) of
   // out-of-flow descendants. Does not update the position of the box.
@@ -232,7 +275,9 @@
       BaseDirection base_direction) const;
   LayoutUnit GetMarginBoxEndEdgeOffsetFromContainingBlock(
       BaseDirection base_direction) const;
+  LayoutUnit margin_left() const { return margin_insets_.left(); }
   LayoutUnit margin_top() const { return margin_insets_.top(); }
+  LayoutUnit margin_right() const { return margin_insets_.right(); }
   LayoutUnit margin_bottom() const { return margin_insets_.bottom(); }
 
   // Border box.
@@ -424,7 +469,12 @@
   // on the subclasses to provide the actual content.
   void RenderAndAnimate(
       render_tree::CompositionNode::Builder* parent_content_node_builder,
-      const math::Vector2dF& offset_from_parent_node);
+      const math::Vector2dF& offset_from_parent_node,
+      ContainerBox* stacking_context);
+
+  scoped_refptr<render_tree::Node> RenderAndAnimateOverflow(
+      const scoped_refptr<render_tree::Node>& content_node,
+      const math::Vector2dF& border_offset);
 
   // Poor man's reflection.
   virtual AnonymousBlockBox* AsAnonymousBlockBox();
@@ -516,14 +566,12 @@
   //
   // Used values of "margin" properties are set by overriders
   // of |UpdateContentSizeAndMargins| method.
-  LayoutUnit margin_left() const { return margin_insets_.left(); }
   void set_margin_left(LayoutUnit margin_left) {
     margin_insets_.set_left(margin_left);
   }
   void set_margin_top(LayoutUnit margin_top) {
     margin_insets_.set_top(margin_top);
   }
-  LayoutUnit margin_right() const { return margin_insets_.right(); }
   void set_margin_right(LayoutUnit margin_right) {
     margin_insets_.set_right(margin_right);
   }
@@ -558,9 +606,17 @@
   //   https://www.w3.org/TR/CSS21/visuren.html#phantom-line-box
   bool HasNonZeroMarginOrBorderOrPadding() const;
 
+  // Add a box and all of its descendants that are contained within the
+  // specified stacking context to the stacking context's draw order. This is
+  // used when a render tree node that is already cached is encountered to
+  // ensure that it maintains the proper draw order in its stacking context.
+  virtual void AddBoxAndDescendantsToDrawOrderInStackingContext(
+      ContainerBox* stacking_context);
+
   // Renders the content of the box.
   virtual void RenderAndAnimateContent(
-      render_tree::CompositionNode::Builder* border_node_builder) const = 0;
+      render_tree::CompositionNode::Builder* border_node_builder,
+      ContainerBox* stacking_context) const = 0;
 
   // A transformable element is an element whose layout is governed by the CSS
   // box model which is either a block-level or atomic inline-level element.
@@ -580,9 +636,11 @@
   // the box tree that have it as their containing block or stacking context.
   // This function is called recursively.
   virtual void UpdateCrossReferencesOfContainerBox(
-      ContainerBox* source_box, bool is_nearest_containing_block,
-      bool is_nearest_absolute_containing_block,
-      bool is_nearest_fixed_containing_block, bool is_nearest_stacking_context);
+      ContainerBox* source_box, RelationshipToBox nearest_containing_block,
+      RelationshipToBox nearest_absolute_containing_block,
+      RelationshipToBox nearest_fixed_containing_block,
+      RelationshipToBox nearest_stacking_context,
+      StackingContextContainerBoxStack* stacking_context_container_box_stack);
 
   // Updates the horizontal margins for block level in-flow boxes. This is used
   // for both non-replaced and replaced elements. See
@@ -622,6 +680,9 @@
       const base::optional<render_tree::RoundedCorners>& rounded_corners,
       render_tree::CompositionNode::Builder* border_node_builder,
       render_tree::animations::AnimateNode::Builder* animate_node_builder);
+  void RenderAndAnimateOutline(
+      render_tree::CompositionNode::Builder* border_node_builder,
+      render_tree::animations::AnimateNode::Builder* animate_node_builder);
   void RenderAndAnimateBackgroundColor(
       const base::optional<render_tree::RoundedCorners>& rounded_corners,
       render_tree::CompositionNode::Builder* border_node_builder,
@@ -651,7 +712,7 @@
 
   scoped_refptr<render_tree::Node> RenderAndAnimateOverflow(
       const base::optional<render_tree::RoundedCorners>& rounded_corners,
-      const scoped_refptr<render_tree::Node>& border_node,
+      const scoped_refptr<render_tree::Node>& content_node,
       render_tree::animations::AnimateNode::Builder* animate_node_builder,
       const math::Vector2dF& border_node_offset);
 
@@ -723,10 +784,10 @@
   // recalculated during each call to RenderAndAnimateContent.
   base::optional<CachedRenderTreeNodeInfo> cached_render_tree_node_info_;
 
-  // A value that indicates the drawing order relative to boxes with the same
-  // rendering ancestor box (which is either the stacking context or the
-  // containing block). Smaller values indicate boxes that are drawn earlier.
-  size_t render_sequence_;
+  // A value that indicates the drawing order relative to other boxes in the
+  // same stacking context. Smaller values indicate boxes that are drawn
+  // earlier.
+  size_t draw_order_position_in_stacking_context_;
 
   // For write access to parent/containing_block members.
   friend class ContainerBox;
diff --git a/src/cobalt/layout/container_box.cc b/src/cobalt/layout/container_box.cc
index a13d889..fa33ea8 100644
--- a/src/cobalt/layout/container_box.cc
+++ b/src/cobalt/layout/container_box.cc
@@ -14,6 +14,8 @@
 
 #include "cobalt/layout/container_box.h"
 
+#include <algorithm>
+
 #include "cobalt/cssom/keyword_value.h"
 #include "cobalt/cssom/number_value.h"
 #include "cobalt/layout/used_style.h"
@@ -31,7 +33,8 @@
           layout_stat_tracker),
       update_size_results_valid_(false),
       are_cross_references_valid_(false),
-      are_bidi_levels_runs_split_(false) {}
+      are_bidi_levels_runs_split_(false),
+      next_draw_order_position_(0) {}
 
 ContainerBox::~ContainerBox() {}
 
@@ -86,7 +89,7 @@
   // for being transformed.
   // https://www.w3.org/TR/css-transforms-1/#transformable-element
   DCHECK(!split_sibling->IsTransformable());
-  if (split_sibling->IsPositioned()) {
+  if (split_sibling->IsPositioned() || split_sibling->IsStackingContext()) {
     split_sibling->GetContainingBlock()->are_cross_references_valid_ = false;
     split_sibling->GetStackingContext()->are_cross_references_valid_ = false;
   }
@@ -135,18 +138,27 @@
   // Children are only being removed from this container. As a result, the cross
   // references only need to be invalidated if there is a non-empty cross
   // reference list that can potentially lose an element.
-  if (!positioned_child_boxes_.empty() || !negative_z_index_child_.empty() ||
-      !non_negative_z_index_child_.empty()) {
+  if (!positioned_child_boxes_.empty()) {
     are_cross_references_valid_ = false;
   }
+  if (!negative_z_index_stacking_context_children_.empty() ||
+      !non_negative_z_index_stacking_context_children_.empty()) {
+    // If this box is a stacking context, then any stacking context children
+    // were added directly by it; otherwise, the stacking context children were
+    // added by the containing stacking context (only a stacking context can
+    // cause stacking context children to be added).
+    if (IsStackingContext()) {
+      are_cross_references_valid_ = false;
+    } else {
+      DCHECK(negative_z_index_stacking_context_children_.empty());
+      GetStackingContext()->are_cross_references_valid_ = false;
+    }
+  }
 
   // Invalidate the render tree nodes now that the children have changed.
   InvalidateRenderTreeNodesOfBoxAndAncestors();
 }
 
-// Returns true if the given style allows a container box to act as a containing
-// block for absolutely positioned elements.  For example it will be true if
-// this box's style is itself 'absolute'.
 bool ContainerBox::IsContainingBlockForPositionAbsoluteElements() const {
   return parent() == NULL || IsPositioned() || IsTransformed();
 }
@@ -155,24 +167,23 @@
   return parent() == NULL || IsTransformed();
 }
 
-// Returns true if this container box serves as a stacking context for
-// descendant elements.  The core stacking context creation criteria is given
-// here (https://www.w3.org/TR/CSS21/visuren.html#z-index) however it is
-// extended by various other specification documents such as those describing
-// opacity (https://www.w3.org/TR/css3-color/#transparency) and transforms
-// (https://www.w3.org/TR/css3-transforms/#transform-rendering).
 bool ContainerBox::IsStackingContext() const {
-  bool has_opacity =
-      base::polymorphic_downcast<const cssom::NumberValue*>(
-          computed_style()->opacity().get())->value() < 1.0f;
-  bool is_positioned_with_non_auto_z_index =
-      IsPositioned() &&
-      computed_style()->z_index() != cssom::KeywordValue::GetAuto();
-
+  // The core stacking context creation criteria is given here
+  // (https://www.w3.org/TR/CSS21/visuren.html#z-index) however it is extended
+  // by various other specification documents such as those describing opacity
+  // (https://www.w3.org/TR/css3-color/#transparency) and transforms
+  // (https://www.w3.org/TR/css3-transforms/#transform-rendering).
+  // NOTE: Fixed position elements are treated as stacking contexts. While the
+  // spec does not specify that they create a stacking context, this is the
+  // functionality of Chrome, Firefox, Edge, and Safari.
   return parent() == NULL ||
-         has_opacity ||
+         (base::polymorphic_downcast<const cssom::NumberValue*>(
+              computed_style()->opacity().get())
+              ->value() < 1.0f) ||
          IsTransformed() ||
-         is_positioned_with_non_auto_z_index;
+         (IsPositioned() &&
+          computed_style()->z_index() != cssom::KeywordValue::GetAuto()) ||
+         computed_style()->position() == cssom::KeywordValue::GetFixed();
 }
 
 void ContainerBox::UpdateCrossReferences() {
@@ -181,28 +192,39 @@
     // box are being re-generated.
     layout_stat_tracker()->OnUpdateCrossReferences();
 
+    bool is_stacking_context = IsStackingContext();
+
     // Cross references are not cleared when they are invalidated. This is
     // because they can be invalidated while they are being walked if a
     // relatively positioned descendant is split. Therefore, they need to be
     // cleared now before they are regenerated.
     positioned_child_boxes_.clear();
-    negative_z_index_child_.clear();
-    non_negative_z_index_child_.clear();
+    if (is_stacking_context) {
+      negative_z_index_stacking_context_children_.clear();
+      non_negative_z_index_stacking_context_children_.clear();
+    }
 
-    const bool kIsNearestContainingBlockOfChildren = true;
-    bool is_nearest_absolute_containing_block =
-        IsContainingBlockForPositionAbsoluteElements();
-    bool is_nearest_fixed_containing_block =
-        IsContainingBlockForPositionFixedElements();
-    bool is_nearest_stacking_context = IsStackingContext();
+    // This stack tracks all container boxes within the stacking context. The
+    // container boxes will only be pushed and popped if the current box is
+    // their stacking context.
+    StackingContextContainerBoxStack stacking_context_container_box_stack;
+
+    const RelationshipToBox kNearestContainingBlockOfChildren = kIsBox;
+    RelationshipToBox nearest_absolute_containing_block =
+        IsContainingBlockForPositionAbsoluteElements() ? kIsBox
+                                                       : kIsBoxAncestor;
+    RelationshipToBox nearest_fixed_containing_block =
+        IsContainingBlockForPositionFixedElements() ? kIsBox : kIsBoxAncestor;
+    RelationshipToBox nearest_stacking_context =
+        is_stacking_context ? kIsBox : kIsBoxAncestor;
 
     for (Boxes::const_iterator child_box_iterator = child_boxes_.begin();
          child_box_iterator != child_boxes_.end(); ++child_box_iterator) {
       Box* child_box = *child_box_iterator;
       child_box->UpdateCrossReferencesOfContainerBox(
-          this, kIsNearestContainingBlockOfChildren,
-          is_nearest_absolute_containing_block,
-          is_nearest_fixed_containing_block, is_nearest_stacking_context);
+          this, kNearestContainingBlockOfChildren,
+          nearest_absolute_containing_block, nearest_fixed_containing_block,
+          nearest_stacking_context, &stacking_context_container_box_stack);
     }
 
     are_cross_references_valid_ = true;
@@ -215,19 +237,28 @@
   positioned_child_boxes_.push_back(child_box);
 }
 
-void ContainerBox::AddStackingContextChild(Box* child_box) {
+void ContainerBox::AddStackingContextChild(
+    Box* child_box, int child_z_index,
+    RelationshipToBox containing_block_relationship,
+    const ContainingBlocksWithOverflowHidden& overflow_hidden_to_apply) {
   DCHECK_NE(this, child_box);
-  DCHECK_EQ(this, child_box->GetStackingContext());
-  int child_z_index = child_box->GetZIndex();
-  DCHECK(child_z_index == 0 || IsStackingContext())
-      << "Children with non-zero z-indices can only be added to container "
-         "boxes that establish stacking contexts.";
+  DCHECK_EQ(child_z_index, child_box->GetZIndex());
+  // If this is a stacking context, then verify that the child box's stacking
+  // context is this stacking context.
+  // Otherwise, verify that this box's stacking context is also the child box's
+  // stacking context and that the z_index of the child is 0 (non-zero z-index
+  // children must be added directly to the stacking context).
+  DCHECK(this->IsStackingContext()
+             ? this == child_box->GetStackingContext()
+             : this->GetStackingContext() == child_box->GetStackingContext() &&
+                   child_z_index == 0);
 
-  if (child_z_index < 0) {
-    negative_z_index_child_.insert(child_box);
-  } else {
-    non_negative_z_index_child_.insert(child_box);
-  }
+  ZIndexSortedList& stacking_context_children =
+      child_z_index < 0 ? negative_z_index_stacking_context_children_
+                        : non_negative_z_index_stacking_context_children_;
+  stacking_context_children.insert(StackingContextChildInfo(
+      child_box, child_z_index, containing_block_relationship,
+      overflow_hidden_to_apply));
 }
 
 namespace {
@@ -291,16 +322,18 @@
     const scoped_refptr<cssom::PropertyValue>& child_box_position =
         child_box->computed_style()->position();
 
-    if (child_box_position == cssom::KeywordValue::GetRelative()) {
-      UpdateOffsetOfRelativelyPositionedChildBox(child_box,
-                                                 relative_child_layout_params);
-    } else if (child_box_position == cssom::KeywordValue::GetAbsolute()) {
+    if (child_box_position == cssom::KeywordValue::GetAbsolute()) {
       UpdateRectOfAbsolutelyPositionedChildBox(child_box,
                                                absolute_child_layout_params);
-    } else {
+    } else if (child_box_position == cssom::KeywordValue::GetFixed()) {
       UpdateRectOfFixedPositionedChildBox(child_box,
                                           relative_child_layout_params);
+    } else {
+      DCHECK(child_box_position == cssom::KeywordValue::GetRelative());
+      UpdateOffsetOfRelativelyPositionedChildBox(child_box,
+                                                 relative_child_layout_params);
     }
+
     // Verify that the positioned child boxes didn't get cleared during the
     // walk. This should never happen because the cross references being
     // invalidated should not cause them to be cleared.
@@ -400,107 +433,283 @@
 
 namespace {
 
-Vector2dLayoutUnit GetOffsetFromContainingBlockToStackingContext(
-    Box* child_box) {
-  DCHECK(child_box->IsPositioned() || child_box->IsTransformed());
+// This class handles all logic involved with calling RenderAndAnimate() on
+// stacking context children., including determining their offset from the child
+// container and applying overflow hidden from its containing blocks.
+class RenderAndAnimateStackingContextChildrenCoordinator {
+ public:
+  RenderAndAnimateStackingContextChildrenCoordinator(
+      ContainerBox* stacking_context, const ContainerBox* child_container,
+      const Vector2dLayoutUnit& child_container_offset_from_parent_node,
+      render_tree::CompositionNode::Builder* base_node_builder)
+      : stacking_context_(stacking_context),
+        child_container_(child_container),
+        child_container_offset_from_parent_node_(
+            child_container_offset_from_parent_node),
+        base_node_builder_(base_node_builder) {}
 
-  Vector2dLayoutUnit relative_position;
-  for (Box *containing_block = child_box->GetContainingBlock(),
-           *current_box = child_box->GetStackingContext();
-       current_box != containing_block;
-       current_box = current_box->GetContainingBlock()) {
-    if (!current_box) {
-      DLOG(WARNING)
-          << "Unsupported stacking context and containing block relation.";
-      break;
-    }
-#if !defined(NDEBUG)
-    // We should not determine a used position through a transform, as
-    // rectangles may not remain rectangles past it, and thus obtaining
-    // a position may be misleading.
-    if (current_box->IsTransformed()) {
-      DLOG(WARNING) << "Boxes with stacking contexts above containing blocks "
-                       "with transforms may not be positioned correctly.";
-    }
-#endif
+  // The destructor handles generating filter nodes for any remaining entries in
+  // |overflow_hidden_stack_|.
+  ~RenderAndAnimateStackingContextChildrenCoordinator();
 
-    relative_position += current_box->GetContentBoxOffsetFromMarginBox();
-    relative_position += current_box->margin_box_offset_from_containing_block();
+  // Applies overflow hidden from the child's containing blocks and then calls
+  // RenderAndAnimate() on it.
+  void RenderAndAnimateChild(
+      const ContainerBox::StackingContextChildInfo& child_info);
+
+ private:
+  struct OverflowHiddenInfo {
+    explicit OverflowHiddenInfo(ContainerBox* containing_block)
+        : node_builder(math::Vector2dF()), containing_block(containing_block) {}
+
+    render_tree::CompositionNode::Builder node_builder;
+    ContainerBox* containing_block;
+  };
+
+  typedef std::vector<OverflowHiddenInfo> OverflowHiddenStack;
+
+  // Updates |overflow_hidden_stack_| with the overflow hidden containing blocks
+  // of the current child. Any entries in |overflow_hidden_stack_| that are no
+  // longer valid are popped. All entries that remain valid are retained, so
+  // that filter nodes can be shared across stacking context children.
+  void ApplyOverflowHiddenForChild(
+      const Box::ContainingBlocksWithOverflowHidden& overflow_hidden_to_apply);
+
+  // Generates a filter node from the top entry in |overflow_hidden_stack_| and
+  // adds it to the active node builder after the top entry is popped.
+  void PopOverflowHiddenEntryFromStack();
+
+  // Returns the node builder from the top entry in |overflow_hidden_stack_| if
+  // it is not empty; otherwise, returns |base_node_builder_|.
+  render_tree::CompositionNode::Builder* GetActiveNodeBuilder();
+
+  Vector2dLayoutUnit GetOffsetFromChildContainerToContainingBlock(
+      const Box* containing_block,
+      const Box::RelationshipToBox
+          containing_block_relationship_to_child_container) const;
+
+  ContainerBox* stacking_context_;
+  const ContainerBox* child_container_;
+  const Vector2dLayoutUnit& child_container_offset_from_parent_node_;
+
+  render_tree::CompositionNode::Builder* base_node_builder_;
+  OverflowHiddenStack overflow_hidden_stack_;
+};
+
+RenderAndAnimateStackingContextChildrenCoordinator::
+    ~RenderAndAnimateStackingContextChildrenCoordinator() {
+  while (!overflow_hidden_stack_.empty()) {
+    PopOverflowHiddenEntryFromStack();
   }
-  return relative_position;
 }
 
-Vector2dLayoutUnit GetOffsetFromStackingContextToContainingBlock(
-    Box* child_box) {
-  const scoped_refptr<cssom::PropertyValue>& child_box_position =
-      child_box->computed_style()->position();
-  if (child_box_position == cssom::KeywordValue::GetFixed()) {
-    // Elements with fixed position will have their containing block farther
-    // up the hierarchy than the stacking context, so handle this case
-    // specially.
-    return -GetOffsetFromContainingBlockToStackingContext(child_box);
-  }
+void RenderAndAnimateStackingContextChildrenCoordinator::RenderAndAnimateChild(
+    const ContainerBox::StackingContextChildInfo& child_info) {
+  ApplyOverflowHiddenForChild(child_info.overflow_hidden_to_apply);
 
-  Vector2dLayoutUnit relative_position;
-  if (child_box_position == cssom::KeywordValue::GetAbsolute()) {
+  // Generate the offset from the child container to the child box.
+  const ContainerBox* child_containing_block =
+      child_info.box->GetContainingBlock();
+  Vector2dLayoutUnit position_offset =
+      GetOffsetFromChildContainerToContainingBlock(
+          child_containing_block, child_info.containing_block_relationship) +
+      child_container_offset_from_parent_node_;
+  if (child_info.box->computed_style()->position() ==
+      cssom::KeywordValue::GetAbsolute()) {
     // The containing block is formed by the padding box instead of the content
     // box, as described in
     // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details.
-    relative_position -=
-        child_box->GetContainingBlock()->GetContentBoxOffsetFromPaddingBox();
+    position_offset -=
+        child_containing_block->GetContentBoxOffsetFromPaddingBox();
   }
-  for (Box *current_box = child_box->GetContainingBlock(),
-           *stacking_context = child_box->GetStackingContext();
-       current_box != stacking_context;
-       current_box = current_box->GetContainingBlock()) {
-    if (!current_box) {
-      // Positioned elements may have their containing block farther
-      // up the hierarchy than the stacking context, so handle this case here.
-      DCHECK(child_box->IsPositioned() || child_box->IsTransformed());
-      return -GetOffsetFromContainingBlockToStackingContext(child_box);
+
+  child_info.box->RenderAndAnimate(GetActiveNodeBuilder(), position_offset,
+                                   stacking_context_);
+}
+
+void RenderAndAnimateStackingContextChildrenCoordinator::
+    ApplyOverflowHiddenForChild(const Box::ContainingBlocksWithOverflowHidden&
+                                    overflow_hidden_to_apply) {
+  // Walk the overflow hidden list being applied and the active overflow hidden
+  // stack looking for the first index where there's a mismatch. All entries
+  // prior to this are retained. This allows as many FilterNodes as possible to
+  // be shared between the stacking context children.
+  size_t index = 0;
+  for (; index < overflow_hidden_to_apply.size() &&
+         index < overflow_hidden_stack_.size();
+       ++index) {
+    if (overflow_hidden_to_apply[index] !=
+        overflow_hidden_stack_[index].containing_block) {
+      break;
     }
+  }
+
+  // Pop all entries in the active overflow hidden stack that follow the index
+  // mismatch. They're no longer contained within the overflow hidden list being
+  // applied.
+  while (index < overflow_hidden_stack_.size()) {
+    PopOverflowHiddenEntryFromStack();
+  }
+
+  // Add the new overflow hidden entries to the active stack.
+  for (; index < overflow_hidden_to_apply.size(); ++index) {
+    overflow_hidden_stack_.push_back(
+        OverflowHiddenInfo(overflow_hidden_to_apply[index]));
+  }
+}
+
+void RenderAndAnimateStackingContextChildrenCoordinator::
+    PopOverflowHiddenEntryFromStack() {
+  DCHECK(!overflow_hidden_stack_.empty());
+  // Before popping the top of the stack, a filter node is generated from it
+  // that is added to next node builder.
+  OverflowHiddenInfo& overflow_hidden_info = overflow_hidden_stack_.back();
+
+  ContainerBox* containing_block = overflow_hidden_info.containing_block;
+  DCHECK_EQ(containing_block->computed_style()->overflow().get(),
+            cssom::KeywordValue::GetHidden());
+
+  // Determine the offset from the child container to this containing block's
+  // margin box.
+  Vector2dLayoutUnit containing_block_border_offset =
+      GetOffsetFromChildContainerToContainingBlock(containing_block,
+                                                   Box::kIsBoxAncestor) +
+      Vector2dLayoutUnit(containing_block->margin_left(),
+                         containing_block->margin_top());
+
+  // Apply the overflow hidden from this containing block to its composition
+  // node; the resulting filter node is added to the next active node builder.
+  scoped_refptr<render_tree::Node> filter_node =
+      containing_block->RenderAndAnimateOverflow(
+          new render_tree::CompositionNode(
+              overflow_hidden_info.node_builder.Pass()),
+          math::Vector2dF(containing_block_border_offset.x().toFloat(),
+                          containing_block_border_offset.y().toFloat()));
+
+  overflow_hidden_stack_.pop_back();
+  GetActiveNodeBuilder()->AddChild(filter_node);
+}
+
+render_tree::CompositionNode::Builder*
+RenderAndAnimateStackingContextChildrenCoordinator::GetActiveNodeBuilder() {
+  return overflow_hidden_stack_.empty()
+             ? base_node_builder_
+             : &(overflow_hidden_stack_.back().node_builder);
+}
+
+Vector2dLayoutUnit RenderAndAnimateStackingContextChildrenCoordinator::
+    GetOffsetFromChildContainerToContainingBlock(
+        const Box* containing_block,
+        const Box::RelationshipToBox
+            containing_block_relationship_to_child_container) const {
+  Vector2dLayoutUnit relative_position;
+  if (containing_block_relationship_to_child_container != Box::kIsBox) {
+    const Box* current_box =
+        containing_block_relationship_to_child_container == Box::kIsBoxAncestor
+            ? child_container_
+            : containing_block;
+    const Box* end_box =
+        containing_block_relationship_to_child_container == Box::kIsBoxAncestor
+            ? containing_block
+            : child_container_;
+
+    while (current_box != end_box) {
 #if !defined(NDEBUG)
-    // We should not determine a used position through a transform, as
-    // rectangles may not remain rectangles past it, and thus obtaining
-    // a position may be misleading.
-    if (current_box->IsTransformed()) {
-      DLOG(WARNING) << "Boxes with stacking contexts below containing blocks "
-                       "with transforms may not be positioned correctly.";
-    }
+      // We should not determine a used position through a transform, as
+      // rectangles may not remain rectangles past it, and thus obtaining a
+      // position may be misleading.
+      if (current_box->IsTransformed()) {
+        DLOG(WARNING) << "Containing block offset calculations that include "
+                         "transforms may not be positioned correctly.";
+      }
 #endif
 
-    relative_position += current_box->GetContentBoxOffsetFromMarginBox();
-    relative_position += current_box->margin_box_offset_from_containing_block();
+      relative_position += current_box->GetContentBoxOffsetFromMarginBox();
+      relative_position +=
+          current_box->margin_box_offset_from_containing_block();
 
-    if (current_box->computed_style()->position() ==
-        cssom::KeywordValue::GetAbsolute()) {
-      relative_position -= current_box->GetContainingBlock()
-                               ->GetContentBoxOffsetFromPaddingBox();
+      const Box* next_box = current_box->GetContainingBlock();
+      if (!next_box) {
+        break;
+      }
+
+      if (current_box->computed_style()->position() ==
+          cssom::KeywordValue::GetAbsolute()) {
+        relative_position -= next_box->GetContentBoxOffsetFromPaddingBox();
+      }
+      current_box = next_box;
+    }
+
+    // If |current_box| does not equal |end_box|, then |end_box| was skipped
+    // during the walk up the tree. Initiate a second walk up the tree from the
+    // end box to the root (which is where the first walk ended).
+    // The end box can be skipped during the initial walk both when the end box
+    // is not positioned and also when a fixed position box is encountered
+    // during the walk. Subtract the offsets during this walk to remove the
+    // extra offsets added after passing the end box during the first walk.
+    std::swap(current_box, end_box);
+    while (current_box != end_box) {
+      relative_position -= current_box->GetContentBoxOffsetFromMarginBox();
+      relative_position -=
+          current_box->margin_box_offset_from_containing_block();
+
+      const Box* next_box = current_box->GetContainingBlock();
+      if (current_box->computed_style()->position() ==
+          cssom::KeywordValue::GetAbsolute()) {
+        relative_position += next_box->GetContentBoxOffsetFromPaddingBox();
+      }
+      current_box = next_box;
+    }
+
+    // If the containing block is an ancestor of the child container, then
+    // reverse the relative position now. The earlier calculations were for the
+    // containing block being a descendant of the child container.
+    if (containing_block_relationship_to_child_container ==
+        Box::kIsBoxAncestor) {
+      relative_position = -relative_position;
     }
   }
+
   return relative_position;
 }
 
 }  // namespace
 
 void ContainerBox::RenderAndAnimateStackingContextChildren(
-    const ZIndexSortedList& z_index_child_list,
+    const ZIndexSortedList& stacking_context_child_list,
     render_tree::CompositionNode::Builder* content_node_builder,
-    const Vector2dLayoutUnit& offset_from_parent_node) const {
+    const Vector2dLayoutUnit& offset_from_parent_node,
+    ContainerBox* stacking_context) const {
+  // Create a coordinator that handles all logic involved with calling
+  // RenderAndAnimate() on stacking context children., including determining
+  // their offset from the child container and applying overflow hidden from the
+  // child's containing blocks.
+  RenderAndAnimateStackingContextChildrenCoordinator coordinator(
+      stacking_context, this, offset_from_parent_node, content_node_builder);
+
   // Render all children of the passed in list in sorted order.
-  for (ZIndexSortedList::const_iterator iter = z_index_child_list.begin();
-       iter != z_index_child_list.end(); ++iter) {
-    Box* child_box = *iter;
+  for (ZIndexSortedList::const_iterator iter =
+           stacking_context_child_list.begin();
+       iter != stacking_context_child_list.end(); ++iter) {
+    const StackingContextChildInfo& child_info = *iter;
 
-    DCHECK_EQ(this, child_box->GetStackingContext());
-    Vector2dLayoutUnit position_offset =
-        GetOffsetFromStackingContextToContainingBlock(child_box) +
-        offset_from_parent_node;
+    // If this container box is a stacking context, then verify that this child
+    // box belongs to it; otherwise, verify that the container box and the child
+    // box share the same stacking context and that the child's z-index is 0.
+    DCHECK(this->IsStackingContext()
+               ? this == child_info.box->GetStackingContext()
+               : this->GetStackingContext() ==
+                         child_info.box->GetStackingContext() &&
+                     child_info.z_index == 0);
 
-    child_box->RenderAndAnimate(content_node_builder, position_offset);
+    coordinator.RenderAndAnimateChild(child_info);
   }
 }
 
+size_t ContainerBox::AddToDrawOrderInThisStackingContext() {
+  return next_draw_order_position_++;
+}
+
 void ContainerBox::SplitBidiLevelRuns() {
   // Only split the child boxes if the bidi level runs haven't already been
   // split.
@@ -516,14 +725,16 @@
 }
 
 void ContainerBox::UpdateCrossReferencesOfContainerBox(
-    ContainerBox* source_box, bool is_nearest_containing_block,
-    bool is_nearest_absolute_containing_block,
-    bool is_nearest_fixed_containing_block, bool is_nearest_stacking_context) {
+    ContainerBox* source_box, RelationshipToBox nearest_containing_block,
+    RelationshipToBox nearest_absolute_containing_block,
+    RelationshipToBox nearest_fixed_containing_block,
+    RelationshipToBox nearest_stacking_context,
+    StackingContextContainerBoxStack* stacking_context_container_box_stack) {
   // First update the source container box's cross references with this box.
   Box::UpdateCrossReferencesOfContainerBox(
-      source_box, is_nearest_containing_block,
-      is_nearest_absolute_containing_block, is_nearest_fixed_containing_block,
-      is_nearest_stacking_context);
+      source_box, nearest_containing_block, nearest_absolute_containing_block,
+      nearest_fixed_containing_block, nearest_stacking_context,
+      stacking_context_container_box_stack);
 
   // In addition to updating the source container box's cross references with
   // this box, we also recursively update it with our children.
@@ -532,58 +743,135 @@
   // specified types, then the target container box cannot be the nearest box of
   // that type for the children.
 
-  const bool kIsNearestContainingBlockOfChildren = false;
-  bool is_nearest_absolute_containing_block_of_children =
-      is_nearest_absolute_containing_block &&
-      !IsContainingBlockForPositionAbsoluteElements();
-  bool is_nearest_fixed_containing_block_of_children =
-      is_nearest_fixed_containing_block &&
-      !IsContainingBlockForPositionFixedElements();
-  bool is_nearest_stacking_context_of_children =
-      is_nearest_stacking_context && !IsStackingContext();
+  const RelationshipToBox kNearestContainingBlockOfChildren = kIsBoxDescendant;
+  RelationshipToBox nearest_absolute_containing_block_of_children =
+      nearest_absolute_containing_block != kIsBoxDescendant &&
+              IsContainingBlockForPositionAbsoluteElements()
+          ? kIsBoxDescendant
+          : nearest_absolute_containing_block;
+  RelationshipToBox nearest_fixed_containing_block_of_children =
+      nearest_fixed_containing_block != kIsBoxDescendant &&
+              IsContainingBlockForPositionFixedElements()
+          ? kIsBoxDescendant
+          : nearest_fixed_containing_block;
+  RelationshipToBox nearest_stacking_context_of_children =
+      nearest_stacking_context != kIsBoxDescendant && IsStackingContext()
+          ? kIsBoxDescendant
+          : nearest_stacking_context;
+
+  // If the source box is the stacking context for this container box, then
+  // clear out this box's stacking context children. They are being set now by
+  // the stacking context. Additionally, add this container to the stack, so
+  // that it will be considered as a possible destination for the stacking
+  // context children.
+  if (nearest_stacking_context_of_children == kIsBox) {
+    negative_z_index_stacking_context_children_.clear();
+    non_negative_z_index_stacking_context_children_.clear();
+
+    bool has_absolute_position =
+        computed_style()->position() == cssom::KeywordValue::GetAbsolute();
+    bool has_overflow_hidden =
+        computed_style()->overflow().get() == cssom::KeywordValue::GetHidden();
+
+    stacking_context_container_box_stack->push_back(
+        StackingContextContainerBoxInfo(
+            this, IsContainingBlockForPositionAbsoluteElements(),
+            has_absolute_position, has_overflow_hidden));
+  }
 
   // Only process the children if the target container box is still the nearest
   // box of one of the types. If it is not, then it is impossible for any of the
   // children to be added to the cross references.
-  if (is_nearest_absolute_containing_block_of_children ||
-      is_nearest_fixed_containing_block_of_children ||
-      is_nearest_stacking_context_of_children) {
+  if (nearest_absolute_containing_block_of_children == kIsBox ||
+      nearest_fixed_containing_block_of_children == kIsBox ||
+      nearest_stacking_context_of_children == kIsBox) {
     for (Boxes::const_iterator child_box_iterator = child_boxes_.begin();
          child_box_iterator != child_boxes_.end(); ++child_box_iterator) {
       Box* child_box = *child_box_iterator;
       child_box->UpdateCrossReferencesOfContainerBox(
-          source_box, kIsNearestContainingBlockOfChildren,
-          is_nearest_absolute_containing_block_of_children,
-          is_nearest_fixed_containing_block_of_children,
-          is_nearest_stacking_context_of_children);
+          source_box, kNearestContainingBlockOfChildren,
+          nearest_absolute_containing_block_of_children,
+          nearest_fixed_containing_block_of_children,
+          nearest_stacking_context_of_children,
+          stacking_context_container_box_stack);
+    }
+  }
+
+  // Pop this container from the stack if it was previously added.
+  if (nearest_stacking_context_of_children == kIsBox) {
+    stacking_context_container_box_stack->pop_back();
+  }
+}
+
+void ContainerBox::AddBoxAndDescendantsToDrawOrderInStackingContext(
+    ContainerBox* stacking_context) {
+  Box::AddBoxAndDescendantsToDrawOrderInStackingContext(stacking_context);
+  // If this is a stacking context, then there's no more work to do. None of
+  // the stacking context children can be part of the ancestor stacking context.
+  // If this is not a stacking context, then all of the stacking context
+  // children are still part of the same stacking context.
+  if (!IsStackingContext()) {
+    // Non-stacking contexts can only have stacking context children with a
+    // z-index of zero. Any child with non-zero z-index, must be added to the
+    // stacking context itself.
+    DCHECK(negative_z_index_stacking_context_children_.empty());
+    for (ZIndexSortedList::const_iterator iter =
+             non_negative_z_index_stacking_context_children_.begin();
+         iter != non_negative_z_index_stacking_context_children_.end();
+         ++iter) {
+      DCHECK_EQ(iter->z_index, 0);
+      iter->box->AddBoxAndDescendantsToDrawOrderInStackingContext(
+          stacking_context);
     }
   }
 }
 
 void ContainerBox::RenderAndAnimateContent(
-    render_tree::CompositionNode::Builder* border_node_builder) const {
-  // Ensure that the cross references are up to date.
-  const_cast<ContainerBox*>(this)->UpdateCrossReferences();
+    render_tree::CompositionNode::Builder* content_node_builder,
+    ContainerBox* stacking_context) const {
+  // Update the stacking context if this is found to be a stacking context.
+  ContainerBox* this_as_stacking_context = const_cast<ContainerBox*>(this);
+
+  // Reset the draw order for this box. Even if it isn't explictly a stacking
+  // context, it'll be used as one for in-flow, non-positioned child boxes.
+  this_as_stacking_context->next_draw_order_position_ = 0;
+
+  // If this is a stacking context, then ensure that the
+  // stacking context children are up to date. This will also update the
+  // stacking context children for any descendant container boxes that are
+  // part of this stacking context.
+  if (IsStackingContext()) {
+    stacking_context = this_as_stacking_context;
+    stacking_context->UpdateCrossReferences();
+  }
 
   Vector2dLayoutUnit content_box_offset(border_left_width() + padding_left(),
                                         border_top_width() + padding_top());
-  // Render all positioned children in our stacking context that have negative
-  // z-index values.
+
+  // Render all child stacking contexts and positioned children in our stacking
+  // context that have negative z-index values.
   //   https://www.w3.org/TR/CSS21/visuren.html#z-index
   RenderAndAnimateStackingContextChildren(
-      negative_z_index_child_, border_node_builder, content_box_offset);
-  // Render laid out child boxes.
+      negative_z_index_stacking_context_children_, content_node_builder,
+      content_box_offset, stacking_context);
+
+  // Render in-flow, non-positioned child boxes.
+  //   https://www.w3.org/TR/CSS21/visuren.html#z-index
   for (Boxes::const_iterator child_box_iterator = child_boxes_.begin();
        child_box_iterator != child_boxes_.end(); ++child_box_iterator) {
     Box* child_box = *child_box_iterator;
-    if (!child_box->IsPositioned() && !child_box->IsTransformed()) {
-      child_box->RenderAndAnimate(border_node_builder, content_box_offset);
+    if (!child_box->IsPositioned() && !child_box->IsStackingContext()) {
+      child_box->RenderAndAnimate(content_node_builder, content_box_offset,
+                                  this_as_stacking_context);
     }
   }
-  // Render all positioned children with non-negative z-index values.
+
+  // Render all child stacking contexts and positioned children in our stacking
+  // context that have non-negative z-index values.
   //   https://www.w3.org/TR/CSS21/visuren.html#z-index
   RenderAndAnimateStackingContextChildren(
-      non_negative_z_index_child_, border_node_builder, content_box_offset);
+      non_negative_z_index_stacking_context_children_, content_node_builder,
+      content_box_offset, stacking_context);
 }
 
 #ifdef COBALT_BOX_DUMP_ENABLED
diff --git a/src/cobalt/layout/container_box.h b/src/cobalt/layout/container_box.h
index 1f8f60a..810dcc4 100644
--- a/src/cobalt/layout/container_box.h
+++ b/src/cobalt/layout/container_box.h
@@ -29,6 +29,21 @@
 // not defined in CSS 2.1.
 class ContainerBox : public Box, public base::SupportsWeakPtr<ContainerBox> {
  public:
+  struct StackingContextChildInfo {
+    StackingContextChildInfo(
+        Box* box, int z_index, RelationshipToBox containing_block_relationship,
+        const ContainingBlocksWithOverflowHidden& overflow_hidden_to_apply)
+        : box(box),
+          z_index(z_index),
+          containing_block_relationship(containing_block_relationship),
+          overflow_hidden_to_apply(overflow_hidden_to_apply) {}
+
+    Box* box;
+    int z_index;
+    RelationshipToBox containing_block_relationship;
+    ContainingBlocksWithOverflowHidden overflow_hidden_to_apply;
+  };
+
   ContainerBox(const scoped_refptr<cssom::CSSComputedStyleDeclaration>&
                    css_computed_style_declaration,
                UsedStyleProvider* used_style_provider,
@@ -60,8 +75,9 @@
   ContainerBox* AsContainerBox() OVERRIDE;
   const ContainerBox* AsContainerBox() const OVERRIDE;
 
-  void RenderAndAnimateContent(render_tree::CompositionNode::Builder*
-                                   border_node_builder) const OVERRIDE;
+  void RenderAndAnimateContent(
+      render_tree::CompositionNode::Builder* border_node_builder,
+      ContainerBox* stacking_context) const OVERRIDE;
 
 #ifdef COBALT_BOX_DUMP_ENABLED
   void DumpChildrenWithIndent(std::ostream* stream, int indent) const OVERRIDE;
@@ -78,20 +94,27 @@
   // section: https://www.w3.org/TR/css3-transforms/#transform-rendering.
   bool IsContainingBlockForPositionFixedElements() const;
 
-  // Returns true if this container box serves as a stacking context for
-  // descendant elements.
-  bool IsStackingContext() const;
+  // Returns true if the box serves as a stacking context for descendant
+  // elements. The core stacking context creation criteria is given here
+  // (https://www.w3.org/TR/CSS21/visuren.html#z-index) however it is extended
+  // by various other specification documents such as those describing opacity
+  // (https://www.w3.org/TR/css3-color/#transparency) and transforms
+  // (https://www.w3.org/TR/css3-transforms/#transform-rendering).
+  bool IsStackingContext() const OVERRIDE;
 
  protected:
   class ZIndexComparator {
    public:
-    bool operator()(const Box* lhs, const Box* rhs) const {
-      return lhs->GetZIndex() < rhs->GetZIndex();
+    bool operator()(const StackingContextChildInfo& lhs,
+                    const StackingContextChildInfo& rhs) const {
+      return lhs.z_index < rhs.z_index;
     }
   };
-  // Note: find(Box*) and erase(Box*) on ZIndexSortedList may not work as
-  // expected due to the use of reflexive comparison for equality.
-  typedef std::multiset<Box*, ZIndexComparator> ZIndexSortedList;
+  // Note: find(StackingContextChildInfo) and erase(StackingContextChildInfo) on
+  // ZIndexSortedList may not work as expected due to the use of reflexive
+  // comparison for equality.
+  typedef std::multiset<StackingContextChildInfo, ZIndexComparator>
+      ZIndexSortedList;
 
   void UpdateRectOfPositionedChildBoxes(
       const LayoutParams& relative_child_layout_params,
@@ -115,14 +138,23 @@
   const Boxes& child_boxes() const { return child_boxes_; }
 
   void UpdateCrossReferencesOfContainerBox(
-      ContainerBox* source_box, bool is_nearest_containing_block,
-      bool is_nearest_absolute_containing_block,
-      bool is_nearest_fixed_containing_block,
-      bool is_nearest_stacking_context) OVERRIDE;
+      ContainerBox* source_box, RelationshipToBox nearest_containing_block,
+      RelationshipToBox nearest_absolute_containing_block,
+      RelationshipToBox nearest_fixed_containing_block,
+      RelationshipToBox nearest_stacking_context,
+      StackingContextContainerBoxStack* stacking_context_container_box_stack)
+      OVERRIDE;
 
   bool ValidateUpdateSizeInputs(const LayoutParams& params) OVERRIDE;
   void InvalidateUpdateSizeInputs() { update_size_results_valid_ = false; }
 
+  // Add a box and all of its descendants that are contained within the
+  // specified stacking context to the stacking context's draw order. This is
+  // used when a render tree node that is already cached is encountered to
+  // ensure that it maintains the proper draw order in its stacking context.
+  void AddBoxAndDescendantsToDrawOrderInStackingContext(
+      ContainerBox* stacking_context) OVERRIDE;
+
  private:
   static Boxes::iterator RemoveConst(Boxes* container,
                                      Boxes::const_iterator const_iter);
@@ -134,7 +166,11 @@
   // These helper functions are called from
   // Box::UpdateCrossReferencesOfContainerBox().
   void AddContainingBlockChild(Box* child_box);
-  void AddStackingContextChild(Box* child_box);
+  void AddStackingContextChild(
+      Box* child_box, int z_index,
+      RelationshipToBox containing_block_relationship,
+      const ContainingBlocksWithOverflowHidden&
+          containing_blocks_with_overflow_hidden_to_apply);
 
   // Updates used values of left/top/right/bottom given the child_box's
   // 'position' property is set to 'relative'.
@@ -163,7 +199,13 @@
   void RenderAndAnimateStackingContextChildren(
       const ZIndexSortedList& z_index_child_list,
       render_tree::CompositionNode::Builder* border_node_builder,
-      const Vector2dLayoutUnit& offset_from_parent_node) const;
+      const Vector2dLayoutUnit& offset_from_parent_node,
+      ContainerBox* stacking_context) const;
+
+  // Called by a box within this stacking context when it is being added to the
+  // render tree so that it can get its position in the stacking context's
+  // draw order.
+  size_t AddToDrawOrderInThisStackingContext();
 
   // A list of our direct children.  If a box is one of our child boxes, we
   // are that box's parent.  We may not be the box's containing block (such
@@ -175,11 +217,11 @@
   // used for properly positioning and sizing positioned child elements.
   std::vector<Box*> positioned_child_boxes_;
 
-  // A list of all children within our stacking context, sorted by z-index.
-  // Every positioned box should appear in exactly one z_index list somewhere
-  // in the box tree.  These lists are only used to determine render order.
-  ZIndexSortedList negative_z_index_child_;
-  ZIndexSortedList non_negative_z_index_child_;
+  // A list of descendant positioned boxes and stacking context children within
+  // our stacking context that should be drawn after this box, sorted by
+  // z-index.
+  ZIndexSortedList negative_z_index_stacking_context_children_;
+  ZIndexSortedList non_negative_z_index_stacking_context_children_;
 
   bool update_size_results_valid_;
 
@@ -192,6 +234,9 @@
   // tracked so it will never be attempted more than once.
   bool are_bidi_levels_runs_split_;
 
+  // The next draw order position within this box's stacking context.
+  size_t next_draw_order_position_;
+
   // Boxes and ContainerBoxes are closely related.  For example, when
   // Box::SetupAsPositionedChild() is called, it will internally call
   // ContainerBox::AddContainingBlockChild() and
diff --git a/src/cobalt/layout/layout.cc b/src/cobalt/layout/layout.cc
index 2331e2e..98c2d6d 100644
--- a/src/cobalt/layout/layout.cc
+++ b/src/cobalt/layout/layout.cc
@@ -149,7 +149,8 @@
         base::StopWatch::kAutoStartOn, layout_stat_tracker);
 
     (*initial_containing_block)
-        ->RenderAndAnimate(&render_tree_root_builder, math::Vector2dF(0, 0));
+        ->RenderAndAnimate(&render_tree_root_builder, math::Vector2dF(0, 0),
+                           (*initial_containing_block));
   }
 
   // During computed style update and RenderAndAnimate, we get the actual images
diff --git a/src/cobalt/layout/layout.gyp b/src/cobalt/layout/layout.gyp
index fa7c03c..f13959e 100644
--- a/src/cobalt/layout/layout.gyp
+++ b/src/cobalt/layout/layout.gyp
@@ -74,6 +74,7 @@
         'replaced_box.h',
         'rect_layout_unit.cc',
         'rect_layout_unit.h',
+        'render_tree_animations.h',
         'size_layout_unit.cc',
         'size_layout_unit.h',
         'text_box.cc',
diff --git a/src/cobalt/layout/layout_boxes.cc b/src/cobalt/layout/layout_boxes.cc
index e0fc773..dc1b5ba 100644
--- a/src/cobalt/layout/layout_boxes.cc
+++ b/src/cobalt/layout/layout_boxes.cc
@@ -14,6 +14,7 @@
 
 #include "cobalt/layout/layout_boxes.h"
 
+#include "cobalt/cssom/keyword_value.h"
 #include "cobalt/layout/container_box.h"
 #include "cobalt/layout/rect_layout_unit.h"
 #include "cobalt/layout/size_layout_unit.h"
@@ -74,9 +75,10 @@
   return dom_rect_list;
 }
 
-bool LayoutBoxes::IsInlineLevel() const {
+bool LayoutBoxes::IsInline() const {
   DCHECK(!boxes_.empty());
-  return boxes_.front()->GetLevel() == Box::kInlineLevel;
+  return boxes_.front()->computed_style()->display() ==
+         cssom::KeywordValue::GetInline();
 }
 
 float LayoutBoxes::GetBorderEdgeLeft() const {
diff --git a/src/cobalt/layout/layout_boxes.h b/src/cobalt/layout/layout_boxes.h
index e28f421..1d49883 100644
--- a/src/cobalt/layout/layout_boxes.h
+++ b/src/cobalt/layout/layout_boxes.h
@@ -36,7 +36,7 @@
   Type type() const OVERRIDE;
 
   scoped_refptr<dom::DOMRectList> GetClientRects() const OVERRIDE;
-  bool IsInlineLevel() const OVERRIDE;
+  bool IsInline() const OVERRIDE;
 
   float GetBorderEdgeLeft() const OVERRIDE;
   float GetBorderEdgeTop() const OVERRIDE;
diff --git a/src/cobalt/layout/layout_manager.cc b/src/cobalt/layout/layout_manager.cc
index ba99c1f..dfb4b44 100644
--- a/src/cobalt/layout/layout_manager.cc
+++ b/src/cobalt/layout/layout_manager.cc
@@ -44,7 +44,8 @@
        const OnRenderTreeProducedCallback& on_render_tree_produced,
        const OnLayoutCallback& on_layout, LayoutTrigger layout_trigger,
        int dom_max_element_depth, float layout_refresh_rate,
-       const std::string& language, LayoutStatTracker* layout_stat_tracker);
+       const std::string& language, bool enable_image_animations,
+       LayoutStatTracker* layout_stat_tracker);
   ~Impl();
 
   // From dom::DocumentObserver.
@@ -153,12 +154,13 @@
     const OnRenderTreeProducedCallback& on_render_tree_produced,
     const OnLayoutCallback& on_layout, LayoutTrigger layout_trigger,
     int dom_max_element_depth, float layout_refresh_rate,
-    const std::string& language, LayoutStatTracker* layout_stat_tracker)
+    const std::string& language, bool enable_image_animations,
+    LayoutStatTracker* layout_stat_tracker)
     : window_(window),
       locale_(icu::Locale::createCanonical(language.c_str())),
       used_style_provider_(new UsedStyleProvider(
           window->html_element_context(), window->document()->font_cache(),
-          base::Bind(&AttachCameraNodes, window))),
+          base::Bind(&AttachCameraNodes, window), enable_image_animations)),
       on_render_tree_produced_callback_(on_render_tree_produced),
       on_layout_callback_(on_layout),
       layout_trigger_(layout_trigger),
@@ -372,10 +374,11 @@
     const OnRenderTreeProducedCallback& on_render_tree_produced,
     const OnLayoutCallback& on_layout, LayoutTrigger layout_trigger,
     const int dom_max_element_depth, const float layout_refresh_rate,
-    const std::string& language, LayoutStatTracker* layout_stat_tracker)
+    const std::string& language, bool enable_image_animations,
+    LayoutStatTracker* layout_stat_tracker)
     : impl_(new Impl(name, window, on_render_tree_produced, on_layout,
                      layout_trigger, dom_max_element_depth, layout_refresh_rate,
-                     language, layout_stat_tracker)) {}
+                     language, enable_image_animations, layout_stat_tracker)) {}
 
 LayoutManager::~LayoutManager() {}
 
diff --git a/src/cobalt/layout/layout_manager.h b/src/cobalt/layout/layout_manager.h
index f2da289..6830336 100644
--- a/src/cobalt/layout/layout_manager.h
+++ b/src/cobalt/layout/layout_manager.h
@@ -67,6 +67,7 @@
                 const OnLayoutCallback& on_layout, LayoutTrigger layout_trigger,
                 const int dom_max_element_depth,
                 const float layout_refresh_rate, const std::string& language,
+                bool enable_image_animations,
                 LayoutStatTracker* layout_stat_tracker);
   ~LayoutManager();
 
diff --git a/src/cobalt/layout/replaced_box.cc b/src/cobalt/layout/replaced_box.cc
index c687b10..e8776e2 100644
--- a/src/cobalt/layout/replaced_box.cc
+++ b/src/cobalt/layout/replaced_box.cc
@@ -275,7 +275,8 @@
 }  // namespace
 
 void ReplacedBox::RenderAndAnimateContent(
-    CompositionNode::Builder* border_node_builder) const {
+    CompositionNode::Builder* border_node_builder,
+    ContainerBox* /*stacking_context*/) const {
   if (computed_style()->visibility() != cssom::KeywordValue::GetVisible()) {
     return;
   }
@@ -584,9 +585,9 @@
   if (spec.mesh_type() == cssom::MapToMeshFunction::kUrls) {
     // Custom mesh URLs.
     // Set a default mesh (in case no resolution-specific mesh matches).
-    cssom::URLValue* url_value =
+    cssom::URLValue* spec_url_value =
         base::polymorphic_downcast<cssom::URLValue*>(spec.mesh_url().get());
-    GURL default_url(url_value->value());
+    GURL default_url(spec_url_value->value());
 
     if (!default_url.is_valid()) {
       DLOG(WARNING) << kWarningInvalidMeshUrl;
diff --git a/src/cobalt/layout/replaced_box.h b/src/cobalt/layout/replaced_box.h
index aa0f6ed..81a9b16 100644
--- a/src/cobalt/layout/replaced_box.h
+++ b/src/cobalt/layout/replaced_box.h
@@ -80,8 +80,9 @@
   // From |Box|.
   void UpdateContentSizeAndMargins(const LayoutParams& layout_params) OVERRIDE;
 
-  void RenderAndAnimateContent(render_tree::CompositionNode::Builder*
-                                   border_node_builder) const OVERRIDE;
+  void RenderAndAnimateContent(
+      render_tree::CompositionNode::Builder* border_node_builder,
+      ContainerBox* stacking_context) const OVERRIDE;
 
   bool IsTransformable() const OVERRIDE { return true; }
 
diff --git a/src/cobalt/layout/text_box.cc b/src/cobalt/layout/text_box.cc
index 0dd7e44..79d8ba6 100644
--- a/src/cobalt/layout/text_box.cc
+++ b/src/cobalt/layout/text_box.cc
@@ -363,7 +363,8 @@
 }  // namespace
 
 void TextBox::RenderAndAnimateContent(
-    render_tree::CompositionNode::Builder* border_node_builder) const {
+    render_tree::CompositionNode::Builder* border_node_builder,
+    ContainerBox* /*stacking_context*/) const {
   if (computed_style()->visibility() != cssom::KeywordValue::GetVisible()) {
     return;
   }
diff --git a/src/cobalt/layout/text_box.h b/src/cobalt/layout/text_box.h
index c599bfc..7fb798e 100644
--- a/src/cobalt/layout/text_box.h
+++ b/src/cobalt/layout/text_box.h
@@ -81,8 +81,9 @@
 
  protected:
   // From |Box|.
-  void RenderAndAnimateContent(render_tree::CompositionNode::Builder*
-                                   border_node_builder) const OVERRIDE;
+  void RenderAndAnimateContent(
+      render_tree::CompositionNode::Builder* border_node_builder,
+      ContainerBox* stacking_context) const OVERRIDE;
   bool IsTransformable() const OVERRIDE;
 
 #ifdef COBALT_BOX_DUMP_ENABLED
diff --git a/src/cobalt/layout/topmost_event_target.cc b/src/cobalt/layout/topmost_event_target.cc
index 547d103..a74dfaf 100644
--- a/src/cobalt/layout/topmost_event_target.cc
+++ b/src/cobalt/layout/topmost_event_target.cc
@@ -41,9 +41,9 @@
     const scoped_refptr<dom::Document>& document,
     const math::Vector2dF& coordinate) {
   const scoped_refptr<dom::HTMLElement>& html_element = document->html();
-  box_ = NULL;
+  DCHECK(!box_);
+  DCHECK(render_sequence_.empty());
   html_element_ = html_element;
-  render_sequence_.clear();
   if (html_element) {
     dom::LayoutBoxes* boxes = html_element->layout_boxes();
     if (boxes && boxes->type() == dom::LayoutBoxes::kLayoutLayoutBoxes) {
@@ -54,6 +54,8 @@
       }
     }
   }
+  box_ = NULL;
+  render_sequence_.clear();
 }
 
 void TopmostEventTarget::ConsiderElement(
@@ -61,24 +63,28 @@
     const math::Vector2dF& coordinate) {
   if (!html_element) return;
   math::Vector2dF element_coordinate(coordinate);
-  dom::LayoutBoxes* boxes = html_element->layout_boxes();
-  if (boxes && boxes->type() == dom::LayoutBoxes::kLayoutLayoutBoxes) {
-    SB_DCHECK(html_element->computed_style());
-    LayoutBoxes* layout_boxes = base::polymorphic_downcast<LayoutBoxes*>(boxes);
-    const Boxes& boxes = layout_boxes->boxes();
-    if (!boxes.empty()) {
-      const Box* box = boxes.front();
-      box->UpdateCoordinateForTransform(&element_coordinate);
+  if (html_element->CanbeDesignatedByPointerIfDisplayed()) {
+    dom::LayoutBoxes* dom_layout_boxes = html_element->layout_boxes();
+    if (dom_layout_boxes &&
+        dom_layout_boxes->type() == dom::LayoutBoxes::kLayoutLayoutBoxes) {
+      DCHECK(html_element->computed_style());
+      LayoutBoxes* layout_boxes =
+          base::polymorphic_downcast<LayoutBoxes*>(dom_layout_boxes);
+      const Boxes& boxes = layout_boxes->boxes();
+      if (!boxes.empty()) {
+        const Box* box = boxes.front();
+        box->UpdateCoordinateForTransform(&element_coordinate);
 
-      if (box->computed_style()->position() ==
-          cssom::KeywordValue::GetAbsolute()) {
-        // The containing block for position:absolute elements is formed by the
-        // padding box instead of the content box, as described in
-        // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details.
-        element_coordinate +=
-            box->GetContainingBlock()->GetContentBoxOffsetFromPaddingBox();
+        if (box->computed_style()->position() ==
+            cssom::KeywordValue::GetAbsolute()) {
+          // The containing block for position:absolute elements is formed by
+          // the padding box instead of the content box, as described in
+          // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details.
+          element_coordinate +=
+              box->GetContainingBlock()->GetContentBoxOffsetFromPaddingBox();
+        }
+        ConsiderBoxes(html_element, layout_boxes, element_coordinate);
       }
-      ConsiderBoxes(html_element, layout_boxes, element_coordinate);
     }
   }
 
@@ -112,16 +118,16 @@
 }
 
 void TopmostEventTarget::MaybeSendPointerEvents(
-    const scoped_refptr<dom::Event>& event,
-    const scoped_refptr<dom::Window>& window) {
+    const scoped_refptr<dom::Event>& event) {
   const dom::MouseEvent* const mouse_event =
       base::polymorphic_downcast<const dom::MouseEvent* const>(event.get());
-  SB_DCHECK(mouse_event);
-  const scoped_refptr<dom::Document>& document =
-      mouse_event->view()->document();
+  DCHECK(mouse_event);
+  DCHECK(!html_element_);
+  scoped_refptr<dom::Window> view = mouse_event->view();
 
-  math::Vector2dF coordinate(mouse_event->client_x(), mouse_event->client_y());
-  FindTopmostEventTarget(document, coordinate);
+  math::Vector2dF coordinate(static_cast<float>(mouse_event->client_x()),
+                             static_cast<float>(mouse_event->client_y()));
+  FindTopmostEventTarget(view->document(), coordinate);
 
   if (html_element_) {
     html_element_->DispatchEvent(event);
@@ -148,37 +154,34 @@
       if (has_compatibility_mouse_event) {
         dom::MouseEventInit mouse_event_init;
         mouse_event_init.set_screen_x(pointer_event->screen_x());
-        mouse_event_init.set_screen_y(pointer_event->screen_x());
+        mouse_event_init.set_screen_y(pointer_event->screen_y());
         mouse_event_init.set_client_x(pointer_event->screen_x());
-        mouse_event_init.set_client_y(pointer_event->screen_x());
+        mouse_event_init.set_client_y(pointer_event->screen_y());
         mouse_event_init.set_button(pointer_event->button());
         mouse_event_init.set_buttons(pointer_event->buttons());
         html_element_->DispatchEvent(
-            new dom::MouseEvent(type, window, mouse_event_init));
+            new dom::MouseEvent(type, view, mouse_event_init));
         if (pointer_event->type() == base::Tokens::pointerup()) {
           type = base::Tokens::click();
           html_element_->DispatchEvent(
-              new dom::MouseEvent(type, window, mouse_event_init));
+              new dom::MouseEvent(type, view, mouse_event_init));
         }
       }
     }
 
+    scoped_refptr<dom::HTMLElement> previous_html_element(
+        previous_html_element_weak_);
+
     // Send enter/leave/over/out (status change) events when needed.
-    if (previous_html_element_ != html_element_) {
+    if (previous_html_element != html_element_) {
       // Store the data for the status change event(s).
       dom::PointerEventInit event_init;
-      event_init.set_related_target(previous_html_element_);
-      const dom::MouseEvent* const pointer_event =
-          base::polymorphic_downcast<const dom::PointerEvent* const>(
-              event.get());
-      event_init.set_screen_x(pointer_event->screen_x());
-      event_init.set_screen_y(pointer_event->screen_x());
-      event_init.set_client_x(pointer_event->screen_x());
-      event_init.set_client_y(pointer_event->screen_x());
+      event_init.set_related_target(previous_html_element);
+      event_init.set_screen_x(mouse_event->screen_x());
+      event_init.set_screen_y(mouse_event->screen_y());
+      event_init.set_client_x(mouse_event->screen_x());
+      event_init.set_client_y(mouse_event->screen_y());
       if (event->GetWrappableType() == base::GetTypeId<dom::PointerEvent>()) {
-        const dom::PointerEvent* const pointer_event =
-            base::polymorphic_downcast<const dom::PointerEvent* const>(
-                event.get());
         event_init.set_pointer_id(pointer_event->pointer_id());
         event_init.set_width(pointer_event->width());
         event_init.set_height(pointer_event->height());
@@ -193,15 +196,15 @@
       // nearest common ancestor between the previous and current element.
       scoped_refptr<dom::Element> nearest_common_ancestor;
 
-      if (previous_html_element_) {
-        previous_html_element_->DispatchEvent(new dom::PointerEvent(
-            base::Tokens::pointerout(), window, event_init));
-        previous_html_element_->DispatchEvent(
-            new dom::MouseEvent(base::Tokens::mouseout(), window, event_init));
+      if (previous_html_element) {
+        previous_html_element->DispatchEvent(new dom::PointerEvent(
+            base::Tokens::pointerout(), view, event_init));
+        previous_html_element->DispatchEvent(
+            new dom::MouseEvent(base::Tokens::mouseout(), view, event_init));
 
         // Find the nearest common ancestor, if there is any.
         dom::Document* previous_document =
-            previous_html_element_->node_document();
+            previous_html_element->node_document();
         if (previous_document) {
           if (html_element_ &&
               previous_document == html_element_->node_document()) {
@@ -217,15 +220,15 @@
             }
           }
 
-          for (scoped_refptr<dom::Element> element = previous_html_element_;
+          for (scoped_refptr<dom::Element> element = previous_html_element;
                element != nearest_common_ancestor;
                element = element->parent_element()) {
             element->DispatchEvent(new dom::PointerEvent(
                 base::Tokens::pointerleave(), dom::Event::kNotBubbles,
-                dom::Event::kNotCancelable, window, event_init));
+                dom::Event::kNotCancelable, view, event_init));
             element->DispatchEvent(new dom::MouseEvent(
                 base::Tokens::mouseleave(), dom::Event::kNotBubbles,
-                dom::Event::kNotCancelable, window, event_init));
+                dom::Event::kNotCancelable, view, event_init));
           }
 
           if (!html_element_ ||
@@ -236,19 +239,19 @@
       }
       if (html_element_) {
         html_element_->DispatchEvent(new dom::PointerEvent(
-            base::Tokens::pointerover(), window, event_init));
+            base::Tokens::pointerover(), view, event_init));
         html_element_->DispatchEvent(
-            new dom::MouseEvent(base::Tokens::mouseover(), window, event_init));
+            new dom::MouseEvent(base::Tokens::mouseover(), view, event_init));
 
         for (scoped_refptr<dom::Element> element = html_element_;
              element != nearest_common_ancestor;
              element = element->parent_element()) {
           element->DispatchEvent(new dom::PointerEvent(
               base::Tokens::pointerenter(), dom::Event::kNotBubbles,
-              dom::Event::kNotCancelable, window, event_init));
+              dom::Event::kNotCancelable, view, event_init));
           element->DispatchEvent(new dom::MouseEvent(
               base::Tokens::mouseenter(), dom::Event::kNotBubbles,
-              dom::Event::kNotCancelable, window, event_init));
+              dom::Event::kNotCancelable, view, event_init));
         }
 
         dom::Document* document = html_element_->node_document();
@@ -256,9 +259,10 @@
           document->SetIndicatedElement(html_element_);
         }
       }
-      previous_html_element_ = html_element_;
+      previous_html_element_weak_ = base::AsWeakPtr(html_element_.get());
     }
   }
+  html_element_ = NULL;
 }
 
 }  // namespace layout
diff --git a/src/cobalt/layout/topmost_event_target.h b/src/cobalt/layout/topmost_event_target.h
index 71e8166..be73764 100644
--- a/src/cobalt/layout/topmost_event_target.h
+++ b/src/cobalt/layout/topmost_event_target.h
@@ -15,6 +15,7 @@
 #ifndef COBALT_LAYOUT_TOPMOST_EVENT_TARGET_H_
 #define COBALT_LAYOUT_TOPMOST_EVENT_TARGET_H_
 
+#include "base/memory/weak_ptr.h"
 #include "cobalt/dom/document.h"
 #include "cobalt/dom/html_element.h"
 #include "cobalt/dom/window.h"
@@ -28,12 +29,11 @@
 
 class TopmostEventTarget {
  public:
-  explicit TopmostEventTarget() {}
+  TopmostEventTarget() {}
 
-  void MaybeSendPointerEvents(const scoped_refptr<dom::Event>& event,
-                              const scoped_refptr<dom::Window>& window);
+  void MaybeSendPointerEvents(const scoped_refptr<dom::Event>& event);
 
-  scoped_refptr<dom::HTMLElement> previous_html_element_;
+  base::WeakPtr<dom::HTMLElement> previous_html_element_weak_;
   scoped_refptr<dom::HTMLElement> html_element_;
   scoped_refptr<Box> box_;
   Box::RenderSequence render_sequence_;
diff --git a/src/cobalt/layout/used_style.cc b/src/cobalt/layout/used_style.cc
index 5c9dab7..2191cc9 100644
--- a/src/cobalt/layout/used_style.cc
+++ b/src/cobalt/layout/used_style.cc
@@ -408,12 +408,14 @@
 
 UsedStyleProvider::UsedStyleProvider(
     dom::HTMLElementContext* html_element_context, dom::FontCache* font_cache,
-    const AttachCameraNodeFunction& attach_camera_node_function)
+    const AttachCameraNodeFunction& attach_camera_node_function,
+    bool enable_image_animations)
     : font_cache_(font_cache),
       animated_image_tracker_(html_element_context->animated_image_tracker()),
       image_cache_(html_element_context->image_cache()),
       mesh_cache_(html_element_context->mesh_cache()),
-      attach_camera_node_function_(attach_camera_node_function) {}
+      attach_camera_node_function_(attach_camera_node_function),
+      enable_image_animations_(enable_image_animations) {}
 
 scoped_refptr<dom::FontList> UsedStyleProvider::GetUsedFontList(
     const scoped_refptr<cssom::PropertyValue>& font_family_refptr,
@@ -657,19 +659,23 @@
     scoped_refptr<loader::image::AnimatedImage> animated_image =
         base::polymorphic_downcast<loader::image::AnimatedImage*>(
             used_background_image.get());
-    DCHECK(animated_image);
     scoped_refptr<render_tree::ImageNode> image_node =
         new render_tree::ImageNode(
-            NULL, image_rect, image_transform_data.image_node_transform_matrix);
-    render_tree::animations::AnimateNode::Builder animate_node_builder;
-    animate_node_builder.Add(
-        image_node,
-        base::Bind(&loader::image::AnimatedImage::AnimateCallback,
-                   animated_image, image_rect,
-                   image_transform_data.image_node_transform_matrix));
+            animated_image->GetFrameProvider()->GetFrame(), image_rect,
+            image_transform_data.image_node_transform_matrix);
+    if (!used_style_provider_->enable_image_animations()) {
+      background_node_ = image_node;
+    } else {
+      render_tree::animations::AnimateNode::Builder animate_node_builder;
+      animate_node_builder.Add(
+          image_node,
+          base::Bind(&loader::image::AnimatedImage::AnimateCallback,
+                     animated_image->GetFrameProvider(), image_rect,
+                     image_transform_data.image_node_transform_matrix));
 
-    background_node_ = new render_tree::animations::AnimateNode(
-        animate_node_builder, image_node);
+      background_node_ = new render_tree::animations::AnimateNode(
+          animate_node_builder, image_node);
+    }
   }
 }
 
diff --git a/src/cobalt/layout/used_style.h b/src/cobalt/layout/used_style.h
index 3e670df..f2ec746 100644
--- a/src/cobalt/layout/used_style.h
+++ b/src/cobalt/layout/used_style.h
@@ -68,9 +68,10 @@
       const scoped_refptr<render_tree::Node>&, float max_horizontal_fov_rad,
       float max_vertical_fov_rad)> AttachCameraNodeFunction;
 
-  UsedStyleProvider(
-      dom::HTMLElementContext* html_element_context, dom::FontCache* font_cache,
-      const AttachCameraNodeFunction& attach_camera_node_function);
+  UsedStyleProvider(dom::HTMLElementContext* html_element_context,
+                    dom::FontCache* font_cache,
+                    const AttachCameraNodeFunction& attach_camera_node_function,
+                    bool enable_image_animations);
 
   scoped_refptr<dom::FontList> GetUsedFontList(
       const scoped_refptr<cssom::PropertyValue>& font_family_refptr,
@@ -90,6 +91,8 @@
   // images.
   void UpdateAnimatedImages();
 
+  bool enable_image_animations() const { return enable_image_animations_; }
+
  private:
   // Called after layout is completed so that it can perform any necessary
   // cleanup. Its primary current purpose is making a request to the font cache
@@ -117,6 +120,9 @@
   scoped_refptr<cssom::PropertyValue> last_font_weight_refptr_;
   scoped_refptr<dom::FontList> last_font_list_;
 
+  // If true, animated WebP images should animate, otherwise they should not.
+  const bool enable_image_animations_;
+
   friend class UsedStyleProviderLayoutScope;
   DISALLOW_COPY_AND_ASSIGN(UsedStyleProvider);
 };
diff --git a/src/cobalt/layout_tests/layout_snapshot.cc b/src/cobalt/layout_tests/layout_snapshot.cc
index f57e2e5..de1f5ec 100644
--- a/src/cobalt/layout_tests/layout_snapshot.cc
+++ b/src/cobalt/layout_tests/layout_snapshot.cc
@@ -88,8 +88,8 @@
       base::Bind(&WebModuleErrorCallback, &run_loop, MessageLoop::current()),
       base::Closure() /* window_close_callback */,
       base::Closure() /* window_minimize_callback */, stub_media_module.get(),
-      &network_module, viewport_size, resource_provider,
-      stub_media_module->system_window(), 60.0f, web_module_options);
+      &network_module, viewport_size, 1.f, resource_provider, 60.0f,
+      web_module_options);
 
   run_loop.Run();
 
diff --git a/src/cobalt/layout_tests/layout_tests.cc b/src/cobalt/layout_tests/layout_tests.cc
index ec0ce07..77b0def 100644
--- a/src/cobalt/layout_tests/layout_tests.cc
+++ b/src/cobalt/layout_tests/layout_tests.cc
@@ -137,6 +137,12 @@
 INSTANTIATE_TEST_CASE_P(
     CSSTransitionLayoutTests, LayoutTest,
     ::testing::ValuesIn(EnumerateLayoutTests("css3-transitions")));
+// Custom CSS Animation
+// (https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations)
+// test cases.
+INSTANTIATE_TEST_CASE_P(
+    CSSAnimationLayoutTests, LayoutTest,
+    ::testing::ValuesIn(EnumerateLayoutTests("css3-animations")));
 // Custom bidi text (http://www.unicode.org/reports/tr9/)
 // (https://www.w3.org/TR/CSS21/visuren.html#direction) test cases.
 INSTANTIATE_TEST_CASE_P(
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements-expected.png
new file mode 100644
index 0000000..6e56609
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements.html b/src/cobalt/layout_tests/testdata/css-2-1/10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements.html
new file mode 100644
index 0000000..a52c5c7
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!--
+ | If the element has "position: absolute", the containing block is established
+ | by the padding edge of the nearest ancestor with a "position" of "absolute".
+ |   http://www.w3.org/TR/CSS21/visudet.html#containing-block-details
+ -->
+<html>
+<head>
+  <style>
+    .containing-block-with-padding {
+      position: absolute;
+
+      width: 150px;
+      height: 150px;
+
+      padding-top: 50px;
+      padding-left: 50px;
+
+      background-color: rgb(100, 100, 255);
+    }
+    .stacking-context {
+      position: static;
+
+      opacity: .9;
+    }
+    .absolute-element {
+      position: absolute;
+
+      width: 100px;
+      height: 100px;
+
+      background-color: rgb(255, 100, 100);
+    }
+  </style>
+</head>
+<body>
+  <div class="containing-block-with-padding">
+    <div class="stacking-context">
+      <div class="absolute-element"></div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children-expected.png
new file mode 100644
index 0000000..285da4a
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children.html b/src/cobalt/layout_tests/testdata/css-2-1/10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children.html
new file mode 100644
index 0000000..ed0de9f
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<!--
+ | This test ensures that an element with a non-positioned stacking context
+ | above its positioned containing block will have its offset from the
+ | containing block calculated correctly. The results should display the blue
+ | block directly under the green block.
+ |   https://www.w3.org/TR/CSS21/visudet.html#containing-block-details
+ -->
+<head>
+  <style>
+    body {
+      font-family: Roboto;
+      font-size: 16px;
+    }
+    .non-positioned-stacking-context {
+      position: static;
+
+      opacity: .9;
+
+      width: 300px;
+      height: 50px;
+      margin-left: 40px;
+    }
+    .absolute-container {
+      position: absolute;
+
+      width: 300px;
+      height: 50px;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .positioned-element {
+      position: absolute;
+
+      z-index: 1;
+
+      width: 300px;
+      height: 20px;
+      top: 60px;
+
+      background-color: rgb(66, 133, 244);
+    }
+  </style>
+</head>
+<body>
+  <div class="non-positioned-stacking-context">
+    <div class="absolute-container">
+      <div class="positioned-element"></div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children-expected.png
new file mode 100644
index 0000000..285da4a
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children.html b/src/cobalt/layout_tests/testdata/css-2-1/10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children.html
new file mode 100644
index 0000000..7ad5eb8
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<!--
+ | This test ensures that an element with a non-positioned stacking context
+ | above its fixed position containing block will have its offset from the
+ | containing block calculated correctly. The results should display the blue
+ | block directly under the green block.
+ |   https://www.w3.org/TR/CSS21/visudet.html#containing-block-details
+ -->
+<head>
+  <style>
+    body {
+      font-family: Roboto;
+      font-size: 16px;
+    }
+    .positioned-stacking-context {
+      position: absolute;
+
+      opacity: .9;
+
+      width: 300px;
+      height: 50px;
+      margin-left: 40px;
+    }
+    .fixed-container {
+      position: fixed;
+
+      width: 300px;
+      height: 50px;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .positioned-element {
+      position: absolute;
+
+      z-index: 1;
+
+      width: 300px;
+      height: 20px;
+      top: 60px;
+
+      background-color: rgb(66, 133, 244);
+    }
+  </style>
+</head>
+<body>
+  <div class="positioned-stacking-context">
+    <div class="fixed-container">
+      <div class="positioned-element"></div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child-expected.png
new file mode 100644
index 0000000..472eacb
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/DISABLED-11-1-1-overflow-should-affect-descendants-with-z-index.html b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child.html
similarity index 72%
rename from src/cobalt/layout_tests/testdata/css-2-1/DISABLED-11-1-1-overflow-should-affect-descendants-with-z-index.html
rename to src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child.html
index 983cf77..8d14ae0 100644
--- a/src/cobalt/layout_tests/testdata/css-2-1/DISABLED-11-1-1-overflow-should-affect-descendants-with-z-index.html
+++ b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child.html
@@ -9,23 +9,19 @@
 <head>
   <style>
     .outer {
-      background-color: rgba(63, 81, 181, 0.9);
-      height: 100px;
-      margin-bottom: 100px;
+      background-color: rgb(63, 81, 181);
       overflow: hidden;
       width: 100px;
-    }
-    .absolutely-positioned {
-      position: absolute;
+      height: 100px;
+      margin-bottom: 100px;
     }
     .inner {
+      position: relative;
       background-color: #2196f3;
+      width: 100px;
       height: 100px;
       left: 50px;
-      position: absolute;
       top: 50px;
-      width: 100px;
-      z-index: -1;
     }
   </style>
 </head>
@@ -33,8 +29,5 @@
   <div class="outer">
     <div class="inner"></div>
   </div>
-  <div class="absolutely-positioned outer">
-    <div class="inner"></div>
-  </div>
 </body>
 </html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-affect-descendants-with-z-index-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-affect-descendants-with-z-index-expected.png
new file mode 100644
index 0000000..8db4457
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-affect-descendants-with-z-index-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-affect-descendants-with-z-index.html b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-affect-descendants-with-z-index.html
new file mode 100644
index 0000000..a0d2f63
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-affect-descendants-with-z-index.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<!--
+ | "overflow" property affects the clipping of all of the element's content
+ | except any descendant elements whose containing block is the viewport or
+ | an ancestor of the element.
+ |   https://www.w3.org/TR/CSS21/visufx.html#overflow
+ -->
+<html>
+<head>
+  <style>
+    .outer-common {
+      background-color: rgba(63, 81, 181, 0.5);
+      width: 100px;
+      height: 100px;
+    }
+    .outer-1 {
+      overflow: hidden;
+      margin-bottom: 30px;
+    }
+    .outer-2 {
+      position: absolute;
+      overflow: hidden;
+    }
+    .outer-3 {
+      position: absolute;
+      left: 140px;
+      top: 0px;
+    }
+    .outer-4 {
+      position: absolute;
+      overflow: hidden;
+      left: 140px;
+    }
+    .inner-common {
+      position: absolute;
+      z-index: -1;
+      width: 50px;
+      height: 50px;
+    }
+    .inner-1 {
+      background-color: #7BAAF7;
+      left: 25px;
+      top: 25px;
+    }
+    .inner-2-container {
+      position: absolute;
+      overflow: hidden;
+      width: 25px;
+      height: 50px;
+      left: 25px;
+      top: 75px;
+    }
+    .inner-2 {
+      background-color: #3367D6;
+    }
+    .inner-3 {
+      background-color: #57BB8A;
+      left: 75px;
+      top: 25px;
+    }
+    .inner-4 {
+      background-color: #0B8043;
+      left: 75px;
+      top: 75px;
+    }
+  </style>
+</head>
+<body>
+  <div class="outer-common outer-1">
+    <div class="inner-common inner-1"></div>
+    <div class="inner-2-container">
+      <div class="inner-common inner-2"></div>
+    </div>
+    <div class="inner-common inner-3"></div>
+    <div class="inner-common inner-4"></div>
+  </div>
+  <div class="outer-common outer-2">
+    <div class="inner-common inner-1"></div>
+    <div class="inner-2-container">
+      <div class="inner-common inner-2"></div>
+    </div>
+    <div class="inner-common inner-3"></div>
+    <div class="inner-common inner-4"></div>
+  </div>
+  <div class="outer-common outer-3">
+    <div class="inner-common inner-1"></div>
+    <div class="inner-2-container">
+      <div class="inner-common inner-2"></div>
+    </div>
+    <div class="inner-common inner-3"></div>
+    <div class="inner-common inner-4"></div>
+  </div>
+  <div class="outer-common outer-4">
+    <div class="inner-common inner-1"></div>
+    <div class="inner-2-container">
+      <div class="inner-common inner-2"></div>
+    </div>
+    <div class="inner-common inner-3"></div>
+    <div class="inner-common inner-4"></div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-not-affect-descendants-contained-in-another-block-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-not-affect-descendants-contained-in-another-block-expected.png
new file mode 100644
index 0000000..bf582dd
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-not-affect-descendants-contained-in-another-block-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/DISABLED-11-1-1-overflow-should-not-affect-descendants-contained-in-another-block.html b/src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-not-affect-descendants-contained-in-another-block.html
similarity index 100%
rename from src/cobalt/layout_tests/testdata/css-2-1/DISABLED-11-1-1-overflow-should-not-affect-descendants-contained-in-another-block.html
rename to src/cobalt/layout_tests/testdata/css-2-1/11-1-1-overflow-should-not-affect-descendants-contained-in-another-block.html
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/12-1-before-pseudoelement-does-not-inherit-inline-style-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/12-1-before-pseudoelement-does-not-inherit-inline-style-expected.png
new file mode 100644
index 0000000..43daa6b
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/12-1-before-pseudoelement-does-not-inherit-inline-style-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/12-1-before-pseudoelement-does-not-inherit-inline-style.html b/src/cobalt/layout_tests/testdata/css-2-1/12-1-before-pseudoelement-does-not-inherit-inline-style.html
new file mode 100644
index 0000000..d9dae32
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/12-1-before-pseudoelement-does-not-inherit-inline-style.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<!--
+ | Tests that :before pseudo elements do not inherit inline style from their
+ | parents.
+-->
+<head>
+  <style>
+    body {
+      background-color: white;
+    }
+
+    #block {
+      width:100px;
+      height:100px;
+      background-color: blue;
+    }
+
+    #block::before {
+      content: "";
+      display: block;
+      width: 50px;
+      height: 50px;
+      background-color: yellow;
+      transform: scale(1.5);
+    }
+  </style>
+</head>
+<body>
+  <div id="block" style="transform: translateX(25px);"></div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-animation-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-animation-expected.png
new file mode 100644
index 0000000..ef86387
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-animation-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-animation.html b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-animation.html
new file mode 100644
index 0000000..779c587
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-animation.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<!--
+ | Test outline width and color animations.
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { outline-color:#FF3D00; outline-width:20px; }
+      50% { outline-color:#01579B; outline-width:10px; }
+      100% { outline-color:#FF3D00; outline-width:20px; }
+    }
+    body {
+      margin: 8px;
+      font-size: 18px;
+    }
+    div {
+      margin: 8px;
+      display: inline-block;
+      padding: 4px;
+      animation: testAnimation 2s forwards;
+    }
+    .outline {
+      outline-style: solid;
+    }
+    .border {
+      border: #80CBC4 solid 8px;
+      border-radius: 50%;
+    }
+  </style>
+</head>
+<body>
+  <div class="outline"></div>
+  <div class="border"></div>
+  <div class="outline border"></div>
+
+  <script>
+
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the animation to the half-way point and then measure the result.
+        window.testRunner.AdvanceClockByMs(1000);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-expected.png
new file mode 100644
index 0000000..85849e6
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-overflow-hidden-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-overflow-hidden-expected.png
new file mode 100644
index 0000000..85849e6
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-overflow-hidden-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-overflow-hidden.html b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-overflow-hidden.html
new file mode 100644
index 0000000..1c2a197
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline-overflow-hidden.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<!--
+ | Test outline with overflow:hidden
+-->
+<head>
+  <style>
+    body {
+      margin: 8px;
+      font-size: 18px;
+    }
+    div {
+      margin: 8px;
+      display: inline-block;
+      overflow: hidden;
+      padding: 4px;
+    }
+    .outline {
+      outline: #009688 solid 8px;
+    }
+    .border {
+      border: #80CBC4 solid 8px;
+      border-radius: 50%;
+    }
+  </style>
+</head>
+<body>
+  <div class="outline"></div>
+  <div class="border"></div>
+  <div class="outline border"></div>
+</body>
+</html>
+
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline.html b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline.html
new file mode 100644
index 0000000..961a1c1
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/18-4-outline.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<!--
+ | Test outline, with and without a border, and it's participation in layout.
+-->
+<head>
+  <style>
+    body {
+      margin: 8px;
+      font-size: 18px;
+    }
+    div {
+      margin: 8px;
+      display: inline-block;
+      padding: 4px;
+    }
+    .outline {
+      outline: #009688 solid 8px;
+    }
+    .border {
+      border: #80CBC4 solid 8px;
+      border-radius: 50%;
+    }
+  </style>
+</head>
+<body>
+  <div class="outline"></div>
+  <div class="border"></div>
+  <div class="outline border"></div>
+</body>
+</html>
+
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-containing-block-should-form-stacking-context-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-containing-block-should-form-stacking-context-expected.png
new file mode 100644
index 0000000..3fad754
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-containing-block-should-form-stacking-context-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-containing-block-should-form-stacking-context.html b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-containing-block-should-form-stacking-context.html
new file mode 100644
index 0000000..3cd40de
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-containing-block-should-form-stacking-context.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<!--
+ | This test ensures that a fixed position element forms a stacking context.
+ | While this is not explicitly required in the spec, it matches the
+ | functionality of Chrome, Firefox, Edge, and Safari (IE and old versions of
+ | Opera do not treat it as a stacking context). The results should show the
+ | blue box in front of the green box.
+ |   https://www.w3.org/TR/CSS21/visuren.html#z-index
+ -->
+<html>
+<head>
+  <style>
+    .fixed-container {
+      position: fixed;
+
+      width: 150px;
+      height: 150px;
+
+      background-color: rgb(158, 158, 158);
+    }
+    .green {
+      position: absolute;
+
+      left: 0px;
+      top: 0px;
+
+      width: 80px;
+      height: 80px;
+
+      z-index: 1;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .blue {
+      position: absolute;
+
+      left: 40px;
+      top: 40px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(66, 133, 244);
+    }
+  </style>
+</head>
+<body>
+  <div class="fixed-container">
+    <div class="green"></div>
+  </div>
+  <div class="blue"></div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings-expected.png
new file mode 100644
index 0000000..b018764
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings.html b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings.html
new file mode 100644
index 0000000..f094fb0
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<!--
+ | Fixed positioned elements should appear in the correct draw order when
+ | they have later, absolutely positioned siblings. The results should show the
+ | blue box in front of the green box.
+ |   https://www.w3.org/TR/CSS21/visuren.html#z-index
+ -->
+<html>
+<head>
+  <style>
+    .container {
+      position: absolute;
+
+      width: 150px;
+      height: 150px;
+
+      background-color: rgb(158, 158, 158);
+    }
+    .fixed-green {
+      position: fixed;
+
+      left: 2px;
+      top: 0px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .absolute-blue {
+      position: absolute;
+
+      left: 20px;
+      top: 20px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(66, 133, 244);
+    }
+    .relative-yellow {
+      position: relative;
+
+      left: 40px;
+      top: 40px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(244, 180, 0);
+    }
+  </style>
+</head>
+<body>
+  <div class="container">
+    <div class="container">
+      <div class="fixed-green"></div>
+      <div class="absolute-blue"></div>
+      <div class="relative-yellow"></div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-nearest-ancestor-stacking-context-should-contain-element-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-nearest-ancestor-stacking-context-should-contain-element-expected.png
new file mode 100644
index 0000000..4abe46a
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-nearest-ancestor-stacking-context-should-contain-element-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-nearest-ancestor-stacking-context-should-contain-element.html b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-nearest-ancestor-stacking-context-should-contain-element.html
new file mode 100644
index 0000000..27788d4
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-nearest-ancestor-stacking-context-should-contain-element.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<!--
+ | Stacking contexts are different from containing blocks. This test ensures
+ | that elements with an 'auto' z-index still use the correct stacking context
+ | when their containing block is further up the tree than their stacking
+ | context. The results should show the blue box in front of the gray box.
+ |   https://www.w3.org/TR/CSS21/visuren.html#z-index
+ -->
+<html>
+<head>
+  <style>
+    .blue-container {
+      position: absolute;
+
+      left: 20px;
+      top: 20px;
+
+      width: 150px;
+      height: 150px;
+      z-index: 3;
+
+      background-color: rgb(100, 100, 100);
+    }
+    .blue {
+      position: fixed;
+
+      left: -20px;
+      top: -20px;
+
+      width: 100px;
+      height: 100px;
+
+      background-color: rgb(100, 100, 255);
+    }
+  </style>
+</head>
+<body>
+  <div class="blue-container">
+    <div class="blue"></div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context-expected.png
new file mode 100644
index 0000000..3fad754
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context.html b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context.html
new file mode 100644
index 0000000..5ba4ab5
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!--
+ | Relative positioned elements should be placed in the correct stacking
+ | context, even when their containing block is nearer and is an in-flow,
+ | non-positioned descendants The results should show the blue box in front of
+ | the green box.
+ |   https://www.w3.org/TR/CSS21/visuren.html#z-index
+ -->
+<html>
+<head>
+  <style>
+    .container {
+      position: absolute;
+
+      width: 150px;
+      height: 150px;
+
+      background-color: rgb(158, 158, 158);
+    }
+    .green {
+      position: absolute;
+
+      left: 0px;
+      top: 0px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .blue-container {
+      position: static;
+
+      left: 20px;
+      top: 20px;
+
+      width: 150px;
+      height: 150px;
+    }
+    .blue {
+      position: relative;
+
+      left: 40px;
+      top: 40px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(66, 133, 244);
+    }
+  </style>
+</head>
+<body>
+  <div class="container">
+    <div class="green"></div>
+    <div class="blue-container">
+      <div class="blue"></div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling-expected.png
new file mode 100644
index 0000000..3fad754
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling.html b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling.html
new file mode 100644
index 0000000..fecd57c
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<!--
+ | Relative positioned elements should appear in the correct draw order when
+ | they have later, absolutely positioned siblings. The results should show the
+ | blue box in front of the green box.
+ |   https://www.w3.org/TR/CSS21/visuren.html#z-index
+ -->
+<html>
+<head>
+  <style>
+    .container {
+      position: absolute;
+
+      width: 150px;
+      height: 150px;
+
+      background-color: rgb(158, 158, 158);
+    }
+    .green {
+      position: relative;
+
+      left: 0px;
+      top: 0px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .blue {
+      position: absolute;
+
+      left: 40px;
+      top: 40px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(66, 133, 244);
+    }
+  </style>
+</head>
+<body>
+  <div class="container">
+    <div class="green"></div>
+    <div class="blue"></div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-z-index-should-only-be-applied-to-positioned-elements-expected.png b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-z-index-should-only-be-applied-to-positioned-elements-expected.png
new file mode 100644
index 0000000..54c3125
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-z-index-should-only-be-applied-to-positioned-elements-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/DISABLED-9-9-1-z-index-should-only-be-applied-to-positioned-elements.html b/src/cobalt/layout_tests/testdata/css-2-1/9-9-1-z-index-should-only-be-applied-to-positioned-elements.html
similarity index 100%
rename from src/cobalt/layout_tests/testdata/css-2-1/DISABLED-9-9-1-z-index-should-only-be-applied-to-positioned-elements.html
rename to src/cobalt/layout_tests/testdata/css-2-1/9-9-1-z-index-should-only-be-applied-to-positioned-elements.html
diff --git a/src/cobalt/layout_tests/testdata/css-2-1/layout_tests.txt b/src/cobalt/layout_tests/testdata/css-2-1/layout_tests.txt
index 8b56461..c0ef673 100644
--- a/src/cobalt/layout_tests/testdata/css-2-1/layout_tests.txt
+++ b/src/cobalt/layout_tests/testdata/css-2-1/layout_tests.txt
@@ -5,6 +5,9 @@
 10-1-absolute-positioned-elements-do-not-effect-containing-block-size
 10-1-containing-block-should-be-ancestor-padding-edge-for-absolutely-positioned-elements
 10-1-containing-block-should-be-ancestor-padding-edge-for-percentage-of-absolutely-positioned-elements
+10-1-containing-block-above-stacking-context-should-be-padding-edge-for-absolute-positioned-elements
+10-1-non-positioned-stacking-context-above-containing-block-should-apply-proper-offset-to-children
+10-1-positioned-stacking-context-above-fixed-containing-block-should-apply-proper-offset-to-children
 10-3-1-auto-margin-should-become-zero-in-inline-non-replaced-elements
 10-3-1-width-should-not-apply-to-inline-non-replaced-elements
 10-3-2-auto-margin-should-become-zero-in-inline-replaced-elements
@@ -59,6 +62,7 @@
 10-8-line-height-should-specify-minimum-height-of-line-boxes
 10-8-margin-box-should-be-used-for-vertical-align-with-most-boxes
 10-8-vertical-align-top-and-bottom-affect-height-and-baseline
+11-1-1-overflow-from-non-positioned-containing-block-should-affect-relative-positioned-child
 11-1-1-overflow-hidden
 11-1-1-overflow-hidden-and-opacity
 11-1-1-overflow-hidden-and-position-absolute-div-with-position-absolute-children
@@ -69,6 +73,8 @@
 11-1-1-overflow-hidden-masks-padding-box-only
 11-1-1-overflow-hidden-transform
 11-1-1-overflow-hidden-translate
+11-1-1-overflow-should-affect-descendants-with-z-index
+11-1-1-overflow-should-not-affect-descendants-contained-in-another-block
 11-1-1-overflow-visible
 11-1-absolutely-positioned-children-of-overflow-hidden
 11-1-absolutely-positioned-children-of-overflow-hidden-to-left
@@ -79,8 +85,12 @@
 12-1-after-pseudoelement
 12-1-after-pseudoelement-simple
 12-1-before-pseudoelement
+12-1-before-pseudoelement-does-not-inherit-inline-style
 16-2-text-align-can-be-left-center-right
 16-2-text-align-should-not-apply-when-child-boxes-overflow
+18-4-outline
+18-4-outline-animation
+18-4-outline-overflow-hidden
 8-1-margin-should-be-transparent
 8-3-margin-percentage-should-refer-containing-block-width
 8-3-negative_margins-should-be-allowed-to-produce_negative-box-widths
@@ -136,7 +146,13 @@
 9-9-1-absolute-positioned-elements-should-render-on-top-of-static-elements
 9-9-1-containing-block-may-be-farther-than-stacking-context
 9-9-1-elements-with-transform-should-appear-over-normal-flow-elements
+9-9-1-fixed-position-containing-block-should-form-stacking-context
+9-9-1-fixed-position-element-should-not-appear-on-top-of-later-siblings
+9-9-1-nearest-ancestor-stacking-context-should-contain-element
 9-9-1-negative-z-indices
+9-9-1-relative-positioned-element-should-not-appear-on-top-of-later-sibling
+9-9-1-relative-positioned-element-should-be-included-in-containing-stacking-context
 9-9-1-simple-positive-z-indices
 9-9-1-stacking-context-should-take-into-account-intermediate-containing-blocks
 9-9-1-stacking-contexts-differ-from-containing-blocks
+9-9-1-z-index-should-only-be-applied-to-positioned-elements
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-expected.png b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-expected.png
new file mode 100644
index 0000000..0d87283
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-from-ancestor-expected.png b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-from-ancestor-expected.png
new file mode 100644
index 0000000..0d87283
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-from-ancestor-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-from-ancestor.html b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-from-ancestor.html
new file mode 100644
index 0000000..fc502df
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits-from-ancestor.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that an animation assigned to an element whose
+ | ancestor has display: none will wait until display becomes non-none to begin.
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { transform: translate(0, 0); }
+      50% { transform: translate(100px,0); }
+      100% { transform: translate(100px,100px); }
+    }
+    #block {
+      width: 100px;
+      height: 100px;
+      font-size: 30px;
+      background-color: red;
+    }
+  </style>
+</head>
+<body>
+  <div id="outer-container">
+    <div id="inner-container">
+      <div id="block"></div>
+    </div>
+  </div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+    var containerDiv = document.getElementById('outer-container');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the transition to the half-way point.
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      containerDiv.style.display = "none";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.animation = "testAnimation 1s forwards";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      containerDiv.style.display = "block";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits.html b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits.html
new file mode 100644
index 0000000..50ee34a
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-during-display-none-waits.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that an animation assigned to an element who
+ | has display: none will wait until display becomes non-none to begin.
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { transform: translate(0, 0); }
+      50% { transform: translate(100px, 0); }
+      100% { transform: translate(100px, 100px); }
+    }
+    #block {
+      width: 100px;
+      height: 100px;
+      font-size: 30px;
+      background-color: red;
+    }
+  </style>
+</head>
+<body>
+  <div id="block"></div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the transition to the half-way point.
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.display = "none";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.animation = "testAnimation 1s forwards";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.display = "block";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-reset-on-display-change-not-computed-style-update-expected.png b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-reset-on-display-change-not-computed-style-update-expected.png
new file mode 100644
index 0000000..0d87283
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-reset-on-display-change-not-computed-style-update-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-reset-on-display-change-not-computed-style-update.html b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-reset-on-display-change-not-computed-style-update.html
new file mode 100644
index 0000000..8dcb486
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-reset-on-display-change-not-computed-style-update.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that an animation assigned to an element whose
+ | ancestor has display: none will wait until display becomes non-none to begin,
+ | and that specifically re-calculating the computed style on the animating
+ | element does not change anything.
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { transform: translate(0, 0); }
+      50% { transform: translate(100px,0); }
+      100% { transform: translate(100px,100px); }
+    }
+    #block {
+      width: 100px;
+      height: 100px;
+      font-size: 30px;
+      background-color: red;
+    }
+  </style>
+</head>
+<body>
+  <div id="outer-container">
+    <div id="inner-container">
+      <div id="block"></div>
+    </div>
+  </div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+    var containerDiv = document.getElementById('outer-container');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the transition to the half-way point.
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      containerDiv.style.display = "none";
+      blockDiv.style.animation = "testAnimation 1s forwards";
+
+      if (window.testRunner) {
+        window.testRunner.AdvanceClockByMs(500);
+      }
+
+      // Call getComputedStyle() to cause a targeted computed style update.
+      window.getComputedStyle(blockDiv);
+
+      containerDiv.style.display = "block";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-expected.png b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-expected.png
new file mode 100644
index 0000000..0d87283
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-from-ancestor-expected.png b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-from-ancestor-expected.png
new file mode 100644
index 0000000..0d87283
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-from-ancestor-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-from-ancestor.html b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-from-ancestor.html
new file mode 100644
index 0000000..9cb60c3
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none-from-ancestor.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that animations restart after display: none is
+ | applied to an ancestor of theirs, and then removed.
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { transform: translate(0, 0); }
+      50% { transform: translate(100px,0); }
+      100% { transform: translate(100px,100px); }
+    }
+    #block {
+      width: 100px;
+      height: 100px;
+      font-size: 30px;
+      background-color: red;
+      animation: testAnimation 1s forwards;
+    }
+  </style>
+</head>
+<body>
+  <div id="outer-container">
+    <div id="inner-container">
+      <div id="block"></div>
+    </div>
+  </div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var containerDiv = document.getElementById('outer-container');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the transition to the half-way point.
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      containerDiv.style.display = "none";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      containerDiv.style.display = "block";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none.html b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none.html
new file mode 100644
index 0000000..809fea4
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-animations-restart-after-display-none.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that animations restart after display: none is
+ | applied to them, and then removed.
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { transform: translate(0, 0); }
+      50% { transform: translate(100px,0); }
+      100% { transform: translate(100px,100px); }
+    }
+    #block {
+      width: 100px;
+      height: 100px;
+      font-size: 30px;
+      background-color: red;
+      animation: testAnimation 1s forwards;
+    }
+  </style>
+</head>
+<body>
+  <div id="block"></div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the transition to the half-way point.
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.display = "none";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.display = "block";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-simple-animation-expected.png b/src/cobalt/layout_tests/testdata/css3-animations/3-simple-animation-expected.png
new file mode 100644
index 0000000..ae9b1aa
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-simple-animation-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/3-simple-animation.html b/src/cobalt/layout_tests/testdata/css3-animations/3-simple-animation.html
new file mode 100644
index 0000000..d7a8c28
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/3-simple-animation.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that simple use of animations works correctly and
+ | that we see the right thing at the right time.
+ -->
+<html>
+<head>
+  <style>
+    @keyframes testAnimation{
+      0% { transform: translate(0, 0); }
+      50% { transform: translate(100px,0); }
+      100% { transform: translate(100px,100px); }
+    }
+    .block {
+      position: absolute;
+      width: 100px;
+      height: 100px;
+      font-size: 30px;
+    }
+    #block1 {
+      background-color: red;
+      animation: testAnimation 1s forwards;
+    }
+    #block2 {
+      background-color: green;
+      animation: testAnimation 2s forwards;
+    }
+  </style>
+</head>
+<body>
+  <div id="block1" class="block"></div>
+  <div id="block2" class="block"></div>
+
+  <script>
+
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Run the transition to the half-way point and then measure the result.
+        window.testRunner.AdvanceClockByMs(1000);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-animations/layout_tests.txt b/src/cobalt/layout_tests/testdata/css3-animations/layout_tests.txt
new file mode 100644
index 0000000..35f08bd
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-animations/layout_tests.txt
@@ -0,0 +1,6 @@
+3-animations-during-display-none-waits
+3-animations-during-display-none-waits-from-ancestor
+3-animations-reset-on-display-change-not-computed-style-update
+3-animations-restart-after-display-none
+3-animations-restart-after-display-none-from-ancestor
+3-simple-animation
diff --git a/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-forms-stacking-context-expected.png b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-forms-stacking-context-expected.png
new file mode 100644
index 0000000..4f6d2da
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-forms-stacking-context-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-forms-stacking-context.html b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-forms-stacking-context.html
new file mode 100644
index 0000000..2b01d07
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-forms-stacking-context.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<!--
+ | This test ensures that a non-positioned element with an opacity less than 1
+ | is painted by its containing stacking context in the order used for child
+ | stacking contexts and positioned elements. The results should draw the blue
+ | rectangle in front of the green rectangle.
+ |   https://www.w3.org/TR/css3-color/#opacity
+ -->
+<html>
+<head>
+  <style>
+    .container {
+      position: absolute;
+
+      width: 150px;
+      height: 150px;
+
+      background-color: rgb(158, 158, 158);
+    }
+    .green {
+      position: absolute;
+
+      left: 20px;
+      top: 20px;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(15, 157, 88);
+    }
+    .blue-container {
+      position: static;
+
+      opacity: .9;
+
+      width: 150px;
+      height: 150px;
+    }
+    .blue {
+      position: static;
+
+      width: 80px;
+      height: 80px;
+
+      background-color: rgb(66, 133, 244);
+    }
+  </style>
+</head>
+<body>
+  <div class="container">
+    <div class="green"></div>
+    <div class="blue-container">
+      <div class="blue"></div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-impacts-positioned-descendants-expected.png b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-impacts-positioned-descendants-expected.png
new file mode 100644
index 0000000..8886f53
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-impacts-positioned-descendants-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-impacts-positioned-descendants.html b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-impacts-positioned-descendants.html
new file mode 100644
index 0000000..da1c3c3
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-color/3-2-non-positioned-element-with-opacity-impacts-positioned-descendants.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<!--
+ | This test ensures that a non-positioned element with an opacity less than 1
+ | paints the layer it creates at the same stacking order that would be used if
+ | it were a positioned element with ‘z-index: 0’ and ‘opacity: 1’, impacting
+ | all of its positioned ancestors. The results should not display "This line is
+ | invisible."
+ |   https://www.w3.org/TR/css3-color/#transparency
+ -->
+<head>
+  <style>
+    body {
+      font-family: Roboto;
+      font-size: 16px;
+    }
+
+    .positioned-container {
+      position: absolute;
+      width: 300px;
+      height: 50px;
+      background-color: #00CC00;
+    }
+
+    .opacity-test {
+      position: static;
+      opacity: 0;
+      width: 300px;
+      height: 50px;
+      background-color: #00CC00;
+    }
+
+    .positioned-red {
+      position: absolute;
+      width: 400px;
+      height: 20px;
+      background-color: #FF0000;
+      top: 60px;
+    }
+  </style>
+</head>
+<body>
+  <div class="positioned-container">
+    <div class="opacity-test">
+      <div class="positioned-red"> This line is invisible. </div>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-color/layout_tests.txt b/src/cobalt/layout_tests/testdata/css3-color/layout_tests.txt
index 8b6aa39..678bedd 100644
--- a/src/cobalt/layout_tests/testdata/css3-color/layout_tests.txt
+++ b/src/cobalt/layout_tests/testdata/css3-color/layout_tests.txt
@@ -1,4 +1,6 @@
 3-2-nested-opacity-compounds
+3-2-non-positioned-element-with-opacity-forms-stacking-context
+3-2-non-positioned-element-with-opacity-impacts-positioned-descendants
 3-2-opacity-applies-to-children
 3-2-opacity-applies-to-text
 3-2-opacity-does-apply-to-background
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-expected.png b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-expected.png
new file mode 100644
index 0000000..31e131c
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-from-ancestor-expected.png b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-from-ancestor-expected.png
new file mode 100644
index 0000000..31e131c
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-from-ancestor-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-from-ancestor.html b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-from-ancestor.html
new file mode 100644
index 0000000..632f95b
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none-from-ancestor.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that when an element's ancestor has its display set
+ | to none, all running transitions on it are immediately ended.
+ | While the specification doesn't seem to say anything about this, it is
+ | how Chrome and Firefox both work, and it is also intuitively in line with
+ | the following behavior specified for CSS Animations:
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    #block {
+      width: 100px;
+      height: 100px;
+      background-color: red;
+      font-size: 30px;
+      transition: background-color 1s, transform 2s linear;
+    }
+  </style>
+</head>
+<body>
+  <div id="outer-container">
+    <div id="inner-container">
+      <div id="block"></div>
+    </div>
+  </div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+    var containerDiv = document.getElementById('outer-container');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Do a layout upon the load event so that we setup our source styles
+        // that we will be transitioning from.
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.backgroundColor = 'blue';
+      blockDiv.style.transform = "translate(100px, 0)";
+
+      if (window.testRunner) {
+        // Run the transition a bit so that it is started but not completed.
+        window.testRunner.DoNonMeasuredLayout();
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+
+        containerDiv.style.display = "none";
+
+        window.testRunner.DoNonMeasuredLayout();
+
+        containerDiv.style.display = "block";
+
+        // Measure that the transition should now appear to be fully completed.
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none.html b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none.html
new file mode 100644
index 0000000..d44099a
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-ends-on-display-none.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that when an element has its display set to none,
+ | all running transitions on it are immediately ended.
+ | While the specification doesn't seem to say anything about this, it is
+ | how Chrome and Firefox both work, and it is also intuitively in line with
+ | the following behavior specified for CSS Animations:
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    #block {
+      width: 100px;
+      height: 100px;
+      background-color: red;
+      font-size: 30px;
+      transition: background-color 1s, transform 2s linear;
+    }
+  </style>
+</head>
+<body>
+  <div id="block"></div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Do a layout upon the load event so that we setup our source styles
+        // that we will be transitioning from.
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.backgroundColor = 'blue';
+      blockDiv.style.transform = "translate(100px, 0)";
+
+      if (window.testRunner) {
+        // Run the transition a bit so that it is started but not completed.
+        window.testRunner.DoNonMeasuredLayout();
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+
+        blockDiv.style.display = "none";
+
+        window.testRunner.DoNonMeasuredLayout();
+
+        blockDiv.style.display = "block";
+
+        // Measure that the transition should now appear to be fully completed.
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-expected.png b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-expected.png
new file mode 100644
index 0000000..31e131c
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-from-ancestor-expected.png b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-from-ancestor-expected.png
new file mode 100644
index 0000000..31e131c
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-from-ancestor-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-from-ancestor.html b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-from-ancestor.html
new file mode 100644
index 0000000..f898557
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition-from-ancestor.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that when a transition "begins" on an element with an
+ | ancestor that has display set to none, when display is set to non-none, the
+ | transition does not run (e.g. it appears immediately fully transitioned).
+ | While the specification doesn't seem to say anything about this, it is
+ | how Chrome and Firefox both work, and it is also intuitively in line with
+ | the following behavior specified for CSS Animations:
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    #block {
+      width: 100px;
+      height: 100px;
+      background-color: red;
+      font-size: 30px;
+      transition: background-color 1s, transform 2s linear;
+    }
+  </style>
+</head>
+<body>
+  <div id="outer-container">
+    <div id="inner-container">
+      <div id="block"></div>
+    </div>
+  </div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+    var containerDiv = document.getElementById('outer-container');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Do a layout upon the load event so that we setup our source styles
+        // that we will be transitioning from.
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      containerDiv.style.display = "none";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.backgroundColor = 'blue';
+      blockDiv.style.transform = "translate(100px, 0)";
+
+      if (window.testRunner) {
+        // Run the transition a bit so that it is started but not completed.
+        window.testRunner.DoNonMeasuredLayout();
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+
+        containerDiv.style.display = "block";
+
+        // Measure that the transition should now appear to be fully completed.
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition.html b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition.html
new file mode 100644
index 0000000..a046316
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/2-transition-start-during-display-none-does-not-transition.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that when a transition "begins" on an element with
+ | display set to none, when display is set to non-none, the transition does
+ | not run (e.g. it appears immediately fully transitioned).
+ | While the specification doesn't seem to say anything about this, it is
+ | how Chrome and Firefox both work, and it is also intuitively in line with
+ | the following behavior specified for CSS Animations:
+ | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations,
+ | "Setting the display property to ‘none’ will terminate any running animation
+ |  applied to the element and its descendants. If an element has a display of
+ |  ‘none’, updating display to a value other than ‘none’ will start all
+ |  animations applied to the element by the ‘animation-name’ property, as well
+ |  as all animations applied to descendants with display other than ‘none’."
+ -->
+<html>
+<head>
+  <style>
+    #block {
+      width: 100px;
+      height: 100px;
+      background-color: red;
+      font-size: 30px;
+      transition: background-color 1s, transform 2s linear;
+    }
+  </style>
+</head>
+<body>
+  <div id="block"></div>
+
+  <script>
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Do a layout upon the load event so that we setup our source styles
+        // that we will be transitioning from.
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.display = "none";
+
+      if (window.testRunner) {
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.backgroundColor = 'blue';
+      blockDiv.style.transform = "translate(100px, 0)";
+
+      if (window.testRunner) {
+        // Run the transition a bit so that it is started but not completed.
+        window.testRunner.DoNonMeasuredLayout();
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.DoNonMeasuredLayout();
+
+        blockDiv.style.display = "block";
+
+        // Measure that the transition should now appear to be fully completed.
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/5-multiple-transitions-should-fire-in-correct-order.html b/src/cobalt/layout_tests/testdata/css3-transitions/5-multiple-transitions-should-fire-in-correct-order.html
index 82e97be..9aa6a57 100644
--- a/src/cobalt/layout_tests/testdata/css3-transitions/5-multiple-transitions-should-fire-in-correct-order.html
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/5-multiple-transitions-should-fire-in-correct-order.html
@@ -63,6 +63,10 @@
     if (window.testRunner) {
       // Do another layout to start the transitions.
       window.testRunner.DoNonMeasuredLayout();
+
+      // Advance the clock to exactly the end of the transition
+      // durations.
+      window.testRunner.AdvanceClockByMs(NUM_DIVS * 10);
     }
   });
 </script>
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/5-simple-transition-expected.png b/src/cobalt/layout_tests/testdata/css3-transitions/5-simple-transition-expected.png
new file mode 100644
index 0000000..caeeafb
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/5-simple-transition-expected.png
Binary files differ
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/5-simple-transition.html b/src/cobalt/layout_tests/testdata/css3-transitions/5-simple-transition.html
new file mode 100644
index 0000000..c0c09e4
--- /dev/null
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/5-simple-transition.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!--
+ | Test case which ensures that simple use of transitions works correctly and
+ | that we see the right thing at the right time.
+ -->
+<html>
+<head>
+  <style>
+    #block {
+      width: 100px;
+      height: 100px;
+      background-color: red;
+      font-size: 30px;
+      transition: background-color 1s, transform 2s linear;
+    }
+  </style>
+</head>
+<body>
+  <div id="block"></div>
+
+  <script>
+
+    if (window.testRunner) {
+      window.testRunner.waitUntilDone();
+    }
+
+    var blockDiv = document.getElementById('block');
+
+    window.addEventListener('load', function() {
+      if (window.testRunner) {
+        // Do a layout upon the load event so that we setup our source styles
+        // that we will be transitioning from.
+        window.testRunner.DoNonMeasuredLayout();
+      }
+
+      blockDiv.style.backgroundColor = 'blue';
+      blockDiv.style.transform = "translate(100px, 0)";
+
+      if (window.testRunner) {
+        // Do another layout to start the transitions.
+        window.testRunner.DoNonMeasuredLayout();
+
+        // Run the transition to the half-way point and then measure the result.
+        window.testRunner.AdvanceClockByMs(500);
+        window.testRunner.notifyDone();
+      }
+    });
+  </script>
+
+</body>
+</html>
diff --git a/src/cobalt/layout_tests/testdata/css3-transitions/layout_tests.txt b/src/cobalt/layout_tests/testdata/css3-transitions/layout_tests.txt
index 5d31aba..f5ae277 100644
--- a/src/cobalt/layout_tests/testdata/css3-transitions/layout_tests.txt
+++ b/src/cobalt/layout_tests/testdata/css3-transitions/layout_tests.txt
@@ -1 +1,6 @@
+2-transition-ends-on-display-none
+2-transition-ends-on-display-none-from-ancestor
+2-transition-start-during-display-none-does-not-transition
+2-transition-start-during-display-none-does-not-transition-from-ancestor
 5-multiple-transitions-should-fire-in-correct-order
+5-simple-transition
diff --git a/src/cobalt/layout_tests/web_platform_tests.cc b/src/cobalt/layout_tests/web_platform_tests.cc
index f990066..5421370 100644
--- a/src/cobalt/layout_tests/web_platform_tests.cc
+++ b/src/cobalt/layout_tests/web_platform_tests.cc
@@ -155,9 +155,10 @@
 
   // Media module
   render_tree::ResourceProviderStub resource_provider;
+  media::MediaModule::Options options;
+  options.output_resolution_override = kDefaultViewportSize;
   scoped_ptr<media::MediaModule> media_module(
-      media::MediaModule::Create(NULL, kDefaultViewportSize, &resource_provider,
-                                 media::MediaModule::Options()));
+      media::MediaModule::Create(NULL, &resource_provider, options));
 
   dom::CspDelegateFactory::GetInstance()->OverrideCreator(
       dom::kCspEnforcementEnable, CspDelegatePermissive::Create);
@@ -178,8 +179,8 @@
       base::Bind(&WebModuleErrorCallback, &run_loop, MessageLoop::current()),
       base::Closure() /* window_close_callback */,
       base::Closure() /* window_minimize_callback */, media_module.get(),
-      &network_module, kDefaultViewportSize, &resource_provider,
-      media_module->system_window(), 60.0f, web_module_options);
+      &network_module, kDefaultViewportSize, 1.f, &resource_provider, 60.0f,
+      web_module_options);
   run_loop.Run();
   const std::string extract_results =
       "document.getElementById(\"__testharness__results__\").textContent;";
diff --git a/src/cobalt/loader/embedded_resources/cobalt_splash_screen.css b/src/cobalt/loader/embedded_resources/cobalt_splash_screen.css
new file mode 100644
index 0000000..5c8c317
--- /dev/null
+++ b/src/cobalt/loader/embedded_resources/cobalt_splash_screen.css
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+body {
+  overflow: hidden;
+  font-size: 1.4815vh;  /* Corresponds to 16px at 1080p. */
+}
+
+#splash {
+  background-color: #ffffff;
+  background-image: url("h5vcc-embedded://cobalt_word_logo_1024.png");
+  background-position: center center;
+  background-repeat: no-repeat;
+  background-size: auto 33%;
+  height: 100%;
+  left: 0;
+  position: absolute;
+  top: 0;
+  width: 100%;
+}
+
+#loading {
+  position: absolute;
+  top: 52em;
+  width: 100%;
+}
+
+#spinner {
+  /* The spinner starts with display set to none, and JavaScript will set this
+     to 'block' after some time has passed, if the splash screen is still
+     visible. */
+  display: none;
+
+  height: 5.33em;
+  margin: 0 auto;
+  position: relative;
+  width: 5.33em;
+}
+
+.dot {
+  background-color: #cbcbcb;
+  border-radius: 50%;
+  height: 1.17em;
+  position: absolute;
+  width: 1.17em;
+}
+
+@keyframes fade1 {
+  0%,100% {opacity: 0}
+  50% {opacity: 1}
+}
+
+@keyframes fade2 {
+  0%,100% {opacity: .25}
+  37.5% {opacity: 1}
+  87.5% {opacity: 0}
+}
+
+@keyframes fade3 {
+  0%,100% {opacity: .5}
+  25% {opacity: 1}
+  75% {opacity: 0}
+}
+
+@keyframes fade4 {
+  0%,100% {opacity: .75}
+  12.5% {opacity: 1}
+  62.5% {opacity: 0}
+}
+
+@keyframes fade5 {
+  0%,100% {opacity: 1}
+  50% {opacity: 0}
+}
+
+@keyframes fade6 {
+  0%,100% {opacity: .75}
+  37.5% {opacity: 0}
+  87.5% {opacity: 1}
+}
+
+@keyframes fade7 {
+  0%,100% {opacity: .5}
+  25% {opacity: 0}
+  75% {opacity: 1}
+}
+
+@keyframes fade8 {
+  0%,100% {opacity: .25}
+  12.5% {opacity: 0}
+  62.5% {opacity: 1}
+}
+
+#dot1 {
+  animation: fade8 .72s infinite ease;
+  left: 0;
+  top: 2.09em;
+}
+
+#dot2 {
+  animation: fade7 .72s infinite ease;
+  left: .61em;
+  top: .61em;
+}
+
+#dot3 {
+  animation: fade6 .72s infinite ease;
+  left: 2.09em;
+  top: 0;
+}
+
+#dot4 {
+  animation: fade5 .72s infinite ease;
+  right: .61em;
+  top: .61em;
+}
+
+#dot5 {
+  animation: fade4 .72s infinite ease;
+  right: 0;
+  top: 2.09em;
+}
+
+#dot6 {
+  animation: fade3 .72s infinite ease;
+  bottom: .61em;
+  right: .61em;
+}
+
+#dot7 {
+  animation: fade2 .72s infinite ease;
+  bottom: 0;
+  left: 2.09em;
+}
+
+#dot8 {
+  animation: fade1 .72s infinite ease;
+  bottom: .61em;
+  left: .61em;
+}
+
+.hidden {
+  height: 0;
+  visibility: hidden;
+}
diff --git a/src/cobalt/loader/embedded_resources/cobalt_splash_screen.html b/src/cobalt/loader/embedded_resources/cobalt_splash_screen.html
new file mode 100644
index 0000000..df1ac86
--- /dev/null
+++ b/src/cobalt/loader/embedded_resources/cobalt_splash_screen.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<!--
+  Copyright 2017 Google Inc. All Rights Reserved.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+
+<head>
+<meta http-equiv="Content-Security-Policy" content="default-src 'none';
+    script-src h5vcc-embedded://*/splash_screen.js;
+    style-src h5vcc-embedded://*/cobalt_splash_screen.css;
+    img-src h5vcc-embedded://*/cobalt_word_logo_1024.png;">
+<link rel="stylesheet" type="text/css"
+    href="h5vcc-embedded://cobalt_splash_screen.css">
+</head>
+
+<body>
+  <div id="splash">
+    <img src="h5vcc-embedded://cobalt_word_logo_1024.png" class="hidden">
+  </div>
+  <div id="loading">
+    <div id="spinner">
+      <div class="dot" id="dot1"></div>
+      <div class="dot" id="dot2"></div>
+      <div class="dot" id="dot3"></div>
+      <div class="dot" id="dot4"></div>
+      <div class="dot" id="dot5"></div>
+      <div class="dot" id="dot6"></div>
+      <div class="dot" id="dot7"></div>
+      <div class="dot" id="dot8"></div>
+    </div>
+  </div>
+  <script type="text/javascript" src="h5vcc-embedded://splash_screen.js">
+  </script>
+</body>
+
+</html>
diff --git a/src/cobalt/loader/embedded_resources/cobalt_word_logo_1024.png b/src/cobalt/loader/embedded_resources/cobalt_word_logo_1024.png
new file mode 100644
index 0000000..2a1d64b
--- /dev/null
+++ b/src/cobalt/loader/embedded_resources/cobalt_word_logo_1024.png
Binary files differ
diff --git a/src/cobalt/loader/embedded_resources/splash_screen.css b/src/cobalt/loader/embedded_resources/splash_screen.css
index 9fbe2a3..81ff7cb 100644
--- a/src/cobalt/loader/embedded_resources/splash_screen.css
+++ b/src/cobalt/loader/embedded_resources/splash_screen.css
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
 body {
   overflow: hidden;
   font-size: 1.4815vh;  /* Corresponds to 16px at 1080p. */
diff --git a/src/cobalt/loader/embedded_resources/splash_screen.html b/src/cobalt/loader/embedded_resources/splash_screen.html
index 0e57e3b..f79d132 100644
--- a/src/cobalt/loader/embedded_resources/splash_screen.html
+++ b/src/cobalt/loader/embedded_resources/splash_screen.html
@@ -1,4 +1,19 @@
 <!DOCTYPE html>
+<!--
+  Copyright 2015 Google Inc. All Rights Reserved.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
 <html>
 
 <head>
@@ -6,7 +21,8 @@
     script-src h5vcc-embedded://*/splash_screen.js;
     style-src h5vcc-embedded://*/splash_screen.css;
     img-src h5vcc-embedded://*/you_tube_logo.png;">
-<link rel="stylesheet" type="text/css" href="h5vcc-embedded://splash_screen.css">
+<link rel="stylesheet" type="text/css"
+    href="h5vcc-embedded://splash_screen.css">
 </head>
 
 <body>
diff --git a/src/cobalt/loader/image/animated_image_tracker.cc b/src/cobalt/loader/image/animated_image_tracker.cc
index 25280aa..9d36010 100644
--- a/src/cobalt/loader/image/animated_image_tracker.cc
+++ b/src/cobalt/loader/image/animated_image_tracker.cc
@@ -16,6 +16,7 @@
 
 #include <algorithm>
 
+#include "base/debug/trace_event.h"
 #include "cobalt/base/polymorphic_downcast.h"
 
 namespace cobalt {
@@ -25,6 +26,7 @@
 AnimatedImageTracker::AnimatedImageTracker(
     base::ThreadPriority animated_image_decode_thread_priority)
     : animated_image_decode_thread_("AnimatedImage") {
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedImageTracker::RecordImage()");
   base::Thread::Options options(MessageLoop::TYPE_DEFAULT,
                                 0 /* default stack size */,
                                 animated_image_decode_thread_priority);
@@ -32,25 +34,37 @@
 }
 
 AnimatedImageTracker::~AnimatedImageTracker() {
-  animated_image_decode_thread_.Stop();
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedImageTracker::RecordImage()");
+  DCHECK(thread_checker_.CalledOnValidThread());
 }
 
 void AnimatedImageTracker::IncreaseURLCount(const GURL& url) {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedImageTracker::IncreaseURLCount()");
+  DCHECK(thread_checker_.CalledOnValidThread());
   current_url_counts_[url]++;
 }
 
 void AnimatedImageTracker::DecreaseURLCount(const GURL& url) {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedImageTracker::DecreaseURLCount()");
+  DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK_GT(current_url_counts_[url], 0);
   current_url_counts_[url]--;
 }
 
 void AnimatedImageTracker::RecordImage(
     const GURL& url, loader::image::AnimatedImage* animated_image) {
+  DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(animated_image);
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedImageTracker::RecordImage()");
   image_map_[url] = animated_image;
 }
 
 void AnimatedImageTracker::ProcessRecordedImages() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedImageTracker::ProcessRecordedImages()");
   for (URLToIntMap::iterator it = current_url_counts_.begin();
        it != current_url_counts_.end();) {
     const GURL& url = it->first;
@@ -83,16 +97,32 @@
 
 void AnimatedImageTracker::OnDisplayStart(
     loader::image::AnimatedImage* animated_image) {
+  DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(animated_image);
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedImageTracker::OnDisplayStart()");
   animated_image->Play(animated_image_decode_thread_.message_loop_proxy());
 }
 
 void AnimatedImageTracker::OnDisplayEnd(
     loader::image::AnimatedImage* animated_image) {
+  DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(animated_image);
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedImageTracker::OnDisplayEnd()");
   animated_image->Stop();
 }
 
+void AnimatedImageTracker::Reset() {
+  for (const auto& playing_url : playing_urls_) {
+    OnDisplayEnd(image_map_[playing_url.first]);
+  }
+
+  image_map_.clear();
+  current_url_counts_.clear();
+  previous_url_counts_.clear();
+  playing_urls_.clear();
+}
+
 }  // namespace image
 }  // namespace loader
 }  // namespace cobalt
diff --git a/src/cobalt/loader/image/animated_image_tracker.h b/src/cobalt/loader/image/animated_image_tracker.h
index 6fdb115..2cb9c72 100644
--- a/src/cobalt/loader/image/animated_image_tracker.h
+++ b/src/cobalt/loader/image/animated_image_tracker.h
@@ -50,19 +50,32 @@
   // be called at the end of a layout.
   void ProcessRecordedImages();
 
+  // Clears the AnimatedImageTracker, releasing any tracked in-progress
+  // animations.
+  void Reset();
+
  private:
   void OnDisplayStart(loader::image::AnimatedImage* image);
   void OnDisplayEnd(loader::image::AnimatedImage* image);
 
-  typedef std::map<GURL, loader::image::AnimatedImage*> URLToImageMap;
+  typedef std::map<GURL, scoped_refptr<loader::image::AnimatedImage> >
+      URLToImageMap;
   typedef std::map<GURL, int> URLToIntMap;
   typedef base::SmallMap<std::map<GURL, base::Unused>, 1> URLSet;
 
+  // The image decode thread is a thread created and owned by the
+  // AnimatedImageTracker, but used by the AnimatedImage decoders.
+  base::Thread animated_image_decode_thread_;
+
   URLToImageMap image_map_;
   URLToIntMap previous_url_counts_;
   URLToIntMap current_url_counts_;
   URLSet playing_urls_;
-  base::Thread animated_image_decode_thread_;
+
+  // Used to ensure that all AnimatedImageTracker methods are called on the
+  // same thread (*not* |animated_image_decode_thread_|), the thread that we
+  // were constructed on.
+  base::ThreadChecker thread_checker_;
 };
 
 }  // namespace image
diff --git a/src/cobalt/loader/image/animated_webp_image.cc b/src/cobalt/loader/image/animated_webp_image.cc
index d43449f..100b919 100644
--- a/src/cobalt/loader/image/animated_webp_image.cc
+++ b/src/cobalt/loader/image/animated_webp_image.cc
@@ -52,15 +52,22 @@
       current_frame_index_(0),
       next_frame_index_(0),
       should_dispose_previous_frame_to_background_(false),
-      resource_provider_(resource_provider) {}
+      resource_provider_(resource_provider),
+      frame_provider_(new FrameProvider()) {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedWebPImage::AnimatedWebPImage()");
+}
 
-scoped_refptr<render_tree::Image> AnimatedWebPImage::GetFrame() {
-  base::AutoLock lock(lock_);
-  return current_canvas_;
+scoped_refptr<const AnimatedImage::FrameProvider>
+AnimatedWebPImage::GetFrameProvider() {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedWebPImage::GetFrameProvider()");
+  return frame_provider_;
 }
 
 void AnimatedWebPImage::Play(
     const scoped_refptr<base::MessageLoopProxy>& message_loop) {
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::Play()");
   base::AutoLock lock(lock_);
 
   if (is_playing_) {
@@ -75,18 +82,21 @@
 }
 
 void AnimatedWebPImage::Stop() {
-  if (!decode_closure_.callback().is_null()) {
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::Stop()");
+  base::AutoLock lock(lock_);
+  if (is_playing_) {
     message_loop_->PostTask(
         FROM_HERE,
         base::Bind(&AnimatedWebPImage::StopInternal, base::Unretained(this)));
   }
 }
 
-void AnimatedWebPImage::AppendChunk(const uint8* data, size_t input_byte) {
+void AnimatedWebPImage::AppendChunk(const uint8* data, size_t size) {
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::AppendChunk()");
   TRACK_MEMORY_SCOPE("Rendering");
   base::AutoLock lock(lock_);
 
-  data_buffer_.insert(data_buffer_.end(), data, data + input_byte);
+  data_buffer_.insert(data_buffer_.end(), data, data + size);
   WebPData webp_data = {&data_buffer_[0], data_buffer_.size()};
   WebPDemuxDelete(demux_);
   demux_ = WebPDemuxPartial(&webp_data, &demux_state_);
@@ -117,30 +127,46 @@
 }
 
 AnimatedWebPImage::~AnimatedWebPImage() {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedWebPImage::~AnimatedWebPImage()");
   Stop();
-  base::AutoLock lock(lock_);
+  bool is_playing = false;
+  {
+    base::AutoLock lock(lock_);
+    is_playing = is_playing_;
+  }
+  if (is_playing) {
+    message_loop_->WaitForFence();
+  }
   WebPDemuxDelete(demux_);
 }
 
 void AnimatedWebPImage::StopInternal() {
-  is_playing_ = false;
-  decode_closure_.Cancel();
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::StopInternal()");
+  DCHECK(message_loop_->BelongsToCurrentThread());
+  base::AutoLock lock(lock_);
+  if (!decode_closure_.callback().is_null()) {
+    is_playing_ = false;
+    decode_closure_.Cancel();
+  }
 }
 
 void AnimatedWebPImage::PlayInternal() {
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::PlayInternal()");
   current_frame_time_ = base::TimeTicks::Now();
-  DCHECK(message_loop_);
   message_loop_->PostTask(
       FROM_HERE,
       base::Bind(&AnimatedWebPImage::DecodeFrames, base::Unretained(this)));
 }
 
 void AnimatedWebPImage::DecodeFrames() {
-  TRACK_MEMORY_SCOPE("Rendering");
   TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::DecodeFrames()");
+  TRACK_MEMORY_SCOPE("Rendering");
   DCHECK(is_playing_ && received_first_frame_);
   DCHECK(message_loop_->BelongsToCurrentThread());
 
+  base::AutoLock lock(lock_);
+
   if (decode_closure_.callback().is_null()) {
     decode_closure_.Reset(
         base::Bind(&AnimatedWebPImage::DecodeFrames, base::Unretained(this)));
@@ -158,7 +184,6 @@
   current_frame_index_ = next_frame_index_;
 
   // Set up the next time to call the decode callback.
-  base::AutoLock lock(lock_);
   if (is_playing_) {
     base::TimeDelta delay = next_frame_time_ - base::TimeTicks::Now();
     const base::TimeDelta min_delay =
@@ -184,8 +209,11 @@
 }  // namespace
 
 bool AnimatedWebPImage::DecodeOneFrame(int frame_index) {
+  TRACE_EVENT0("cobalt::loader::image", "AnimatedWebPImage::DecodeOneFrame()");
   TRACK_MEMORY_SCOPE("Rendering");
-  base::AutoLock lock(lock_);
+  DCHECK(message_loop_->BelongsToCurrentThread());
+  lock_.AssertAcquired();
+
   WebPIterator webp_iterator;
   scoped_refptr<render_tree::Image> next_frame_image;
 
@@ -242,6 +270,7 @@
         new render_tree::CompositionNode(builder);
 
     current_canvas_ = resource_provider_->DrawOffscreenImage(root);
+    frame_provider_->SetFrame(current_canvas_);
   }
 
   if (webp_iterator.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) {
@@ -260,8 +289,12 @@
 }
 
 void AnimatedWebPImage::UpdateTimelineInfo() {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedWebPImage::UpdateTimelineInfo()");
   TRACK_MEMORY_SCOPE("Rendering");
-  base::AutoLock lock(lock_);
+  DCHECK(message_loop_->BelongsToCurrentThread());
+  lock_.AssertAcquired();
+
   base::TimeTicks current_time = base::TimeTicks::Now();
   next_frame_index_ = current_frame_index_ ? current_frame_index_ : 1;
   while (true) {
@@ -297,6 +330,8 @@
 
 scoped_ptr<render_tree::ImageData> AnimatedWebPImage::AllocateImageData(
     const math::Size& size) {
+  TRACE_EVENT0("cobalt::loader::image",
+               "AnimatedWebPImage::AllocateImageData()");
   TRACK_MEMORY_SCOPE("Rendering");
   scoped_ptr<render_tree::ImageData> image_data =
       resource_provider_->AllocateImageData(
diff --git a/src/cobalt/loader/image/animated_webp_image.h b/src/cobalt/loader/image/animated_webp_image.h
index e988519..179d42e 100644
--- a/src/cobalt/loader/image/animated_webp_image.h
+++ b/src/cobalt/loader/image/animated_webp_image.h
@@ -50,13 +50,13 @@
 
   bool IsOpaque() const OVERRIDE { return is_opaque_; }
 
-  scoped_refptr<render_tree::Image> GetFrame() OVERRIDE;
+  scoped_refptr<const FrameProvider> GetFrameProvider() OVERRIDE;
 
   void Play(const scoped_refptr<base::MessageLoopProxy>& message_loop) OVERRIDE;
 
   void Stop() OVERRIDE;
 
-  void AppendChunk(const uint8* data, size_t input_byte);
+  void AppendChunk(const uint8* data, size_t size);
 
  private:
   ~AnimatedWebPImage() OVERRIDE;
@@ -102,6 +102,7 @@
   // The original encoded data.
   std::vector<uint8> data_buffer_;
   scoped_refptr<render_tree::Image> current_canvas_;
+  scoped_refptr<FrameProvider> frame_provider_;
   base::Lock lock_;
 };
 
diff --git a/src/cobalt/loader/image/image.h b/src/cobalt/loader/image/image.h
index feb1bd3..fe77dac 100644
--- a/src/cobalt/loader/image/image.h
+++ b/src/cobalt/loader/image/image.h
@@ -19,6 +19,7 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/message_loop_proxy.h"
+#include "base/synchronization/lock.h"
 #include "base/time.h"
 #include "cobalt/math/size_f.h"
 #include "cobalt/math/transform_2d.h"
@@ -77,13 +78,38 @@
 // when playing animation.
 class AnimatedImage : public Image {
  public:
+  // FrameProvider nested classes are used as "frame containers".  Typically
+  // they will be created by an AnimatedImage and have frames pushed into them
+  // by the creating AnimatedImage object.  They can be handed to consumers to
+  // have frames pulled out of them.  Its purpose is to allow AnimatedImage
+  // objects to be destroyed without affecting consumers of the FrameProvider.
+  // If the AnimatedImage is destroyed before the consumer is done pulling
+  // frames out of FrameProvider, they will simply be left with the last frame
+  // that was in there.
+  class FrameProvider : public base::RefCountedThreadSafe<FrameProvider> {
+   public:
+    void SetFrame(const scoped_refptr<render_tree::Image>& frame) {
+      base::AutoLock lock(mutex_);
+      frame_ = frame;
+    }
+
+    scoped_refptr<render_tree::Image> GetFrame() const {
+      base::AutoLock lock(mutex_);
+      return frame_;
+    }
+
+   private:
+    virtual ~FrameProvider() {}
+    friend class base::RefCountedThreadSafe<FrameProvider>;
+
+    mutable base::Lock mutex_;
+    scoped_refptr<render_tree::Image> frame_;
+  };
+
   bool IsAnimated() const OVERRIDE { return true; }
 
   bool IsOpaque() const OVERRIDE { return false; }
 
-  // Get the current frame. Implementation should be thread safe.
-  virtual scoped_refptr<render_tree::Image> GetFrame() = 0;
-
   // Start playing the animation, decoding on the given message loop.
   // Implementation should be thread safe.
   virtual void Play(
@@ -92,14 +118,21 @@
   // Stop playing the animation.
   virtual void Stop() = 0;
 
+  // Returns a FrameProvider object from which frames can be pulled out of.
+  // The AnimatedImage object is expected to push frames into the FrameProvider
+  // as it generates them.
+  virtual scoped_refptr<const FrameProvider> GetFrameProvider() = 0;
+
   // This callback is intended to be used in a render_tree::AnimateNode.
-  void AnimateCallback(const math::RectF& destination_rect,
-                       const math::Matrix3F& local_transform,
-                       render_tree::ImageNode::Builder* image_node_builder,
-                       base::TimeDelta time) {
+  static void AnimateCallback(
+      scoped_refptr<const FrameProvider> frame_provider,
+      const math::RectF& destination_rect,
+      const math::Matrix3F& local_transform,
+      render_tree::ImageNode::Builder* image_node_builder,
+      base::TimeDelta time) {
     UNREFERENCED_PARAMETER(time);
 
-    image_node_builder->source = GetFrame();
+    image_node_builder->source = frame_provider->GetFrame();
     image_node_builder->destination_rect = destination_rect;
     image_node_builder->local_transform = local_transform;
   }
diff --git a/src/cobalt/loader/image/jpeg_image_decoder.cc b/src/cobalt/loader/image/jpeg_image_decoder.cc
index 10ca062..b034900 100644
--- a/src/cobalt/loader/image/jpeg_image_decoder.cc
+++ b/src/cobalt/loader/image/jpeg_image_decoder.cc
@@ -347,6 +347,7 @@
         FillRow<2, 1, 0, 3>(static_cast<int>(info_.output_width),
                             pixel_data, sample_buffer);
       } break;
+      case render_tree::kPixelFormatUYVY:
       case render_tree::kPixelFormatY8:
       case render_tree::kPixelFormatU8:
       case render_tree::kPixelFormatV8:
diff --git a/src/cobalt/loader/image/png_image_decoder.cc b/src/cobalt/loader/image/png_image_decoder.cc
index 9e9f602..626b6f1 100644
--- a/src/cobalt/loader/image/png_image_decoder.cc
+++ b/src/cobalt/loader/image/png_image_decoder.cc
@@ -327,6 +327,7 @@
         FillRow<false, 2, 1, 0, 3>(width, pixel_data, pixel);
       }
     } break;
+    case render_tree::kPixelFormatUYVY:
     case render_tree::kPixelFormatY8:
     case render_tree::kPixelFormatU8:
     case render_tree::kPixelFormatV8:
diff --git a/src/cobalt/media/base/sbplayer_pipeline.cc b/src/cobalt/media/base/sbplayer_pipeline.cc
index 13db021..5752961 100644
--- a/src/cobalt/media/base/sbplayer_pipeline.cc
+++ b/src/cobalt/media/base/sbplayer_pipeline.cc
@@ -631,6 +631,8 @@
     }
     output_mode_change_cb.Run();
 
+    UpdateDecoderConfig(audio_stream_);
+    UpdateDecoderConfig(video_stream_);
     return;
   }
 
@@ -669,6 +671,7 @@
   DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO);
   DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO);
   if (audio_stream == NULL || video_stream == NULL) {
+    LOG(INFO) << "The video doesn't contain both an audio and a video track.";
     ResetAndRunIfNotNull(&error_cb_, DEMUXER_ERROR_NO_SUPPORTED_STREAMS);
     return;
   }
diff --git a/src/cobalt/media/base/starboard_player.cc b/src/cobalt/media/base/starboard_player.cc
index b0dae0b..d91a113 100644
--- a/src/cobalt/media/base/starboard_player.cc
+++ b/src/cobalt/media/base/starboard_player.cc
@@ -647,6 +647,14 @@
   }
   CHECK_NE(kSbPlayerOutputModeInvalid, output_mode);
 
+#if defined(COBALT_ENABLE_LIB)
+  // When Cobalt is used as a library, it doesn't control the
+  // screen and so punch-out cannot be assumed.  You will need
+  // to implement decode-to-texture support if you wish to use
+  // Cobalt as a library and play videos with it.
+  CHECK_EQ(kSbPlayerOutputModeDecodeToTexture, output_mode)
+#endif  // defined(COBALT_ENABLE_LIB)
+
   return output_mode;
 }
 #endif  // SB_API_VERSION >= 4
diff --git a/src/cobalt/media/blink/BUILD.gn b/src/cobalt/media/blink/BUILD.gn
deleted file mode 100644
index 19b0b58..0000000
--- a/src/cobalt/media/blink/BUILD.gn
+++ /dev/null
@@ -1,155 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//media/media_options.gni")
-import("//testing/test.gni")
-
-component("blink") {
-  output_name = "media_blink"
-
-  deps = [
-    "//base",
-    "//cc",
-    "//cc/blink",
-    "//gpu",
-    "//media",
-    "//media:shared_memory_support",
-    "//net",
-    "//skia",
-    "//third_party/WebKit/public:blink",
-    "//ui/gfx",
-    "//ui/gfx/geometry",
-    "//url",
-  ]
-
-  defines = [ "MEDIA_BLINK_IMPLEMENTATION" ]
-
-  sources = [
-    "active_loader.cc",
-    "active_loader.h",
-    "buffered_data_source_host_impl.cc",
-    "buffered_data_source_host_impl.h",
-    "cache_util.cc",
-    "cache_util.h",
-    "cdm_result_promise.h",
-    "cdm_result_promise_helper.cc",
-    "cdm_result_promise_helper.h",
-    "cdm_session_adapter.cc",
-    "cdm_session_adapter.h",
-    "interval_map.h",
-    "key_system_config_selector.cc",
-    "key_system_config_selector.h",
-    "lru.h",
-    "media_blink_export.h",
-    "multibuffer.cc",
-    "multibuffer.h",
-    "multibuffer_data_source.cc",
-    "multibuffer_data_source.h",
-    "multibuffer_reader.cc",
-    "multibuffer_reader.h",
-    "new_session_cdm_result_promise.cc",
-    "new_session_cdm_result_promise.h",
-    "resource_multibuffer_data_provider.cc",
-    "resource_multibuffer_data_provider.h",
-    "texttrack_impl.cc",
-    "texttrack_impl.h",
-    "url_index.cc",
-    "url_index.h",
-    "video_frame_compositor.cc",
-    "video_frame_compositor.h",
-    "watch_time_reporter.cc",
-    "watch_time_reporter.h",
-    "webaudiosourceprovider_impl.cc",
-    "webaudiosourceprovider_impl.h",
-    "webcontentdecryptionmodule_impl.cc",
-    "webcontentdecryptionmodule_impl.h",
-    "webcontentdecryptionmoduleaccess_impl.cc",
-    "webcontentdecryptionmoduleaccess_impl.h",
-    "webcontentdecryptionmodulesession_impl.cc",
-    "webcontentdecryptionmodulesession_impl.h",
-    "webencryptedmediaclient_impl.cc",
-    "webencryptedmediaclient_impl.h",
-    "webinbandtexttrack_impl.cc",
-    "webinbandtexttrack_impl.h",
-    "webmediaplayer_delegate.h",
-    "webmediaplayer_params.cc",
-    "webmediaplayer_params.h",
-    "webmediaplayer_util.cc",
-    "webmediaplayer_util.h",
-    "webmediasource_impl.cc",
-    "webmediasource_impl.h",
-    "websourcebuffer_impl.cc",
-    "websourcebuffer_impl.h",
-  ]
-
-  if (media_use_ffmpeg || !is_android) {
-    sources += [
-      "webmediaplayer_impl.cc",
-      "webmediaplayer_impl.h",
-    ]
-    if (is_android) {
-      sources += [
-        "webmediaplayer_cast_android.cc",
-        "webmediaplayer_cast_android.h",
-      ]
-      deps += [ "//gpu/command_buffer/client:gles2_interface" ]
-    }
-  }
-}
-
-test("media_blink_unittests") {
-  deps = [
-    ":blink",
-    "//base",
-    "//base/test:test_support",
-    "//cc",
-    "//cc/blink",
-    "//gin",
-    "//media",
-    "//media:shared_memory_support",
-    "//media/base:test_support",
-    "//net",
-    "//testing/gmock",
-    "//testing/gtest",
-    "//third_party/WebKit/public:blink",
-    "//third_party/WebKit/public:test_support",
-    "//ui/gfx:test_support",
-    "//ui/gfx/geometry",
-    "//url",
-  ]
-
-  configs += [
-    "//build/config/compiler:no_size_t_to_int_warning",
-    "//v8:external_startup_data",
-  ]
-
-  sources = [
-    "buffered_data_source_host_impl_unittest.cc",
-    "cache_util_unittest.cc",
-    "interval_map_unittest.cc",
-    "key_system_config_selector_unittest.cc",
-    "lru_unittest.cc",
-    "mock_weburlloader.cc",
-    "mock_weburlloader.h",
-    "multibuffer_data_source_unittest.cc",
-    "multibuffer_unittest.cc",
-    "resource_multibuffer_data_provider_unittest.cc",
-    "run_all_unittests.cc",
-    "test_response_generator.cc",
-    "test_response_generator.h",
-    "url_index_unittest.cc",
-    "video_frame_compositor_unittest.cc",
-    "watch_time_reporter_unittest.cc",
-    "webaudiosourceprovider_impl_unittest.cc",
-    "webmediaplayer_impl_unittest.cc",
-  ]
-
-  if (is_android) {
-    deps += [
-      "//media/base/android",
-      "//media/base/android:media_java",
-      "//v8:v8_external_startup_data_assets",
-    ]
-  }
-}
diff --git a/src/cobalt/media/blink/active_loader.cc b/src/cobalt/media/blink/active_loader.cc
deleted file mode 100644
index ac9cbfd..0000000
--- a/src/cobalt/media/blink/active_loader.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/active_loader.h"
-
-#include <utility>
-
-#include "third_party/WebKit/public/platform/WebURLLoader.h"
-
-namespace cobalt {
-namespace media {
-
-ActiveLoader::ActiveLoader(std::unique_ptr<blink::WebURLLoader> loader)
-    : loader_(std::move(loader)), deferred_(false) {}
-
-ActiveLoader::~ActiveLoader() { loader_->cancel(); }
-
-void ActiveLoader::SetDeferred(bool deferred) {
-  deferred_ = deferred;
-  loader_->setDefersLoading(deferred);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/active_loader.h b/src/cobalt/media/blink/active_loader.h
deleted file mode 100644
index 1d059be..0000000
--- a/src/cobalt/media/blink/active_loader.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_ACTIVE_LOADER_H_
-#define COBALT_MEDIA_BLINK_ACTIVE_LOADER_H_
-
-#include <memory>
-
-#include "base/basictypes.h"
-#include "cobalt/media/blink/media_blink_export.h"
-
-namespace blink {
-class WebURLLoader;
-}
-
-namespace cobalt {
-namespace media {
-
-// Wraps an active WebURLLoader with some additional state.
-//
-// Handles deferring and deletion of loaders.
-class MEDIA_BLINK_EXPORT ActiveLoader {
- public:
-  // Creates an ActiveLoader with the given loader. It is assumed that the
-  // initial state of |loader| is loading and not deferred.
-  explicit ActiveLoader(std::unique_ptr<blink::WebURLLoader> loader);
-  ~ActiveLoader();
-
-  // Starts or stops deferring the resource load.
-  void SetDeferred(bool deferred);
-  bool deferred() { return deferred_; }
-
- private:
-  friend class MultibufferDataSourceTest;
-
-  std::unique_ptr<blink::WebURLLoader> loader_;
-  bool deferred_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_ACTIVE_LOADER_H_
diff --git a/src/cobalt/media/blink/buffered_data_source_host_impl.cc b/src/cobalt/media/blink/buffered_data_source_host_impl.cc
deleted file mode 100644
index 9fb81a2..0000000
--- a/src/cobalt/media/blink/buffered_data_source_host_impl.cc
+++ /dev/null
@@ -1,68 +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.
-
-#include "cobalt/media/blink/buffered_data_source_host_impl.h"
-
-#include "cobalt/media/base/timestamp_constants.h"
-
-namespace cobalt {
-namespace media {
-
-BufferedDataSourceHostImpl::BufferedDataSourceHostImpl()
-    : total_bytes_(0), did_loading_progress_(false) {}
-
-BufferedDataSourceHostImpl::~BufferedDataSourceHostImpl() {}
-
-void BufferedDataSourceHostImpl::SetTotalBytes(int64_t total_bytes) {
-  total_bytes_ = total_bytes;
-}
-
-void BufferedDataSourceHostImpl::AddBufferedByteRange(int64_t start,
-                                                      int64_t end) {
-  const auto i = buffered_byte_ranges_.find(start);
-  if (i.value() && i.interval_end() >= end) {
-    // No change
-    return;
-  }
-  buffered_byte_ranges_.SetInterval(start, end, 1);
-  did_loading_progress_ = true;
-}
-
-static base::TimeDelta TimeForByteOffset(int64_t byte_offset,
-                                         int64_t total_bytes,
-                                         base::TimeDelta duration) {
-  double position = static_cast<double>(byte_offset) / total_bytes;
-  // Snap to the beginning/end where the approximation can look especially bad.
-  if (position < 0.01) return base::TimeDelta();
-  if (position > 0.99) return duration;
-  return base::TimeDelta::FromMilliseconds(
-      static_cast<int64_t>(position * duration.InMilliseconds()));
-}
-
-void BufferedDataSourceHostImpl::AddBufferedTimeRanges(
-    Ranges<base::TimeDelta>* buffered_time_ranges,
-    base::TimeDelta media_duration) const {
-  DCHECK(media_duration != kNoTimestamp);
-  DCHECK(media_duration != kInfiniteDuration);
-  if (total_bytes_ && !buffered_byte_ranges_.empty()) {
-    for (const auto i : buffered_byte_ranges_) {
-      if (i.second) {
-        int64_t start = i.first.begin;
-        int64_t end = i.first.end;
-        buffered_time_ranges->Add(
-            TimeForByteOffset(start, total_bytes_, media_duration),
-            TimeForByteOffset(end, total_bytes_, media_duration));
-      }
-    }
-  }
-}
-
-bool BufferedDataSourceHostImpl::DidLoadingProgress() {
-  bool ret = did_loading_progress_;
-  did_loading_progress_ = false;
-  return ret;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/buffered_data_source_host_impl.h b/src/cobalt/media/blink/buffered_data_source_host_impl.h
deleted file mode 100644
index b15f022..0000000
--- a/src/cobalt/media/blink/buffered_data_source_host_impl.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_
-#define COBALT_MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_
-
-#include "base/basictypes.h"
-#include "base/time.h"
-#include "cobalt/media/base/ranges.h"
-#include "cobalt/media/blink/interval_map.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-
-// Interface for testing purposes.
-class MEDIA_BLINK_EXPORT BufferedDataSourceHost {
- public:
-  // Notify the host of the total size of the media file.
-  virtual void SetTotalBytes(int64_t total_bytes) = 0;
-
-  // Notify the host that byte range [start,end] has been buffered.
-  // TODO(fischman): remove this method when demuxing is push-based instead of
-  // pull-based.  http://crbug.com/131444
-  virtual void AddBufferedByteRange(int64_t start, int64_t end) = 0;
-
- protected:
-  virtual ~BufferedDataSourceHost() {}
-};
-
-// Provides an implementation of BufferedDataSourceHost that translates the
-// buffered byte ranges into estimated time ranges.
-class MEDIA_BLINK_EXPORT BufferedDataSourceHostImpl
-    : public BufferedDataSourceHost {
- public:
-  BufferedDataSourceHostImpl();
-  ~BufferedDataSourceHostImpl() OVERRIDE;
-
-  // BufferedDataSourceHost implementation.
-  void SetTotalBytes(int64_t total_bytes) OVERRIDE;
-  void AddBufferedByteRange(int64_t start, int64_t end) OVERRIDE;
-
-  // Translate the byte ranges to time ranges and append them to the list.
-  // TODO(sandersd): This is a confusing name, find something better.
-  void AddBufferedTimeRanges(Ranges<base::TimeDelta>* buffered_time_ranges,
-                             base::TimeDelta media_duration) const;
-
-  bool DidLoadingProgress();
-
- private:
-  // Total size of the data source.
-  int64_t total_bytes_;
-
-  // List of buffered byte ranges for estimating buffered time.
-  // The InterValMap value is 1 for bytes that are buffered, 0 otherwise.
-  IntervalMap<int64_t, int> buffered_byte_ranges_;
-
-  // True when AddBufferedByteRange() has been called more recently than
-  // DidLoadingProgress().
-  bool did_loading_progress_;
-
-  DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_BUFFERED_DATA_SOURCE_HOST_IMPL_H_
diff --git a/src/cobalt/media/blink/buffered_data_source_host_impl_unittest.cc b/src/cobalt/media/blink/buffered_data_source_host_impl_unittest.cc
deleted file mode 100644
index 51a7613..0000000
--- a/src/cobalt/media/blink/buffered_data_source_host_impl_unittest.cc
+++ /dev/null
@@ -1,78 +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.
-
-#include "base/basictypes.h"
-#include "cobalt/media/blink/buffered_data_source_host_impl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-
-class BufferedDataSourceHostImplTest : public testing::Test {
- public:
-  BufferedDataSourceHostImplTest() {}
-
-  void Add() {
-    host_.AddBufferedTimeRanges(&ranges_, base::TimeDelta::FromSeconds(10));
-  }
-
- protected:
-  BufferedDataSourceHostImpl host_;
-  Ranges<base::TimeDelta> ranges_;
-
-  DISALLOW_COPY_AND_ASSIGN(BufferedDataSourceHostImplTest);
-};
-
-TEST_F(BufferedDataSourceHostImplTest, Empty) {
-  EXPECT_FALSE(host_.DidLoadingProgress());
-  Add();
-  EXPECT_EQ(0u, ranges_.size());
-}
-
-TEST_F(BufferedDataSourceHostImplTest, AddBufferedTimeRanges) {
-  host_.AddBufferedByteRange(10, 20);
-  host_.SetTotalBytes(100);
-  Add();
-  EXPECT_EQ(1u, ranges_.size());
-  EXPECT_EQ(base::TimeDelta::FromSeconds(1), ranges_.start(0));
-  EXPECT_EQ(base::TimeDelta::FromSeconds(2), ranges_.end(0));
-}
-
-TEST_F(BufferedDataSourceHostImplTest, AddBufferedTimeRanges_Merges) {
-  ranges_.Add(base::TimeDelta::FromSeconds(0), base::TimeDelta::FromSeconds(1));
-  host_.AddBufferedByteRange(10, 20);
-  host_.SetTotalBytes(100);
-  Add();
-  EXPECT_EQ(1u, ranges_.size());
-  EXPECT_EQ(base::TimeDelta::FromSeconds(0), ranges_.start(0));
-  EXPECT_EQ(base::TimeDelta::FromSeconds(2), ranges_.end(0));
-}
-
-TEST_F(BufferedDataSourceHostImplTest, AddBufferedTimeRanges_Snaps) {
-  host_.AddBufferedByteRange(5, 995);
-  host_.SetTotalBytes(1000);
-  Add();
-  EXPECT_EQ(1u, ranges_.size());
-  EXPECT_EQ(base::TimeDelta::FromSeconds(0), ranges_.start(0));
-  EXPECT_EQ(base::TimeDelta::FromSeconds(10), ranges_.end(0));
-}
-
-TEST_F(BufferedDataSourceHostImplTest, SetTotalBytes) {
-  host_.AddBufferedByteRange(10, 20);
-  Add();
-  EXPECT_EQ(0u, ranges_.size());
-
-  host_.SetTotalBytes(100);
-  Add();
-  EXPECT_EQ(1u, ranges_.size());
-}
-
-TEST_F(BufferedDataSourceHostImplTest, DidLoadingProgress) {
-  host_.AddBufferedByteRange(10, 20);
-  EXPECT_TRUE(host_.DidLoadingProgress());
-  EXPECT_FALSE(host_.DidLoadingProgress());
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/cache_util.cc b/src/cobalt/media/blink/cache_util.cc
deleted file mode 100644
index bac066a..0000000
--- a/src/cobalt/media/blink/cache_util.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/cache_util.h"
-
-#include <algorithm>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/string_number_conversions.h"
-#include "base/string_util.h"
-#include "base/time.h"
-#include "net/http/http_util.h"
-#include "net/http/http_version.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-
-using base::Time;
-using base::TimeDelta;
-using net::HttpVersion;
-using blink::WebURLResponse;
-
-namespace cobalt {
-namespace media {
-
-enum { kHttpOK = 200, kHttpPartialContent = 206 };
-
-uint32_t GetReasonsForUncacheability(const WebURLResponse& response) {
-  uint32_t reasons = 0;
-  const int code = response.httpStatusCode();
-  const int version = response.httpVersion();
-  const HttpVersion http_version =
-      version == WebURLResponse::HTTPVersion_2_0
-          ? HttpVersion(2, 0)
-          : version == WebURLResponse::HTTPVersion_1_1
-                ? HttpVersion(1, 1)
-                : version == WebURLResponse::HTTPVersion_1_0
-                      ? HttpVersion(1, 0)
-                      : version == WebURLResponse::HTTPVersion_0_9
-                            ? HttpVersion(0, 9)
-                            : HttpVersion();
-  if (code != kHttpOK && code != kHttpPartialContent) reasons |= kNoData;
-  if (http_version < HttpVersion(1, 1) && code == kHttpPartialContent)
-    reasons |= kPre11PartialResponse;
-  if (code == kHttpPartialContent &&
-      !net::HttpUtil::HasStrongValidators(
-          http_version, response.httpHeaderField("etag").utf8(),
-          response.httpHeaderField("Last-Modified").utf8(),
-          response.httpHeaderField("Date").utf8())) {
-    reasons |= kNoStrongValidatorOnPartialResponse;
-  }
-
-  std::string cache_control_header =
-      base::ToLowerASCII(response.httpHeaderField("cache-control").utf8());
-  if (cache_control_header.find("no-cache") != std::string::npos)
-    reasons |= kNoCache;
-  if (cache_control_header.find("no-store") != std::string::npos)
-    reasons |= kNoStore;
-  if (cache_control_header.find("must-revalidate") != std::string::npos)
-    reasons |= kHasMustRevalidate;
-
-  const TimeDelta kMinimumAgeForUsefulness =
-      TimeDelta::FromSeconds(3600);  // Arbitrary value.
-
-  const char kMaxAgePrefix[] = "max-age=";
-  const size_t kMaxAgePrefixLen = arraysize(kMaxAgePrefix) - 1;
-  if (cache_control_header.substr(0, kMaxAgePrefixLen) == kMaxAgePrefix) {
-    int64_t max_age_seconds;
-    base::StringToInt64(
-        base::StringPiece(cache_control_header.begin() + kMaxAgePrefixLen,
-                          cache_control_header.end()),
-        &max_age_seconds);
-    if (TimeDelta::FromSeconds(max_age_seconds) < kMinimumAgeForUsefulness)
-      reasons |= kShortMaxAge;
-  }
-
-  Time date;
-  Time expires;
-  if (Time::FromString(response.httpHeaderField("Date").utf8().data(), &date) &&
-      Time::FromString(response.httpHeaderField("Expires").utf8().data(),
-                       &expires) &&
-      date > Time() && expires > Time() &&
-      (expires - date) < kMinimumAgeForUsefulness) {
-    reasons |= kExpiresTooSoon;
-  }
-
-  return reasons;
-}
-
-base::TimeDelta GetCacheValidUntil(const WebURLResponse& response) {
-  std::string cache_control_header =
-      base::ToLowerASCII(response.httpHeaderField("cache-control").utf8());
-  if (cache_control_header.find("no-cache") != std::string::npos)
-    return base::TimeDelta();
-  if (cache_control_header.find("must-revalidate") != std::string::npos)
-    return base::TimeDelta();
-
-  // Max cache timeout ~= 1 month.
-  base::TimeDelta ret = base::TimeDelta::FromDays(30);
-
-  const char kMaxAgePrefix[] = "max-age=";
-  const size_t kMaxAgePrefixLen = arraysize(kMaxAgePrefix) - 1;
-  if (cache_control_header.substr(0, kMaxAgePrefixLen) == kMaxAgePrefix) {
-    int64_t max_age_seconds;
-    base::StringToInt64(
-        base::StringPiece(cache_control_header.begin() + kMaxAgePrefixLen,
-                          cache_control_header.end()),
-        &max_age_seconds);
-
-    ret = std::min(ret, TimeDelta::FromSeconds(max_age_seconds));
-  } else {
-    // Note that |date| may be smaller than |expires|, which means we'll
-    // return a timetick some time in the past.
-    Time date;
-    Time expires;
-    if (Time::FromString(response.httpHeaderField("Date").utf8().data(),
-                         &date) &&
-        Time::FromString(response.httpHeaderField("Expires").utf8().data(),
-                         &expires) &&
-        date > Time() && expires > Time()) {
-      ret = std::min(ret, expires - date);
-    }
-  }
-
-  return ret;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/cache_util.h b/src/cobalt/media/blink/cache_util.h
deleted file mode 100644
index d3e6a92..0000000
--- a/src/cobalt/media/blink/cache_util.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_CACHE_UTIL_H_
-#define COBALT_MEDIA_BLINK_CACHE_UTIL_H_
-
-#include <vector>
-
-#include "base/time.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "starboard/types.h"
-
-namespace blink {
-class WebURLResponse;
-}
-
-namespace cobalt {
-namespace media {
-
-// Reasons that a cached WebURLResponse will *not* prevent a future request to
-// the server.  Reported via UMA, so don't change/reuse previously-existing
-// values.
-enum UncacheableReason {
-  kNoData = 1 << 0,                              // Not 200 or 206.
-  kPre11PartialResponse = 1 << 1,                // 206 but HTTP version < 1.1.
-  kNoStrongValidatorOnPartialResponse = 1 << 2,  // 206, no strong validator.
-  kShortMaxAge = 1 << 3,        // Max age less than 1h (arbitrary value).
-  kExpiresTooSoon = 1 << 4,     // Expires in less than 1h (arbitrary value).
-  kHasMustRevalidate = 1 << 5,  // Response asks for revalidation.
-  kNoCache = 1 << 6,            // Response included a no-cache header.
-  kNoStore = 1 << 7,            // Response included a no-store header.
-  kMaxReason  // Needs to be one more than max legitimate reason.
-};
-
-// Return the logical OR of the reasons "response" cannot be used for a future
-// request (using the disk cache), or 0 if it might be useful.
-uint32_t MEDIA_BLINK_EXPORT
-GetReasonsForUncacheability(const blink::WebURLResponse& response);
-
-// Returns when we should evict data from this response from our
-// memory cache. Note that we may still cache data longer if
-// a audio/video tag is currently using it. Returns a TimeDelta
-// which is should be added to base::Time::Now() or base::TimeTicks::Now().
-base::TimeDelta MEDIA_BLINK_EXPORT
-GetCacheValidUntil(const blink::WebURLResponse& response);
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_CACHE_UTIL_H_
diff --git a/src/cobalt/media/blink/cache_util_unittest.cc b/src/cobalt/media/blink/cache_util_unittest.cc
deleted file mode 100644
index 0eb174b..0000000
--- a/src/cobalt/media/blink/cache_util_unittest.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/cache_util.h"
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/format_macros.h"
-#include "base/string_number_conversions.h"
-#include "base/string_split.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-
-using blink::WebString;
-using blink::WebURLResponse;
-
-namespace cobalt {
-namespace media {
-
-// Inputs & expected output for GetReasonsForUncacheability.
-struct GRFUTestCase {
-  WebURLResponse::HTTPVersion version;
-  int status_code;
-  const char* headers;
-  uint32_t expected_reasons;
-};
-
-// Create a new WebURLResponse object.
-static WebURLResponse CreateResponse(const GRFUTestCase& test) {
-  WebURLResponse response;
-  response.setHTTPVersion(test.version);
-  response.setHTTPStatusCode(test.status_code);
-  for (const std::string& line :
-       base::SplitString(test.headers, "\n", base::KEEP_WHITESPACE,
-                         base::SPLIT_WANT_NONEMPTY)) {
-    size_t colon = line.find(": ");
-    response.addHTTPHeaderField(WebString::fromUTF8(line.substr(0, colon)),
-                                WebString::fromUTF8(line.substr(colon + 2)));
-  }
-  return response;
-}
-
-TEST(CacheUtilTest, GetReasonsForUncacheability) {
-  enum { kNoReasons = 0 };
-
-  const GRFUTestCase tests[] = {
-      {WebURLResponse::HTTPVersion_1_1, 206, "ETag: 'fooblort'", kNoReasons},
-      {WebURLResponse::HTTPVersion_1_1, 206, "",
-       kNoStrongValidatorOnPartialResponse},
-      {WebURLResponse::HTTPVersion_1_0, 206, "",
-       kPre11PartialResponse | kNoStrongValidatorOnPartialResponse},
-      {WebURLResponse::HTTPVersion_1_1, 200, "cache-control: max-Age=42",
-       kShortMaxAge},
-      {WebURLResponse::HTTPVersion_1_1, 200, "cache-control: max-Age=4200",
-       kNoReasons},
-      {WebURLResponse::HTTPVersion_1_1, 200,
-       "Date: Tue, 22 May 2012 23:46:08 GMT\n"
-       "Expires: Tue, 22 May 2012 23:56:08 GMT",
-       kExpiresTooSoon},
-      {WebURLResponse::HTTPVersion_1_1, 200, "cache-control: must-revalidate",
-       kHasMustRevalidate},
-      {WebURLResponse::HTTPVersion_1_1, 200, "cache-control: no-cache",
-       kNoCache},
-      {WebURLResponse::HTTPVersion_1_1, 200, "cache-control: no-store",
-       kNoStore},
-      {WebURLResponse::HTTPVersion_1_1, 200,
-       "cache-control: no-cache\ncache-control: no-store", kNoCache | kNoStore},
-  };
-  for (size_t i = 0; i < arraysize(tests); ++i) {
-    SCOPED_TRACE(base::StringPrintf(
-        "case: %" PRIuS ", version: %d, code: %d, headers: %s", i,
-        tests[i].version, tests[i].status_code, tests[i].headers));
-    EXPECT_EQ(GetReasonsForUncacheability(CreateResponse(tests[i])),
-              tests[i].expected_reasons);
-  }
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/cdm_result_promise.h b/src/cobalt/media/blink/cdm_result_promise.h
deleted file mode 100644
index a063c4f..0000000
--- a/src/cobalt/media/blink/cdm_result_promise.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_CDM_RESULT_PROMISE_H_
-#define COBALT_MEDIA_BLINK_CDM_RESULT_PROMISE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "cobalt/media/base/cdm_promise.h"
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/blink/cdm_result_promise_helper.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-// Used to convert a WebContentDecryptionModuleResult into a CdmPromiseTemplate
-// so that it can be passed through Chromium. When resolve(T) is called, the
-// appropriate complete...() method on WebContentDecryptionModuleResult will be
-// invoked. If reject() is called instead,
-// WebContentDecryptionModuleResult::completeWithError() is called.
-// If constructed with a |uma_name|, CdmResultPromise will report the promise
-// result (success or rejection code) to UMA.
-template <typename... T>
-class CdmResultPromise : public CdmPromiseTemplate<T...> {
- public:
-  CdmResultPromise(const blink::WebContentDecryptionModuleResult& result,
-                   const std::string& uma_name);
-  ~CdmResultPromise() OVERRIDE;
-
-  // CdmPromiseTemplate<T> implementation.
-  void resolve(const T&... result) OVERRIDE;
-  void reject(MediaKeys::Exception exception_code, uint32_t system_code,
-              const std::string& error_message) OVERRIDE;
-
- private:
-  using CdmPromiseTemplate<T...>::IsPromiseSettled;
-  using CdmPromiseTemplate<T...>::MarkPromiseSettled;
-  using CdmPromiseTemplate<T...>::RejectPromiseOnDestruction;
-
-  blink::WebContentDecryptionModuleResult web_cdm_result_;
-
-  // UMA name to report result to.
-  std::string uma_name_;
-
-  DISALLOW_COPY_AND_ASSIGN(CdmResultPromise);
-};
-
-template <typename... T>
-CdmResultPromise<T...>::CdmResultPromise(
-    const blink::WebContentDecryptionModuleResult& result,
-    const std::string& uma_name)
-    : web_cdm_result_(result), uma_name_(uma_name) {}
-
-template <typename... T>
-CdmResultPromise<T...>::~CdmResultPromise() {
-  if (!IsPromiseSettled()) RejectPromiseOnDestruction();
-}
-
-// "inline" is needed to prevent multiple definition error.
-
-template <>
-inline void CdmResultPromise<>::resolve() {
-  MarkPromiseSettled();
-  ReportCdmResultUMA(uma_name_, SUCCESS);
-  web_cdm_result_.complete();
-}
-
-template <typename... T>
-void CdmResultPromise<T...>::reject(MediaKeys::Exception exception_code,
-                                    uint32_t system_code,
-                                    const std::string& error_message) {
-  MarkPromiseSettled();
-  ReportCdmResultUMA(uma_name_,
-                     ConvertCdmExceptionToResultForUMA(exception_code));
-  web_cdm_result_.completeWithError(ConvertCdmException(exception_code),
-                                    system_code,
-                                    blink::WebString::fromUTF8(error_message));
-}
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_CDM_RESULT_PROMISE_H_
diff --git a/src/cobalt/media/blink/cdm_result_promise_helper.cc b/src/cobalt/media/blink/cdm_result_promise_helper.cc
deleted file mode 100644
index 98e74f2..0000000
--- a/src/cobalt/media/blink/cdm_result_promise_helper.cc
+++ /dev/null
@@ -1,67 +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.
-
-#include "cobalt/media/blink/cdm_result_promise_helper.h"
-
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-
-namespace cobalt {
-namespace media {
-
-CdmResultForUMA ConvertCdmExceptionToResultForUMA(
-    MediaKeys::Exception exception_code) {
-  switch (exception_code) {
-    case MediaKeys::NOT_SUPPORTED_ERROR:
-      return NOT_SUPPORTED_ERROR;
-    case MediaKeys::INVALID_STATE_ERROR:
-      return INVALID_STATE_ERROR;
-    case MediaKeys::INVALID_ACCESS_ERROR:
-      return INVALID_ACCESS_ERROR;
-    case MediaKeys::QUOTA_EXCEEDED_ERROR:
-      return QUOTA_EXCEEDED_ERROR;
-    case MediaKeys::UNKNOWN_ERROR:
-      return UNKNOWN_ERROR;
-    case MediaKeys::CLIENT_ERROR:
-      return CLIENT_ERROR;
-    case MediaKeys::OUTPUT_ERROR:
-      return OUTPUT_ERROR;
-  }
-  NOTREACHED();
-  return UNKNOWN_ERROR;
-}
-
-blink::WebContentDecryptionModuleException ConvertCdmException(
-    MediaKeys::Exception exception_code) {
-  switch (exception_code) {
-    case MediaKeys::NOT_SUPPORTED_ERROR:
-      return blink::WebContentDecryptionModuleExceptionNotSupportedError;
-    case MediaKeys::INVALID_STATE_ERROR:
-      return blink::WebContentDecryptionModuleExceptionInvalidStateError;
-    case MediaKeys::INVALID_ACCESS_ERROR:
-      return blink::WebContentDecryptionModuleExceptionInvalidAccessError;
-    case MediaKeys::QUOTA_EXCEEDED_ERROR:
-      return blink::WebContentDecryptionModuleExceptionQuotaExceededError;
-    case MediaKeys::UNKNOWN_ERROR:
-      return blink::WebContentDecryptionModuleExceptionUnknownError;
-    case MediaKeys::CLIENT_ERROR:
-      return blink::WebContentDecryptionModuleExceptionClientError;
-    case MediaKeys::OUTPUT_ERROR:
-      return blink::WebContentDecryptionModuleExceptionOutputError;
-  }
-  NOTREACHED();
-  return blink::WebContentDecryptionModuleExceptionUnknownError;
-}
-
-void ReportCdmResultUMA(const std::string& uma_name, CdmResultForUMA result) {
-  if (uma_name.empty()) return;
-
-  base::LinearHistogram::FactoryGet(
-      uma_name, 1, NUM_RESULT_CODES, NUM_RESULT_CODES + 1,
-      base::HistogramBase::kUmaTargetedHistogramFlag)
-      ->Add(result);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/cdm_result_promise_helper.h b/src/cobalt/media/blink/cdm_result_promise_helper.h
deleted file mode 100644
index 83327b2..0000000
--- a/src/cobalt/media/blink/cdm_result_promise_helper.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_CDM_RESULT_PROMISE_HELPER_H_
-#define COBALT_MEDIA_BLINK_CDM_RESULT_PROMISE_HELPER_H_
-
-#include <string>
-
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-
-namespace cobalt {
-namespace media {
-
-// A superset of media::MediaKeys::Exception for UMA reporting. These values
-// should never be changed as it will affect existing reporting, and must match
-// the values for CdmPromiseResult in tools/metrics/histograms/histograms.xml.
-enum CdmResultForUMA {
-  SUCCESS = 0,
-  NOT_SUPPORTED_ERROR = 1,
-  INVALID_STATE_ERROR = 2,
-  INVALID_ACCESS_ERROR = 3,
-  QUOTA_EXCEEDED_ERROR = 4,
-  UNKNOWN_ERROR = 5,
-  CLIENT_ERROR = 6,
-  OUTPUT_ERROR = 7,
-  NUM_RESULT_CODES
-};
-
-MEDIA_BLINK_EXPORT CdmResultForUMA
-ConvertCdmExceptionToResultForUMA(MediaKeys::Exception exception_code);
-
-MEDIA_BLINK_EXPORT blink::WebContentDecryptionModuleException
-ConvertCdmException(MediaKeys::Exception exception_code);
-
-MEDIA_BLINK_EXPORT void ReportCdmResultUMA(const std::string& uma_name,
-                                           CdmResultForUMA result);
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_CDM_RESULT_PROMISE_HELPER_H_
diff --git a/src/cobalt/media/blink/cdm_session_adapter.cc b/src/cobalt/media/blink/cdm_session_adapter.cc
deleted file mode 100644
index 5b69b89..0000000
--- a/src/cobalt/media/blink/cdm_session_adapter.cc
+++ /dev/null
@@ -1,219 +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.
-
-#include "cobalt/media/blink/cdm_session_adapter.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-#include "base/stl_util.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/trace_event/trace_event.h"
-#include "cobalt/media/base/cdm_factory.h"
-#include "cobalt/media/base/cdm_key_information.h"
-#include "cobalt/media/base/cdm_promise.h"
-#include "cobalt/media/base/key_systems.h"
-#include "cobalt/media/blink/webcontentdecryptionmodule_impl.h"
-#include "cobalt/media/blink/webcontentdecryptionmodulesession_impl.h"
-#include "googleurl/src/gurl.h"
-
-namespace cobalt {
-namespace media {
-
-namespace {
-const char kMediaEME[] = "Media.EME.";
-const char kDot[] = ".";
-const char kTimeToCreateCdmUMAName[] = "CreateCdmTime";
-}  // namespace
-
-CdmSessionAdapter::CdmSessionAdapter()
-    : trace_id_(0), weak_ptr_factory_(this) {}
-
-CdmSessionAdapter::~CdmSessionAdapter() {}
-
-void CdmSessionAdapter::CreateCdm(
-    CdmFactory* cdm_factory, const std::string& key_system,
-    const GURL& security_origin, const CdmConfig& cdm_config,
-    std::unique_ptr<blink::WebContentDecryptionModuleResult> result) {
-  TRACE_EVENT_ASYNC_BEGIN0("media", "CdmSessionAdapter::CreateCdm",
-                           ++trace_id_);
-
-  base::TimeTicks start_time = base::TimeTicks::Now();
-
-  // Note: WebContentDecryptionModuleImpl::Create() calls this method without
-  // holding a reference to the CdmSessionAdapter. Bind OnCdmCreated() with
-  // |this| instead of |weak_this| to prevent |this| from being destructed.
-  base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr();
-
-  DCHECK(!cdm_created_result_);
-  cdm_created_result_ = std::move(result);
-
-  cdm_factory->Create(
-      key_system, security_origin, cdm_config,
-      base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this),
-      base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this),
-      base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this),
-      base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this),
-      base::Bind(&CdmSessionAdapter::OnCdmCreated, this, key_system,
-                 start_time));
-}
-
-void CdmSessionAdapter::SetServerCertificate(
-    const std::vector<uint8_t>& certificate,
-    std::unique_ptr<SimpleCdmPromise> promise) {
-  cdm_->SetServerCertificate(certificate, std::move(promise));
-}
-
-WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::CreateSession() {
-  return new WebContentDecryptionModuleSessionImpl(this);
-}
-
-bool CdmSessionAdapter::RegisterSession(
-    const std::string& session_id,
-    base::WeakPtr<WebContentDecryptionModuleSessionImpl> session) {
-  // If this session ID is already registered, don't register it again.
-  if (base::ContainsKey(sessions_, session_id)) return false;
-
-  sessions_[session_id] = session;
-  return true;
-}
-
-void CdmSessionAdapter::UnregisterSession(const std::string& session_id) {
-  DCHECK(base::ContainsKey(sessions_, session_id));
-  sessions_.erase(session_id);
-}
-
-void CdmSessionAdapter::InitializeNewSession(
-    EmeInitDataType init_data_type, const std::vector<uint8_t>& init_data,
-    MediaKeys::SessionType session_type,
-    std::unique_ptr<NewSessionCdmPromise> promise) {
-  cdm_->CreateSessionAndGenerateRequest(session_type, init_data_type, init_data,
-                                        std::move(promise));
-}
-
-void CdmSessionAdapter::LoadSession(
-    MediaKeys::SessionType session_type, const std::string& session_id,
-    std::unique_ptr<NewSessionCdmPromise> promise) {
-  cdm_->LoadSession(session_type, session_id, std::move(promise));
-}
-
-void CdmSessionAdapter::UpdateSession(
-    const std::string& session_id, const std::vector<uint8_t>& response,
-    std::unique_ptr<SimpleCdmPromise> promise) {
-  cdm_->UpdateSession(session_id, response, std::move(promise));
-}
-
-void CdmSessionAdapter::CloseSession(
-    const std::string& session_id, std::unique_ptr<SimpleCdmPromise> promise) {
-  cdm_->CloseSession(session_id, std::move(promise));
-}
-
-void CdmSessionAdapter::RemoveSession(
-    const std::string& session_id, std::unique_ptr<SimpleCdmPromise> promise) {
-  cdm_->RemoveSession(session_id, std::move(promise));
-}
-
-scoped_refptr<MediaKeys> CdmSessionAdapter::GetCdm() { return cdm_; }
-
-const std::string& CdmSessionAdapter::GetKeySystem() const {
-  return key_system_;
-}
-
-const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const {
-  DCHECK(!key_system_uma_prefix_.empty());
-  return key_system_uma_prefix_;
-}
-
-void CdmSessionAdapter::OnCdmCreated(const std::string& key_system,
-                                     base::TimeTicks start_time,
-                                     const scoped_refptr<MediaKeys>& cdm,
-                                     const std::string& error_message) {
-  DVLOG(2) << __func__ << ": "
-           << (cdm ? "success" : "failure (" + error_message + ")");
-  DCHECK(!cdm_);
-
-  TRACE_EVENT_ASYNC_END2("media", "CdmSessionAdapter::CreateCdm", trace_id_,
-                         "success", (cdm ? "true" : "false"), "error_message",
-                         error_message);
-
-  if (!cdm) {
-    cdm_created_result_->completeWithError(
-        blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
-        blink::WebString::fromUTF8(error_message));
-    cdm_created_result_.reset();
-    return;
-  }
-
-  key_system_ = key_system;
-  key_system_uma_prefix_ =
-      kMediaEME + GetKeySystemNameForUMA(key_system) + kDot;
-
-  // Only report time for successful CDM creation.
-  ReportTimeToCreateCdmUMA(base::TimeTicks::Now() - start_time);
-
-  cdm_ = cdm;
-
-  cdm_created_result_->completeWithContentDecryptionModule(
-      new WebContentDecryptionModuleImpl(this));
-  cdm_created_result_.reset();
-}
-
-void CdmSessionAdapter::OnSessionMessage(const std::string& session_id,
-                                         MediaKeys::MessageType message_type,
-                                         const std::vector<uint8_t>& message) {
-  WebContentDecryptionModuleSessionImpl* session = GetSession(session_id);
-  DLOG_IF(WARNING, !session) << __func__ << " for unknown session "
-                             << session_id;
-  if (session) session->OnSessionMessage(message_type, message);
-}
-
-void CdmSessionAdapter::OnSessionKeysChange(const std::string& session_id,
-                                            bool has_additional_usable_key,
-                                            CdmKeysInfo keys_info) {
-  WebContentDecryptionModuleSessionImpl* session = GetSession(session_id);
-  DLOG_IF(WARNING, !session) << __func__ << " for unknown session "
-                             << session_id;
-  if (session)
-    session->OnSessionKeysChange(has_additional_usable_key,
-                                 std::move(keys_info));
-}
-
-void CdmSessionAdapter::OnSessionExpirationUpdate(
-    const std::string& session_id, const base::Time& new_expiry_time) {
-  WebContentDecryptionModuleSessionImpl* session = GetSession(session_id);
-  DLOG_IF(WARNING, !session) << __func__ << " for unknown session "
-                             << session_id;
-  if (session) session->OnSessionExpirationUpdate(new_expiry_time);
-}
-
-void CdmSessionAdapter::OnSessionClosed(const std::string& session_id) {
-  WebContentDecryptionModuleSessionImpl* session = GetSession(session_id);
-  DLOG_IF(WARNING, !session) << __func__ << " for unknown session "
-                             << session_id;
-  if (session) session->OnSessionClosed();
-}
-
-WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession(
-    const std::string& session_id) {
-  // Since session objects may get garbage collected, it is possible that there
-  // are events coming back from the CDM and the session has been unregistered.
-  // We can not tell if the CDM is firing events at sessions that never existed.
-  SessionMap::iterator session = sessions_.find(session_id);
-  return (session != sessions_.end()) ? session->second.get() : NULL;
-}
-
-void CdmSessionAdapter::ReportTimeToCreateCdmUMA(base::TimeDelta time) const {
-  // Note: This leaks memory, which is expected behavior.
-  base::HistogramBase* histogram = base::Histogram::FactoryTimeGet(
-      GetKeySystemUMAPrefix() + kTimeToCreateCdmUMAName,
-      base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10),
-      50, base::HistogramBase::kUmaTargetedHistogramFlag);
-
-  histogram->AddTime(time);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/cdm_session_adapter.h b/src/cobalt/media/blink/cdm_session_adapter.h
deleted file mode 100644
index c22fc2e..0000000
--- a/src/cobalt/media/blink/cdm_session_adapter.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
-#define COBALT_MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/hash_tables.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "cobalt/media/base/media_keys.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h"
-
-class GURL;
-
-namespace cobalt {
-namespace media {
-
-struct CdmConfig;
-class CdmFactory;
-class WebContentDecryptionModuleSessionImpl;
-
-// Owns the CDM instance and makes calls from session objects to the CDM.
-// Forwards the session ID-based callbacks of the MediaKeys interface to the
-// appropriate session object. Callers should hold references to this class
-// as long as they need the CDM instance.
-class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> {
- public:
-  CdmSessionAdapter();
-
-  // Creates the CDM for |key_system| using |cdm_factory| and returns the result
-  // via |result|.
-  void CreateCdm(
-      CdmFactory* cdm_factory, const std::string& key_system,
-      const GURL& security_origin, const CdmConfig& cdm_config,
-      std::unique_ptr<blink::WebContentDecryptionModuleResult> result);
-
-  // Provides a server certificate to be used to encrypt messages to the
-  // license server.
-  void SetServerCertificate(const std::vector<uint8_t>& certificate,
-                            std::unique_ptr<SimpleCdmPromise> promise);
-
-  // Creates a new session and adds it to the internal map. The caller owns the
-  // created session. RemoveSession() must be called when destroying it, if
-  // RegisterSession() was called.
-  WebContentDecryptionModuleSessionImpl* CreateSession();
-
-  // Adds a session to the internal map. Called once the session is successfully
-  // initialized. Returns true if the session was registered, false if there is
-  // already an existing session with the same |session_id|.
-  bool RegisterSession(
-      const std::string& session_id,
-      base::WeakPtr<WebContentDecryptionModuleSessionImpl> session);
-
-  // Removes a session from the internal map.
-  void UnregisterSession(const std::string& session_id);
-
-  // Initializes a session with the |init_data_type|, |init_data| and
-  // |session_type| provided.
-  void InitializeNewSession(EmeInitDataType init_data_type,
-                            const std::vector<uint8_t>& init_data,
-                            MediaKeys::SessionType session_type,
-                            std::unique_ptr<NewSessionCdmPromise> promise);
-
-  // Loads the session specified by |session_id|.
-  void LoadSession(MediaKeys::SessionType session_type,
-                   const std::string& session_id,
-                   std::unique_ptr<NewSessionCdmPromise> promise);
-
-  // Updates the session specified by |session_id| with |response|.
-  void UpdateSession(const std::string& session_id,
-                     const std::vector<uint8_t>& response,
-                     std::unique_ptr<SimpleCdmPromise> promise);
-
-  // Closes the session specified by |session_id|.
-  void CloseSession(const std::string& session_id,
-                    std::unique_ptr<SimpleCdmPromise> promise);
-
-  // Removes stored session data associated with the session specified by
-  // |session_id|.
-  void RemoveSession(const std::string& session_id,
-                     std::unique_ptr<SimpleCdmPromise> promise);
-
-  // Returns a reference to the CDM.
-  scoped_refptr<MediaKeys> GetCdm();
-
-  // Returns the key system name.
-  const std::string& GetKeySystem() const;
-
-  // Returns a prefix to use for UMAs.
-  const std::string& GetKeySystemUMAPrefix() const;
-
- private:
-  friend class base::RefCounted<CdmSessionAdapter>;
-
-  // Session ID to WebContentDecryptionModuleSessionImpl mapping.
-  typedef base::hash_map<std::string,
-                         base::WeakPtr<WebContentDecryptionModuleSessionImpl> >
-      SessionMap;
-
-  ~CdmSessionAdapter();
-
-  // Callback for CreateCdm().
-  void OnCdmCreated(const std::string& key_system, base::TimeTicks start_time,
-                    const scoped_refptr<MediaKeys>& cdm,
-                    const std::string& error_message);
-
-  // Callbacks for firing session events.
-  void OnSessionMessage(const std::string& session_id,
-                        MediaKeys::MessageType message_type,
-                        const std::vector<uint8_t>& message);
-  void OnSessionKeysChange(const std::string& session_id,
-                           bool has_additional_usable_key,
-                           CdmKeysInfo keys_info);
-  void OnSessionExpirationUpdate(const std::string& session_id,
-                                 const base::Time& new_expiry_time);
-  void OnSessionClosed(const std::string& session_id);
-
-  // Helper function of the callbacks.
-  WebContentDecryptionModuleSessionImpl* GetSession(
-      const std::string& session_id);
-
-  void ReportTimeToCreateCdmUMA(base::TimeDelta cdm_creation_time) const;
-
-  scoped_refptr<MediaKeys> cdm_;
-
-  SessionMap sessions_;
-
-  std::string key_system_;
-  std::string key_system_uma_prefix_;
-
-  // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching
-  // OnCdmCreated() call.
-  uint32_t trace_id_;
-
-  std::unique_ptr<blink::WebContentDecryptionModuleResult> cdm_created_result_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
diff --git a/src/cobalt/media/blink/interval_map.h b/src/cobalt/media/blink/interval_map.h
deleted file mode 100644
index b516052..0000000
--- a/src/cobalt/media/blink/interval_map.h
+++ /dev/null
@@ -1,288 +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 COBALT_MEDIA_BLINK_INTERVAL_MAP_H_
-#define COBALT_MEDIA_BLINK_INTERVAL_MAP_H_
-
-#include <algorithm>
-#include <functional>
-#include <limits>
-#include <map>
-#include <utility>
-
-#include "base/logging.h"
-
-namespace cobalt {
-namespace media {
-
-// An IntervalMap<KeyType, ValueType> maps every value of KeyType to
-// a ValueType, and incrementing, decrementing and setting ranges of values
-// has been optimized. The default state is to map all values in
-// KeyType to ValueType(). (Which is usually zero.)
-//
-// Set/Increment operations should generally take
-// O(log(N)) + O(M) time where N is the number of intervals in the map and
-// M is the number of modified intervals.
-//
-// Internally, IntervalMap<> uses an std::map, where the beginning of each
-// interval is stored along with the value for that interval. Adjacent intervals
-// which have the same value are automatically merged. For instance, if you did:
-//
-// IntervalMap<int, int> tmp;
-// tmp.IncrementInterval(2, 5, 2);
-// tmp.IncrementInterval(4, 6, 1);
-//
-// Then:
-//  tmp[0] = 0
-//  tmp[1] = 0
-//  tmp[2] = 2
-//  tmp[3] = 2
-//  tmp[4] = 3
-//  tmp[5] = 1
-//  tmp[6] = 0
-//
-// If you iterate over tmp, you get the following intervals:
-//  -maxint .. 2 => 0
-//  2 .. 4 => 2
-//  4 .. 5 => 3
-//  5 .. 6 => 1
-//  6 .. maxint => 0
-//
-// Internally, this would be stored in a map as:
-//    -maxint:0, 2:2, 4:3, 5:1, 6:0
-//
-// TODO(hubbe): Consider consolidating with media::Ranges.
-
-// Simple interval class.
-// Interval ends are always non-inclusive.
-// Please note that end <= begin is a valid (but empty) interval.
-template <typename T>
-struct Interval {
- public:
-  Interval(const T& begin, const T& end) : begin(begin), end(end) {}
-
-  // May return empty intervals (begin >= end).
-  Interval Intersect(const Interval& other) const {
-    return Interval(std::max(begin, other.begin), std::min(end, other.end));
-  }
-
-  bool Empty() const { return begin >= end; }
-
-  T begin;
-  T end;
-};
-
-// The IntervalMapConstIterator points to an interval in an
-// IntervalMap where all values are the same. Calling ++/--
-// goes to the next/previous interval, which is guaranteed to
-// have values different from the current interval.
-template <typename KeyType, typename ValueType,
-          class Compare = std::less<KeyType>,
-          class NumericLimits = std::numeric_limits<KeyType>>
-class IntervalMapConstIterator {
- public:
-  typedef std::map<KeyType, ValueType, Compare> MapType;
-  IntervalMapConstIterator() {}
-  IntervalMapConstIterator(const MapType* map,
-                           typename MapType::const_iterator iter)
-      : map_(map), iter_(iter) {}
-
-  bool operator==(const IntervalMapConstIterator& other) const {
-    return iter_ == other.iter_;
-  }
-
-  bool operator!=(const IntervalMapConstIterator& other) const {
-    return iter_ != other.iter_;
-  }
-
-  // Returns the beginning of the current interval.
-  KeyType interval_begin() const {
-    DCHECK(iter_ != map_->end());
-    return iter_->first;
-  }
-
-  // Returns the end of the current interval, non-inclusive.
-  KeyType interval_end() const {
-    DCHECK(iter_ != map_->end());
-    typename MapType::const_iterator next = iter_;
-    ++next;
-    if (next == map_->end()) {
-      return NumericLimits::max();
-    } else {
-      return next->first;
-    }
-  }
-
-  // Returns the current interval.
-  Interval<KeyType> interval() const {
-    return Interval<KeyType>(interval_begin(), interval_end());
-  }
-
-  // Returns the value associated with the current interval.
-  ValueType value() const {
-    DCHECK(iter_ != map_->end());
-    return iter_->second;
-  }
-
-  // Needed to make the following construct work:
-  // for (const auto& interval_value_pair : interval_map)
-  std::pair<Interval<KeyType>, ValueType> operator*() const {
-    return std::make_pair(interval(), value());
-  }
-
-  // Go to the next interval.
-  // The beginning of the next interval always matches the end of the current
-  // interval. (But should always have a different value.)
-  // Not allowed if we're already at map_->end().
-  void operator++() {
-    DCHECK(iter_ != map_->end());
-    ++iter_;
-  }
-
-  // Go to the previous interval.
-  // The end of the previous interval always matches the beginning of the
-  // current interval. (But should always have a different value.)
-  // Not allowed if we're already at map_->begin().
-  void operator--() {
-    DCHECK(iter_ != map_->begin());
-    --iter_;
-  }
-
- private:
-  const MapType* map_;
-
-  // Pointer to the entry in the IntervalMap that specifies the
-  // beginning of the current interval.
-  typename MapType::const_iterator iter_;
-};
-
-template <typename KeyType, typename ValueType,
-          class Compare = std::less<KeyType>,
-          class NumericLimits = std::numeric_limits<KeyType>>
-class IntervalMap {
- public:
-  typedef std::map<KeyType, ValueType, Compare> MapType;
-  typedef IntervalMapConstIterator<KeyType, ValueType, Compare, NumericLimits>
-      const_iterator;
-  IntervalMap() {
-    // Adding an explicit entry for the default interval is not strictly needed,
-    // but simplifies the code a lot.
-    map_[NumericLimits::min()] = ValueType();
-  }
-
-  // Returns the value at a particular point.
-  // Defaults to ValueType().
-  ValueType operator[](const KeyType& k) const {
-    typename MapType::const_iterator i = map_.upper_bound(k);
-    DCHECK(i != map_.begin());
-    --i;
-    return i->second;
-  }
-
-  // Increase [from..to) by |how_much|.
-  void IncrementInterval(KeyType from, KeyType to, ValueType how_much) {
-    if (to <= from || how_much == 0) return;
-    typename MapType::iterator a = MakeEntry(from);
-    typename MapType::iterator b = MakeEntry(to);
-    for (typename MapType::iterator i = a; i != b; ++i) {
-      i->second += how_much;
-    }
-    RemoveDuplicates(a);
-    // b may be invalid
-    RemoveDuplicates(map_.lower_bound(to));
-  }
-
-  // Set [from..to) to |how_much|.
-  void SetInterval(KeyType from, KeyType to, ValueType how_much) {
-    if (to <= from) return;
-    typename MapType::iterator a = MakeEntry(from);
-    typename MapType::iterator b = MakeEntry(to);
-    a->second = how_much;
-    while (true) {
-      typename MapType::iterator c = a;
-      ++c;
-      if (c == b) {
-        break;
-      } else {
-        map_.erase(c);
-      }
-    }
-    RemoveDuplicates(a);
-    // b may be invalid
-    RemoveDuplicates(map_.lower_bound(to));
-  }
-
-  // Returns an iterator to the first interval.
-  // Note, there is always at least one interval.
-  const_iterator begin() const { return const_iterator(&map(), map_.begin()); }
-
-  // Returns an end marker iterator.
-  const_iterator end() const { return const_iterator(&map(), map_.end()); }
-
-  // Returns an iterator to the interval containing |k|.
-  // Always returns a valid iterator.
-  const_iterator find(KeyType k) const {
-    typename MapType::const_iterator iter = map_.upper_bound(k);
-    DCHECK(iter != map_.begin());
-    --iter;
-    return const_iterator(&map(), iter);
-  }
-
-  bool empty() const { return map().size() == 1; }
-  void clear() {
-    map_.clear();
-    map_[NumericLimits::min()] = ValueType();
-  }
-
- private:
-  const MapType& map() const { return map_; }
-
-  // Make an entry in map_ with the key |k| and return it's iterator.
-  // If such an entry already exists, just re-use it.
-  // If a new entry is created, it's value will be set to the same
-  // as the preceeding entry, or ValueType() if no preceeding entry exists.
-  // After calling this function, we'll need to call RemoveDuplicates()
-  // to clean up any duplicates that we made.
-  typename MapType::iterator MakeEntry(KeyType k) {
-    typename MapType::value_type tmp(k, 0);
-    std::pair<typename MapType::iterator, bool> insert_result;
-    insert_result = map_.insert(tmp);
-    if (insert_result.second) {
-      if (insert_result.first != map_.begin()) {
-        typename MapType::iterator i = insert_result.first;
-        --i;
-        insert_result.first->second = i->second;
-      }
-    }
-    return insert_result.first;
-  }
-
-  // Remove duplicates before and after |i|.
-  void RemoveDuplicates(typename MapType::iterator i) {
-    if (i == map_.end()) return;
-
-    typename MapType::iterator first = i;
-    typename MapType::iterator second = i;
-    if (i != map_.begin()) {
-      --first;
-      if (first->second == second->second) {
-        map_.erase(second);
-        second = first;
-      } else {
-        first = second;
-      }
-    }
-    ++second;
-    if (second != map_.end() && first->second == second->second) {
-      map_.erase(second);
-    }
-  }
-
-  MapType map_;
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_INTERVAL_MAP_H_
diff --git a/src/cobalt/media/blink/interval_map_unittest.cc b/src/cobalt/media/blink/interval_map_unittest.cc
deleted file mode 100644
index 10e75ab..0000000
--- a/src/cobalt/media/blink/interval_map_unittest.cc
+++ /dev/null
@@ -1,272 +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 <string>
-#include <vector>
-
-#include "base/stringprintf.h"
-#include "cobalt/media/base/test_random.h"
-#include "cobalt/media/blink/interval_map.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-// Our tests only modifiy the interval map entries in [0..kTestSize).
-// We need this to be big enough to hit tricky corner cases, but small
-// enough that we get lots of entry duplication to clean up.
-// Also, SimpleIntervalMap uses a vector of size kTestSize to emulate
-// a intervalmap, so making this too big will the test down a lot.
-const int kTestSize = 16;
-
-class SimpleIntervalMap {
- public:
-  SimpleIntervalMap() : data_(kTestSize) {}
-
-  void IncrementInterval(int32_t from, int32_t to, int32_t how_much) {
-    for (int32_t i = from; i < to; i++) {
-      data_[i] += how_much;
-    }
-  }
-
-  void SetInterval(int32_t from, int32_t to, int32_t how_much) {
-    for (int32_t i = from; i < to; i++) {
-      data_[i] = how_much;
-    }
-  }
-
-  int32_t operator[](int32_t index) const { return data_[index]; }
-
- private:
-  std::vector<int32_t> data_;
-};
-
-class IntervalMapTest : public testing::Test {
- public:
-  IntervalMapTest() : rnd_(42) {}
-  void IncrementInterval(int32_t from, int32_t to, int32_t how_much) {
-    truth_.IncrementInterval(from, to, how_much);
-    testee_.IncrementInterval(from, to, how_much);
-    std::string message =
-        base::StringPrintf("After [%d - %d) += %d", from, to, how_much);
-    Compare(message);
-  }
-
-  void SetInterval(int32_t from, int32_t to, int32_t how_much) {
-    truth_.SetInterval(from, to, how_much);
-    testee_.SetInterval(from, to, how_much);
-    std::string message =
-        base::StringPrintf("After [%d - %d) += %d", from, to, how_much);
-    Compare(message);
-  }
-
-  // Will exercise operator[] and IntervalMap::const_iterator.
-  void Compare(const std::string& message) {
-    bool had_fail = HasFailure();
-    for (int i = 0; i < kTestSize; i++) {
-      EXPECT_EQ(truth_[i], testee_[i]) << " i = " << i << " " << message;
-    }
-    EXPECT_EQ(testee_[-1], 0) << message;
-    EXPECT_EQ(testee_[kTestSize], 0) << message;
-    int32_t prev_ = 0;
-    int32_t end_of_last_interval = 0;
-    int32_t num_intervals = 0;
-    for (const auto& r : testee_) {
-      num_intervals++;
-      EXPECT_LT(r.first.begin, r.first.end);
-      if (r.first.begin == std::numeric_limits<int32_t>::min()) {
-        EXPECT_EQ(0, r.second);
-      } else {
-        EXPECT_EQ(end_of_last_interval, r.first.begin);
-        EXPECT_GE(r.first.begin, 0) << message;
-        EXPECT_LE(r.first.begin, kTestSize) << message;
-        EXPECT_NE(r.second, prev_) << message;
-      }
-      end_of_last_interval = r.first.end;
-      prev_ = r.second;
-    }
-    EXPECT_EQ(prev_, 0) << message;
-
-    if (HasFailure() && !had_fail) {
-      for (int i = 0; i < kTestSize; i++) {
-        LOG(ERROR) << i << ": Truth =" << truth_[i]
-                   << " Testee = " << testee_[i];
-      }
-      for (const auto& r : testee_) {
-        LOG(ERROR) << "Interval:  " << r.first.begin << " - " << r.first.end
-                   << " = " << r.second;
-      }
-    }
-  }
-
-  void Clear() {
-    for (int j = 0; j < kTestSize; j++) {
-      IncrementInterval(j, j + 1, -truth_[j]);
-    }
-  }
-
- protected:
-  media::TestRandom rnd_;
-  SimpleIntervalMap truth_;
-  media::IntervalMap<int32_t, int32_t> testee_;
-};
-}
-
-TEST_F(IntervalMapTest, SimpleTest) {
-  IncrementInterval(3, 7, 4);
-  EXPECT_EQ(0, testee_[0]);
-  EXPECT_EQ(0, testee_[2]);
-  EXPECT_EQ(4, testee_[3]);
-  EXPECT_EQ(4, testee_[5]);
-  EXPECT_EQ(4, testee_[6]);
-  EXPECT_EQ(0, testee_[7]);
-  IncrementInterval(3, 7, -4);
-  EXPECT_TRUE(testee_.empty());
-}
-
-TEST_F(IntervalMapTest, SimpleIncrementTest) {
-  IncrementInterval(3, 7, 1);
-  IncrementInterval(6, 10, 2);
-  EXPECT_EQ(0, testee_[2]);
-  EXPECT_EQ(1, testee_[3]);
-  EXPECT_EQ(1, testee_[5]);
-  EXPECT_EQ(3, testee_[6]);
-  EXPECT_EQ(2, testee_[7]);
-  EXPECT_EQ(2, testee_[9]);
-  EXPECT_EQ(0, testee_[10]);
-  SetInterval(3, 12, 0);
-  EXPECT_TRUE(testee_.empty());
-}
-
-TEST_F(IntervalMapTest, IncrementJoinIntervalsTest) {
-  IncrementInterval(3, 5, 1);
-  IncrementInterval(7, 8, 1);
-  IncrementInterval(9, 11, 1);
-  IncrementInterval(5, 7, 1);
-  IncrementInterval(8, 9, 1);
-  auto i = testee_.find(5);
-  EXPECT_EQ(3, i.interval_begin());
-  EXPECT_EQ(11, i.interval_end());
-  EXPECT_EQ(1, i.value());
-}
-
-TEST_F(IntervalMapTest, SetJoinIntervalsTest) {
-  SetInterval(3, 5, 1);
-  SetInterval(7, 8, 1);
-  SetInterval(9, 11, 1);
-  SetInterval(5, 9, 1);  // overwrites one interval
-  auto i = testee_.find(5);
-  EXPECT_EQ(3, i.interval_begin());
-  EXPECT_EQ(11, i.interval_end());
-  EXPECT_EQ(1, i.value());
-}
-
-TEST_F(IntervalMapTest, FindTest) {
-  IncrementInterval(5, 6, 1);
-  IncrementInterval(1, 10, 2);
-  int32_t min_value = std::numeric_limits<int32_t>::min();
-  int32_t max_value = std::numeric_limits<int32_t>::max();
-  auto i = testee_.find(0);
-  EXPECT_EQ(min_value, i.interval_begin());
-  EXPECT_EQ(1, i.interval_end());
-  EXPECT_EQ(0, i.value());
-  i = testee_.find(4);
-  EXPECT_EQ(1, i.interval_begin());
-  EXPECT_EQ(5, i.interval_end());
-  EXPECT_EQ(2, i.value());
-  i = testee_.find(5);
-  EXPECT_EQ(5, i.interval_begin());
-  EXPECT_EQ(6, i.interval_end());
-  EXPECT_EQ(3, i.value());
-  i = testee_.find(6);
-  EXPECT_EQ(6, i.interval_begin());
-  EXPECT_EQ(10, i.interval_end());
-  EXPECT_EQ(2, i.value());
-  i = testee_.find(9);
-  EXPECT_EQ(6, i.interval_begin());
-  EXPECT_EQ(10, i.interval_end());
-  EXPECT_EQ(2, i.value());
-  i = testee_.find(10);
-  EXPECT_EQ(10, i.interval_begin());
-  EXPECT_EQ(max_value, i.interval_end());
-  EXPECT_EQ(0, i.value());
-}
-
-TEST_F(IntervalMapTest, MinMaxInt) {
-  int32_t min_value = std::numeric_limits<int32_t>::min();
-  int32_t max_value = std::numeric_limits<int32_t>::max();
-
-  // Change a single value at minint
-  testee_.IncrementInterval(min_value, min_value + 1, 7);
-  EXPECT_EQ(7, testee_[min_value]);
-  EXPECT_EQ(0, testee_[min_value + 1]);
-  auto i = testee_.find(0);
-  EXPECT_EQ(min_value + 1, i.interval_begin());
-  EXPECT_EQ(max_value, i.interval_end());
-  EXPECT_EQ(0, i.value());
-  --i;
-  EXPECT_TRUE(i == testee_.find(min_value));
-  EXPECT_EQ(min_value, i.interval_begin());
-  EXPECT_EQ(min_value + 1, i.interval_end());
-  EXPECT_EQ(7, i.value());
-  testee_.clear();
-
-  // Change a single value at maxint
-  // Note that we don't actually have a way to represent a range
-  // that includes maxint as the end of the interval is non-inclusive.
-  testee_.IncrementInterval(max_value - 1, max_value, 7);
-  EXPECT_EQ(7, testee_[max_value - 1]);
-  EXPECT_EQ(0, testee_[max_value - 2]);
-  i = testee_.find(0);
-  EXPECT_EQ(min_value, i.interval_begin());
-  EXPECT_EQ(max_value - 1, i.interval_end());
-  EXPECT_EQ(0, i.value());
-  ++i;
-  EXPECT_TRUE(i == testee_.find(max_value - 1));
-  EXPECT_EQ(max_value - 1, i.interval_begin());
-  EXPECT_EQ(max_value, i.interval_end());
-  EXPECT_EQ(7, i.value());
-
-  testee_.clear();
-
-  // Change entire range (almost)
-  testee_.IncrementInterval(min_value, max_value, 17);
-  EXPECT_EQ(17, testee_[min_value]);
-  EXPECT_EQ(17, testee_[0]);
-  EXPECT_EQ(17, testee_[max_value - 1]);
-  i = testee_.find(0);
-  EXPECT_EQ(min_value, i.interval_begin());
-  EXPECT_EQ(max_value, i.interval_end());
-  EXPECT_EQ(17, i.value());
-  EXPECT_TRUE(i == testee_.find(max_value - 1));
-  EXPECT_TRUE(i == testee_.find(min_value));
-}
-
-TEST_F(IntervalMapTest, RandomIncrementTest) {
-  for (int j = 0; j < 200; j++) {
-    Clear();
-    for (int i = 0; i < 200; i++) {
-      int32_t begin = rnd_.Rand() % (kTestSize - 1);
-      int32_t end = begin + 1 + rnd_.Rand() % (kTestSize - begin - 1);
-      IncrementInterval(begin, end, (rnd_.Rand() & 32) ? 1 : -1);
-      if (HasFailure()) {
-        return;
-      }
-    }
-  }
-}
-
-TEST_F(IntervalMapTest, RandomSetTest) {
-  for (int j = 0; j < 200; j++) {
-    Clear();
-    for (int i = 0; i < 200; i++) {
-      int32_t begin = rnd_.Rand() % (kTestSize - 1);
-      int32_t end = begin + 1 + rnd_.Rand() % (kTestSize - begin - 1);
-      SetInterval(begin, end, rnd_.Rand() & 3);
-      if (HasFailure()) {
-        return;
-      }
-    }
-  }
-}
diff --git a/src/cobalt/media/blink/key_system_config_selector.cc b/src/cobalt/media/blink/key_system_config_selector.cc
deleted file mode 100644
index 18edcfc..0000000
--- a/src/cobalt/media/blink/key_system_config_selector.cc
+++ /dev/null
@@ -1,922 +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.
-
-#include "cobalt/media/blink/key_system_config_selector.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "cobalt/media/base/cdm_config.h"
-#include "cobalt/media/base/key_systems.h"
-#include "cobalt/media/base/media_permission.h"
-#include "cobalt/media/base/mime_util.h"
-#include "cobalt/media/blink/webmediaplayer_util.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/URLConversion.h"
-#include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
-
-namespace cobalt {
-namespace media {
-
-using EmeFeatureRequirement =
-    blink::WebMediaKeySystemConfiguration::Requirement;
-
-namespace {
-
-static EmeConfigRule GetSessionTypeConfigRule(EmeSessionTypeSupport support) {
-  switch (support) {
-    case EmeSessionTypeSupport::INVALID:
-      NOTREACHED();
-      return EmeConfigRule::NOT_SUPPORTED;
-    case EmeSessionTypeSupport::NOT_SUPPORTED:
-      return EmeConfigRule::NOT_SUPPORTED;
-    case EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER:
-      return EmeConfigRule::IDENTIFIER_AND_PERSISTENCE_REQUIRED;
-    case EmeSessionTypeSupport::SUPPORTED:
-      return EmeConfigRule::PERSISTENCE_REQUIRED;
-  }
-  NOTREACHED();
-  return EmeConfigRule::NOT_SUPPORTED;
-}
-
-static EmeConfigRule GetDistinctiveIdentifierConfigRule(
-    EmeFeatureSupport support, EmeFeatureRequirement requirement) {
-  if (support == EmeFeatureSupport::INVALID) {
-    NOTREACHED();
-    return EmeConfigRule::NOT_SUPPORTED;
-  }
-
-  // For NOT_ALLOWED and REQUIRED, the result is as expected. For OPTIONAL, we
-  // return the most restrictive rule that is not more restrictive than for
-  // NOT_ALLOWED or REQUIRED. Those values will be checked individually when
-  // the option is resolved.
-  //
-  //                   NOT_ALLOWED    OPTIONAL       REQUIRED
-  //    NOT_SUPPORTED  I_NOT_ALLOWED  I_NOT_ALLOWED  NOT_SUPPORTED
-  //      REQUESTABLE  I_NOT_ALLOWED  SUPPORTED      I_REQUIRED
-  //   ALWAYS_ENABLED  NOT_SUPPORTED  I_REQUIRED     I_REQUIRED
-  DCHECK(support == EmeFeatureSupport::NOT_SUPPORTED ||
-         support == EmeFeatureSupport::REQUESTABLE ||
-         support == EmeFeatureSupport::ALWAYS_ENABLED);
-  DCHECK(requirement == EmeFeatureRequirement::NotAllowed ||
-         requirement == EmeFeatureRequirement::Optional ||
-         requirement == EmeFeatureRequirement::Required);
-  if ((support == EmeFeatureSupport::NOT_SUPPORTED &&
-       requirement == EmeFeatureRequirement::Required) ||
-      (support == EmeFeatureSupport::ALWAYS_ENABLED &&
-       requirement == EmeFeatureRequirement::NotAllowed)) {
-    return EmeConfigRule::NOT_SUPPORTED;
-  }
-  if (support == EmeFeatureSupport::REQUESTABLE &&
-      requirement == EmeFeatureRequirement::Optional) {
-    return EmeConfigRule::SUPPORTED;
-  }
-  if (support == EmeFeatureSupport::NOT_SUPPORTED ||
-      requirement == EmeFeatureRequirement::NotAllowed) {
-    return EmeConfigRule::IDENTIFIER_NOT_ALLOWED;
-  }
-  return EmeConfigRule::IDENTIFIER_REQUIRED;
-}
-
-static EmeConfigRule GetPersistentStateConfigRule(
-    EmeFeatureSupport support, EmeFeatureRequirement requirement) {
-  if (support == EmeFeatureSupport::INVALID) {
-    NOTREACHED();
-    return EmeConfigRule::NOT_SUPPORTED;
-  }
-
-  // For NOT_ALLOWED and REQUIRED, the result is as expected. For OPTIONAL, we
-  // return the most restrictive rule that is not more restrictive than for
-  // NOT_ALLOWED or REQUIRED. Those values will be checked individually when
-  // the option is resolved.
-  //
-  // Note that even though a distinctive identifier can not be required for
-  // persistent state, it may still be required for persistent sessions.
-  //
-  //                   NOT_ALLOWED    OPTIONAL       REQUIRED
-  //    NOT_SUPPORTED  P_NOT_ALLOWED  P_NOT_ALLOWED  NOT_SUPPORTED
-  //      REQUESTABLE  P_NOT_ALLOWED  SUPPORTED      P_REQUIRED
-  //   ALWAYS_ENABLED  NOT_SUPPORTED  P_REQUIRED     P_REQUIRED
-  DCHECK(support == EmeFeatureSupport::NOT_SUPPORTED ||
-         support == EmeFeatureSupport::REQUESTABLE ||
-         support == EmeFeatureSupport::ALWAYS_ENABLED);
-  DCHECK(requirement == EmeFeatureRequirement::NotAllowed ||
-         requirement == EmeFeatureRequirement::Optional ||
-         requirement == EmeFeatureRequirement::Required);
-  if ((support == EmeFeatureSupport::NOT_SUPPORTED &&
-       requirement == EmeFeatureRequirement::Required) ||
-      (support == EmeFeatureSupport::ALWAYS_ENABLED &&
-       requirement == EmeFeatureRequirement::NotAllowed)) {
-    return EmeConfigRule::NOT_SUPPORTED;
-  }
-  if (support == EmeFeatureSupport::REQUESTABLE &&
-      requirement == EmeFeatureRequirement::Optional) {
-    return EmeConfigRule::SUPPORTED;
-  }
-  if (support == EmeFeatureSupport::NOT_SUPPORTED ||
-      requirement == EmeFeatureRequirement::NotAllowed) {
-    return EmeConfigRule::PERSISTENCE_NOT_ALLOWED;
-  }
-  return EmeConfigRule::PERSISTENCE_REQUIRED;
-}
-
-static bool IsPersistentSessionType(
-    blink::WebEncryptedMediaSessionType sessionType) {
-  switch (sessionType) {
-    case blink::WebEncryptedMediaSessionType::Temporary:
-      return false;
-    case blink::WebEncryptedMediaSessionType::PersistentLicense:
-      return true;
-    case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage:
-      return true;
-    case blink::WebEncryptedMediaSessionType::Unknown:
-      break;
-  }
-
-  NOTREACHED();
-  return false;
-}
-
-}  // namespace
-
-struct KeySystemConfigSelector::SelectionRequest {
-  std::string key_system;
-  blink::WebVector<blink::WebMediaKeySystemConfiguration>
-      candidate_configurations;
-  blink::WebSecurityOrigin security_origin;
-  base::Callback<void(const blink::WebMediaKeySystemConfiguration&,
-                      const CdmConfig&)> succeeded_cb;
-  base::Callback<void(const blink::WebString&)> not_supported_cb;
-  bool was_permission_requested = false;
-  bool is_permission_granted = false;
-  bool are_secure_codecs_supported = false;
-};
-
-// Accumulates configuration rules to determine if a feature (additional
-// configuration rule) can be added to an accumulated configuration.
-class KeySystemConfigSelector::ConfigState {
- public:
-  ConfigState(bool was_permission_requested, bool is_permission_granted)
-      : was_permission_requested_(was_permission_requested),
-        is_permission_granted_(is_permission_granted) {}
-
-  bool IsPermissionGranted() const { return is_permission_granted_; }
-
-  // Permission is possible if it has not been denied.
-  bool IsPermissionPossible() const {
-    return is_permission_granted_ || !was_permission_requested_;
-  }
-
-  bool IsIdentifierRequired() const { return is_identifier_required_; }
-
-  bool IsIdentifierRecommended() const { return is_identifier_recommended_; }
-
-  bool AreHwSecureCodecsRequired() const {
-    return are_hw_secure_codecs_required_;
-  }
-
-  // Checks whether a rule is compatible with all previously added rules.
-  bool IsRuleSupported(EmeConfigRule rule) const {
-    switch (rule) {
-      case EmeConfigRule::NOT_SUPPORTED:
-        return false;
-      case EmeConfigRule::IDENTIFIER_NOT_ALLOWED:
-        return !is_identifier_required_;
-      case EmeConfigRule::IDENTIFIER_REQUIRED:
-        // TODO(sandersd): Confirm if we should be refusing these rules when
-        // permission has been denied (as the spec currently says).
-        return !is_identifier_not_allowed_ && IsPermissionPossible();
-      case EmeConfigRule::IDENTIFIER_RECOMMENDED:
-        return true;
-      case EmeConfigRule::PERSISTENCE_NOT_ALLOWED:
-        return !is_persistence_required_;
-      case EmeConfigRule::PERSISTENCE_REQUIRED:
-        return !is_persistence_not_allowed_;
-      case EmeConfigRule::IDENTIFIER_AND_PERSISTENCE_REQUIRED:
-        return (!is_identifier_not_allowed_ && IsPermissionPossible() &&
-                !is_persistence_not_allowed_);
-      case EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED:
-        return !are_hw_secure_codecs_required_;
-      case EmeConfigRule::HW_SECURE_CODECS_REQUIRED:
-        return !are_hw_secure_codecs_not_allowed_;
-      case EmeConfigRule::SUPPORTED:
-        return true;
-    }
-    NOTREACHED();
-    return false;
-  }
-
-  // Add a rule to the accumulated configuration state.
-  void AddRule(EmeConfigRule rule) {
-    DCHECK(IsRuleSupported(rule));
-    switch (rule) {
-      case EmeConfigRule::NOT_SUPPORTED:
-        NOTREACHED();
-        return;
-      case EmeConfigRule::IDENTIFIER_NOT_ALLOWED:
-        is_identifier_not_allowed_ = true;
-        return;
-      case EmeConfigRule::IDENTIFIER_REQUIRED:
-        is_identifier_required_ = true;
-        return;
-      case EmeConfigRule::IDENTIFIER_RECOMMENDED:
-        is_identifier_recommended_ = true;
-        return;
-      case EmeConfigRule::PERSISTENCE_NOT_ALLOWED:
-        is_persistence_not_allowed_ = true;
-        return;
-      case EmeConfigRule::PERSISTENCE_REQUIRED:
-        is_persistence_required_ = true;
-        return;
-      case EmeConfigRule::IDENTIFIER_AND_PERSISTENCE_REQUIRED:
-        is_identifier_required_ = true;
-        is_persistence_required_ = true;
-        return;
-      case EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED:
-        are_hw_secure_codecs_not_allowed_ = true;
-        return;
-      case EmeConfigRule::HW_SECURE_CODECS_REQUIRED:
-        are_hw_secure_codecs_required_ = true;
-        return;
-      case EmeConfigRule::SUPPORTED:
-        return;
-    }
-    NOTREACHED();
-  }
-
- private:
-  // Whether permission to use a distinctive identifier was requested. If set,
-  // |is_permission_granted_| represents the final decision.
-  // (Not changed by adding rules.)
-  bool was_permission_requested_;
-
-  // Whether permission to use a distinctive identifier has been granted.
-  // (Not changed by adding rules.)
-  bool is_permission_granted_;
-
-  // Whether a rule has been added that requires or blocks a distinctive
-  // identifier.
-  bool is_identifier_required_ = false;
-  bool is_identifier_not_allowed_ = false;
-
-  // Whether a rule has been added that recommends a distinctive identifier.
-  bool is_identifier_recommended_ = false;
-
-  // Whether a rule has been added that requires or blocks persistent state.
-  bool is_persistence_required_ = false;
-  bool is_persistence_not_allowed_ = false;
-
-  // Whether a rule has been added that requires or blocks hardware-secure
-  // codecs.
-  bool are_hw_secure_codecs_required_ = false;
-  bool are_hw_secure_codecs_not_allowed_ = false;
-};
-
-KeySystemConfigSelector::KeySystemConfigSelector(
-    const KeySystems* key_systems, MediaPermission* media_permission)
-    : key_systems_(key_systems),
-      media_permission_(media_permission),
-      weak_factory_(this) {
-  DCHECK(key_systems_);
-  DCHECK(media_permission_);
-}
-
-KeySystemConfigSelector::~KeySystemConfigSelector() {}
-
-bool IsSupportedMediaFormat(const std::string& container_mime_type,
-                            const std::string& codecs, bool use_aes_decryptor) {
-  std::vector<std::string> codec_vector;
-  ParseCodecString(codecs, &codec_vector, false);
-  // AesDecryptor decrypts the stream in the demuxer before it reaches the
-  // decoder so check whether the media format is supported when clear.
-  SupportsType support_result =
-      use_aes_decryptor
-          ? IsSupportedMediaFormat(container_mime_type, codec_vector)
-          : IsSupportedEncryptedMediaFormat(container_mime_type, codec_vector);
-  switch (support_result) {
-    case IsSupported:
-      return true;
-    case MayBeSupported:
-      // If no codecs were specified, the best possible result is
-      // MayBeSupported, indicating support for the container.
-      return codec_vector.empty();
-    case IsNotSupported:
-      return false;
-  }
-  NOTREACHED();
-  return false;
-}
-
-// TODO(sandersd): Move contentType parsing from Blink to here so that invalid
-// parameters can be rejected. http://crbug.com/417561
-bool KeySystemConfigSelector::IsSupportedContentType(
-    const std::string& key_system, EmeMediaType media_type,
-    const std::string& container_mime_type, const std::string& codecs,
-    KeySystemConfigSelector::ConfigState* config_state) {
-  // From RFC6838: "Both top-level type and subtype names are case-insensitive."
-  std::string container_lower = base::ToLowerASCII(container_mime_type);
-
-  // contentTypes must provide a codec string unless the container implies a
-  // particular codec. For EME, none of the currently supported containers
-  // imply a codec, so |codecs| must be provided.
-  if (codecs.empty()) {
-    // Since the spec didn't initially require this, add an exemption for
-    // some existing containers to give clients time to adapt.
-    // TODO(jrummell): Remove this exemption once the number of contentTypes
-    // without codecs drops low enough (UMA added in the blink code).
-    // http://crbug.com/605661.
-    if (container_lower != "audio/webm" && container_lower != "video/webm" &&
-        container_lower != "audio/mp4" && container_lower != "video/mp4") {
-      return false;
-    }
-  }
-
-  // Check that |container_mime_type| and |codecs| are supported by Chrome. This
-  // is done primarily to validate extended codecs, but it also ensures that the
-  // CDM cannot support codecs that Chrome does not (which could complicate the
-  // robustness algorithm).
-  if (!IsSupportedMediaFormat(container_lower, codecs,
-                              CanUseAesDecryptor(key_system))) {
-    return false;
-  }
-
-  // Check that |container_mime_type| and |codecs| are supported by the CDM.
-  // This check does not handle extended codecs, so extended codec information
-  // is stripped (extended codec information was checked above).
-  std::vector<std::string> stripped_codec_vector;
-  ParseCodecString(codecs, &stripped_codec_vector, true);
-  EmeConfigRule codecs_rule = key_systems_->GetContentTypeConfigRule(
-      key_system, media_type, container_lower, stripped_codec_vector);
-  if (!config_state->IsRuleSupported(codecs_rule)) return false;
-  config_state->AddRule(codecs_rule);
-
-  return true;
-}
-
-bool KeySystemConfigSelector::GetSupportedCapabilities(
-    const std::string& key_system, EmeMediaType media_type,
-    const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
-        requested_media_capabilities,
-    KeySystemConfigSelector::ConfigState* config_state,
-    std::vector<blink::WebMediaKeySystemMediaCapability>*
-        supported_media_capabilities) {
-  // From
-  // https://w3c.github.io/encrypted-media/#get-supported-capabilities-for-media-type
-  // 1. Let local accumulated capabilities be a local copy of partial
-  //    configuration.
-  //    (Skipped as we directly update |config_state|. This is safe because we
-  //    only do so when at least one requested media capability is supported.)
-  // 2. Let supported media capabilities be empty.
-  DCHECK_EQ(supported_media_capabilities->size(), 0ul);
-  // 3. For each value in requested media capabilities:
-  for (size_t i = 0; i < requested_media_capabilities.size(); i++) {
-    // 3.1. Let contentType be the value's contentType member.
-    // 3.2. Let robustness be the value's robustness member.
-    const blink::WebMediaKeySystemMediaCapability& capability =
-        requested_media_capabilities[i];
-    // 3.3. If contentType is the empty string, return null.
-    if (capability.mimeType.isEmpty()) {
-      DVLOG(2) << "Rejecting requested configuration because "
-               << "a capability contentType was empty.";
-      return false;
-    }
-
-    // 3.4-3.11. (Implemented by IsSupportedContentType().)
-    ConfigState proposed_config_state = *config_state;
-    if (!base::IsStringASCII(capability.mimeType) ||
-        !base::IsStringASCII(capability.codecs) ||
-        !IsSupportedContentType(
-            key_system, media_type,
-            base::UTF16ToASCII(base::StringPiece16(capability.mimeType)),
-            base::UTF16ToASCII(base::StringPiece16(capability.codecs)),
-            &proposed_config_state)) {
-      continue;
-    }
-    // 3.12. If robustness is not the empty string, run the following steps:
-    if (!capability.robustness.isEmpty()) {
-      // 3.12.1. If robustness is an unrecognized value or not supported by
-      //         implementation, continue to the next iteration. String
-      //         comparison is case-sensitive.
-      if (!base::IsStringASCII(capability.robustness)) continue;
-      EmeConfigRule robustness_rule = key_systems_->GetRobustnessConfigRule(
-          key_system, media_type,
-          base::UTF16ToASCII(base::StringPiece16(capability.robustness)));
-      if (!proposed_config_state.IsRuleSupported(robustness_rule)) continue;
-      proposed_config_state.AddRule(robustness_rule);
-      // 3.12.2. Add robustness to configuration.
-      //         (It's already added, we use capability as configuration.)
-    }
-    // 3.13. If the user agent and implementation do not support playback of
-    //       encrypted media data as specified by configuration, including all
-    //       media types, in combination with local accumulated capabilities,
-    //       continue to the next iteration.
-    //       (This is handled when adding rules to |proposed_config_state|.)
-    // 3.14. Add configuration to supported media capabilities.
-    supported_media_capabilities->push_back(capability);
-    // 3.15. Add configuration to local accumulated capabilities.
-    *config_state = proposed_config_state;
-  }
-  // 4. If supported media capabilities is empty, return null.
-  if (supported_media_capabilities->empty()) {
-    DVLOG(2) << "Rejecting requested configuration because "
-             << "no capabilities were supported.";
-    return false;
-  }
-  // 5. Return media type capabilities.
-  return true;
-}
-
-KeySystemConfigSelector::ConfigurationSupport
-KeySystemConfigSelector::GetSupportedConfiguration(
-    const std::string& key_system,
-    const blink::WebMediaKeySystemConfiguration& candidate,
-    ConfigState* config_state,
-    blink::WebMediaKeySystemConfiguration* accumulated_configuration) {
-  // From
-  // http://w3c.github.io/encrypted-media/#get-supported-configuration-and-consent
-  // 1. Let accumulated configuration be a new MediaKeySystemConfiguration
-  //    dictionary. (Done by caller.)
-  // 2. Set the label member of accumulated configuration to equal the label
-  //    member of candidate configuration.
-  accumulated_configuration->label = candidate.label;
-
-  // 3. If the initDataTypes member of candidate configuration is non-empty,
-  //    run the following steps:
-  if (!candidate.initDataTypes.isEmpty()) {
-    // 3.1. Let supported types be an empty sequence of DOMStrings.
-    std::vector<blink::WebEncryptedMediaInitDataType> supported_types;
-
-    // 3.2. For each value in candidate configuration's initDataTypes member:
-    for (size_t i = 0; i < candidate.initDataTypes.size(); i++) {
-      // 3.2.1. Let initDataType be the value.
-      blink::WebEncryptedMediaInitDataType init_data_type =
-          candidate.initDataTypes[i];
-
-      // 3.2.2. If the implementation supports generating requests based on
-      //        initDataType, add initDataType to supported types. String
-      //        comparison is case-sensitive. The empty string is never
-      //        supported.
-      if (key_systems_->IsSupportedInitDataType(
-              key_system, ConvertToEmeInitDataType(init_data_type))) {
-        supported_types.push_back(init_data_type);
-      }
-    }
-
-    // 3.3. If supported types is empty, return null.
-    if (supported_types.empty()) {
-      DVLOG(2) << "Rejecting requested configuration because "
-               << "no initDataType values were supported.";
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-
-    // 3.4. Set the initDataTypes member of accumulated configuration to
-    //      supported types.
-    accumulated_configuration->initDataTypes = supported_types;
-  }
-
-  // 4. Let distinctive identifier requirement be the value of candidate
-  //    configuration's distinctiveIdentifier member.
-  EmeFeatureRequirement distinctive_identifier =
-      candidate.distinctiveIdentifier;
-
-  // 5. If distinctive identifier requirement is "optional" and Distinctive
-  //    Identifiers are not allowed according to restrictions, set distinctive
-  //    identifier requirement to "not-allowed".
-  EmeFeatureSupport distinctive_identifier_support =
-      key_systems_->GetDistinctiveIdentifierSupport(key_system);
-  if (distinctive_identifier == EmeFeatureRequirement::Optional) {
-    if (distinctive_identifier_support == EmeFeatureSupport::INVALID ||
-        distinctive_identifier_support == EmeFeatureSupport::NOT_SUPPORTED) {
-      distinctive_identifier = EmeFeatureRequirement::NotAllowed;
-    }
-  }
-
-  // 6. Follow the steps for distinctive identifier requirement from the
-  //    following list:
-  //      - "required": If the implementation does not support use of
-  //         Distinctive Identifier(s) in combination with accumulated
-  //         configuration and restrictions, return NotSupported.
-  //      - "optional": Continue with the following steps.
-  //      - "not-allowed": If the implementation requires use Distinctive
-  //        Identifier(s) or Distinctive Permanent Identifier(s) in
-  //        combination with accumulated configuration and restrictions,
-  //        return NotSupported.
-  // We also reject OPTIONAL when distinctive identifiers are ALWAYS_ENABLED and
-  // permission has already been denied. This would happen anyway later.
-  EmeConfigRule di_rule = GetDistinctiveIdentifierConfigRule(
-      distinctive_identifier_support, distinctive_identifier);
-  if (!config_state->IsRuleSupported(di_rule)) {
-    DVLOG(2) << "Rejecting requested configuration because "
-             << "the distinctiveIdentifier requirement was not supported.";
-    return CONFIGURATION_NOT_SUPPORTED;
-  }
-  config_state->AddRule(di_rule);
-
-  // 7. Set the distinctiveIdentifier member of accumulated configuration to
-  //    equal distinctive identifier requirement.
-  accumulated_configuration->distinctiveIdentifier = distinctive_identifier;
-
-  // 8. Let persistent state requirement be equal to the value of candidate
-  //    configuration's persistentState member.
-  EmeFeatureRequirement persistent_state = candidate.persistentState;
-
-  // 9. If persistent state requirement is "optional" and persisting state is
-  //    not allowed according to restrictions, set persistent state requirement
-  //    to "not-allowed".
-  EmeFeatureSupport persistent_state_support =
-      key_systems_->GetPersistentStateSupport(key_system);
-  if (persistent_state == EmeFeatureRequirement::Optional) {
-    if (persistent_state_support == EmeFeatureSupport::INVALID ||
-        persistent_state_support == EmeFeatureSupport::NOT_SUPPORTED) {
-      persistent_state = EmeFeatureRequirement::NotAllowed;
-    }
-  }
-
-  // 10. Follow the steps for persistent state requirement from the following
-  //     list:
-  //       - "required": If the implementation does not support persisting
-  //         state in combination with accumulated configuration and
-  //         restrictions, return NotSupported.
-  //       - "optional": Continue with the following steps.
-  //       - "not-allowed": If the implementation requires persisting state in
-  //         combination with accumulated configuration and restrictions,
-  //         return NotSupported.
-  EmeConfigRule ps_rule =
-      GetPersistentStateConfigRule(persistent_state_support, persistent_state);
-  if (!config_state->IsRuleSupported(ps_rule)) {
-    DVLOG(2) << "Rejecting requested configuration because "
-             << "the persistentState requirement was not supported.";
-    return CONFIGURATION_NOT_SUPPORTED;
-  }
-  config_state->AddRule(ps_rule);
-
-  // 11. Set the persistentState member of accumulated configuration to equal
-  //     the value of persistent state requirement.
-  accumulated_configuration->persistentState = persistent_state;
-
-  // 12. Follow the steps for the first matching condition from the following
-  //     list:
-  //       - If the sessionTypes member is present in candidate configuration,
-  //         let session types be candidate configuration's sessionTypes member.
-  //       - Otherwise, let session types be [ "temporary" ].
-  //         (Done in MediaKeySystemAccessInitializer.)
-  blink::WebVector<blink::WebEncryptedMediaSessionType> session_types =
-      candidate.sessionTypes;
-
-  // 13. For each value in session types:
-  for (size_t i = 0; i < session_types.size(); i++) {
-    // 13.1. Let session type be the value.
-    blink::WebEncryptedMediaSessionType session_type = session_types[i];
-
-    // 13.2. If accumulated configuration's persistentState value is
-    //       "not-allowed" and the Is persistent session type? algorithm
-    //       returns true for session type return NotSupported.
-    if (accumulated_configuration->persistentState ==
-            EmeFeatureRequirement::NotAllowed &&
-        IsPersistentSessionType(session_type)) {
-      DVLOG(2) << "Rejecting requested configuration because persistent "
-                  "sessions are not allowed.";
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-
-    // 13.3. If the implementation does not support session type in combination
-    //       with accumulated configuration and restrictions for other reasons,
-    //       return NotSupported.
-    EmeConfigRule session_type_rule = EmeConfigRule::NOT_SUPPORTED;
-    switch (session_type) {
-      case blink::WebEncryptedMediaSessionType::Unknown:
-        DVLOG(2) << "Rejecting requested configuration because "
-                 << "a required session type was not recognized.";
-        return CONFIGURATION_NOT_SUPPORTED;
-      case blink::WebEncryptedMediaSessionType::Temporary:
-        session_type_rule = EmeConfigRule::SUPPORTED;
-        break;
-      case blink::WebEncryptedMediaSessionType::PersistentLicense:
-        session_type_rule = GetSessionTypeConfigRule(
-            key_systems_->GetPersistentLicenseSessionSupport(key_system));
-        break;
-      case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage:
-        session_type_rule = GetSessionTypeConfigRule(
-            key_systems_->GetPersistentReleaseMessageSessionSupport(
-                key_system));
-        break;
-    }
-
-    if (!config_state->IsRuleSupported(session_type_rule)) {
-      DVLOG(2) << "Rejecting requested configuration because "
-               << "a required session type was not supported.";
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-    config_state->AddRule(session_type_rule);
-
-    // 13.4. If accumulated configuration's persistentState value is "optional"
-    //       and the result of running the Is persistent session type?
-    //       algorithm on session type is true, change accumulated
-    //       configuration's persistentState value to "required".
-    if (accumulated_configuration->persistentState ==
-            EmeFeatureRequirement::Optional &&
-        IsPersistentSessionType(session_type)) {
-      accumulated_configuration->persistentState =
-          EmeFeatureRequirement::Required;
-    }
-  }
-
-  // 14. Set the sessionTypes member of accumulated configuration to
-  //     session types.
-  accumulated_configuration->sessionTypes = session_types;
-
-  // 15. If the videoCapabilities and audioCapabilities members in candidate
-  //     configuration are both empty, return NotSupported.
-  // TODO(jrummell): Enforce this once the deprecation warning is removed.
-  // See http://crbug.com/616233.
-
-  // 16. If the videoCapabilities member in candidate configuration is
-  //     non-empty:
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities;
-  if (!candidate.videoCapabilities.isEmpty()) {
-    // 16.1. Let video capabilities be the result of executing the Get
-    //       Supported Capabilities for Audio/Video Type algorithm on Video,
-    //       candidate configuration's videoCapabilities member, accumulated
-    //       configuration, and restrictions.
-    // 16.2. If video capabilities is null, return NotSupported.
-    if (!GetSupportedCapabilities(key_system, EmeMediaType::VIDEO,
-                                  candidate.videoCapabilities, config_state,
-                                  &video_capabilities)) {
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-
-    // 16.3. Set the videoCapabilities member of accumulated configuration
-    //       to video capabilities.
-    accumulated_configuration->videoCapabilities = video_capabilities;
-  } else {
-    // Otherwise set the videoCapabilities member of accumulated configuration
-    // to an empty sequence.
-    accumulated_configuration->videoCapabilities = video_capabilities;
-  }
-
-  // 17. If the audioCapabilities member in candidate configuration is
-  //     non-empty:
-  std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities;
-  if (!candidate.audioCapabilities.isEmpty()) {
-    // 17.1. Let audio capabilities be the result of executing the Get
-    //       Supported Capabilities for Audio/Video Type algorithm on Audio,
-    //       candidate configuration's audioCapabilities member, accumulated
-    //       configuration, and restrictions.
-    // 17.2. If audio capabilities is null, return NotSupported.
-    if (!GetSupportedCapabilities(key_system, EmeMediaType::AUDIO,
-                                  candidate.audioCapabilities, config_state,
-                                  &audio_capabilities)) {
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-
-    // 17.3. Set the audioCapabilities member of accumulated configuration
-    //       to audio capabilities.
-    accumulated_configuration->audioCapabilities = audio_capabilities;
-  } else {
-    // Otherwise set the audioCapabilities member of accumulated configuration
-    // to an empty sequence.
-    accumulated_configuration->audioCapabilities = audio_capabilities;
-  }
-
-  // 18. If accumulated configuration's distinctiveIdentifier value is
-  //     "optional", follow the steps for the first matching condition
-  //      from the following list:
-  //       - If the implementation requires use Distinctive Identifier(s) or
-  //         Distinctive Permanent Identifier(s) for any of the combinations
-  //         in accumulated configuration, change accumulated configuration's
-  //         distinctiveIdentifier value to "required".
-  //       - Otherwise, change accumulated configuration's
-  //         distinctiveIdentifier value to "not-allowed".
-  if (accumulated_configuration->distinctiveIdentifier ==
-      EmeFeatureRequirement::Optional) {
-    EmeConfigRule not_allowed_rule = GetDistinctiveIdentifierConfigRule(
-        key_systems_->GetDistinctiveIdentifierSupport(key_system),
-        EmeFeatureRequirement::NotAllowed);
-    EmeConfigRule required_rule = GetDistinctiveIdentifierConfigRule(
-        key_systems_->GetDistinctiveIdentifierSupport(key_system),
-        EmeFeatureRequirement::Required);
-    bool not_allowed_supported =
-        config_state->IsRuleSupported(not_allowed_rule);
-    bool required_supported = config_state->IsRuleSupported(required_rule);
-    // If a distinctive identifier is recommend and that is a possible outcome,
-    // prefer that.
-    if (required_supported && config_state->IsIdentifierRecommended() &&
-        config_state->IsPermissionPossible()) {
-      not_allowed_supported = false;
-    }
-    if (not_allowed_supported) {
-      accumulated_configuration->distinctiveIdentifier =
-          EmeFeatureRequirement::NotAllowed;
-      config_state->AddRule(not_allowed_rule);
-    } else if (required_supported) {
-      accumulated_configuration->distinctiveIdentifier =
-          EmeFeatureRequirement::Required;
-      config_state->AddRule(required_rule);
-    } else {
-      // We should not have passed step 6.
-      NOTREACHED();
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-  }
-
-  // 19. If accumulated configuration's persistentState value is "optional",
-  //     follow the steps for the first matching condition from the following
-  //     list:
-  //       - If the implementation requires persisting state for any of the
-  //         combinations in accumulated configuration, change accumulated
-  //         configuration's persistentState value to "required".
-  //       - Otherwise, change accumulated configuration's persistentState
-  //         value to "not-allowed".
-  if (accumulated_configuration->persistentState ==
-      EmeFeatureRequirement::Optional) {
-    EmeConfigRule not_allowed_rule = GetPersistentStateConfigRule(
-        key_systems_->GetPersistentStateSupport(key_system),
-        EmeFeatureRequirement::NotAllowed);
-    EmeConfigRule required_rule = GetPersistentStateConfigRule(
-        key_systems_->GetPersistentStateSupport(key_system),
-        EmeFeatureRequirement::Required);
-    // |distinctiveIdentifier| should not be affected after it is decided.
-    DCHECK(not_allowed_rule == EmeConfigRule::NOT_SUPPORTED ||
-           not_allowed_rule == EmeConfigRule::PERSISTENCE_NOT_ALLOWED);
-    DCHECK(required_rule == EmeConfigRule::NOT_SUPPORTED ||
-           required_rule == EmeConfigRule::PERSISTENCE_REQUIRED);
-    bool not_allowed_supported =
-        config_state->IsRuleSupported(not_allowed_rule);
-    bool required_supported = config_state->IsRuleSupported(required_rule);
-    if (not_allowed_supported) {
-      accumulated_configuration->persistentState =
-          EmeFeatureRequirement::NotAllowed;
-      config_state->AddRule(not_allowed_rule);
-    } else if (required_supported) {
-      accumulated_configuration->persistentState =
-          EmeFeatureRequirement::Required;
-      config_state->AddRule(required_rule);
-    } else {
-      // We should not have passed step 5.
-      NOTREACHED();
-      return CONFIGURATION_NOT_SUPPORTED;
-    }
-  }
-
-  // 20. If implementation in the configuration specified by the combination of
-  //     the values in accumulated configuration is not supported or not allowed
-  //     in the origin, return NotSupported.
-  // TODO(jrummell): can we check that the CDM can't be loaded by the origin?
-
-  // 21. If accumulated configuration's distinctiveIdentifier value is
-  //     "required" and the Distinctive Identifier(s) associated with
-  //     accumulated configuration are not unique per origin and profile
-  //     and clearable:
-  // 21.1. Update restrictions to reflect that all configurations described
-  //       by accumulated configuration do not have user consent.
-  // 21.2. Return ConsentDenied and restrictions.
-  // (Not required as data is unique per origin and clearable.)
-
-  // 22. Let consent status and updated restrictions be the result of running
-  //     the Get Consent Status algorithm on accumulated configuration,
-  //     restrictions and origin and follow the steps for the value of consent
-  //     status from the following list:
-  //       - "ConsentDenied": Return ConsentDenied and updated restrictions.
-  //       - "InformUser": Inform the user that accumulated configuration is
-  //         in use in the origin including, specifically, the information
-  //         that Distinctive Identifier(s) and/or Distinctive Permanent
-  //         Identifier(s) as appropriate will be used if the
-  //         distinctiveIdentifier member of accumulated configuration is
-  //         "required". Continue to the next step.
-  //       - "Allowed": Continue to the next step.
-  // Accumulated configuration's distinctiveIdentifier should be "required" or
-  // "notallowed"" due to step 18. If it is "required", prompt the user for
-  // consent unless it has already been granted.
-  if (accumulated_configuration->distinctiveIdentifier ==
-      EmeFeatureRequirement::Required) {
-    // The caller is responsible for resolving what to do if permission is
-    // required but has been denied (it should treat it as NOT_SUPPORTED).
-    if (!config_state->IsPermissionGranted())
-      return CONFIGURATION_REQUIRES_PERMISSION;
-  }
-
-  // 23. Return accumulated configuration.
-  return CONFIGURATION_SUPPORTED;
-}
-
-void KeySystemConfigSelector::SelectConfig(
-    const blink::WebString& key_system,
-    const blink::WebVector<blink::WebMediaKeySystemConfiguration>&
-        candidate_configurations,
-    const blink::WebSecurityOrigin& security_origin,
-    bool are_secure_codecs_supported,
-    base::Callback<void(const blink::WebMediaKeySystemConfiguration&,
-                        const CdmConfig&)> succeeded_cb,
-    base::Callback<void(const blink::WebString&)> not_supported_cb) {
-  // Continued from requestMediaKeySystemAccess(), step 6, from
-  // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess
-  //
-  // 6.1 If keySystem is not one of the Key Systems supported by the user
-  //     agent, reject promise with a NotSupportedError. String comparison
-  //     is case-sensitive.
-  if (!base::IsStringASCII(key_system)) {
-    not_supported_cb.Run("Only ASCII keySystems are supported");
-    return;
-  }
-
-  std::string key_system_ascii =
-      base::UTF16ToASCII(base::StringPiece16(key_system));
-  if (!key_systems_->IsSupportedKeySystem(key_system_ascii)) {
-    not_supported_cb.Run("Unsupported keySystem");
-    return;
-  }
-
-  // 6.2-6.4. Implemented by OnSelectConfig().
-  // TODO(sandersd): This should be async, ideally not on the main thread.
-  std::unique_ptr<SelectionRequest> request(new SelectionRequest());
-  request->key_system = key_system_ascii;
-  request->candidate_configurations = candidate_configurations;
-  request->security_origin = security_origin;
-  request->are_secure_codecs_supported = are_secure_codecs_supported;
-  request->succeeded_cb = succeeded_cb;
-  request->not_supported_cb = not_supported_cb;
-  SelectConfigInternal(std::move(request));
-}
-
-void KeySystemConfigSelector::SelectConfigInternal(
-    std::unique_ptr<SelectionRequest> request) {
-  // Continued from requestMediaKeySystemAccess(), step 6, from
-  // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess
-  //
-  // 6.2. Let implementation be the implementation of keySystem.
-  //      (|key_systems_| fills this role.)
-  // 6.3. For each value in supportedConfigurations:
-  for (size_t i = 0; i < request->candidate_configurations.size(); i++) {
-    // 6.3.1. Let candidate configuration be the value.
-    // 6.3.2. Let supported configuration be the result of executing the Get
-    //        Supported Configuration algorithm on implementation, candidate
-    //        configuration, and origin.
-    // 6.3.3. If supported configuration is not NotSupported, [initialize
-    //        and return a new MediaKeySystemAccess object.]
-    ConfigState config_state(request->was_permission_requested,
-                             request->is_permission_granted);
-    DCHECK(config_state.IsRuleSupported(
-        EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED));
-    if (!request->are_secure_codecs_supported)
-      config_state.AddRule(EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED);
-    blink::WebMediaKeySystemConfiguration accumulated_configuration;
-    CdmConfig cdm_config;
-    ConfigurationSupport support = GetSupportedConfiguration(
-        request->key_system, request->candidate_configurations[i],
-        &config_state, &accumulated_configuration);
-    switch (support) {
-      case CONFIGURATION_NOT_SUPPORTED:
-        continue;
-      case CONFIGURATION_REQUIRES_PERMISSION:
-        if (request->was_permission_requested) {
-          DVLOG(2) << "Rejecting requested configuration because "
-                   << "permission was denied.";
-          continue;
-        }
-        {
-          // Note: the GURL must not be constructed inline because
-          // base::Passed(&request) sets |request| to null.
-          GURL security_origin(
-              blink::WebStringToGURL(request->security_origin.toString()));
-          media_permission_->RequestPermission(
-              MediaPermission::PROTECTED_MEDIA_IDENTIFIER, security_origin,
-              base::Bind(&KeySystemConfigSelector::OnPermissionResult,
-                         weak_factory_.GetWeakPtr(), base::Passed(&request)));
-        }
-        return;
-      case CONFIGURATION_SUPPORTED:
-        cdm_config.allow_distinctive_identifier =
-            (accumulated_configuration.distinctiveIdentifier ==
-             EmeFeatureRequirement::Required);
-        cdm_config.allow_persistent_state =
-            (accumulated_configuration.persistentState ==
-             EmeFeatureRequirement::Required);
-        cdm_config.use_hw_secure_codecs =
-            config_state.AreHwSecureCodecsRequired();
-        request->succeeded_cb.Run(accumulated_configuration, cdm_config);
-        return;
-    }
-  }
-
-  // 6.4. Reject promise with a NotSupportedError.
-  request->not_supported_cb.Run(
-      "None of the requested configurations were supported.");
-}
-
-void KeySystemConfigSelector::OnPermissionResult(
-    std::unique_ptr<SelectionRequest> request, bool is_permission_granted) {
-  request->was_permission_requested = true;
-  request->is_permission_granted = is_permission_granted;
-  SelectConfigInternal(std::move(request));
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/key_system_config_selector.h b/src/cobalt/media/blink/key_system_config_selector.h
deleted file mode 100644
index 3146805..0000000
--- a/src/cobalt/media/blink/key_system_config_selector.h
+++ /dev/null
@@ -1,98 +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 COBALT_MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
-#define COBALT_MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "cobalt/media/base/eme_constants.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
-
-namespace blink {
-
-struct WebMediaKeySystemConfiguration;
-struct WebMediaKeySystemMediaCapability;
-class WebSecurityOrigin;
-class WebString;
-
-}  // namespace blink
-
-namespace cobalt {
-namespace media {
-
-struct CdmConfig;
-class KeySystems;
-class MediaPermission;
-
-class MEDIA_BLINK_EXPORT KeySystemConfigSelector {
- public:
-  KeySystemConfigSelector(const KeySystems* key_systems,
-                          MediaPermission* media_permission);
-
-  ~KeySystemConfigSelector();
-
-  void SelectConfig(
-      const blink::WebString& key_system,
-      const blink::WebVector<blink::WebMediaKeySystemConfiguration>&
-          candidate_configurations,
-      const blink::WebSecurityOrigin& security_origin,
-      bool are_secure_codecs_supported,
-      base::Callback<void(const blink::WebMediaKeySystemConfiguration&,
-                          const CdmConfig&)> succeeded_cb,
-      base::Callback<void(const blink::WebString&)> not_supported_cb);
-
- private:
-  struct SelectionRequest;
-  class ConfigState;
-
-  enum ConfigurationSupport {
-    CONFIGURATION_NOT_SUPPORTED,
-    CONFIGURATION_REQUIRES_PERMISSION,
-    CONFIGURATION_SUPPORTED,
-  };
-
-  void SelectConfigInternal(std::unique_ptr<SelectionRequest> request);
-
-  void OnPermissionResult(std::unique_ptr<SelectionRequest> request,
-                          bool is_permission_granted);
-
-  ConfigurationSupport GetSupportedConfiguration(
-      const std::string& key_system,
-      const blink::WebMediaKeySystemConfiguration& candidate,
-      ConfigState* config_state,
-      blink::WebMediaKeySystemConfiguration* accumulated_configuration);
-
-  bool GetSupportedCapabilities(
-      const std::string& key_system, EmeMediaType media_type,
-      const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
-          requested_media_capabilities,
-      ConfigState* config_state,
-      std::vector<blink::WebMediaKeySystemMediaCapability>*
-          supported_media_capabilities);
-
-  bool IsSupportedContentType(const std::string& key_system,
-                              EmeMediaType media_type,
-                              const std::string& container_mime_type,
-                              const std::string& codecs,
-                              ConfigState* config_state);
-
-  const KeySystems* key_systems_;
-  MediaPermission* media_permission_;
-  base::WeakPtrFactory<KeySystemConfigSelector> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelector);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_KEY_SYSTEM_CONFIG_SELECTOR_H_
diff --git a/src/cobalt/media/blink/key_system_config_selector_unittest.cc b/src/cobalt/media/blink/key_system_config_selector_unittest.cc
deleted file mode 100644
index 4ee51a8..0000000
--- a/src/cobalt/media/blink/key_system_config_selector_unittest.cc
+++ /dev/null
@@ -1,801 +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 <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "cobalt/media/base/eme_constants.h"
-#include "cobalt/media/base/key_systems.h"
-#include "cobalt/media/base/media_permission.h"
-#include "cobalt/media/blink/key_system_config_selector.h"
-#include "googleurl/src/gurl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h"
-#include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-namespace {
-
-const char kSupported[] = "supported";
-const char kRecommendIdentifier[] = "recommend_identifier";
-const char kRequireIdentifier[] = "require_identifier";
-const char kUnsupported[] = "unsupported";
-
-// TODO: Audio and video variants (doesn't matter for now because the checks are
-// in KeySystems).
-const char kSupportedContainer[] = "video/webm";
-const char kUnsupportedContainer[] = "video/foo";
-
-// TODO(sandersd): Extended codec variants (requires proprietary codec support).
-const char kSupportedCodec[] = "vp8";
-const char kUnsupportedCodec[] = "foo";
-const char kUnsupportedCodecs[] = "vp8,foo";
-const char kSupportedCodecs[] = "vp8,vp8";
-
-const char kDefaultSecurityOrigin[] = "https://example.com/";
-
-// The IDL for MediaKeySystemConfiguration specifies some defaults, so
-// create a default object that mimics what would be created if an empty
-// dictionary was passed in.
-blink::WebMediaKeySystemConfiguration DefaultConfiguration() {
-  // http://w3c.github.io/encrypted-media/#mediakeysystemconfiguration-dictionary
-  // If this member (sessionTypes) is not present when the dictionary
-  // is passed to requestMediaKeySystemAccess(), the dictionary will
-  // be treated as if this member is set to [ "temporary" ].
-  std::vector<blink::WebEncryptedMediaSessionType> session_types;
-  session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
-
-  blink::WebMediaKeySystemConfiguration config;
-  config.label = "";
-  config.sessionTypes = session_types;
-  return config;
-}
-
-class FakeKeySystems : public KeySystems {
- public:
-  ~FakeKeySystems() override {}
-
-  bool IsSupportedKeySystem(const std::string& key_system) const override {
-    if (key_system == kSupported) return true;
-    return false;
-  }
-
-  // TODO(sandersd): Move implementation into KeySystemConfigSelector?
-  bool IsSupportedInitDataType(const std::string& key_system,
-                               EmeInitDataType init_data_type) const override {
-    switch (init_data_type) {
-      case EmeInitDataType::UNKNOWN:
-        return false;
-      case EmeInitDataType::WEBM:
-        return init_data_type_webm_supported_;
-      case EmeInitDataType::CENC:
-        return init_data_type_cenc_supported_;
-      case EmeInitDataType::KEYIDS:
-        return init_data_type_keyids_supported_;
-    }
-    NOTREACHED();
-    return false;
-  }
-
-  // TODO(sandersd): Secure codec simulation.
-  EmeConfigRule GetContentTypeConfigRule(
-      const std::string& key_system, EmeMediaType media_type,
-      const std::string& container_mime_type,
-      const std::vector<std::string>& codecs) const override {
-    if (container_mime_type == kUnsupportedContainer)
-      return EmeConfigRule::NOT_SUPPORTED;
-    DCHECK_EQ(kSupportedContainer, container_mime_type);
-    for (const std::string& codec : codecs) {
-      if (codec == kUnsupportedCodec) return EmeConfigRule::NOT_SUPPORTED;
-      DCHECK_EQ(kSupportedCodec, codec);
-    }
-    return EmeConfigRule::SUPPORTED;
-  }
-
-  EmeConfigRule GetRobustnessConfigRule(
-      const std::string& key_system, EmeMediaType media_type,
-      const std::string& requested_robustness) const override {
-    if (requested_robustness == kUnsupported)
-      return EmeConfigRule::NOT_SUPPORTED;
-    if (requested_robustness == kRequireIdentifier)
-      return EmeConfigRule::IDENTIFIER_REQUIRED;
-    if (requested_robustness == kRecommendIdentifier)
-      return EmeConfigRule::IDENTIFIER_RECOMMENDED;
-    if (requested_robustness == kSupported) return EmeConfigRule::SUPPORTED;
-    NOTREACHED();
-    return EmeConfigRule::NOT_SUPPORTED;
-  }
-
-  EmeSessionTypeSupport GetPersistentLicenseSessionSupport(
-      const std::string& key_system) const override {
-    return persistent_license;
-  }
-
-  EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport(
-      const std::string& key_system) const override {
-    return persistent_release_message;
-  }
-
-  EmeFeatureSupport GetPersistentStateSupport(
-      const std::string& key_system) const override {
-    return persistent_state;
-  }
-
-  EmeFeatureSupport GetDistinctiveIdentifierSupport(
-      const std::string& key_system) const override {
-    return distinctive_identifier;
-  }
-
-  bool init_data_type_webm_supported_ = false;
-  bool init_data_type_cenc_supported_ = false;
-  bool init_data_type_keyids_supported_ = false;
-
-  // INVALID so that they must be set in any test that needs them.
-  EmeSessionTypeSupport persistent_license = EmeSessionTypeSupport::INVALID;
-  EmeSessionTypeSupport persistent_release_message =
-      EmeSessionTypeSupport::INVALID;
-
-  // Every test implicitly requires these, so they must be set. They are set to
-  // values that are likely to cause tests to fail if they are accidentally
-  // depended on. Test cases explicitly depending on them should set them, as
-  // the default values may be changed.
-  EmeFeatureSupport persistent_state = EmeFeatureSupport::NOT_SUPPORTED;
-  EmeFeatureSupport distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-};
-
-class FakeMediaPermission : public MediaPermission {
- public:
-  void HasPermission(Type type, const GURL& security_origin,
-                     const PermissionStatusCB& permission_status_cb) override {
-    permission_status_cb.Run(is_granted);
-  }
-
-  void RequestPermission(
-      Type type, const GURL& security_origin,
-      const PermissionStatusCB& permission_status_cb) override {
-    requests++;
-    permission_status_cb.Run(is_granted);
-  }
-
-  int requests = 0;
-  bool is_granted = false;
-};
-
-}  // namespace
-
-class KeySystemConfigSelectorTest : public testing::Test {
- public:
-  KeySystemConfigSelectorTest()
-      : key_systems_(new FakeKeySystems()),
-        media_permission_(new FakeMediaPermission()) {}
-
-  void SelectConfig() {
-    media_permission_->requests = 0;
-    succeeded_count_ = 0;
-    not_supported_count_ = 0;
-    KeySystemConfigSelector(key_systems_.get(), media_permission_.get())
-        .SelectConfig(key_system_, configs_, security_origin_, false,
-                      base::Bind(&KeySystemConfigSelectorTest::OnSucceeded,
-                                 base::Unretained(this)),
-                      base::Bind(&KeySystemConfigSelectorTest::OnNotSupported,
-                                 base::Unretained(this)));
-  }
-
-  bool SelectConfigReturnsConfig() {
-    SelectConfig();
-    EXPECT_EQ(0, media_permission_->requests);
-    EXPECT_EQ(1, succeeded_count_);
-    EXPECT_EQ(0, not_supported_count_);
-    return (succeeded_count_ != 0);
-  }
-
-  bool SelectConfigReturnsError() {
-    SelectConfig();
-    EXPECT_EQ(0, media_permission_->requests);
-    EXPECT_EQ(0, succeeded_count_);
-    EXPECT_EQ(1, not_supported_count_);
-    return (not_supported_count_ != 0);
-  }
-
-  bool SelectConfigRequestsPermissionAndReturnsConfig() {
-    SelectConfig();
-    EXPECT_EQ(1, media_permission_->requests);
-    EXPECT_EQ(1, succeeded_count_);
-    EXPECT_EQ(0, not_supported_count_);
-    return (media_permission_->requests != 0 && succeeded_count_ != 0);
-  }
-
-  bool SelectConfigRequestsPermissionAndReturnsError() {
-    SelectConfig();
-    EXPECT_EQ(1, media_permission_->requests);
-    EXPECT_EQ(0, succeeded_count_);
-    EXPECT_EQ(1, not_supported_count_);
-    return (media_permission_->requests != 0 && not_supported_count_ != 0);
-  }
-
-  void OnSucceeded(const blink::WebMediaKeySystemConfiguration& result,
-                   const CdmConfig& cdm_config) {
-    succeeded_count_++;
-    config_ = result;
-  }
-
-  void OnNotSupported(const blink::WebString&) { not_supported_count_++; }
-
-  std::unique_ptr<FakeKeySystems> key_systems_;
-  std::unique_ptr<FakeMediaPermission> media_permission_;
-
-  // Held values for the call to SelectConfig().
-  blink::WebString key_system_ = blink::WebString::fromUTF8(kSupported);
-  std::vector<blink::WebMediaKeySystemConfiguration> configs_;
-  blink::WebSecurityOrigin security_origin_ =
-      blink::WebSecurityOrigin::createFromString(kDefaultSecurityOrigin);
-
-  // Holds the last successful accumulated configuration.
-  blink::WebMediaKeySystemConfiguration config_;
-
-  int succeeded_count_;
-  int not_supported_count_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(KeySystemConfigSelectorTest);
-};
-
-// --- Basics ---
-
-TEST_F(KeySystemConfigSelectorTest, NoConfigs) {
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, DefaultConfig) {
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-
-  // label = "";
-  ASSERT_EQ("", config.label);
-
-  // initDataTypes = [];
-  ASSERT_EQ(0u, config.initDataTypes.size());
-
-  // audioCapabilities = [];
-  ASSERT_EQ(0u, config.audioCapabilities.size());
-
-  // videoCapabilities = [];
-  ASSERT_EQ(0u, config.videoCapabilities.size());
-
-  // distinctiveIdentifier = "optional";
-  ASSERT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Optional,
-            config.distinctiveIdentifier);
-
-  // persistentState = "optional";
-  ASSERT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Optional,
-            config.persistentState);
-
-  // If this member is not present when the dictionary is passed to
-  // requestMediaKeySystemAccess(), the dictionary will be treated as
-  // if this member is set to [ "temporary" ].
-  ASSERT_EQ(1u, config.sessionTypes.size());
-  ASSERT_EQ(blink::WebEncryptedMediaSessionType::Temporary,
-            config.sessionTypes[0]);
-}
-
-// Most of the tests below assume that the default config is valid.
-TEST_F(KeySystemConfigSelectorTest, EmptyConfig) {
-  configs_.push_back(DefaultConfiguration());
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_EQ("", config_.label);
-  EXPECT_TRUE(config_.initDataTypes.isEmpty());
-  EXPECT_TRUE(config_.audioCapabilities.isEmpty());
-  EXPECT_TRUE(config_.videoCapabilities.isEmpty());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed,
-            config_.distinctiveIdentifier);
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed,
-            config_.persistentState);
-  ASSERT_EQ(1u, config_.sessionTypes.size());
-  EXPECT_EQ(blink::WebEncryptedMediaSessionType::Temporary,
-            config_.sessionTypes[0]);
-}
-
-TEST_F(KeySystemConfigSelectorTest, Label) {
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.label = "foo";
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_EQ("foo", config_.label);
-}
-
-// --- keySystem ---
-// Empty is not tested because the empty check is in Blink.
-
-TEST_F(KeySystemConfigSelectorTest, KeySystem_NonAscii) {
-  key_system_ = "\xde\xad\xbe\xef";
-  configs_.push_back(DefaultConfiguration());
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, KeySystem_Unsupported) {
-  key_system_ = kUnsupported;
-  configs_.push_back(DefaultConfiguration());
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-// --- initDataTypes ---
-
-TEST_F(KeySystemConfigSelectorTest, InitDataTypes_Empty) {
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-}
-
-TEST_F(KeySystemConfigSelectorTest, InitDataTypes_NoneSupported) {
-  key_systems_->init_data_type_webm_supported_ = true;
-
-  std::vector<blink::WebEncryptedMediaInitDataType> init_data_types;
-  init_data_types.push_back(blink::WebEncryptedMediaInitDataType::Unknown);
-  init_data_types.push_back(blink::WebEncryptedMediaInitDataType::Cenc);
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.initDataTypes = init_data_types;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, InitDataTypes_SubsetSupported) {
-  key_systems_->init_data_type_webm_supported_ = true;
-
-  std::vector<blink::WebEncryptedMediaInitDataType> init_data_types;
-  init_data_types.push_back(blink::WebEncryptedMediaInitDataType::Unknown);
-  init_data_types.push_back(blink::WebEncryptedMediaInitDataType::Cenc);
-  init_data_types.push_back(blink::WebEncryptedMediaInitDataType::Webm);
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.initDataTypes = init_data_types;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ(1u, config_.initDataTypes.size());
-  EXPECT_EQ(blink::WebEncryptedMediaInitDataType::Webm,
-            config_.initDataTypes[0]);
-}
-
-// --- distinctiveIdentifier ---
-
-TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Default) {
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed,
-            config_.distinctiveIdentifier);
-}
-
-TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Forced) {
-  media_permission_->is_granted = true;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::ALWAYS_ENABLED;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Required,
-            config_.distinctiveIdentifier);
-}
-
-TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Blocked) {
-  key_systems_->distinctive_identifier = EmeFeatureSupport::NOT_SUPPORTED;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Required;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RequestsPermission) {
-  media_permission_->is_granted = true;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Required;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Required,
-            config_.distinctiveIdentifier);
-}
-
-TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RespectsPermission) {
-  media_permission_->is_granted = false;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Required;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsError());
-}
-
-// --- persistentState ---
-
-TEST_F(KeySystemConfigSelectorTest, PersistentState_Default) {
-  key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.persistentState =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed,
-            config_.persistentState);
-}
-
-TEST_F(KeySystemConfigSelectorTest, PersistentState_Forced) {
-  key_systems_->persistent_state = EmeFeatureSupport::ALWAYS_ENABLED;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.persistentState =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Required,
-            config_.persistentState);
-}
-
-TEST_F(KeySystemConfigSelectorTest, PersistentState_Blocked) {
-  key_systems_->persistent_state = EmeFeatureSupport::ALWAYS_ENABLED;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.persistentState =
-      blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-// --- sessionTypes ---
-
-TEST_F(KeySystemConfigSelectorTest, SessionTypes_Empty) {
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-
-  // Default configuration has [ "temporary" ].
-  std::vector<blink::WebEncryptedMediaSessionType> session_types;
-  config.sessionTypes = session_types;
-
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_TRUE(config_.sessionTypes.isEmpty());
-}
-
-TEST_F(KeySystemConfigSelectorTest, SessionTypes_SubsetSupported) {
-  // Allow persistent state, as it would be required to be successful.
-  key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
-  key_systems_->persistent_license = EmeSessionTypeSupport::NOT_SUPPORTED;
-
-  std::vector<blink::WebEncryptedMediaSessionType> session_types;
-  session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
-  session_types.push_back(
-      blink::WebEncryptedMediaSessionType::PersistentLicense);
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.sessionTypes = session_types;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, SessionTypes_AllSupported) {
-  // Allow persistent state, and expect it to be required.
-  key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
-  key_systems_->persistent_license = EmeSessionTypeSupport::SUPPORTED;
-
-  std::vector<blink::WebEncryptedMediaSessionType> session_types;
-  session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
-  session_types.push_back(
-      blink::WebEncryptedMediaSessionType::PersistentLicense);
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.persistentState =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  config.sessionTypes = session_types;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Required,
-            config_.persistentState);
-  ASSERT_EQ(2u, config_.sessionTypes.size());
-  EXPECT_EQ(blink::WebEncryptedMediaSessionType::Temporary,
-            config_.sessionTypes[0]);
-  EXPECT_EQ(blink::WebEncryptedMediaSessionType::PersistentLicense,
-            config_.sessionTypes[1]);
-}
-
-TEST_F(KeySystemConfigSelectorTest, SessionTypes_PermissionCanBeRequired) {
-  media_permission_->is_granted = true;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-  key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
-  key_systems_->persistent_license =
-      EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER;
-
-  std::vector<blink::WebEncryptedMediaSessionType> session_types;
-  session_types.push_back(
-      blink::WebEncryptedMediaSessionType::PersistentLicense);
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  config.persistentState =
-      blink::WebMediaKeySystemConfiguration::Requirement::Optional;
-  config.sessionTypes = session_types;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Required,
-            config_.distinctiveIdentifier);
-}
-
-// --- videoCapabilities ---
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Empty) {
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_NoneSupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(2);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kUnsupportedContainer;
-  video_capabilities[1].contentType = "b";
-  video_capabilities[1].mimeType = kSupportedContainer;
-  video_capabilities[1].codecs = kUnsupportedCodec;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_SubsetSupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(2);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kUnsupportedContainer;
-  video_capabilities[1].contentType = "b";
-  video_capabilities[1].mimeType = kSupportedContainer;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ(1u, config_.videoCapabilities.size());
-  EXPECT_EQ("b", config_.videoCapabilities[0].contentType);
-  EXPECT_EQ(kSupportedContainer, config_.videoCapabilities[0].mimeType);
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_AllSupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(2);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[1].contentType = "b";
-  video_capabilities[1].mimeType = kSupportedContainer;
-  video_capabilities[1].codecs = kSupportedCodecs;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ(2u, config_.videoCapabilities.size());
-  EXPECT_EQ("a", config_.videoCapabilities[0].contentType);
-  EXPECT_EQ("b", config_.videoCapabilities[1].contentType);
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Codecs_SubsetSupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[0].codecs = kUnsupportedCodecs;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Codecs_AllSupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[0].codecs = kSupportedCodecs;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ(1u, config_.videoCapabilities.size());
-  EXPECT_EQ(kSupportedCodecs, config_.videoCapabilities[0].codecs);
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Robustness_Supported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[0].robustness = kSupported;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ(1u, config_.videoCapabilities.size());
-  EXPECT_EQ(kSupported, config_.videoCapabilities[0].robustness);
-}
-
-TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Robustness_Unsupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[0].robustness = kUnsupported;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsError());
-}
-
-TEST_F(KeySystemConfigSelectorTest,
-       VideoCapabilities_Robustness_PermissionCanBeRequired) {
-  media_permission_->is_granted = true;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[0].robustness = kRequireIdentifier;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::Required,
-            config_.distinctiveIdentifier);
-}
-
-TEST_F(KeySystemConfigSelectorTest,
-       VideoCapabilities_Robustness_PermissionCanBeRecommended) {
-  media_permission_->is_granted = false;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
-  video_capabilities[0].contentType = "a";
-  video_capabilities[0].mimeType = kSupportedContainer;
-  video_capabilities[0].robustness = kRecommendIdentifier;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.videoCapabilities = video_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  EXPECT_EQ(blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed,
-            config_.distinctiveIdentifier);
-}
-
-// --- audioCapabilities ---
-// These are handled by the same code as |videoCapabilities|, so only minimal
-// additional testing is done.
-
-TEST_F(KeySystemConfigSelectorTest, AudioCapabilities_SubsetSupported) {
-  std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities(2);
-  audio_capabilities[0].contentType = "a";
-  audio_capabilities[0].mimeType = kUnsupportedContainer;
-  audio_capabilities[1].contentType = "b";
-  audio_capabilities[1].mimeType = kSupportedContainer;
-
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.audioCapabilities = audio_capabilities;
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ(1u, config_.audioCapabilities.size());
-  EXPECT_EQ("b", config_.audioCapabilities[0].contentType);
-  EXPECT_EQ(kSupportedContainer, config_.audioCapabilities[0].mimeType);
-}
-
-// --- Multiple configurations ---
-
-TEST_F(KeySystemConfigSelectorTest, Configurations_AllSupported) {
-  blink::WebMediaKeySystemConfiguration config = DefaultConfiguration();
-  config.label = "a";
-  configs_.push_back(config);
-  config.label = "b";
-  configs_.push_back(config);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ("a", config_.label);
-}
-
-TEST_F(KeySystemConfigSelectorTest, Configurations_SubsetSupported) {
-  blink::WebMediaKeySystemConfiguration config1 = DefaultConfiguration();
-  config1.label = "a";
-  std::vector<blink::WebEncryptedMediaInitDataType> init_data_types;
-  init_data_types.push_back(blink::WebEncryptedMediaInitDataType::Unknown);
-  config1.initDataTypes = init_data_types;
-  configs_.push_back(config1);
-
-  blink::WebMediaKeySystemConfiguration config2 = DefaultConfiguration();
-  config2.label = "b";
-  configs_.push_back(config2);
-
-  ASSERT_TRUE(SelectConfigReturnsConfig());
-  ASSERT_EQ("b", config_.label);
-}
-
-TEST_F(KeySystemConfigSelectorTest,
-       Configurations_FirstRequiresPermission_Allowed) {
-  media_permission_->is_granted = true;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  blink::WebMediaKeySystemConfiguration config1 = DefaultConfiguration();
-  config1.label = "a";
-  config1.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Required;
-  configs_.push_back(config1);
-
-  blink::WebMediaKeySystemConfiguration config2 = DefaultConfiguration();
-  config2.label = "b";
-  configs_.push_back(config2);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  ASSERT_EQ("a", config_.label);
-}
-
-TEST_F(KeySystemConfigSelectorTest,
-       Configurations_FirstRequiresPermission_Rejected) {
-  media_permission_->is_granted = false;
-  key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
-
-  blink::WebMediaKeySystemConfiguration config1 = DefaultConfiguration();
-  config1.label = "a";
-  config1.distinctiveIdentifier =
-      blink::WebMediaKeySystemConfiguration::Requirement::Required;
-  configs_.push_back(config1);
-
-  blink::WebMediaKeySystemConfiguration config2 = DefaultConfiguration();
-  config2.label = "b";
-  configs_.push_back(config2);
-
-  ASSERT_TRUE(SelectConfigRequestsPermissionAndReturnsConfig());
-  ASSERT_EQ("b", config_.label);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/lru.h b/src/cobalt/media/blink/lru.h
deleted file mode 100644
index ec54b34..0000000
--- a/src/cobalt/media/blink/lru.h
+++ /dev/null
@@ -1,95 +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 COBALT_MEDIA_BLINK_LRU_H_
-#define COBALT_MEDIA_BLINK_LRU_H_
-
-#include <list>
-
-#include "base/basictypes.h"
-#include "base/hash_tables.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-
-// Simple LRU (least recently used) class.
-// Keeps track of a set of data and lets you get the least recently used
-// (oldest) element at any time. All operations are O(1). Elements are expected
-// to be hashable and unique.
-// Example:
-//  LRU<int> lru;
-//  lru.Insert(1);
-//  lru.Insert(2);
-//  lru.Insert(3);
-//  lru.Use(1);
-//  cout << lru.Pop();  // this will print "2"
-template <typename T>
-class LRU {
- public:
-  LRU() {}
-
-  // Adds |x| to LRU.
-  // |x| must not already be in the LRU.
-  // Faster than Use(), and will DCHECK that |x| is not in the LRU.
-  void Insert(const T& x) {
-    DCHECK(!Contains(x));
-    lru_.push_front(x);
-    pos_[x] = lru_.begin();
-  }
-
-  // Removes |x| from LRU.
-  // |x| must be in the LRU.
-  void Remove(const T& x) {
-    DCHECK(Contains(x));
-    lru_.erase(pos_[x]);
-    pos_.erase(x);
-  }
-
-  // Moves |x| to front of LRU. (most recently used)
-  // If |x| is not in LRU, it is added.
-  // Please call Insert() if you know that |x| is not in the LRU.
-  void Use(const T& x) {
-    if (Contains(x)) Remove(x);
-    Insert(x);
-  }
-
-  bool Empty() const { return lru_.empty(); }
-
-  // Returns the Least Recently Used T and removes it.
-  T Pop() {
-    DCHECK(!Empty());
-    T ret = lru_.back();
-    lru_.pop_back();
-    pos_.erase(ret);
-    return ret;
-  }
-
-  // Returns the Least Recently Used T _without_ removing it.
-  T Peek() const {
-    DCHECK(!Empty());
-    return lru_.back();
-  }
-
-  bool Contains(const T& x) const { return pos_.find(x) != pos_.end(); }
-
-  size_t Size() const { return pos_.size(); }
-
- private:
-  friend class LRUTest;
-
-  // Linear list of elements, most recently used first.
-  std::list<T> lru_;
-
-  // Maps element values to positions in the list so that we
-  // can quickly remove elements.
-  base::hash_map<T, typename std::list<T>::iterator> pos_;
-
-  DISALLOW_COPY_AND_ASSIGN(LRU);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_LRU_H_
diff --git a/src/cobalt/media/blink/lru_unittest.cc b/src/cobalt/media/blink/lru_unittest.cc
deleted file mode 100644
index 1bb0d34..0000000
--- a/src/cobalt/media/blink/lru_unittest.cc
+++ /dev/null
@@ -1,235 +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 <list>
-
-#include "base/logging.h"
-#include "cobalt/media/base/test_random.h"
-#include "cobalt/media/blink/lru.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-// Range of integer used in tests below.
-// We keep the integers small to get lots of re-use of integers.
-const int kTestIntRange = 16;
-
-namespace cobalt {
-namespace media {
-
-class LRUTest;
-
-class SimpleLRU {
- public:
-  void Insert(int x) {
-    DCHECK(!Contains(x));
-    data_.push_back(x);
-  }
-
-  void Remove(int x) {
-    for (std::list<int>::iterator i = data_.begin(); i != data_.end(); ++i) {
-      if (*i == x) {
-        data_.erase(i);
-        DCHECK(!Contains(x));
-        return;
-      }
-    }
-    LOG(FATAL) << "Remove non-existing element " << x;
-  }
-
-  void Use(int x) {
-    if (Contains(x)) Remove(x);
-    Insert(x);
-  }
-
-  bool Empty() const { return data_.empty(); }
-
-  int Pop() {
-    DCHECK(!Empty());
-    int ret = data_.front();
-    data_.pop_front();
-    return ret;
-  }
-
-  int Peek() {
-    DCHECK(!Empty());
-    return data_.front();
-  }
-
-  bool Contains(int x) const {
-    for (std::list<int>::const_iterator i = data_.begin(); i != data_.end();
-         ++i) {
-      if (*i == x) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  size_t Size() const { return data_.size(); }
-
- private:
-  friend class LRUTest;
-  std::list<int> data_;
-};
-
-class LRUTest : public testing::Test {
- public:
-  LRUTest() : rnd_(42) {}
-
-  void Insert(int x) {
-    truth_.Insert(x);
-    testee_.Insert(x);
-    Compare();
-  }
-
-  void Remove(int x) {
-    truth_.Remove(x);
-    testee_.Remove(x);
-    Compare();
-  }
-
-  void Use(int x) {
-    truth_.Use(x);
-    testee_.Use(x);
-    Compare();
-  }
-
-  int Pop() {
-    int truth_value = truth_.Pop();
-    int testee_value = testee_.Pop();
-    EXPECT_EQ(truth_value, testee_value);
-    Compare();
-    return truth_value;
-  }
-
-  void Compare() {
-    EXPECT_EQ(truth_.Size(), testee_.Size());
-    auto testee_iterator = testee_.lru_.rbegin();
-    for (const auto truth : truth_.data_) {
-      EXPECT_TRUE(testee_iterator != testee_.lru_.rend());
-      EXPECT_EQ(truth, *testee_iterator);
-      ++testee_iterator;
-    }
-    EXPECT_TRUE(testee_iterator == testee_.lru_.rend());
-  }
-
-  bool Empty() const {
-    EXPECT_EQ(truth_.Empty(), testee_.Empty());
-    return truth_.Empty();
-  }
-
-  bool Contains(int i) const {
-    EXPECT_EQ(truth_.Contains(i), testee_.Contains(i));
-    return testee_.Contains(i);
-  }
-
-  void Clear() {
-    while (!Empty()) Pop();
-  }
-
-  int Peek() {
-    EXPECT_EQ(truth_.Peek(), testee_.Peek());
-    return testee_.Peek();
-  }
-
- protected:
-  media::TestRandom rnd_;
-  SimpleLRU truth_;
-  media::LRU<int> testee_;
-};
-
-TEST_F(LRUTest, SimpleTest) {
-  Insert(1);  // 1
-  Insert(2);  // 1 2
-  Insert(3);  // 1 2 3
-  EXPECT_EQ(1, Peek());
-  EXPECT_EQ(1, Pop());  // 2 3
-  EXPECT_EQ(2, Peek());
-  Use(2);  // 3 2
-  EXPECT_EQ(3, Peek());
-  EXPECT_EQ(3, Pop());  // 2
-  EXPECT_EQ(2, Pop());
-  EXPECT_TRUE(Empty());
-}
-
-TEST_F(LRUTest, UseTest) {
-  EXPECT_TRUE(Empty());
-  // Using a value that's not on the LRU adds it.
-  Use(3);  // 3
-  EXPECT_EQ(3, Peek());
-  Use(5);  // 3 5
-  EXPECT_EQ(3, Peek());
-  EXPECT_TRUE(Contains(5));
-  Use(7);  // 3 5 7
-  EXPECT_EQ(3, Peek());
-  EXPECT_TRUE(Contains(7));
-  // Using a value that's alraedy on the LRU moves it to the top.
-  Use(3);  // 5 7 3
-  EXPECT_EQ(5, Peek());
-  EXPECT_TRUE(Contains(5));
-  EXPECT_EQ(5, Pop());  // 7 3
-  EXPECT_FALSE(Contains(5));
-  EXPECT_EQ(7, Peek());
-  EXPECT_TRUE(Contains(7));
-  EXPECT_TRUE(Contains(3));
-  Use(9);  // 7 3 9
-  EXPECT_EQ(7, Peek());
-  // Using the same value again has no effect.
-  Use(9);  // 7 3 9
-  EXPECT_EQ(7, Peek());
-  Use(3);  // 7 9 3
-  EXPECT_EQ(7, Pop());
-  EXPECT_EQ(9, Pop());
-  EXPECT_EQ(3, Pop());
-  EXPECT_TRUE(Empty());
-}
-
-TEST_F(LRUTest, RemoveTest) {
-  Insert(5);  // 5
-  Insert(4);  // 5 4
-  Insert(3);  // 5 4 3
-  Insert(2);  // 5 4 3 2
-  Insert(1);  // 5 4 3 2 1
-  EXPECT_EQ(5, Peek());
-  Remove(5);  // 4 3 2 1
-  EXPECT_EQ(4, Peek());
-  Remove(1);  // 4 3 2
-  EXPECT_EQ(4, Peek());
-  Remove(3);  // 4 2
-  EXPECT_EQ(4, Pop());
-  EXPECT_EQ(2, Pop());
-  EXPECT_TRUE(Empty());
-}
-
-TEST_F(LRUTest, RandomTest) {
-  for (int j = 0; j < 100; j++) {
-    Clear();
-    for (int i = 0; i < 1000; i++) {
-      int value = rnd_.Rand() % kTestIntRange;
-      switch (rnd_.Rand() % 3) {
-        case 0:
-          if (!Empty()) Pop();
-          break;
-
-        case 1:
-          Use(value);
-          break;
-
-        case 2:
-          if (Contains(value)) {
-            Remove(value);
-          } else {
-            Insert(value);
-          }
-          break;
-      }
-      if (HasFailure()) {
-        return;
-      }
-    }
-  }
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/media_blink_export.h b/src/cobalt/media/blink/media_blink_export.h
deleted file mode 100644
index 42325e5..0000000
--- a/src/cobalt/media/blink/media_blink_export.h
+++ /dev/null
@@ -1,32 +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_MEDIA_BLINK_EXPORT_H_
-#define MEDIA_BLINK_MEDIA_BLINK_EXPORT_H_
-
-// Define MEDIA_BLINK_EXPORT so that functionality implemented by the
-// media/blink module can be exported to consumers.
-
-#if defined(COMPONENT_BUILD)
-#if defined(WIN32)
-
-#if defined(MEDIA_BLINK_IMPLEMENTATION)
-#define MEDIA_BLINK_EXPORT __declspec(dllexport)
-#else
-#define MEDIA_BLINK_EXPORT __declspec(dllimport)
-#endif  // defined(MEDIA_IMPLEMENTATION)
-
-#else  // defined(WIN32)
-#if defined(MEDIA_BLINK_IMPLEMENTATION)
-#define MEDIA_BLINK_EXPORT __attribute__((visibility("default")))
-#else
-#define MEDIA_BLINK_EXPORT
-#endif
-#endif
-
-#else  // defined(COMPONENT_BUILD)
-#define MEDIA_BLINK_EXPORT
-#endif
-
-#endif  // MEDIA_BLINK_MEDIA_BLINK_EXPORT_H_
diff --git a/src/cobalt/media/blink/mock_weburlloader.cc b/src/cobalt/media/blink/mock_weburlloader.cc
deleted file mode 100644
index 4f3c77b..0000000
--- a/src/cobalt/media/blink/mock_weburlloader.cc
+++ /dev/null
@@ -1,20 +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.
-
-#include "cobalt/media/blink/mock_weburlloader.h"
-
-#include "third_party/WebKit/public/platform/WebData.h"
-#include "third_party/WebKit/public/platform/WebURLError.h"
-#include "third_party/WebKit/public/platform/WebURLRequest.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-
-namespace cobalt {
-namespace media {
-
-MockWebURLLoader::MockWebURLLoader() {}
-
-MockWebURLLoader::~MockWebURLLoader() {}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/mock_weburlloader.h b/src/cobalt/media/blink/mock_weburlloader.h
deleted file mode 100644
index 1c2e910..0000000
--- a/src/cobalt/media/blink/mock_weburlloader.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_MOCK_WEBURLLOADER_H_
-#define COBALT_MEDIA_BLINK_MOCK_WEBURLLOADER_H_
-
-#include "base/basictypes.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/WebKit/public/platform/WebURLLoader.h"
-
-namespace cobalt {
-namespace media {
-
-class MockWebURLLoader : public blink::WebURLLoader {
- public:
-  MockWebURLLoader();
-  virtual ~MockWebURLLoader();
-
-  MOCK_METHOD5(loadSynchronously,
-               void(const blink::WebURLRequest& request,
-                    blink::WebURLResponse& response, blink::WebURLError& error,
-                    blink::WebData& data, int64_t& encoded_data_length));
-  MOCK_METHOD2(loadAsynchronously, void(const blink::WebURLRequest& request,
-                                        blink::WebURLLoaderClient* client));
-  MOCK_METHOD0(cancel, void());
-  MOCK_METHOD1(setDefersLoading, void(bool value));
-  MOCK_METHOD1(setLoadingTaskRunner, void(blink::WebTaskRunner* task_runner));
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MockWebURLLoader);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_MOCK_WEBURLLOADER_H_
diff --git a/src/cobalt/media/blink/multibuffer.cc b/src/cobalt/media/blink/multibuffer.cc
deleted file mode 100644
index 8f526a4..0000000
--- a/src/cobalt/media/blink/multibuffer.cc
+++ /dev/null
@@ -1,515 +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 "cobalt/media/blink/multibuffer.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/location.h"
-
-namespace cobalt {
-namespace media {
-
-// Prune 80 blocks per 30 seconds.
-// This means a full cache will go away in ~5 minutes.
-enum {
-  kBlockPruneInterval = 30,
-  kBlocksPrunedPerInterval = 80,
-};
-
-// Returns the block ID closest to (but less or equal than) |pos| from |index|.
-template <class T>
-static MultiBuffer::BlockId ClosestPreviousEntry(
-    const std::map<MultiBuffer::BlockId, T>& index, MultiBuffer::BlockId pos) {
-  auto i = index.upper_bound(pos);
-  DCHECK(i == index.end() || i->first > pos);
-  if (i == index.begin()) {
-    return std::numeric_limits<MultiBufferBlockId>::min();
-  }
-  --i;
-  DCHECK_LE(i->first, pos);
-  return i->first;
-}
-
-// Returns the block ID closest to (but greter than or equal to) |pos|
-// from |index|.
-template <class T>
-static MultiBuffer::BlockId ClosestNextEntry(
-    const std::map<MultiBuffer::BlockId, T>& index, MultiBuffer::BlockId pos) {
-  auto i = index.lower_bound(pos);
-  if (i == index.end()) {
-    return std::numeric_limits<MultiBufferBlockId>::max();
-  }
-  DCHECK_GE(i->first, pos);
-  return i->first;
-}
-
-//
-// MultiBuffer::GlobalLRU
-//
-MultiBuffer::GlobalLRU::GlobalLRU(
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
-    : max_size_(0),
-      data_size_(0),
-      background_pruning_pending_(false),
-      task_runner_(task_runner) {}
-
-MultiBuffer::GlobalLRU::~GlobalLRU() {
-  // By the time we're freed, all blocks should have been removed,
-  // and our sums should be zero.
-  DCHECK(lru_.Empty());
-  DCHECK_EQ(max_size_, 0);
-  DCHECK_EQ(data_size_, 0);
-}
-
-void MultiBuffer::GlobalLRU::Use(MultiBuffer* multibuffer,
-                                 MultiBufferBlockId block_id) {
-  GlobalBlockId id(multibuffer, block_id);
-  lru_.Use(id);
-  SchedulePrune();
-}
-
-void MultiBuffer::GlobalLRU::Insert(MultiBuffer* multibuffer,
-                                    MultiBufferBlockId block_id) {
-  GlobalBlockId id(multibuffer, block_id);
-  lru_.Insert(id);
-  SchedulePrune();
-}
-
-void MultiBuffer::GlobalLRU::Remove(MultiBuffer* multibuffer,
-                                    MultiBufferBlockId block_id) {
-  GlobalBlockId id(multibuffer, block_id);
-  lru_.Remove(id);
-}
-
-bool MultiBuffer::GlobalLRU::Contains(MultiBuffer* multibuffer,
-                                      MultiBufferBlockId block_id) {
-  GlobalBlockId id(multibuffer, block_id);
-  return lru_.Contains(id);
-}
-
-void MultiBuffer::GlobalLRU::IncrementDataSize(int64_t blocks) {
-  data_size_ += blocks;
-  DCHECK_GE(data_size_, 0);
-  SchedulePrune();
-}
-
-void MultiBuffer::GlobalLRU::IncrementMaxSize(int64_t blocks) {
-  max_size_ += blocks;
-  DCHECK_GE(max_size_, 0);
-  SchedulePrune();
-}
-
-bool MultiBuffer::GlobalLRU::Pruneable() const {
-  return data_size_ > max_size_ && !lru_.Empty();
-}
-
-void MultiBuffer::GlobalLRU::SchedulePrune() {
-  if (Pruneable() && !background_pruning_pending_) {
-    task_runner_->PostDelayedTask(
-        FROM_HERE, base::Bind(&MultiBuffer::GlobalLRU::PruneTask, this),
-        base::TimeDelta::FromSeconds(kBlockPruneInterval));
-    background_pruning_pending_ = true;
-  }
-}
-
-void MultiBuffer::GlobalLRU::PruneTask() {
-  background_pruning_pending_ = false;
-  Prune(kBlocksPrunedPerInterval);
-  SchedulePrune();
-}
-
-void MultiBuffer::GlobalLRU::Prune(int64_t max_to_free) {
-  // We group the blocks by multibuffer so that we can free as many blocks as
-  // possible in one call. This reduces the number of callbacks to clients
-  // when their available ranges change.
-  std::map<MultiBuffer*, std::vector<MultiBufferBlockId>> to_free;
-  int64_t freed = 0;
-  while (data_size_ - freed > max_size_ && !lru_.Empty() &&
-         freed < max_to_free) {
-    GlobalBlockId block_id = lru_.Pop();
-    to_free[block_id.first].push_back(block_id.second);
-    freed++;
-  }
-  for (const auto& to_free_pair : to_free) {
-    to_free_pair.first->ReleaseBlocks(to_free_pair.second);
-  }
-}
-
-int64_t MultiBuffer::GlobalLRU::Size() const { return lru_.Size(); }
-
-//
-// MultiBuffer
-//
-MultiBuffer::MultiBuffer(int32_t block_size_shift,
-                         const scoped_refptr<GlobalLRU>& global_lru)
-    : max_size_(0), block_size_shift_(block_size_shift), lru_(global_lru) {}
-
-MultiBuffer::~MultiBuffer() {
-  CHECK(pinned_.empty());
-  DCHECK_EQ(max_size_, 0);
-  // Remove all blocks from the LRU.
-  for (const auto& i : data_) {
-    lru_->Remove(this, i.first);
-  }
-  lru_->IncrementDataSize(-static_cast<int64_t>(data_.size()));
-  lru_->IncrementMaxSize(-max_size_);
-}
-
-void MultiBuffer::AddReader(const BlockId& pos, Reader* reader) {
-  std::set<Reader*>* set_of_readers = &readers_[pos];
-  bool already_waited_for = !set_of_readers->empty();
-  set_of_readers->insert(reader);
-
-  if (already_waited_for || Contains(pos)) {
-    return;
-  }
-
-  // We may need to create a new data provider to service this request.
-  // Look for an existing data provider first.
-  DataProvider* provider = NULL;
-  BlockId closest_writer = ClosestPreviousEntry(writer_index_, pos);
-
-  if (closest_writer > pos - kMaxWaitForWriterOffset) {
-    auto i = present_.find(pos);
-    BlockId closest_block;
-    if (i.value()) {
-      // Shouldn't happen, we already tested that Contains(pos) is true.
-      NOTREACHED();
-      closest_block = pos;
-    } else if (i == present_.begin()) {
-      closest_block = -1;
-    } else {
-      closest_block = i.interval_begin() - 1;
-    }
-
-    // Make sure that there are no present blocks between the writer and
-    // the requested position, as that will cause the writer to quit.
-    if (closest_writer > closest_block) {
-      provider = writer_index_[closest_writer].get();
-      DCHECK(provider);
-    }
-  }
-  if (!provider) {
-    DCHECK(writer_index_.find(pos) == writer_index_.end());
-    writer_index_[pos] = CreateWriter(pos);
-    provider = writer_index_[pos].get();
-  }
-  provider->SetDeferred(false);
-}
-
-void MultiBuffer::RemoveReader(const BlockId& pos, Reader* reader) {
-  auto i = readers_.find(pos);
-  if (i == readers_.end()) return;
-  i->second.erase(reader);
-  if (i->second.empty()) {
-    readers_.erase(i);
-  }
-}
-
-void MultiBuffer::CleanupWriters(const BlockId& pos) {
-  BlockId p2 = pos + kMaxWaitForReaderOffset;
-  BlockId closest_writer = ClosestPreviousEntry(writer_index_, p2);
-  while (closest_writer > pos - kMaxWaitForWriterOffset) {
-    DCHECK(writer_index_[closest_writer]);
-    OnDataProviderEvent(writer_index_[closest_writer].get());
-    closest_writer = ClosestPreviousEntry(writer_index_, closest_writer - 1);
-  }
-}
-
-bool MultiBuffer::Contains(const BlockId& pos) const {
-  DCHECK(present_[pos] == 0 || present_[pos] == 1)
-      << " pos = " << pos << " present_[pos] " << present_[pos];
-  DCHECK_EQ(present_[pos], data_.find(pos) != data_.end() ? 1 : 0);
-  return !!present_[pos];
-}
-
-MultiBufferBlockId MultiBuffer::FindNextUnavailable(const BlockId& pos) const {
-  auto i = present_.find(pos);
-  if (i.value()) return i.interval_end();
-  return pos;
-}
-
-void MultiBuffer::NotifyAvailableRange(
-    const Interval<MultiBufferBlockId>& observer_range,
-    const Interval<MultiBufferBlockId>& new_range) {
-  std::set<Reader*> tmp;
-  for (auto i = readers_.lower_bound(observer_range.begin);
-       i != readers_.end() && i->first < observer_range.end; ++i) {
-    tmp.insert(i->second.begin(), i->second.end());
-  }
-  for (Reader* reader : tmp) {
-    reader->NotifyAvailableRange(new_range);
-  }
-}
-
-void MultiBuffer::ReleaseBlocks(const std::vector<MultiBufferBlockId>& blocks) {
-  IntervalMap<BlockId, int32_t> freed;
-  for (MultiBufferBlockId to_free : blocks) {
-    DCHECK(data_[to_free]);
-    DCHECK_EQ(pinned_[to_free], 0);
-    DCHECK_EQ(present_[to_free], 1);
-    data_.erase(to_free);
-    freed.IncrementInterval(to_free, to_free + 1, 1);
-    present_.IncrementInterval(to_free, to_free + 1, -1);
-  }
-  lru_->IncrementDataSize(-static_cast<int64_t>(blocks.size()));
-
-  for (const auto& freed_range : freed) {
-    if (freed_range.second) {
-      // Technically, there shouldn't be any observers in this range
-      // as all observers really should be pinning the range where it's
-      // actually observing.
-      NotifyAvailableRange(
-          freed_range.first,
-          // Empty range.
-          Interval<BlockId>(freed_range.first.begin, freed_range.first.begin));
-
-      auto i = present_.find(freed_range.first.begin);
-      DCHECK_EQ(i.value(), 0);
-      DCHECK_LE(i.interval_begin(), freed_range.first.begin);
-      DCHECK_LE(freed_range.first.end, i.interval_end());
-
-      if (i.interval_begin() == freed_range.first.begin) {
-        // Notify the previous range that it contains fewer blocks.
-        auto j = i;
-        --j;
-        DCHECK_EQ(j.value(), 1);
-        NotifyAvailableRange(j.interval(), j.interval());
-      }
-      if (i.interval_end() == freed_range.first.end) {
-        // Notify the following range that it contains fewer blocks.
-        auto j = i;
-        ++j;
-        DCHECK_EQ(j.value(), 1);
-        NotifyAvailableRange(j.interval(), j.interval());
-      }
-    }
-  }
-  if (data_.empty()) OnEmpty();
-}
-
-void MultiBuffer::OnEmpty() {}
-
-void MultiBuffer::AddProvider(std::unique_ptr<DataProvider> provider) {
-  // If there is already a provider in the same location, we delete it.
-  DCHECK(!provider->Available());
-  BlockId pos = provider->Tell();
-  writer_index_[pos] = std::move(provider);
-}
-
-std::unique_ptr<MultiBuffer::DataProvider> MultiBuffer::RemoveProvider(
-    DataProvider* provider) {
-  BlockId pos = provider->Tell();
-  auto iter = writer_index_.find(pos);
-  DCHECK(iter != writer_index_.end());
-  DCHECK_EQ(iter->second.get(), provider);
-  std::unique_ptr<DataProvider> ret = std::move(iter->second);
-  writer_index_.erase(iter);
-  return ret;
-}
-
-MultiBuffer::ProviderState MultiBuffer::SuggestProviderState(
-    const BlockId& pos) const {
-  MultiBufferBlockId next_reader_pos = ClosestNextEntry(readers_, pos);
-  if (next_reader_pos != std::numeric_limits<MultiBufferBlockId>::max() &&
-      (next_reader_pos - pos <= kMaxWaitForWriterOffset || !RangeSupported())) {
-    // Check if there is another writer between us and the next reader.
-    MultiBufferBlockId next_writer_pos =
-        ClosestNextEntry(writer_index_, pos + 1);
-    if (next_writer_pos > next_reader_pos) {
-      return ProviderStateLoad;
-    }
-  }
-
-  MultiBufferBlockId previous_reader_pos =
-      ClosestPreviousEntry(readers_, pos - 1);
-  if (previous_reader_pos != std::numeric_limits<MultiBufferBlockId>::min() &&
-      (pos - previous_reader_pos <= kMaxWaitForReaderOffset ||
-       !RangeSupported())) {
-    MultiBufferBlockId previous_writer_pos =
-        ClosestPreviousEntry(writer_index_, pos - 1);
-    if (previous_writer_pos < previous_reader_pos) {
-      return ProviderStateDefer;
-    }
-  }
-
-  return ProviderStateDead;
-}
-
-bool MultiBuffer::ProviderCollision(const BlockId& id) const {
-  // If there is a writer at the same location, it is always a collision.
-  if (writer_index_.find(id) != writer_index_.end()) return true;
-
-  // Data already exists at providers current position,
-  // if the URL supports ranges, we can kill the data provider.
-  if (RangeSupported() && Contains(id)) return true;
-
-  return false;
-}
-
-void MultiBuffer::Prune(size_t max_to_free) { lru_->Prune(max_to_free); }
-
-void MultiBuffer::OnDataProviderEvent(DataProvider* provider_tmp) {
-  std::unique_ptr<DataProvider> provider(RemoveProvider(provider_tmp));
-  BlockId start_pos = provider->Tell();
-  BlockId pos = start_pos;
-  bool eof = false;
-  int64_t blocks_before = data_.size();
-
-  while (!ProviderCollision(pos) && !eof) {
-    if (!provider->Available()) {
-      AddProvider(std::move(provider));
-      break;
-    }
-    DCHECK_GE(pos, 0);
-    scoped_refptr<DataBuffer> data = provider->Read();
-    data_[pos] = data;
-    eof = data->end_of_stream();
-    if (!pinned_[pos]) lru_->Use(this, pos);
-    ++pos;
-  }
-  int64_t blocks_after = data_.size();
-  int64_t blocks_added = blocks_after - blocks_before;
-
-  if (pos > start_pos) {
-    present_.SetInterval(start_pos, pos, 1);
-    Interval<BlockId> expanded_range = present_.find(start_pos).interval();
-    NotifyAvailableRange(expanded_range, expanded_range);
-    lru_->IncrementDataSize(blocks_added);
-    Prune(blocks_added * kMaxFreesPerAdd + 1);
-  } else {
-    // Make sure to give progress reports even when there
-    // aren't any new blocks yet.
-    NotifyAvailableRange(Interval<BlockId>(start_pos, start_pos + 1),
-                         Interval<BlockId>(start_pos, start_pos));
-  }
-
-  // Check that it's still there before we try to delete it.
-  // In case of EOF or a collision, we might not have called AddProvider above.
-  // Even if we did call AddProvider, calling NotifyAvailableRange can cause
-  // readers to seek or self-destruct and clean up any associated writers.
-  auto i = writer_index_.find(pos);
-  if (i != writer_index_.end() && i->second.get() == provider_tmp) {
-    switch (SuggestProviderState(pos)) {
-      case ProviderStateLoad:
-        // Not sure we actually need to do this
-        provider_tmp->SetDeferred(false);
-        break;
-      case ProviderStateDefer:
-        provider_tmp->SetDeferred(true);
-        break;
-      case ProviderStateDead:
-        RemoveProvider(provider_tmp);
-        break;
-    }
-  }
-}
-
-void MultiBuffer::MergeFrom(MultiBuffer* other) {
-  // Import data and update LRU.
-  size_t data_size = data_.size();
-  for (const auto& data : other->data_) {
-    if (data_.insert(std::make_pair(data.first, data.second)).second) {
-      if (!pinned_[data.first]) {
-        lru_->Insert(this, data.first);
-      }
-    }
-  }
-  lru_->IncrementDataSize(static_cast<int64_t>(data_.size() - data_size));
-  // Update present_
-  for (const auto& r : other->present_) {
-    if (r.second) {
-      present_.SetInterval(r.first.begin, r.first.end, 1);
-    }
-  }
-  // Notify existing readers.
-  auto last = present_.begin();
-  for (const auto& r : other->present_) {
-    if (r.second) {
-      auto i = present_.find(r.first.begin);
-      if (i != last) {
-        NotifyAvailableRange(i.interval(), i.interval());
-        last = i;
-      }
-    }
-  }
-}
-
-void MultiBuffer::PinRange(const BlockId& from, const BlockId& to,
-                           int32_t how_much) {
-  DCHECK_NE(how_much, 0);
-  DVLOG(3) << "PINRANGE [" << from << " - " << to << ") += " << how_much;
-  pinned_.IncrementInterval(from, to, how_much);
-  Interval<BlockId> modified_range(from, to);
-
-  // Iterate over all the modified ranges and check if any of them have
-  // transitioned in or out of the unlocked state. If so, we iterate over
-  // all buffers in that range and add/remove them from the LRU as approperiate.
-  // We iterate *backwards* through the ranges, with the idea that data in a
-  // continous range should be freed from the end first.
-
-  if (data_.empty()) return;
-
-  auto range = pinned_.find(to - 1);
-  while (1) {
-    DCHECK_GE(range.value(), 0);
-    if (range.value() == 0 || range.value() == how_much) {
-      bool pin = range.value() == how_much;
-      Interval<BlockId> transition_range =
-          modified_range.Intersect(range.interval());
-      if (transition_range.Empty()) break;
-
-      // For each range that has transitioned to/from a pinned state,
-      // we iterate over the corresponding ranges in |present_| to find
-      // the blocks that are actually in the multibuffer.
-      for (auto present_block_range = present_.find(transition_range.end - 1);
-           present_block_range != present_.begin(); --present_block_range) {
-        if (!present_block_range.value()) continue;
-        Interval<BlockId> present_transitioned_range =
-            transition_range.Intersect(present_block_range.interval());
-        if (present_transitioned_range.Empty()) break;
-        for (BlockId block = present_transitioned_range.end - 1;
-             block >= present_transitioned_range.begin; --block) {
-          DCHECK_GE(block, 0);
-          DCHECK(data_.find(block) != data_.end());
-          if (pin) {
-            DCHECK(pinned_[block]);
-            lru_->Remove(this, block);
-          } else {
-            DCHECK(!pinned_[block]);
-            lru_->Insert(this, block);
-          }
-        }
-      }
-    }
-    if (range == pinned_.begin()) break;
-    --range;
-  }
-}
-
-void MultiBuffer::PinRanges(const IntervalMap<BlockId, int32_t>& ranges) {
-  for (const auto& r : ranges) {
-    if (r.second != 0) {
-      PinRange(r.first.begin, r.first.end, r.second);
-    }
-  }
-}
-
-void MultiBuffer::IncrementMaxSize(int32_t size) {
-  max_size_ += size;
-  lru_->IncrementMaxSize(size);
-  DCHECK_GE(max_size_, 0);
-  // Pruning only happens when blocks are added.
-}
-
-int64_t MultiBuffer::UncommittedBytesAt(const MultiBuffer::BlockId& block) {
-  auto i = writer_index_.find(block);
-  if (writer_index_.end() == i) return 0;
-  return i->second->AvailableBytes();
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/multibuffer.h b/src/cobalt/media/blink/multibuffer.h
deleted file mode 100644
index 25a84ef..0000000
--- a/src/cobalt/media/blink/multibuffer.h
+++ /dev/null
@@ -1,360 +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 COBALT_MEDIA_BLINK_MULTIBUFFER_H_
-#define COBALT_MEDIA_BLINK_MULTIBUFFER_H_
-
-#include <limits>
-#include <map>
-#include <memory>
-#include <set>
-#include <utility>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/hash.h"
-#include "base/hash_tables.h"
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "build/build_config.h"
-#include "cobalt/media/base/data_buffer.h"
-#include "cobalt/media/blink/interval_map.h"
-#include "cobalt/media/blink/lru.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-
-// Used to identify a block of data in the multibuffer.
-// Our blocks are 32kb (1 << 15), so our maximum cacheable file size
-// is 1 << (15 + 31) = 64Tb
-typedef int32_t MultiBufferBlockId;
-class MultiBuffer;
-
-// This type is used to identify a block in the LRU, which is shared between
-// multibuffers.
-typedef std::pair<MultiBuffer*, MultiBufferBlockId> MultiBufferGlobalBlockId;
-
-}  // namespace media
-}  // namespace cobalt
-
-namespace BASE_HASH_NAMESPACE {
-
-template <>
-struct hash<media::MultiBufferGlobalBlockId> {
-  std::size_t operator()(const media::MultiBufferGlobalBlockId& key) const {
-    return base::HashInts(reinterpret_cast<uintptr_t>(key.first), key.second);
-  }
-};
-
-}  // namespace BASE_HASH_NAMESPACE
-
-namespace cobalt {
-namespace media {
-
-// Freeing a lot of blocks can be expensive, to keep thing
-// flowing smoothly we only free a maximum of |kMaxFreesPerAdd|
-// blocks when a new block is added to the cache.
-const int kMaxFreesPerAdd = 10;
-
-// There is a simple logic for creating, destroying and deferring
-// data providers. Every data provider has a look-ahead region and
-// a look-behind region. If there are readers in the look-ahead
-// region, we keep reading. If not, but there are readers in the
-// look-behind region, we defer. If there are no readers in either
-// region, we destroy the data provider.
-
-// When new readers are added, new data providers are created if
-// the new reader doesn't fall into the look-ahead region of
-// an existing data provider.
-
-// This is the size of the look-ahead region.
-const int kMaxWaitForWriterOffset = 5;
-
-// This is the size of the look-behind region.
-const int kMaxWaitForReaderOffset = 50;
-
-// MultiBuffers are multi-reader multi-writer cache/buffers with
-// prefetching and pinning. Data is stored internally in ref-counted
-// blocks of identical size. |block_size_shift| is log2 of the block
-// size.
-//
-// Users should inherit this class and implement CreateWriter().
-// TODO(hubbe): Make the multibuffer respond to memory pressure.
-class MEDIA_BLINK_EXPORT MultiBuffer {
- public:
-  // Interface for clients wishing to read data out of this cache.
-  // Note: It might look tempting to replace this with a callback,
-  // but we keep and compare pointers to Readers internally.
-  class Reader {
-   public:
-    Reader() {}
-    virtual ~Reader() {}
-    // Notifies the reader that the range of available blocks has changed.
-    // The reader must call MultiBuffer::Observe() to activate this callback.
-    virtual void NotifyAvailableRange(
-        const Interval<MultiBufferBlockId>& range) = 0;
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(Reader);
-  };
-
-  // DataProvider is the interface that MultiBuffer
-  // uses to get data into the cache.
-  class DataProvider {
-   public:
-    virtual ~DataProvider() {}
-
-    // Returns the block number that is to be returned
-    // by the next Read() call.
-    virtual MultiBufferBlockId Tell() const = 0;
-
-    // Returns true if one (or more) blocks are
-    // availble to read.
-    virtual bool Available() const = 0;
-
-    // Returns how many bytes are available, note that Available() may still
-    // return false even if AvailableBytes() returns a value greater than
-    // zero if less than a full block is available.
-    virtual int64_t AvailableBytes() const = 0;
-
-    // Returns the next block. Only valid if Available()
-    // returns true. Last block might be of a smaller size
-    // and after the last block we will get an end-of-stream
-    // DataBuffer.
-    virtual scoped_refptr<DataBuffer> Read() = 0;
-
-    // Ask the data provider to stop giving us data.
-    // It's ok if the effect is not immediate.
-    virtual void SetDeferred(bool deferred) = 0;
-  };
-
-  // Multibuffers use a global shared LRU to free memory.
-  // This effectively means that recently used multibuffers can
-  // borrow memory from less recently used ones.
-  class MEDIA_BLINK_EXPORT GlobalLRU : public base::RefCounted<GlobalLRU> {
-   public:
-    typedef MultiBufferGlobalBlockId GlobalBlockId;
-    explicit GlobalLRU(
-        const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
-
-    // Free elements from cache if needed and possible.
-    // Don't free more than |max_to_free| blocks.
-    // Virtual for testing purposes.
-    void Prune(int64_t max_to_free);
-
-    // Returns true if there are prunable blocks.
-    bool Pruneable() const;
-
-    // Incremnt the amount of data used by all multibuffers.
-    void IncrementDataSize(int64_t blocks);
-
-    // Each multibuffer is allowed a certain amount of memory,
-    // that memory is registered by calling this function.
-    // The memory is actually shared by all multibuffers.
-    // When the total amount of memory used by all multibuffers
-    // is greater than what has been registered here, we use the
-    // LRU to decide what blocks to free first.
-    void IncrementMaxSize(int64_t blocks);
-
-    // LRU operations.
-    void Use(MultiBuffer* multibuffer, MultiBufferBlockId id);
-    void Remove(MultiBuffer* multibuffer, MultiBufferBlockId id);
-    void Insert(MultiBuffer* multibuffer, MultiBufferBlockId id);
-    bool Contains(MultiBuffer* multibuffer, MultiBufferBlockId id);
-    int64_t Size() const;
-
-   private:
-    friend class base::RefCounted<GlobalLRU>;
-    ~GlobalLRU();
-
-    // Schedule background pruning, if needed.
-    void SchedulePrune();
-
-    // Perform background pruning.
-    void PruneTask();
-
-    // Max number of blocks.
-    int64_t max_size_;
-
-    // Sum of all multibuffer::data_.size().
-    int64_t data_size_;
-
-    // True if there is a call to the background pruning outstanding.
-    bool background_pruning_pending_;
-
-    // The LRU should contain all blocks which are not pinned from
-    // all multibuffers.
-    LRU<GlobalBlockId> lru_;
-
-    // Where we run our tasks.
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-
-    DISALLOW_COPY_AND_ASSIGN(GlobalLRU);
-  };
-
-  MultiBuffer(int32_t block_size_shift,
-              const scoped_refptr<GlobalLRU>& global_lru);
-  virtual ~MultiBuffer();
-
-  // Identifies a block in the cache.
-  // Block numbers can be calculated from byte positions as:
-  // block_num = byte_pos >> block_size_shift
-  typedef MultiBufferBlockId BlockId;
-  typedef base::hash_map<BlockId, scoped_refptr<DataBuffer>> DataMap;
-
-  // Registers a reader at the given position.
-  // If the cache does not already contain |pos|, it will activate
-  // or create data providers to make sure that the block becomes
-  // available soon. If |pos| is already in the cache, no action is
-  // taken, it simply lets the cache know that this reader is likely
-  // to read pos+1, pos+2.. soon.
-  //
-  // Registered readers will be notified when the available range
-  // at their position changes. The available range at |pos| is a range
-  // from A to B where: A <= |pos|, B >= |pos| and all blocks in [A..B)
-  // are present in the cache.  When this changes, we will call
-  // NotifyAvailableRange() on the reader.
-  void AddReader(const BlockId& pos, Reader* reader);
-
-  // Unregister a reader at block |pos|.
-  // Often followed by a call to AddReader(pos + 1, ...);
-  // Idempotent.
-  void RemoveReader(const BlockId& pos, Reader* reader);
-
-  // Immediately remove writers at or before |pos| if nobody needs them.
-  // Note that we can't really do this in StopWaitFor(), because it's very
-  // likely that StopWaitFor() is immediately followed by a call to WaitFor().
-  // It is also a bad idea to wait for the writers to clean themselves up when
-  // they try to provide unwanted data to the cache. Besides the obvoius
-  // inefficiency, it will also cause the http_cache to bypass the disk/memory
-  // cache if we have multiple simultaneous requests going against the same
-  // url.
-  void CleanupWriters(const BlockId& pos);
-
-  // Returns true if block |pos| is available in the cache.
-  bool Contains(const BlockId& pos) const;
-
-  // Returns the next unavailable block at or after |pos|.
-  BlockId FindNextUnavailable(const BlockId& pos) const;
-
-  // Change the pin count for a range of data blocks.
-  // Note that blocks do not have to be present in the
-  // cache to be pinned.
-  // Examples:
-  // Pin block 3, 4 & 5: PinRange(3, 6, 1);
-  // Unpin block 4 & 5: PinRange(4, 6, -1);
-  void PinRange(const BlockId& from, const BlockId& to, int32_t how_much);
-
-  // Calls PinRange for each range in |ranges|, convenience
-  // function for applying multiple changes to the pinned ranges.
-  void PinRanges(const IntervalMap<BlockId, int32_t>& ranges);
-
-  // Increment max cache size by |size| (counted in blocks).
-  void IncrementMaxSize(int32_t size);
-
-  // Returns how many bytes have been received by the data providers at position
-  // |block|, which have not yet been submitted to the multibuffer cache.
-  // The returned number should be less than the size of one block.
-  int64_t UncommittedBytesAt(const BlockId& block);
-
-  // Caller takes ownership of 'provider', cache will
-  // not call it anymore.
-  std::unique_ptr<DataProvider> RemoveProvider(DataProvider* provider);
-
-  // Add a writer to this cache. Cache takes ownership, and may
-  // destroy |provider| later. (Not during this call.)
-  void AddProvider(std::unique_ptr<DataProvider> provider);
-
-  // Transfer all data from |other| to this.
-  void MergeFrom(MultiBuffer* other);
-
-  // Accessors.
-  const DataMap& map() const { return data_; }
-  int32_t block_size_shift() const { return block_size_shift_; }
-
-  // Callback which notifies us that a data provider has
-  // some data for us. Also called when it might be appropriate
-  // for a provider in a deferred state to wake up.
-  void OnDataProviderEvent(DataProvider* provider);
-
- protected:
-  // Create a new writer at |pos| and return it.
-  // Users needs to implemement this method.
-  virtual std::unique_ptr<DataProvider> CreateWriter(const BlockId& pos) = 0;
-
-  virtual bool RangeSupported() const = 0;
-
-  // Called when the cache becomes empty. Implementations can use this
-  // as a signal for when we should free this object and any metadata
-  // that goes with it.
-  virtual void OnEmpty();
-
- private:
-  // For testing.
-  friend class TestMultiBuffer;
-
-  enum ProviderState {
-    ProviderStateDead,
-    ProviderStateDefer,
-    ProviderStateLoad
-  };
-
-  // Can be overriden for testing.
-  virtual void Prune(size_t max_to_free);
-
-  // Remove the given blocks from the multibuffer, called from
-  // GlobalLRU::Prune().
-  void ReleaseBlocks(const std::vector<MultiBufferBlockId>& blocks);
-
-  // Figure out what state a writer at |pos| should be in.
-  ProviderState SuggestProviderState(const BlockId& pos) const;
-
-  // Returns true if a writer at |pos| is colliding with
-  // output of another writer.
-  bool ProviderCollision(const BlockId& pos) const;
-
-  // Call NotifyAvailableRange(new_range) on all readers waiting
-  // for a block in |observer_range|
-  void NotifyAvailableRange(const Interval<MultiBufferBlockId>& observer_range,
-                            const Interval<MultiBufferBlockId>& new_range);
-
-  // Max number of blocks.
-  int64_t max_size_;
-
-  // log2 of block size.
-  int32_t block_size_shift_;
-
-  // Stores the actual data.
-  DataMap data_;
-
-  // Keeps track of readers waiting for data.
-  std::map<MultiBufferBlockId, std::set<Reader*>> readers_;
-
-  // Keeps track of writers by their position.
-  // The writers are owned by this class.
-  std::map<BlockId, std::unique_ptr<DataProvider>> writer_index_;
-
-  // Gloabally shared LRU, decides which block to free next.
-  scoped_refptr<GlobalLRU> lru_;
-
-  // Keeps track of what blocks are pinned. If block p is pinned,
-  // then pinned_[p] > 0. Pinned blocks cannot be freed and should not
-  // be present in |lru_|.
-  IntervalMap<BlockId, int32_t> pinned_;
-
-  // present_[block] should be 1 for all blocks that are present
-  // and 0 for all blocks that are not. Used to quickly figure out
-  // ranges of available/unavailable blocks without iterating.
-  IntervalMap<BlockId, int32_t> present_;
-
-  DISALLOW_COPY_AND_ASSIGN(MultiBuffer);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_MULTIBUFFER_H_
diff --git a/src/cobalt/media/blink/multibuffer_data_source.cc b/src/cobalt/media/blink/multibuffer_data_source.cc
deleted file mode 100644
index f633a4f..0000000
--- a/src/cobalt/media/blink/multibuffer_data_source.cc
+++ /dev/null
@@ -1,590 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/multibuffer_data_source.h"
-
-#include <algorithm>
-#include <utility>
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/blink/buffered_data_source_host_impl.h"
-#include "cobalt/media/blink/multibuffer_reader.h"
-#include "net/base/net_errors.h"
-
-using blink::WebFrame;
-
-namespace {
-
-// Minimum preload buffer.
-const int64_t kMinBufferPreload = 2 << 20;  // 2 Mb
-// Maxmimum preload buffer.
-const int64_t kMaxBufferPreload = 20 << 20;  // 20 Mb
-
-// Preload this much extra, then stop preloading until we fall below the
-// kTargetSecondsBufferedAhead.
-const int64_t kPreloadHighExtra = 1 << 20;  // 1 Mb
-
-// Total size of the pinned region in the cache.
-const int64_t kMaxBufferSize = 25 << 20;  // 25 Mb
-
-// If bitrate is not known, use this.
-const int64_t kDefaultBitrate = 200 * 8 << 10;  // 200 Kbps.
-
-// Maximum bitrate for buffer calculations.
-const int64_t kMaxBitrate = 20 * 8 << 20;  // 20 Mbps.
-
-// Maximum playback rate for buffer calculations.
-const double kMaxPlaybackRate = 25.0;
-
-// Preload this many seconds of data by default.
-const int64_t kTargetSecondsBufferedAhead = 10;
-
-// Keep this many seconds of data for going back by default.
-const int64_t kTargetSecondsBufferedBehind = 2;
-
-}  // namespace
-
-namespace cobalt {
-namespace media {
-
-template <typename T>
-T clamp(T value, T min, T max) {
-  return std::max(std::min(value, max), min);
-}
-
-class MultibufferDataSource::ReadOperation {
- public:
-  ReadOperation(int64_t position, int size, uint8_t* data,
-                const DataSource::ReadCB& callback);
-  ~ReadOperation();
-
-  // Runs |callback_| with the given |result|, deleting the operation
-  // afterwards.
-  static void Run(std::unique_ptr<ReadOperation> read_op, int result);
-
-  int64_t position() { return position_; }
-  int size() { return size_; }
-  uint8_t* data() { return data_; }
-
- private:
-  const int64_t position_;
-  const int size_;
-  uint8_t* data_;
-  DataSource::ReadCB callback_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ReadOperation);
-};
-
-MultibufferDataSource::ReadOperation::ReadOperation(
-    int64_t position, int size, uint8_t* data,
-    const DataSource::ReadCB& callback)
-    : position_(position), size_(size), data_(data), callback_(callback) {
-  DCHECK(!callback_.is_null());
-}
-
-MultibufferDataSource::ReadOperation::~ReadOperation() {
-  DCHECK(callback_.is_null());
-}
-
-// static
-void MultibufferDataSource::ReadOperation::Run(
-    std::unique_ptr<ReadOperation> read_op, int result) {
-  base::ResetAndReturn(&read_op->callback_).Run(result);
-}
-
-MultibufferDataSource::MultibufferDataSource(
-    const GURL& url, UrlData::CORSMode cors_mode,
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-    linked_ptr<UrlIndex> url_index, WebFrame* frame, MediaLog* media_log,
-    BufferedDataSourceHost* host, const DownloadingCB& downloading_cb)
-    : cors_mode_(cors_mode),
-      total_bytes_(kPositionNotSpecified),
-      streaming_(false),
-      loading_(false),
-      failed_(false),
-      render_task_runner_(task_runner),
-      url_index_(url_index),
-      frame_(frame),
-      stop_signal_received_(false),
-      media_has_played_(false),
-      buffering_strategy_(BUFFERING_STRATEGY_NORMAL),
-      single_origin_(true),
-      cancel_on_defer_(false),
-      preload_(AUTO),
-      bitrate_(0),
-      playback_rate_(0.0),
-      media_log_(media_log),
-      host_(host),
-      downloading_cb_(downloading_cb),
-      weak_factory_(this) {
-  weak_ptr_ = weak_factory_.GetWeakPtr();
-  DCHECK(host_);
-  DCHECK(!downloading_cb_.is_null());
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  url_data_ = url_index_->GetByUrl(url, cors_mode_);
-  url_data_->Use();
-  DCHECK(url_data_);
-  url_data_->OnRedirect(
-      base::Bind(&MultibufferDataSource::OnRedirect, weak_ptr_));
-}
-
-MultibufferDataSource::~MultibufferDataSource() {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-}
-
-bool MultibufferDataSource::media_has_played() const {
-  return media_has_played_;
-}
-
-bool MultibufferDataSource::assume_fully_buffered() {
-  return !url_data_->url().SchemeIsHTTPOrHTTPS();
-}
-
-void MultibufferDataSource::CreateResourceLoader(int64_t first_byte_position,
-                                                 int64_t last_byte_position) {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-
-  reader_.reset(new MultiBufferReader(
-      url_data_->multibuffer(), first_byte_position, last_byte_position,
-      base::Bind(&MultibufferDataSource::ProgressCallback, weak_ptr_)));
-  UpdateBufferSizes();
-}
-
-void MultibufferDataSource::Initialize(const InitializeCB& init_cb) {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  DCHECK(!init_cb.is_null());
-  DCHECK(!reader_.get());
-
-  init_cb_ = init_cb;
-
-  CreateResourceLoader(0, kPositionNotSpecified);
-
-  // We're not allowed to call Wait() if data is already available.
-  if (reader_->Available()) {
-    render_task_runner_->PostTask(
-        FROM_HERE,
-        base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
-  } else {
-    reader_->Wait(1,
-                  base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
-  }
-}
-
-void MultibufferDataSource::OnRedirect(
-    const scoped_refptr<UrlData>& destination) {
-  if (!destination) {
-    // A failure occured.
-    failed_ = true;
-    if (!init_cb_.is_null()) {
-      render_task_runner_->PostTask(
-          FROM_HERE,
-          base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
-    } else {
-      base::AutoLock auto_lock(lock_);
-      StopInternal_Locked();
-    }
-    StopLoader();
-    return;
-  }
-  if (url_data_->url().GetOrigin() != destination->url().GetOrigin()) {
-    single_origin_ = false;
-  }
-  reader_.reset(NULL);
-  url_data_ = destination;
-
-  if (url_data_) {
-    url_data_->OnRedirect(
-        base::Bind(&MultibufferDataSource::OnRedirect, weak_ptr_));
-
-    if (!init_cb_.is_null()) {
-      CreateResourceLoader(0, kPositionNotSpecified);
-      if (reader_->Available()) {
-        render_task_runner_->PostTask(
-            FROM_HERE,
-            base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
-      } else {
-        reader_->Wait(
-            1, base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
-      }
-    } else if (read_op_) {
-      CreateResourceLoader(read_op_->position(), kPositionNotSpecified);
-      if (reader_->Available()) {
-        render_task_runner_->PostTask(
-            FROM_HERE, base::Bind(&MultibufferDataSource::ReadTask, weak_ptr_));
-      } else {
-        reader_->Wait(1,
-                      base::Bind(&MultibufferDataSource::ReadTask, weak_ptr_));
-      }
-    }
-  }
-}
-
-void MultibufferDataSource::SetPreload(Preload preload) {
-  DVLOG(1) << __func__ << "(" << preload << ")";
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  preload_ = preload;
-  UpdateBufferSizes();
-}
-
-void MultibufferDataSource::SetBufferingStrategy(
-    BufferingStrategy buffering_strategy) {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  buffering_strategy_ = buffering_strategy;
-  UpdateBufferSizes();
-}
-
-bool MultibufferDataSource::HasSingleOrigin() {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  // Before initialization completes there is no risk of leaking data. Callers
-  // are required to order checks such that this isn't a race.
-  return single_origin_;
-}
-
-bool MultibufferDataSource::DidPassCORSAccessCheck() const {
-  if (cors_mode_ == UrlData::CORS_UNSPECIFIED) return false;
-  // If init_cb is set, we initialization is not finished yet.
-  if (!init_cb_.is_null()) return false;
-  if (failed_) return false;
-  return true;
-}
-
-void MultibufferDataSource::MediaPlaybackRateChanged(double playback_rate) {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  DCHECK(reader_.get());
-
-  if (playback_rate < 0.0) return;
-
-  playback_rate_ = playback_rate;
-  cancel_on_defer_ = false;
-  UpdateBufferSizes();
-}
-
-void MultibufferDataSource::MediaIsPlaying() {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  media_has_played_ = true;
-  cancel_on_defer_ = false;
-  // Once we start playing, we need preloading.
-  preload_ = AUTO;
-  UpdateBufferSizes();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// DataSource implementation.
-void MultibufferDataSource::Stop() {
-  {
-    base::AutoLock auto_lock(lock_);
-    StopInternal_Locked();
-  }
-
-  render_task_runner_->PostTask(FROM_HERE,
-                                base::Bind(&MultibufferDataSource::StopLoader,
-                                           weak_factory_.GetWeakPtr()));
-}
-
-void MultibufferDataSource::Abort() {
-  base::AutoLock auto_lock(lock_);
-  DCHECK(init_cb_.is_null());
-  if (read_op_) ReadOperation::Run(std::move(read_op_), kAborted);
-
-  // Abort does not call StopLoader() since it is typically called prior to a
-  // seek or suspend. Let the loader logic make the decision about whether a new
-  // loader is necessary upon the seek or resume.
-}
-
-void MultibufferDataSource::SetBitrate(int bitrate) {
-  render_task_runner_->PostTask(
-      FROM_HERE, base::Bind(&MultibufferDataSource::SetBitrateTask,
-                            weak_factory_.GetWeakPtr(), bitrate));
-}
-
-void MultibufferDataSource::OnBufferingHaveEnough(bool always_cancel) {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  if (reader_ && (always_cancel || (preload_ == METADATA &&
-                                    !media_has_played_ && !IsStreaming()))) {
-    cancel_on_defer_ = true;
-    if (!loading_) reader_.reset(NULL);
-  }
-}
-
-int64_t MultibufferDataSource::GetMemoryUsage() const {
-  // TODO(hubbe): Make more accurate when url_data_ is shared.
-  return url_data_->CachedSize()
-         << url_data_->multibuffer()->block_size_shift();
-}
-
-GURL MultibufferDataSource::GetUrlAfterRedirects() const {
-  return url_data_->url();
-}
-
-void MultibufferDataSource::Read(int64_t position, int size, uint8_t* data,
-                                 const DataSource::ReadCB& read_cb) {
-  DVLOG(1) << "Read: " << position << " offset, " << size << " bytes";
-  // Reading is not allowed until after initialization.
-  DCHECK(init_cb_.is_null());
-  DCHECK(!read_cb.is_null());
-
-  {
-    base::AutoLock auto_lock(lock_);
-    DCHECK(!read_op_);
-
-    if (stop_signal_received_) {
-      read_cb.Run(kReadError);
-      return;
-    }
-
-    read_op_.reset(new ReadOperation(position, size, data, read_cb));
-  }
-
-  render_task_runner_->PostTask(
-      FROM_HERE,
-      base::Bind(&MultibufferDataSource::ReadTask, weak_factory_.GetWeakPtr()));
-}
-
-bool MultibufferDataSource::GetSize(int64_t* size_out) {
-  base::AutoLock auto_lock(lock_);
-  if (total_bytes_ != kPositionNotSpecified) {
-    *size_out = total_bytes_;
-    return true;
-  }
-  *size_out = 0;
-  return false;
-}
-
-bool MultibufferDataSource::IsStreaming() { return streaming_; }
-
-/////////////////////////////////////////////////////////////////////////////
-// This method is the place where actual read happens,
-void MultibufferDataSource::ReadTask() {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-
-  base::AutoLock auto_lock(lock_);
-  int bytes_read = 0;
-  if (stop_signal_received_ || !read_op_) return;
-  DCHECK(read_op_->size());
-
-  if (!reader_) {
-    CreateResourceLoader(read_op_->position(), kPositionNotSpecified);
-  } else {
-    reader_->Seek(read_op_->position());
-  }
-
-  int64_t available = reader_->Available();
-  if (available < 0) {
-    // A failure has occured.
-    ReadOperation::Run(std::move(read_op_), kReadError);
-    return;
-  }
-  if (available) {
-    bytes_read =
-        static_cast<int>(std::min<int64_t>(available, read_op_->size()));
-    bytes_read = reader_->TryRead(read_op_->data(), bytes_read);
-
-    if (bytes_read == 0 && total_bytes_ == kPositionNotSpecified) {
-      // We've reached the end of the file and we didn't know the total size
-      // before. Update the total size so Read()s past the end of the file will
-      // fail like they would if we had known the file size at the beginning.
-      total_bytes_ = reader_->Tell();
-      if (total_bytes_ != kPositionNotSpecified)
-        host_->SetTotalBytes(total_bytes_);
-    }
-
-    ReadOperation::Run(std::move(read_op_), bytes_read);
-  } else {
-    reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask,
-                                weak_factory_.GetWeakPtr()));
-  }
-  UpdateLoadingState_Locked(false);
-}
-
-void MultibufferDataSource::StopInternal_Locked() {
-  lock_.AssertAcquired();
-  if (stop_signal_received_) return;
-
-  stop_signal_received_ = true;
-
-  // Initialize() isn't part of the DataSource interface so don't call it in
-  // response to Stop().
-  init_cb_.Reset();
-
-  if (read_op_) ReadOperation::Run(std::move(read_op_), kReadError);
-}
-
-void MultibufferDataSource::StopLoader() {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  reader_.reset(NULL);
-}
-
-void MultibufferDataSource::SetBitrateTask(int bitrate) {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-  DCHECK(reader_.get());
-
-  bitrate_ = bitrate;
-  UpdateBufferSizes();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// BufferedResourceLoader callback methods.
-void MultibufferDataSource::StartCallback() {
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-
-  if (init_cb_.is_null()) {
-    reader_.reset();
-    return;
-  }
-
-  // All responses must be successful. Resources that are assumed to be fully
-  // buffered must have a known content length.
-  bool success = reader_ && reader_->Available() > 0 && url_data_ &&
-                 (!assume_fully_buffered() ||
-                  url_data_->length() != kPositionNotSpecified);
-
-  if (success) {
-    {
-      base::AutoLock auto_lock(lock_);
-      total_bytes_ = url_data_->length();
-    }
-    streaming_ =
-        !assume_fully_buffered() && (total_bytes_ == kPositionNotSpecified ||
-                                     !url_data_->range_supported());
-
-    media_log_->SetDoubleProperty("total_bytes",
-                                  static_cast<double>(total_bytes_));
-    media_log_->SetBooleanProperty("streaming", streaming_);
-  } else {
-    reader_.reset(NULL);
-  }
-
-  // TODO(scherkus): we shouldn't have to lock to signal host(), see
-  // http://crbug.com/113712 for details.
-  base::AutoLock auto_lock(lock_);
-  if (stop_signal_received_) return;
-
-  if (success) {
-    if (total_bytes_ != kPositionNotSpecified) {
-      host_->SetTotalBytes(total_bytes_);
-      if (assume_fully_buffered()) host_->AddBufferedByteRange(0, total_bytes_);
-    }
-
-    // Progress callback might be called after the start callback,
-    // make sure that we update single_origin_ now.
-    media_log_->SetBooleanProperty("single_origin", single_origin_);
-    media_log_->SetBooleanProperty("passed_cors_access_check",
-                                   DidPassCORSAccessCheck());
-    media_log_->SetBooleanProperty("range_header_supported",
-                                   url_data_->range_supported());
-  }
-
-  render_task_runner_->PostTask(
-      FROM_HERE, base::Bind(base::ResetAndReturn(&init_cb_), success));
-
-  // Even if data is cached, say that we're loading at this point for
-  // compatibility.
-  UpdateLoadingState_Locked(true);
-}
-
-void MultibufferDataSource::ProgressCallback(int64_t begin, int64_t end) {
-  DVLOG(1) << __func__ << "(" << begin << ", " << end << ")";
-  DCHECK(render_task_runner_->BelongsToCurrentThread());
-
-  if (assume_fully_buffered()) return;
-
-  base::AutoLock auto_lock(lock_);
-
-  if (end > begin) {
-    // TODO(scherkus): we shouldn't have to lock to signal host(), see
-    // http://crbug.com/113712 for details.
-    if (stop_signal_received_) return;
-
-    host_->AddBufferedByteRange(begin, end);
-  }
-
-  UpdateLoadingState_Locked(false);
-}
-
-void MultibufferDataSource::UpdateLoadingState_Locked(bool force_loading) {
-  DVLOG(1) << __func__;
-  lock_.AssertAcquired();
-  if (assume_fully_buffered()) return;
-  // Update loading state.
-  bool is_loading = !!reader_ && reader_->IsLoading();
-  if (force_loading || is_loading != loading_) {
-    bool loading = is_loading || force_loading;
-
-    if (!loading && cancel_on_defer_) {
-      if (read_op_) {
-        // We can't destroy the reader if a read operation is pending.
-        // UpdateLoadingState_Locked will be called again when the read
-        // operation is done.
-        return;
-      }
-      reader_.reset(NULL);
-    }
-
-    loading_ = loading;
-
-    // Callback could kill us, be sure to call it last.
-    downloading_cb_.Run(loading_);
-  }
-}
-
-void MultibufferDataSource::UpdateBufferSizes() {
-  DVLOG(1) << __func__;
-  if (!reader_) return;
-
-  if (!assume_fully_buffered()) {
-    // If the playback has started and the strategy is aggressive, then try to
-    // load as much as possible, assuming that the file is cacheable. (If not,
-    // why bother?)
-    bool aggressive = (buffering_strategy_ == BUFFERING_STRATEGY_AGGRESSIVE);
-    if (media_has_played_ && aggressive && url_data_ &&
-        url_data_->range_supported() && url_data_->cacheable()) {
-      reader_->SetPreload(1LL << 40, 1LL << 40);  // 1 Tb
-      return;
-    }
-  }
-
-  // Use a default bit rate if unknown and clamp to prevent overflow.
-  int64_t bitrate = clamp<int64_t>(bitrate_, 0, kMaxBitrate);
-  if (bitrate == 0) bitrate = kDefaultBitrate;
-
-  // Only scale the buffer window for playback rates greater than 1.0 in
-  // magnitude and clamp to prevent overflow.
-  double playback_rate = playback_rate_;
-
-  playback_rate = std::max(playback_rate, 1.0);
-  playback_rate = std::min(playback_rate, kMaxPlaybackRate);
-
-  int64_t bytes_per_second = (bitrate / 8.0) * playback_rate;
-
-  int64_t preload = clamp(kTargetSecondsBufferedAhead * bytes_per_second,
-                          kMinBufferPreload, kMaxBufferPreload);
-  int64_t preload_high = preload + kPreloadHighExtra;
-
-  // Assert that kMaxBufferSize is big enough that the subtraction on the next
-  // line cannot go negative.
-  static_assert(kMaxBufferSize > kMaxBufferPreload + kPreloadHighExtra,
-                "kMaxBufferSize too small to contain preload.");
-  int64_t back_buffer = clamp(kTargetSecondsBufferedBehind * bytes_per_second,
-                              kMinBufferPreload, kMaxBufferSize - preload_high);
-  int64_t buffer_size =
-      std::min((kTargetSecondsBufferedAhead + kTargetSecondsBufferedBehind) *
-                   bytes_per_second,
-               kMaxBufferSize);
-  reader_->SetMaxBuffer(buffer_size);
-  reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra);
-
-  if (preload_ == METADATA) {
-    reader_->SetPreload(0, 0);
-  } else {
-    reader_->SetPreload(preload_high, preload);
-  }
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/multibuffer_data_source.h b/src/cobalt/media/blink/multibuffer_data_source.h
deleted file mode 100644
index 19cbdbc..0000000
--- a/src/cobalt/media/blink/multibuffer_data_source.h
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_
-#define COBALT_MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/memory/linked_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/synchronization/lock.h"
-#include "cobalt/media/base/data_source.h"
-#include "cobalt/media/base/ranges.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/blink/url_index.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-}
-
-namespace cobalt {
-namespace media {
-class BufferedDataSourceHost;
-class MediaLog;
-class MultiBufferReader;
-
-// A data source capable of loading URLs and buffering the data using an
-// in-memory sliding window.
-//
-// MultibufferDataSource must be created and destroyed on the thread associated
-// with the |task_runner| passed in the constructor.
-class MEDIA_BLINK_EXPORT MultibufferDataSource : public DataSource {
- public:
-  typedef base::Callback<void(bool)> DownloadingCB;
-
-  // Used to specify video preload states. They are "hints" to the browser about
-  // how aggressively the browser should load and buffer data.
-  // Please see the HTML5 spec for the descriptions of these values:
-  // http://www.w3.org/TR/html5/video.html#attr-media-preload
-  //
-  // Enum values must match the values in blink::WebMediaPlayer::Preload and
-  // there will be assertions at compile time if they do not match.
-  enum Preload {
-    NONE,
-    METADATA,
-    AUTO,
-  };
-
-  // Enum values must match the values in
-  // blink::WebMediaPlayer::BufferingStrategy and there will be assertions at
-  // compile time if they do not match.
-  enum BufferingStrategy {
-    BUFFERING_STRATEGY_NORMAL,
-    BUFFERING_STRATEGY_AGGRESSIVE,
-  };
-
-  // |url| and |cors_mode| are passed to the object. Buffered byte range changes
-  // will be reported to |host|. |downloading_cb| will be called whenever the
-  // downloading/paused state of the source changes.
-  MultibufferDataSource(
-      const GURL& url, UrlData::CORSMode cors_mode,
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      linked_ptr<UrlIndex> url_index, blink::WebFrame* frame,
-      MediaLog* media_log, BufferedDataSourceHost* host,
-      const DownloadingCB& downloading_cb);
-  ~MultibufferDataSource() OVERRIDE;
-
-  // Executes |init_cb| with the result of initialization when it has completed.
-  //
-  // Method called on the render thread.
-  typedef base::Callback<void(bool)> InitializeCB;
-  void Initialize(const InitializeCB& init_cb);
-
-  // Adjusts the buffering algorithm based on the given preload value.
-  void SetPreload(Preload preload);
-
-  // Adjusts the buffering algorithm based on the given buffering strategy
-  // value.
-  void SetBufferingStrategy(BufferingStrategy buffering_strategy);
-
-  // Returns true if the media resource has a single origin, false otherwise.
-  // Only valid to call after Initialize() has completed.
-  //
-  // Method called on the render thread.
-  bool HasSingleOrigin();
-
-  // Returns true if the media resource passed a CORS access control check.
-  bool DidPassCORSAccessCheck() const;
-
-  // Notifies changes in playback state for controlling media buffering
-  // behavior.
-  void MediaPlaybackRateChanged(double playback_rate);
-  void MediaIsPlaying();
-  bool media_has_played() const;
-
-  // Returns true if the resource is local.
-  bool assume_fully_buffered();
-
-  // Cancels any open network connections once reaching the deferred state. If
-  // |always_cancel| is false this is done only for preload=metadata, non-
-  // streaming resources that have not started playback. If |always_cancel| is
-  // true, all resource types will have their connections canceled. If already
-  // deferred, connections will be immediately closed.
-  void OnBufferingHaveEnough(bool always_cancel);
-
-  int64_t GetMemoryUsage() const;
-
-  GURL GetUrlAfterRedirects() const;
-
-  // DataSource implementation.
-  // Called from demuxer thread.
-  void Stop() OVERRIDE;
-  void Abort() OVERRIDE;
-
-  void Read(int64_t position, int size, uint8_t* data,
-            const DataSource::ReadCB& read_cb) OVERRIDE;
-  bool GetSize(int64_t* size_out) OVERRIDE;
-  bool IsStreaming() OVERRIDE;
-  void SetBitrate(int bitrate) OVERRIDE;
-
- protected:
-  void OnRedirect(const scoped_refptr<UrlData>& destination);
-
-  // A factory method to create a BufferedResourceLoader based on the read
-  // parameters.
-  void CreateResourceLoader(int64_t first_byte_position,
-                            int64_t last_byte_position);
-
-  friend class MultibufferDataSourceTest;
-
-  // Task posted to perform actual reading on the render thread.
-  void ReadTask();
-
-  // Cancels oustanding callbacks and sets |stop_signal_received_|. Safe to call
-  // from any thread.
-  void StopInternal_Locked();
-
-  // Stops |reader_| if present. Used by Abort() and Stop().
-  void StopLoader();
-
-  // Tells |reader_| the bitrate of the media.
-  void SetBitrateTask(int bitrate);
-
-  // BufferedResourceLoader::Start() callback for initial load.
-  void StartCallback();
-
-  // Check if we've moved to a new url and update has_signgle_origin_.
-  void UpdateSingleOrigin();
-
-  // MultiBufferReader progress callback.
-  void ProgressCallback(int64_t begin, int64_t end);
-
-  // call downloading_cb_ if needed.
-  // If |force_loading| is true, we call downloading_cb_ and tell it that
-  // we are currently loading, regardless of what reader_->IsLoading() says.
-  // Caller must hold |lock_|.
-  void UpdateLoadingState_Locked(bool force_loading);
-
-  // Update |reader_|'s preload and buffer settings.
-  void UpdateBufferSizes();
-
-  // crossorigin attribute on the corresponding HTML media element, if any.
-  UrlData::CORSMode cors_mode_;
-
-  // URL of the resource requested.
-  scoped_refptr<UrlData> url_data_;
-
-  // The total size of the resource. Set during StartCallback() if the size is
-  // known, otherwise it will remain kPositionNotSpecified until the size is
-  // determined by reaching EOF.
-  int64_t total_bytes_;
-
-  // This value will be true if this data source can only support streaming.
-  // i.e. range request is not supported.
-  bool streaming_;
-
-  // This is the loading state that we last reported to our owner through
-  // |downloading_cb_|.
-  bool loading_;
-
-  // True if a failure has occured.
-  bool failed_;
-
-  // The task runner of the render thread.
-  const scoped_refptr<base::SingleThreadTaskRunner> render_task_runner_;
-
-  // Shared cache.
-  linked_ptr<UrlIndex> url_index_;
-
-  // A webframe for loading.
-  blink::WebFrame* frame_;
-
-  // A resource reader for the media resource.
-  std::unique_ptr<MultiBufferReader> reader_;
-
-  // Callback method from the pipeline for initialization.
-  InitializeCB init_cb_;
-
-  // Read parameters received from the Read() method call. Must be accessed
-  // under |lock_|.
-  class ReadOperation;
-  std::unique_ptr<ReadOperation> read_op_;
-
-  // Protects |stop_signal_received_|, |read_op_| and |total_bytes_|.
-  base::Lock lock_;
-
-  // Whether we've been told to stop via Abort() or Stop().
-  bool stop_signal_received_;
-
-  // This variable is true when the user has requested the video to play at
-  // least once.
-  bool media_has_played_;
-
-  // Buffering strategy set by SetBufferingStrategy.
-  BufferingStrategy buffering_strategy_;
-
-  // As we follow redirects, we set this variable to false if redirects
-  // go between different origins.
-  bool single_origin_;
-
-  // Close the connection when we have enough data.
-  bool cancel_on_defer_;
-
-  // This variable holds the value of the preload attribute for the video
-  // element.
-  Preload preload_;
-
-  // Bitrate of the content, 0 if unknown.
-  int bitrate_;
-
-  // Current playback rate.
-  double playback_rate_;
-
-  scoped_refptr<MediaLog> media_log_;
-
-  // Host object to report buffered byte range changes to.
-  BufferedDataSourceHost* host_;
-
-  DownloadingCB downloading_cb_;
-
-  // The original URL of the first response. If the request is redirected to
-  // another URL it is the URL after redirected. If the response is generated in
-  // a Service Worker this URL is empty. MultibufferDataSource checks the
-  // original URL of each successive response. If the origin URL of it is
-  // different from the original URL of the first response, it is treated
-  // as an error.
-  GURL response_original_url_;
-
-  // Disallow rebinding WeakReference ownership to a different thread by keeping
-  // a persistent reference. This avoids problems with the thread-safety of
-  // reaching into this class from multiple threads to attain a WeakPtr.
-  base::WeakPtr<MultibufferDataSource> weak_ptr_;
-  base::WeakPtrFactory<MultibufferDataSource> weak_factory_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MultibufferDataSource);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_
diff --git a/src/cobalt/media/blink/multibuffer_data_source_unittest.cc b/src/cobalt/media/blink/multibuffer_data_source_unittest.cc
deleted file mode 100644
index d4d0ca7..0000000
--- a/src/cobalt/media/blink/multibuffer_data_source_unittest.cc
+++ /dev/null
@@ -1,1552 +0,0 @@
-// Copyright 2013 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 "base/basictypes.h"
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "base/string_number_conversions.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/base/mock_filters.h"
-#include "cobalt/media/base/test_helpers.h"
-#include "cobalt/media/blink/buffered_data_source_host_impl.h"
-#include "cobalt/media/blink/mock_weburlloader.h"
-#include "cobalt/media/blink/multibuffer_data_source.h"
-#include "cobalt/media/blink/multibuffer_reader.h"
-#include "cobalt/media/blink/resource_multibuffer_data_provider.h"
-#include "cobalt/media/blink/test_response_generator.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-#include "third_party/WebKit/public/web/WebFrameClient.h"
-#include "third_party/WebKit/public/web/WebLocalFrame.h"
-#include "third_party/WebKit/public/web/WebView.h"
-
-using ::testing::_;
-using ::testing::Assign;
-using ::testing::DoAll;
-using ::testing::Invoke;
-using ::testing::InvokeWithoutArgs;
-using ::testing::InSequence;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-
-using blink::WebLocalFrame;
-using blink::WebString;
-using blink::WebURLLoader;
-using blink::WebURLResponse;
-using blink::WebView;
-
-namespace cobalt {
-namespace media {
-
-class TestResourceMultiBuffer;
-class TestMultiBufferDataProvider;
-
-std::set<TestMultiBufferDataProvider*> test_data_providers;
-
-class TestMultiBufferDataProvider : public ResourceMultiBufferDataProvider {
- public:
-  TestMultiBufferDataProvider(UrlData* url_data, MultiBuffer::BlockId pos)
-      : ResourceMultiBufferDataProvider(url_data, pos), loading_(false) {
-    CHECK(test_data_providers.insert(this).second);
-  }
-  ~TestMultiBufferDataProvider() override {
-    CHECK_EQ(static_cast<size_t>(1), test_data_providers.erase(this));
-  }
-  void Start() override {
-    // Create a mock active loader.
-    // Keep track of active loading state via loadAsynchronously() and cancel().
-    NiceMock<MockWebURLLoader>* url_loader = new NiceMock<MockWebURLLoader>();
-    ON_CALL(*url_loader, cancel())
-        .WillByDefault(Invoke([this]() {
-          // Check that we have not been destroyed first.
-          if (test_data_providers.find(this) != test_data_providers.end()) {
-            this->loading_ = false;
-          }
-        }));
-    loading_ = true;
-    active_loader_.reset(
-        new ActiveLoader(std::unique_ptr<WebURLLoader>(url_loader)));
-    if (!on_start_.is_null()) {
-      on_start_.Run();
-    }
-  }
-
-  bool loading() const { return loading_; }
-  void RunOnStart(base::Closure cb) { on_start_ = cb; }
-
- private:
-  bool loading_;
-  base::Closure on_start_;
-};
-
-class TestUrlData;
-
-class TestResourceMultiBuffer : public ResourceMultiBuffer {
- public:
-  TestResourceMultiBuffer(UrlData* url_data, int shift)
-      : ResourceMultiBuffer(url_data, shift) {}
-
-  std::unique_ptr<MultiBuffer::DataProvider> CreateWriter(
-      const BlockId& pos) override {
-    TestMultiBufferDataProvider* ret =
-        new TestMultiBufferDataProvider(url_data_, pos);
-    ret->Start();
-    return std::unique_ptr<MultiBuffer::DataProvider>(ret);
-  }
-
-  // TODO: Make these global
-
-  TestMultiBufferDataProvider* GetProvider() {
-    EXPECT_EQ(test_data_providers.size(), 1U);
-    if (test_data_providers.size() != 1) return NULL;
-    return *test_data_providers.begin();
-  }
-  TestMultiBufferDataProvider* GetProvider_allownull() {
-    EXPECT_LE(test_data_providers.size(), 1U);
-    if (test_data_providers.size() != 1U) return NULL;
-    return *test_data_providers.begin();
-  }
-  bool HasProvider() const { return test_data_providers.size() == 1U; }
-  bool loading() {
-    if (test_data_providers.empty()) return false;
-    return GetProvider()->loading();
-  }
-};
-
-class TestUrlData : public UrlData {
- public:
-  TestUrlData(const GURL& url, CORSMode cors_mode,
-              const base::WeakPtr<UrlIndex>& url_index)
-      : UrlData(url, cors_mode, url_index),
-        block_shift_(url_index->block_shift()) {}
-
-  ResourceMultiBuffer* multibuffer() override {
-    if (!test_multibuffer_.get()) {
-      test_multibuffer_.reset(new TestResourceMultiBuffer(this, block_shift_));
-    }
-    return test_multibuffer_.get();
-  }
-
-  TestResourceMultiBuffer* test_multibuffer() {
-    if (!test_multibuffer_.get()) {
-      test_multibuffer_.reset(new TestResourceMultiBuffer(this, block_shift_));
-    }
-    return test_multibuffer_.get();
-  }
-
- protected:
-  ~TestUrlData() override {}
-  const int block_shift_;
-
-  std::unique_ptr<TestResourceMultiBuffer> test_multibuffer_;
-};
-
-class TestUrlIndex : public UrlIndex {
- public:
-  explicit TestUrlIndex(blink::WebFrame* frame) : UrlIndex(frame) {}
-
-  scoped_refptr<UrlData> NewUrlData(const GURL& url,
-                                    UrlData::CORSMode cors_mode) override {
-    last_url_data_ =
-        new TestUrlData(url, cors_mode, weak_factory_.GetWeakPtr());
-    return last_url_data_;
-  }
-
-  scoped_refptr<TestUrlData> last_url_data() {
-    EXPECT_TRUE(last_url_data_);
-    return last_url_data_;
-  }
-
- private:
-  scoped_refptr<TestUrlData> last_url_data_;
-};
-
-class MockBufferedDataSourceHost : public BufferedDataSourceHost {
- public:
-  MockBufferedDataSourceHost() {}
-  virtual ~MockBufferedDataSourceHost() {}
-
-  MOCK_METHOD1(SetTotalBytes, void(int64_t total_bytes));
-  MOCK_METHOD2(AddBufferedByteRange, void(int64_t start, int64_t end));
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSourceHost);
-};
-
-class MockMultibufferDataSource : public MultibufferDataSource {
- public:
-  MockMultibufferDataSource(
-      const GURL& url, UrlData::CORSMode cors_mode,
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      linked_ptr<UrlIndex> url_index, WebLocalFrame* frame,
-      BufferedDataSourceHost* host)
-      : MultibufferDataSource(
-            url, cors_mode, task_runner, url_index, frame,
-            new media::MediaLog(), host,
-            base::Bind(&MockMultibufferDataSource::set_downloading,
-                       base::Unretained(this))),
-        downloading_(false) {}
-
-  bool downloading() { return downloading_; }
-  void set_downloading(bool downloading) { downloading_ = downloading; }
-  bool range_supported() { return url_data_->range_supported(); }
-
- private:
-  // Whether the resource is downloading or deferred.
-  bool downloading_;
-
-  DISALLOW_COPY_AND_ASSIGN(MockMultibufferDataSource);
-};
-
-static const int64_t kFileSize = 5000000;
-static const int64_t kFarReadPosition = 3997696;
-static const int kDataSize = 32 << 10;
-
-static const char kHttpUrl[] = "http://localhost/foo.webm";
-static const char kFileUrl[] = "file:///tmp/bar.webm";
-static const char kHttpDifferentPathUrl[] = "http://localhost/bar.webm";
-static const char kHttpDifferentOriginUrl[] = "http://127.0.0.1/foo.webm";
-
-class MultibufferDataSourceTest : public testing::Test {
- public:
-  MultibufferDataSourceTest()
-      : view_(WebView::create(NULL, blink::WebPageVisibilityStateVisible)),
-        preload_(MultibufferDataSource::AUTO) {
-    WebLocalFrame* frame =
-        WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_);
-    view_->setMainFrame(frame);
-    url_index_ = make_linked_ptr(new TestUrlIndex(frame));
-  }
-
-  virtual ~MultibufferDataSourceTest() { view_->close(); }
-
-  MOCK_METHOD1(OnInitialize, void(bool));
-
-  void InitializeWithCORS(const char* url, bool expected,
-                          UrlData::CORSMode cors_mode) {
-    GURL gurl(url);
-    data_source_.reset(new MockMultibufferDataSource(
-        gurl, cors_mode, message_loop_.task_runner(), url_index_,
-        view_->mainFrame()->toWebLocalFrame(), &host_));
-    data_source_->SetPreload(preload_);
-
-    response_generator_.reset(new TestResponseGenerator(gurl, kFileSize));
-    EXPECT_CALL(*this, OnInitialize(expected));
-    data_source_->Initialize(base::Bind(
-        &MultibufferDataSourceTest::OnInitialize, base::Unretained(this)));
-    base::RunLoop().RunUntilIdle();
-
-    // Not really loading until after OnInitialize is called.
-    EXPECT_EQ(data_source_->downloading(), false);
-  }
-
-  void Initialize(const char* url, bool expected) {
-    InitializeWithCORS(url, expected, UrlData::CORS_UNSPECIFIED);
-  }
-
-  // Helper to initialize tests with a valid 200 response.
-  void InitializeWith200Response() {
-    Initialize(kHttpUrl, true);
-
-    EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-    Respond(response_generator_->Generate200());
-
-    EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-    ReceiveData(kDataSize);
-  }
-
-  // Helper to initialize tests with a valid 206 response.
-  void InitializeWith206Response() {
-    Initialize(kHttpUrl, true);
-
-    EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-    Respond(response_generator_->Generate206(0));
-    EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-    ReceiveData(kDataSize);
-  }
-
-  // Helper to initialize tests with a valid file:// response.
-  void InitializeWithFileResponse() {
-    Initialize(kFileUrl, true);
-
-    EXPECT_CALL(host_, SetTotalBytes(kFileSize));
-    EXPECT_CALL(host_, AddBufferedByteRange(0, kFileSize));
-    Respond(response_generator_->GenerateFileResponse(0));
-
-    ReceiveData(kDataSize);
-  }
-
-  // Stops any active loaders and shuts down the data source.
-  //
-  // This typically happens when the page is closed and for our purposes is
-  // appropriate to do when tearing down a test.
-  void Stop() {
-    if (loading()) {
-      data_provider()->didFail(url_loader(),
-                               response_generator_->GenerateError());
-      base::RunLoop().RunUntilIdle();
-    }
-
-    data_source_->Stop();
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void Respond(const WebURLResponse& response) {
-    EXPECT_TRUE(url_loader());
-    if (!active_loader()) return;
-    data_provider()->didReceiveResponse(url_loader(), response);
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void ReceiveDataLow(int size) {
-    EXPECT_TRUE(url_loader());
-    if (!url_loader()) return;
-    std::unique_ptr<char[]> data(new char[size]);
-    SbMemorySet(data.get(), 0xA5, size);  // Arbitrary non-zero value.
-
-    data_provider()->didReceiveData(url_loader(), data.get(), size, size, size);
-  }
-
-  void ReceiveData(int size) {
-    ReceiveDataLow(size);
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void FinishLoading() {
-    EXPECT_TRUE(url_loader());
-    if (!url_loader()) return;
-    data_provider()->didFinishLoading(url_loader(), 0, -1);
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void FailLoading() {
-    data_provider()->didFail(url_loader(),
-                             response_generator_->GenerateError());
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void Restart() {
-    EXPECT_TRUE(data_provider());
-    EXPECT_FALSE(active_loader_allownull());
-    if (!data_provider()) return;
-    data_provider()->Start();
-  }
-
-  MOCK_METHOD1(ReadCallback, void(int size));
-
-  void ReadAt(int64_t position, int64_t howmuch = kDataSize) {
-    data_source_->Read(position, howmuch, buffer_,
-                       base::Bind(&MultibufferDataSourceTest::ReadCallback,
-                                  base::Unretained(this)));
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void ExecuteMixedResponseSuccessTest(const WebURLResponse& response1,
-                                       const WebURLResponse& response2) {
-    EXPECT_CALL(host_, SetTotalBytes(kFileSize));
-    EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-    EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-    EXPECT_CALL(*this, ReadCallback(kDataSize)).Times(2);
-
-    Respond(response1);
-    ReceiveData(kDataSize);
-    ReadAt(0);
-    EXPECT_TRUE(loading());
-
-    FinishLoading();
-    Restart();
-    ReadAt(kDataSize);
-    Respond(response2);
-    ReceiveData(kDataSize);
-    FinishLoading();
-    Stop();
-  }
-
-  void ExecuteMixedResponseFailureTest(const WebURLResponse& response1,
-                                       const WebURLResponse& response2) {
-    EXPECT_CALL(host_, SetTotalBytes(kFileSize));
-    EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-    EXPECT_CALL(*this, ReadCallback(kDataSize));
-    // Stop() will also cause the readback to be called with kReadError, but
-    // we want to make sure it was called before Stop().
-    bool failed_ = false;
-    EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError))
-        .WillOnce(Assign(&failed_, true));
-
-    Respond(response1);
-    ReceiveData(kDataSize);
-    ReadAt(0);
-    EXPECT_TRUE(loading());
-
-    FinishLoading();
-    Restart();
-    ReadAt(kDataSize);
-    Respond(response2);
-    EXPECT_TRUE(failed_);
-    Stop();
-  }
-
-  void CheckCapacityDefer() {
-    EXPECT_EQ(2 << 20, preload_low());
-    EXPECT_EQ(3 << 20, preload_high());
-  }
-
-  void CheckReadThenDefer() {
-    EXPECT_EQ(0, preload_low());
-    EXPECT_EQ(0, preload_high());
-  }
-
-  void CheckNeverDefer() {
-    EXPECT_EQ(1LL << 40, preload_low());
-    EXPECT_EQ(1LL << 40, preload_high());
-  }
-
-  // Accessors for private variables on |data_source_|.
-  MultiBufferReader* loader() { return data_source_->reader_.get(); }
-
-  TestResourceMultiBuffer* multibuffer() {
-    return url_index_->last_url_data()->test_multibuffer();
-  }
-
-  TestMultiBufferDataProvider* data_provider() {
-    return multibuffer()->GetProvider();
-  }
-  ActiveLoader* active_loader() {
-    EXPECT_TRUE(data_provider());
-    if (!data_provider()) return NULL;
-    return data_provider()->active_loader_.get();
-  }
-  ActiveLoader* active_loader_allownull() {
-    TestMultiBufferDataProvider* data_provider =
-        multibuffer()->GetProvider_allownull();
-    if (!data_provider) return NULL;
-    return data_provider->active_loader_.get();
-  }
-  WebURLLoader* url_loader() {
-    EXPECT_TRUE(active_loader());
-    if (!active_loader()) return NULL;
-    return active_loader()->loader_.get();
-  }
-
-  bool loading() { return multibuffer()->loading(); }
-
-  MultibufferDataSource::Preload preload() { return data_source_->preload_; }
-  void set_preload(MultibufferDataSource::Preload preload) {
-    preload_ = preload;
-  }
-  int64_t preload_high() {
-    CHECK(loader());
-    return loader()->preload_high();
-  }
-  int64_t preload_low() {
-    CHECK(loader());
-    return loader()->preload_low();
-  }
-  int data_source_bitrate() { return data_source_->bitrate_; }
-  double data_source_playback_rate() { return data_source_->playback_rate_; }
-  bool is_local_source() { return data_source_->assume_fully_buffered(); }
-  scoped_refptr<UrlData> url_data() { return data_source_->url_data_; }
-  void set_might_be_reused_from_cache_in_future(bool value) {
-    url_data()->set_cacheable(value);
-  }
-
- protected:
-  blink::WebFrameClient client_;
-  WebView* view_;
-  MultibufferDataSource::Preload preload_;
-  base::MessageLoop message_loop_;
-  linked_ptr<TestUrlIndex> url_index_;
-
-  std::unique_ptr<MockMultibufferDataSource> data_source_;
-
-  std::unique_ptr<TestResponseGenerator> response_generator_;
-
-  StrictMock<MockBufferedDataSourceHost> host_;
-
-  // Used for calling MultibufferDataSource::Read().
-  uint8_t buffer_[kDataSize * 2];
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MultibufferDataSourceTest);
-};
-
-TEST_F(MultibufferDataSourceTest, Range_Supported) {
-  InitializeWith206Response();
-
-  EXPECT_TRUE(loading());
-  EXPECT_FALSE(data_source_->IsStreaming());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_InstanceSizeUnknown) {
-  Initialize(kHttpUrl, true);
-
-  Respond(response_generator_->Generate206(
-      0, TestResponseGenerator::kNoContentRangeInstanceSize));
-
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_TRUE(loading());
-  EXPECT_TRUE(data_source_->IsStreaming());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_NotFound) {
-  Initialize(kHttpUrl, false);
-  Respond(response_generator_->Generate404());
-
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_NotSupported) {
-  InitializeWith200Response();
-
-  EXPECT_TRUE(loading());
-  EXPECT_TRUE(data_source_->IsStreaming());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_NotSatisfiable) {
-  Initialize(kHttpUrl, true);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  Respond(response_generator_->GenerateResponse(416));
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-// Special carve-out for Apache versions that choose to return a 200 for
-// Range:0- ("because it's more efficient" than a 206)
-TEST_F(MultibufferDataSourceTest, Range_SupportedButReturned200) {
-  Initialize(kHttpUrl, true);
-  EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-  WebURLResponse response = response_generator_->Generate200();
-  response.setHTTPHeaderField(WebString::fromUTF8("Accept-Ranges"),
-                              WebString::fromUTF8("bytes"));
-  Respond(response);
-
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_TRUE(loading());
-  EXPECT_FALSE(data_source_->IsStreaming());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_MissingContentRange) {
-  Initialize(kHttpUrl, false);
-  Respond(response_generator_->Generate206(
-      0, TestResponseGenerator::kNoContentRange));
-
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_MissingContentLength) {
-  Initialize(kHttpUrl, true);
-
-  // It'll manage without a Content-Length response.
-  EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-  Respond(response_generator_->Generate206(
-      0, TestResponseGenerator::kNoContentLength));
-
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_TRUE(loading());
-  EXPECT_FALSE(data_source_->IsStreaming());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Range_WrongContentRange) {
-  Initialize(kHttpUrl, false);
-
-  // Now it's done and will fail.
-  Respond(response_generator_->Generate206(1337));
-
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-// Test the case where the initial response from the server indicates that
-// Range requests are supported, but a later request prove otherwise.
-TEST_F(MultibufferDataSourceTest, Range_ServerLied) {
-  InitializeWith206Response();
-
-  // Read causing a new request to be made -- we'll expect it to error.
-  ReadAt(kFarReadPosition);
-
-  // Return a 200 in response to a range request.
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError));
-  Respond(response_generator_->Generate200());
-
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_AbortWhileReading) {
-  InitializeWith206Response();
-
-  // Make sure there's a pending read -- we'll expect it to error.
-  ReadAt(kFileSize);
-
-  // Abort!!!
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kAborted));
-  data_source_->Abort();
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_TRUE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, File_AbortWhileReading) {
-  InitializeWithFileResponse();
-
-  // Make sure there's a pending read -- we'll expect it to error.
-  ReadAt(kFileSize);
-
-  // Abort!!!
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kAborted));
-  data_source_->Abort();
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_TRUE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_Retry) {
-  InitializeWith206Response();
-
-  // Read to advance our position.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  // Issue a pending read but terminate the connection to force a retry.
-  ReadAt(kDataSize);
-  FinishLoading();
-  Restart();
-  Respond(response_generator_->Generate206(kDataSize));
-
-  // Complete the read.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReceiveData(kDataSize);
-
-  EXPECT_TRUE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_RetryOnError) {
-  InitializeWith206Response();
-
-  // Read to advance our position.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  // Issue a pending read but trigger an error to force a retry.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReadAt(kDataSize);
-  base::RunLoop run_loop;
-  data_provider()->didFail(url_loader(), response_generator_->GenerateError());
-  data_provider()->RunOnStart(run_loop.QuitClosure());
-  run_loop.Run();
-  Respond(response_generator_->Generate206(kDataSize));
-  ReceiveData(kDataSize);
-  FinishLoading();
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-// Make sure that we prefetch across partial responses. (crbug.com/516589)
-TEST_F(MultibufferDataSourceTest, Http_PartialResponsePrefetch) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 3 - 1);
-
-  EXPECT_CALL(host_, SetTotalBytes(kFileSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-
-  Respond(response1);
-  ReceiveData(kDataSize);
-  ReadAt(0);
-  EXPECT_TRUE(loading());
-
-  FinishLoading();
-  Restart();
-  Respond(response2);
-  ReceiveData(kDataSize);
-  ReceiveData(kDataSize);
-  FinishLoading();
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_PartialResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  // The origin URL of response1 and response2 are same. So no error should
-  // occur.
-  ExecuteMixedResponseSuccessTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_RedirectedToDifferentPathResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  response2.setURL(GURL(kHttpDifferentPathUrl));
-  // The origin URL of response1 and response2 are same. So no error should
-  // occur.
-  ExecuteMixedResponseSuccessTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_RedirectedToDifferentOriginResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  response2.setURL(GURL(kHttpDifferentOriginUrl));
-  // The origin URL of response1 and response2 are different. So an error should
-  // occur.
-  ExecuteMixedResponseFailureTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_ServiceWorkerGeneratedResponseAndNormalResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  response1.setWasFetchedViaServiceWorker(true);
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  // response1 is generated in a Service Worker but response2 is from a native
-  // server. So an error should occur.
-  ExecuteMixedResponseFailureTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_ServiceWorkerProxiedAndSameURLResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  response1.setWasFetchedViaServiceWorker(true);
-  response1.setOriginalURLViaServiceWorker(GURL(kHttpUrl));
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  // The origin URL of response1 and response2 are same. So no error should
-  // occur.
-  ExecuteMixedResponseSuccessTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_ServiceWorkerProxiedAndDifferentPathResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  response1.setWasFetchedViaServiceWorker(true);
-  response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentPathUrl));
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  // The origin URL of response1 and response2 are same. So no error should
-  // occur.
-  ExecuteMixedResponseSuccessTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_ServiceWorkerProxiedAndDifferentOriginResponse) {
-  Initialize(kHttpUrl, true);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  response1.setWasFetchedViaServiceWorker(true);
-  response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl));
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  // The origin URL of response1 and response2 are different. So an error should
-  // occur.
-  ExecuteMixedResponseFailureTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest,
-       Http_MixedResponse_ServiceWorkerProxiedAndDifferentOriginResponseCORS) {
-  InitializeWithCORS(kHttpUrl, true, UrlData::CORS_ANONYMOUS);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  response1.setWasFetchedViaServiceWorker(true);
-  response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl));
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-  // The origin URL of response1 and response2 are different, but a CORS check
-  // has been passed for each request, so expect success.
-  ExecuteMixedResponseSuccessTest(response1, response2);
-}
-
-TEST_F(MultibufferDataSourceTest, File_Retry) {
-  InitializeWithFileResponse();
-
-  // Read to advance our position.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  // Issue a pending read but terminate the connection to force a retry.
-  ReadAt(kDataSize);
-  FinishLoading();
-  Restart();
-  Respond(response_generator_->GenerateFileResponse(kDataSize));
-
-  // Complete the read.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_TRUE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_TooManyRetries) {
-  InitializeWith206Response();
-
-  // Make sure there's a pending read -- we'll expect it to error.
-  ReadAt(kDataSize);
-
-  for (int i = 0; i < ResourceMultiBufferDataProvider::kMaxRetries; i++) {
-    FailLoading();
-    data_provider()->Start();
-    Respond(response_generator_->Generate206(kDataSize));
-  }
-
-  // Stop() will also cause the readback to be called with kReadError, but
-  // we want to make sure it was called during FailLoading().
-  bool failed_ = false;
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError))
-      .WillOnce(Assign(&failed_, true));
-  FailLoading();
-  EXPECT_TRUE(failed_);
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, File_TooManyRetries) {
-  InitializeWithFileResponse();
-
-  // Make sure there's a pending read -- we'll expect it to error.
-  ReadAt(kDataSize);
-
-  for (int i = 0; i < ResourceMultiBufferDataProvider::kMaxRetries; i++) {
-    FailLoading();
-    data_provider()->Start();
-    Respond(response_generator_->Generate206(kDataSize));
-  }
-
-  // Stop() will also cause the readback to be called with kReadError, but
-  // we want to make sure it was called during FailLoading().
-  bool failed_ = false;
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError))
-      .WillOnce(Assign(&failed_, true));
-  FailLoading();
-  EXPECT_TRUE(failed_);
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, File_InstanceSizeUnknown) {
-  Initialize(kFileUrl, false);
-
-  Respond(
-      response_generator_->GenerateFileResponse(media::DataSource::kReadError));
-  ReceiveData(kDataSize);
-
-  EXPECT_FALSE(data_source_->downloading());
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, File_Successful) {
-  InitializeWithFileResponse();
-
-  EXPECT_TRUE(loading());
-  EXPECT_FALSE(data_source_->IsStreaming());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, StopDuringRead) {
-  InitializeWith206Response();
-
-  uint8_t buffer[256];
-  data_source_->Read(0, arraysize(buffer), buffer,
-                     base::Bind(&MultibufferDataSourceTest::ReadCallback,
-                                base::Unretained(this)));
-
-  // The outstanding read should fail before the stop callback runs.
-  {
-    InSequence s;
-    EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError));
-    data_source_->Stop();
-  }
-  base::RunLoop().RunUntilIdle();
-}
-
-TEST_F(MultibufferDataSourceTest, DefaultValues) {
-  InitializeWith206Response();
-
-  // Ensure we have sane values for default loading scenario.
-  EXPECT_EQ(MultibufferDataSource::AUTO, preload());
-  EXPECT_EQ(2 << 20, preload_low());
-  EXPECT_EQ(3 << 20, preload_high());
-
-  EXPECT_EQ(0, data_source_bitrate());
-  EXPECT_EQ(0.0, data_source_playback_rate());
-
-  EXPECT_TRUE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, SetBitrate) {
-  InitializeWith206Response();
-
-  data_source_->SetBitrate(1234);
-  base::RunLoop().RunUntilIdle();
-  EXPECT_EQ(1234, data_source_bitrate());
-
-  // Read so far ahead to cause the loader to get recreated.
-  TestMultiBufferDataProvider* old_loader = data_provider();
-  ReadAt(kFarReadPosition);
-  Respond(response_generator_->Generate206(kFarReadPosition));
-
-  // Verify loader changed but still has same bitrate.
-  EXPECT_NE(old_loader, data_provider());
-
-  EXPECT_TRUE(loading());
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError));
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, MediaPlaybackRateChanged) {
-  InitializeWith206Response();
-
-  data_source_->MediaPlaybackRateChanged(2.0);
-  base::RunLoop().RunUntilIdle();
-  EXPECT_EQ(2.0, data_source_playback_rate());
-
-  // Read so far ahead to cause the loader to get recreated.
-  TestMultiBufferDataProvider* old_loader = data_provider();
-  ReadAt(kFarReadPosition);
-  Respond(response_generator_->Generate206(kFarReadPosition));
-
-  // Verify loader changed but still has same playback rate.
-  EXPECT_NE(old_loader, data_provider());
-
-  EXPECT_TRUE(loading());
-  EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError));
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_Read) {
-  InitializeWith206Response();
-
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0, kDataSize * 2);
-
-  ReadAt(kDataSize, kDataSize);
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_,
-              AddBufferedByteRange(kDataSize, kDataSize + kDataSize / 2));
-  ReceiveData(kDataSize / 2);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReceiveData(kDataSize / 2);
-
-  EXPECT_TRUE(data_source_->downloading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_ShareData) {
-  InitializeWith206Response();
-
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0, kDataSize * 2);
-
-  ReadAt(kDataSize, kDataSize);
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_,
-              AddBufferedByteRange(kDataSize, kDataSize + kDataSize / 2));
-  ReceiveData(kDataSize / 2);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReceiveData(kDataSize / 2);
-
-  EXPECT_TRUE(data_source_->downloading());
-
-  StrictMock<MockBufferedDataSourceHost> host2;
-  MockMultibufferDataSource source2(
-      GURL(kHttpUrl), UrlData::CORS_UNSPECIFIED, message_loop_.task_runner(),
-      url_index_, view_->mainFrame()->toWebLocalFrame(), &host2);
-  source2.SetPreload(preload_);
-
-  EXPECT_CALL(*this, OnInitialize(true));
-
-  // This call would not be expected if we were not sharing data.
-  EXPECT_CALL(host2, SetTotalBytes(response_generator_->content_length()));
-  source2.Initialize(base::Bind(&MultibufferDataSourceTest::OnInitialize,
-                                base::Unretained(this)));
-  base::RunLoop().RunUntilIdle();
-
-  // Always loading after initialize.
-  EXPECT_EQ(source2.downloading(), true);
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_Read_Seek) {
-  InitializeWith206Response();
-
-  // Read a bit from the beginning.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  // Simulate a seek by reading a bit beyond kDataSize.
-  ReadAt(kDataSize * 2);
-
-  // We receive data leading up to but not including our read.
-  // No notification will happen, since it's progress outside
-  // of our current range.
-  ReceiveData(kDataSize);
-
-  // We now receive the rest of the data for our read.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
-  ReceiveData(kDataSize);
-
-  EXPECT_TRUE(data_source_->downloading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, File_Read) {
-  InitializeWithFileResponse();
-
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0, kDataSize * 2);
-
-  ReadAt(kDataSize, kDataSize);
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReceiveData(kDataSize);
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_FinishLoading) {
-  InitializeWith206Response();
-
-  EXPECT_TRUE(data_source_->downloading());
-  // premature didFinishLoading() will cause a retry.
-  FinishLoading();
-  EXPECT_TRUE(data_source_->downloading());
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, File_FinishLoading) {
-  InitializeWithFileResponse();
-
-  ReceiveData(kDataSize);
-
-  EXPECT_FALSE(data_source_->downloading());
-  // premature didFinishLoading() will cause a retry.
-  FinishLoading();
-  EXPECT_FALSE(data_source_->downloading());
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, LocalResource_DeferStrategy) {
-  InitializeWithFileResponse();
-
-  EXPECT_EQ(MultibufferDataSource::AUTO, preload());
-  EXPECT_TRUE(is_local_source());
-  CheckCapacityDefer();
-
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckCapacityDefer();
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, LocalResource_PreloadMetadata_DeferStrategy) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWithFileResponse();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_TRUE(is_local_source());
-  CheckReadThenDefer();
-
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckCapacityDefer();
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, ExternalResource_Reponse200_DeferStrategy) {
-  InitializeWith200Response();
-
-  EXPECT_EQ(MultibufferDataSource::AUTO, preload());
-  EXPECT_FALSE(is_local_source());
-  EXPECT_FALSE(data_source_->range_supported());
-  CheckCapacityDefer();
-
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckCapacityDefer();
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest,
-       ExternalResource_Response200_PreloadMetadata_DeferStrategy) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWith200Response();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_FALSE(is_local_source());
-  EXPECT_FALSE(data_source_->range_supported());
-  CheckReadThenDefer();
-
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckCapacityDefer();
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, ExternalResource_Reponse206_DeferStrategy) {
-  InitializeWith206Response();
-
-  EXPECT_EQ(MultibufferDataSource::AUTO, preload());
-  EXPECT_FALSE(is_local_source());
-  EXPECT_TRUE(data_source_->range_supported());
-  CheckCapacityDefer();
-
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-  set_might_be_reused_from_cache_in_future(true);
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckNeverDefer();
-
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_NORMAL);
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-
-  set_might_be_reused_from_cache_in_future(false);
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckCapacityDefer();
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest,
-       ExternalResource_Response206_PreloadMetadata_DeferStrategy) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWith206Response();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_FALSE(is_local_source());
-  EXPECT_TRUE(data_source_->range_supported());
-  CheckReadThenDefer();
-
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-
-  set_might_be_reused_from_cache_in_future(true);
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckNeverDefer();
-
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_NORMAL);
-  data_source_->MediaIsPlaying();
-  CheckCapacityDefer();
-  set_might_be_reused_from_cache_in_future(false);
-  data_source_->SetBufferingStrategy(
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-  CheckCapacityDefer();
-
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, ExternalResource_Response206_VerifyDefer) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWith206Response();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_FALSE(is_local_source());
-  EXPECT_TRUE(data_source_->range_supported());
-  CheckReadThenDefer();
-
-  // Read a bit from the beginning.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  ASSERT_TRUE(active_loader());
-  EXPECT_TRUE(active_loader()->deferred());
-}
-
-TEST_F(MultibufferDataSourceTest,
-       ExternalResource_Response206_CancelAfterDefer) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWith206Response();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_FALSE(is_local_source());
-
-  EXPECT_TRUE(data_source_->range_supported());
-  CheckReadThenDefer();
-
-  ReadAt(kDataSize);
-
-  data_source_->OnBufferingHaveEnough(false);
-  ASSERT_TRUE(active_loader());
-
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReceiveData(kDataSize);
-
-  EXPECT_FALSE(active_loader_allownull());
-}
-
-// This test tries to trigger an edge case where the read callback
-// never happens because the reader is deleted before that happens.
-TEST_F(MultibufferDataSourceTest,
-       ExternalResource_Response206_CancelAfterDefer2) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWith206Response();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_FALSE(is_local_source());
-
-  EXPECT_TRUE(data_source_->range_supported());
-  CheckReadThenDefer();
-
-  ReadAt(kDataSize);
-
-  data_source_->OnBufferingHaveEnough(false);
-  ASSERT_TRUE(active_loader());
-
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(kDataSize, kDataSize + 2000));
-
-  ReceiveDataLow(2000);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2 + 2000));
-  ReceiveDataLow(kDataSize);
-
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_FALSE(active_loader_allownull());
-}
-
-TEST_F(MultibufferDataSourceTest,
-       ExternalResource_Response206_CancelAfterPlay) {
-  set_preload(MultibufferDataSource::METADATA);
-  InitializeWith206Response();
-
-  EXPECT_EQ(MultibufferDataSource::METADATA, preload());
-  EXPECT_FALSE(is_local_source());
-
-  EXPECT_TRUE(data_source_->range_supported());
-  CheckReadThenDefer();
-
-  ReadAt(kDataSize);
-
-  // Marking the media as playing should prevent deferral. It also tells the
-  // data source to start buffering beyond the initial load.
-  data_source_->MediaIsPlaying();
-  data_source_->OnBufferingHaveEnough(false);
-  CheckCapacityDefer();
-  ASSERT_TRUE(active_loader());
-
-  // Read a bit from the beginning and ensure deferral hasn't happened yet.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReceiveData(kDataSize);
-  ASSERT_TRUE(active_loader());
-  data_source_->OnBufferingHaveEnough(true);
-  ASSERT_TRUE(active_loader());
-  ASSERT_FALSE(active_loader()->deferred());
-
-  // Deliver data until capacity is reached and verify deferral.
-  int bytes_received = 0;
-  EXPECT_CALL(host_, AddBufferedByteRange(_, _)).Times(testing::AtLeast(1));
-  while (active_loader_allownull() && !active_loader()->deferred()) {
-    ReceiveData(kDataSize);
-    bytes_received += kDataSize;
-  }
-  EXPECT_GT(bytes_received, 0);
-  EXPECT_LT(bytes_received + kDataSize, kFileSize);
-  EXPECT_FALSE(active_loader_allownull());
-}
-
-TEST_F(MultibufferDataSourceTest, SeekPastEOF) {
-  GURL gurl(kHttpUrl);
-  data_source_.reset(new MockMultibufferDataSource(
-      gurl, UrlData::CORS_UNSPECIFIED, message_loop_.task_runner(), url_index_,
-      view_->mainFrame()->toWebLocalFrame(), &host_));
-  data_source_->SetPreload(preload_);
-
-  response_generator_.reset(new TestResponseGenerator(gurl, kDataSize + 1));
-  EXPECT_CALL(*this, OnInitialize(true));
-  data_source_->Initialize(base::Bind(&MultibufferDataSourceTest::OnInitialize,
-                                      base::Unretained(this)));
-  base::RunLoop().RunUntilIdle();
-
-  // Not really loading until after OnInitialize is called.
-  EXPECT_EQ(data_source_->downloading(), false);
-
-  EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-  Respond(response_generator_->Generate206(0));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  // Read a bit from the beginning.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  EXPECT_CALL(host_, AddBufferedByteRange(kDataSize, kDataSize + 1));
-  ReceiveData(1);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
-  FinishLoading();
-  EXPECT_CALL(*this, ReadCallback(0));
-
-  ReadAt(kDataSize + 5, kDataSize * 2);
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_RetryThenRedirect) {
-  InitializeWith206Response();
-
-  // Read to advance our position.
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  // Issue a pending read but trigger an error to force a retry.
-  EXPECT_CALL(*this, ReadCallback(kDataSize - 10));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReadAt(kDataSize + 10, kDataSize - 10);
-  base::RunLoop run_loop;
-  data_provider()->didFail(url_loader(), response_generator_->GenerateError());
-  data_provider()->RunOnStart(run_loop.QuitClosure());
-  run_loop.Run();
-
-  // Server responds with a redirect.
-  blink::WebURLRequest request((GURL(kHttpDifferentPathUrl)));
-  blink::WebURLResponse response((GURL(kHttpUrl)));
-  response.setHTTPStatusCode(307);
-  data_provider()->willFollowRedirect(url_loader(), request, response);
-  Respond(response_generator_->Generate206(kDataSize));
-  ReceiveData(kDataSize);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
-  FinishLoading();
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_NotStreamingAfterRedirect) {
-  Initialize(kHttpUrl, true);
-
-  // Server responds with a redirect.
-  blink::WebURLRequest request((GURL(kHttpDifferentPathUrl)));
-  blink::WebURLResponse response((GURL(kHttpUrl)));
-  response.setHTTPStatusCode(307);
-  data_provider()->willFollowRedirect(url_loader(), request, response);
-
-  EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-  Respond(response_generator_->Generate206(0));
-
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_FALSE(data_source_->IsStreaming());
-
-  FinishLoading();
-  EXPECT_FALSE(loading());
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, Http_RangeNotSatisfiableAfterRedirect) {
-  Initialize(kHttpUrl, true);
-
-  // Server responds with a redirect.
-  blink::WebURLRequest request((GURL(kHttpDifferentPathUrl)));
-  blink::WebURLResponse response((GURL(kHttpUrl)));
-  response.setHTTPStatusCode(307);
-  data_provider()->willFollowRedirect(url_loader(), request, response);
-
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  Respond(response_generator_->GenerateResponse(416));
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, LengthKnownAtEOF) {
-  Initialize(kHttpUrl, true);
-  // Server responds without content-length.
-  WebURLResponse response = response_generator_->Generate200();
-  response.clearHTTPHeaderField(WebString::fromUTF8("Content-Length"));
-  response.setExpectedContentLength(kPositionNotSpecified);
-  Respond(response);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-  int64_t len;
-  EXPECT_FALSE(data_source_->GetSize(&len));
-  EXPECT_TRUE(data_source_->IsStreaming());
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-  ReadAt(0);
-
-  ReadAt(kDataSize);
-  EXPECT_CALL(host_, SetTotalBytes(kDataSize));
-  EXPECT_CALL(*this, ReadCallback(0));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  FinishLoading();
-
-  // Done loading, now we should know the length.
-  EXPECT_TRUE(data_source_->GetSize(&len));
-  EXPECT_EQ(kDataSize, len);
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, FileSizeLessThanBlockSize) {
-  Initialize(kHttpUrl, true);
-  GURL gurl(kHttpUrl);
-  blink::WebURLResponse response(gurl);
-  response.setHTTPStatusCode(200);
-  response.setHTTPHeaderField(
-      WebString::fromUTF8("Content-Length"),
-      WebString::fromUTF8(base::Int64ToString(kDataSize / 2)));
-  response.setExpectedContentLength(kDataSize / 2);
-  Respond(response);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize / 2));
-  EXPECT_CALL(host_, SetTotalBytes(kDataSize / 2));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
-  ReceiveData(kDataSize / 2);
-  FinishLoading();
-
-  int64_t len = 0;
-  EXPECT_TRUE(data_source_->GetSize(&len));
-  EXPECT_EQ(kDataSize / 2, len);
-  Stop();
-}
-
-TEST_F(MultibufferDataSourceTest, DidPassCORSAccessTest) {
-  InitializeWithCORS(kHttpUrl, true, UrlData::CORS_ANONYMOUS);
-  set_preload(MultibufferDataSource::NONE);
-  WebURLResponse response1 =
-      response_generator_->GeneratePartial206(0, kDataSize - 1);
-  response1.setWasFetchedViaServiceWorker(true);
-  response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl));
-  WebURLResponse response2 =
-      response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
-
-  EXPECT_CALL(host_, SetTotalBytes(kFileSize));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  EXPECT_CALL(*this, ReadCallback(kDataSize));
-
-  EXPECT_FALSE(data_source_->DidPassCORSAccessCheck());
-  Respond(response1);
-  ReceiveData(kDataSize);
-  ReadAt(0);
-  EXPECT_TRUE(loading());
-  EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
-
-  FinishLoading();
-
-  // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true.
-  data_source_->Stop();
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
-}
-
-TEST_F(MultibufferDataSourceTest, EtagTest) {
-  Initialize(kHttpUrl, true);
-
-  EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-  WebURLResponse response = response_generator_->Generate206(0);
-  const std::string etag("\"arglebargle glop-glyf?\"");
-  response.setHTTPHeaderField(WebString::fromUTF8("Etag"),
-                              WebString::fromUTF8(etag));
-  Respond(response);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_EQ(url_data()->etag(), etag);
-}
-
-// Provoke an edge case where the loading state may not end up transitioning
-// back to "idle" when we're done loading.
-TEST_F(MultibufferDataSourceTest, Http_CheckLoadingTransition) {
-  GURL gurl(kHttpUrl);
-  data_source_.reset(new MockMultibufferDataSource(
-      gurl, UrlData::CORS_UNSPECIFIED, message_loop_.task_runner(), url_index_,
-      view_->mainFrame()->toWebLocalFrame(), &host_));
-  data_source_->SetPreload(preload_);
-
-  response_generator_.reset(new TestResponseGenerator(gurl, kDataSize * 1));
-  EXPECT_CALL(*this, OnInitialize(true));
-  data_source_->Initialize(base::Bind(&MultibufferDataSourceTest::OnInitialize,
-                                      base::Unretained(this)));
-  base::RunLoop().RunUntilIdle();
-
-  // Not really loading until after OnInitialize is called.
-  EXPECT_EQ(data_source_->downloading(), false);
-
-  EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
-  Respond(response_generator_->Generate206(0));
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
-  ReceiveData(kDataSize);
-
-  EXPECT_EQ(data_source_->downloading(), true);
-  EXPECT_CALL(host_, AddBufferedByteRange(kDataSize, kDataSize + 1));
-  ReceiveDataLow(1);
-  EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
-  data_provider()->didFinishLoading(url_loader(), 0, -1);
-
-  EXPECT_CALL(*this, ReadCallback(1));
-  data_source_->Read(kDataSize, 2, buffer_,
-                     base::Bind(&MultibufferDataSourceTest::ReadCallback,
-                                base::Unretained(this)));
-  base::RunLoop().RunUntilIdle();
-
-  // Make sure we're not downloading anymore.
-  EXPECT_EQ(data_source_->downloading(), false);
-  Stop();
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/multibuffer_reader.cc b/src/cobalt/media/blink/multibuffer_reader.cc
deleted file mode 100644
index 8e24fef..0000000
--- a/src/cobalt/media/blink/multibuffer_reader.cc
+++ /dev/null
@@ -1,239 +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 <algorithm>
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "cobalt/media/blink/multibuffer_reader.h"
-#include "net/base/net_errors.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-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),
-      current_buffer_size_(0),
-      pinned_range_(0, 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() {
-  PinRange(0, 0);
-  multibuffer_->RemoveReader(preload_pos_, this);
-  multibuffer_->IncrementMaxSize(-current_buffer_size_);
-  multibuffer_->CleanupWriters(preload_pos_);
-}
-
-void MultiBufferReader::Seek(int64_t pos) {
-  DCHECK_GE(pos, 0);
-  if (pos == pos_) return;
-  PinRange(block(pos - max_buffer_backward_),
-           block_ceil(pos + max_buffer_forward_));
-
-  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 buffer_size) {
-  // Safe, because we know this doesn't actually prune the cache right away.
-  int64_t new_buffer_size = block_ceil(buffer_size);
-  multibuffer_->IncrementMaxSize(new_buffer_size - current_buffer_size_);
-  current_buffer_size_ = new_buffer_size;
-}
-
-void MultiBufferReader::SetPinRange(int64_t backward, int64_t forward) {
-  // Safe, because we know this doesn't actually prune the cache right away.
-  max_buffer_backward_ = backward;
-  max_buffer_forward_ = forward;
-  PinRange(block(pos_ - max_buffer_backward_),
-           block_ceil(pos_ + max_buffer_forward_));
-}
-
-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);
-    if (offset > static_cast<size_t>(i->second->data_size())) break;
-    size_t tocopy =
-        std::min<size_t>(len - bytes_read, i->second->data_size() - offset);
-    SbMemoryCopy(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::ThreadTaskRunnerHandle::Get()->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::UpdateEnd(MultiBufferBlockId p) {
-  auto i = multibuffer_->map().find(p - 1);
-  if (i != multibuffer_->map().end() && 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>(p)
-                               << multibuffer_->block_size_shift();
-    end_ = std::min(end_, size_upper_limit);
-  }
-}
-
-void MultiBufferReader::NotifyAvailableRange(
-    const Interval<MultiBufferBlockId>& range) {
-  // Update end_ if we can.
-  if (range.end > range.begin) {
-    UpdateEnd(range.end);
-  }
-  UpdateInternalState();
-  if (!progress_callback_.is_null()) {
-    base::ThreadTaskRunnerHandle::Get()->PostTask(
-        FROM_HERE,
-        base::Bind(progress_callback_, static_cast<int64_t>(range.begin)
-                                           << multibuffer_->block_size_shift(),
-                   (static_cast<int64_t>(range.end)
-                    << multibuffer_->block_size_shift()) +
-                       multibuffer_->UncommittedBytesAt(range.end)));
-  }
-}
-
-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);
-  }
-
-  // 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_);
-  UpdateEnd(preload_pos_);
-  DCHECK_GE(preload_pos_, 0);
-
-  MultiBuffer::BlockId max_preload = block_ceil(
-      std::min(end_, pos_ + std::max(effective_preload, current_wait_size_)));
-
-  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();
-}
-
-void MultiBufferReader::PinRange(MultiBuffer::BlockId begin,
-                                 MultiBuffer::BlockId end) {
-  // Use a rangemap to compute the diff in pinning.
-  IntervalMap<MultiBuffer::BlockId, int32_t> tmp;
-  tmp.IncrementInterval(pinned_range_.begin, pinned_range_.end, -1);
-  tmp.IncrementInterval(begin, end, 1);
-  multibuffer_->PinRanges(tmp);
-  pinned_range_.begin = begin;
-  pinned_range_.end = end;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/multibuffer_reader.h b/src/cobalt/media/blink/multibuffer_reader.h
deleted file mode 100644
index 2cf72c2..0000000
--- a/src/cobalt/media/blink/multibuffer_reader.h
+++ /dev/null
@@ -1,174 +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 COBALT_MEDIA_BLINK_MULTIBUFFER_READER_H_
-#define COBALT_MEDIA_BLINK_MULTIBUFFER_READER_H_
-
-#include <limits>
-#include <map>
-#include <set>
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/blink/multibuffer.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-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 SetPinRange(int64_t backward, int64_t forward);
-
-  // Set how much memory usage we target. This memory is added to the global
-  // LRU and shared between all multibuffers. We may end up using more memory
-  // if no memory can be freed due to pinning.
-  void SetMaxBuffer(int64_t bytes);
-
-  // 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);
-  }
-
-  // Unpin previous range, then pin the new range.
-  void PinRange(MultiBuffer::BlockId begin, MultiBuffer::BlockId end);
-
-  // 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();
-
-  // Update end_ if p-1 contains an end-of-stream block.
-  void UpdateEnd(MultiBufferBlockId p);
-
-  // 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_;
-
-  // The amount of buffer we've added to the global LRU.
-  int64_t current_buffer_size_;
-
-  // Currently pinned range.
-  Interval<MultiBuffer::BlockId> pinned_range_;
-
-  // 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
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_MULTIBUFFER_READER_H_
diff --git a/src/cobalt/media/blink/multibuffer_unittest.cc b/src/cobalt/media/blink/multibuffer_unittest.cc
deleted file mode 100644
index 20e04b7..0000000
--- a/src/cobalt/media/blink/multibuffer_unittest.cc
+++ /dev/null
@@ -1,565 +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 <algorithm>
-
-#include <deque>
-#include <string>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/message_loop.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "cobalt/media/base/fake_single_thread_task_runner.h"
-#include "cobalt/media/base/test_random.h"
-#include "cobalt/media/blink/multibuffer.h"
-#include "cobalt/media/blink/multibuffer_reader.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-const int kBlockSizeShift = 8;
-const size_t kBlockSize = 1UL << kBlockSizeShift;
-
-namespace cobalt {
-namespace media {
-
-class FakeMultiBufferDataProvider;
-
-namespace {
-std::vector<FakeMultiBufferDataProvider*> writers;
-}  // namespace
-
-class FakeMultiBufferDataProvider : public MultiBuffer::DataProvider {
- public:
-  FakeMultiBufferDataProvider(MultiBufferBlockId pos, size_t file_size,
-                              int max_blocks_after_defer,
-                              bool must_read_whole_file,
-                              MultiBuffer* multibuffer, 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),
-        multibuffer_(multibuffer),
-        rnd_(rnd) {
-    writers.push_back(this);
-  }
-
-  ~FakeMultiBufferDataProvider() 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(); }
-  int64_t AvailableBytes() const override { return 0; }
-
-  scoped_refptr<DataBuffer> Read() override {
-    DCHECK(Available());
-    scoped_refptr<DataBuffer> ret = fifo_.front();
-    fifo_.pop_front();
-    ++pos_;
-    return ret;
-  }
-
-  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<DataBuffer> block = new 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;
-    }
-    multibuffer_->OnDataProviderEvent(this);
-    return ret;
-  }
-
- private:
-  std::deque<scoped_refptr<DataBuffer>> fifo_;
-  MultiBufferBlockId pos_;
-  int32_t blocks_until_deferred_;
-  int32_t max_blocks_after_defer_;
-  size_t file_size_;
-  bool must_read_whole_file_;
-  MultiBuffer* multibuffer_;
-  TestRandom* rnd_;
-};
-
-class TestMultiBuffer : public MultiBuffer {
- public:
-  explicit TestMultiBuffer(int32_t shift,
-                           const scoped_refptr<MultiBuffer::GlobalLRU>& lru,
-                           TestRandom* rnd)
-      : 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 != present_.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:
-  std::unique_ptr<DataProvider> CreateWriter(
-      const MultiBufferBlockId& pos) override {
-    DCHECK(create_ok_);
-    writers_created_++;
-    CHECK_LT(writers.size(), max_writers_);
-    return std::unique_ptr<DataProvider>(new FakeMultiBufferDataProvider(
-        pos, file_size_, max_blocks_after_defer_, must_read_whole_file_, this,
-        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_;
-  TestRandom* rnd_;
-};
-
-class MultiBufferTest : public testing::Test {
- public:
-  MultiBufferTest()
-      : rnd_(42),
-        task_runner_(new FakeSingleThreadTaskRunner(&clock_)),
-        lru_(new MultiBuffer::GlobalLRU(task_runner_)),
-        multibuffer_(kBlockSizeShift, lru_, &rnd_) {}
-
-  void TearDown() override {
-    // Make sure we have nothing left to prune.
-    lru_->Prune(1000000);
-    // Run the outstanding callback to make sure everything is freed.
-    task_runner_->Sleep(base::TimeDelta::FromSeconds(30));
-  }
-
-  void Advance() {
-    CHECK(writers.size());
-    writers[rnd_.Rand() % writers.size()]->Advance();
-  }
-
-  bool AdvanceAll() {
-    bool advanced = false;
-    for (size_t i = 0; i < writers.size(); i++) {
-      advanced |= writers[i]->Advance();
-    }
-    multibuffer_.CheckLRUState();
-    return advanced;
-  }
-
- protected:
-  TestRandom rnd_;
-  base::SimpleTestTickClock clock_;
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  scoped_refptr<MultiBuffer::GlobalLRU> lru_;
-  TestMultiBuffer multibuffer_;
-
-  // TODO(hubbe): Make MultiBufferReader take a task_runner_
-  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);
-  MultiBufferReader reader(&multibuffer_, pos, end,
-                           base::Callback<void(int64_t, int64_t)>());
-  reader.SetPinRange(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);
-  MultiBufferReader reader(&multibuffer_, pos, end,
-                           base::Callback<void(int64_t, int64_t)>());
-  reader.SetPinRange(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);
-  MultiBufferReader reader(&multibuffer_, pos, end,
-                           base::Callback<void(int64_t, int64_t)>());
-  reader.SetPinRange(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);
-  MultiBufferReader reader(&multibuffer_, pos, end,
-                           base::Callback<void(int64_t, int64_t)>());
-  reader.SetPinRange(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);
-  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());
-}
-
-TEST_F(MultiBufferTest, LRUTestExpirationTest) {
-  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);
-  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());
-  EXPECT_FALSE(lru_->Pruneable());
-
-  // Make 3 packets pruneable.
-  lru_->IncrementMaxSize(-3);
-  max_size -= 3;
-
-  // There should be no change after 29 seconds.
-  task_runner_->Sleep(base::TimeDelta::FromSeconds(29));
-  EXPECT_EQ(current_size, lru_->Size());
-  EXPECT_TRUE(lru_->Pruneable());
-
-  // After 30 seconds, pruning should have happened.
-  task_runner_->Sleep(base::TimeDelta::FromSeconds(30));
-  current_size -= 3;
-  EXPECT_EQ(current_size, lru_->Size());
-  EXPECT_FALSE(lru_->Pruneable());
-
-  // Make the rest of the packets pruneable.
-  lru_->IncrementMaxSize(-max_size);
-
-  // After another 30 seconds, everything should be pruned.
-  task_runner_->Sleep(base::TimeDelta::FromSeconds(30));
-  EXPECT_EQ(0, lru_->Size());
-  EXPECT_FALSE(lru_->Pruneable());
-}
-
-class ReadHelper {
- public:
-  ReadHelper(size_t end, size_t max_read_size, MultiBuffer* multibuffer,
-             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_.SetPinRange(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_;
-  TestRandom* rnd_;
-  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 < 100; i++) {
-    for (int j = 0; j < 100; j++) {
-      if (rnd_.Rand() & 1) {
-        if (!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 < 100; i++) {
-    for (int j = 0; j < 100; j++) {
-      if (rnd_.Rand() & 1) {
-        if (!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();
-  }
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/new_session_cdm_result_promise.cc b/src/cobalt/media/blink/new_session_cdm_result_promise.cc
deleted file mode 100644
index 7d30803..0000000
--- a/src/cobalt/media/blink/new_session_cdm_result_promise.cc
+++ /dev/null
@@ -1,71 +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.
-
-#include "cobalt/media/blink/new_session_cdm_result_promise.h"
-
-#include "base/logging.h"
-#include "cobalt/media/blink/cdm_result_promise_helper.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-static blink::WebContentDecryptionModuleResult::SessionStatus ConvertStatus(
-    SessionInitStatus status) {
-  switch (status) {
-    case SessionInitStatus::UNKNOWN_STATUS:
-      break;
-    case SessionInitStatus::NEW_SESSION:
-      return blink::WebContentDecryptionModuleResult::NewSession;
-    case SessionInitStatus::SESSION_NOT_FOUND:
-      return blink::WebContentDecryptionModuleResult::SessionNotFound;
-    case SessionInitStatus::SESSION_ALREADY_EXISTS:
-      return blink::WebContentDecryptionModuleResult::SessionAlreadyExists;
-  }
-  NOTREACHED();
-  return blink::WebContentDecryptionModuleResult::SessionNotFound;
-}
-
-NewSessionCdmResultPromise::NewSessionCdmResultPromise(
-    const blink::WebContentDecryptionModuleResult& result,
-    const std::string& uma_name,
-    const SessionInitializedCB& new_session_created_cb)
-    : web_cdm_result_(result),
-      uma_name_(uma_name),
-      new_session_created_cb_(new_session_created_cb) {}
-
-NewSessionCdmResultPromise::~NewSessionCdmResultPromise() {
-  if (!IsPromiseSettled()) RejectPromiseOnDestruction();
-}
-
-void NewSessionCdmResultPromise::resolve(const std::string& session_id) {
-  // |new_session_created_cb_| uses a WeakPtr<> and may not do anything
-  // if the session object has been destroyed.
-  SessionInitStatus status = SessionInitStatus::UNKNOWN_STATUS;
-  new_session_created_cb_.Run(session_id, &status);
-
-  if (status == SessionInitStatus::UNKNOWN_STATUS) {
-    reject(MediaKeys::INVALID_STATE_ERROR, 0,
-           "Cannot finish session initialization");
-    return;
-  }
-
-  MarkPromiseSettled();
-  ReportCdmResultUMA(uma_name_, SUCCESS);
-  web_cdm_result_.completeWithSession(ConvertStatus(status));
-}
-
-void NewSessionCdmResultPromise::reject(MediaKeys::Exception exception_code,
-                                        uint32_t system_code,
-                                        const std::string& error_message) {
-  MarkPromiseSettled();
-  ReportCdmResultUMA(uma_name_,
-                     ConvertCdmExceptionToResultForUMA(exception_code));
-  web_cdm_result_.completeWithError(ConvertCdmException(exception_code),
-                                    system_code,
-                                    blink::WebString::fromUTF8(error_message));
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/new_session_cdm_result_promise.h b/src/cobalt/media/blink/new_session_cdm_result_promise.h
deleted file mode 100644
index 585ac55..0000000
--- a/src/cobalt/media/blink/new_session_cdm_result_promise.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_
-#define COBALT_MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "cobalt/media/base/cdm_promise.h"
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-
-namespace cobalt {
-namespace media {
-
-enum class SessionInitStatus {
-  // Error creating the session.
-  UNKNOWN_STATUS,
-
-  // New session has been initialized.
-  NEW_SESSION,
-
-  // CDM could not find the requested session.
-  SESSION_NOT_FOUND,
-
-  // CDM already has a non-closed session that matches the provided
-  // parameters.
-  SESSION_ALREADY_EXISTS
-};
-
-typedef base::Callback<void(const std::string& session_id,
-                            SessionInitStatus* status)> SessionInitializedCB;
-
-// Special class for resolving a new session promise. Resolving a new session
-// promise returns the session ID (as a string), but the blink promise needs
-// to get passed a SessionStatus. This class converts the session id to a
-// SessionStatus by calling |new_session_created_cb|.
-class MEDIA_BLINK_EXPORT NewSessionCdmResultPromise
-    : public CdmPromiseTemplate<std::string> {
- public:
-  NewSessionCdmResultPromise(
-      const blink::WebContentDecryptionModuleResult& result,
-      const std::string& uma_name,
-      const SessionInitializedCB& new_session_created_cb);
-  ~NewSessionCdmResultPromise() OVERRIDE;
-
-  // CdmPromiseTemplate<T> implementation.
-  void resolve(const std::string& session_id) OVERRIDE;
-  void reject(MediaKeys::Exception exception_code, uint32_t system_code,
-              const std::string& error_message) OVERRIDE;
-
- private:
-  blink::WebContentDecryptionModuleResult web_cdm_result_;
-
-  // UMA name to report result to.
-  std::string uma_name_;
-
-  // Called on resolve() to convert the session ID into a SessionInitStatus to
-  // be reported to blink.
-  SessionInitializedCB new_session_created_cb_;
-
-  DISALLOW_COPY_AND_ASSIGN(NewSessionCdmResultPromise);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_NEW_SESSION_CDM_RESULT_PROMISE_H_
diff --git a/src/cobalt/media/blink/renderer_media_player_interface.h b/src/cobalt/media/blink/renderer_media_player_interface.h
deleted file mode 100644
index 450097b..0000000
--- a/src/cobalt/media/blink/renderer_media_player_interface.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
-#define COBALT_MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
-
-// This file contains interfaces modeled after classes in
-// content/renderer/media/android for the purposes of letting clases in
-// this directory implement and/or interact with those classes.
-// It's a stop-gap used to support cast on android until a better solution
-// is implemented: crbug/575276
-
-#include <string>
-
-#include "base/time.h"
-#include "cobalt/media/blink/webmediaplayer_delegate.h"
-#include "googleurl/src/gurl.h"
-#include "ui/gfx/geometry/rect_f.h"
-
-// Dictates which type of media playback is being initialized.
-enum MediaPlayerHostMsg_Initialize_Type {
-  MEDIA_PLAYER_TYPE_URL,
-  MEDIA_PLAYER_TYPE_REMOTE_ONLY,
-  MEDIA_PLAYER_TYPE_LAST = MEDIA_PLAYER_TYPE_REMOTE_ONLY
-};
-
-namespace cobalt {
-namespace media {
-
-class RendererMediaPlayerInterface {
- public:
-  virtual void OnMediaMetadataChanged(base::TimeDelta duration, int width,
-                                      int height, bool success) = 0;
-  virtual void OnPlaybackComplete() = 0;
-  virtual void OnBufferingUpdate(int percentage) = 0;
-  virtual void OnSeekRequest(const base::TimeDelta& time_to_seek) = 0;
-  virtual void OnSeekComplete(const base::TimeDelta& current_time) = 0;
-  virtual void OnMediaError(int error_type) = 0;
-  virtual void OnVideoSizeChanged(int width, int height) = 0;
-
-  // Called to update the current time.
-  virtual void OnTimeUpdate(base::TimeDelta current_timestamp,
-                            base::TimeTicks current_time_ticks) = 0;
-
-  virtual void OnPlayerReleased() = 0;
-
-  // Functions called when media player status changes.
-  virtual void OnConnectedToRemoteDevice(
-      const std::string& remote_playback_message) = 0;
-  virtual void OnDisconnectedFromRemoteDevice() = 0;
-  virtual void OnCancelledRemotePlaybackRequest() = 0;
-  virtual void OnDidExitFullscreen() = 0;
-  virtual void OnMediaPlayerPlay() = 0;
-  virtual void OnMediaPlayerPause() = 0;
-  virtual void OnRemoteRouteAvailabilityChanged(bool routes_available) = 0;
-
-  // Getters of playback state.
-  virtual bool paused() const = 0;
-
-  // True if the loaded media has a playable video track.
-  virtual bool hasVideo() const = 0;
-
-  // This function is called by the RendererMediaPlayerManager to pause the
-  // video and release the media player and surface texture when we switch tabs.
-  // However, the actual GlTexture is not released to keep the video screenshot.
-  virtual void SuspendAndReleaseResources() = 0;
-};
-
-class RendererMediaPlayerManagerInterface {
- public:
-  // Initializes a MediaPlayerAndroid object in browser process.
-  virtual void Initialize(MediaPlayerHostMsg_Initialize_Type type,
-                          int player_id, const GURL& url,
-                          const GURL& first_party_for_cookies,
-                          const GURL& frame_url, bool allow_credentials,
-                          int delegate_id) = 0;
-
-  // Starts the player.
-  virtual void Start(int player_id) = 0;
-
-  // Pauses the player.
-  // is_media_related_action should be true if this pause is coming from an
-  // an action that explicitly pauses the video (user pressing pause, JS, etc.)
-  // Otherwise it should be false if Pause is being called due to other reasons
-  // (cleanup, freeing resources, etc.)
-  virtual void Pause(int player_id, bool is_media_related_action) = 0;
-
-  // Performs seek on the player.
-  virtual void Seek(int player_id, const base::TimeDelta& time) = 0;
-
-  // Sets the player volume.
-  virtual void SetVolume(int player_id, double volume) = 0;
-
-  // Sets the poster image.
-  virtual void SetPoster(int player_id, const GURL& poster) = 0;
-
-  // Releases resources for the player after being suspended.
-  virtual void SuspendAndReleaseResources(int player_id) = 0;
-
-  // Destroys the player in the browser process
-  virtual void DestroyPlayer(int player_id) = 0;
-
-  // Requests remote playback if possible
-  virtual void RequestRemotePlayback(int player_id) = 0;
-
-  // Requests control of remote playback
-  virtual void RequestRemotePlaybackControl(int player_id) = 0;
-
-  // Registers and unregisters a RendererMediaPlayerInterface object.
-  virtual int RegisterMediaPlayer(RendererMediaPlayerInterface* player) = 0;
-  virtual void UnregisterMediaPlayer(int player_id) = 0;
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
diff --git a/src/cobalt/media/blink/resource_multibuffer_data_provider.cc b/src/cobalt/media/blink/resource_multibuffer_data_provider.cc
deleted file mode 100644
index 1d87fb1..0000000
--- a/src/cobalt/media/blink/resource_multibuffer_data_provider.cc
+++ /dev/null
@@ -1,544 +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 "cobalt/media/blink/resource_multibuffer_data_provider.h"
-
-#include <algorithm>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bits.h"
-#include "base/callback_helpers.h"
-#include "base/location.h"
-#include "base/metrics/histogram.h"
-#include "base/single_thread_task_runner.h"
-#include "base/string_number_conversions.h"
-#include "base/string_util.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "cobalt/media/blink/active_loader.h"
-#include "cobalt/media/blink/cache_util.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/blink/url_index.h"
-#include "net/http/http_byte_range.h"
-#include "net/http/http_request_headers.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebURLError.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-
-using blink::WebFrame;
-using blink::WebString;
-using blink::WebURLError;
-using blink::WebURLLoader;
-using blink::WebURLLoaderOptions;
-using blink::WebURLRequest;
-using blink::WebURLResponse;
-
-namespace cobalt {
-namespace media {
-
-// The number of milliseconds to wait before retrying a failed load.
-const int kLoaderFailedRetryDelayMs = 250;
-
-// Each retry, add this many MS to the delay.
-// total delay is:
-// (kLoaderPartialRetryDelayMs +
-//  kAdditionalDelayPerRetryMs * (kMaxRetries - 1) / 2) * kMaxretries = 29250 ms
-const int kAdditionalDelayPerRetryMs = 50;
-
-// The number of milliseconds to wait before retrying when the server
-// decides to not give us all the data at once.
-const int kLoaderPartialRetryDelayMs = 25;
-
-const int kHttpOK = 200;
-const int kHttpPartialContent = 206;
-const int kHttpRangeNotSatisfiable = 416;
-
-ResourceMultiBufferDataProvider::ResourceMultiBufferDataProvider(
-    UrlData* url_data, MultiBufferBlockId pos)
-    : pos_(pos),
-      url_data_(url_data),
-      retries_(0),
-      cors_mode_(url_data->cors_mode()),
-      origin_(url_data->url().GetOrigin()),
-      weak_factory_(this) {
-  DCHECK(url_data_) << " pos = " << pos;
-  DCHECK_GE(pos, 0);
-}
-
-void ResourceMultiBufferDataProvider::Start() {
-  // Prepare the request.
-  WebURLRequest request(url_data_->url());
-  // TODO(mkwst): Split this into video/audio.
-  request.setRequestContext(WebURLRequest::RequestContextVideo);
-
-  DVLOG(1) << __func__ << " @ " << byte_pos();
-  if (url_data_->length() > 0 && byte_pos() >= url_data_->length()) {
-    base::ThreadTaskRunnerHandle::Get()->PostTask(
-        FROM_HERE, base::Bind(&ResourceMultiBufferDataProvider::Terminate,
-                              weak_factory_.GetWeakPtr()));
-    return;
-  }
-
-  request.setHTTPHeaderField(
-      WebString::fromUTF8(net::HttpRequestHeaders::kRange),
-      WebString::fromUTF8(
-          net::HttpByteRange::RightUnbounded(byte_pos()).GetHeaderValue()));
-
-  if (!url_data_->etag().empty()) {
-    request.setHTTPHeaderField(WebString::fromUTF8("If-Match"),
-                               WebString::fromUTF8(url_data_->etag()));
-  }
-
-  url_data_->frame()->setReferrerForRequest(request, blink::WebURL());
-
-  // Disable compression, compression for audio/video doesn't make sense...
-  request.setHTTPHeaderField(
-      WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding),
-      WebString::fromUTF8("identity;q=1, *;q=0"));
-
-  // Check for our test WebURLLoader.
-  std::unique_ptr<WebURLLoader> loader;
-  if (test_loader_) {
-    loader = std::move(test_loader_);
-  } else {
-    WebURLLoaderOptions options;
-    if (url_data_->cors_mode() == UrlData::CORS_UNSPECIFIED) {
-      options.allowCredentials = true;
-      options.crossOriginRequestPolicy =
-          WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
-    } else {
-      options.exposeAllResponseHeaders = true;
-      // The author header set is empty, no preflight should go ahead.
-      options.preflightPolicy = WebURLLoaderOptions::PreventPreflight;
-      options.crossOriginRequestPolicy =
-          WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
-      if (url_data_->cors_mode() == UrlData::CORS_USE_CREDENTIALS)
-        options.allowCredentials = true;
-    }
-    loader.reset(url_data_->frame()->createAssociatedURLLoader(options));
-  }
-
-  // Start the resource loading.
-  loader->loadAsynchronously(request, this);
-  active_loader_.reset(new ActiveLoader(std::move(loader)));
-}
-
-ResourceMultiBufferDataProvider::~ResourceMultiBufferDataProvider() {}
-
-/////////////////////////////////////////////////////////////////////////////
-// MultiBuffer::DataProvider implementation.
-MultiBufferBlockId ResourceMultiBufferDataProvider::Tell() const {
-  return pos_;
-}
-
-bool ResourceMultiBufferDataProvider::Available() const {
-  if (fifo_.empty()) return false;
-  if (fifo_.back()->end_of_stream()) return true;
-  if (fifo_.front()->data_size() == block_size()) return true;
-  return false;
-}
-
-int64_t ResourceMultiBufferDataProvider::AvailableBytes() const {
-  int64_t bytes = 0;
-  for (const auto i : fifo_) {
-    if (i->end_of_stream()) break;
-    bytes += i->data_size();
-  }
-  return bytes;
-}
-
-scoped_refptr<DataBuffer> ResourceMultiBufferDataProvider::Read() {
-  DCHECK(Available());
-  scoped_refptr<DataBuffer> ret = fifo_.front();
-  fifo_.pop_front();
-  ++pos_;
-  return ret;
-}
-
-void ResourceMultiBufferDataProvider::SetDeferred(bool deferred) {
-  if (!active_loader_ || active_loader_->deferred() == deferred) return;
-  active_loader_->SetDeferred(deferred);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// WebURLLoaderClient implementation.
-
-bool ResourceMultiBufferDataProvider::willFollowRedirect(
-    WebURLLoader* loader, WebURLRequest& newRequest,
-    const WebURLResponse& redirectResponse) {
-  redirects_to_ = newRequest.url();
-  url_data_->set_valid_until(base::Time::Now() +
-                             GetCacheValidUntil(redirectResponse));
-
-  // This test is vital for security!
-  if (cors_mode_ == UrlData::CORS_UNSPECIFIED) {
-    // We allow the redirect if the origin is the same.
-    if (origin_ != redirects_to_.GetOrigin()) {
-      // We also allow the redirect if we don't have any data in the
-      // cache, as that means that no dangerous data mixing can occur.
-      if (url_data_->multibuffer()->map().empty() && fifo_.empty()) return true;
-
-      active_loader_ = NULL;
-      url_data_->Fail();
-      return false;  // "this" may be deleted now.
-    }
-  }
-  return true;
-}
-
-void ResourceMultiBufferDataProvider::didSendData(
-    WebURLLoader* loader, uint64 bytes_sent, uint64 total_bytes_to_be_sent) {
-  NOTIMPLEMENTED();
-}
-
-void ResourceMultiBufferDataProvider::didReceiveResponse(
-    WebURLLoader* loader, const WebURLResponse& response) {
-#if ENABLE_DLOG
-  string version;
-  switch (response.httpVersion()) {
-    case WebURLResponse::HTTPVersion_0_9:
-      version = "0.9";
-      break;
-    case WebURLResponse::HTTPVersion_1_0:
-      version = "1.0";
-      break;
-    case WebURLResponse::HTTPVersion_1_1:
-      version = "1.1";
-      break;
-    case WebURLResponse::HTTPVersion_2_0:
-      version = "2.1";
-      break;
-  }
-  DVLOG(1) << "didReceiveResponse: HTTP/" << version << " "
-           << response.httpStatusCode();
-#endif
-  DCHECK(active_loader_);
-
-  scoped_refptr<UrlData> destination_url_data(url_data_);
-
-  UrlIndex* url_index = url_data_->url_index();
-
-  if (!redirects_to_.is_empty()) {
-    if (!url_index) {
-      // We've been disconnected from the url index.
-      // That means the url_index_ has been destroyed, which means we do not
-      // need to do anything clever.
-      return;
-    }
-    destination_url_data = url_index->GetByUrl(redirects_to_, cors_mode_);
-    redirects_to_ = GURL();
-  }
-
-  base::Time last_modified;
-  if (base::Time::FromString(
-          response.httpHeaderField("Last-Modified").utf8().data(),
-          &last_modified)) {
-    destination_url_data->set_last_modified(last_modified);
-  }
-
-  destination_url_data->set_etag(
-      response.httpHeaderField("ETag").utf8().data());
-
-  destination_url_data->set_valid_until(base::Time::Now() +
-                                        GetCacheValidUntil(response));
-
-  uint32_t reasons = GetReasonsForUncacheability(response);
-  destination_url_data->set_cacheable(reasons == 0);
-  UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0);
-  int shift = 0;
-  int max_enum = base::bits::Log2Ceiling(kMaxReason);
-  while (reasons) {
-    DCHECK_LT(shift, max_enum);  // Sanity check.
-    if (reasons & 0x1) {
-      UMA_HISTOGRAM_ENUMERATION("Media.UncacheableReason", shift,
-                                max_enum);  // PRESUBMIT_IGNORE_UMA_MAX
-    }
-
-    reasons >>= 1;
-    ++shift;
-  }
-
-  // Expected content length can be |kPositionNotSpecified|, in that case
-  // |content_length_| is not specified and this is a streaming response.
-  int64_t content_length = response.expectedContentLength();
-  bool end_of_file = false;
-
-  // We make a strong assumption that when we reach here we have either
-  // received a response from HTTP/HTTPS protocol or the request was
-  // successful (in particular range request). So we only verify the partial
-  // response for HTTP and HTTPS protocol.
-  if (destination_url_data->url().SchemeIsHTTPOrHTTPS()) {
-    bool partial_response = (response.httpStatusCode() == kHttpPartialContent);
-    bool ok_response = (response.httpStatusCode() == kHttpOK);
-
-    // Check to see whether the server supports byte ranges.
-    std::string accept_ranges =
-        response.httpHeaderField("Accept-Ranges").utf8();
-    if (accept_ranges.find("bytes") != std::string::npos)
-      destination_url_data->set_range_supported();
-
-    // If we have verified the partial response and it is correct.
-    // It's also possible for a server to support range requests
-    // without advertising "Accept-Ranges: bytes".
-    if (partial_response &&
-        VerifyPartialResponse(response, destination_url_data)) {
-      destination_url_data->set_range_supported();
-    } else if (ok_response && pos_ == 0) {
-      // We accept a 200 response for a Range:0- request, trusting the
-      // Accept-Ranges header, because Apache thinks that's a reasonable thing
-      // to return.
-      destination_url_data->set_length(content_length);
-    } else if (response.httpStatusCode() == kHttpRangeNotSatisfiable) {
-      // Unsatisfiable range
-      // Really, we should never request a range that doesn't exist, but
-      // if we do, let's handle it in a sane way.
-      // Note, we can't just call OnDataProviderEvent() here, because
-      // url_data_ hasn't been updated to the final destination yet.
-      end_of_file = true;
-    } else {
-      active_loader_ = NULL;
-      destination_url_data->Fail();
-      return;  // "this" may be deleted now.
-    }
-  } else {
-    destination_url_data->set_range_supported();
-    if (content_length != kPositionNotSpecified) {
-      destination_url_data->set_length(content_length + byte_pos());
-    }
-  }
-
-  if (url_index) {
-    destination_url_data = url_index->TryInsert(destination_url_data);
-  }
-
-  if (destination_url_data != url_data_) {
-    // At this point, we've encountered a redirect, or found a better url data
-    // instance for the data that we're about to download.
-
-    // First, let's take a ref on the current url data.
-    scoped_refptr<UrlData> old_url_data(url_data_);
-    destination_url_data->Use();
-
-    // Take ownership of ourselves. (From the multibuffer)
-    std::unique_ptr<DataProvider> self(
-        url_data_->multibuffer()->RemoveProvider(this));
-    url_data_ = destination_url_data.get();
-    // Give the ownership to our new owner.
-    url_data_->multibuffer()->AddProvider(std::move(self));
-
-    // Call callback to let upstream users know about the transfer.
-    // This will merge the data from the two multibuffers and
-    // cause clients to start using the new UrlData.
-    old_url_data->RedirectTo(destination_url_data);
-  }
-
-  // This test is vital for security!
-  const GURL& original_url = response.wasFetchedViaServiceWorker()
-                                 ? response.originalURLViaServiceWorker()
-                                 : response.url();
-  if (!url_data_->ValidateDataOrigin(original_url.GetOrigin())) {
-    active_loader_ = NULL;
-    url_data_->Fail();
-    return;  // "this" may be deleted now.
-  }
-
-  if (end_of_file) {
-    fifo_.push_back(DataBuffer::CreateEOSBuffer());
-    url_data_->multibuffer()->OnDataProviderEvent(this);
-  }
-}
-
-void ResourceMultiBufferDataProvider::didReceiveData(WebURLLoader* loader,
-                                                     const char* data,
-                                                     int data_length,
-                                                     int encoded_data_length,
-                                                     int encoded_body_length) {
-  DVLOG(1) << "didReceiveData: " << data_length << " bytes";
-  DCHECK(!Available());
-  DCHECK(active_loader_);
-  DCHECK_GT(data_length, 0);
-
-  // When we receive data, we allow more retries.
-  retries_ = 0;
-
-  while (data_length) {
-    if (fifo_.empty() || fifo_.back()->data_size() == block_size()) {
-      fifo_.push_back(new DataBuffer(block_size()));
-      fifo_.back()->set_data_size(0);
-    }
-    int last_block_size = fifo_.back()->data_size();
-    int to_append = std::min<int>(data_length, block_size() - last_block_size);
-    DCHECK_GT(to_append, 0);
-    SbMemoryCopy(fifo_.back()->writable_data() + last_block_size, data,
-                 to_append);
-    data += to_append;
-    fifo_.back()->set_data_size(last_block_size + to_append);
-    data_length -= to_append;
-  }
-
-  url_data_->multibuffer()->OnDataProviderEvent(this);
-
-  // Beware, this object might be deleted here.
-}
-
-void ResourceMultiBufferDataProvider::didDownloadData(WebURLLoader* loader,
-                                                      int dataLength,
-                                                      int encoded_data_length) {
-  NOTIMPLEMENTED();
-}
-
-void ResourceMultiBufferDataProvider::didReceiveCachedMetadata(
-    WebURLLoader* loader, const char* data, int data_length) {
-  NOTIMPLEMENTED();
-}
-
-void ResourceMultiBufferDataProvider::didFinishLoading(
-    WebURLLoader* loader, double finishTime,
-    int64_t total_encoded_data_length) {
-  DVLOG(1) << "didFinishLoading";
-  DCHECK(active_loader_.get());
-  DCHECK(!Available());
-
-  // We're done with the loader.
-  active_loader_.reset();
-
-  // If we didn't know the |instance_size_| we do now.
-  int64_t size = byte_pos();
-
-  // This request reports something smaller than what we've seen in the past,
-  // Maybe it's transient error?
-  if (url_data_->length() != kPositionNotSpecified &&
-      size < url_data_->length()) {
-    if (retries_ < kMaxRetries) {
-      DVLOG(1) << " Partial data received.... @ pos = " << size;
-      retries_++;
-      base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
-          FROM_HERE, base::Bind(&ResourceMultiBufferDataProvider::Start,
-                                weak_factory_.GetWeakPtr()),
-          base::TimeDelta::FromMilliseconds(kLoaderPartialRetryDelayMs));
-      return;
-    } else {
-      active_loader_ = NULL;
-      url_data_->Fail();
-      return;  // "this" may be deleted now.
-    }
-  }
-
-  url_data_->set_length(size);
-  fifo_.push_back(DataBuffer::CreateEOSBuffer());
-
-  DCHECK(Available());
-  url_data_->multibuffer()->OnDataProviderEvent(this);
-
-  // Beware, this object might be deleted here.
-}
-
-void ResourceMultiBufferDataProvider::didFail(WebURLLoader* loader,
-                                              const WebURLError& error) {
-  DVLOG(1) << "didFail: reason=" << error.reason
-           << ", isCancellation=" << error.isCancellation
-           << ", domain=" << error.domain.utf8().data()
-           << ", localizedDescription="
-           << error.localizedDescription.utf8().data();
-  DCHECK(active_loader_.get());
-
-  if (retries_ < kMaxRetries && pos_ != 0) {
-    retries_++;
-    base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
-        FROM_HERE, base::Bind(&ResourceMultiBufferDataProvider::Start,
-                              weak_factory_.GetWeakPtr()),
-        base::TimeDelta::FromMilliseconds(
-            kLoaderFailedRetryDelayMs + kAdditionalDelayPerRetryMs * retries_));
-  } else {
-    // We don't need to continue loading after failure.
-    // Note that calling Fail() will most likely delete this object.
-    url_data_->Fail();
-  }
-}
-
-bool ResourceMultiBufferDataProvider::ParseContentRange(
-    const std::string& content_range_str, int64_t* first_byte_position,
-    int64_t* last_byte_position, int64_t* instance_size) {
-  const char kUpThroughBytesUnit[] = "bytes ";
-  if (!base::StartsWith(content_range_str, kUpThroughBytesUnit,
-                        base::CompareCase::SENSITIVE)) {
-    return false;
-  }
-  std::string range_spec =
-      content_range_str.substr(sizeof(kUpThroughBytesUnit) - 1);
-  size_t dash_offset = range_spec.find("-");
-  size_t slash_offset = range_spec.find("/");
-
-  if (dash_offset == std::string::npos || slash_offset == std::string::npos ||
-      slash_offset < dash_offset || slash_offset + 1 == range_spec.length()) {
-    return false;
-  }
-  if (!base::StringToInt64(range_spec.substr(0, dash_offset),
-                           first_byte_position) ||
-      !base::StringToInt64(
-          range_spec.substr(dash_offset + 1, slash_offset - dash_offset - 1),
-          last_byte_position)) {
-    return false;
-  }
-  if (slash_offset == range_spec.length() - 2 &&
-      range_spec[slash_offset + 1] == '*') {
-    *instance_size = kPositionNotSpecified;
-  } else {
-    if (!base::StringToInt64(range_spec.substr(slash_offset + 1),
-                             instance_size)) {
-      return false;
-    }
-  }
-  if (*last_byte_position < *first_byte_position ||
-      (*instance_size != kPositionNotSpecified &&
-       *last_byte_position >= *instance_size)) {
-    return false;
-  }
-
-  return true;
-}
-
-void ResourceMultiBufferDataProvider::Terminate() {
-  fifo_.push_back(DataBuffer::CreateEOSBuffer());
-  url_data_->multibuffer()->OnDataProviderEvent(this);
-}
-
-int64_t ResourceMultiBufferDataProvider::byte_pos() const {
-  int64_t ret = pos_;
-  ret += fifo_.size();
-  ret = ret << url_data_->multibuffer()->block_size_shift();
-  if (!fifo_.empty()) {
-    ret += fifo_.back()->data_size() - block_size();
-  }
-  return ret;
-}
-
-int64_t ResourceMultiBufferDataProvider::block_size() const {
-  int64_t ret = 1;
-  return ret << url_data_->multibuffer()->block_size_shift();
-}
-
-bool ResourceMultiBufferDataProvider::VerifyPartialResponse(
-    const WebURLResponse& response, const scoped_refptr<UrlData>& url_data) {
-  int64_t first_byte_position, last_byte_position, instance_size;
-  if (!ParseContentRange(response.httpHeaderField("Content-Range").utf8(),
-                         &first_byte_position, &last_byte_position,
-                         &instance_size)) {
-    return false;
-  }
-
-  if (url_data_->length() == kPositionNotSpecified) {
-    url_data->set_length(instance_size);
-  }
-
-  if (byte_pos() != first_byte_position) {
-    return false;
-  }
-
-  return true;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/resource_multibuffer_data_provider.h b/src/cobalt/media/blink/resource_multibuffer_data_provider.h
deleted file mode 100644
index ed9c8c5..0000000
--- a/src/cobalt/media/blink/resource_multibuffer_data_provider.h
+++ /dev/null
@@ -1,132 +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 COBALT_MEDIA_BLINK_RESOURCE_MULTIBUFFER_DATA_PROVIDER_H_
-#define COBALT_MEDIA_BLINK_RESOURCE_MULTIBUFFER_DATA_PROVIDER_H_
-
-#include <list>
-#include <memory>
-#include <string>
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "cobalt/media/blink/active_loader.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/blink/multibuffer.h"
-#include "cobalt/media/blink/url_index.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebURLLoader.h"
-#include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
-#include "third_party/WebKit/public/platform/WebURLRequest.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-
-namespace cobalt {
-namespace media {
-
-class MEDIA_BLINK_EXPORT ResourceMultiBufferDataProvider
-    : NON_EXPORTED_BASE(public MultiBuffer::DataProvider),
-      NON_EXPORTED_BASE(public blink::WebURLLoaderClient) {
- public:
-  // NUmber of times we'll retry if the connection fails.
-  enum { kMaxRetries = 30 };
-
-  ResourceMultiBufferDataProvider(UrlData* url_data, MultiBufferBlockId pos);
-  ~ResourceMultiBufferDataProvider() OVERRIDE;
-
-  // Virtual for testing purposes.
-  virtual void Start();
-
-  // MultiBuffer::DataProvider implementation
-  MultiBufferBlockId Tell() const OVERRIDE;
-  bool Available() const OVERRIDE;
-  int64_t AvailableBytes() const OVERRIDE;
-  scoped_refptr<DataBuffer> Read() OVERRIDE;
-  void SetDeferred(bool defer) OVERRIDE;
-
-  // blink::WebURLLoaderClient implementation.
-  bool willFollowRedirect(
-      blink::WebURLLoader* loader, blink::WebURLRequest& newRequest,
-      const blink::WebURLResponse& redirectResponse) OVERRIDE;
-  void didSendData(blink::WebURLLoader* loader, uint64 bytesSent,
-                   uint64 totalBytesToBeSent) OVERRIDE;
-  void didReceiveResponse(blink::WebURLLoader* loader,
-                          const blink::WebURLResponse& response) OVERRIDE;
-  void didDownloadData(blink::WebURLLoader* loader, int data_length,
-                       int encoded_data_length) OVERRIDE;
-  void didReceiveData(blink::WebURLLoader* loader, const char* data,
-                      int data_length, int encoded_data_length,
-                      int encoded_body_length) OVERRIDE;
-  void didReceiveCachedMetadata(blink::WebURLLoader* loader, const char* data,
-                                int dataLength) OVERRIDE;
-  void didFinishLoading(blink::WebURLLoader* loader, double finishTime,
-                        int64_t total_encoded_data_length) OVERRIDE;
-  void didFail(blink::WebURLLoader* loader, const blink::WebURLError&) OVERRIDE;
-
-  // Use protected instead of private for testing purposes.
- protected:
-  friend class MultibufferDataSourceTest;
-  friend class ResourceMultiBufferDataProviderTest;
-  friend class MockBufferedDataSource;
-
-  // Callback used when we're asked to fetch data after the end of the file.
-  void Terminate();
-
-  // Parse a Content-Range header into its component pieces and return true if
-  // each of the expected elements was found & parsed correctly.
-  // |*instance_size| may be set to kPositionNotSpecified if the range ends in
-  // "/*".
-  // NOTE: only public for testing!  This is an implementation detail of
-  // VerifyPartialResponse (a private method).
-  static bool ParseContentRange(const std::string& content_range_str,
-                                int64_t* first_byte_position,
-                                int64_t* last_byte_position,
-                                int64_t* instance_size);
-
-  int64_t byte_pos() const;
-  int64_t block_size() const;
-
-  // If we have made a range request, verify the response from the server.
-  bool VerifyPartialResponse(const blink::WebURLResponse& response,
-                             const scoped_refptr<UrlData>& url_data);
-
-  // Current Position.
-  MultiBufferBlockId pos_;
-
-  // This is where we actually get read data from.
-  // We don't need (or want) a scoped_refptr for this one, because
-  // we are owned by it. Note that we may change this when we encounter
-  // a redirect because we actually change ownership.
-  UrlData* url_data_;
-
-  // Temporary storage for incoming data.
-  std::list<scoped_refptr<DataBuffer>> fifo_;
-
-  // How many retries have we done at the current position.
-  int retries_;
-
-  // Copy of url_data_->cors_mode()
-  // const to make it obvious that redirects cannot change it.
-  const UrlData::CORSMode cors_mode_;
-
-  // The origin for the initial request.
-  // const to make it obvious that redirects cannot change it.
-  const GURL origin_;
-
-  // Keeps track of an active WebURLLoader and associated state.
-  std::unique_ptr<ActiveLoader> active_loader_;
-
-  // Injected WebURLLoader instance for testing purposes.
-  std::unique_ptr<blink::WebURLLoader> test_loader_;
-
-  // When we encounter a redirect, this is the source of the redirect.
-  GURL redirects_to_;
-
-  base::WeakPtrFactory<ResourceMultiBufferDataProvider> weak_factory_;
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_RESOURCE_MULTIBUFFER_DATA_PROVIDER_H_
diff --git a/src/cobalt/media/blink/resource_multibuffer_data_provider_unittest.cc b/src/cobalt/media/blink/resource_multibuffer_data_provider_unittest.cc
deleted file mode 100644
index f7d7473..0000000
--- a/src/cobalt/media/blink/resource_multibuffer_data_provider_unittest.cc
+++ /dev/null
@@ -1,336 +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 "cobalt/media/blink/resource_multibuffer_data_provider.h"
-
-#include <algorithm>
-#include <string>
-#include <utility>
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/format_macros.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "base/stringprintf.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/base/seekable_buffer.h"
-#include "cobalt/media/blink/mock_weburlloader.h"
-#include "cobalt/media/blink/url_index.h"
-#include "net/base/net_errors.h"
-#include "net/http/http_request_headers.h"
-#include "net/http/http_util.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURLError.h"
-#include "third_party/WebKit/public/platform/WebURLRequest.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-#include "third_party/WebKit/public/web/WebFrameClient.h"
-#include "third_party/WebKit/public/web/WebLocalFrame.h"
-#include "third_party/WebKit/public/web/WebView.h"
-
-using ::testing::_;
-using ::testing::InSequence;
-using ::testing::Return;
-using ::testing::Truly;
-using ::testing::NiceMock;
-
-using blink::WebLocalFrame;
-using blink::WebString;
-using blink::WebURLError;
-using blink::WebURLResponse;
-using blink::WebView;
-
-namespace cobalt {
-namespace media {
-
-const char kHttpUrl[] = "http://test";
-const char kHttpRedirect[] = "http://test/ing";
-const char kEtag[] = "\"arglebargle glopy-glyf?\"";
-
-const int kDataSize = 1024;
-const int kHttpOK = 200;
-const int kHttpPartialContent = 206;
-
-enum NetworkState { NONE, LOADED, LOADING };
-
-// Predicate that tests that request disallows compressed data.
-static bool CorrectAcceptEncodingAndEtag(const blink::WebURLRequest& request) {
-  std::string etag =
-      request.httpHeaderField(WebString::fromUTF8("If-Match")).utf8();
-  EXPECT_EQ(etag, kEtag);
-
-  std::string value =
-      request.httpHeaderField(
-                 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding))
-          .utf8();
-  return (value.find("identity;q=1") != std::string::npos) &&
-         (value.find("*;q=0") != std::string::npos);
-}
-
-class ResourceMultiBufferDataProviderTest : public testing::Test {
- public:
-  ResourceMultiBufferDataProviderTest()
-      : view_(WebView::create(NULL, blink::WebPageVisibilityStateVisible)) {
-    WebLocalFrame* frame =
-        WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_);
-    view_->setMainFrame(frame);
-    url_index_.reset(new UrlIndex(frame, 0));
-
-    for (int i = 0; i < kDataSize; ++i) {
-      data_[i] = i;
-    }
-  }
-
-  virtual ~ResourceMultiBufferDataProviderTest() { view_->close(); }
-
-  void Initialize(const char* url, int first_position) {
-    gurl_ = GURL(url);
-    url_data_ = url_index_->GetByUrl(gurl_, UrlData::CORS_UNSPECIFIED);
-    url_data_->set_etag(kEtag);
-    DCHECK(url_data_);
-    DCHECK(url_data_->frame());
-    url_data_->OnRedirect(
-        base::Bind(&ResourceMultiBufferDataProviderTest::RedirectCallback,
-                   base::Unretained(this)));
-
-    first_position_ = first_position;
-
-    std::unique_ptr<ResourceMultiBufferDataProvider> loader(
-        new ResourceMultiBufferDataProvider(url_data_.get(), first_position_));
-    loader_ = loader.get();
-    url_data_->multibuffer()->AddProvider(std::move(loader));
-
-    // |test_loader_| will be used when Start() is called.
-    url_loader_ = new NiceMock<MockWebURLLoader>();
-    loader_->test_loader_ = std::unique_ptr<blink::WebURLLoader>(url_loader_);
-  }
-
-  void Start() {
-    InSequence s;
-    EXPECT_CALL(
-        *url_loader_,
-        loadAsynchronously(Truly(CorrectAcceptEncodingAndEtag), loader_));
-
-    loader_->Start();
-  }
-
-  void FullResponse(int64_t instance_size, bool ok = true) {
-    WebURLResponse response(gurl_);
-    response.setHTTPHeaderField(
-        WebString::fromUTF8("Content-Length"),
-        WebString::fromUTF8(base::StringPrintf("%" PRId64, instance_size)));
-    response.setExpectedContentLength(instance_size);
-    response.setHTTPStatusCode(kHttpOK);
-    loader_->didReceiveResponse(url_loader_, response);
-
-    if (ok) {
-      EXPECT_EQ(instance_size, url_data_->length());
-    }
-
-    EXPECT_FALSE(url_data_->range_supported());
-  }
-
-  void PartialResponse(int64_t first_position, int64_t last_position,
-                       int64_t instance_size) {
-    PartialResponse(first_position, last_position, instance_size, false, true);
-  }
-
-  void PartialResponse(int64_t first_position, int64_t last_position,
-                       int64_t instance_size, bool chunked,
-                       bool accept_ranges) {
-    WebURLResponse response(gurl_);
-    response.setHTTPHeaderField(
-        WebString::fromUTF8("Content-Range"),
-        WebString::fromUTF8(
-            base::StringPrintf("bytes "
-                               "%" PRId64 "-%" PRId64 "/%" PRId64,
-                               first_position, last_position, instance_size)));
-
-    // HTTP 1.1 doesn't permit Content-Length with Transfer-Encoding: chunked.
-    int64_t content_length = -1;
-    if (chunked) {
-      response.setHTTPHeaderField(WebString::fromUTF8("Transfer-Encoding"),
-                                  WebString::fromUTF8("chunked"));
-    } else {
-      content_length = last_position - first_position + 1;
-    }
-    response.setExpectedContentLength(content_length);
-
-    // A server isn't required to return Accept-Ranges even though it might.
-    if (accept_ranges) {
-      response.setHTTPHeaderField(WebString::fromUTF8("Accept-Ranges"),
-                                  WebString::fromUTF8("bytes"));
-    }
-
-    response.setHTTPStatusCode(kHttpPartialContent);
-    loader_->didReceiveResponse(url_loader_, response);
-
-    EXPECT_EQ(instance_size, url_data_->length());
-
-    // A valid partial response should always result in this being true.
-    EXPECT_TRUE(url_data_->range_supported());
-  }
-
-  void Redirect(const char* url) {
-    GURL redirectUrl(url);
-    blink::WebURLRequest newRequest(redirectUrl);
-    blink::WebURLResponse redirectResponse(gurl_);
-
-    EXPECT_CALL(*this, RedirectCallback(_))
-        .WillOnce(
-            Invoke(this, &ResourceMultiBufferDataProviderTest::SetUrlData));
-
-    loader_->willFollowRedirect(url_loader_, newRequest, redirectResponse);
-
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void StopWhenLoad() {
-    InSequence s;
-    EXPECT_CALL(*url_loader_, cancel());
-    loader_ = NULL;
-    url_data_ = NULL;
-  }
-
-  // Helper method to write to |loader_| from |data_|.
-  void WriteLoader(int position, int size) {
-    loader_->didReceiveData(url_loader_,
-                            reinterpret_cast<char*>(data_ + position), size,
-                            size, size);
-  }
-
-  void WriteData(int size) {
-    std::unique_ptr<char[]> data(new char[size]);
-    loader_->didReceiveData(url_loader_, data.get(), size, size, size);
-  }
-
-  // Verifies that data in buffer[0...size] is equal to data_[pos...pos+size].
-  void VerifyBuffer(uint8_t* buffer, int pos, int size) {
-    EXPECT_EQ(0, SbMemoryCompare(buffer, data_ + pos, size));
-  }
-
-  bool HasActiveLoader() { return loader_->active_loader_ != NULL; }
-  MOCK_METHOD1(RedirectCallback, void(const scoped_refptr<UrlData>&));
-
-  void SetUrlData(const scoped_refptr<UrlData>& new_url_data) {
-    url_data_ = new_url_data;
-  }
-
- protected:
-  GURL gurl_;
-  int64_t first_position_;
-
-  std::unique_ptr<UrlIndex> url_index_;
-  scoped_refptr<UrlData> url_data_;
-  scoped_refptr<UrlData> redirected_to_;
-  // The loader is owned by the UrlData above.
-  ResourceMultiBufferDataProvider* loader_;
-  NiceMock<MockWebURLLoader>* url_loader_;
-
-  blink::WebFrameClient client_;
-  WebView* view_;
-
-  base::MessageLoop message_loop_;
-
-  uint8_t data_[kDataSize];
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ResourceMultiBufferDataProviderTest);
-};
-
-TEST_F(ResourceMultiBufferDataProviderTest, StartStop) {
-  Initialize(kHttpUrl, 0);
-  Start();
-  StopWhenLoad();
-}
-
-// Tests that a bad HTTP response is recived, e.g. file not found.
-TEST_F(ResourceMultiBufferDataProviderTest, BadHttpResponse) {
-  Initialize(kHttpUrl, 0);
-  Start();
-
-  EXPECT_CALL(*this, RedirectCallback(scoped_refptr<UrlData>(NULL)));
-
-  WebURLResponse response(gurl_);
-  response.setHTTPStatusCode(404);
-  response.setHTTPStatusText("Not Found\n");
-  loader_->didReceiveResponse(url_loader_, response);
-}
-
-// Tests that partial content is requested but not fulfilled.
-TEST_F(ResourceMultiBufferDataProviderTest, NotPartialResponse) {
-  Initialize(kHttpUrl, 100);
-  Start();
-  FullResponse(1024, false);
-}
-
-// Tests that a 200 response is received.
-TEST_F(ResourceMultiBufferDataProviderTest, FullResponse) {
-  Initialize(kHttpUrl, 0);
-  Start();
-  FullResponse(1024);
-  StopWhenLoad();
-}
-
-// Tests that a partial content response is received.
-TEST_F(ResourceMultiBufferDataProviderTest, PartialResponse) {
-  Initialize(kHttpUrl, 100);
-  Start();
-  PartialResponse(100, 200, 1024);
-  StopWhenLoad();
-}
-
-TEST_F(ResourceMultiBufferDataProviderTest, PartialResponse_Chunked) {
-  Initialize(kHttpUrl, 100);
-  Start();
-  PartialResponse(100, 200, 1024, true, true);
-  StopWhenLoad();
-}
-
-TEST_F(ResourceMultiBufferDataProviderTest, PartialResponse_NoAcceptRanges) {
-  Initialize(kHttpUrl, 100);
-  Start();
-  PartialResponse(100, 200, 1024, false, false);
-  StopWhenLoad();
-}
-
-TEST_F(ResourceMultiBufferDataProviderTest,
-       PartialResponse_ChunkedNoAcceptRanges) {
-  Initialize(kHttpUrl, 100);
-  Start();
-  PartialResponse(100, 200, 1024, true, false);
-  StopWhenLoad();
-}
-
-// Tests that an invalid partial response is received.
-TEST_F(ResourceMultiBufferDataProviderTest, InvalidPartialResponse) {
-  Initialize(kHttpUrl, 0);
-  Start();
-
-  EXPECT_CALL(*this, RedirectCallback(scoped_refptr<UrlData>(NULL)));
-
-  WebURLResponse response(gurl_);
-  response.setHTTPHeaderField(
-      WebString::fromUTF8("Content-Range"),
-      WebString::fromUTF8(base::StringPrintf("bytes "
-                                             "%d-%d/%d",
-                                             1, 10, 1024)));
-  response.setExpectedContentLength(10);
-  response.setHTTPStatusCode(kHttpPartialContent);
-  loader_->didReceiveResponse(url_loader_, response);
-}
-
-TEST_F(ResourceMultiBufferDataProviderTest, TestRedirects) {
-  // Test redirect.
-  Initialize(kHttpUrl, 0);
-  Start();
-  Redirect(kHttpRedirect);
-  FullResponse(1024);
-  StopWhenLoad();
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/run_all_unittests.cc b/src/cobalt/media/blink/run_all_unittests.cc
deleted file mode 100644
index 5b10f7b..0000000
--- a/src/cobalt/media/blink/run_all_unittests.cc
+++ /dev/null
@@ -1,98 +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.
-
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/test/launcher/unit_test_launcher.h"
-#include "base/test/test_suite.h"
-#include "build/build_config.h"
-#include "cobalt/media/base/media.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h"
-#include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h"
-#include "third_party/WebKit/public/web/WebKit.h"
-
-#if defined(OS_ANDROID)
-#include "base/android/jni_android.h"
-#include "cobalt/media/base/android/media_jni_registrar.h"
-#endif
-
-#ifdef V8_USE_EXTERNAL_STARTUP_DATA
-#include "gin/v8_initializer.h"
-#endif
-
-class TestBlinkPlatformSupport : public blink::Platform {
- public:
-  TestBlinkPlatformSupport()
-      : renderer_scheduler_(
-            blink::scheduler::CreateRendererSchedulerForTests()),
-        main_thread_(renderer_scheduler_->CreateMainThread()) {}
-  ~TestBlinkPlatformSupport() OVERRIDE;
-
-  blink::WebThread* currentThread() override {
-    EXPECT_TRUE(main_thread_->isCurrentThread());
-    return main_thread_.get();
-  }
-
- private:
-  std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler_;
-  std::unique_ptr<blink::WebThread> main_thread_;
-};
-
-TestBlinkPlatformSupport::~TestBlinkPlatformSupport() {
-  renderer_scheduler_->Shutdown();
-}
-
-class BlinkMediaTestSuite : public base::TestSuite {
- public:
-  BlinkMediaTestSuite(int argc, char** argv);
-  ~BlinkMediaTestSuite() OVERRIDE;
-
- protected:
-  void Initialize() OVERRIDE;
-
- private:
-  std::unique_ptr<TestBlinkPlatformSupport> blink_platform_support_;
-};
-
-BlinkMediaTestSuite::BlinkMediaTestSuite(int argc, char** argv)
-    : TestSuite(argc, argv),
-      blink_platform_support_(new TestBlinkPlatformSupport()) {}
-
-BlinkMediaTestSuite::~BlinkMediaTestSuite() {}
-
-void BlinkMediaTestSuite::Initialize() {
-  // Run TestSuite::Initialize first so that logging is initialized.
-  base::TestSuite::Initialize();
-
-#if defined(OS_ANDROID)
-  media::RegisterJni(base::android::AttachCurrentThread());
-#endif
-
-  // Run this here instead of main() to ensure an AtExitManager is already
-  // present.
-  media::InitializeMediaLibrary();
-
-#ifdef V8_USE_EXTERNAL_STARTUP_DATA
-  gin::V8Initializer::LoadV8Snapshot();
-  gin::V8Initializer::LoadV8Natives();
-#endif
-
-  // Dummy task runner is initialized here because the blink::initialize creates
-  // IsolateHolder which needs the current task runner handle. There should be
-  // no task posted to this task runner.
-  std::unique_ptr<base::MessageLoop> message_loop;
-  if (!base::MessageLoop::current())
-    message_loop.reset(new base::MessageLoop());
-  blink::initialize(blink_platform_support_.get());
-}
-
-int main(int argc, char** argv) {
-  BlinkMediaTestSuite test_suite(argc, argv);
-
-  return base::LaunchUnitTests(
-      argc, argv,
-      base::Bind(&BlinkMediaTestSuite::Run, base::Unretained(&test_suite)));
-}
diff --git a/src/cobalt/media/blink/test_response_generator.cc b/src/cobalt/media/blink/test_response_generator.cc
deleted file mode 100644
index 2711978..0000000
--- a/src/cobalt/media/blink/test_response_generator.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/test_response_generator.h"
-
-#include <string>
-
-#include "base/format_macros.h"
-#include "base/string_number_conversions.h"
-#include "base/stringprintf.h"
-#include "net/base/net_errors.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-using blink::WebString;
-using blink::WebURLError;
-using blink::WebURLResponse;
-
-namespace cobalt {
-namespace media {
-
-TestResponseGenerator::TestResponseGenerator(const GURL& gurl,
-                                             int64_t content_length)
-    : gurl_(gurl), content_length_(content_length) {}
-
-WebURLError TestResponseGenerator::GenerateError() {
-  WebURLError error;
-  error.reason = net::ERR_ABORTED;
-  error.domain = WebString::fromUTF8(net::kErrorDomain);
-  return error;
-}
-
-WebURLResponse TestResponseGenerator::Generate200() {
-  WebURLResponse response(gurl_);
-  response.setHTTPStatusCode(200);
-
-  response.setHTTPHeaderField(
-      WebString::fromUTF8("Content-Length"),
-      WebString::fromUTF8(base::Int64ToString(content_length_)));
-  response.setExpectedContentLength(content_length_);
-  return response;
-}
-
-WebURLResponse TestResponseGenerator::Generate206(int64_t first_byte_offset) {
-  return GeneratePartial206(first_byte_offset, content_length_ - 1, kNormal);
-}
-
-WebURLResponse TestResponseGenerator::Generate206(int64_t first_byte_offset,
-                                                  Flags flags) {
-  return GeneratePartial206(first_byte_offset, content_length_ - 1, flags);
-}
-
-WebURLResponse TestResponseGenerator::GeneratePartial206(
-    int64_t first_byte_offset, int64_t last_byte_offset) {
-  return GeneratePartial206(first_byte_offset, last_byte_offset, kNormal);
-}
-
-WebURLResponse TestResponseGenerator::GeneratePartial206(
-    int64_t first_byte_offset, int64_t last_byte_offset, Flags flags) {
-  int64_t range_content_length = content_length_ - first_byte_offset;
-
-  WebURLResponse response(gurl_);
-  response.setHTTPStatusCode(206);
-
-  if ((flags & kNoAcceptRanges) == 0) {
-    response.setHTTPHeaderField(WebString::fromUTF8("Accept-Ranges"),
-                                WebString::fromUTF8("bytes"));
-  }
-
-  if ((flags & kNoContentRange) == 0) {
-    std::string content_range = base::StringPrintf(
-        "bytes %" PRId64 "-%" PRId64 "/", first_byte_offset, last_byte_offset);
-    if (flags & kNoContentRangeInstanceSize)
-      content_range += "*";
-    else
-      content_range += base::StringPrintf("%" PRId64, content_length_);
-    response.setHTTPHeaderField(WebString::fromUTF8("Content-Range"),
-                                WebString::fromUTF8(content_range));
-  }
-
-  if ((flags & kNoContentLength) == 0) {
-    response.setHTTPHeaderField(
-        WebString::fromUTF8("Content-Length"),
-        WebString::fromUTF8(base::Int64ToString(range_content_length)));
-    response.setExpectedContentLength(range_content_length);
-  }
-  return response;
-}
-
-WebURLResponse TestResponseGenerator::GenerateResponse(int code) {
-  WebURLResponse response(gurl_);
-  response.setHTTPStatusCode(code);
-  return response;
-}
-
-WebURLResponse TestResponseGenerator::Generate404() {
-  return GenerateResponse(404);
-}
-
-WebURLResponse TestResponseGenerator::GenerateFileResponse(
-    int64_t first_byte_offset) {
-  WebURLResponse response(gurl_);
-  response.setHTTPStatusCode(0);
-
-  if (first_byte_offset >= 0) {
-    response.setExpectedContentLength(content_length_ - first_byte_offset);
-  } else {
-    response.setExpectedContentLength(-1);
-  }
-  return response;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/test_response_generator.h b/src/cobalt/media/blink/test_response_generator.h
deleted file mode 100644
index 3bcbda4..0000000
--- a/src/cobalt/media/blink/test_response_generator.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_
-#define COBALT_MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_
-
-#include "base/basictypes.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebURLError.h"
-#include "third_party/WebKit/public/platform/WebURLResponse.h"
-
-namespace cobalt {
-namespace media {
-
-// Generates WebURLErrors and WebURLResponses suitable for testing purposes.
-class TestResponseGenerator {
- public:
-  enum Flags {
-    kNormal = 0,
-    kNoAcceptRanges = 1 << 0,   // Don't include Accept-Ranges in 206 response.
-    kNoContentRange = 1 << 1,   // Don't include Content-Range in 206 response.
-    kNoContentLength = 1 << 2,  // Don't include Content-Length in 206 response.
-    kNoContentRangeInstanceSize = 1 << 3,  // Content-Range: N-M/* in 206.
-  };
-
-  // Build an HTTP response generator for the given URL. |content_length| is
-  // used to generate Content-Length and Content-Range headers.
-  TestResponseGenerator(const GURL& gurl, int64_t content_length);
-
-  // Generates a WebURLError object.
-  blink::WebURLError GenerateError();
-
-  // Generates a regular HTTP 200 response.
-  blink::WebURLResponse Generate200();
-
-  // Generates a regular HTTP 206 response starting from |first_byte_offset|
-  // until the end of the resource.
-  blink::WebURLResponse Generate206(int64_t first_byte_offset);
-
-  // Generates a custom HTTP 206 response starting from |first_byte_offset|
-  // until the end of the resource. You can tweak what gets included in the
-  // headers via |flags|.
-  blink::WebURLResponse Generate206(int64_t first_byte_offset, Flags flags);
-
-  // Generates a regular HTTP 206 response starting from |first_byte_offset|
-  // until |last_byte_offset|.
-  blink::WebURLResponse GeneratePartial206(int64_t first_byte_offset,
-                                           int64_t last_byte_offset);
-
-  // Generates a custom HTTP 206 response starting from |first_byte_offset|
-  // until |last_byte_offset|. You can tweak what gets included in the
-  // headers via |flags|.
-  blink::WebURLResponse GeneratePartial206(int64_t first_byte_offset,
-                                           int64_t last_byte_offset,
-                                           Flags flags);
-
-  // Generates a regular HTTP 404 response.
-  blink::WebURLResponse Generate404();
-
-  // Generate a HTTP response with specified code.
-  blink::WebURLResponse GenerateResponse(int code);
-
-  // Generates a file:// response starting from |first_byte_offset| until the
-  // end of the resource.
-  //
-  // If |first_byte_offset| is negative a response containing no content length
-  // will be returned.
-  blink::WebURLResponse GenerateFileResponse(int64_t first_byte_offset);
-
-  int64_t content_length() { return content_length_; }
-
- private:
-  GURL gurl_;
-  int64_t content_length_;
-
-  DISALLOW_COPY_AND_ASSIGN(TestResponseGenerator);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_
diff --git a/src/cobalt/media/blink/texttrack_impl.cc b/src/cobalt/media/blink/texttrack_impl.cc
deleted file mode 100644
index 2c15e92..0000000
--- a/src/cobalt/media/blink/texttrack_impl.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/texttrack_impl.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "cobalt/media/base/bind_to_current_loop.h"
-#include "cobalt/media/blink/webinbandtexttrack_impl.h"
-#include "third_party/WebKit/public/platform/WebInbandTextTrackClient.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
-
-namespace cobalt {
-namespace media {
-
-TextTrackImpl::TextTrackImpl(
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-    blink::WebMediaPlayerClient* client,
-    std::unique_ptr<WebInbandTextTrackImpl> text_track)
-    : task_runner_(task_runner),
-      client_(client),
-      text_track_(std::move(text_track)) {
-  client_->addTextTrack(text_track_.get());
-}
-
-TextTrackImpl::~TextTrackImpl() {
-  task_runner_->PostTask(FROM_HERE,
-                         base::Bind(&TextTrackImpl::OnRemoveTrack, client_,
-                                    base::Passed(&text_track_)));
-}
-
-void TextTrackImpl::addWebVTTCue(const base::TimeDelta& start,
-                                 const base::TimeDelta& end,
-                                 const std::string& id,
-                                 const std::string& content,
-                                 const std::string& settings) {
-  task_runner_->PostTask(
-      FROM_HERE, base::Bind(&TextTrackImpl::OnAddCue, text_track_.get(), start,
-                            end, id, content, settings));
-}
-
-void TextTrackImpl::OnAddCue(WebInbandTextTrackImpl* text_track,
-                             const base::TimeDelta& start,
-                             const base::TimeDelta& end, const std::string& id,
-                             const std::string& content,
-                             const std::string& settings) {
-  if (blink::WebInbandTextTrackClient* client = text_track->client()) {
-    client->addWebVTTCue(start.InSecondsF(), end.InSecondsF(),
-                         blink::WebString::fromUTF8(id),
-                         blink::WebString::fromUTF8(content),
-                         blink::WebString::fromUTF8(settings));
-  }
-}
-
-void TextTrackImpl::OnRemoveTrack(
-    blink::WebMediaPlayerClient* client,
-    std::unique_ptr<WebInbandTextTrackImpl> text_track) {
-  if (text_track->client()) client->removeTextTrack(text_track.get());
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/texttrack_impl.h b/src/cobalt/media/blink/texttrack_impl.h
deleted file mode 100644
index 1db40e1..0000000
--- a/src/cobalt/media/blink/texttrack_impl.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_TEXTTRACK_IMPL_H_
-#define COBALT_MEDIA_BLINK_TEXTTRACK_IMPL_H_
-
-#include <memory>
-#include <string>
-
-#include "base/basictypes.h"
-#include "cobalt/media/base/text_track.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-}
-
-namespace blink {
-class WebInbandTextTrackClient;
-class WebMediaPlayerClient;
-}
-
-namespace cobalt {
-namespace media {
-
-class WebInbandTextTrackImpl;
-
-class TextTrackImpl : public TextTrack {
- public:
-  // Constructor assumes ownership of the |text_track| object.
-  TextTrackImpl(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-                blink::WebMediaPlayerClient* client,
-                std::unique_ptr<WebInbandTextTrackImpl> text_track);
-
-  ~TextTrackImpl() OVERRIDE;
-
-  void addWebVTTCue(const base::TimeDelta& start, const base::TimeDelta& end,
-                    const std::string& id, const std::string& content,
-                    const std::string& settings) OVERRIDE;
-
- private:
-  static void OnAddCue(WebInbandTextTrackImpl* text_track,
-                       const base::TimeDelta& start, const base::TimeDelta& end,
-                       const std::string& id, const std::string& content,
-                       const std::string& settings);
-
-  static void OnRemoveTrack(blink::WebMediaPlayerClient* client,
-                            std::unique_ptr<WebInbandTextTrackImpl> text_track);
-
-  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  blink::WebMediaPlayerClient* client_;
-  std::unique_ptr<WebInbandTextTrackImpl> text_track_;
-  DISALLOW_COPY_AND_ASSIGN(TextTrackImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_TEXTTRACK_IMPL_H_
diff --git a/src/cobalt/media/blink/url_index.cc b/src/cobalt/media/blink/url_index.cc
deleted file mode 100644
index 3aa2794..0000000
--- a/src/cobalt/media/blink/url_index.cc
+++ /dev/null
@@ -1,268 +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 <algorithm>
-#include <set>
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/time.h"
-#include "cobalt/media/blink/resource_multibuffer_data_provider.h"
-#include "cobalt/media/blink/url_index.h"
-
-namespace cobalt {
-namespace media {
-
-const int kBlockSizeShift = 15;  // 1<<15 == 32kb
-const int kUrlMappingTimeoutSeconds = 300;
-
-ResourceMultiBuffer::ResourceMultiBuffer(UrlData* url_data, int block_shift)
-    : MultiBuffer(block_shift, url_data->url_index_->lru_),
-      url_data_(url_data) {}
-
-ResourceMultiBuffer::~ResourceMultiBuffer() {}
-
-std::unique_ptr<MultiBuffer::DataProvider> ResourceMultiBuffer::CreateWriter(
-    const MultiBufferBlockId& pos) {
-  ResourceMultiBufferDataProvider* ret =
-      new ResourceMultiBufferDataProvider(url_data_, pos);
-  ret->Start();
-  return std::unique_ptr<MultiBuffer::DataProvider>(ret);
-}
-
-bool ResourceMultiBuffer::RangeSupported() const {
-  return url_data_->range_supported_;
-}
-
-void ResourceMultiBuffer::OnEmpty() { url_data_->OnEmpty(); }
-
-UrlData::UrlData(const GURL& url, CORSMode cors_mode,
-                 const base::WeakPtr<UrlIndex>& url_index)
-    : url_(url),
-      have_data_origin_(false),
-      cors_mode_(cors_mode),
-      url_index_(url_index),
-      length_(kPositionNotSpecified),
-      range_supported_(false),
-      cacheable_(false),
-      last_used_(),
-      multibuffer_(this, url_index_->block_shift_),
-      frame_(url_index->frame()) {}
-
-UrlData::~UrlData() {}
-
-std::pair<GURL, UrlData::CORSMode> UrlData::key() const {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  return std::make_pair(url(), cors_mode());
-}
-
-void UrlData::set_valid_until(base::Time valid_until) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  valid_until_ = valid_until;
-}
-
-void UrlData::MergeFrom(const scoped_refptr<UrlData>& other) {
-  // We're merging from another UrlData that refers to the *same*
-  // resource, so when we merge the metadata, we can use the most
-  // optimistic values.
-  if (ValidateDataOrigin(other->data_origin_)) {
-    DCHECK(thread_checker_.CalledOnValidThread());
-    valid_until_ = std::max(valid_until_, other->valid_until_);
-    // set_length() will not override the length if already known.
-    set_length(other->length_);
-    cacheable_ |= other->cacheable_;
-    range_supported_ |= other->range_supported_;
-    if (last_modified_.is_null()) {
-      last_modified_ = other->last_modified_;
-    }
-    multibuffer()->MergeFrom(other->multibuffer());
-  }
-}
-
-void UrlData::set_cacheable(bool cacheable) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  cacheable_ = cacheable;
-}
-
-void UrlData::set_length(int64_t length) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (length != kPositionNotSpecified) {
-    length_ = length;
-  }
-}
-
-void UrlData::RedirectTo(const scoped_refptr<UrlData>& url_data) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  // Copy any cached data over to the new location.
-  url_data->multibuffer()->MergeFrom(multibuffer());
-
-  std::vector<RedirectCB> redirect_callbacks;
-  redirect_callbacks.swap(redirect_callbacks_);
-  for (const RedirectCB& cb : redirect_callbacks) {
-    cb.Run(url_data);
-  }
-}
-
-void UrlData::Fail() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  // Handled similar to a redirect.
-  std::vector<RedirectCB> redirect_callbacks;
-  redirect_callbacks.swap(redirect_callbacks_);
-  for (const RedirectCB& cb : redirect_callbacks) {
-    cb.Run(NULL);
-  }
-}
-
-void UrlData::OnRedirect(const RedirectCB& cb) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  redirect_callbacks_.push_back(cb);
-}
-
-void UrlData::Use() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  last_used_ = base::Time::Now();
-}
-
-bool UrlData::ValidateDataOrigin(const GURL& origin) {
-  if (!have_data_origin_) {
-    data_origin_ = origin;
-    have_data_origin_ = true;
-    return true;
-  }
-  if (cors_mode_ == UrlData::CORS_UNSPECIFIED) {
-    return data_origin_ == origin;
-  }
-  // The actual cors checks is done in the net layer.
-  return true;
-}
-
-void UrlData::OnEmpty() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::Bind(&UrlIndex::RemoveUrlDataIfEmpty, url_index_,
-                            scoped_refptr<UrlData>(this)));
-}
-
-bool UrlData::Valid() const {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  base::Time now = base::Time::Now();
-  if (!range_supported_) return false;
-  // When ranges are not supported, we cannot re-use cached data.
-  if (valid_until_ > now) return true;
-  if (now - last_used_ <
-      base::TimeDelta::FromSeconds(kUrlMappingTimeoutSeconds))
-    return true;
-  return false;
-}
-
-void UrlData::set_last_modified(base::Time last_modified) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  last_modified_ = last_modified;
-}
-
-void UrlData::set_etag(const std::string& etag) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  etag_ = etag;
-}
-
-void UrlData::set_range_supported() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  range_supported_ = true;
-}
-
-ResourceMultiBuffer* UrlData::multibuffer() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  return &multibuffer_;
-}
-
-size_t UrlData::CachedSize() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  return multibuffer()->map().size();
-}
-
-UrlIndex::UrlIndex(blink::WebFrame* frame) : UrlIndex(frame, kBlockSizeShift) {}
-
-UrlIndex::UrlIndex(blink::WebFrame* frame, int block_shift)
-    : frame_(frame),
-      lru_(new MultiBuffer::GlobalLRU(base::ThreadTaskRunnerHandle::Get())),
-      block_shift_(block_shift),
-      weak_factory_(this) {}
-
-UrlIndex::~UrlIndex() {}
-
-void UrlIndex::RemoveUrlDataIfEmpty(const scoped_refptr<UrlData>& url_data) {
-  if (!url_data->multibuffer()->map().empty()) return;
-
-  auto i = by_url_.find(url_data->key());
-  if (i != by_url_.end() && i->second == url_data) by_url_.erase(i);
-}
-
-scoped_refptr<UrlData> UrlIndex::GetByUrl(const GURL& gurl,
-                                          UrlData::CORSMode cors_mode) {
-  auto i = by_url_.find(std::make_pair(gurl, cors_mode));
-  if (i != by_url_.end() && i->second->Valid()) {
-    return i->second;
-  }
-  return NewUrlData(gurl, cors_mode);
-}
-
-scoped_refptr<UrlData> UrlIndex::NewUrlData(const GURL& url,
-                                            UrlData::CORSMode cors_mode) {
-  return new UrlData(url, cors_mode, weak_factory_.GetWeakPtr());
-}
-
-namespace {
-bool IsStrongEtag(const std::string& etag) {
-  return etag.size() > 2 && etag[0] == '"';
-}
-
-bool IsNewDataForSameResource(const scoped_refptr<UrlData>& new_entry,
-                              const scoped_refptr<UrlData>& old_entry) {
-  if (IsStrongEtag(new_entry->etag()) && IsStrongEtag(old_entry->etag())) {
-    if (new_entry->etag() != old_entry->etag()) return true;
-  }
-  if (!new_entry->last_modified().is_null()) {
-    if (new_entry->last_modified() != old_entry->last_modified()) return true;
-  }
-  return false;
-}
-
-}  // namespace
-
-scoped_refptr<UrlData> UrlIndex::TryInsert(
-    const scoped_refptr<UrlData>& url_data) {
-  scoped_refptr<UrlData>* by_url_slot;
-  bool urldata_valid = url_data->Valid();
-  if (urldata_valid) {
-    by_url_slot = &by_url_.insert(std::make_pair(url_data->key(), url_data))
-                       .first->second;
-  } else {
-    std::map<UrlData::KeyType, scoped_refptr<UrlData>>::iterator iter;
-    iter = by_url_.find(url_data->key());
-    if (iter == by_url_.end()) return url_data;
-    by_url_slot = &iter->second;
-  }
-  if (*by_url_slot == url_data) return url_data;
-
-  if (IsNewDataForSameResource(url_data, *by_url_slot)) {
-    if (urldata_valid) *by_url_slot = url_data;
-    return url_data;
-  }
-
-  // Check if we should replace the in-cache url data with our url data.
-  if (urldata_valid) {
-    if ((!(*by_url_slot)->Valid() ||
-         url_data->CachedSize() > (*by_url_slot)->CachedSize())) {
-      *by_url_slot = url_data;
-    } else {
-      (*by_url_slot)->MergeFrom(url_data);
-    }
-  }
-  return *by_url_slot;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/url_index.h b/src/cobalt/media/blink/url_index.h
deleted file mode 100644
index 81f9022..0000000
--- a/src/cobalt/media/blink/url_index.h
+++ /dev/null
@@ -1,263 +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 COBALT_MEDIA_BLINK_URL_INDEX_H_
-#define COBALT_MEDIA_BLINK_URL_INDEX_H_
-
-#include <map>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/thread_checker.h"
-#include "cobalt/media/blink/lru.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/blink/multibuffer.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-
-namespace cobalt {
-namespace media {
-
-const int64_t kPositionNotSpecified = -1;
-
-class UrlData;
-
-// A multibuffer for loading media resources which knows
-// how to create MultiBufferDataProviders to load data
-// into the cache.
-class MEDIA_BLINK_EXPORT ResourceMultiBuffer
-    : NON_EXPORTED_BASE(public MultiBuffer) {
- public:
-  ResourceMultiBuffer(UrlData* url_data_, int block_shift);
-  ~ResourceMultiBuffer() OVERRIDE;
-
-  // MultiBuffer implementation.
-  std::unique_ptr<MultiBuffer::DataProvider> CreateWriter(
-      const BlockId& pos) OVERRIDE;
-  bool RangeSupported() const OVERRIDE;
-  void OnEmpty() OVERRIDE;
-
- protected:
-  // Do not access from destructor, it is a pointer to the
-  // object that contains us.
-  UrlData* url_data_;
-};
-
-class UrlIndex;
-
-// All the data & metadata for a single resource.
-// Data is cached using a MultiBuffer instance.
-class MEDIA_BLINK_EXPORT UrlData : public base::RefCounted<UrlData> {
- public:
-  // Keep in sync with WebMediaPlayer::CORSMode.
-  enum CORSMode { CORS_UNSPECIFIED, CORS_ANONYMOUS, CORS_USE_CREDENTIALS };
-  typedef std::pair<GURL, CORSMode> KeyType;
-
-  // Accessors
-  const GURL& url() const { return url_; }
-
-  // Cross-origin access mode
-  CORSMode cors_mode() const { return cors_mode_; }
-
-  // Are HTTP range requests supported?
-  bool range_supported() const { return range_supported_; }
-
-  // True if we found a reason why this URL won't be stored in the
-  // HTTP disk cache.
-  bool cacheable() const { return cacheable_; }
-
-  // Last used time.
-  base::Time last_used() const { return last_used_; }
-
-  // Last modified time.
-  base::Time last_modified() const { return last_modified_; }
-
-  const std::string& etag() const { return etag_; }
-
-  // Expiration time.
-  base::Time valid_until() const { return valid_until_; }
-
-  // The key used by UrlIndex to find this UrlData.
-  KeyType key() const;
-
-  // Length of data associated with url or |kPositionNotSpecified|
-  int64_t length() const { return length_; }
-
-  // Returns the number of blocks cached for this resource.
-  size_t CachedSize();
-
-  // Returns our url_index, or NULL if it's been destroyed.
-  UrlIndex* url_index() const { return url_index_.get(); }
-
-  // Notifies the url index that this is currently used.
-  // The url <-> URLData mapping will be eventually be invalidated if
-  // this is not called regularly.
-  void Use();
-
-  // Call this before we add some data to the multibuffer().
-  // If the multibuffer is empty, the data origin is set from
-  // |origin| and returns true. If not, it compares |origin|
-  // to the previous origin and returns wheather they match or not.
-  bool ValidateDataOrigin(const GURL& origin);
-
-  // Setters.
-  void set_length(int64_t length);
-  void set_cacheable(bool cacheable);
-  void set_valid_until(base::Time valid_until);
-  void set_range_supported();
-  void set_last_modified(base::Time last_modified);
-  void set_etag(const std::string& etag);
-
-  // A redirect has occured (or we've found a better UrlData for the same
-  // resource).
-  void RedirectTo(const scoped_refptr<UrlData>& to);
-
-  // Fail, tell all clients that a failure has occured.
-  void Fail();
-
-  // Callback for receving notifications when a redirect occurs.
-  typedef base::Callback<void(const scoped_refptr<UrlData>&)> RedirectCB;
-
-  // Register a callback to be called when a redirect occurs.
-  // Callbacks are cleared when a redirect occurs, so clients must call
-  // OnRedirect again if they wish to continue receiving callbacks.
-  void OnRedirect(const RedirectCB& cb);
-
-  // Returns true it is valid to keep using this to access cached data.
-  // A single media player instance may choose to ignore this for resources
-  // that have already been opened.
-  bool Valid() const;
-
-  // Virtual so we can override it for testing.
-  virtual ResourceMultiBuffer* multibuffer();
-
-  // Accessor
-  blink::WebFrame* frame() const { return frame_; }
-
- protected:
-  UrlData(const GURL& url, CORSMode cors_mode,
-          const base::WeakPtr<UrlIndex>& url_index);
-  virtual ~UrlData();
-
- private:
-  friend class ResourceMultiBuffer;
-  friend class UrlIndex;
-  friend class base::RefCounted<UrlData>;
-
-  void OnEmpty();
-  void MergeFrom(const scoped_refptr<UrlData>& other);
-
-  // Url we represent, note that there may be multiple UrlData for
-  // the same url.
-  const GURL url_;
-
-  // Origin of the data, should only be different from the url_.GetOrigin()
-  // when service workers are involved.
-  GURL data_origin_;
-  bool have_data_origin_;
-
-  // Cross-origin access mode.
-  const CORSMode cors_mode_;
-
-  base::WeakPtr<UrlIndex> url_index_;
-
-  // Length of resource this url points to. (in bytes)
-  int64_t length_;
-
-  // Does the server support ranges?
-  bool range_supported_;
-
-  // Set to false if we have reason to beleive the chrome disk cache
-  // will not cache this url.
-  bool cacheable_;
-
-  // Last time some media time used this resource.
-  // Note that we use base::Time rather than base::TimeTicks because
-  // TimeTicks will stop advancing when a machine goes to sleep.
-  // base::Time can go backwards, jump hours at a time and be generally
-  // unpredictable, but it doesn't stop, which is preferable here.
-  // (False negatives are better than false positivies.)
-  base::Time last_used_;
-
-  // Expiration time according to http headers.
-  base::Time valid_until_;
-
-  // Last modification time according to http headers.
-  base::Time last_modified_;
-
-  // Etag from HTTP reply.
-  std::string etag_;
-
-  ResourceMultiBuffer multibuffer_;
-  std::vector<RedirectCB> redirect_callbacks_;
-
-  blink::WebFrame* frame_;
-
-  base::ThreadChecker thread_checker_;
-  DISALLOW_COPY_AND_ASSIGN(UrlData);
-};
-
-// The UrlIndex lets you look up UrlData instances by url.
-class MEDIA_BLINK_EXPORT UrlIndex {
- public:
-  explicit UrlIndex(blink::WebFrame*);
-  UrlIndex(blink::WebFrame*, int block_shift);
-  virtual ~UrlIndex();
-
-  // Look up an UrlData in the index and return it. If none is found,
-  // create a new one. Note that newly created UrlData entries are NOT
-  // added to the index, instead you must call TryInsert on them after
-  // initializing relevant parameters, like whether it support
-  // ranges and it's last modified time.
-  scoped_refptr<UrlData> GetByUrl(const GURL& gurl,
-                                  UrlData::CORSMode cors_mode);
-
-  // Add the given UrlData to the index if possible. If a better UrlData
-  // is already present in the index, return it instead. (If not, we just
-  // return the given UrlData.) Please make sure to initialize all the data
-  // that can be gathered from HTTP headers in |url_data| before calling this.
-  // In particular, the following fields are important:
-  //   o range_supported: Entries which do not support ranges cannot be
-  //     shared and are not added to the index.
-  //   o valid_until, last_used: Entries have to be valid to be inserted
-  //     into the index, this means that they have to have been recently
-  //     used or have an Expires: header that says when they stop being valid.
-  //   o last_modified: Expired cache entries can be re-used if last_modified
-  //     matches.
-  // TODO(hubbe): Add etag support.
-  scoped_refptr<UrlData> TryInsert(const scoped_refptr<UrlData>& url_data);
-
-  blink::WebFrame* frame() const { return frame_; }
-  int block_shift() const { return block_shift_; }
-
- private:
-  friend class UrlData;
-  friend class ResourceMultiBuffer;
-  void RemoveUrlDataIfEmpty(const scoped_refptr<UrlData>& url_data);
-
-  // Virtual so we can override it in tests.
-  virtual scoped_refptr<UrlData> NewUrlData(const GURL& url,
-                                            UrlData::CORSMode cors_mode);
-
-  std::map<UrlData::KeyType, scoped_refptr<UrlData>> by_url_;
-  blink::WebFrame* frame_;
-  scoped_refptr<MultiBuffer::GlobalLRU> lru_;
-
-  // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift.
-  // Currently only changed for testing purposes.
-  const int block_shift_;
-
- protected:
-  base::WeakPtrFactory<UrlIndex> weak_factory_;
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_URL_INDEX_H_
diff --git a/src/cobalt/media/blink/url_index_unittest.cc b/src/cobalt/media/blink/url_index_unittest.cc
deleted file mode 100644
index 6731020..0000000
--- a/src/cobalt/media/blink/url_index_unittest.cc
+++ /dev/null
@@ -1,160 +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 <list>
-#include <string>
-
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "base/stringprintf.h"
-#include "cobalt/media/blink/url_index.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-
-class UrlIndexTest : public testing::Test {
- public:
-  UrlIndexTest() : url_index_(NULL) {}
-
-  scoped_refptr<UrlData> GetByUrl(const GURL& gurl,
-                                  UrlData::CORSMode cors_mode) {
-    scoped_refptr<UrlData> ret = url_index_.GetByUrl(gurl, cors_mode);
-    EXPECT_EQ(ret->url(), gurl);
-    EXPECT_EQ(ret->cors_mode(), cors_mode);
-    return ret;
-  }
-
-  // TODO(hubbe): Make UrlIndex take a task_runner_
-  base::MessageLoop message_loop_;
-  UrlIndex url_index_;
-};
-
-TEST_F(UrlIndexTest, SimpleTest) {
-  GURL url1("http://foo.bar.com");
-  GURL url2("http://foo.bar.com/urgel");
-  scoped_refptr<UrlData> a = GetByUrl(url1, UrlData::CORS_UNSPECIFIED);
-  // Make sure it's valid, we still shouldn't get the same one.
-  a->Use();
-  a->set_range_supported();
-  EXPECT_TRUE(a->Valid());
-  EXPECT_EQ(a, url_index_.TryInsert(a));
-  scoped_refptr<UrlData> b = GetByUrl(url1, UrlData::CORS_ANONYMOUS);
-  b->Use();
-  b->set_range_supported();
-  EXPECT_TRUE(b->Valid());
-  EXPECT_EQ(b, url_index_.TryInsert(b));
-  scoped_refptr<UrlData> c = GetByUrl(url1, UrlData::CORS_USE_CREDENTIALS);
-  c->Use();
-  c->set_range_supported();
-  EXPECT_TRUE(c->Valid());
-  EXPECT_EQ(c, url_index_.TryInsert(c));
-  scoped_refptr<UrlData> d = GetByUrl(url2, UrlData::CORS_UNSPECIFIED);
-  d->Use();
-  d->set_range_supported();
-  EXPECT_TRUE(d->Valid());
-  EXPECT_EQ(d, url_index_.TryInsert(d));
-
-  EXPECT_NE(a, b);
-  EXPECT_NE(a, c);
-  EXPECT_NE(a, d);
-  EXPECT_NE(b, c);
-  EXPECT_NE(b, d);
-  EXPECT_NE(c, d);
-  EXPECT_EQ(a, GetByUrl(url1, UrlData::CORS_UNSPECIFIED));
-  EXPECT_EQ(b, GetByUrl(url1, UrlData::CORS_ANONYMOUS));
-  EXPECT_EQ(c, GetByUrl(url1, UrlData::CORS_USE_CREDENTIALS));
-  EXPECT_EQ(d, GetByUrl(url2, UrlData::CORS_UNSPECIFIED));
-}
-
-TEST_F(UrlIndexTest, UrlDataTest) {
-  GURL url("http://foo.bar.com");
-  scoped_refptr<UrlData> a = GetByUrl(url, UrlData::CORS_UNSPECIFIED);
-
-  // Check default values.
-  EXPECT_FALSE(a->range_supported());
-  EXPECT_FALSE(a->cacheable());
-  EXPECT_EQ(a->length(), kPositionNotSpecified);
-  EXPECT_FALSE(a->Valid());
-
-  a->set_length(117);
-  EXPECT_EQ(a->length(), 117);
-
-  a->set_cacheable(true);
-  EXPECT_TRUE(a->cacheable());
-
-  base::Time now = base::Time::Now();
-  base::Time valid_until = now + base::TimeDelta::FromSeconds(500);
-  a->set_valid_until(valid_until);
-  a->set_range_supported();
-  EXPECT_EQ(valid_until, a->valid_until());
-  EXPECT_TRUE(a->Valid());
-
-  base::Time last_modified = now - base::TimeDelta::FromSeconds(500);
-  a->set_last_modified(last_modified);
-  EXPECT_EQ(last_modified, a->last_modified());
-}
-
-TEST_F(UrlIndexTest, UseTest) {
-  GURL url("http://foo.bar.com");
-  scoped_refptr<UrlData> a = GetByUrl(url, UrlData::CORS_UNSPECIFIED);
-  EXPECT_FALSE(a->Valid());
-  a->Use();
-  a->set_range_supported();
-  EXPECT_TRUE(a->Valid());
-}
-
-TEST_F(UrlIndexTest, TryInsert) {
-  GURL url("http://foo.bar.com");
-  scoped_refptr<UrlData> a = GetByUrl(url, UrlData::CORS_UNSPECIFIED);
-  scoped_refptr<UrlData> c = GetByUrl(url, UrlData::CORS_UNSPECIFIED);
-  EXPECT_NE(a, c);
-  EXPECT_FALSE(a->Valid());
-  base::Time now = base::Time::Now();
-  base::Time last_modified = now - base::TimeDelta::FromSeconds(500);
-  base::Time valid_until = now + base::TimeDelta::FromSeconds(500);
-
-  // Not sharable yet. (no ranges)
-  EXPECT_EQ(a, url_index_.TryInsert(a));
-  EXPECT_NE(a, GetByUrl(url, UrlData::CORS_UNSPECIFIED));
-  a->set_last_modified(last_modified);
-
-  // Not sharable yet. (no ranges)
-  EXPECT_EQ(a, url_index_.TryInsert(a));
-  EXPECT_NE(a, GetByUrl(url, UrlData::CORS_UNSPECIFIED));
-
-  // Now we should be able to insert it into the index.
-  a->set_range_supported();
-  a->set_valid_until(valid_until);
-  EXPECT_TRUE(a->Valid());
-  EXPECT_EQ(a, url_index_.TryInsert(a));
-  EXPECT_EQ(a, GetByUrl(url, UrlData::CORS_UNSPECIFIED));
-
-  // |a| becomes expired...
-  a->set_valid_until(now - base::TimeDelta::FromSeconds(100));
-  EXPECT_FALSE(a->Valid());
-  scoped_refptr<UrlData> b = GetByUrl(url, UrlData::CORS_UNSPECIFIED);
-  EXPECT_NE(a, b);
-
-  b->set_range_supported();
-  b->set_valid_until(valid_until);
-  b->set_last_modified(last_modified);
-  EXPECT_TRUE(b->Valid());
-
-  EXPECT_EQ(b, url_index_.TryInsert(b));
-  EXPECT_EQ(b, GetByUrl(url, UrlData::CORS_UNSPECIFIED));
-
-  c->set_range_supported();
-  c->set_valid_until(valid_until);
-  c->set_last_modified(last_modified);
-  EXPECT_TRUE(c->Valid());
-
-  // B is still valid, so it should be preferred over C.
-  EXPECT_EQ(b, url_index_.TryInsert(c));
-  EXPECT_EQ(b, GetByUrl(url, UrlData::CORS_UNSPECIFIED));
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/video_frame_compositor.cc b/src/cobalt/media/blink/video_frame_compositor.cc
deleted file mode 100644
index 9747d09..0000000
--- a/src/cobalt/media/blink/video_frame_compositor.cc
+++ /dev/null
@@ -1,241 +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.
-
-#include "cobalt/media/blink/video_frame_compositor.h"
-
-#include "base/bind.h"
-#include "base/default_tick_clock.h"
-#include "base/message_loop.h"
-#include "base/trace_event/trace_event.h"
-#include "cobalt/media/base/video_frame.h"
-
-namespace cobalt {
-namespace media {
-
-// Amount of time to wait between UpdateCurrentFrame() callbacks before starting
-// background rendering to keep the Render() callbacks moving.
-const int kBackgroundRenderingTimeoutMs = 250;
-
-VideoFrameCompositor::VideoFrameCompositor(
-    const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner)
-    : compositor_task_runner_(compositor_task_runner),
-      tick_clock_(new base::DefaultTickClock()),
-      background_rendering_enabled_(true),
-      background_rendering_timer_(
-          FROM_HERE,
-          base::TimeDelta::FromMilliseconds(kBackgroundRenderingTimeoutMs),
-          base::Bind(&VideoFrameCompositor::BackgroundRender,
-                     base::Unretained(this)),
-          // Task is not repeating, CallRender() will reset the task as needed.
-          false),
-      client_(NULL),
-      rendering_(false),
-      rendered_last_frame_(false),
-      is_background_rendering_(false),
-      new_background_frame_(false),
-      // Assume 60Hz before the first UpdateCurrentFrame() call.
-      last_interval_(base::TimeDelta::FromSecondsD(1.0 / 60)),
-      callback_(NULL) {
-  background_rendering_timer_.SetTaskRunner(compositor_task_runner_);
-}
-
-VideoFrameCompositor::~VideoFrameCompositor() {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  DCHECK(!callback_);
-  DCHECK(!rendering_);
-  if (client_) client_->StopUsingProvider();
-}
-
-void VideoFrameCompositor::OnRendererStateUpdate(bool new_state) {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  DCHECK_NE(rendering_, new_state);
-  rendering_ = new_state;
-
-  if (rendering_) {
-    // Always start playback in background rendering mode, if |client_| kicks
-    // in right away it's okay.
-    BackgroundRender();
-  } else if (background_rendering_enabled_) {
-    background_rendering_timer_.Stop();
-  } else {
-    DCHECK(!background_rendering_timer_.IsRunning());
-  }
-
-  if (!client_) return;
-
-  if (rendering_)
-    client_->StartRendering();
-  else
-    client_->StopRendering();
-}
-
-void VideoFrameCompositor::SetVideoFrameProviderClient(
-    cc::VideoFrameProvider::Client* client) {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  if (client_) client_->StopUsingProvider();
-  client_ = client;
-
-  // |client_| may now be null, so verify before calling it.
-  if (rendering_ && client_) client_->StartRendering();
-}
-
-scoped_refptr<VideoFrame> VideoFrameCompositor::GetCurrentFrame() {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  return current_frame_;
-}
-
-void VideoFrameCompositor::PutCurrentFrame() {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  rendered_last_frame_ = true;
-}
-
-bool VideoFrameCompositor::UpdateCurrentFrame(base::TimeTicks deadline_min,
-                                              base::TimeTicks deadline_max) {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  return CallRender(deadline_min, deadline_max, false);
-}
-
-bool VideoFrameCompositor::HasCurrentFrame() {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  return static_cast<bool>(current_frame_);
-}
-
-void VideoFrameCompositor::Start(RenderCallback* callback) {
-  TRACE_EVENT_ASYNC_BEGIN0("media,rail", "VideoPlayback",
-                           static_cast<const void*>(this));
-
-  // Called from the media thread, so acquire the callback under lock before
-  // returning in case a Stop() call comes in before the PostTask is processed.
-  base::AutoLock lock(callback_lock_);
-  DCHECK(!callback_);
-  callback_ = callback;
-  compositor_task_runner_->PostTask(
-      FROM_HERE, base::Bind(&VideoFrameCompositor::OnRendererStateUpdate,
-                            base::Unretained(this), true));
-}
-
-void VideoFrameCompositor::Stop() {
-  TRACE_EVENT_ASYNC_END0("media,rail", "VideoPlayback",
-                         static_cast<const void*>(this));
-
-  // Called from the media thread, so release the callback under lock before
-  // returning to avoid a pending UpdateCurrentFrame() call occurring before
-  // the PostTask is processed.
-  base::AutoLock lock(callback_lock_);
-  DCHECK(callback_);
-  callback_ = NULL;
-  compositor_task_runner_->PostTask(
-      FROM_HERE, base::Bind(&VideoFrameCompositor::OnRendererStateUpdate,
-                            base::Unretained(this), false));
-}
-
-void VideoFrameCompositor::PaintSingleFrame(
-    const scoped_refptr<VideoFrame>& frame, bool repaint_duplicate_frame) {
-  if (!compositor_task_runner_->BelongsToCurrentThread()) {
-    compositor_task_runner_->PostTask(
-        FROM_HERE,
-        base::Bind(&VideoFrameCompositor::PaintSingleFrame,
-                   base::Unretained(this), frame, repaint_duplicate_frame));
-    return;
-  }
-
-  if (ProcessNewFrame(frame, repaint_duplicate_frame) && client_)
-    client_->DidReceiveFrame();
-}
-
-scoped_refptr<VideoFrame>
-VideoFrameCompositor::GetCurrentFrameAndUpdateIfStale() {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  if (client_ || !rendering_ || !is_background_rendering_)
-    return current_frame_;
-
-  DCHECK(!last_background_render_.is_null());
-
-  const base::TimeTicks now = tick_clock_->NowTicks();
-  const base::TimeDelta interval = now - last_background_render_;
-
-  // Cap updates to 250Hz which should be more than enough for everyone.
-  if (interval < base::TimeDelta::FromMilliseconds(4)) return current_frame_;
-
-  // Update the interval based on the time between calls and call background
-  // render which will give this information to the client.
-  last_interval_ = interval;
-  BackgroundRender();
-
-  return current_frame_;
-}
-
-base::TimeDelta VideoFrameCompositor::GetCurrentFrameTimestamp() const {
-  // When the VFC is stopped, |callback_| is cleared; this synchronously
-  // prevents CallRender() from invoking ProcessNewFrame(), and so
-  // |current_frame_| won't change again until after Start(). (Assuming that
-  // PaintSingleFrame() is not also called while stopped.)
-  if (!current_frame_) return base::TimeDelta();
-  return current_frame_->timestamp();
-}
-
-bool VideoFrameCompositor::ProcessNewFrame(
-    const scoped_refptr<VideoFrame>& frame, bool repaint_duplicate_frame) {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-
-  if (!repaint_duplicate_frame && frame == current_frame_) return false;
-
-  // Set the flag indicating that the current frame is unrendered, if we get a
-  // subsequent PutCurrentFrame() call it will mark it as rendered.
-  rendered_last_frame_ = false;
-
-  current_frame_ = frame;
-  return true;
-}
-
-void VideoFrameCompositor::BackgroundRender() {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-  const base::TimeTicks now = tick_clock_->NowTicks();
-  last_background_render_ = now;
-  bool new_frame = CallRender(now, now + last_interval_, true);
-  if (new_frame && client_) client_->DidReceiveFrame();
-}
-
-bool VideoFrameCompositor::CallRender(base::TimeTicks deadline_min,
-                                      base::TimeTicks deadline_max,
-                                      bool background_rendering) {
-  DCHECK(compositor_task_runner_->BelongsToCurrentThread());
-
-  base::AutoLock lock(callback_lock_);
-  if (!callback_) {
-    // Even if we no longer have a callback, return true if we have a frame
-    // which |client_| hasn't seen before.
-    return !rendered_last_frame_ && current_frame_;
-  }
-
-  DCHECK(rendering_);
-
-  // If the previous frame was never rendered and we're not in background
-  // rendering mode (nor have just exited it), let the client know.
-  if (!rendered_last_frame_ && current_frame_ && !background_rendering &&
-      !is_background_rendering_) {
-    callback_->OnFrameDropped();
-  }
-
-  const bool new_frame = ProcessNewFrame(
-      callback_->Render(deadline_min, deadline_max, background_rendering),
-      false);
-
-  // We may create a new frame here with background rendering, but the provider
-  // has no way of knowing that a new frame had been processed, so keep track of
-  // the new frame, and return true on the next call to |CallRender|.
-  const bool had_new_background_frame = new_background_frame_;
-  new_background_frame_ = background_rendering && new_frame;
-
-  is_background_rendering_ = background_rendering;
-  last_interval_ = deadline_max - deadline_min;
-
-  // Restart the background rendering timer whether we're background rendering
-  // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|.
-  if (background_rendering_enabled_) background_rendering_timer_.Reset();
-  return new_frame || had_new_background_frame;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/video_frame_compositor.h b/src/cobalt/media/blink/video_frame_compositor.h
deleted file mode 100644
index 1cb1ae9..0000000
--- a/src/cobalt/media/blink/video_frame_compositor.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_
-#define COBALT_MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_
-
-#include <utility>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "base/synchronization/lock.h"
-#include "base/tick_clock.h"
-#include "base/timer/timer.h"
-#include "cc/layers/video_frame_provider.h"
-#include "cobalt/media/base/video_renderer_sink.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "ui/gfx/size.h"
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-
-// VideoFrameCompositor acts as a bridge between the media and cc layers for
-// rendering video frames. I.e. a media::VideoRenderer will talk to this class
-// from the media side, while a cc::VideoFrameProvider::Client will talk to it
-// from the cc side.
-//
-// This class is responsible for requesting new frames from a video renderer in
-// response to requests from the VFP::Client. Since the VFP::Client may stop
-// issuing requests in response to visibility changes it is also responsible for
-// ensuring the "freshness" of the current frame for programmatic frame
-// requests; e.g., Canvas.drawImage() requests
-//
-// This class is also responsible for detecting frames dropped by the compositor
-// after rendering and signaling that information to a RenderCallback. It
-// detects frames not dropped by verifying each GetCurrentFrame() is followed
-// by a PutCurrentFrame() before the next UpdateCurrentFrame() call.
-//
-// VideoRenderSink::RenderCallback implementations must call Start() and Stop()
-// once new frames are expected or are no longer expected to be ready; this data
-// is relayed to the compositor to avoid extraneous callbacks.
-//
-// VideoFrameCompositor is also responsible for pumping UpdateCurrentFrame()
-// callbacks in the background when |client_| has decided to suspend them.
-//
-// VideoFrameCompositor must live on the same thread as the compositor, though
-// it may be constructed on any thread.
-class MEDIA_BLINK_EXPORT VideoFrameCompositor
-    : public VideoRendererSink,
-      NON_EXPORTED_BASE(public cc::VideoFrameProvider) {
- public:
-  // |compositor_task_runner| is the task runner on which this class will live,
-  // though it may be constructed on any thread.
-  explicit VideoFrameCompositor(
-      const scoped_refptr<base::SingleThreadTaskRunner>&
-          compositor_task_runner);
-
-  // Destruction must happen on the compositor thread; Stop() must have been
-  // called before destruction starts.
-  ~VideoFrameCompositor() OVERRIDE;
-
-  // cc::VideoFrameProvider implementation. These methods must be called on the
-  // |compositor_task_runner_|.
-  void SetVideoFrameProviderClient(
-      cc::VideoFrameProvider::Client* client) OVERRIDE;
-  bool UpdateCurrentFrame(base::TimeTicks deadline_min,
-                          base::TimeTicks deadline_max) OVERRIDE;
-  bool HasCurrentFrame() OVERRIDE;
-  scoped_refptr<VideoFrame> GetCurrentFrame() OVERRIDE;
-  void PutCurrentFrame() OVERRIDE;
-
-  // VideoRendererSink implementation. These methods must be called from the
-  // same thread (typically the media thread).
-  void Start(RenderCallback* callback) OVERRIDE;
-  void Stop() OVERRIDE;
-  void PaintSingleFrame(const scoped_refptr<VideoFrame>& frame,
-                        bool repaint_duplicate_frame = false) OVERRIDE;
-
-  // Returns |current_frame_| if |client_| is set.  If no |client_| is set,
-  // |is_background_rendering_| is true, and |callback_| is set, it requests a
-  // new frame from |callback_|, using the elapsed time between calls to this
-  // function as the render interval; defaulting to 16.6ms if no prior calls
-  // have been made.  A cap of 250Hz (4ms) is in place to prevent clients from
-  // accidentally (or intentionally) spamming the rendering pipeline.
-  //
-  // This method is primarily to facilitate canvas and WebGL based applications
-  // where the <video> tag is invisible (possibly not even in the DOM) and thus
-  // does not receive a |client_|.  In this case, frame acquisition is driven by
-  // the frequency of canvas or WebGL paints requested via JavaScript.
-  scoped_refptr<VideoFrame> GetCurrentFrameAndUpdateIfStale();
-
-  // Returns the timestamp of the current (possibly stale) frame, or
-  // base::TimeDelta() if there is no current frame. This method may be called
-  // from the media thread as long as the VFC is stopped. (Assuming that
-  // PaintSingleFrame() is not also called while stopped.)
-  base::TimeDelta GetCurrentFrameTimestamp() const;
-
-  void set_tick_clock_for_testing(std::unique_ptr<base::TickClock> tick_clock) {
-    tick_clock_ = std::move(tick_clock);
-  }
-
-  void clear_current_frame_for_testing() { current_frame_ = NULL; }
-
-  // Enables or disables background rendering. If |enabled|, |timeout| is the
-  // amount of time to wait after the last Render() call before starting the
-  // background rendering mode.  Note, this can not disable the background
-  // rendering call issues when a sink is started.
-  void set_background_rendering_for_testing(bool enabled) {
-    background_rendering_enabled_ = enabled;
-  }
-
- private:
-  // Called on the compositor thread in response to Start() or Stop() calls;
-  // must be used to change |rendering_| state.
-  void OnRendererStateUpdate(bool new_state);
-
-  // Handles setting of |current_frame_|.
-  bool ProcessNewFrame(const scoped_refptr<VideoFrame>& frame,
-                       bool repaint_duplicate_frame);
-
-  // Called by |background_rendering_timer_| when enough time elapses where we
-  // haven't seen a Render() call.
-  void BackgroundRender();
-
-  // If |callback_| is available, calls Render() with the provided properties.
-  // Updates |is_background_rendering_|, |last_interval_|, and resets
-  // |background_rendering_timer_|. Returns true if there's a new frame
-  // available via GetCurrentFrame().
-  bool CallRender(base::TimeTicks deadline_min, base::TimeTicks deadline_max,
-                  bool background_rendering);
-
-  scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
-  std::unique_ptr<base::TickClock> tick_clock_;
-
-  // Allows tests to disable the background rendering task.
-  bool background_rendering_enabled_;
-
-  // Manages UpdateCurrentFrame() callbacks if |client_| has stopped sending
-  // them for various reasons.  Runs on |compositor_task_runner_| and is reset
-  // after each successful UpdateCurrentFrame() call.
-  base::Timer background_rendering_timer_;
-
-  // These values are only set and read on the compositor thread.
-  cc::VideoFrameProvider::Client* client_;
-  bool rendering_;
-  bool rendered_last_frame_;
-  bool is_background_rendering_;
-  bool new_background_frame_;
-  base::TimeDelta last_interval_;
-  base::TimeTicks last_background_render_;
-
-  // These values are set on the compositor thread, but also read on the media
-  // thread when the VFC is stopped.
-  scoped_refptr<VideoFrame> current_frame_;
-
-  // These values are updated and read from the media and compositor threads.
-  base::Lock callback_lock_;
-  VideoRendererSink::RenderCallback* callback_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_
diff --git a/src/cobalt/media/blink/video_frame_compositor_unittest.cc b/src/cobalt/media/blink/video_frame_compositor_unittest.cc
deleted file mode 100644
index 00b4814..0000000
--- a/src/cobalt/media/blink/video_frame_compositor_unittest.cc
+++ /dev/null
@@ -1,265 +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.
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "cc/layers/video_frame_provider.h"
-#include "cobalt/media/base/gmock_callback_support.h"
-#include "cobalt/media/base/video_frame.h"
-#include "cobalt/media/blink/video_frame_compositor.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using testing::_;
-using testing::DoAll;
-using testing::Return;
-
-namespace cobalt {
-namespace media {
-
-class VideoFrameCompositorTest : public testing::Test,
-                                 public cc::VideoFrameProvider::Client,
-                                 public VideoRendererSink::RenderCallback {
- public:
-  VideoFrameCompositorTest()
-      : tick_clock_(new base::SimpleTestTickClock()),
-        compositor_(new VideoFrameCompositor(message_loop.task_runner())),
-        did_receive_frame_count_(0) {
-    compositor_->SetVideoFrameProviderClient(this);
-    compositor_->set_tick_clock_for_testing(
-        std::unique_ptr<base::TickClock>(tick_clock_));
-    // Disable background rendering by default.
-    compositor_->set_background_rendering_for_testing(false);
-  }
-
-  ~VideoFrameCompositorTest() override {
-    compositor_->SetVideoFrameProviderClient(NULL);
-  }
-
-  scoped_refptr<VideoFrame> CreateOpaqueFrame() {
-    gfx::Size size(8, 8);
-    return VideoFrame::CreateFrame(PIXEL_FORMAT_YV12, size, gfx::Rect(size),
-                                   size, base::TimeDelta());
-  }
-
-  VideoFrameCompositor* compositor() { return compositor_.get(); }
-  int did_receive_frame_count() { return did_receive_frame_count_; }
-
- protected:
-  // cc::VideoFrameProvider::Client implementation.
-  void StopUsingProvider() override {}
-  MOCK_METHOD0(StartRendering, void());
-  MOCK_METHOD0(StopRendering, void());
-  void DidReceiveFrame() override { ++did_receive_frame_count_; }
-
-  // VideoRendererSink::RenderCallback implementation.
-  MOCK_METHOD3(Render, scoped_refptr<VideoFrame>(base::TimeTicks,
-                                                 base::TimeTicks, bool));
-  MOCK_METHOD0(OnFrameDropped, void());
-
-  void StartVideoRendererSink() {
-    EXPECT_CALL(*this, StartRendering());
-    const bool had_current_frame = !!compositor_->GetCurrentFrame();
-    compositor()->Start(this);
-    // If we previously had a frame, we should still have one now.
-    EXPECT_EQ(had_current_frame, !!compositor_->GetCurrentFrame());
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void StopVideoRendererSink(bool have_client) {
-    if (have_client) EXPECT_CALL(*this, StopRendering());
-    const bool had_current_frame = !!compositor_->GetCurrentFrame();
-    compositor()->Stop();
-    // If we previously had a frame, we should still have one now.
-    EXPECT_EQ(had_current_frame, !!compositor_->GetCurrentFrame());
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void RenderFrame() {
-    compositor()->GetCurrentFrame();
-    compositor()->PutCurrentFrame();
-  }
-
-  base::MessageLoop message_loop;
-  base::SimpleTestTickClock* tick_clock_;  // Owned by |compositor_|
-  std::unique_ptr<VideoFrameCompositor> compositor_;
-
-  int did_receive_frame_count_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest);
-};
-
-TEST_F(VideoFrameCompositorTest, InitialValues) {
-  EXPECT_FALSE(compositor()->GetCurrentFrame().get());
-}
-
-TEST_F(VideoFrameCompositorTest, PaintSingleFrame) {
-  scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame();
-
-  // Should notify compositor synchronously.
-  EXPECT_EQ(0, did_receive_frame_count());
-  compositor()->PaintSingleFrame(expected);
-  scoped_refptr<VideoFrame> actual = compositor()->GetCurrentFrame();
-  EXPECT_EQ(expected, actual);
-  EXPECT_EQ(1, did_receive_frame_count());
-}
-
-TEST_F(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) {
-  scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
-
-  EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame));
-  StartVideoRendererSink();
-
-  EXPECT_TRUE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  // Another call should trigger a dropped frame callback.
-  EXPECT_CALL(*this, OnFrameDropped());
-  EXPECT_FALSE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  // Ensure it always happens until the frame is rendered.
-  EXPECT_CALL(*this, OnFrameDropped());
-  EXPECT_FALSE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  // Call GetCurrentFrame() but not PutCurrentFrame()
-  compositor()->GetCurrentFrame();
-
-  // The frame should still register as dropped until PutCurrentFrame is called.
-  EXPECT_CALL(*this, OnFrameDropped());
-  EXPECT_FALSE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  RenderFrame();
-  EXPECT_FALSE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  StopVideoRendererSink(true);
-}
-
-TEST_F(VideoFrameCompositorTest, VideoLayerShutdownWhileRendering) {
-  EXPECT_CALL(*this, Render(_, _, true)).WillOnce(Return(NULL));
-  StartVideoRendererSink();
-  compositor_->SetVideoFrameProviderClient(NULL);
-  StopVideoRendererSink(false);
-}
-
-TEST_F(VideoFrameCompositorTest, StartFiresBackgroundRender) {
-  scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
-  EXPECT_CALL(*this, Render(_, _, true)).WillRepeatedly(Return(opaque_frame));
-  StartVideoRendererSink();
-  StopVideoRendererSink(true);
-}
-
-TEST_F(VideoFrameCompositorTest, BackgroundRenderTicks) {
-  scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
-  compositor_->set_background_rendering_for_testing(true);
-
-  base::RunLoop run_loop;
-  EXPECT_CALL(*this, Render(_, _, true))
-      .WillOnce(Return(opaque_frame))
-      .WillOnce(
-          DoAll(RunClosure(run_loop.QuitClosure()), Return(opaque_frame)));
-  StartVideoRendererSink();
-  run_loop.Run();
-
-  // UpdateCurrentFrame() calls should indicate they are not synthetic.
-  EXPECT_CALL(*this, Render(_, _, false)).WillOnce(Return(opaque_frame));
-  EXPECT_FALSE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  // Background rendering should tick another render callback.
-  StopVideoRendererSink(true);
-}
-
-TEST_F(VideoFrameCompositorTest,
-       UpdateCurrentFrameWorksWhenBackgroundRendered) {
-  scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
-  compositor_->set_background_rendering_for_testing(true);
-
-  // Background render a frame that succeeds immediately.
-  EXPECT_CALL(*this, Render(_, _, true)).WillOnce(Return(opaque_frame));
-  StartVideoRendererSink();
-
-  // The background render completes immediately, so the next call to
-  // UpdateCurrentFrame is expected to return true to account for the frame
-  // rendered in the background.
-  EXPECT_CALL(*this, Render(_, _, false))
-      .WillOnce(Return(scoped_refptr<VideoFrame>(opaque_frame)));
-  EXPECT_TRUE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-  RenderFrame();
-
-  // Second call to UpdateCurrentFrame will return false as no new frame has
-  // been created since the last call.
-  EXPECT_CALL(*this, Render(_, _, false))
-      .WillOnce(Return(scoped_refptr<VideoFrame>(opaque_frame)));
-  EXPECT_FALSE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  StopVideoRendererSink(true);
-}
-
-TEST_F(VideoFrameCompositorTest, GetCurrentFrameAndUpdateIfStale) {
-  scoped_refptr<VideoFrame> opaque_frame_1 = CreateOpaqueFrame();
-  scoped_refptr<VideoFrame> opaque_frame_2 = CreateOpaqueFrame();
-  compositor_->set_background_rendering_for_testing(true);
-
-  // |current_frame_| should be null at this point since we don't have a client
-  // or a callback.
-  ASSERT_FALSE(compositor()->GetCurrentFrameAndUpdateIfStale());
-
-  // Starting the video renderer should return a single frame.
-  EXPECT_CALL(*this, Render(_, _, true)).WillOnce(Return(opaque_frame_1));
-  StartVideoRendererSink();
-
-  // Since we have a client, this call should not call background render, even
-  // if a lot of time has elapsed between calls.
-  tick_clock_->Advance(base::TimeDelta::FromSeconds(1));
-  ASSERT_EQ(opaque_frame_1, compositor()->GetCurrentFrameAndUpdateIfStale());
-
-  // An update current frame call should stop background rendering.
-  EXPECT_CALL(*this, Render(_, _, false)).WillOnce(Return(opaque_frame_2));
-  EXPECT_TRUE(
-      compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
-
-  // This call should still not call background render.
-  ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale());
-
-  testing::Mock::VerifyAndClearExpectations(this);
-
-  // Clear our client, which means no mock function calls for Client.
-  compositor()->SetVideoFrameProviderClient(NULL);
-
-  // This call should still not call background render, because we aren't in the
-  // background rendering state yet.
-  ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale());
-
-  // Wait for background rendering to tick again.
-  base::RunLoop run_loop;
-  EXPECT_CALL(*this, Render(_, _, true))
-      .WillOnce(
-          DoAll(RunClosure(run_loop.QuitClosure()), Return(opaque_frame_1)))
-      .WillOnce(Return(opaque_frame_2));
-  run_loop.Run();
-
-  // This call should still not call background render, because not enough time
-  // has elapsed since the last background render call.
-  ASSERT_EQ(opaque_frame_1, compositor()->GetCurrentFrameAndUpdateIfStale());
-
-  // Advancing the tick clock should allow a new frame to be requested.
-  tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10));
-  ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale());
-
-  // Background rendering should tick another render callback.
-  StopVideoRendererSink(false);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/watch_time_reporter.cc b/src/cobalt/media/blink/watch_time_reporter.cc
deleted file mode 100644
index 71cad45..0000000
--- a/src/cobalt/media/blink/watch_time_reporter.cc
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cobalt/media/blink/watch_time_reporter.h"
-
-#include "base/power_monitor/power_monitor.h"
-
-namespace cobalt {
-namespace media {
-
-// The minimum amount of media playback which can elapse before we'll report
-// watch time metrics for a playback.
-constexpr base::TimeDelta kMinimumElapsedWatchTime =
-    base::TimeDelta::FromSeconds(7);
-
-// The minimum width and height of videos to report watch time metrics for.
-constexpr gfx::Size kMinimumVideoSize = gfx::Size(200, 200);
-
-static bool IsOnBatteryPower() {
-  if (base::PowerMonitor* pm = base::PowerMonitor::Get())
-    return pm->IsOnBatteryPower();
-  return false;
-}
-
-WatchTimeReporter::WatchTimeReporter(bool has_audio, bool has_video,
-                                     bool is_mse, bool is_encrypted,
-                                     scoped_refptr<MediaLog> media_log,
-                                     const gfx::Size& initial_video_size,
-                                     const GetMediaTimeCB& get_media_time_cb)
-    : has_audio_(has_audio),
-      has_video_(has_video),
-      is_mse_(is_mse),
-      is_encrypted_(is_encrypted),
-      media_log_(std::move(media_log)),
-      initial_video_size_(initial_video_size),
-      get_media_time_cb_(get_media_time_cb) {
-  DCHECK(!get_media_time_cb_.is_null());
-  DCHECK(has_audio_ || has_video_);
-  if (has_video_) DCHECK(!initial_video_size_.IsEmpty());
-
-  if (base::PowerMonitor* pm = base::PowerMonitor::Get()) pm->AddObserver(this);
-}
-
-WatchTimeReporter::~WatchTimeReporter() {
-  // If the timer is still running, finalize immediately, this is our last
-  // chance to capture metrics.
-  if (reporting_timer_.IsRunning())
-    MaybeFinalizeWatchTime(FinalizeTime::IMMEDIATELY);
-
-  if (base::PowerMonitor* pm = base::PowerMonitor::Get())
-    pm->RemoveObserver(this);
-}
-
-void WatchTimeReporter::OnPlaying() {
-  is_playing_ = true;
-  MaybeStartReportingTimer(get_media_time_cb_.Run());
-}
-
-void WatchTimeReporter::OnPaused() {
-  is_playing_ = false;
-  MaybeFinalizeWatchTime(FinalizeTime::ON_NEXT_UPDATE);
-}
-
-void WatchTimeReporter::OnSeeking() {
-  if (!reporting_timer_.IsRunning()) return;
-
-  // Seek is a special case that does not have hysteresis, when this is called
-  // the seek is imminent, so finalize the previous playback immediately.
-
-  // Don't trample an existing end timestamp.
-  if (end_timestamp_ == kNoTimestamp) end_timestamp_ = get_media_time_cb_.Run();
-  UpdateWatchTime();
-}
-
-void WatchTimeReporter::OnVolumeChange(double volume) {
-  const double old_volume = volume_;
-  volume_ = volume;
-
-  // We're only interesting in transitions in and out of the muted state.
-  if (!old_volume && volume)
-    MaybeStartReportingTimer(get_media_time_cb_.Run());
-  else if (old_volume && !volume_)
-    MaybeFinalizeWatchTime(FinalizeTime::ON_NEXT_UPDATE);
-}
-
-void WatchTimeReporter::OnShown() {
-  is_visible_ = true;
-  MaybeStartReportingTimer(get_media_time_cb_.Run());
-}
-
-void WatchTimeReporter::OnHidden() {
-  is_visible_ = false;
-  MaybeFinalizeWatchTime(FinalizeTime::ON_NEXT_UPDATE);
-}
-
-void WatchTimeReporter::OnPowerStateChange(bool on_battery_power) {
-  if (!reporting_timer_.IsRunning()) return;
-
-  // Defer changing |is_on_battery_power_| until the next watch time report to
-  // avoid momentary power changes from affecting the results.
-  if (is_on_battery_power_ != on_battery_power) {
-    end_timestamp_for_power_ = get_media_time_cb_.Run();
-
-    // Restart the reporting timer so the full hysteresis is afforded.
-    reporting_timer_.Start(FROM_HERE, reporting_interval_, this,
-                           &WatchTimeReporter::UpdateWatchTime);
-    return;
-  }
-
-  end_timestamp_for_power_ = kNoTimestamp;
-}
-
-bool WatchTimeReporter::ShouldReportWatchTime() {
-  // Only report watch time for media of sufficient size with both audio and
-  // video tracks present.
-  return has_audio_ && has_video_ &&
-         initial_video_size_.height() >= kMinimumVideoSize.height() &&
-         initial_video_size_.width() >= kMinimumVideoSize.width();
-}
-
-void WatchTimeReporter::MaybeStartReportingTimer(
-    base::TimeDelta start_timestamp) {
-  // Don't start the timer if any of our state indicates we shouldn't; this
-  // check is important since the various event handlers do not have to care
-  // about the state of other events.
-  if (!ShouldReportWatchTime() || !is_playing_ || !volume_ || !is_visible_) {
-    // If we reach this point the timer should already have been stopped or
-    // there is a pending finalize in flight.
-    DCHECK(!reporting_timer_.IsRunning() || end_timestamp_ != kNoTimestamp);
-    return;
-  }
-
-  // If we haven't finalized the last watch time metrics yet, count this
-  // playback as a continuation of the previous metrics.
-  if (end_timestamp_ != kNoTimestamp) {
-    DCHECK(reporting_timer_.IsRunning());
-    end_timestamp_ = kNoTimestamp;
-    return;
-  }
-
-  // Don't restart the timer if it's already running.
-  if (reporting_timer_.IsRunning()) return;
-
-  last_media_timestamp_ = end_timestamp_for_power_ = kNoTimestamp;
-  is_on_battery_power_ = IsOnBatteryPower();
-  start_timestamp_ = start_timestamp_for_power_ = start_timestamp;
-  reporting_timer_.Start(FROM_HERE, reporting_interval_, this,
-                         &WatchTimeReporter::UpdateWatchTime);
-}
-
-void WatchTimeReporter::MaybeFinalizeWatchTime(FinalizeTime finalize_time) {
-  // Don't finalize if the timer is already stopped.
-  if (!reporting_timer_.IsRunning()) return;
-
-  // Don't trample an existing finalize; the first takes precedence.
-  if (end_timestamp_ == kNoTimestamp) end_timestamp_ = get_media_time_cb_.Run();
-
-  if (finalize_time == FinalizeTime::IMMEDIATELY) {
-    UpdateWatchTime();
-    return;
-  }
-
-  // Always restart the timer when finalizing, so that we allow for the full
-  // length of |kReportingInterval| to elapse for hysteresis purposes.
-  DCHECK_EQ(finalize_time, FinalizeTime::ON_NEXT_UPDATE);
-  reporting_timer_.Start(FROM_HERE, reporting_interval_, this,
-                         &WatchTimeReporter::UpdateWatchTime);
-}
-
-void WatchTimeReporter::UpdateWatchTime() {
-  DCHECK(ShouldReportWatchTime());
-
-  const bool is_finalizing = end_timestamp_ != kNoTimestamp;
-  const bool is_power_change_pending = end_timestamp_for_power_ != kNoTimestamp;
-
-  // If we're finalizing the log, use the media time value at the time of
-  // finalization.
-  const base::TimeDelta current_timestamp =
-      is_finalizing ? end_timestamp_ : get_media_time_cb_.Run();
-  const base::TimeDelta elapsed = current_timestamp - start_timestamp_;
-
-  // Only report watch time after some minimum amount has elapsed. Don't update
-  // watch time if media time hasn't changed since the last run; this may occur
-  // if a seek is taking some time to complete or the playback is stalled for
-  // some reason.
-  if (elapsed >= kMinimumElapsedWatchTime &&
-      last_media_timestamp_ != current_timestamp) {
-    last_media_timestamp_ = current_timestamp;
-
-    std::unique_ptr<MediaLogEvent> log_event =
-        media_log_->CreateEvent(MediaLogEvent::Type::WATCH_TIME_UPDATE);
-
-    log_event->params.SetDoubleWithoutPathExpansion(
-        MediaLog::kWatchTimeAudioVideoAll, elapsed.InSecondsF());
-    if (is_mse_) {
-      log_event->params.SetDoubleWithoutPathExpansion(
-          MediaLog::kWatchTimeAudioVideoMse, elapsed.InSecondsF());
-    } else {
-      log_event->params.SetDoubleWithoutPathExpansion(
-          MediaLog::kWatchTimeAudioVideoSrc, elapsed.InSecondsF());
-    }
-    if (is_encrypted_) {
-      log_event->params.SetDoubleWithoutPathExpansion(
-          MediaLog::kWatchTimeAudioVideoEme, elapsed.InSecondsF());
-    }
-
-    // Record watch time using the last known value for |is_on_battery_power_|;
-    // if there's a |pending_power_change_| use that to accurately finalize the
-    // last bits of time in the previous bucket.
-    const base::TimeDelta elapsed_power =
-        (is_power_change_pending ? end_timestamp_for_power_
-                                 : current_timestamp) -
-        start_timestamp_for_power_;
-
-    // Again, only update watch time if enough time has elapsed; we need to
-    // recheck the elapsed time here since the power source can change anytime.
-    if (elapsed_power >= kMinimumElapsedWatchTime) {
-      if (is_on_battery_power_) {
-        log_event->params.SetDoubleWithoutPathExpansion(
-            MediaLog::kWatchTimeAudioVideoBattery, elapsed_power.InSecondsF());
-      } else {
-        log_event->params.SetDoubleWithoutPathExpansion(
-            MediaLog::kWatchTimeAudioVideoAc, elapsed_power.InSecondsF());
-      }
-    }
-
-    if (is_finalizing)
-      log_event->params.SetBoolean(MediaLog::kWatchTimeFinalize, true);
-    else if (is_power_change_pending)
-      log_event->params.SetBoolean(MediaLog::kWatchTimeFinalizePower, true);
-
-    DVLOG(2) << "Sending watch time update.";
-    media_log_->AddEvent(std::move(log_event));
-  }
-
-  if (is_power_change_pending) {
-    // Invert battery power status here instead of using the value returned by
-    // the PowerObserver since there may be a pending OnPowerStateChange().
-    is_on_battery_power_ = !is_on_battery_power_;
-
-    start_timestamp_for_power_ = end_timestamp_for_power_;
-    end_timestamp_for_power_ = kNoTimestamp;
-  }
-
-  // Stop the timer if this is supposed to be our last tick.
-  if (is_finalizing) {
-    end_timestamp_ = kNoTimestamp;
-    reporting_timer_.Stop();
-  }
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/watch_time_reporter.h b/src/cobalt/media/blink/watch_time_reporter.h
deleted file mode 100644
index 2459214..0000000
--- a/src/cobalt/media/blink/watch_time_reporter.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_WATCH_TIME_REPORTER_H_
-#define COBALT_MEDIA_BLINK_WATCH_TIME_REPORTER_H_
-
-#include "base/callback.h"
-#include "base/power_monitor/power_observer.h"
-#include "base/time.h"
-#include "base/timer/timer.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/base/timestamp_constants.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "ui/gfx/size.h"
-
-namespace cobalt {
-namespace media {
-
-// Class for monitoring and reporting watch time in response to various state
-// changes during the playback of media. At present we are only recording the
-// watch time for audio+video playbacks.
-// TODO(dalecurtis): We want to introduce a similar "listening time" metric in
-// the near future to track audio only cases.
-//
-// Watch time for our purposes is defined as the amount of elapsed media time
-// for audio+video media. A minimum of 7 seconds of unmuted, foreground media
-// must be watched to start watch time monitoring. Watch time is checked every
-// 5 seconds from then on and reported to multiple buckets: All, MSE, SRC, EME,
-// AC, and battery.
-//
-// Any one of paused, hidden, or muted is sufficient to stop watch time metric
-// reports. Each of these has a hysteresis where if the state change is undone
-// within 5 seconds, the watch time will be counted as uninterrupted.
-//
-// Power events (on/off battery power) have a similar hysteresis, but unlike
-// the aforementioned properties, will not stop metric collection.
-//
-// Each seek event will result in a new watch time metric being started and the
-// old metric finalized as accurately as possible.
-class MEDIA_BLINK_EXPORT WatchTimeReporter : base::PowerObserver {
- public:
-  using GetMediaTimeCB = base::Callback<base::TimeDelta(void)>;
-
-  // Constructor for the reporter; all requested metadata should be fully known
-  // before attempting construction as incorrect values will result in the wrong
-  // watch time metrics being reported.
-  //
-  // |media_log| is used to continuously log the watch time values for eventual
-  // recording to a histogram upon finalization.
-  //
-  // |initial_video_size| required to ensure that the video track has sufficient
-  // size for watch time reporting.
-  //
-  // |get_media_time_cb| must return the current playback time in terms of media
-  // time, not wall clock time! Using media time instead of wall clock time
-  // allows us to avoid a whole class of issues around clock changes during
-  // suspend and resume.
-  // TODO(dalecurtis): Should we only report when rate == 1.0? Should we scale
-  // the elapsed media time instead?
-  WatchTimeReporter(bool has_audio, bool has_video, bool is_mse,
-                    bool is_encrypted, scoped_refptr<MediaLog> media_log,
-                    const gfx::Size& initial_video_size,
-                    const GetMediaTimeCB& get_media_time_cb);
-  ~WatchTimeReporter() OVERRIDE;
-
-  // These methods are used to ensure that watch time is only reported for
-  // media that is actually playing. They should be called whenever the media
-  // starts or stops playing for any reason.
-  void OnPlaying();
-  void OnPaused();
-
-  // This will immediately finalize any outstanding watch time reports and stop
-  // the reporting timer. Clients should call OnPlaying() upon seek completion
-  // to restart the reporting timer.
-  void OnSeeking();
-
-  // This method is used to ensure that watch time is only reported for media
-  // that is actually audible to the user. It should be called whenever the
-  // volume changes.
-  //
-  // Note: This does not catch all cases. E.g., headphones that are being
-  // listened too, or even OS level volume state.
-  void OnVolumeChange(double volume);
-
-  // These methods are used to ensure that watch time is only reported for
-  // videos that are actually visible to the user. They should be called when
-  // the video is shown or hidden respectively.
-  //
-  // TODO(dalecurtis): At present, this is only called when the entire content
-  // window goes into the foreground or background respectively; i.e. it does
-  // not catch cases where the video is in the foreground but out of the view
-  // port. We need a method for rejecting out of view port videos.
-  void OnShown();
-  void OnHidden();
-
- private:
-  friend class WatchTimeReporterTest;
-
-  // base::PowerObserver implementation.
-  //
-  // We only observe power source changes. We don't need to observe suspend and
-  // resume events because we report watch time in terms of elapsed media time
-  // and not in terms of elapsed real time.
-  void OnPowerStateChange(bool on_battery_power) OVERRIDE;
-
-  bool ShouldReportWatchTime();
-  void MaybeStartReportingTimer(base::TimeDelta start_timestamp);
-  enum class FinalizeTime { IMMEDIATELY, ON_NEXT_UPDATE };
-  void MaybeFinalizeWatchTime(FinalizeTime finalize_time);
-  void UpdateWatchTime();
-
-  // Initialized during construction.
-  const bool has_audio_;
-  const bool has_video_;
-  const bool is_mse_;
-  const bool is_encrypted_;
-  scoped_refptr<MediaLog> media_log_;
-  const gfx::Size initial_video_size_;
-  const GetMediaTimeCB get_media_time_cb_;
-
-  // The amount of time between each UpdateWatchTime(); this is the frequency by
-  // which the watch times are updated. In the event of a process crash or kill
-  // this is also the most amount of watch time that we might lose.
-  base::TimeDelta reporting_interval_ = base::TimeDelta::FromSeconds(5);
-
-  base::RepeatingTimer reporting_timer_;
-
-  // Updated by the OnXXX() methods above.
-  bool is_on_battery_power_ = false;
-  bool is_playing_ = false;
-  bool is_visible_ = true;
-  double volume_ = 1.0;
-
-  // The last media timestamp seen by UpdateWatchTime().
-  base::TimeDelta last_media_timestamp_ = kNoTimestamp;
-
-  // The starting and ending timestamps used for reporting watch time.
-  base::TimeDelta start_timestamp_;
-  base::TimeDelta end_timestamp_ = kNoTimestamp;
-
-  // Similar to the above but tracks watch time relative to whether or not
-  // battery or AC power is being used.
-  base::TimeDelta start_timestamp_for_power_;
-  base::TimeDelta end_timestamp_for_power_ = kNoTimestamp;
-
-  DISALLOW_COPY_AND_ASSIGN(WatchTimeReporter);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WATCH_TIME_REPORTER_H_
diff --git a/src/cobalt/media/blink/watch_time_reporter_unittest.cc b/src/cobalt/media/blink/watch_time_reporter_unittest.cc
deleted file mode 100644
index 09c23de..0000000
--- a/src/cobalt/media/blink/watch_time_reporter_unittest.cc
+++ /dev/null
@@ -1,548 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <memory>
-
-#include <string>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/run_loop.h"
-#include "base/test/test_message_loop.h"
-#include "cobalt/media/base/mock_media_log.h"
-#include "cobalt/media/blink/watch_time_reporter.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-
-constexpr gfx::Size kSizeJustRight = gfx::Size(201, 201);
-
-#define EXPECT_WATCH_TIME(key, value) \
-  EXPECT_CALL(*media_log_, OnWatchTimeUpdate(key, value)).RetiresOnSaturation();
-
-#define EXPECT_WATCH_TIME_FINALIZED() \
-  EXPECT_CALL(*media_log_, OnWatchTimeFinalized()).RetiresOnSaturation();
-
-#define EXPECT_POWER_WATCH_TIME_FINALIZED() \
-  EXPECT_CALL(*media_log_, OnPowerWatchTimeFinalized()).RetiresOnSaturation();
-
-class WatchTimeReporterTest : public testing::Test {
- public:
-  WatchTimeReporterTest()
-      : media_log_(new testing::StrictMock<WatchTimeLogMonitor>()) {}
-  ~WatchTimeReporterTest() override {}
-
- protected:
-  class WatchTimeLogMonitor : public MediaLog {
-   public:
-    WatchTimeLogMonitor() {}
-
-    void AddEvent(std::unique_ptr<MediaLogEvent> event) override {
-      ASSERT_EQ(event->type, MediaLogEvent::Type::WATCH_TIME_UPDATE);
-
-      for (base::DictionaryValue::Iterator it(event->params); !it.IsAtEnd();
-           it.Advance()) {
-        bool finalize;
-        if (it.value().GetAsBoolean(&finalize)) {
-          if (it.key() == MediaLog::kWatchTimeFinalize)
-            OnWatchTimeFinalized();
-          else
-            OnPowerWatchTimeFinalized();
-          continue;
-        }
-
-        double in_seconds;
-        ASSERT_TRUE(it.value().GetAsDouble(&in_seconds));
-        OnWatchTimeUpdate(it.key(), base::TimeDelta::FromSecondsD(in_seconds));
-      }
-    }
-
-    MOCK_METHOD0(OnWatchTimeFinalized, void(void));
-    MOCK_METHOD0(OnPowerWatchTimeFinalized, void(void));
-    MOCK_METHOD2(OnWatchTimeUpdate, void(const std::string&, base::TimeDelta));
-
-   protected:
-    ~WatchTimeLogMonitor() override {}
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(WatchTimeLogMonitor);
-  };
-
-  void Initialize(bool has_audio, bool has_video, bool is_mse,
-                  bool is_encrypted, const gfx::Size& initial_video_size) {
-    wtr_.reset(new WatchTimeReporter(
-        has_audio, has_video, is_mse, is_encrypted, media_log_,
-        initial_video_size,
-        base::Bind(&WatchTimeReporterTest::GetCurrentMediaTime,
-                   base::Unretained(this))));
-
-    // Setup the reporting interval to be immediate to avoid spinning real time
-    // within the unit test.
-    wtr_->reporting_interval_ = base::TimeDelta();
-  }
-
-  void CycleReportingTimer() {
-    base::RunLoop run_loop;
-    message_loop_.task_runner()->PostTask(FROM_HERE, run_loop.QuitClosure());
-    run_loop.Run();
-  }
-
-  bool IsMonitoring() { return wtr_->reporting_timer_.IsRunning(); }
-
-  // We call directly into the reporter for this instead of using an actual
-  // PowerMonitorTestSource since that results in a posted tasks which interfere
-  // with our ability to test the timer.
-  void SetOnBatteryPower(bool on_battery_power) {
-    wtr_->is_on_battery_power_ = on_battery_power;
-  }
-
-  void OnPowerStateChange(bool on_battery_power) {
-    wtr_->OnPowerStateChange(on_battery_power);
-  }
-
-  enum {
-    // After |test_callback_func| is executed, should watch time continue to
-    // accumulate?
-    kAccumulationContinuesAfterTest = 1,
-
-    // |test_callback_func| for hysteresis tests enters and exits finalize mode
-    // for watch time, not all exits require a new current time update.
-    kFinalizeExitDoesNotRequireCurrentTime = 2,
-
-    // During finalize the watch time should not continue on the starting power
-    // metric. By default this means the AC metric will be finalized, but if
-    // used with |kStartOnBattery| it will be the battery metric.
-    kFinalizePowerWatchTime = 4,
-
-    // During finalize the watch time should continue on the metric opposite the
-    // starting metric (by default it's AC, it's battery if |kStartOnBattery| is
-    // specified.
-    kTransitionPowerWatchTime = 8,
-
-    // Indicates that power watch time should be reported to the battery metric.
-    kStartOnBattery = 16,
-
-    // Indicates an extra start event may be generated during test execution.
-    kFinalizeInterleavedStartEvent = 32,
-  };
-
-  template <int TestFlags = 0, typename HysteresisTestCallback>
-  void RunHysteresisTest(HysteresisTestCallback test_callback_func) {
-    Initialize(true, true, false, false, kSizeJustRight);
-
-    // Setup all current time expectations first since they need to use the
-    // InSequence macro for ease of use, but we don't want the watch time
-    // expectations to be in sequence (or expectations would depend on sorted
-    // order of histogram names).
-    constexpr base::TimeDelta kWatchTime1 = base::TimeDelta::FromSeconds(10);
-    constexpr base::TimeDelta kWatchTime2 = base::TimeDelta::FromSeconds(12);
-    constexpr base::TimeDelta kWatchTime3 = base::TimeDelta::FromSeconds(15);
-    constexpr base::TimeDelta kWatchTime4 = base::TimeDelta::FromSeconds(30);
-    {
-      testing::InSequence s;
-      EXPECT_CALL(*this, GetCurrentMediaTime())
-          .WillOnce(testing::Return(base::TimeDelta()))
-          .WillOnce(testing::Return(kWatchTime1));
-
-      // Setup conditions depending on if the test will not resume watch time
-      // accumulation or not; i.e. the finalize criteria will not be undone
-      // within the hysteresis time.
-      if (TestFlags & kAccumulationContinuesAfterTest) {
-        EXPECT_CALL(*this, GetCurrentMediaTime())
-            .Times(TestFlags & (kFinalizeExitDoesNotRequireCurrentTime |
-                                kFinalizePowerWatchTime)
-                       ? 1
-                       : 2)
-            .WillRepeatedly(testing::Return(kWatchTime2));
-        EXPECT_CALL(*this, GetCurrentMediaTime())
-            .WillOnce(testing::Return(kWatchTime3));
-      } else {
-        // Current time should be requested when entering the finalize state.
-        EXPECT_CALL(*this, GetCurrentMediaTime())
-            .Times(TestFlags & kFinalizeInterleavedStartEvent ? 2 : 1)
-            .WillRepeatedly(testing::Return(kWatchTime2));
-      }
-
-      if (TestFlags & kTransitionPowerWatchTime) {
-        EXPECT_CALL(*this, GetCurrentMediaTime())
-            .WillOnce(testing::Return(kWatchTime4));
-      }
-    }
-
-    wtr_->OnPlaying();
-    EXPECT_TRUE(IsMonitoring());
-    if (TestFlags & kStartOnBattery)
-      SetOnBatteryPower(true);
-    else
-      ASSERT_FALSE(wtr_->is_on_battery_power_);
-
-    EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime1);
-    EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoSrc, kWatchTime1);
-    EXPECT_WATCH_TIME(TestFlags & kStartOnBattery
-                          ? MediaLog::kWatchTimeAudioVideoBattery
-                          : MediaLog::kWatchTimeAudioVideoAc,
-                      kWatchTime1);
-    CycleReportingTimer();
-
-    // Invoke the test.
-    test_callback_func();
-
-    const base::TimeDelta kExpectedWatchTime =
-        TestFlags & kAccumulationContinuesAfterTest ? kWatchTime3 : kWatchTime2;
-
-    EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kExpectedWatchTime);
-    EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoSrc, kExpectedWatchTime);
-    EXPECT_WATCH_TIME(
-        TestFlags & kStartOnBattery ? MediaLog::kWatchTimeAudioVideoBattery
-                                    : MediaLog::kWatchTimeAudioVideoAc,
-        TestFlags & kFinalizePowerWatchTime ? kWatchTime2 : kExpectedWatchTime);
-
-    // If we're not testing battery watch time, this is the end of the test.
-    if (!(TestFlags & kTransitionPowerWatchTime)) {
-      EXPECT_WATCH_TIME_FINALIZED();
-      wtr_.reset();
-      return;
-    }
-
-    ASSERT_TRUE(TestFlags & kAccumulationContinuesAfterTest)
-        << "kTransitionPowerWatchTime tests must be done with "
-           "kAccumulationContinuesAfterTest";
-
-    EXPECT_POWER_WATCH_TIME_FINALIZED();
-    CycleReportingTimer();
-
-    // Run one last cycle that is long enough to trigger a new watch time entry
-    // on the opposite of the current power watch time graph; i.e. if we started
-    // on battery we'll now record one for ac and vice versa.
-    EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime4);
-    EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoSrc, kWatchTime4);
-    EXPECT_WATCH_TIME(TestFlags & kStartOnBattery
-                          ? MediaLog::kWatchTimeAudioVideoAc
-                          : MediaLog::kWatchTimeAudioVideoBattery,
-                      kWatchTime4 - kWatchTime2);
-    EXPECT_WATCH_TIME_FINALIZED();
-    wtr_.reset();
-  }
-
-  MOCK_METHOD0(GetCurrentMediaTime, base::TimeDelta());
-
-  base::TestMessageLoop message_loop_;
-  scoped_refptr<testing::StrictMock<WatchTimeLogMonitor>> media_log_;
-  std::unique_ptr<WatchTimeReporter> wtr_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WatchTimeReporterTest);
-};
-
-// Tests that watch time reporting is appropriately enabled or disabled.
-TEST_F(WatchTimeReporterTest, WatchTimeReporter) {
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillRepeatedly(testing::Return(base::TimeDelta()));
-
-  Initialize(false, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_FALSE(IsMonitoring());
-
-  Initialize(true, false, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_FALSE(IsMonitoring());
-
-  constexpr gfx::Size kSizeTooSmall = gfx::Size(100, 100);
-  Initialize(true, true, true, true, kSizeTooSmall);
-  wtr_->OnPlaying();
-  EXPECT_FALSE(IsMonitoring());
-
-  Initialize(true, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  Initialize(true, true, false, false, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  Initialize(true, true, true, false, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-}
-
-// Tests that basic reporting for the all category works.
-TEST_F(WatchTimeReporterTest, WatchTimeReporterBasic) {
-  constexpr base::TimeDelta kWatchTimeEarly = base::TimeDelta::FromSeconds(5);
-  constexpr base::TimeDelta kWatchTimeLate = base::TimeDelta::FromSeconds(10);
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTimeEarly))
-      .WillRepeatedly(testing::Return(kWatchTimeLate));
-  Initialize(true, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  // No log should have been generated yet since the message loop has not had
-  // any chance to pump.
-  CycleReportingTimer();
-
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTimeLate);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTimeLate);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoEme, kWatchTimeLate);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoMse, kWatchTimeLate);
-  CycleReportingTimer();
-}
-// Tests that starting from a non-zero base works.
-TEST_F(WatchTimeReporterTest, WatchTimeReporterNonZeroStart) {
-  constexpr base::TimeDelta kWatchTime1 = base::TimeDelta::FromSeconds(5);
-  constexpr base::TimeDelta kWatchTime2 = base::TimeDelta::FromSeconds(15);
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(kWatchTime1))
-      .WillRepeatedly(testing::Return(kWatchTime2));
-  Initialize(true, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  const base::TimeDelta kWatchTime = kWatchTime2 - kWatchTime1;
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoEme, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoMse, kWatchTime);
-  CycleReportingTimer();
-}
-
-// Tests that seeking causes an immediate finalization.
-TEST_F(WatchTimeReporterTest, SeekFinalizes) {
-  constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(10);
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoEme, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoMse, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_->OnSeeking();
-}
-
-// Tests that seeking causes an immediate finalization, but does not trample a
-// previously set finalize time.
-TEST_F(WatchTimeReporterTest, SeekFinalizeDoesNotTramplePreviousFinalize) {
-  constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(10);
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoEme, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoMse, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_->OnPaused();
-  wtr_->OnSeeking();
-}
-
-// Tests that watch time is finalized upon destruction.
-TEST_F(WatchTimeReporterTest, WatchTimeReporterFinalizeOnDestruction) {
-  constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(10);
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, true, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-
-  // Finalize the histogram before any cycles of the timer have run.
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoEme, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoMse, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_.reset();
-}
-
-// Tests that watch time categories are mapped correctly.
-TEST_F(WatchTimeReporterTest, WatchTimeCategoryMapping) {
-  constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(10);
-
-  // Verify ac, all, src
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, false, false, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoSrc, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_.reset();
-
-  // Verify ac, all, mse
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, true, false, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoMse, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_.reset();
-
-  // Verify ac, all, eme, src
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, false, true, kSizeJustRight);
-  wtr_->OnPlaying();
-  EXPECT_TRUE(IsMonitoring());
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAc, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoEme, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoSrc, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_.reset();
-
-  // Verify all, battery, src
-  EXPECT_CALL(*this, GetCurrentMediaTime())
-      .WillOnce(testing::Return(base::TimeDelta()))
-      .WillOnce(testing::Return(kWatchTime));
-  Initialize(true, true, false, false, kSizeJustRight);
-  wtr_->OnPlaying();
-  SetOnBatteryPower(true);
-  EXPECT_TRUE(IsMonitoring());
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoAll, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoBattery, kWatchTime);
-  EXPECT_WATCH_TIME(MediaLog::kWatchTimeAudioVideoSrc, kWatchTime);
-  EXPECT_WATCH_TIME_FINALIZED();
-  wtr_.reset();
-}
-
-TEST_F(WatchTimeReporterTest, PlayPauseHysteresisContinuation) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest>([this]() {
-    wtr_->OnPaused();
-    wtr_->OnPlaying();
-  });
-}
-
-TEST_F(WatchTimeReporterTest, PlayPauseHysteresisFinalized) {
-  RunHysteresisTest([this]() { wtr_->OnPaused(); });
-}
-
-TEST_F(WatchTimeReporterTest, OnVolumeChangeHysteresisContinuation) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest>([this]() {
-    wtr_->OnVolumeChange(0);
-    wtr_->OnVolumeChange(1);
-  });
-}
-
-TEST_F(WatchTimeReporterTest, OnVolumeChangeHysteresisFinalized) {
-  RunHysteresisTest([this]() { wtr_->OnVolumeChange(0); });
-}
-
-TEST_F(WatchTimeReporterTest, OnShownHiddenHysteresisContinuation) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest>([this]() {
-    wtr_->OnHidden();
-    wtr_->OnShown();
-  });
-}
-
-TEST_F(WatchTimeReporterTest, OnShownHiddenHysteresisFinalized) {
-  RunHysteresisTest([this]() { wtr_->OnHidden(); });
-}
-
-TEST_F(WatchTimeReporterTest, OnPowerStateChangeHysteresisBatteryContinuation) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest |
-                    kFinalizeExitDoesNotRequireCurrentTime | kStartOnBattery>(
-      [this]() {
-        OnPowerStateChange(false);
-        OnPowerStateChange(true);
-      });
-}
-
-TEST_F(WatchTimeReporterTest, OnPowerStateChangeHysteresisBatteryFinalized) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest | kFinalizePowerWatchTime |
-                    kStartOnBattery>([this]() { OnPowerStateChange(false); });
-}
-
-TEST_F(WatchTimeReporterTest, OnPowerStateChangeHysteresisAcContinuation) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest |
-                    kFinalizeExitDoesNotRequireCurrentTime>([this]() {
-    OnPowerStateChange(true);
-    OnPowerStateChange(false);
-  });
-}
-
-TEST_F(WatchTimeReporterTest, OnPowerStateChangeHysteresisAcFinalized) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest | kFinalizePowerWatchTime>(
-      [this]() { OnPowerStateChange(true); });
-}
-
-TEST_F(WatchTimeReporterTest, OnPowerStateChangeBatteryTransitions) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest | kFinalizePowerWatchTime |
-                    kStartOnBattery | kTransitionPowerWatchTime>(
-      [this]() { OnPowerStateChange(false); });
-}
-
-TEST_F(WatchTimeReporterTest, OnPowerStateChangeAcTransitions) {
-  RunHysteresisTest<kAccumulationContinuesAfterTest | kFinalizePowerWatchTime |
-                    kTransitionPowerWatchTime>(
-      [this]() { OnPowerStateChange(true); });
-}
-
-// Tests that the first finalize is the only one that matters.
-TEST_F(WatchTimeReporterTest, HysteresisFinalizedWithEarliest) {
-  RunHysteresisTest([this]() {
-    wtr_->OnPaused();
-
-    // These subsequent "stop events" should do nothing since a finalize time
-    // has already been selected.
-    wtr_->OnHidden();
-    wtr_->OnVolumeChange(0);
-  });
-}
-
-// Tests that if a stop, stop, start sequence occurs, the middle stop is not
-// undone and thus finalize still occurs.
-TEST_F(WatchTimeReporterTest, HysteresisPartialExitStillFinalizes) {
-  auto stop_event = [this](size_t i) {
-    if (i == 0)
-      wtr_->OnPaused();
-    else if (i == 1)
-      wtr_->OnHidden();
-    else
-      wtr_->OnVolumeChange(0);
-  };
-
-  auto start_event = [this](size_t i) {
-    if (i == 0)
-      wtr_->OnPlaying();
-    else if (i == 1)
-      wtr_->OnShown();
-    else
-      wtr_->OnVolumeChange(1);
-  };
-
-  for (size_t i = 0; i < 3; ++i) {
-    for (size_t j = 0; j < 3; ++j) {
-      if (i == j) continue;
-
-      RunHysteresisTest<kFinalizeInterleavedStartEvent>(
-          [i, j, start_event, stop_event]() {
-            stop_event(i);
-            stop_event(j);
-            start_event(i);
-          });
-    }
-  }
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webaudiosourceprovider_impl.cc b/src/cobalt/media/blink/webaudiosourceprovider_impl.cc
deleted file mode 100644
index e994fc3..0000000
--- a/src/cobalt/media/blink/webaudiosourceprovider_impl.cc
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webaudiosourceprovider_impl.h"
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-#include "cobalt/media/base/bind_to_current_loop.h"
-#include "third_party/WebKit/public/platform/WebAudioSourceProviderClient.h"
-
-using blink::WebVector;
-
-namespace cobalt {
-namespace media {
-
-namespace {
-
-// Simple helper class for Try() locks.  Lock is Try()'d on construction and
-// must be checked via the locked() attribute.  If acquisition was successful
-// the lock will be released upon destruction.
-// TODO(dalecurtis): This should probably move to base/ if others start using
-// this pattern.
-class AutoTryLock {
- public:
-  explicit AutoTryLock(base::Lock& lock)
-      : lock_(lock), acquired_(lock_.Try()) {}
-
-  bool locked() const { return acquired_; }
-
-  ~AutoTryLock() {
-    if (acquired_) {
-      lock_.AssertAcquired();
-      lock_.Release();
-    }
-  }
-
- private:
-  base::Lock& lock_;
-  const bool acquired_;
-  DISALLOW_COPY_AND_ASSIGN(AutoTryLock);
-};
-
-}  // namespace
-
-// TeeFilter is a RenderCallback implementation that allows for a client to get
-// a copy of the data being rendered by the |renderer_| on Render(). This class
-// also holds on to the necessary audio parameters.
-class WebAudioSourceProviderImpl::TeeFilter
-    : public AudioRendererSink::RenderCallback {
- public:
-  TeeFilter() : renderer_(NULL), channels_(0), sample_rate_(0) {}
-  ~TeeFilter() override {}
-
-  void Initialize(AudioRendererSink::RenderCallback* renderer, int channels,
-                  int sample_rate) {
-    DCHECK(renderer);
-    renderer_ = renderer;
-    channels_ = channels;
-    sample_rate_ = sample_rate;
-  }
-
-  // AudioRendererSink::RenderCallback implementation.
-  // These are forwarders to |renderer_| and are here to allow for a client to
-  // get a copy of the rendered audio by SetCopyAudioCallback().
-  int Render(AudioBus* audio_bus, uint32_t frames_delayed,
-             uint32_t frames_skipped) OVERRIDE;
-  void OnRenderError() OVERRIDE;
-
-  bool IsInitialized() const { return !!renderer_; }
-  int channels() const { return channels_; }
-  int sample_rate() const { return sample_rate_; }
-  void set_copy_audio_bus_callback(const CopyAudioCB& callback) {
-    copy_audio_bus_callback_ = callback;
-  }
-
- private:
-  AudioRendererSink::RenderCallback* renderer_;
-  int channels_;
-  int sample_rate_;
-
-  CopyAudioCB copy_audio_bus_callback_;
-
-  DISALLOW_COPY_AND_ASSIGN(TeeFilter);
-};
-
-WebAudioSourceProviderImpl::WebAudioSourceProviderImpl(
-    const scoped_refptr<SwitchableAudioRendererSink>& sink)
-    : volume_(1.0),
-      state_(kStopped),
-      client_(NULL),
-      sink_(sink),
-      tee_filter_(new TeeFilter()),
-      weak_factory_(this) {}
-
-WebAudioSourceProviderImpl::~WebAudioSourceProviderImpl() {}
-
-void WebAudioSourceProviderImpl::setClient(
-    blink::WebAudioSourceProviderClient* client) {
-  base::AutoLock auto_lock(sink_lock_);
-  if (client && client != client_) {
-    // Detach the audio renderer from normal playback.
-    sink_->Stop();
-
-    // The client will now take control by calling provideInput() periodically.
-    client_ = client;
-
-    set_format_cb_ = BindToCurrentLoop(base::Bind(
-        &WebAudioSourceProviderImpl::OnSetFormat, weak_factory_.GetWeakPtr()));
-
-    // If |tee_filter_| is Initialize()d - then run |set_format_cb_| to send
-    // |client_| the current format info. Otherwise |set_format_cb_| will get
-    // called when Initialize() is called. Note: Always using |set_format_cb_|
-    // ensures we have the same locking order when calling into |client_|.
-    if (tee_filter_->IsInitialized())
-      base::ResetAndReturn(&set_format_cb_).Run();
-  } else if (!client && client_) {
-    // Restore normal playback.
-    client_ = NULL;
-    sink_->SetVolume(volume_);
-    if (state_ >= kStarted) sink_->Start();
-    if (state_ >= kPlaying) sink_->Play();
-  }
-}
-
-void WebAudioSourceProviderImpl::provideInput(
-    const WebVector<float*>& audio_data, size_t number_of_frames) {
-  if (!bus_wrapper_ ||
-      static_cast<size_t>(bus_wrapper_->channels()) != audio_data.size()) {
-    bus_wrapper_ = AudioBus::CreateWrapper(static_cast<int>(audio_data.size()));
-  }
-
-  const int incoming_number_of_frames = static_cast<int>(number_of_frames);
-  bus_wrapper_->set_frames(incoming_number_of_frames);
-  for (size_t i = 0; i < audio_data.size(); ++i)
-    bus_wrapper_->SetChannelData(static_cast<int>(i), audio_data[i]);
-
-  // Use a try lock to avoid contention in the real-time audio thread.
-  AutoTryLock auto_try_lock(sink_lock_);
-  if (!auto_try_lock.locked() || state_ != kPlaying) {
-    // Provide silence if we failed to acquire the lock or the source is not
-    // running.
-    bus_wrapper_->Zero();
-    return;
-  }
-
-  DCHECK(client_);
-  DCHECK_EQ(tee_filter_->channels(), bus_wrapper_->channels());
-  const int frames = tee_filter_->Render(bus_wrapper_.get(), 0, 0);
-  if (frames < incoming_number_of_frames)
-    bus_wrapper_->ZeroFramesPartial(frames, incoming_number_of_frames - frames);
-
-  bus_wrapper_->Scale(volume_);
-}
-
-void WebAudioSourceProviderImpl::Initialize(const AudioParameters& params,
-                                            RenderCallback* renderer) {
-  base::AutoLock auto_lock(sink_lock_);
-  DCHECK_EQ(state_, kStopped);
-
-  tee_filter_->Initialize(renderer, params.channels(), params.sample_rate());
-
-  sink_->Initialize(params, tee_filter_.get());
-
-  if (!set_format_cb_.is_null()) base::ResetAndReturn(&set_format_cb_).Run();
-}
-
-void WebAudioSourceProviderImpl::Start() {
-  base::AutoLock auto_lock(sink_lock_);
-  DCHECK(tee_filter_);
-  DCHECK_EQ(state_, kStopped);
-  state_ = kStarted;
-  if (!client_) sink_->Start();
-}
-
-void WebAudioSourceProviderImpl::Stop() {
-  base::AutoLock auto_lock(sink_lock_);
-  state_ = kStopped;
-  if (!client_) sink_->Stop();
-}
-
-void WebAudioSourceProviderImpl::Play() {
-  base::AutoLock auto_lock(sink_lock_);
-  DCHECK_EQ(state_, kStarted);
-  state_ = kPlaying;
-  if (!client_) sink_->Play();
-}
-
-void WebAudioSourceProviderImpl::Pause() {
-  base::AutoLock auto_lock(sink_lock_);
-  DCHECK(state_ == kPlaying || state_ == kStarted);
-  state_ = kStarted;
-  if (!client_) sink_->Pause();
-}
-
-bool WebAudioSourceProviderImpl::SetVolume(double volume) {
-  base::AutoLock auto_lock(sink_lock_);
-  volume_ = volume;
-  if (!client_) sink_->SetVolume(volume);
-  return true;
-}
-
-media::OutputDeviceInfo WebAudioSourceProviderImpl::GetOutputDeviceInfo() {
-  base::AutoLock auto_lock(sink_lock_);
-  return sink_->GetOutputDeviceInfo();
-}
-
-bool WebAudioSourceProviderImpl::CurrentThreadIsRenderingThread() {
-  NOTIMPLEMENTED();
-  return false;
-}
-
-void WebAudioSourceProviderImpl::SwitchOutputDevice(
-    const std::string& device_id, const url::Origin& security_origin,
-    const OutputDeviceStatusCB& callback) {
-  base::AutoLock auto_lock(sink_lock_);
-  if (client_)
-    callback.Run(media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL);
-  else
-    sink_->SwitchOutputDevice(device_id, security_origin, callback);
-}
-
-void WebAudioSourceProviderImpl::SetCopyAudioCallback(
-    const CopyAudioCB& callback) {
-  DCHECK(!callback.is_null());
-
-  // Use |sink_lock_| to protect |tee_filter_| too since they go in lockstep.
-  base::AutoLock auto_lock(sink_lock_);
-
-  DCHECK(tee_filter_);
-  tee_filter_->set_copy_audio_bus_callback(callback);
-}
-
-void WebAudioSourceProviderImpl::ClearCopyAudioCallback() {
-  DCHECK(tee_filter_);
-  tee_filter_->set_copy_audio_bus_callback(CopyAudioCB());
-}
-
-int WebAudioSourceProviderImpl::RenderForTesting(AudioBus* audio_bus) {
-  return tee_filter_->Render(audio_bus, 0, 0);
-}
-
-void WebAudioSourceProviderImpl::OnSetFormat() {
-  base::AutoLock auto_lock(sink_lock_);
-  if (!client_) return;
-
-  // Inform Blink about the audio stream format.
-  client_->setFormat(tee_filter_->channels(), tee_filter_->sample_rate());
-}
-
-int WebAudioSourceProviderImpl::TeeFilter::Render(AudioBus* audio_bus,
-                                                  uint32_t frames_delayed,
-                                                  uint32_t frames_skipped) {
-  DCHECK(IsInitialized());
-
-  const int num_rendered_frames =
-      renderer_->Render(audio_bus, frames_delayed, frames_skipped);
-
-  if (!copy_audio_bus_callback_.is_null()) {
-    std::unique_ptr<AudioBus> bus_copy =
-        AudioBus::Create(audio_bus->channels(), audio_bus->frames());
-    audio_bus->CopyTo(bus_copy.get());
-    copy_audio_bus_callback_.Run(std::move(bus_copy), frames_delayed,
-                                 sample_rate_);
-  }
-
-  return num_rendered_frames;
-}
-
-void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() {
-  DCHECK(IsInitialized());
-  renderer_->OnRenderError();
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webaudiosourceprovider_impl.h b/src/cobalt/media/blink/webaudiosourceprovider_impl.h
deleted file mode 100644
index 0f1fe22..0000000
--- a/src/cobalt/media/blink/webaudiosourceprovider_impl.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "base/synchronization/lock.h"
-#include "cobalt/media/base/audio_renderer_sink.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebAudioSourceProvider.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
-
-namespace blink {
-class WebAudioSourceProviderClient;
-}
-
-namespace cobalt {
-namespace media {
-
-// WebAudioSourceProviderImpl is either one of two things (but not both):
-// - a connection between a RestartableAudioRendererSink (the |sink_|) passed in
-//   constructor and an AudioRendererSink::RenderCallback passed on Initialize()
-//   by means of an internal AudioRendererSink::RenderCallback.
-// - a connection between the said AudioRendererSink::RenderCallback and a
-//   blink::WebAudioSourceProviderClient passed via setClient() (the |client_|),
-//   again using the internal AudioRendererSink::RenderCallback. Blink calls
-//   provideInput() periodically to fetch the appropriate data.
-//
-// In either case, the internal RenderCallback allows for delivering a copy of
-// the data if a listener is configured. WASPImpl is also a
-// RestartableAudioRendererSink itself in order to be controlled (Play(),
-// Pause() etc).
-//
-// All calls are protected by a lock.
-class MEDIA_BLINK_EXPORT WebAudioSourceProviderImpl
-    : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider),
-      NON_EXPORTED_BASE(public SwitchableAudioRendererSink) {
- public:
-  using CopyAudioCB = base::Callback<void(
-      std::unique_ptr<AudioBus>, uint32_t frames_delayed, int sample_rate)>;
-
-  explicit WebAudioSourceProviderImpl(
-      const scoped_refptr<SwitchableAudioRendererSink>& sink);
-
-  // blink::WebAudioSourceProvider implementation.
-  void setClient(blink::WebAudioSourceProviderClient* client) OVERRIDE;
-  void provideInput(const blink::WebVector<float*>& audio_data,
-                    size_t number_of_frames) OVERRIDE;
-
-  // RestartableAudioRendererSink implementation.
-  void Initialize(const AudioParameters& params,
-                  RenderCallback* renderer) OVERRIDE;
-  void Start() OVERRIDE;
-  void Stop() OVERRIDE;
-  void Play() OVERRIDE;
-  void Pause() OVERRIDE;
-  bool SetVolume(double volume) OVERRIDE;
-  OutputDeviceInfo GetOutputDeviceInfo() OVERRIDE;
-  bool CurrentThreadIsRenderingThread() OVERRIDE;
-  void SwitchOutputDevice(const std::string& device_id,
-                          const url::Origin& security_origin,
-                          const OutputDeviceStatusCB& callback) OVERRIDE;
-
-  // These methods allow a client to get a copy of the rendered audio.
-  void SetCopyAudioCallback(const CopyAudioCB& callback);
-  void ClearCopyAudioCallback();
-
-  int RenderForTesting(AudioBus* audio_bus);
-
- private:
-  friend class WebAudioSourceProviderImplTest;
-  ~WebAudioSourceProviderImpl() OVERRIDE;
-
-  // Calls setFormat() on |client_| from the Blink renderer thread.
-  void OnSetFormat();
-
-  // Used to keep the volume across reconfigurations.
-  double volume_;
-
-  // Tracks the current playback state.
-  enum PlaybackState { kStopped, kStarted, kPlaying };
-  PlaybackState state_;
-
-  // Closure that calls OnSetFormat() on |client_| on the renderer thread.
-  base::Closure set_format_cb_;
-  // When set via setClient() it overrides |sink_| for consuming audio.
-  blink::WebAudioSourceProviderClient* client_;
-
-  // Where audio ends up unless overridden by |client_|.
-  base::Lock sink_lock_;
-  const scoped_refptr<SwitchableAudioRendererSink> sink_;
-  std::unique_ptr<AudioBus> bus_wrapper_;
-
-  // An inner class acting as a T filter where actual data can be tapped.
-  class TeeFilter;
-  const std::unique_ptr<TeeFilter> tee_filter_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_
diff --git a/src/cobalt/media/blink/webaudiosourceprovider_impl_unittest.cc b/src/cobalt/media/blink/webaudiosourceprovider_impl_unittest.cc
deleted file mode 100644
index b63473c..0000000
--- a/src/cobalt/media/blink/webaudiosourceprovider_impl_unittest.cc
+++ /dev/null
@@ -1,277 +0,0 @@
-// Copyright 2013 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/basictypes.h"
-#include "base/bind.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "cobalt/media/base/audio_parameters.h"
-#include "cobalt/media/base/fake_audio_render_callback.h"
-#include "cobalt/media/base/mock_audio_renderer_sink.h"
-#include "cobalt/media/blink/webaudiosourceprovider_impl.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebAudioSourceProviderClient.h"
-
-using ::testing::_;
-
-namespace cobalt {
-namespace media {
-
-namespace {
-const float kTestVolume = 0.25;
-}  // namespace
-
-class WebAudioSourceProviderImplTest
-    : public testing::Test,
-      public blink::WebAudioSourceProviderClient {
- public:
-  WebAudioSourceProviderImplTest()
-      : params_(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 48000,
-                16, 64),
-        fake_callback_(0.1),
-        mock_sink_(new MockAudioRendererSink()),
-        wasp_impl_(new WebAudioSourceProviderImpl(mock_sink_)) {}
-
-  virtual ~WebAudioSourceProviderImplTest() {}
-
-  void CallAllSinkMethodsAndVerify(bool verify) {
-    testing::InSequence s;
-
-    EXPECT_CALL(*mock_sink_.get(), Start()).Times(verify);
-    wasp_impl_->Start();
-
-    EXPECT_CALL(*mock_sink_.get(), Play()).Times(verify);
-    wasp_impl_->Play();
-
-    EXPECT_CALL(*mock_sink_.get(), Pause()).Times(verify);
-    wasp_impl_->Pause();
-
-    EXPECT_CALL(*mock_sink_.get(), SetVolume(kTestVolume)).Times(verify);
-    wasp_impl_->SetVolume(kTestVolume);
-
-    EXPECT_CALL(*mock_sink_.get(), Stop()).Times(verify);
-    wasp_impl_->Stop();
-
-    testing::Mock::VerifyAndClear(mock_sink_.get());
-  }
-
-  void SetClient(blink::WebAudioSourceProviderClient* client) {
-    testing::InSequence s;
-
-    if (client) {
-      EXPECT_CALL(*mock_sink_.get(), Stop());
-      EXPECT_CALL(*this, setFormat(params_.channels(), params_.sample_rate()));
-    }
-    wasp_impl_->setClient(client);
-    base::RunLoop().RunUntilIdle();
-
-    testing::Mock::VerifyAndClear(mock_sink_.get());
-    testing::Mock::VerifyAndClear(this);
-  }
-
-  bool CompareBusses(const AudioBus* bus1, const AudioBus* bus2) {
-    EXPECT_EQ(bus1->channels(), bus2->channels());
-    EXPECT_EQ(bus1->frames(), bus2->frames());
-    for (int ch = 0; ch < bus1->channels(); ++ch) {
-      if (SbMemoryCompare(bus1->channel(ch), bus2->channel(ch),
-                          sizeof(*bus1->channel(ch)) * bus1->frames()) != 0) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  // blink::WebAudioSourceProviderClient implementation.
-  MOCK_METHOD2(setFormat, void(size_t numberOfChannels, float sampleRate));
-
-  // CopyAudioCB. Added forwarder method due to GMock troubles with scoped_ptr.
-  MOCK_METHOD3(DoCopyAudioCB,
-               void(AudioBus*, uint32_t frames_delayed, int sample_rate));
-  void OnAudioBus(std::unique_ptr<AudioBus> bus, uint32_t frames_delayed,
-                  int sample_rate) {
-    DoCopyAudioCB(bus.get(), frames_delayed, sample_rate);
-  }
-
-  int Render(AudioBus* audio_bus) {
-    return wasp_impl_->RenderForTesting(audio_bus);
-  }
-
- protected:
-  AudioParameters params_;
-  FakeAudioRenderCallback fake_callback_;
-  scoped_refptr<MockAudioRendererSink> mock_sink_;
-  scoped_refptr<WebAudioSourceProviderImpl> wasp_impl_;
-  base::MessageLoop message_loop_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WebAudioSourceProviderImplTest);
-};
-
-TEST_F(WebAudioSourceProviderImplTest, SetClientBeforeInitialize) {
-  // setClient() with a NULL client should do nothing if no client is set.
-  wasp_impl_->setClient(NULL);
-
-  EXPECT_CALL(*mock_sink_.get(), Stop());
-  wasp_impl_->setClient(this);
-  base::RunLoop().RunUntilIdle();
-
-  // When Initialize() is called after setClient(), the params should propagate
-  // to the client via setFormat() during the call.
-  EXPECT_CALL(*this, setFormat(params_.channels(), params_.sample_rate()));
-  wasp_impl_->Initialize(params_, &fake_callback_);
-  base::RunLoop().RunUntilIdle();
-
-  // setClient() with the same client should do nothing.
-  wasp_impl_->setClient(this);
-  base::RunLoop().RunUntilIdle();
-}
-
-// Verify AudioRendererSink functionality w/ and w/o a client.
-TEST_F(WebAudioSourceProviderImplTest, SinkMethods) {
-  wasp_impl_->Initialize(params_, &fake_callback_);
-
-  // Without a client all WASP calls should fall through to the underlying sink.
-  CallAllSinkMethodsAndVerify(true);
-
-  // With a client no calls should reach the Stop()'d sink.  Also, setClient()
-  // should propagate the params provided during Initialize() at call time.
-  SetClient(this);
-  CallAllSinkMethodsAndVerify(false);
-
-  // Removing the client should cause WASP to revert to the underlying sink.
-  EXPECT_CALL(*mock_sink_.get(), SetVolume(kTestVolume));
-  SetClient(NULL);
-  CallAllSinkMethodsAndVerify(true);
-}
-
-// Verify underlying sink state is restored after client removal.
-TEST_F(WebAudioSourceProviderImplTest, SinkStateRestored) {
-  wasp_impl_->Initialize(params_, &fake_callback_);
-
-  // Verify state set before the client is set propagates back afterward.
-  EXPECT_CALL(*mock_sink_.get(), Start());
-  wasp_impl_->Start();
-  SetClient(this);
-
-  EXPECT_CALL(*mock_sink_.get(), SetVolume(1.0));
-  EXPECT_CALL(*mock_sink_.get(), Start());
-  SetClient(NULL);
-
-  // Verify state set while the client was attached propagates back afterward.
-  SetClient(this);
-  wasp_impl_->Play();
-  wasp_impl_->SetVolume(kTestVolume);
-
-  EXPECT_CALL(*mock_sink_.get(), SetVolume(kTestVolume));
-  EXPECT_CALL(*mock_sink_.get(), Start());
-  EXPECT_CALL(*mock_sink_.get(), Play());
-  SetClient(NULL);
-}
-
-// Test the AudioRendererSink state machine and its effects on provideInput().
-TEST_F(WebAudioSourceProviderImplTest, ProvideInput) {
-  std::unique_ptr<AudioBus> bus1 = AudioBus::Create(params_);
-  std::unique_ptr<AudioBus> bus2 = AudioBus::Create(params_);
-
-  // Point the WebVector into memory owned by |bus1|.
-  blink::WebVector<float*> audio_data(static_cast<size_t>(bus1->channels()));
-  for (size_t i = 0; i < audio_data.size(); ++i)
-    audio_data[i] = bus1->channel(static_cast<int>(i));
-
-  // Verify provideInput() works before Initialize() and returns silence.
-  bus1->channel(0)[0] = 1;
-  bus2->Zero();
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-
-  wasp_impl_->Initialize(params_, &fake_callback_);
-  SetClient(this);
-
-  // Verify provideInput() is muted prior to Start() and no calls to the render
-  // callback have occurred.
-  bus1->channel(0)[0] = 1;
-  bus2->Zero();
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-  ASSERT_EQ(fake_callback_.last_frames_delayed(), -1);
-
-  wasp_impl_->Start();
-
-  // Ditto for Play().
-  bus1->channel(0)[0] = 1;
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-  ASSERT_EQ(fake_callback_.last_frames_delayed(), -1);
-
-  wasp_impl_->Play();
-
-  // Now we should get real audio data.
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_FALSE(CompareBusses(bus1.get(), bus2.get()));
-
-  // Ensure volume adjustment is working.
-  fake_callback_.reset();
-  fake_callback_.Render(bus2.get(), 0, 0);
-  bus2->Scale(kTestVolume);
-
-  fake_callback_.reset();
-  wasp_impl_->SetVolume(kTestVolume);
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-
-  // Pause should return to silence.
-  wasp_impl_->Pause();
-  bus1->channel(0)[0] = 1;
-  bus2->Zero();
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-
-  // Ensure if a renderer properly fill silence for partial Render() calls by
-  // configuring the fake callback to return half the data.  After these calls
-  // bus1 is full of junk data, and bus2 is partially filled.
-  wasp_impl_->SetVolume(1);
-  fake_callback_.Render(bus1.get(), 0, 0);
-  fake_callback_.reset();
-  fake_callback_.Render(bus2.get(), 0, 0);
-  bus2->ZeroFramesPartial(bus2->frames() / 2,
-                          bus2->frames() - bus2->frames() / 2);
-  fake_callback_.reset();
-  fake_callback_.set_half_fill(true);
-  wasp_impl_->Play();
-
-  // Play should return real audio data again, but the last half should be zero.
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-
-  // Stop() should return silence.
-  wasp_impl_->Stop();
-  bus1->channel(0)[0] = 1;
-  bus2->Zero();
-  wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
-  ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
-}
-
-// Verify CopyAudioCB is called if registered.
-TEST_F(WebAudioSourceProviderImplTest, CopyAudioCB) {
-  testing::InSequence s;
-  wasp_impl_->Initialize(params_, &fake_callback_);
-  wasp_impl_->SetCopyAudioCallback(base::Bind(
-      &WebAudioSourceProviderImplTest::OnAudioBus, base::Unretained(this)));
-
-  const std::unique_ptr<AudioBus> bus1 = AudioBus::Create(params_);
-  EXPECT_CALL(*this, DoCopyAudioCB(_, 0, params_.sample_rate())).Times(1);
-  Render(bus1.get());
-
-  wasp_impl_->ClearCopyAudioCallback();
-  EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0);
-  Render(bus1.get());
-
-  testing::Mock::VerifyAndClear(mock_sink_.get());
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webcontentdecryptionmodule_impl.cc b/src/cobalt/media/blink/webcontentdecryptionmodule_impl.cc
deleted file mode 100644
index a3a03c1..0000000
--- a/src/cobalt/media/blink/webcontentdecryptionmodule_impl.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webcontentdecryptionmodule_impl.h"
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "cobalt/media/base/cdm_promise.h"
-#include "cobalt/media/base/key_systems.h"
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/blink/cdm_result_promise.h"
-#include "cobalt/media/blink/cdm_session_adapter.h"
-#include "cobalt/media/blink/webcontentdecryptionmodulesession_impl.h"
-#include "googleurl/src/gurl.h"
-#include "third_party/WebKit/public/platform/URLConversion.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-void WebContentDecryptionModuleImpl::Create(
-    media::CdmFactory* cdm_factory, const base::string16& key_system,
-    const blink::WebSecurityOrigin& security_origin,
-    const CdmConfig& cdm_config,
-    std::unique_ptr<blink::WebContentDecryptionModuleResult> result) {
-  DCHECK(!security_origin.isNull());
-  DCHECK(!key_system.empty());
-
-  // TODO(ddorwin): Guard against this in supported types check and remove this.
-  // Chromium only supports ASCII key systems.
-  if (!base::IsStringASCII(key_system)) {
-    NOTREACHED();
-    result->completeWithError(
-        blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
-        "Invalid keysystem.");
-    return;
-  }
-
-  // TODO(ddorwin): This should be a DCHECK.
-  std::string key_system_ascii = base::UTF16ToASCII(key_system);
-  if (!media::KeySystems::GetInstance()->IsSupportedKeySystem(
-          key_system_ascii)) {
-    std::string message =
-        "Keysystem '" + key_system_ascii + "' is not supported.";
-    result->completeWithError(
-        blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
-        blink::WebString::fromUTF8(message));
-    return;
-  }
-
-  // If unique security origin, don't try to create the CDM.
-  if (security_origin.isUnique() || security_origin.toString() == "null") {
-    result->completeWithError(
-        blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
-        "EME use is not allowed on unique origins.");
-    return;
-  }
-
-  GURL security_origin_as_gurl(
-      blink::WebStringToGURL(security_origin.toString()));
-
-  // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then
-  // if WebContentDecryptionModuleImpl is successfully created (returned in
-  // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will
-  // be destructed.
-  scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
-  adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl,
-                     cdm_config, std::move(result));
-}
-
-WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
-    scoped_refptr<CdmSessionAdapter> adapter)
-    : adapter_(adapter) {}
-
-WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {}
-
-// The caller owns the created session.
-blink::WebContentDecryptionModuleSession*
-WebContentDecryptionModuleImpl::createSession() {
-  return adapter_->CreateSession();
-}
-
-void WebContentDecryptionModuleImpl::setServerCertificate(
-    const uint8_t* server_certificate, size_t server_certificate_length,
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(server_certificate);
-  adapter_->SetServerCertificate(
-      std::vector<uint8_t>(server_certificate,
-                           server_certificate + server_certificate_length),
-      std::unique_ptr<SimpleCdmPromise>(
-          new CdmResultPromise<>(result, std::string())));
-}
-
-scoped_refptr<MediaKeys> WebContentDecryptionModuleImpl::GetCdm() {
-  return adapter_->GetCdm();
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webcontentdecryptionmodule_impl.h b/src/cobalt/media/blink/webcontentdecryptionmodule_impl.h
deleted file mode 100644
index 4d09ac3..0000000
--- a/src/cobalt/media/blink/webcontentdecryptionmodule_impl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
-
-#include <memory>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/string16.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-
-namespace blink {
-#if defined(ENABLE_PEPPER_CDMS)
-class WebLocalFrame;
-#endif
-class WebSecurityOrigin;
-}
-
-namespace cobalt {
-namespace media {
-
-struct CdmConfig;
-class CdmFactory;
-class CdmSessionAdapter;
-class MediaKeys;
-class WebContentDecryptionModuleSessionImpl;
-
-class MEDIA_BLINK_EXPORT WebContentDecryptionModuleImpl
-    : public blink::WebContentDecryptionModule {
- public:
-  static void Create(
-      CdmFactory* cdm_factory, const base::string16& key_system,
-      const blink::WebSecurityOrigin& security_origin,
-      const CdmConfig& cdm_config,
-      std::unique_ptr<blink::WebContentDecryptionModuleResult> result);
-
-  ~WebContentDecryptionModuleImpl() OVERRIDE;
-
-  // blink::WebContentDecryptionModule implementation.
-  blink::WebContentDecryptionModuleSession* createSession() OVERRIDE;
-
-  void setServerCertificate(
-      const uint8_t* server_certificate, size_t server_certificate_length,
-      blink::WebContentDecryptionModuleResult result) OVERRIDE;
-
-  // Returns a reference to the CDM used by |adapter_|.
-  scoped_refptr<MediaKeys> GetCdm();
-
- private:
-  friend CdmSessionAdapter;
-
-  // Takes reference to |adapter|.
-  explicit WebContentDecryptionModuleImpl(
-      scoped_refptr<CdmSessionAdapter> adapter);
-
-  scoped_refptr<CdmSessionAdapter> adapter_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl);
-};
-
-// Allow typecasting from blink type as this is the only implementation.
-inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl(
-    blink::WebContentDecryptionModule* cdm) {
-  return static_cast<WebContentDecryptionModuleImpl*>(cdm);
-}
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
diff --git a/src/cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.cc b/src/cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.cc
deleted file mode 100644
index cc1689c..0000000
--- a/src/cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.h"
-
-#include <memory>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "cobalt/media/blink/webencryptedmediaclient_impl.h"
-
-namespace cobalt {
-namespace media {
-
-// The caller owns the created cdm (passed back using |result|).
-static void CreateCdm(
-    const base::WeakPtr<WebEncryptedMediaClientImpl>& client,
-    const blink::WebString& key_system,
-    const blink::WebSecurityOrigin& security_origin,
-    const CdmConfig& cdm_config,
-    std::unique_ptr<blink::WebContentDecryptionModuleResult> result) {
-  // If |client| is gone (due to the frame getting destroyed), it is
-  // impossible to create the CDM, so fail.
-  if (!client) {
-    result->completeWithError(
-        blink::WebContentDecryptionModuleExceptionInvalidStateError, 0,
-        "Failed to create CDM.");
-    return;
-  }
-
-  client->CreateCdm(key_system, security_origin, cdm_config, std::move(result));
-}
-
-WebContentDecryptionModuleAccessImpl*
-WebContentDecryptionModuleAccessImpl::Create(
-    const blink::WebString& key_system,
-    const blink::WebSecurityOrigin& security_origin,
-    const blink::WebMediaKeySystemConfiguration& configuration,
-    const CdmConfig& cdm_config,
-    const base::WeakPtr<WebEncryptedMediaClientImpl>& client) {
-  return new WebContentDecryptionModuleAccessImpl(
-      key_system, security_origin, configuration, cdm_config, client);
-}
-
-WebContentDecryptionModuleAccessImpl::WebContentDecryptionModuleAccessImpl(
-    const blink::WebString& key_system,
-    const blink::WebSecurityOrigin& security_origin,
-    const blink::WebMediaKeySystemConfiguration& configuration,
-    const CdmConfig& cdm_config,
-    const base::WeakPtr<WebEncryptedMediaClientImpl>& client)
-    : key_system_(key_system),
-      security_origin_(security_origin),
-      configuration_(configuration),
-      cdm_config_(cdm_config),
-      client_(client) {}
-
-WebContentDecryptionModuleAccessImpl::~WebContentDecryptionModuleAccessImpl() {}
-
-blink::WebMediaKeySystemConfiguration
-WebContentDecryptionModuleAccessImpl::getConfiguration() {
-  return configuration_;
-}
-
-void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule(
-    blink::WebContentDecryptionModuleResult result) {
-  // This method needs to run asynchronously, as it may need to load the CDM.
-  // As this object's lifetime is controlled by MediaKeySystemAccess on the
-  // blink side, copy all values needed by CreateCdm() in case the blink object
-  // gets garbage-collected.
-  std::unique_ptr<blink::WebContentDecryptionModuleResult> result_copy(
-      new blink::WebContentDecryptionModuleResult(result));
-  base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::Bind(&CreateCdm, client_, key_system_, security_origin_,
-                            cdm_config_, base::Passed(&result_copy)));
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.h b/src/cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.h
deleted file mode 100644
index f146dc2..0000000
--- a/src/cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_
-
-#include "base/basictypes.h"
-#include "base/memory/weak_ptr.h"
-#include "cobalt/media/base/cdm_config.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleAccess.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-#include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-class WebEncryptedMediaClientImpl;
-
-class WebContentDecryptionModuleAccessImpl
-    : public blink::WebContentDecryptionModuleAccess {
- public:
-  static WebContentDecryptionModuleAccessImpl* Create(
-      const blink::WebString& key_system,
-      const blink::WebSecurityOrigin& security_origin,
-      const blink::WebMediaKeySystemConfiguration& configuration,
-      const CdmConfig& cdm_config,
-      const base::WeakPtr<WebEncryptedMediaClientImpl>& client);
-  ~WebContentDecryptionModuleAccessImpl() OVERRIDE;
-
-  // blink::WebContentDecryptionModuleAccess interface.
-  blink::WebMediaKeySystemConfiguration getConfiguration() OVERRIDE;
-  void createContentDecryptionModule(
-      blink::WebContentDecryptionModuleResult result) OVERRIDE;
-
- private:
-  WebContentDecryptionModuleAccessImpl(
-      const blink::WebString& key_system,
-      const blink::WebSecurityOrigin& security_origin,
-      const blink::WebMediaKeySystemConfiguration& configuration,
-      const CdmConfig& cdm_config,
-      const base::WeakPtr<WebEncryptedMediaClientImpl>& client);
-
-  const blink::WebString key_system_;
-  const blink::WebSecurityOrigin security_origin_;
-  const blink::WebMediaKeySystemConfiguration configuration_;
-  const CdmConfig cdm_config_;
-
-  // Keep a WeakPtr as client is owned by render_frame_impl.
-  base::WeakPtr<WebEncryptedMediaClientImpl> client_;
-
-  DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleAccessImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULEACCESS_IMPL_H_
diff --git a/src/cobalt/media/blink/webcontentdecryptionmodulesession_impl.cc b/src/cobalt/media/blink/webcontentdecryptionmodulesession_impl.cc
deleted file mode 100644
index 7f2ef7e..0000000
--- a/src/cobalt/media/blink/webcontentdecryptionmodulesession_impl.cc
+++ /dev/null
@@ -1,434 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webcontentdecryptionmodulesession_impl.h"
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/logging.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "cobalt/media/base/cdm_key_information.h"
-#include "cobalt/media/base/cdm_promise.h"
-#include "cobalt/media/base/key_system_names.h"
-#include "cobalt/media/base/key_systems.h"
-#include "cobalt/media/base/limits.h"
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/blink/cdm_result_promise.h"
-#include "cobalt/media/blink/cdm_session_adapter.h"
-#include "cobalt/media/blink/webmediaplayer_util.h"
-#include "cobalt/media/cdm/json_web_key.h"
-#include "third_party/WebKit/public/platform/WebData.h"
-#include "third_party/WebKit/public/platform/WebEncryptedMediaKeyInformation.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURL.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
-
-#if defined(USE_PROPRIETARY_CODECS)
-#include "cobalt/media/cdm/cenc_utils.h"
-#endif
-
-namespace cobalt {
-namespace media {
-
-const char kCloseSessionUMAName[] = "CloseSession";
-const char kGenerateRequestUMAName[] = "GenerateRequest";
-const char kLoadSessionUMAName[] = "LoadSession";
-const char kRemoveSessionUMAName[] = "RemoveSession";
-const char kUpdateSessionUMAName[] = "UpdateSession";
-
-static blink::WebContentDecryptionModuleSession::Client::MessageType
-convertMessageType(MediaKeys::MessageType message_type) {
-  switch (message_type) {
-    case media::MediaKeys::LICENSE_REQUEST:
-      return blink::WebContentDecryptionModuleSession::Client::MessageType::
-          LicenseRequest;
-    case media::MediaKeys::LICENSE_RENEWAL:
-      return blink::WebContentDecryptionModuleSession::Client::MessageType::
-          LicenseRenewal;
-    case media::MediaKeys::LICENSE_RELEASE:
-      return blink::WebContentDecryptionModuleSession::Client::MessageType::
-          LicenseRelease;
-  }
-
-  NOTREACHED();
-  return blink::WebContentDecryptionModuleSession::Client::MessageType::
-      LicenseRequest;
-}
-
-static blink::WebEncryptedMediaKeyInformation::KeyStatus convertStatus(
-    media::CdmKeyInformation::KeyStatus status) {
-  switch (status) {
-    case media::CdmKeyInformation::USABLE:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::Usable;
-    case media::CdmKeyInformation::INTERNAL_ERROR:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::InternalError;
-    case media::CdmKeyInformation::EXPIRED:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::Expired;
-    case media::CdmKeyInformation::OUTPUT_RESTRICTED:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::
-          OutputRestricted;
-    case media::CdmKeyInformation::OUTPUT_DOWNSCALED:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::
-          OutputDownscaled;
-    case media::CdmKeyInformation::KEY_STATUS_PENDING:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::StatusPending;
-    case media::CdmKeyInformation::RELEASED:
-      return blink::WebEncryptedMediaKeyInformation::KeyStatus::Released;
-  }
-
-  NOTREACHED();
-  return blink::WebEncryptedMediaKeyInformation::KeyStatus::InternalError;
-}
-
-static MediaKeys::SessionType convertSessionType(
-    blink::WebEncryptedMediaSessionType session_type) {
-  switch (session_type) {
-    case blink::WebEncryptedMediaSessionType::Temporary:
-      return MediaKeys::TEMPORARY_SESSION;
-    case blink::WebEncryptedMediaSessionType::PersistentLicense:
-      return MediaKeys::PERSISTENT_LICENSE_SESSION;
-    case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage:
-      return MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION;
-    case blink::WebEncryptedMediaSessionType::Unknown:
-      break;
-  }
-
-  NOTREACHED();
-  return MediaKeys::TEMPORARY_SESSION;
-}
-
-static bool SanitizeInitData(EmeInitDataType init_data_type,
-                             const unsigned char* init_data,
-                             size_t init_data_length,
-                             std::vector<uint8_t>* sanitized_init_data,
-                             std::string* error_message) {
-  DCHECK_GT(init_data_length, 0u);
-  if (init_data_length > limits::kMaxInitDataLength) {
-    error_message->assign("Initialization data too long.");
-    return false;
-  }
-
-  switch (init_data_type) {
-    case EmeInitDataType::WEBM:
-      // |init_data| for WebM is a single key.
-      if (init_data_length > limits::kMaxKeyIdLength) {
-        error_message->assign("Initialization data for WebM is too long.");
-        return false;
-      }
-      sanitized_init_data->assign(init_data, init_data + init_data_length);
-      return true;
-
-    case EmeInitDataType::CENC:
-#if defined(USE_PROPRIETARY_CODECS)
-      sanitized_init_data->assign(init_data, init_data + init_data_length);
-      if (!ValidatePsshInput(*sanitized_init_data)) {
-        error_message->assign("Initialization data for CENC is incorrect.");
-        return false;
-      }
-      return true;
-#else
-      error_message->assign("Initialization data type CENC is not supported.");
-      return false;
-#endif
-
-    case EmeInitDataType::KEYIDS: {
-      // Extract the keys and then rebuild the message. This ensures that any
-      // extra data in the provided JSON is dropped.
-      std::string init_data_string(init_data, init_data + init_data_length);
-      KeyIdList key_ids;
-      if (!ExtractKeyIdsFromKeyIdsInitData(init_data_string, &key_ids,
-                                           error_message))
-        return false;
-
-      for (const auto& key_id : key_ids) {
-        if (key_id.size() < limits::kMinKeyIdLength ||
-            key_id.size() > limits::kMaxKeyIdLength) {
-          error_message->assign("Incorrect key size.");
-          return false;
-        }
-      }
-
-      CreateKeyIdsInitData(key_ids, sanitized_init_data);
-      return true;
-    }
-
-    case EmeInitDataType::UNKNOWN:
-      break;
-  }
-
-  NOTREACHED();
-  error_message->assign("Initialization data type is not supported.");
-  return false;
-}
-
-static bool SanitizeSessionId(const blink::WebString& session_id,
-                              std::string* sanitized_session_id) {
-  // The user agent should thoroughly validate the sessionId value before
-  // passing it to the CDM. At a minimum, this should include checking that
-  // the length and value (e.g. alphanumeric) are reasonable.
-  if (!base::IsStringASCII(session_id)) return false;
-
-  sanitized_session_id->assign(
-      base::UTF16ToASCII(base::StringPiece16(session_id)));
-  if (sanitized_session_id->length() > limits::kMaxSessionIdLength)
-    return false;
-
-  for (const char c : *sanitized_session_id) {
-    if (!base::IsAsciiAlpha(c) && !base::IsAsciiDigit(c)) return false;
-  }
-
-  return true;
-}
-
-static bool SanitizeResponse(const std::string& key_system,
-                             const uint8_t* response, size_t response_length,
-                             std::vector<uint8_t>* sanitized_response) {
-  // The user agent should thoroughly validate the response before passing it
-  // to the CDM. This may include verifying values are within reasonable limits,
-  // stripping irrelevant data or fields, pre-parsing it, sanitizing it,
-  // and/or generating a fully sanitized version. The user agent should check
-  // that the length and values of fields are reasonable. Unknown fields should
-  // be rejected or removed.
-  if (response_length > limits::kMaxSessionResponseLength) return false;
-
-  if (IsClearKey(key_system) || IsExternalClearKey(key_system)) {
-    std::string key_string(response, response + response_length);
-    KeyIdAndKeyPairs keys;
-    MediaKeys::SessionType session_type = MediaKeys::TEMPORARY_SESSION;
-    if (!ExtractKeysFromJWKSet(key_string, &keys, &session_type)) return false;
-
-    // Must contain at least one key.
-    if (keys.empty()) return false;
-
-    for (const auto key_pair : keys) {
-      if (key_pair.first.size() < limits::kMinKeyIdLength ||
-          key_pair.first.size() > limits::kMaxKeyIdLength) {
-        return false;
-      }
-    }
-
-    std::string sanitized_data = GenerateJWKSet(keys, session_type);
-    sanitized_response->assign(sanitized_data.begin(), sanitized_data.end());
-    return true;
-  }
-
-  // TODO(jrummell): Verify responses for Widevine.
-  sanitized_response->assign(response, response + response_length);
-  return true;
-}
-
-WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl(
-    const scoped_refptr<CdmSessionAdapter>& adapter)
-    : adapter_(adapter), is_closed_(false), weak_ptr_factory_(this) {}
-
-WebContentDecryptionModuleSessionImpl::
-    ~WebContentDecryptionModuleSessionImpl() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (!session_id_.empty()) adapter_->UnregisterSession(session_id_);
-}
-
-void WebContentDecryptionModuleSessionImpl::setClientInterface(Client* client) {
-  client_ = client;
-}
-
-blink::WebString WebContentDecryptionModuleSessionImpl::sessionId() const {
-  return blink::WebString::fromUTF8(session_id_);
-}
-
-void WebContentDecryptionModuleSessionImpl::initializeNewSession(
-    blink::WebEncryptedMediaInitDataType init_data_type,
-    const unsigned char* init_data, size_t init_data_length,
-    blink::WebEncryptedMediaSessionType session_type,
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(init_data);
-  DCHECK(session_id_.empty());
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  // From https://w3c.github.io/encrypted-media/#generateRequest.
-  // 5. If the Key System implementation represented by this object's cdm
-  //    implementation value does not support initDataType as an Initialization
-  //    Data Type, return a promise rejected with a new DOMException whose name
-  //    is NotSupportedError. String comparison is case-sensitive.
-  EmeInitDataType eme_init_data_type = ConvertToEmeInitDataType(init_data_type);
-  if (!IsSupportedKeySystemWithInitDataType(adapter_->GetKeySystem(),
-                                            eme_init_data_type)) {
-    std::string message =
-        "The initialization data type is not supported by the key system.";
-    result.completeWithError(
-        blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
-        blink::WebString::fromUTF8(message));
-    return;
-  }
-
-  // 9.1 If the init data is not valid for initDataType, reject promise with a
-  //     new DOMException whose name is InvalidAccessError.
-  // 9.2 Let sanitized init data be a validated and sanitized version of init
-  //     data. The user agent must thoroughly validate the Initialization Data
-  //     before passing it to the CDM. This includes verifying that the length
-  //     and values of fields are reasonable, verifying that values are within
-  //     reasonable limits, and stripping irrelevant, unsupported, or unknown
-  //     data or fields. It is recommended that user agents pre-parse, sanitize,
-  //     and/or generate a fully sanitized version of the Initialization Data.
-  //     If the Initialization Data format specified by initDataType support
-  //     multiple entries, the user agent should remove entries that are not
-  //     needed by the CDM.
-  // 9.3 If the previous step failed, reject promise with a new DOMException
-  //     whose name is InvalidAccessError.
-  std::vector<uint8_t> sanitized_init_data;
-  std::string message;
-  if (!SanitizeInitData(eme_init_data_type, init_data, init_data_length,
-                        &sanitized_init_data, &message)) {
-    result.completeWithError(
-        blink::WebContentDecryptionModuleExceptionInvalidAccessError, 0,
-        blink::WebString::fromUTF8(message));
-    return;
-  }
-
-  // 9.4 Let session id be the empty string.
-  //     (Done in constructor.)
-
-  // 9.5 Let message be null.
-  //     (Done by CDM.)
-
-  // 9.6 Let cdm be the CDM instance represented by this object's cdm
-  //     instance value.
-  // 9.7 Use the cdm to execute the following steps:
-  adapter_->InitializeNewSession(
-      eme_init_data_type, sanitized_init_data, convertSessionType(session_type),
-      std::unique_ptr<NewSessionCdmPromise>(new NewSessionCdmResultPromise(
-          result, adapter_->GetKeySystemUMAPrefix() + kGenerateRequestUMAName,
-          base::Bind(
-              &WebContentDecryptionModuleSessionImpl::OnSessionInitialized,
-              weak_ptr_factory_.GetWeakPtr()))));
-}
-
-void WebContentDecryptionModuleSessionImpl::load(
-    const blink::WebString& session_id,
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(!session_id.isEmpty());
-  DCHECK(session_id_.empty());
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  std::string sanitized_session_id;
-  if (!SanitizeSessionId(session_id, &sanitized_session_id)) {
-    result.completeWithError(
-        blink::WebContentDecryptionModuleExceptionInvalidAccessError, 0,
-        "Invalid session ID.");
-    return;
-  }
-
-  // TODO(jrummell): Now that there are 2 types of persistent sessions, the
-  // session type should be passed from blink. Type should also be passed in the
-  // constructor (and removed from initializeNewSession()).
-  adapter_->LoadSession(
-      MediaKeys::PERSISTENT_LICENSE_SESSION, sanitized_session_id,
-      std::unique_ptr<NewSessionCdmPromise>(new NewSessionCdmResultPromise(
-          result, adapter_->GetKeySystemUMAPrefix() + kLoadSessionUMAName,
-          base::Bind(
-              &WebContentDecryptionModuleSessionImpl::OnSessionInitialized,
-              weak_ptr_factory_.GetWeakPtr()))));
-}
-
-void WebContentDecryptionModuleSessionImpl::update(
-    const uint8_t* response, size_t response_length,
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(response);
-  DCHECK(!session_id_.empty());
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  std::vector<uint8_t> sanitized_response;
-  if (!SanitizeResponse(adapter_->GetKeySystem(), response, response_length,
-                        &sanitized_response)) {
-    result.completeWithError(
-        blink::WebContentDecryptionModuleExceptionInvalidAccessError, 0,
-        "Invalid response.");
-    return;
-  }
-
-  adapter_->UpdateSession(
-      session_id_, sanitized_response,
-      std::unique_ptr<SimpleCdmPromise>(new CdmResultPromise<>(
-          result, adapter_->GetKeySystemUMAPrefix() + kUpdateSessionUMAName)));
-}
-
-void WebContentDecryptionModuleSessionImpl::close(
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(!session_id_.empty());
-  DCHECK(thread_checker_.CalledOnValidThread());
-  adapter_->CloseSession(
-      session_id_,
-      std::unique_ptr<SimpleCdmPromise>(new CdmResultPromise<>(
-          result, adapter_->GetKeySystemUMAPrefix() + kCloseSessionUMAName)));
-}
-
-void WebContentDecryptionModuleSessionImpl::remove(
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(!session_id_.empty());
-  DCHECK(thread_checker_.CalledOnValidThread());
-  adapter_->RemoveSession(
-      session_id_,
-      std::unique_ptr<SimpleCdmPromise>(new CdmResultPromise<>(
-          result, adapter_->GetKeySystemUMAPrefix() + kRemoveSessionUMAName)));
-}
-
-void WebContentDecryptionModuleSessionImpl::OnSessionMessage(
-    MediaKeys::MessageType message_type, const std::vector<uint8_t>& message) {
-  DCHECK(client_) << "Client not set before message event";
-  DCHECK(thread_checker_.CalledOnValidThread());
-  client_->message(convertMessageType(message_type), message.data(),
-                   message.size());
-}
-
-void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange(
-    bool has_additional_usable_key, CdmKeysInfo keys_info) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  blink::WebVector<blink::WebEncryptedMediaKeyInformation> keys(
-      keys_info.size());
-  for (size_t i = 0; i < keys_info.size(); ++i) {
-    auto* key_info = keys_info[i];
-    keys[i].setId(blink::WebData(reinterpret_cast<char*>(&key_info->key_id[0]),
-                                 key_info->key_id.size()));
-    keys[i].setStatus(convertStatus(key_info->status));
-    keys[i].setSystemCode(key_info->system_code);
-  }
-
-  // Now send the event to blink.
-  client_->keysStatusesChange(keys, has_additional_usable_key);
-}
-
-void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate(
-    const base::Time& new_expiry_time) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  client_->expirationChanged(new_expiry_time.ToJsTime());
-}
-
-void WebContentDecryptionModuleSessionImpl::OnSessionClosed() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (is_closed_) return;
-
-  is_closed_ = true;
-  client_->close();
-}
-
-void WebContentDecryptionModuleSessionImpl::OnSessionInitialized(
-    const std::string& session_id, SessionInitStatus* status) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  // CDM will return NULL if the session to be loaded can't be found.
-  if (session_id.empty()) {
-    *status = SessionInitStatus::SESSION_NOT_FOUND;
-    return;
-  }
-
-  DCHECK(session_id_.empty()) << "Session ID may not be changed once set.";
-  session_id_ = session_id;
-  *status =
-      adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr())
-          ? SessionInitStatus::NEW_SESSION
-          : SessionInitStatus::SESSION_ALREADY_EXISTS;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webcontentdecryptionmodulesession_impl.h b/src/cobalt/media/blink/webcontentdecryptionmodulesession_impl.h
deleted file mode 100644
index bf33d06..0000000
--- a/src/cobalt/media/blink/webcontentdecryptionmodulesession_impl.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/thread_checker.h"
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/blink/new_session_cdm_result_promise.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-class CdmSessionAdapter;
-class MediaKeys;
-
-class WebContentDecryptionModuleSessionImpl
-    : public blink::WebContentDecryptionModuleSession {
- public:
-  WebContentDecryptionModuleSessionImpl(
-      const scoped_refptr<CdmSessionAdapter>& adapter);
-  ~WebContentDecryptionModuleSessionImpl() OVERRIDE;
-
-  // blink::WebContentDecryptionModuleSession implementation.
-  void setClientInterface(Client* client) OVERRIDE;
-  blink::WebString sessionId() const OVERRIDE;
-
-  void initializeNewSession(
-      blink::WebEncryptedMediaInitDataType init_data_type,
-      const unsigned char* initData, size_t initDataLength,
-      blink::WebEncryptedMediaSessionType session_type,
-      blink::WebContentDecryptionModuleResult result) OVERRIDE;
-  void load(const blink::WebString& session_id,
-            blink::WebContentDecryptionModuleResult result) OVERRIDE;
-  void update(const uint8_t* response, size_t response_length,
-              blink::WebContentDecryptionModuleResult result) OVERRIDE;
-  void close(blink::WebContentDecryptionModuleResult result) OVERRIDE;
-  void remove(blink::WebContentDecryptionModuleResult result) OVERRIDE;
-
-  // Callbacks.
-  void OnSessionMessage(MediaKeys::MessageType message_type,
-                        const std::vector<uint8_t>& message);
-  void OnSessionKeysChange(bool has_additional_usable_key,
-                           CdmKeysInfo keys_info);
-  void OnSessionExpirationUpdate(const base::Time& new_expiry_time);
-  void OnSessionClosed();
-
- private:
-  // Called when a new session is created or loaded. |status| is set as
-  // appropriate, depending on whether the session already exists or not.
-  void OnSessionInitialized(const std::string& session_id,
-                            SessionInitStatus* status);
-
-  scoped_refptr<CdmSessionAdapter> adapter_;
-
-  // Non-owned pointer.
-  Client* client_;
-
-  // Session ID is the app visible ID for this session generated by the CDM.
-  // This value is not set until the CDM resolves the initializeNewSession()
-  // promise.
-  std::string session_id_;
-
-  // Don't pass more than 1 close() event to blink::
-  // TODO(jrummell): Remove this once blink tests handle close() promise and
-  // closed() event.
-  bool is_closed_;
-
-  base::ThreadChecker thread_checker_;
-  // Since promises will live until they are fired, use a weak reference when
-  // creating a promise in case this class disappears before the promise
-  // actually fires.
-  base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULESESSION_IMPL_H_
diff --git a/src/cobalt/media/blink/webencryptedmediaclient_impl.cc b/src/cobalt/media/blink/webencryptedmediaclient_impl.cc
deleted file mode 100644
index ed4d938..0000000
--- a/src/cobalt/media/blink/webencryptedmediaclient_impl.cc
+++ /dev/null
@@ -1,169 +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.
-
-#include "cobalt/media/blink/webencryptedmediaclient_impl.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/memory/ptr_util.h"
-#include "base/metrics/histogram.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "cobalt/media/base/key_systems.h"
-#include "cobalt/media/base/media_client.h"
-#include "cobalt/media/base/media_permission.h"
-#include "cobalt/media/blink/webcontentdecryptionmodule_impl.h"
-#include "cobalt/media/blink/webcontentdecryptionmoduleaccess_impl.h"
-#include "third_party/WebKit/public/platform/URLConversion.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-#include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h"
-#include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-namespace {
-
-// Used to name UMAs in Reporter.
-const char kKeySystemSupportUMAPrefix[] =
-    "Media.EME.RequestMediaKeySystemAccess.";
-
-}  // namespace
-
-// Report usage of key system to UMA. There are 2 different counts logged:
-// 1. The key system is requested.
-// 2. The requested key system and options are supported.
-// Each stat is only reported once per renderer frame per key system.
-// Note that WebEncryptedMediaClientImpl is only created once by each
-// renderer frame.
-class WebEncryptedMediaClientImpl::Reporter {
- public:
-  enum KeySystemSupportStatus {
-    KEY_SYSTEM_REQUESTED = 0,
-    KEY_SYSTEM_SUPPORTED = 1,
-    KEY_SYSTEM_SUPPORT_STATUS_COUNT
-  };
-
-  explicit Reporter(const std::string& key_system_for_uma)
-      : uma_name_(kKeySystemSupportUMAPrefix + key_system_for_uma),
-        is_request_reported_(false),
-        is_support_reported_(false) {}
-  ~Reporter() {}
-
-  void ReportRequested() {
-    if (is_request_reported_) return;
-    Report(KEY_SYSTEM_REQUESTED);
-    is_request_reported_ = true;
-  }
-
-  void ReportSupported() {
-    DCHECK(is_request_reported_);
-    if (is_support_reported_) return;
-    Report(KEY_SYSTEM_SUPPORTED);
-    is_support_reported_ = true;
-  }
-
- private:
-  void Report(KeySystemSupportStatus status) {
-    // Not using UMA_HISTOGRAM_ENUMERATION directly because UMA_* macros
-    // require the names to be constant throughout the process' lifetime.
-    base::LinearHistogram::FactoryGet(
-        uma_name_, 1, KEY_SYSTEM_SUPPORT_STATUS_COUNT,
-        KEY_SYSTEM_SUPPORT_STATUS_COUNT + 1,
-        base::Histogram::kUmaTargetedHistogramFlag)
-        ->Add(status);
-  }
-
-  const std::string uma_name_;
-  bool is_request_reported_;
-  bool is_support_reported_;
-};
-
-WebEncryptedMediaClientImpl::WebEncryptedMediaClientImpl(
-    base::Callback<bool(void)> are_secure_codecs_supported_cb,
-    CdmFactory* cdm_factory, MediaPermission* media_permission)
-    : are_secure_codecs_supported_cb_(are_secure_codecs_supported_cb),
-      cdm_factory_(cdm_factory),
-      key_system_config_selector_(KeySystems::GetInstance(), media_permission),
-      weak_factory_(this) {
-  DCHECK(cdm_factory_);
-}
-
-WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() {}
-
-void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess(
-    blink::WebEncryptedMediaRequest request) {
-  GetReporter(request.keySystem())->ReportRequested();
-
-  if (GetMediaClient()) {
-    GURL security_origin(
-        blink::WebStringToGURL(request.getSecurityOrigin().toString()));
-
-    GetMediaClient()->RecordRapporURL("Media.OriginUrl.EME", security_origin);
-
-    if (!request.getSecurityOrigin().isPotentiallyTrustworthy()) {
-      GetMediaClient()->RecordRapporURL("Media.OriginUrl.EME.Insecure",
-                                        security_origin);
-    }
-  }
-
-  key_system_config_selector_.SelectConfig(
-      request.keySystem(), request.supportedConfigurations(),
-      request.getSecurityOrigin(), are_secure_codecs_supported_cb_.Run(),
-      base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded,
-                 weak_factory_.GetWeakPtr(), request),
-      base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported,
-                 weak_factory_.GetWeakPtr(), request));
-}
-
-void WebEncryptedMediaClientImpl::CreateCdm(
-    const blink::WebString& key_system,
-    const blink::WebSecurityOrigin& security_origin,
-    const CdmConfig& cdm_config,
-    std::unique_ptr<blink::WebContentDecryptionModuleResult> result) {
-  WebContentDecryptionModuleImpl::Create(
-      cdm_factory_, key_system, security_origin, cdm_config, std::move(result));
-}
-
-void WebEncryptedMediaClientImpl::OnRequestSucceeded(
-    blink::WebEncryptedMediaRequest request,
-    const blink::WebMediaKeySystemConfiguration& accumulated_configuration,
-    const CdmConfig& cdm_config) {
-  GetReporter(request.keySystem())->ReportSupported();
-  // TODO(sandersd): Pass |are_secure_codecs_required| along and use it to
-  // configure the CDM security level and use of secure surfaces on Android.
-  request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create(
-      request.keySystem(), request.getSecurityOrigin(),
-      accumulated_configuration, cdm_config, weak_factory_.GetWeakPtr()));
-}
-
-void WebEncryptedMediaClientImpl::OnRequestNotSupported(
-    blink::WebEncryptedMediaRequest request,
-    const blink::WebString& error_message) {
-  request.requestNotSupported(error_message);
-}
-
-WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter(
-    const blink::WebString& key_system) {
-  // Assumes that empty will not be found by GetKeySystemNameForUMA().
-  // TODO(sandersd): Avoid doing ASCII conversion more than once.
-  std::string key_system_ascii;
-  if (base::IsStringASCII(key_system))
-    key_system_ascii = base::UTF16ToASCII(base::StringPiece16(key_system));
-
-  // Return a per-frame singleton so that UMA reports will be once-per-frame.
-  std::string uma_name = GetKeySystemNameForUMA(key_system_ascii);
-  Reporter* reporter = reporters_.get(uma_name);
-  if (!reporter) {
-    reporter = new Reporter(uma_name);
-    reporters_.add(uma_name, base::WrapUnique(reporter));
-  }
-  return reporter;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webencryptedmediaclient_impl.h b/src/cobalt/media/blink/webencryptedmediaclient_impl.h
deleted file mode 100644
index c793e94..0000000
--- a/src/cobalt/media/blink/webencryptedmediaclient_impl.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
-
-#include <memory>
-#include <string>
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "base/scoped_ptr_hash_map.h"
-#include "cobalt/media/blink/key_system_config_selector.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h"
-
-namespace blink {
-
-class WebContentDecryptionModuleResult;
-struct WebMediaKeySystemConfiguration;
-class WebSecurityOrigin;
-
-}  // namespace blink
-
-namespace cobalt {
-namespace media {
-
-struct CdmConfig;
-class CdmFactory;
-class KeySystems;
-class MediaPermission;
-
-class MEDIA_BLINK_EXPORT WebEncryptedMediaClientImpl
-    : public blink::WebEncryptedMediaClient {
- public:
-  WebEncryptedMediaClientImpl(
-      base::Callback<bool(void)> are_secure_codecs_supported_cb,
-      CdmFactory* cdm_factory, MediaPermission* media_permission);
-  ~WebEncryptedMediaClientImpl() OVERRIDE;
-
-  // WebEncryptedMediaClient implementation.
-  void requestMediaKeySystemAccess(
-      blink::WebEncryptedMediaRequest request) OVERRIDE;
-
-  // Create the CDM for |key_system| and |security_origin|. The caller owns
-  // the created cdm (passed back using |result|).
-  void CreateCdm(
-      const blink::WebString& key_system,
-      const blink::WebSecurityOrigin& security_origin,
-      const CdmConfig& cdm_config,
-      std::unique_ptr<blink::WebContentDecryptionModuleResult> result);
-
- private:
-  // Report usage of key system to UMA. There are 2 different counts logged:
-  // 1. The key system is requested.
-  // 2. The requested key system and options are supported.
-  // Each stat is only reported once per renderer frame per key system.
-  class Reporter;
-
-  // Complete a requestMediaKeySystemAccess() request with a supported
-  // accumulated configuration.
-  void OnRequestSucceeded(
-      blink::WebEncryptedMediaRequest request,
-      const blink::WebMediaKeySystemConfiguration& accumulated_configuration,
-      const CdmConfig& cdm_config);
-
-  // Complete a requestMediaKeySystemAccess() request with an error message.
-  void OnRequestNotSupported(blink::WebEncryptedMediaRequest request,
-                             const blink::WebString& error_message);
-
-  // Gets the Reporter for |key_system|. If it doesn't already exist,
-  // create one.
-  Reporter* GetReporter(const blink::WebString& key_system);
-
-  // Reporter singletons.
-  base::ScopedPtrHashMap<std::string, std::unique_ptr<Reporter>> reporters_;
-
-  base::Callback<bool(void)> are_secure_codecs_supported_cb_;
-  CdmFactory* cdm_factory_;
-  KeySystemConfigSelector key_system_config_selector_;
-  base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_;
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
diff --git a/src/cobalt/media/blink/webinbandtexttrack_impl.cc b/src/cobalt/media/blink/webinbandtexttrack_impl.cc
deleted file mode 100644
index 556c541..0000000
--- a/src/cobalt/media/blink/webinbandtexttrack_impl.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webinbandtexttrack_impl.h"
-
-#include "base/logging.h"
-
-namespace cobalt {
-namespace media {
-
-WebInbandTextTrackImpl::WebInbandTextTrackImpl(Kind kind,
-                                               const blink::WebString& label,
-                                               const blink::WebString& language,
-                                               const blink::WebString& id)
-    : client_(NULL), kind_(kind), label_(label), language_(language), id_(id) {}
-
-WebInbandTextTrackImpl::~WebInbandTextTrackImpl() { DCHECK(!client_); }
-
-void WebInbandTextTrackImpl::setClient(
-    blink::WebInbandTextTrackClient* client) {
-  client_ = client;
-}
-
-blink::WebInbandTextTrackClient* WebInbandTextTrackImpl::client() {
-  return client_;
-}
-
-WebInbandTextTrackImpl::Kind WebInbandTextTrackImpl::kind() const {
-  return kind_;
-}
-
-blink::WebString WebInbandTextTrackImpl::label() const { return label_; }
-
-blink::WebString WebInbandTextTrackImpl::language() const { return language_; }
-
-blink::WebString WebInbandTextTrackImpl::id() const { return id_; }
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webinbandtexttrack_impl.h b/src/cobalt/media/blink/webinbandtexttrack_impl.h
deleted file mode 100644
index 424803b..0000000
--- a/src/cobalt/media/blink/webinbandtexttrack_impl.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBINBANDTEXTTRACK_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBINBANDTEXTTRACK_IMPL_H_
-
-#include "base/basictypes.h"
-#include "third_party/WebKit/public/platform/WebInbandTextTrack.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace cobalt {
-namespace media {
-
-class WebInbandTextTrackImpl : public blink::WebInbandTextTrack {
- public:
-  WebInbandTextTrackImpl(Kind kind, const blink::WebString& label,
-                         const blink::WebString& language,
-                         const blink::WebString& id);
-  ~WebInbandTextTrackImpl() OVERRIDE;
-
-  void setClient(blink::WebInbandTextTrackClient* client) OVERRIDE;
-  blink::WebInbandTextTrackClient* client() OVERRIDE;
-
-  Kind kind() const OVERRIDE;
-
-  blink::WebString label() const OVERRIDE;
-  blink::WebString language() const OVERRIDE;
-  blink::WebString id() const OVERRIDE;
-
- private:
-  blink::WebInbandTextTrackClient* client_;
-  Kind kind_;
-  blink::WebString label_;
-  blink::WebString language_;
-  blink::WebString id_;
-  DISALLOW_COPY_AND_ASSIGN(WebInbandTextTrackImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBINBANDTEXTTRACK_IMPL_H_
diff --git a/src/cobalt/media/blink/webmediaplayer_delegate.h b/src/cobalt/media/blink/webmediaplayer_delegate.h
deleted file mode 100644
index ba8c2f2..0000000
--- a/src/cobalt/media/blink/webmediaplayer_delegate.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_
-#define COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_
-
-namespace blink {
-class WebMediaPlayer;
-}
-namespace cobalt {
-namespace media {
-
-enum class MediaContentType;
-
-// An interface to allow a WebMediaPlayer to communicate changes of state to
-// objects that need to know.
-class WebMediaPlayerDelegate {
- public:
-  class Observer {
-   public:
-    // Called when the WebMediaPlayer enters the background or foreground
-    // respectively. Note: Some implementations will stop playback when hidden,
-    // and thus subsequently call WebMediaPlayerDelegate::PlayerGone().
-    virtual void OnHidden() = 0;
-    virtual void OnShown() = 0;
-
-    // Requests a WebMediaPlayer instance to release all idle resources. If
-    // |must_suspend| is true, the player must stop playback, release all idle
-    // resources, and finally call WebMediaPlayerDelegate::PlayerGone(). If
-    // |must_suspend| is false, the player may ignore the request. Optionally,
-    // it may do some or all of the same actions as when |must_suspend| is true.
-    // To be clear, the player is not required to call PlayerGone() when
-    // |must_suspend| is false.
-    // Return false to reject the request and indicate that further calls to
-    // OnSuspendRequested() are required. Otherwise the Observer is removed
-    // from the idle list.
-    virtual bool OnSuspendRequested(bool must_suspend) = 0;
-
-    virtual void OnPlay() = 0;
-    virtual void OnPause() = 0;
-
-    // Playout volume should be set to current_volume * multiplier. The range is
-    // [0, 1] and is typically 1.
-    virtual void OnVolumeMultiplierUpdate(double multiplier) = 0;
-  };
-
-  WebMediaPlayerDelegate() {}
-
-  // Subscribe or unsubscribe from observer callbacks respectively. A client
-  // must use the delegate id returned by AddObserver() for all other calls.
-  virtual int AddObserver(Observer* observer) = 0;
-  virtual void RemoveObserver(int delegate_id) = 0;
-
-  // The specified player started playing media.
-  virtual void DidPlay(int delegate_id, bool has_video, bool has_audio,
-                       bool is_remote,
-                       media::MediaContentType media_content_type) = 0;
-
-  // The specified player stopped playing media. This may be called at any time
-  // with or without a DidPlay() having previously occurred. Calling this will
-  // cause the delegate to be registered for idle suspension. I.e., after some
-  // time elapses without a DidPlay(), OnSuspendRequested() will be issued.
-  virtual void DidPause(int delegate_id, bool reached_end_of_stream) = 0;
-
-  // The specified player was destroyed or suspended and will no longer accept
-  // Observer::OnPlay() or Observer::OnPause() calls. This may be called
-  // multiple times in row. Note: Clients must still call RemoveObserver() to
-  // unsubscribe from callbacks.
-  virtual void PlayerGone(int delegate_id) = 0;
-
-  // Returns whether the render frame is currently hidden.
-  virtual bool IsHidden() = 0;
-
-  // Returns whether there's a video playing in background within the render
-  // frame.
-  virtual bool IsPlayingBackgroundVideo() = 0;
-
- protected:
-  virtual ~WebMediaPlayerDelegate() {}
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_
diff --git a/src/cobalt/media/blink/webmediaplayer_impl.cc b/src/cobalt/media/blink/webmediaplayer_impl.cc
deleted file mode 100644
index 7202d23..0000000
--- a/src/cobalt/media/blink/webmediaplayer_impl.cc
+++ /dev/null
@@ -1,1853 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webmediaplayer_impl.h"
-
-#include <algorithm>
-#include <cmath>
-#include <limits>
-#include <string>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback.h"
-#include "base/callback_helpers.h"
-#include "base/command_line.h"
-#include "base/debug/alias.h"
-#include "base/debug/crash_logging.h"
-#include "base/location.h"
-#include "base/metrics/histogram.h"
-#include "base/single_thread_task_runner.h"
-#include "base/string_number_conversions.h"
-#include "base/task_runner_util.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/trace_event/trace_event.h"
-#include "build/build_config.h"
-#include "cc/blink/web_layer_impl.h"
-#include "cc/layers/video_layer.h"
-#include "cobalt/media/audio/null_audio_sink.h"
-#include "cobalt/media/base/bind_to_current_loop.h"
-#include "cobalt/media/base/cdm_context.h"
-#include "cobalt/media/base/limits.h"
-#include "cobalt/media/base/media_content_type.h"
-#include "cobalt/media/base/media_keys.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/base/media_switches.h"
-#include "cobalt/media/base/text_renderer.h"
-#include "cobalt/media/base/timestamp_constants.h"
-#include "cobalt/media/base/video_frame.h"
-#include "cobalt/media/blink/texttrack_impl.h"
-#include "cobalt/media/blink/watch_time_reporter.h"
-#include "cobalt/media/blink/webaudiosourceprovider_impl.h"
-#include "cobalt/media/blink/webcontentdecryptionmodule_impl.h"
-#include "cobalt/media/blink/webinbandtexttrack_impl.h"
-#include "cobalt/media/blink/webmediaplayer_delegate.h"
-#include "cobalt/media/blink/webmediaplayer_util.h"
-#include "cobalt/media/blink/webmediasource_impl.h"
-#include "cobalt/media/filters/chunk_demuxer.h"
-#include "cobalt/media/filters/ffmpeg_demuxer.h"
-#include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
-#include "third_party/WebKit/public/platform/WebMediaSource.h"
-#include "third_party/WebKit/public/platform/WebRect.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebSize.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURL.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebLocalFrame.h"
-#include "third_party/WebKit/public/web/WebView.h"
-
-#if defined(OS_ANDROID)
-#include "cobalt/media/base/android/media_codec_util.h"
-#endif
-
-using blink::WebCanvas;
-using blink::WebMediaPlayer;
-using blink::WebRect;
-using blink::WebSize;
-using blink::WebString;
-using gpu::gles2::GLES2Interface;
-
-#define STATIC_ASSERT_ENUM(a, b)                            \
-  static_assert(static_cast<int>(a) == static_cast<int>(b), \
-                "mismatching enums: " #a)
-
-namespace cobalt {
-namespace media {
-
-namespace {
-
-// Limits the range of playback rate.
-//
-// TODO(kylep): Revisit these.
-//
-// Vista has substantially lower performance than XP or Windows7.  If you speed
-// up a video too much, it can't keep up, and rendering stops updating except on
-// the time bar. For really high speeds, audio becomes a bottleneck and we just
-// use up the data we have, which may not achieve the speed requested, but will
-// not crash the tab.
-//
-// A very slow speed, ie 0.00000001x, causes the machine to lock up. (It seems
-// like a busy loop). It gets unresponsive, although its not completely dead.
-//
-// Also our timers are not very accurate (especially for ogg), which becomes
-// evident at low speeds and on Vista. Since other speeds are risky and outside
-// the norms, we think 1/16x to 16x is a safe and useful range for now.
-const double kMinRate = 0.0625;
-const double kMaxRate = 16.0;
-
-void SetSinkIdOnMediaThread(scoped_refptr<WebAudioSourceProviderImpl> sink,
-                            const std::string& device_id,
-                            const url::Origin& security_origin,
-                            const OutputDeviceStatusCB& callback) {
-  sink->SwitchOutputDevice(device_id, security_origin, callback);
-}
-
-bool IsBackgroundedSuspendEnabled() {
-#if !defined(OS_ANDROID)
-  // Suspend/Resume is only enabled by default on Android.
-  return base::CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kEnableMediaSuspend);
-#else
-  return !base::CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kDisableMediaSuspend);
-#endif
-}
-
-bool IsResumeBackgroundVideosEnabled() {
-  return base::FeatureList::IsEnabled(kResumeBackgroundVideo);
-}
-
-bool IsNetworkStateError(blink::WebMediaPlayer::NetworkState state) {
-  bool result = state == blink::WebMediaPlayer::NetworkStateFormatError ||
-                state == blink::WebMediaPlayer::NetworkStateNetworkError ||
-                state == blink::WebMediaPlayer::NetworkStateDecodeError;
-  DCHECK_EQ(state > blink::WebMediaPlayer::NetworkStateLoaded, result);
-  return result;
-}
-
-gfx::Size GetRotatedVideoSize(VideoRotation rotation, gfx::Size natural_size) {
-  if (rotation == VIDEO_ROTATION_90 || rotation == VIDEO_ROTATION_270)
-    return gfx::Size(natural_size.height(), natural_size.width());
-  return natural_size;
-}
-
-base::TimeDelta GetCurrentTimeInternal(WebMediaPlayerImpl* p_this) {
-  // We wrap currentTime() instead of using pipeline_.GetMediaTime() since there
-  // are a variety of cases in which that time is not accurate; e.g., while
-  // remoting and during a pause or seek.
-  return base::TimeDelta::FromSecondsD(p_this->currentTime());
-}
-
-// How much time must have elapsed since loading last progressed before the
-// player is eligible for idle suspension.
-constexpr base::TimeDelta kLoadingToIdleTimeout =
-    base::TimeDelta::FromSeconds(3);
-
-}  // namespace
-
-class BufferedDataSourceHostImpl;
-
-STATIC_ASSERT_ENUM(WebMediaPlayer::CORSModeUnspecified,
-                   UrlData::CORS_UNSPECIFIED);
-STATIC_ASSERT_ENUM(WebMediaPlayer::CORSModeAnonymous, UrlData::CORS_ANONYMOUS);
-STATIC_ASSERT_ENUM(WebMediaPlayer::CORSModeUseCredentials,
-                   UrlData::CORS_USE_CREDENTIALS);
-
-#define BIND_TO_RENDER_LOOP(function)                   \
-  (DCHECK(main_task_runner_->BelongsToCurrentThread()), \
-   BindToCurrentLoop(base::Bind(function, AsWeakPtr())))
-
-#define BIND_TO_RENDER_LOOP1(function, arg1)            \
-  (DCHECK(main_task_runner_->BelongsToCurrentThread()), \
-   BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1)))
-
-WebMediaPlayerImpl::WebMediaPlayerImpl(
-    blink::WebLocalFrame* frame, blink::WebMediaPlayerClient* client,
-    blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
-    base::WeakPtr<WebMediaPlayerDelegate> delegate,
-    std::unique_ptr<RendererFactory> renderer_factory,
-    linked_ptr<UrlIndex> url_index, const WebMediaPlayerParams& params)
-    : frame_(frame),
-      delegate_state_(DelegateState::GONE),
-      is_idle_(false),
-      must_suspend_(false),
-      network_state_(WebMediaPlayer::NetworkStateEmpty),
-      ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
-      highest_ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
-      preload_(MultibufferDataSource::AUTO),
-      buffering_strategy_(MultibufferDataSource::BUFFERING_STRATEGY_NORMAL),
-      main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
-      media_task_runner_(params.media_task_runner()),
-      worker_task_runner_(params.worker_task_runner()),
-      media_log_(params.media_log()),
-      pipeline_(media_task_runner_, media_log_.get()),
-      pipeline_controller_(
-          &pipeline_, base::Bind(&WebMediaPlayerImpl::CreateRenderer,
-                                 base::Unretained(this)),
-          base::Bind(&WebMediaPlayerImpl::OnPipelineSeeked, AsWeakPtr()),
-          base::Bind(&WebMediaPlayerImpl::OnPipelineSuspended, AsWeakPtr()),
-          base::Bind(&WebMediaPlayerImpl::OnError, AsWeakPtr())),
-      load_type_(LoadTypeURL),
-      opaque_(false),
-      playback_rate_(0.0),
-      paused_(true),
-      seeking_(false),
-      pending_suspend_resume_cycle_(false),
-      ended_(false),
-      should_notify_time_changed_(false),
-      overlay_enabled_(false),
-      decoder_requires_restart_for_overlay_(false),
-      client_(client),
-      encrypted_client_(encrypted_client),
-      delegate_(delegate),
-      delegate_id_(0),
-      defer_load_cb_(params.defer_load_cb()),
-      context_3d_cb_(params.context_3d_cb()),
-      adjust_allocated_memory_cb_(params.adjust_allocated_memory_cb()),
-      last_reported_memory_usage_(0),
-      supports_save_(true),
-      chunk_demuxer_(NULL),
-      url_index_(url_index),
-      // Threaded compositing isn't enabled universally yet.
-      compositor_task_runner_(params.compositor_task_runner()
-                                  ? params.compositor_task_runner()
-                                  : base::ThreadTaskRunnerHandle::Get()),
-      compositor_(new VideoFrameCompositor(compositor_task_runner_)),
-#if defined(OS_ANDROID)  // WMPI_CAST
-      cast_impl_(this, client_, params.context_3d_cb()),
-#endif
-      volume_(1.0),
-      volume_multiplier_(1.0),
-      renderer_factory_(std::move(renderer_factory)),
-      surface_manager_(params.surface_manager()),
-      overlay_surface_id_(SurfaceManager::kNoSurfaceID),
-      suppress_destruction_errors_(false),
-      can_suspend_state_(CanSuspendState::UNKNOWN),
-      is_encrypted_(false),
-      underflow_count_(0) {
-  DCHECK(!adjust_allocated_memory_cb_.is_null());
-  DCHECK(renderer_factory_);
-  DCHECK(client_);
-
-  tick_clock_.reset(new base::DefaultTickClock());
-
-  force_video_overlays_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kForceVideoOverlays);
-
-  disable_fullscreen_video_overlays_ =
-      !base::FeatureList::IsEnabled(media::kOverlayFullscreenVideo);
-
-  if (delegate_) delegate_id_ = delegate_->AddObserver(this);
-
-  media_log_->AddEvent(
-      media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED));
-
-  if (params.initial_cdm()) SetCdm(params.initial_cdm());
-
-  // TODO(xhwang): When we use an external Renderer, many methods won't work,
-  // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861
-
-  // Use the null sink if no sink was provided.
-  audio_source_provider_ = new WebAudioSourceProviderImpl(
-      params.audio_renderer_sink().get()
-          ? params.audio_renderer_sink()
-          : new NullAudioSink(media_task_runner_));
-}
-
-WebMediaPlayerImpl::~WebMediaPlayerImpl() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  suppress_destruction_errors_ = true;
-  if (delegate_) {
-    delegate_->PlayerGone(delegate_id_);
-    delegate_->RemoveObserver(delegate_id_);
-  }
-
-  // Finalize any watch time metrics before destroying the pipeline.
-  watch_time_reporter_.reset();
-
-  // Pipeline must be stopped before it is destroyed.
-  pipeline_.Stop();
-
-  if (last_reported_memory_usage_)
-    adjust_allocated_memory_cb_.Run(-last_reported_memory_usage_);
-
-  // Destruct compositor resources in the proper order.
-  client_->setWebLayer(NULL);
-  if (video_weblayer_)
-    static_cast<cc::VideoLayer*>(video_weblayer_->layer())->StopUsingProvider();
-  compositor_task_runner_->DeleteSoon(FROM_HERE, compositor_);
-
-  media_log_->AddEvent(
-      media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_DESTROYED));
-}
-
-void WebMediaPlayerImpl::load(LoadType load_type,
-                              const blink::WebMediaPlayerSource& source,
-                              CORSMode cors_mode) {
-  // Only URL or MSE blob URL is supported.
-  DCHECK(source.isURL());
-  blink::WebURL url = source.getAsURL();
-  DVLOG(1) << __func__ << "(" << load_type << ", " << url << ", " << cors_mode
-           << ")";
-  if (!defer_load_cb_.is_null()) {
-    defer_load_cb_.Run(base::Bind(&WebMediaPlayerImpl::DoLoad, AsWeakPtr(),
-                                  load_type, url, cors_mode));
-    return;
-  }
-  DoLoad(load_type, url, cors_mode);
-}
-
-bool WebMediaPlayerImpl::supportsOverlayFullscreenVideo() {
-#if defined(OS_ANDROID)
-  return true;
-#else
-  return false;
-#endif
-}
-
-void WebMediaPlayerImpl::EnableOverlay() {
-  overlay_enabled_ = true;
-  if (surface_manager_) {
-    surface_created_cb_.Reset(
-        base::Bind(&WebMediaPlayerImpl::OnSurfaceCreated, AsWeakPtr()));
-    surface_manager_->CreateFullscreenSurface(pipeline_metadata_.natural_size,
-                                              surface_created_cb_.callback());
-  }
-
-  if (decoder_requires_restart_for_overlay_) ScheduleRestart();
-}
-
-void WebMediaPlayerImpl::DisableOverlay() {
-  overlay_enabled_ = false;
-  surface_created_cb_.Cancel();
-  overlay_surface_id_ = SurfaceManager::kNoSurfaceID;
-
-  if (decoder_requires_restart_for_overlay_) ScheduleRestart();
-}
-
-void WebMediaPlayerImpl::enteredFullscreen() {
-  if (!force_video_overlays_ && !disable_fullscreen_video_overlays_)
-    EnableOverlay();
-}
-
-void WebMediaPlayerImpl::exitedFullscreen() {
-  if (!force_video_overlays_ && !disable_fullscreen_video_overlays_)
-    DisableOverlay();
-}
-
-void WebMediaPlayerImpl::DoLoad(LoadType load_type, const blink::WebURL& url,
-                                CORSMode cors_mode) {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  GURL gurl(url);
-  ReportMetrics(load_type, gurl, frame_->getSecurityOrigin());
-
-  // Set subresource URL for crash reporting.
-  base::debug::SetCrashKeyValue("subresource_url", gurl.spec());
-
-  load_type_ = load_type;
-
-  SetNetworkState(WebMediaPlayer::NetworkStateLoading);
-  SetReadyState(WebMediaPlayer::ReadyStateHaveNothing);
-  media_log_->AddEvent(media_log_->CreateLoadEvent(url.string().utf8()));
-
-  // Media source pipelines can start immediately.
-  if (load_type == LoadTypeMediaSource) {
-    supports_save_ = false;
-    StartPipeline();
-  } else {
-    data_source_.reset(new MultibufferDataSource(
-        url, static_cast<UrlData::CORSMode>(cors_mode), main_task_runner_,
-        url_index_, frame_, media_log_.get(), &buffered_data_source_host_,
-        base::Bind(&WebMediaPlayerImpl::NotifyDownloading, AsWeakPtr())));
-    data_source_->SetPreload(preload_);
-    data_source_->SetBufferingStrategy(buffering_strategy_);
-    data_source_->Initialize(
-        base::Bind(&WebMediaPlayerImpl::DataSourceInitialized, AsWeakPtr()));
-  }
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  cast_impl_.Initialize(url, frame_, delegate_id_);
-#endif
-}
-
-void WebMediaPlayerImpl::play() {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  if (isRemote()) {
-    cast_impl_.play();
-    return;
-  }
-#endif
-  paused_ = false;
-  is_idle_ = false;
-  pipeline_.SetPlaybackRate(playback_rate_);
-  background_pause_timer_.Stop();
-
-  if (data_source_) data_source_->MediaIsPlaying();
-
-  DCHECK(watch_time_reporter_);
-  watch_time_reporter_->OnPlaying();
-  media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PLAY));
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::pause() {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // We update the paused state even when casting, since we expect pause() to be
-  // called when casting begins, and when we exit casting we should end up in a
-  // paused state.
-  paused_ = true;
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  if (isRemote()) {
-    cast_impl_.pause();
-    return;
-  }
-#endif
-
-  pipeline_.SetPlaybackRate(0.0);
-
-  // pause() may be called after playback has ended and the HTMLMediaElement
-  // requires that currentTime() == duration() after ending.  We want to ensure
-  // |paused_time_| matches currentTime() in this case or a future seek() may
-  // incorrectly discard what it thinks is a seek to the existing time.
-  paused_time_ =
-      ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
-
-  DCHECK(watch_time_reporter_);
-  watch_time_reporter_->OnPaused();
-  media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE));
-  UpdatePlayState();
-}
-
-bool WebMediaPlayerImpl::supportsSave() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  return supports_save_;
-}
-
-void WebMediaPlayerImpl::seek(double seconds) {
-  DVLOG(1) << __func__ << "(" << seconds << "s)";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DoSeek(base::TimeDelta::FromSecondsD(seconds), true);
-}
-
-void WebMediaPlayerImpl::DoSeek(base::TimeDelta time, bool time_updated) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  if (isRemote()) {
-    cast_impl_.seek(time);
-    return;
-  }
-#endif
-
-  ReadyState old_state = ready_state_;
-  if (ready_state_ > WebMediaPlayer::ReadyStateHaveMetadata)
-    SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
-
-  // When paused, we know exactly what the current time is and can elide seeks
-  // to it. However, there are two cases that are not elided:
-  //   1) When the pipeline state is not stable.
-  //      In this case we just let |pipeline_controller_| decide what to do, as
-  //      it has complete information.
-  //   2) For MSE.
-  //      Because the buffers may have changed between seeks, MSE seeks are
-  //      never elided.
-  if (paused_ && pipeline_controller_.IsStable() && paused_time_ == time &&
-      !chunk_demuxer_) {
-    // If the ready state was high enough before, we can indicate that the seek
-    // completed just by restoring it. Otherwise we will just wait for the real
-    // ready state change to eventually happen.
-    if (old_state == ReadyStateHaveEnoughData) {
-      main_task_runner_->PostTask(
-          FROM_HERE, base::Bind(&WebMediaPlayerImpl::OnBufferingStateChange,
-                                AsWeakPtr(), BUFFERING_HAVE_ENOUGH));
-    }
-    return;
-  }
-
-  // Call this before setting |seeking_| so that the current media time can be
-  // recorded by the reporter.
-  if (watch_time_reporter_) watch_time_reporter_->OnSeeking();
-
-  // TODO(sandersd): Ideally we would not clear the idle state if
-  // |pipeline_controller_| can elide the seek.
-  is_idle_ = false;
-  ended_ = false;
-
-  seeking_ = true;
-  seek_time_ = time;
-  if (paused_) paused_time_ = time;
-  pipeline_controller_.Seek(time, time_updated);
-
-  // This needs to be called after Seek() so that if a resume is triggered, it
-  // is to the correct time.
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::setRate(double rate) {
-  DVLOG(1) << __func__ << "(" << rate << ")";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // TODO(kylep): Remove when support for negatives is added. Also, modify the
-  // following checks so rewind uses reasonable values also.
-  if (rate < 0.0) return;
-
-  // Limit rates to reasonable values by clamping.
-  if (rate != 0.0) {
-    if (rate < kMinRate)
-      rate = kMinRate;
-    else if (rate > kMaxRate)
-      rate = kMaxRate;
-  }
-
-  playback_rate_ = rate;
-  if (!paused_) {
-    pipeline_.SetPlaybackRate(rate);
-    if (data_source_) data_source_->MediaPlaybackRateChanged(rate);
-  }
-}
-
-void WebMediaPlayerImpl::setVolume(double volume) {
-  DVLOG(1) << __func__ << "(" << volume << ")";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  volume_ = volume;
-  pipeline_.SetVolume(volume_ * volume_multiplier_);
-  if (watch_time_reporter_) watch_time_reporter_->OnVolumeChange(volume);
-
-  // The play state is updated because the player might have left the autoplay
-  // muted state.
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::setSinkId(
-    const blink::WebString& sink_id,
-    const blink::WebSecurityOrigin& security_origin,
-    blink::WebSetSinkIdCallbacks* web_callback) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DVLOG(1) << __func__;
-
-  media::OutputDeviceStatusCB callback =
-      media::ConvertToOutputDeviceStatusCB(web_callback);
-  media_task_runner_->PostTask(
-      FROM_HERE,
-      base::Bind(&SetSinkIdOnMediaThread, audio_source_provider_,
-                 sink_id.utf8(), static_cast<url::Origin>(security_origin),
-                 callback));
-}
-
-STATIC_ASSERT_ENUM(WebMediaPlayer::PreloadNone, MultibufferDataSource::NONE);
-STATIC_ASSERT_ENUM(WebMediaPlayer::PreloadMetaData,
-                   MultibufferDataSource::METADATA);
-STATIC_ASSERT_ENUM(WebMediaPlayer::PreloadAuto, MultibufferDataSource::AUTO);
-
-void WebMediaPlayerImpl::setPreload(WebMediaPlayer::Preload preload) {
-  DVLOG(1) << __func__ << "(" << preload << ")";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  preload_ = static_cast<MultibufferDataSource::Preload>(preload);
-  if (data_source_) data_source_->SetPreload(preload_);
-}
-
-STATIC_ASSERT_ENUM(WebMediaPlayer::BufferingStrategy::Normal,
-                   MultibufferDataSource::BUFFERING_STRATEGY_NORMAL);
-STATIC_ASSERT_ENUM(WebMediaPlayer::BufferingStrategy::Aggressive,
-                   MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE);
-
-void WebMediaPlayerImpl::setBufferingStrategy(
-    WebMediaPlayer::BufferingStrategy buffering_strategy) {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-#if defined(OS_ANDROID)
-  // We disallow aggressive buffering on Android since it matches the behavior
-  // of the platform media player and may have data usage penalties.
-  // TODO(dalecurtis, hubbe): We should probably stop using "pause-and-buffer"
-  // everywhere. See http://crbug.com/594669 for more details.
-  buffering_strategy_ = MultibufferDataSource::BUFFERING_STRATEGY_NORMAL;
-#else
-  buffering_strategy_ =
-      static_cast<MultibufferDataSource::BufferingStrategy>(buffering_strategy);
-#endif
-
-  if (data_source_) data_source_->SetBufferingStrategy(buffering_strategy_);
-}
-
-bool WebMediaPlayerImpl::hasVideo() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  return pipeline_metadata_.has_video;
-}
-
-bool WebMediaPlayerImpl::hasAudio() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  return pipeline_metadata_.has_audio;
-}
-
-void WebMediaPlayerImpl::enabledAudioTracksChanged(
-    const blink::WebVector<blink::WebMediaPlayer::TrackId>& enabledTrackIds) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  std::ostringstream logstr;
-  std::vector<MediaTrack::Id> enabledMediaTrackIds;
-  for (const auto& blinkTrackId : enabledTrackIds) {
-    MediaTrack::Id track_id = blinkTrackId.utf8().data();
-    logstr << track_id << " ";
-    enabledMediaTrackIds.push_back(track_id);
-  }
-  MEDIA_LOG(INFO, media_log_) << "Enabled audio tracks: [" << logstr.str()
-                              << "]";
-  pipeline_.OnEnabledAudioTracksChanged(enabledMediaTrackIds);
-}
-
-void WebMediaPlayerImpl::selectedVideoTrackChanged(
-    blink::WebMediaPlayer::TrackId* selectedTrackId) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  std::ostringstream logstr;
-  std::vector<MediaTrack::Id> selectedVideoMediaTrackId;
-  if (selectedTrackId) {
-    selectedVideoMediaTrackId.push_back(selectedTrackId->utf8().data());
-    logstr << selectedVideoMediaTrackId[0];
-  }
-  MEDIA_LOG(INFO, media_log_) << "Selected video track: [" << logstr.str()
-                              << "]";
-  pipeline_.OnSelectedVideoTrackChanged(selectedVideoMediaTrackId);
-}
-
-blink::WebSize WebMediaPlayerImpl::naturalSize() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  return blink::WebSize(pipeline_metadata_.natural_size);
-}
-
-bool WebMediaPlayerImpl::paused() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  if (isRemote()) return cast_impl_.paused();
-#endif
-
-  return pipeline_.GetPlaybackRate() == 0.0f;
-}
-
-bool WebMediaPlayerImpl::seeking() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) return false;
-
-  return seeking_;
-}
-
-double WebMediaPlayerImpl::duration() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing)
-    return std::numeric_limits<double>::quiet_NaN();
-
-  return GetPipelineDuration();
-}
-
-double WebMediaPlayerImpl::timelineOffset() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  if (pipeline_metadata_.timeline_offset.is_null())
-    return std::numeric_limits<double>::quiet_NaN();
-
-  return pipeline_metadata_.timeline_offset.ToJsTime();
-}
-
-double WebMediaPlayerImpl::currentTime() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing);
-
-  // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement,
-  // see http://crbug.com/409280
-  if (ended_) return duration();
-
-  if (seeking()) return seek_time_.InSecondsF();
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  if (isRemote()) return cast_impl_.currentTime();
-#endif
-
-  if (paused_) return paused_time_.InSecondsF();
-
-  return pipeline_.GetMediaTime().InSecondsF();
-}
-
-WebMediaPlayer::NetworkState WebMediaPlayerImpl::getNetworkState() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  return network_state_;
-}
-
-WebMediaPlayer::ReadyState WebMediaPlayerImpl::getReadyState() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  return ready_state_;
-}
-
-blink::WebString WebMediaPlayerImpl::getErrorMessage() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  return blink::WebString::fromUTF8(media_log_->GetLastErrorMessage());
-}
-
-blink::WebTimeRanges WebMediaPlayerImpl::buffered() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  Ranges<base::TimeDelta> buffered_time_ranges =
-      pipeline_.GetBufferedTimeRanges();
-
-  const base::TimeDelta duration = pipeline_.GetMediaDuration();
-  if (duration != kInfiniteDuration) {
-    buffered_data_source_host_.AddBufferedTimeRanges(&buffered_time_ranges,
-                                                     duration);
-  }
-  return ConvertToWebTimeRanges(buffered_time_ranges);
-}
-
-blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
-    return blink::WebTimeRanges();
-
-  const double seekable_end = duration();
-
-  // Allow a special exception for seeks to zero for streaming sources with a
-  // finite duration; this allows looping to work.
-  const bool allow_seek_to_zero = data_source_ && data_source_->IsStreaming() &&
-                                  std::isfinite(seekable_end);
-
-  // TODO(dalecurtis): Technically this allows seeking on media which return an
-  // infinite duration so long as DataSource::IsStreaming() is false.  While not
-  // expected, disabling this breaks semi-live players, http://crbug.com/427412.
-  const blink::WebTimeRange seekable_range(
-      0.0, allow_seek_to_zero ? 0.0 : seekable_end);
-  return blink::WebTimeRanges(&seekable_range, 1);
-}
-
-bool WebMediaPlayerImpl::didLoadingProgress() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // Note: Separate variables used to ensure both methods are called every time.
-  const bool pipeline_progress = pipeline_.DidLoadingProgress();
-  const bool data_progress = buffered_data_source_host_.DidLoadingProgress();
-  const bool did_loading_progress = pipeline_progress || data_progress;
-
-  // If we've idle suspended before reaching kHaveFutureData and loading has
-  // progressed we need to spin up the renderer and figure out if we have enough
-  // data yet; |client_| may be waiting on this signal to trigger playback. The
-  // idle timeout is long enough that this is a low-cost operation.
-  if (highest_ready_state_ < ReadyState::ReadyStateHaveFutureData &&
-      pipeline_controller_.IsSuspended() && did_loading_progress && is_idle_) {
-    is_idle_ = false;
-    UpdatePlayState();
-  }
-
-  if (did_loading_progress)
-    last_time_loading_progressed_ = tick_clock_->NowTicks();
-
-  return did_loading_progress;
-}
-
-void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas,
-                               const blink::WebRect& rect, SkPaint& paint) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  TRACE_EVENT0("media", "WebMediaPlayerImpl:paint");
-
-  // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when
-  // we have other ways to check if decoder owns video frame.
-  // See http://crbug.com/595716 and http://crbug.com/602708
-  if (cdm_) return;
-
-  scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
-
-  gfx::Rect gfx_rect(rect);
-  Context3D context_3d;
-  if (video_frame.get() && video_frame->HasTextures()) {
-    if (!context_3d_cb_.is_null()) context_3d = context_3d_cb_.Run();
-    if (!context_3d.gl)
-      return;  // Unable to get/create a shared main thread context.
-    if (!context_3d.gr_context)
-      return;  // The context has been lost since and can't setup a GrContext.
-  }
-  skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect),
-                                 paint, pipeline_metadata_.video_rotation,
-                                 context_3d);
-}
-
-bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
-  if (data_source_) return data_source_->HasSingleOrigin();
-  return true;
-}
-
-bool WebMediaPlayerImpl::didPassCORSAccessCheck() const {
-  if (data_source_) return data_source_->DidPassCORSAccessCheck();
-  return false;
-}
-
-double WebMediaPlayerImpl::mediaTimeForTimeValue(double timeValue) const {
-  return base::TimeDelta::FromSecondsD(timeValue).InSecondsF();
-}
-
-unsigned WebMediaPlayerImpl::decodedFrameCount() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  PipelineStatistics stats = pipeline_.GetStatistics();
-  return stats.video_frames_decoded;
-}
-
-unsigned WebMediaPlayerImpl::droppedFrameCount() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  PipelineStatistics stats = pipeline_.GetStatistics();
-  return stats.video_frames_dropped;
-}
-
-size_t WebMediaPlayerImpl::audioDecodedByteCount() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  PipelineStatistics stats = pipeline_.GetStatistics();
-  return stats.audio_bytes_decoded;
-}
-
-size_t WebMediaPlayerImpl::videoDecodedByteCount() const {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  PipelineStatistics stats = pipeline_.GetStatistics();
-  return stats.video_bytes_decoded;
-}
-
-bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
-    gpu::gles2::GLES2Interface* gl, unsigned int texture,
-    unsigned int internal_format, unsigned int type, bool premultiply_alpha,
-    bool flip_y) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
-
-  // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when
-  // we have other ways to check if decoder owns video frame.
-  // See http://crbug.com/595716 and http://crbug.com/602708
-  if (cdm_) return false;
-
-  scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
-  if (!video_frame.get() || !video_frame->HasTextures()) {
-    return false;
-  }
-
-  Context3D context_3d;
-  if (!context_3d_cb_.is_null()) context_3d = context_3d_cb_.Run();
-  return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture(
-      context_3d, gl, video_frame.get(), texture, internal_format, type,
-      premultiply_alpha, flip_y);
-}
-
-void WebMediaPlayerImpl::setContentDecryptionModule(
-    blink::WebContentDecryptionModule* cdm,
-    blink::WebContentDecryptionModuleResult result) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // Once the CDM is set it can't be cleared as there may be frames being
-  // decrypted on other threads. So fail this request.
-  // http://crbug.com/462365#c7.
-  if (!cdm) {
-    result.completeWithError(
-        blink::WebContentDecryptionModuleExceptionInvalidStateError, 0,
-        "The existing MediaKeys object cannot be removed at this time.");
-    return;
-  }
-
-  // Create a local copy of |result| to avoid problems with the callback
-  // getting passed to the media thread and causing |result| to be destructed
-  // on the wrong thread in some failure conditions. Blink should prevent
-  // multiple simultaneous calls.
-  DCHECK(!set_cdm_result_);
-  set_cdm_result_.reset(new blink::WebContentDecryptionModuleResult(result));
-
-  // Recreate the watch time reporter if necessary.
-  const bool was_encrypted = is_encrypted_;
-  is_encrypted_ = true;
-  if (!was_encrypted && watch_time_reporter_) CreateWatchTimeReporter();
-
-  SetCdm(cdm);
-}
-
-void WebMediaPlayerImpl::OnEncryptedMediaInitData(
-    EmeInitDataType init_data_type, const std::vector<uint8_t>& init_data) {
-  DCHECK(init_data_type != EmeInitDataType::UNKNOWN);
-
-  // TODO(xhwang): Update this UMA name. https://crbug.com/589251
-  UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1);
-
-  // Recreate the watch time reporter if necessary.
-  const bool was_encrypted = is_encrypted_;
-  is_encrypted_ = true;
-  if (!was_encrypted && watch_time_reporter_) CreateWatchTimeReporter();
-
-  encrypted_client_->encrypted(
-      ConvertToWebInitDataType(init_data_type), init_data.data(),
-      base::saturated_cast<unsigned int>(init_data.size()));
-}
-
-void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated(
-    std::unique_ptr<MediaTracks> tracks) {
-  // For MSE/chunk_demuxer case the media track updates are handled by
-  // WebSourceBufferImpl.
-  DCHECK(demuxer_.get());
-  DCHECK(!chunk_demuxer_);
-
-  // Report the media track information to blink.
-  for (const auto& track : tracks->tracks()) {
-    if (track->type() == MediaTrack::Audio) {
-      client_->addAudioTrack(blink::WebString::fromUTF8(track->id()),
-                             blink::WebMediaPlayerClient::AudioTrackKindMain,
-                             blink::WebString::fromUTF8(track->label()),
-                             blink::WebString::fromUTF8(track->language()),
-                             /*enabled*/ true);
-    } else if (track->type() == MediaTrack::Video) {
-      client_->addVideoTrack(blink::WebString::fromUTF8(track->id()),
-                             blink::WebMediaPlayerClient::VideoTrackKindMain,
-                             blink::WebString::fromUTF8(track->label()),
-                             blink::WebString::fromUTF8(track->language()),
-                             /*selected*/ true);
-    } else {
-      // Text tracks are not supported through this code path yet.
-      NOTREACHED();
-    }
-  }
-}
-
-void WebMediaPlayerImpl::SetCdm(blink::WebContentDecryptionModule* cdm) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK(cdm);
-  scoped_refptr<MediaKeys> cdm_reference =
-      ToWebContentDecryptionModuleImpl(cdm)->GetCdm();
-  if (!cdm_reference) {
-    NOTREACHED();
-    OnCdmAttached(false);
-    return;
-  }
-
-  CdmContext* cdm_context = cdm_reference->GetCdmContext();
-  if (!cdm_context) {
-    OnCdmAttached(false);
-    return;
-  }
-
-  // Keep the reference to the CDM, as it shouldn't be destroyed until
-  // after the pipeline is done with the |cdm_context|.
-  pending_cdm_ = std::move(cdm_reference);
-  pipeline_.SetCdm(cdm_context,
-                   base::Bind(&WebMediaPlayerImpl::OnCdmAttached, AsWeakPtr()));
-}
-
-void WebMediaPlayerImpl::OnCdmAttached(bool success) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK(pending_cdm_);
-
-  // If the CDM is set from the constructor there is no promise
-  // (|set_cdm_result_|) to fulfill.
-  if (success) {
-    // This will release the previously attached CDM (if any).
-    cdm_ = std::move(pending_cdm_);
-    if (set_cdm_result_) {
-      set_cdm_result_->complete();
-      set_cdm_result_.reset();
-    }
-
-    return;
-  }
-
-  pending_cdm_ = NULL;
-  if (set_cdm_result_) {
-    set_cdm_result_->completeWithError(
-        blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
-        "Unable to set MediaKeys object");
-    set_cdm_result_.reset();
-  }
-}
-
-void WebMediaPlayerImpl::OnPipelineSeeked(bool time_updated) {
-  seeking_ = false;
-  seek_time_ = base::TimeDelta();
-  if (paused_) {
-#if defined(OS_ANDROID)  // WMPI_CAST
-    if (isRemote()) {
-      paused_time_ = base::TimeDelta::FromSecondsD(cast_impl_.currentTime());
-    } else {
-      paused_time_ = pipeline_.GetMediaTime();
-    }
-#else
-    paused_time_ = pipeline_.GetMediaTime();
-#endif
-  } else {
-    DCHECK(watch_time_reporter_);
-    watch_time_reporter_->OnPlaying();
-  }
-  if (time_updated) should_notify_time_changed_ = true;
-
-  // Reset underflow count upon seek; this prevents looping videos and user
-  // actions from artificially inflating the underflow count.
-  underflow_count_ = 0;
-}
-
-void WebMediaPlayerImpl::OnPipelineSuspended() {
-#if defined(OS_ANDROID)
-  if (isRemote()) {
-    scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner();
-    if (frame) compositor_->PaintSingleFrame(frame);
-  }
-#endif
-
-  // If we're not in an aggressive buffering state, tell the data source we have
-  // enough data so that it may release the connection.
-  if (buffering_strategy_ !=
-      MultibufferDataSource::BUFFERING_STRATEGY_AGGRESSIVE) {
-    if (data_source_) data_source_->OnBufferingHaveEnough(true);
-  }
-
-  ReportMemoryUsage();
-
-  if (pending_suspend_resume_cycle_) {
-    pending_suspend_resume_cycle_ = false;
-    UpdatePlayState();
-  }
-}
-
-void WebMediaPlayerImpl::OnDemuxerOpened() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  client_->mediaSourceOpened(
-      new WebMediaSourceImpl(chunk_demuxer_, media_log_));
-}
-
-void WebMediaPlayerImpl::OnError(PipelineStatus status) {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK_NE(status, PIPELINE_OK);
-
-  if (suppress_destruction_errors_) return;
-
-  ReportPipelineError(load_type_, frame_->getSecurityOrigin(), status);
-  media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(status));
-
-  if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) {
-    // Any error that occurs before reaching ReadyStateHaveMetadata should
-    // be considered a format error.
-    SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
-  } else {
-    SetNetworkState(PipelineErrorToNetworkState(status));
-  }
-
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::OnEnded() {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // Ignore state changes until we've completed all outstanding operations.
-  if (!pipeline_controller_.IsStable()) return;
-
-  ended_ = true;
-  client_->timeChanged();
-
-  // We don't actually want this to run until |client_| calls seek() or pause(),
-  // but that should have already happened in timeChanged() and so this is
-  // expected to be a no-op.
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::OnMetadata(PipelineMetadata metadata) {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  pipeline_metadata_ = metadata;
-
-  SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
-  UMA_HISTOGRAM_ENUMERATION("Media.VideoRotation", metadata.video_rotation,
-                            VIDEO_ROTATION_MAX + 1);
-
-  if (hasVideo()) {
-    pipeline_metadata_.natural_size = GetRotatedVideoSize(
-        pipeline_metadata_.video_rotation, pipeline_metadata_.natural_size);
-
-    if (overlay_enabled_ && surface_manager_)
-      surface_manager_->NaturalSizeChanged(pipeline_metadata_.natural_size);
-
-    DCHECK(!video_weblayer_);
-    video_weblayer_.reset(new cc_blink::WebLayerImpl(cc::VideoLayer::Create(
-        compositor_, pipeline_metadata_.video_rotation)));
-    video_weblayer_->layer()->SetContentsOpaque(opaque_);
-    video_weblayer_->SetContentsOpaqueIsFixed(true);
-    client_->setWebLayer(video_weblayer_.get());
-  }
-
-  CreateWatchTimeReporter();
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::OnBufferingStateChange(BufferingState state) {
-  DVLOG(1) << __func__ << "(" << state << ")";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // Ignore buffering state changes until we've completed all outstanding
-  // operations.
-  if (!pipeline_controller_.IsStable()) return;
-
-  if (state == BUFFERING_HAVE_ENOUGH) {
-    if (data_source_ &&
-        highest_ready_state_ < WebMediaPlayer::ReadyStateHaveEnoughData) {
-      DCHECK_EQ(underflow_count_, 0);
-      // Record a zero value for underflow histograms so that the histogram
-      // includes playbacks which never encounter an underflow event.
-      UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", 0);
-      UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", base::TimeDelta());
-    }
-
-    // TODO(chcunningham): Monitor playback position vs buffered. Potentially
-    // transition to HAVE_FUTURE_DATA here if not enough is buffered.
-    SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
-
-    // Let the DataSource know we have enough data. It may use this information
-    // to release unused network connections.
-    if (data_source_) data_source_->OnBufferingHaveEnough(false);
-
-    // Blink expects a timeChanged() in response to a seek().
-    if (should_notify_time_changed_) client_->timeChanged();
-
-    // Once we have enough, start reporting the total memory usage. We'll also
-    // report once playback starts.
-    ReportMemoryUsage();
-
-    // Report the amount of time it took to leave the underflow state. Don't
-    // bother to report this for MSE playbacks since it's out of our control.
-    if (underflow_timer_ && data_source_) {
-      UMA_HISTOGRAM_TIMES("Media.UnderflowDuration",
-                          underflow_timer_->Elapsed());
-      underflow_timer_.reset();
-    }
-  } else {
-    // Buffering has underflowed.
-    DCHECK_EQ(state, BUFFERING_HAVE_NOTHING);
-
-    // Report the number of times we've entered the underflow state. Only report
-    // for src= playback since for MSE it's out of our control. Ensure we only
-    // report the value when transitioning from HAVE_ENOUGH to HAVE_NOTHING.
-    if (data_source_ &&
-        ready_state_ == WebMediaPlayer::ReadyStateHaveEnoughData) {
-      UMA_HISTOGRAM_COUNTS_100("Media.UnderflowCount", ++underflow_count_);
-      underflow_timer_.reset(new base::ElapsedTimer());
-    }
-
-    // It shouldn't be possible to underflow if we've not advanced past
-    // HAVE_CURRENT_DATA.
-    DCHECK_GT(highest_ready_state_, WebMediaPlayer::ReadyStateHaveCurrentData);
-    SetReadyState(WebMediaPlayer::ReadyStateHaveCurrentData);
-  }
-
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::OnDurationChange() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // TODO(sandersd): We should call delegate_->DidPlay() with the new duration,
-  // especially if it changed from  <5s to >5s.
-  if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) return;
-
-  client_->durationChanged();
-}
-
-void WebMediaPlayerImpl::OnAddTextTrack(const TextTrackConfig& config,
-                                        const AddTextTrackDoneCB& done_cb) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  const WebInbandTextTrackImpl::Kind web_kind =
-      static_cast<WebInbandTextTrackImpl::Kind>(config.kind());
-  const blink::WebString web_label = blink::WebString::fromUTF8(config.label());
-  const blink::WebString web_language =
-      blink::WebString::fromUTF8(config.language());
-  const blink::WebString web_id = blink::WebString::fromUTF8(config.id());
-
-  std::unique_ptr<WebInbandTextTrackImpl> web_inband_text_track(
-      new WebInbandTextTrackImpl(web_kind, web_label, web_language, web_id));
-
-  std::unique_ptr<media::TextTrack> text_track(new TextTrackImpl(
-      main_task_runner_, client_, std::move(web_inband_text_track)));
-
-  done_cb.Run(std::move(text_track));
-}
-
-void WebMediaPlayerImpl::OnWaitingForDecryptionKey() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  encrypted_client_->didBlockPlaybackWaitingForKey();
-  // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called
-  // when a key has been successfully added (e.g. OnSessionKeysChange() with
-  // |has_additional_usable_key| = true). http://crbug.com/461903
-  encrypted_client_->didResumePlaybackBlockedForKey();
-}
-
-void WebMediaPlayerImpl::OnVideoNaturalSizeChange(const gfx::Size& size) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing);
-
-  gfx::Size rotated_size =
-      GetRotatedVideoSize(pipeline_metadata_.video_rotation, size);
-
-  if (rotated_size == pipeline_metadata_.natural_size) return;
-
-  TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged");
-  media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent(
-      rotated_size.width(), rotated_size.height()));
-
-  if (overlay_enabled_ && surface_manager_)
-    surface_manager_->NaturalSizeChanged(rotated_size);
-
-  pipeline_metadata_.natural_size = rotated_size;
-  client_->sizeChanged();
-}
-
-void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing);
-
-  opaque_ = opaque;
-  // Modify content opaqueness of cc::Layer directly so that
-  // SetContentsOpaqueIsFixed is ignored.
-  if (video_weblayer_) video_weblayer_->layer()->SetContentsOpaque(opaque_);
-}
-
-void WebMediaPlayerImpl::OnHidden() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  if (watch_time_reporter_) watch_time_reporter_->OnHidden();
-
-  UpdatePlayState();
-
-  // Schedule suspended playing media to be paused if the user doesn't come back
-  // to it within some timeout period to avoid any autoplay surprises.
-  ScheduleIdlePauseTimer();
-}
-
-void WebMediaPlayerImpl::OnShown() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  if (watch_time_reporter_) watch_time_reporter_->OnShown();
-
-  must_suspend_ = false;
-  background_pause_timer_.Stop();
-
-  UpdatePlayState();
-}
-
-bool WebMediaPlayerImpl::OnSuspendRequested(bool must_suspend) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  if (must_suspend) {
-    must_suspend_ = true;
-    UpdatePlayState();
-    return true;
-  }
-
-  // If we're beyond HaveFutureData, we can safely suspend at any time.
-  if (highest_ready_state_ >= WebMediaPlayer::ReadyStateHaveFutureData) {
-    is_idle_ = true;
-    UpdatePlayState();
-    return true;
-  }
-
-  // Before HaveFutureData blink will not call play(), so we must be careful to
-  // only suspend if we'll eventually receive an event that will trigger a
-  // resume. If the last time loading progressed was a while ago, and we still
-  // haven't reached HaveFutureData, we assume that we're waiting on more data
-  // to continue pre-rolling. When that data is loaded the pipeline will be
-  // resumed by didLoadingProgress().
-  if (last_time_loading_progressed_.is_null() ||
-      (tick_clock_->NowTicks() - last_time_loading_progressed_) >
-          kLoadingToIdleTimeout) {
-    is_idle_ = true;
-    UpdatePlayState();
-    return true;
-  }
-
-  return false;
-}
-
-void WebMediaPlayerImpl::OnPlay() {
-  play();
-  client_->playbackStateChanged();
-}
-
-void WebMediaPlayerImpl::OnPause() {
-  pause();
-  client_->playbackStateChanged();
-}
-
-void WebMediaPlayerImpl::OnVolumeMultiplierUpdate(double multiplier) {
-  volume_multiplier_ = multiplier;
-  setVolume(volume_);
-}
-
-void WebMediaPlayerImpl::ScheduleRestart() {
-  // TODO(watk): All restart logic should be moved into PipelineController.
-  if (pipeline_.IsRunning() && !pipeline_controller_.IsPipelineSuspended()) {
-    pending_suspend_resume_cycle_ = true;
-    UpdatePlayState();
-  }
-}
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-bool WebMediaPlayerImpl::isRemote() const { return cast_impl_.isRemote(); }
-
-void WebMediaPlayerImpl::SetMediaPlayerManager(
-    RendererMediaPlayerManagerInterface* media_player_manager) {
-  cast_impl_.SetMediaPlayerManager(media_player_manager);
-}
-
-void WebMediaPlayerImpl::requestRemotePlayback() {
-  cast_impl_.requestRemotePlayback();
-}
-
-void WebMediaPlayerImpl::requestRemotePlaybackControl() {
-  cast_impl_.requestRemotePlaybackControl();
-}
-
-void WebMediaPlayerImpl::OnRemotePlaybackEnded() {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  ended_ = true;
-  client_->timeChanged();
-}
-
-void WebMediaPlayerImpl::OnDisconnectedFromRemoteDevice(double t) {
-  DoSeek(base::TimeDelta::FromSecondsD(t), false);
-
-  // We already told the delegate we're paused when remoting started.
-  client_->playbackStateChanged();
-  client_->disconnectedFromRemoteDevice();
-
-  UpdatePlayState();
-}
-
-void WebMediaPlayerImpl::SuspendForRemote() {
-  if (pipeline_controller_.IsPipelineSuspended()) {
-    scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner();
-    if (frame) compositor_->PaintSingleFrame(frame);
-  }
-
-  UpdatePlayState();
-}
-
-gfx::Size WebMediaPlayerImpl::GetCanvasSize() const {
-  if (!video_weblayer_) return pipeline_metadata_.natural_size;
-
-  return video_weblayer_->bounds();
-}
-
-void WebMediaPlayerImpl::SetDeviceScaleFactor(float scale_factor) {
-  cast_impl_.SetDeviceScaleFactor(scale_factor);
-}
-
-void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) {
-  cast_impl_.setPoster(poster);
-}
-#endif  // defined(OS_ANDROID)  // WMPI_CAST
-
-void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
-  DVLOG(1) << __func__;
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-#if defined(OS_ANDROID)
-  // We can't play HLS URLs with WebMediaPlayerImpl, so in cases where they are
-  // encountered, instruct the HTML media element to create a new WebMediaPlayer
-  // instance with the correct URL to trigger WebMediaPlayerAndroid creation.
-  //
-  // TODO(tguilbert): Remove this code path once we have the ability to host a
-  // MediaPlayer within a Mojo media renderer.  http://crbug.com/580626
-  if (data_source_) {
-    const GURL url_after_redirects = data_source_->GetUrlAfterRedirects();
-    if (MediaCodecUtil::IsHLSPath(url_after_redirects)) {
-      client_->requestReload(url_after_redirects);
-      // |this| may be destructed, do nothing after this.
-      return;
-    }
-  }
-#endif
-
-  if (!success) {
-    SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
-
-    // Not really necessary, since the pipeline was never started, but it at
-    // least this makes sure that the error handling code is in sync.
-    UpdatePlayState();
-
-    return;
-  }
-
-  StartPipeline();
-}
-
-void WebMediaPlayerImpl::NotifyDownloading(bool is_downloading) {
-  DVLOG(1) << __func__;
-  if (!is_downloading && network_state_ == WebMediaPlayer::NetworkStateLoading)
-    SetNetworkState(WebMediaPlayer::NetworkStateIdle);
-  else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle)
-    SetNetworkState(WebMediaPlayer::NetworkStateLoading);
-  media_log_->AddEvent(
-      media_log_->CreateBooleanEvent(MediaLogEvent::NETWORK_ACTIVITY_SET,
-                                     "is_downloading_data", is_downloading));
-}
-
-void WebMediaPlayerImpl::OnSurfaceCreated(int surface_id) {
-  if (force_video_overlays_ && surface_id == SurfaceManager::kNoSurfaceID)
-    LOG(ERROR) << "Create surface failed.";
-
-  overlay_surface_id_ = surface_id;
-  if (!pending_surface_request_cb_.is_null())
-    base::ResetAndReturn(&pending_surface_request_cb_).Run(surface_id);
-}
-
-// TODO(watk): Move this state management out of WMPI.
-void WebMediaPlayerImpl::OnSurfaceRequested(
-    const SurfaceCreatedCB& surface_created_cb) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  DCHECK(surface_manager_);
-
-  // A null callback indicates that the decoder is going away.
-  if (surface_created_cb.is_null()) {
-    decoder_requires_restart_for_overlay_ = false;
-    pending_surface_request_cb_.Reset();
-    return;
-  }
-
-  // If we're getting a surface request it means GVD is initializing, so until
-  // we get a null surface request, GVD is the active decoder. While that's the
-  // case we should restart the pipeline on fullscreen transitions so that when
-  // we create a new GVD it will request a surface again and get the right kind
-  // of surface for the fullscreen state.
-  // TODO(watk): Don't require a pipeline restart to switch surfaces for
-  // cases where it isn't necessary.
-  decoder_requires_restart_for_overlay_ = true;
-  if (overlay_enabled_) {
-    if (overlay_surface_id_ != SurfaceManager::kNoSurfaceID)
-      surface_created_cb.Run(overlay_surface_id_);
-    else
-      pending_surface_request_cb_ = surface_created_cb;
-  } else {
-    // Tell the decoder to create its own surface.
-    surface_created_cb.Run(SurfaceManager::kNoSurfaceID);
-  }
-}
-
-std::unique_ptr<Renderer> WebMediaPlayerImpl::CreateRenderer() {
-  if (force_video_overlays_) EnableOverlay();
-
-  RequestSurfaceCB request_surface_cb;
-#if defined(OS_ANDROID)
-  request_surface_cb =
-      BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnSurfaceRequested);
-#endif
-  return renderer_factory_->CreateRenderer(
-      media_task_runner_, worker_task_runner_, audio_source_provider_.get(),
-      compositor_, request_surface_cb);
-}
-
-void WebMediaPlayerImpl::StartPipeline() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb =
-      BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnEncryptedMediaInitData);
-
-  // Figure out which demuxer to use.
-  if (load_type_ != LoadTypeMediaSource) {
-    DCHECK(!chunk_demuxer_);
-    DCHECK(data_source_);
-
-#if !defined(MEDIA_DISABLE_FFMPEG)
-    Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb =
-        BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated);
-
-    demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(),
-                                     encrypted_media_init_data_cb,
-                                     media_tracks_updated_cb, media_log_));
-#else
-    OnError(PipelineStatus::DEMUXER_ERROR_COULD_NOT_OPEN);
-    return;
-#endif
-  } else {
-    DCHECK(!chunk_demuxer_);
-    DCHECK(!data_source_);
-
-    chunk_demuxer_ = new ChunkDemuxer(
-        BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened),
-        encrypted_media_init_data_cb, media_log_, true);
-    demuxer_.reset(chunk_demuxer_);
-  }
-
-  // TODO(sandersd): FileSystem objects may also be non-static, but due to our
-  // caching layer such situations are broken already. http://crbug.com/593159
-  bool is_static = !chunk_demuxer_;
-
-  // ... and we're ready to go!
-  seeking_ = true;
-
-  // TODO(sandersd): On Android, defer Start() if the tab is not visible.
-  bool is_streaming = (data_source_ && data_source_->IsStreaming());
-  pipeline_controller_.Start(demuxer_.get(), this, is_streaming, is_static);
-}
-
-void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) {
-  DVLOG(1) << __func__ << "(" << state << ")";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  network_state_ = state;
-  // Always notify to ensure client has the latest value.
-  client_->networkStateChanged();
-}
-
-void WebMediaPlayerImpl::SetReadyState(WebMediaPlayer::ReadyState state) {
-  DVLOG(1) << __func__ << "(" << state << ")";
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  if (state == WebMediaPlayer::ReadyStateHaveEnoughData && data_source_ &&
-      data_source_->assume_fully_buffered() &&
-      network_state_ == WebMediaPlayer::NetworkStateLoading)
-    SetNetworkState(WebMediaPlayer::NetworkStateLoaded);
-
-  ready_state_ = state;
-  highest_ready_state_ = std::max(highest_ready_state_, ready_state_);
-
-  // Always notify to ensure client has the latest value.
-  client_->readyStateChanged();
-}
-
-blink::WebAudioSourceProvider* WebMediaPlayerImpl::getAudioSourceProvider() {
-  return audio_source_provider_.get();
-}
-
-double WebMediaPlayerImpl::GetPipelineDuration() const {
-  base::TimeDelta duration = pipeline_.GetMediaDuration();
-
-  // Return positive infinity if the resource is unbounded.
-  // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-duration
-  if (duration == kInfiniteDuration)
-    return std::numeric_limits<double>::infinity();
-
-  return duration.InSecondsF();
-}
-
-static void GetCurrentFrameAndSignal(VideoFrameCompositor* compositor,
-                                     scoped_refptr<VideoFrame>* video_frame_out,
-                                     base::WaitableEvent* event) {
-  TRACE_EVENT0("media", "GetCurrentFrameAndSignal");
-  *video_frame_out = compositor->GetCurrentFrameAndUpdateIfStale();
-  event->Signal();
-}
-
-scoped_refptr<VideoFrame> WebMediaPlayerImpl::GetCurrentFrameFromCompositor() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-  TRACE_EVENT0("media", "WebMediaPlayerImpl::GetCurrentFrameFromCompositor");
-
-  // Needed when the |main_task_runner_| and |compositor_task_runner_| are the
-  // same to avoid deadlock in the Wait() below.
-  if (compositor_task_runner_->BelongsToCurrentThread())
-    return compositor_->GetCurrentFrameAndUpdateIfStale();
-
-  // Use a posted task and waitable event instead of a lock otherwise
-  // WebGL/Canvas can see different content than what the compositor is seeing.
-  scoped_refptr<VideoFrame> video_frame;
-  base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
-                            base::WaitableEvent::InitialState::NOT_SIGNALED);
-  compositor_task_runner_->PostTask(
-      FROM_HERE,
-      base::Bind(&GetCurrentFrameAndSignal, base::Unretained(compositor_),
-                 &video_frame, &event));
-  event.Wait();
-  return video_frame;
-}
-
-void WebMediaPlayerImpl::UpdatePlayState() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  bool is_remote = isRemote();
-#else
-  bool is_remote = false;
-#endif
-
-  bool is_suspended = pipeline_controller_.IsSuspended();
-  bool is_backgrounded =
-      IsBackgroundedSuspendEnabled() && delegate_ && delegate_->IsHidden();
-  PlayState state = UpdatePlayState_ComputePlayState(is_remote, is_suspended,
-                                                     is_backgrounded);
-  SetDelegateState(state.delegate_state);
-  SetMemoryReportingState(state.is_memory_reporting_enabled);
-  SetSuspendState(state.is_suspended || pending_suspend_resume_cycle_);
-}
-
-void WebMediaPlayerImpl::SetDelegateState(DelegateState new_state) {
-  if (!delegate_) return;
-
-  if (delegate_state_ == new_state) {
-    if (delegate_state_ != DelegateState::PLAYING ||
-        autoplay_muted_ == client_->isAutoplayingMuted()) {
-      return;
-    }
-  }
-
-  delegate_state_ = new_state;
-
-  switch (delegate_state_) {
-    case DelegateState::GONE:
-      delegate_->PlayerGone(delegate_id_);
-      break;
-    case DelegateState::PLAYING: {
-      autoplay_muted_ = client_->isAutoplayingMuted();
-      bool has_audio = autoplay_muted_ ? false : hasAudio();
-      delegate_->DidPlay(
-          delegate_id_, hasVideo(), has_audio, false,
-          media::DurationToMediaContentType(pipeline_.GetMediaDuration()));
-      break;
-    }
-    case DelegateState::PAUSED:
-      delegate_->DidPause(delegate_id_, false);
-      break;
-    case DelegateState::ENDED:
-      delegate_->DidPause(delegate_id_, true);
-      break;
-  }
-}
-
-void WebMediaPlayerImpl::SetMemoryReportingState(
-    bool is_memory_reporting_enabled) {
-  if (memory_usage_reporting_timer_.IsRunning() ==
-      is_memory_reporting_enabled) {
-    return;
-  }
-
-  if (is_memory_reporting_enabled) {
-    memory_usage_reporting_timer_.Start(FROM_HERE,
-                                        base::TimeDelta::FromSeconds(2), this,
-                                        &WebMediaPlayerImpl::ReportMemoryUsage);
-  } else {
-    memory_usage_reporting_timer_.Stop();
-    ReportMemoryUsage();
-  }
-}
-
-void WebMediaPlayerImpl::SetSuspendState(bool is_suspended) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // Do not change the state after an error has occurred.
-  // TODO(sandersd): Update PipelineController to remove the need for this.
-  if (IsNetworkStateError(network_state_)) return;
-
-#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
-  // TODO(sandersd): idle suspend is disabled if decoder owns video frame.
-  // Used on OSX,Windows+Chromecast. Since GetCurrentFrameFromCompositor is
-  // a synchronous cross-thread post, avoid the cost on platforms that
-  // always allow suspend. Need to find a better mechanism for this. See
-  // http://crbug.com/595716 and http://crbug.com/602708
-  if (can_suspend_state_ == CanSuspendState::UNKNOWN) {
-    scoped_refptr<VideoFrame> frame = GetCurrentFrameFromCompositor();
-    if (frame) {
-      can_suspend_state_ =
-          frame->metadata()->IsTrue(VideoFrameMetadata::DECODER_OWNS_FRAME)
-              ? CanSuspendState::NO
-              : CanSuspendState::YES;
-    }
-  }
-#else
-  can_suspend_state_ = CanSuspendState::YES;
-#endif
-
-  if (can_suspend_state_ == CanSuspendState::NO) return;
-
-  if (is_suspended) {
-    pipeline_controller_.Suspend();
-  } else {
-    pipeline_controller_.Resume();
-  }
-}
-
-WebMediaPlayerImpl::PlayState
-WebMediaPlayerImpl::UpdatePlayState_ComputePlayState(bool is_remote,
-                                                     bool is_suspended,
-                                                     bool is_backgrounded) {
-  PlayState result;
-
-  // This includes both data source (before pipeline startup) and pipeline
-  // errors.
-  bool has_error = IsNetworkStateError(network_state_);
-
-  // After HaveMetadata, we know which tracks are present and the duration.
-  bool have_metadata = ready_state_ >= WebMediaPlayer::ReadyStateHaveMetadata;
-
-  // After HaveFutureData, Blink will call play() if the state is not paused;
-  // prior to this point |paused_| is not accurate.
-  bool have_future_data =
-      highest_ready_state_ >= WebMediaPlayer::ReadyStateHaveFutureData;
-
-  // Background suspend is not enabled for audio-only players unless paused,
-  // though in the case of audio-only the session should be kept.
-  // Videos are not suspended if the user resumed the playback via the remote
-  // controls earlier and it's still playing.
-  bool is_backgrounded_video = is_backgrounded && have_metadata && hasVideo();
-  bool can_play_backgrounded = is_backgrounded_video && !is_remote &&
-                               hasAudio() && IsResumeBackgroundVideosEnabled();
-  bool is_background_playing =
-      delegate_ && delegate_->IsPlayingBackgroundVideo();
-  bool background_suspended = is_backgrounded_video &&
-                              !(can_play_backgrounded && is_background_playing);
-  bool background_pause_suspended =
-      is_backgrounded && paused_ && have_future_data;
-
-  // Idle suspension is allowed prior to have future data since there exist
-  // mechanisms to exit the idle state when the player is capable of reaching
-  // the have future data state; see didLoadingProgress().
-  //
-  // TODO(sandersd): Make the delegate suspend idle players immediately when
-  // hidden.
-  bool idle_suspended = is_idle_ && paused_ && !seeking_ && !overlay_enabled_;
-
-  // If we're already suspended, see if we can wait for user interaction. Prior
-  // to HaveFutureData, we require |is_idle_| to remain suspended. |is_idle_|
-  // will be cleared when we receive data which may take us to HaveFutureData.
-  bool can_stay_suspended =
-      (is_idle_ || have_future_data) && is_suspended && paused_ && !seeking_;
-
-  // Combined suspend state.
-  result.is_suspended = is_remote || must_suspend_ || idle_suspended ||
-                        background_suspended || background_pause_suspended ||
-                        can_stay_suspended;
-
-  // We do not treat |playback_rate_| == 0 as paused. For the media session,
-  // being paused implies displaying a play button, which is incorrect in this
-  // case. For memory usage reporting, we just use the same definition (but we
-  // don't have to).
-  //
-  // Similarly, we don't consider |ended_| to be paused. Blink will immediately
-  // call pause() or seek(), so |ended_| should not affect the computation.
-  // Despite that, |ended_| does result in a separate paused state, to simplfy
-  // the contract for SetDelegateState().
-  //
-  // |has_session| is used to decide when to create a media session. Idle
-  // suspension does not destroy the media session, because we expect that the
-  // notification controls (and audio focus) remain. We also require:
-  //   - |have_metadata|, since the tracks and duration are passed to DidPlay().
-  //   - |have_future_data|, since we need to know whether we are paused to
-  //     correctly configure the session.
-  //
-  // TODO(sandersd): If Blink told us the paused state sooner, we could create
-  // the media session sooner.
-  bool can_play = !has_error && !is_remote && have_future_data;
-  bool has_session_playing =
-      can_play && !must_suspend_ && !background_suspended;
-
-  // |has_session_suspended| means the player is suspended from the media
-  // element point of view but paused and can be resumed from the delegate point
-  // of view. Therefore it behaves like |paused_| for the delegate.
-  bool has_session_suspended = can_play && !must_suspend_ &&
-                               background_suspended && can_play_backgrounded;
-
-  bool has_session = has_session_playing || has_session_suspended;
-
-  if (!has_session) {
-    result.delegate_state = DelegateState::GONE;
-  } else if (paused_ || has_session_suspended) {
-    result.delegate_state =
-        ended_ ? DelegateState::ENDED : DelegateState::PAUSED;
-  } else {
-    result.delegate_state = DelegateState::PLAYING;
-  }
-
-  // It's not critical if some cases where memory usage can change are missed,
-  // since media memory changes are usually gradual.
-  result.is_memory_reporting_enabled =
-      can_play && !result.is_suspended && !paused_;
-
-  return result;
-}
-
-void WebMediaPlayerImpl::ReportMemoryUsage() {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  // About base::Unretained() usage below: We destroy |demuxer_| on the main
-  // thread.  Before that, however, ~WebMediaPlayerImpl() posts a task to the
-  // media thread and waits for it to finish.  Hence, the GetMemoryUsage() task
-  // posted here must finish earlier.
-
-  if (demuxer_) {
-    base::PostTaskAndReplyWithResult(
-        media_task_runner_.get(), FROM_HERE,
-        base::Bind(&Demuxer::GetMemoryUsage, base::Unretained(demuxer_.get())),
-        base::Bind(&WebMediaPlayerImpl::FinishMemoryUsageReport, AsWeakPtr()));
-  } else {
-    FinishMemoryUsageReport(0);
-  }
-}
-
-void WebMediaPlayerImpl::FinishMemoryUsageReport(int64_t demuxer_memory_usage) {
-  DCHECK(main_task_runner_->BelongsToCurrentThread());
-
-  const PipelineStatistics stats = pipeline_.GetStatistics();
-  const int64_t current_memory_usage =
-      stats.audio_memory_usage + stats.video_memory_usage +
-      (data_source_ ? data_source_->GetMemoryUsage() : 0) +
-      demuxer_memory_usage;
-
-  // Note, this isn't entirely accurate, there may be VideoFrames held by the
-  // compositor or other resources that we're unaware of.
-
-  DVLOG(2) << "Memory Usage -- Audio: " << stats.audio_memory_usage
-           << ", Video: " << stats.video_memory_usage << ", DataSource: "
-           << (data_source_ ? data_source_->GetMemoryUsage() : 0)
-           << ", Demuxer: " << demuxer_memory_usage;
-
-  const int64_t delta = current_memory_usage - last_reported_memory_usage_;
-  last_reported_memory_usage_ = current_memory_usage;
-  adjust_allocated_memory_cb_.Run(delta);
-}
-
-void WebMediaPlayerImpl::ScheduleIdlePauseTimer() {
-  // Only schedule the pause timer if we're playing and are suspended.
-  if (paused_ || !pipeline_controller_.IsSuspended()) return;
-
-#if defined(OS_ANDROID)
-  // Remote players will be suspended and locally paused.
-  if (isRemote()) return;
-#endif
-
-  // Idle timeout chosen arbitrarily.
-  background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
-                                this, &WebMediaPlayerImpl::OnPause);
-}
-
-void WebMediaPlayerImpl::CreateWatchTimeReporter() {
-  // Create the watch time reporter and synchronize its initial state.
-  watch_time_reporter_.reset(new WatchTimeReporter(
-      hasAudio(), hasVideo(), !!chunk_demuxer_, is_encrypted_, media_log_,
-      pipeline_metadata_.natural_size,
-      base::Bind(&GetCurrentTimeInternal, this)));
-  watch_time_reporter_->OnVolumeChange(volume_);
-  if (delegate_ && delegate_->IsHidden())
-    watch_time_reporter_->OnHidden();
-  else
-    watch_time_reporter_->OnShown();
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webmediaplayer_impl.h b/src/cobalt/media/blink/webmediaplayer_impl.h
deleted file mode 100644
index a61edcb..0000000
--- a/src/cobalt/media/blink/webmediaplayer_impl.h
+++ /dev/null
@@ -1,565 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/cancelable_callback.h"
-#include "base/compiler_specific.h"
-#include "base/default_tick_clock.h"
-#include "base/memory/linked_ptr.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/thread.h"
-#include "base/timer/elapsed_timer.h"
-#include "base/timer/timer.h"
-#include "build/build_config.h"
-#include "cobalt/media/base/media_tracks.h"
-#include "cobalt/media/base/pipeline_impl.h"
-#include "cobalt/media/base/renderer_factory.h"
-#include "cobalt/media/base/surface_manager.h"
-#include "cobalt/media/base/text_track.h"
-#include "cobalt/media/blink/buffered_data_source_host_impl.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/blink/multibuffer_data_source.h"
-#include "cobalt/media/blink/video_frame_compositor.h"
-#include "cobalt/media/blink/webmediaplayer_delegate.h"
-#include "cobalt/media/blink/webmediaplayer_params.h"
-#include "cobalt/media/blink/webmediaplayer_util.h"
-#include "cobalt/media/filters/pipeline_controller.h"
-#include "cobalt/media/renderers/skcanvas_video_renderer.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebAudioSourceProvider.h"
-#include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-// Delete this file when WMPI_CAST is no longer needed.
-#include "cobalt/media/blink/webmediaplayer_cast_android.h"
-#endif
-
-namespace blink {
-class WebLocalFrame;
-class WebMediaPlayerClient;
-class WebMediaPlayerEncryptedMediaClient;
-}
-
-namespace base {
-class SingleThreadTaskRunner;
-class TaskRunner;
-}
-
-namespace cc_blink {
-class WebLayerImpl;
-}
-
-namespace gpu {
-namespace gles2 {
-class GLES2Interface;
-}
-}
-
-namespace cobalt {
-namespace media {
-class ChunkDemuxer;
-class GpuVideoAcceleratorFactories;
-class MediaKeys;
-class MediaLog;
-class UrlIndex;
-class VideoFrameCompositor;
-class WatchTimeReporter;
-class WebAudioSourceProviderImpl;
-class WebMediaPlayerDelegate;
-class WebTextTrackImpl;
-
-// The canonical implementation of blink::WebMediaPlayer that's backed by
-// Pipeline. Handles normal resource loading, Media Source, and
-// Encrypted Media.
-class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
-    : public NON_EXPORTED_BASE(blink::WebMediaPlayer),
-      public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer),
-      public NON_EXPORTED_BASE(Pipeline::Client),
-      public base::SupportsWeakPtr<WebMediaPlayerImpl> {
- public:
-  // Constructs a WebMediaPlayer implementation using Chromium's media stack.
-  // |delegate| may be null. |renderer_factory| must not be null.
-  WebMediaPlayerImpl(
-      blink::WebLocalFrame* frame, blink::WebMediaPlayerClient* client,
-      blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
-      base::WeakPtr<WebMediaPlayerDelegate> delegate,
-      std::unique_ptr<RendererFactory> renderer_factory,
-      linked_ptr<UrlIndex> url_index, const WebMediaPlayerParams& params);
-  ~WebMediaPlayerImpl() OVERRIDE;
-
-  void load(LoadType load_type, const blink::WebMediaPlayerSource& source,
-            CORSMode cors_mode) OVERRIDE;
-
-  // Playback controls.
-  void play() OVERRIDE;
-  void pause() OVERRIDE;
-  bool supportsSave() const OVERRIDE;
-  void seek(double seconds) OVERRIDE;
-  void setRate(double rate) OVERRIDE;
-  void setVolume(double volume) OVERRIDE;
-  void setSinkId(const blink::WebString& sink_id,
-                 const blink::WebSecurityOrigin& security_origin,
-                 blink::WebSetSinkIdCallbacks* web_callback) OVERRIDE;
-  void setPreload(blink::WebMediaPlayer::Preload preload) OVERRIDE;
-  void setBufferingStrategy(
-      blink::WebMediaPlayer::BufferingStrategy buffering_strategy) OVERRIDE;
-  blink::WebTimeRanges buffered() const OVERRIDE;
-  blink::WebTimeRanges seekable() const OVERRIDE;
-
-  // paint() the current video frame into |canvas|. This is used to support
-  // various APIs and functionalities, including but not limited to: <canvas>,
-  // WebGL texImage2D, ImageBitmap, printing and capturing capabilities.
-  void paint(blink::WebCanvas* canvas, const blink::WebRect& rect,
-             SkPaint& paint) OVERRIDE;
-
-  // True if the loaded media has a playable video/audio track.
-  bool hasVideo() const OVERRIDE;
-  bool hasAudio() const OVERRIDE;
-
-  void enabledAudioTracksChanged(
-      const blink::WebVector<blink::WebMediaPlayer::TrackId>& enabledTrackIds)
-      OVERRIDE;
-  void selectedVideoTrackChanged(
-      blink::WebMediaPlayer::TrackId* selectedTrackId) OVERRIDE;
-
-  // Dimensions of the video.
-  blink::WebSize naturalSize() const OVERRIDE;
-
-  // Getters of playback state.
-  bool paused() const OVERRIDE;
-  bool seeking() const OVERRIDE;
-  double duration() const OVERRIDE;
-  virtual double timelineOffset() const;
-  double currentTime() const OVERRIDE;
-
-  // Internal states of loading and network.
-  // TODO(hclam): Ask the pipeline about the state rather than having reading
-  // them from members which would cause race conditions.
-  blink::WebMediaPlayer::NetworkState getNetworkState() const OVERRIDE;
-  blink::WebMediaPlayer::ReadyState getReadyState() const OVERRIDE;
-
-  blink::WebString getErrorMessage() OVERRIDE;
-  bool didLoadingProgress() OVERRIDE;
-
-  bool hasSingleSecurityOrigin() const OVERRIDE;
-  bool didPassCORSAccessCheck() const OVERRIDE;
-
-  double mediaTimeForTimeValue(double timeValue) const OVERRIDE;
-
-  unsigned decodedFrameCount() const OVERRIDE;
-  unsigned droppedFrameCount() const OVERRIDE;
-  size_t audioDecodedByteCount() const OVERRIDE;
-  size_t videoDecodedByteCount() const OVERRIDE;
-
-  bool copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interface* gl,
-                                         unsigned int texture,
-                                         unsigned int internal_format,
-                                         unsigned int type,
-                                         bool premultiply_alpha,
-                                         bool flip_y) OVERRIDE;
-
-  blink::WebAudioSourceProvider* getAudioSourceProvider() OVERRIDE;
-
-  void setContentDecryptionModule(
-      blink::WebContentDecryptionModule* cdm,
-      blink::WebContentDecryptionModuleResult result) OVERRIDE;
-
-  bool supportsOverlayFullscreenVideo() OVERRIDE;
-  void enteredFullscreen() OVERRIDE;
-  void exitedFullscreen() OVERRIDE;
-
-  // WebMediaPlayerDelegate::Observer implementation.
-  void OnHidden() OVERRIDE;
-  void OnShown() OVERRIDE;
-  bool OnSuspendRequested(bool must_suspend) OVERRIDE;
-  void OnPlay() OVERRIDE;
-  void OnPause() OVERRIDE;
-  void OnVolumeMultiplierUpdate(double multiplier) OVERRIDE;
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  bool isRemote() const OVERRIDE;
-  void requestRemotePlayback() OVERRIDE;
-  void requestRemotePlaybackControl() OVERRIDE;
-
-  void SetMediaPlayerManager(
-      RendererMediaPlayerManagerInterface* media_player_manager);
-  void OnRemotePlaybackEnded();
-  void OnDisconnectedFromRemoteDevice(double t);
-  void SuspendForRemote();
-  void DisplayCastFrameAfterSuspend(const scoped_refptr<VideoFrame>& new_frame,
-                                    PipelineStatus status);
-  gfx::Size GetCanvasSize() const;
-  void SetDeviceScaleFactor(float scale_factor);
-  void setPoster(const blink::WebURL& poster) OVERRIDE;
-#endif
-
-  // Called from WebMediaPlayerCast.
-  // TODO(hubbe): WMPI_CAST make private.
-  void OnPipelineSeeked(bool time_updated);
-
-  // Distinct states that |delegate_| can be in.
-  // TODO(sandersd): This should move into WebMediaPlayerDelegate.
-  // (Public for testing.)
-  enum class DelegateState {
-    GONE,
-    PLAYING,
-    PAUSED,
-    ENDED,
-  };
-
-  // Playback state variables computed together in UpdatePlayState().
-  // (Public for testing.)
-  struct PlayState {
-    DelegateState delegate_state;
-    bool is_memory_reporting_enabled;
-    bool is_suspended;
-  };
-
- private:
-  friend class WebMediaPlayerImplTest;
-
-  void EnableOverlay();
-  void DisableOverlay();
-
-  void OnPipelineSuspended();
-  void OnDemuxerOpened();
-
-  // Pipeline::Client overrides.
-  void OnError(PipelineStatus status) OVERRIDE;
-  void OnEnded() OVERRIDE;
-  void OnMetadata(PipelineMetadata metadata) OVERRIDE;
-  void OnBufferingStateChange(BufferingState state) OVERRIDE;
-  void OnDurationChange() OVERRIDE;
-  void OnAddTextTrack(const TextTrackConfig& config,
-                      const AddTextTrackDoneCB& done_cb) OVERRIDE;
-  void OnWaitingForDecryptionKey() OVERRIDE;
-  void OnVideoNaturalSizeChange(const gfx::Size& size) OVERRIDE;
-  void OnVideoOpacityChange(bool opaque) OVERRIDE;
-
-  // Actually seek. Avoids causing |should_notify_time_changed_| to be set when
-  // |time_updated| is false.
-  void DoSeek(base::TimeDelta time, bool time_updated);
-
-  // Ask for the renderer to be restarted (destructed and recreated).
-  void ScheduleRestart();
-
-  // Called after |defer_load_cb_| has decided to allow the load. If
-  // |defer_load_cb_| is null this is called immediately.
-  void DoLoad(LoadType load_type, const blink::WebURL& url, CORSMode cors_mode);
-
-  // Called after asynchronous initialization of a data source completed.
-  void DataSourceInitialized(bool success);
-
-  // Called when the data source is downloading or paused.
-  void NotifyDownloading(bool is_downloading);
-
-  // Called by SurfaceManager when a surface is created.
-  void OnSurfaceCreated(int surface_id);
-
-  // Called by GpuVideoDecoder on Android to request a surface to render to (if
-  // necessary).
-  void OnSurfaceRequested(const SurfaceCreatedCB& surface_created_cb);
-
-  // Creates a Renderer via the |renderer_factory_|.
-  std::unique_ptr<Renderer> CreateRenderer();
-
-  // Finishes starting the pipeline due to a call to load().
-  void StartPipeline();
-
-  // Helpers that set the network/ready state and notifies the client if
-  // they've changed.
-  void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
-  void SetReadyState(blink::WebMediaPlayer::ReadyState state);
-
-  // Gets the duration value reported by the pipeline.
-  double GetPipelineDuration() const;
-
-  // Called by VideoRendererImpl on its internal thread with the new frame to be
-  // painted.
-  void FrameReady(const scoped_refptr<VideoFrame>& frame);
-
-  // Returns the current video frame from |compositor_|. Blocks until the
-  // compositor can return the frame.
-  scoped_refptr<VideoFrame> GetCurrentFrameFromCompositor();
-
-  // Called when the demuxer encounters encrypted streams.
-  void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
-                                const std::vector<uint8_t>& init_data);
-
-  // Called when the FFmpegDemuxer encounters new media tracks. This is only
-  // invoked when using FFmpegDemuxer, since MSE/ChunkDemuxer handle media
-  // tracks separately in WebSourceBufferImpl.
-  void OnFFmpegMediaTracksUpdated(std::unique_ptr<MediaTracks> tracks);
-
-  // Sets CdmContext from |cdm| on the pipeline and calls OnCdmAttached()
-  // when done.
-  void SetCdm(blink::WebContentDecryptionModule* cdm);
-
-  // Called when a CDM has been attached to the |pipeline_|.
-  void OnCdmAttached(bool success);
-
-  // Inspects the current playback state and:
-  //   - notifies |delegate_|,
-  //   - toggles the memory usage reporting timer, and
-  //   - toggles suspend/resume as necessary.
-  //
-  // This method should be called any time its dependent values change. These
-  // are:
-  //   - isRemote(),
-  //   - hasVideo(),
-  //   - delegate_->IsHidden(),
-  //   - network_state_, ready_state_,
-  //   - is_idle_, must_suspend_,
-  //   - paused_, ended_,
-  //   - pending_suspend_resume_cycle_,
-  void UpdatePlayState();
-
-  // Methods internal to UpdatePlayState().
-  PlayState UpdatePlayState_ComputePlayState(bool is_remote, bool is_suspended,
-                                             bool is_backgrounded);
-  void SetDelegateState(DelegateState new_state);
-  void SetMemoryReportingState(bool is_memory_reporting_enabled);
-  void SetSuspendState(bool is_suspended);
-
-  // Called at low frequency to tell external observers how much memory we're
-  // using for video playback.  Called by |memory_usage_reporting_timer_|.
-  // Memory usage reporting is done in two steps, because |demuxer_| must be
-  // accessed on the media thread.
-  void ReportMemoryUsage();
-  void FinishMemoryUsageReport(int64_t demuxer_memory_usage);
-
-  // Called during OnHidden() when we want a suspended player to enter the
-  // paused state after some idle timeout.
-  void ScheduleIdlePauseTimer();
-
-  void CreateWatchTimeReporter();
-
-  blink::WebLocalFrame* frame_;
-
-  // The playback state last reported to |delegate_|, to avoid setting duplicate
-  // states. (Which can have undesired effects like resetting the idle timer.)
-  DelegateState delegate_state_;
-
-  // Set when OnSuspendRequested() is called with |must_suspend| unset.
-  bool is_idle_;
-
-  // Set when OnSuspendRequested() is called with |must_suspend| set.
-  bool must_suspend_;
-
-  blink::WebMediaPlayer::NetworkState network_state_;
-  blink::WebMediaPlayer::ReadyState ready_state_;
-  blink::WebMediaPlayer::ReadyState highest_ready_state_;
-
-  // Preload state for when |data_source_| is created after setPreload().
-  MultibufferDataSource::Preload preload_;
-
-  // Buffering strategy for when |data_source_| is created after
-  // setBufferingStrategy().
-  MultibufferDataSource::BufferingStrategy buffering_strategy_;
-
-  // Task runner for posting tasks on Chrome's main thread. Also used
-  // for DCHECKs so methods calls won't execute in the wrong thread.
-  const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
-
-  scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
-  scoped_refptr<base::TaskRunner> worker_task_runner_;
-  scoped_refptr<MediaLog> media_log_;
-
-  // |pipeline_controller_| references |pipeline_| and therefore must be
-  // constructed after and destructed before |pipeline_|.
-  PipelineImpl pipeline_;
-  PipelineController pipeline_controller_;
-
-  // The LoadType passed in the |load_type| parameter of the load() call.
-  LoadType load_type_;
-
-  // Cache of metadata for answering hasAudio(), hasVideo(), and naturalSize().
-  PipelineMetadata pipeline_metadata_;
-
-  // Whether the video is known to be opaque or not.
-  bool opaque_;
-
-  // Playback state.
-  //
-  // TODO(scherkus): we have these because Pipeline favours the simplicity of a
-  // single "playback rate" over worrying about paused/stopped etc...  It forces
-  // all clients to manage the pause+playback rate externally, but is that
-  // really a bad thing?
-  //
-  // TODO(scherkus): since SetPlaybackRate(0) is asynchronous and we don't want
-  // to hang the render thread during pause(), we record the time at the same
-  // time we pause and then return that value in currentTime().  Otherwise our
-  // clock can creep forward a little bit while the asynchronous
-  // SetPlaybackRate(0) is being executed.
-  double playback_rate_;
-
-  // Set while paused. |paused_time_| is only valid when |paused_| is true.
-  bool paused_;
-  base::TimeDelta paused_time_;
-
-  // Set when starting, seeking, and resuming (all of which require a Pipeline
-  // seek). |seek_time_| is only valid when |seeking_| is true.
-  bool seeking_;
-  base::TimeDelta seek_time_;
-
-  // Set when doing a restart (a suspend and resume in sequence) of the pipeline
-  // in order to destruct and reinitialize the decoders. This is separate from
-  // |pending_resume_| and |pending_suspend_| because they can be elided in
-  // certain cases, whereas for a restart they must happen.
-  // TODO(sandersd,watk): Create a simpler interface for a pipeline restart.
-  bool pending_suspend_resume_cycle_;
-
-  // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement,
-  // see http://crbug.com/409280
-  bool ended_;
-
-  // Tracks whether to issue time changed notifications during buffering state
-  // changes.
-  bool should_notify_time_changed_;
-
-  bool overlay_enabled_;
-
-  // Whether the current decoder requires a restart on overlay transitions.
-  bool decoder_requires_restart_for_overlay_;
-
-  blink::WebMediaPlayerClient* client_;
-  blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_;
-
-  // WebMediaPlayer notifies the |delegate_| of playback state changes using
-  // |delegate_id_|; an id provided after registering with the delegate.  The
-  // WebMediaPlayer may also receive directives (play, pause) from the delegate
-  // via the WebMediaPlayerDelegate::Observer interface after registration.
-  base::WeakPtr<WebMediaPlayerDelegate> delegate_;
-  int delegate_id_;
-
-  WebMediaPlayerParams::DeferLoadCB defer_load_cb_;
-  WebMediaPlayerParams::Context3DCB context_3d_cb_;
-
-  // Members for notifying upstream clients about internal memory usage.  The
-  // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|.
-  base::RepeatingTimer memory_usage_reporting_timer_;
-  WebMediaPlayerParams::AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
-  int64_t last_reported_memory_usage_;
-
-  // Routes audio playback to either AudioRendererSink or WebAudio.
-  scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_;
-
-  bool supports_save_;
-
-  // These two are mutually exclusive:
-  //   |data_source_| is used for regular resource loads.
-  //   |chunk_demuxer_| is used for Media Source resource loads.
-  //
-  // |demuxer_| will contain the appropriate demuxer based on which resource
-  // load strategy we're using.
-  std::unique_ptr<MultibufferDataSource> data_source_;
-  std::unique_ptr<Demuxer> demuxer_;
-  ChunkDemuxer* chunk_demuxer_;
-
-  BufferedDataSourceHostImpl buffered_data_source_host_;
-  linked_ptr<UrlIndex> url_index_;
-
-  // Video rendering members.
-  scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
-  VideoFrameCompositor* compositor_;  // Deleted on |compositor_task_runner_|.
-  SkCanvasVideoRenderer skcanvas_video_renderer_;
-
-  // The compositor layer for displaying the video content when using composited
-  // playback.
-  std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_;
-
-  std::unique_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_;
-
-  // If a CDM is attached keep a reference to it, so that it is not destroyed
-  // until after the pipeline is done with it.
-  scoped_refptr<MediaKeys> cdm_;
-
-  // Keep track of the CDM while it is in the process of attaching to the
-  // pipeline.
-  scoped_refptr<MediaKeys> pending_cdm_;
-
-#if defined(OS_ANDROID)  // WMPI_CAST
-  WebMediaPlayerCast cast_impl_;
-#endif
-
-  // The last volume received by setVolume() and the last volume multiplier from
-  // OnVolumeMultiplierUpdate().  The multiplier is typical 1.0, but may be less
-  // if the WebMediaPlayerDelegate has requested a volume reduction (ducking)
-  // for a transient sound.  Playout volume is derived by volume * multiplier.
-  double volume_;
-  double volume_multiplier_;
-
-  std::unique_ptr<RendererFactory> renderer_factory_;
-
-  // For requesting surfaces on behalf of the Android H/W decoder in fullscreen.
-  // This will be null everywhere but Android.
-  SurfaceManager* surface_manager_;
-
-  // For canceling ongoing surface creation requests when exiting fullscreen.
-  base::CancelableCallback<void(int)> surface_created_cb_;
-
-  // The current overlay surface id. Populated while in fullscreen once the
-  // surface is created.
-  int overlay_surface_id_;
-
-  // If a surface is requested before it's finished being created, the request
-  // is saved and satisfied once the surface is available.
-  SurfaceCreatedCB pending_surface_request_cb_;
-
-  // Force to use SurfaceView instead of SurfaceTexture on Android.
-  bool force_video_overlays_;
-
-  // Prevent use of SurfaceView on Android. (Ignored when
-  // |force_video_overlays_| is true.)
-  bool disable_fullscreen_video_overlays_;
-
-  // Suppresses calls to OnPipelineError() after destruction / shutdown has been
-  // started; prevents us from spuriously logging errors that are transient or
-  // unimportant.
-  bool suppress_destruction_errors_;
-
-  // State indicating if it's okay to suspend or not. Updated on the first time
-  // OnSuspendRequested() is called. If the state is UNKNOWN, the current frame
-  // from the compositor will be queried to see if suspend is supported; the
-  // state will be set to YES or NO respectively if a frame is available.
-  enum class CanSuspendState { UNKNOWN, YES, NO };
-  CanSuspendState can_suspend_state_;
-
-  // Called some-time after OnHidden() if the media was suspended in a playing
-  // state as part of the call to OnHidden().
-  base::OneShotTimer background_pause_timer_;
-
-  // Monitors the watch time of the played content.
-  std::unique_ptr<WatchTimeReporter> watch_time_reporter_;
-  bool is_encrypted_;
-
-  // Number of times we've reached BUFFERING_HAVE_NOTHING during playback.
-  int underflow_count_;
-  std::unique_ptr<base::ElapsedTimer> underflow_timer_;
-
-  // The last time didLoadingProgress() returned true.
-  base::TimeTicks last_time_loading_progressed_;
-
-  std::unique_ptr<base::TickClock> tick_clock_;
-
-  // Whether the player is currently in autoplay muted state.
-  bool autoplay_muted_ = false;
-
-  DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
diff --git a/src/cobalt/media/blink/webmediaplayer_impl_unittest.cc b/src/cobalt/media/blink/webmediaplayer_impl_unittest.cc
deleted file mode 100644
index b97fd12..0000000
--- a/src/cobalt/media/blink/webmediaplayer_impl_unittest.cc
+++ /dev/null
@@ -1,719 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cobalt/media/blink/webmediaplayer_impl.h"
-
-#include <memory>
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/command_line.h"
-#include "base/memory/ptr_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/message_loop.h"
-#include "base/run_loop.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/base/media_switches.h"
-#include "cobalt/media/base/test_helpers.h"
-#include "cobalt/media/blink/webmediaplayer_delegate.h"
-#include "cobalt/media/blink/webmediaplayer_params.h"
-#include "cobalt/media/renderers/default_renderer_factory.h"
-#include "googleurl/src/gurl.h"
-#include "starboard/types.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebSize.h"
-#include "third_party/WebKit/public/web/WebFrameClient.h"
-#include "third_party/WebKit/public/web/WebLocalFrame.h"
-#include "third_party/WebKit/public/web/WebView.h"
-
-using ::testing::AnyNumber;
-using ::testing::InSequence;
-using ::testing::Return;
-using ::testing::_;
-
-namespace cobalt {
-namespace media {
-
-int64_t OnAdjustAllocatedMemory(int64_t delta) { return 0; }
-
-class DummyWebMediaPlayerClient : public blink::WebMediaPlayerClient {
- public:
-  DummyWebMediaPlayerClient() {}
-
-  // blink::WebMediaPlayerClient implementation.
-  void networkStateChanged() override {}
-  void readyStateChanged() override {}
-  void timeChanged() override {}
-  void repaint() override {}
-  void durationChanged() override {}
-  void sizeChanged() override {}
-  void playbackStateChanged() override {}
-  void setWebLayer(blink::WebLayer*) override {}
-  blink::WebMediaPlayer::TrackId addAudioTrack(
-      const blink::WebString& id, blink::WebMediaPlayerClient::AudioTrackKind,
-      const blink::WebString& label, const blink::WebString& language,
-      bool enabled) override {
-    return blink::WebMediaPlayer::TrackId();
-  }
-  void removeAudioTrack(blink::WebMediaPlayer::TrackId) override {}
-  blink::WebMediaPlayer::TrackId addVideoTrack(
-      const blink::WebString& id, blink::WebMediaPlayerClient::VideoTrackKind,
-      const blink::WebString& label, const blink::WebString& language,
-      bool selected) override {
-    return blink::WebMediaPlayer::TrackId();
-  }
-  void removeVideoTrack(blink::WebMediaPlayer::TrackId) override {}
-  void addTextTrack(blink::WebInbandTextTrack*) override {}
-  void removeTextTrack(blink::WebInbandTextTrack*) override {}
-  void mediaSourceOpened(blink::WebMediaSource*) override {}
-  void requestSeek(double) override {}
-  void remoteRouteAvailabilityChanged(bool) override {}
-  void connectedToRemoteDevice() override {}
-  void disconnectedFromRemoteDevice() override {}
-  void cancelledRemotePlaybackRequest() override {}
-  bool isAutoplayingMuted() override { return is_autoplaying_muted_; }
-  void requestReload(const blink::WebURL& newUrl) override {}
-
-  void set_is_autoplaying_muted(bool value) { is_autoplaying_muted_ = value; }
-
- private:
-  bool is_autoplaying_muted_ = false;
-
-  DISALLOW_COPY_AND_ASSIGN(DummyWebMediaPlayerClient);
-};
-
-class MockWebMediaPlayerDelegate
-    : public WebMediaPlayerDelegate,
-      public base::SupportsWeakPtr<MockWebMediaPlayerDelegate> {
- public:
-  MockWebMediaPlayerDelegate() = default;
-  ~MockWebMediaPlayerDelegate() = default;
-
-  // WebMediaPlayerDelegate implementation.
-  MOCK_METHOD1(AddObserver, int(Observer*));
-  MOCK_METHOD1(RemoveObserver, void(int));
-  MOCK_METHOD5(DidPlay, void(int, bool, bool, bool, MediaContentType));
-  MOCK_METHOD2(DidPause, void(int, bool));
-  MOCK_METHOD1(PlayerGone, void(int));
-  MOCK_METHOD0(IsHidden, bool());
-  MOCK_METHOD0(IsPlayingBackgroundVideo, bool());
-};
-
-class WebMediaPlayerImplTest : public testing::Test {
- public:
-  WebMediaPlayerImplTest()
-      : media_thread_("MediaThreadForTest"),
-        web_view_(
-            blink::WebView::create(NULL, blink::WebPageVisibilityStateVisible)),
-        web_local_frame_(blink::WebLocalFrame::create(
-            blink::WebTreeScopeType::Document, &web_frame_client_)),
-        media_log_(new MediaLog()),
-        audio_parameters_(TestAudioParameters::Normal()) {
-    web_view_->setMainFrame(web_local_frame_);
-    media_thread_.StartAndWaitForTesting();
-  }
-
-  void InitializeWebMediaPlayerImpl() {
-    wmpi_.reset(new WebMediaPlayerImpl(
-        web_local_frame_, &client_, NULL, delegate_.AsWeakPtr(),
-        base::MakeUnique<DefaultRendererFactory>(
-            media_log_, NULL, DefaultRendererFactory::GetGpuFactoriesCB()),
-        url_index_,
-        WebMediaPlayerParams(
-            WebMediaPlayerParams::DeferLoadCB(),
-            scoped_refptr<SwitchableAudioRendererSink>(), media_log_,
-            media_thread_.task_runner(), message_loop_.task_runner(),
-            message_loop_.task_runner(), WebMediaPlayerParams::Context3DCB(),
-            base::Bind(&OnAdjustAllocatedMemory), NULL, NULL)));
-  }
-
-  ~WebMediaPlayerImplTest() override {
-    // Destruct WebMediaPlayerImpl and pump the message loop to ensure that
-    // objects passed to the message loop for destruction are released.
-    //
-    // NOTE: This should be done before any other member variables are
-    // destructed since WMPI may reference them during destruction.
-    wmpi_.reset();
-    base::RunLoop().RunUntilIdle();
-
-    web_view_->close();
-  }
-
- protected:
-  void SetReadyState(blink::WebMediaPlayer::ReadyState state) {
-    wmpi_->SetReadyState(state);
-  }
-
-  void SetPaused(bool is_paused) { wmpi_->paused_ = is_paused; }
-  void SetSeeking(bool is_seeking) { wmpi_->seeking_ = is_seeking; }
-  void SetEnded(bool is_ended) { wmpi_->ended_ = is_ended; }
-  void SetTickClock(base::TickClock* clock) { wmpi_->tick_clock_.reset(clock); }
-
-  void SetFullscreen(bool is_fullscreen) {
-    wmpi_->overlay_enabled_ = is_fullscreen;
-  }
-
-  void SetMetadata(bool has_audio, bool has_video) {
-    wmpi_->SetNetworkState(blink::WebMediaPlayer::NetworkStateLoaded);
-    wmpi_->SetReadyState(blink::WebMediaPlayer::ReadyStateHaveMetadata);
-    wmpi_->pipeline_metadata_.has_audio = has_audio;
-    wmpi_->pipeline_metadata_.has_video = has_video;
-  }
-
-  void OnMetadata(PipelineMetadata metadata) { wmpi_->OnMetadata(metadata); }
-
-  void OnVideoNaturalSizeChange(const gfx::Size& size) {
-    wmpi_->OnVideoNaturalSizeChange(size);
-  }
-
-  WebMediaPlayerImpl::PlayState ComputePlayState() {
-    wmpi_->is_idle_ = false;
-    wmpi_->must_suspend_ = false;
-    return wmpi_->UpdatePlayState_ComputePlayState(false, false, false);
-  }
-
-  WebMediaPlayerImpl::PlayState ComputePlayStateSuspended() {
-    wmpi_->is_idle_ = false;
-    wmpi_->must_suspend_ = false;
-    return wmpi_->UpdatePlayState_ComputePlayState(false, true, false);
-  }
-
-  WebMediaPlayerImpl::PlayState ComputeBackgroundedPlayState() {
-    wmpi_->is_idle_ = false;
-    wmpi_->must_suspend_ = false;
-    return wmpi_->UpdatePlayState_ComputePlayState(false, false, true);
-  }
-
-  WebMediaPlayerImpl::PlayState ComputeIdlePlayState() {
-    wmpi_->is_idle_ = true;
-    wmpi_->must_suspend_ = false;
-    return wmpi_->UpdatePlayState_ComputePlayState(false, false, false);
-  }
-
-  WebMediaPlayerImpl::PlayState ComputeIdleSuspendedPlayState() {
-    wmpi_->is_idle_ = true;
-    wmpi_->must_suspend_ = false;
-    return wmpi_->UpdatePlayState_ComputePlayState(false, true, false);
-  }
-
-  WebMediaPlayerImpl::PlayState ComputeMustSuspendPlayState() {
-    wmpi_->is_idle_ = false;
-    wmpi_->must_suspend_ = true;
-    return wmpi_->UpdatePlayState_ComputePlayState(false, false, false);
-  }
-
-  void SetDelegateState(WebMediaPlayerImpl::DelegateState state) {
-    wmpi_->SetDelegateState(state);
-  }
-
-  bool IsSuspended() { return wmpi_->pipeline_controller_.IsSuspended(); }
-
-  void AddBufferedRanges() {
-    wmpi_->buffered_data_source_host_.AddBufferedByteRange(0, 1);
-  }
-
-  void SetupForResumingBackgroundVideo() {
-#if !defined(OS_ANDROID)
-    // Need to enable media suspend to test resuming background videos.
-    base::CommandLine::ForCurrentProcess()->AppendSwitch(
-        switches::kEnableMediaSuspend);
-#endif  // !defined(OS_ANDROID)
-    std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
-    feature_list->InitializeFromCommandLine(kResumeBackgroundVideo.name, "");
-    base::FeatureList::ClearInstanceForTesting();
-    base::FeatureList::SetInstance(std::move(feature_list));
-  }
-
-  // "Renderer" thread.
-  base::MessageLoop message_loop_;
-
-  // "Media" thread. This is necessary because WMPI destruction waits on a
-  // WaitableEvent.
-  base::Thread media_thread_;
-
-  // Blink state.
-  blink::WebFrameClient web_frame_client_;
-  blink::WebView* web_view_;
-  blink::WebLocalFrame* web_local_frame_;
-
-  scoped_refptr<MediaLog> media_log_;
-  linked_ptr<media::UrlIndex> url_index_;
-
-  // Audio hardware configuration.
-  AudioParameters audio_parameters_;
-
-  // The client interface used by |wmpi_|. Just a dummy for now, but later we
-  // may want a mock or intelligent fake.
-  DummyWebMediaPlayerClient client_;
-
-  testing::NiceMock<MockWebMediaPlayerDelegate> delegate_;
-
-  // The WebMediaPlayerImpl instance under test.
-  std::unique_ptr<WebMediaPlayerImpl> wmpi_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImplTest);
-};
-
-TEST_F(WebMediaPlayerImplTest, ConstructAndDestroy) {
-  InitializeWebMediaPlayerImpl();
-}
-
-TEST_F(WebMediaPlayerImplTest, IdleSuspendIsEnabledBeforeLoadingBegins) {
-  InitializeWebMediaPlayerImpl();
-  wmpi_->OnSuspendRequested(false);
-  base::RunLoop().RunUntilIdle();
-  EXPECT_TRUE(IsSuspended());
-}
-
-TEST_F(WebMediaPlayerImplTest,
-       IdleSuspendIsDisabledIfLoadingProgressedRecently) {
-  InitializeWebMediaPlayerImpl();
-  base::SimpleTestTickClock* clock = new base::SimpleTestTickClock();
-  clock->Advance(base::TimeDelta::FromSeconds(1));
-  SetTickClock(clock);
-  AddBufferedRanges();
-  wmpi_->didLoadingProgress();
-  // Advance less than the loading timeout.
-  clock->Advance(base::TimeDelta::FromSeconds(1));
-  wmpi_->OnSuspendRequested(false);
-  base::RunLoop().RunUntilIdle();
-  EXPECT_FALSE(IsSuspended());
-}
-
-TEST_F(WebMediaPlayerImplTest, IdleSuspendIsEnabledIfLoadingHasStalled) {
-  InitializeWebMediaPlayerImpl();
-  base::SimpleTestTickClock* clock = new base::SimpleTestTickClock();
-  clock->Advance(base::TimeDelta::FromSeconds(1));
-  SetTickClock(clock);
-  AddBufferedRanges();
-  wmpi_->didLoadingProgress();
-  // Advance more than the loading timeout.
-  clock->Advance(base::TimeDelta::FromSeconds(4));
-  wmpi_->OnSuspendRequested(false);
-  base::RunLoop().RunUntilIdle();
-  EXPECT_TRUE(IsSuspended());
-}
-
-TEST_F(WebMediaPlayerImplTest, DidLoadingProgressTriggersResume) {
-  InitializeWebMediaPlayerImpl();
-  EXPECT_FALSE(IsSuspended());
-  wmpi_->OnSuspendRequested(false);
-  base::RunLoop().RunUntilIdle();
-  EXPECT_TRUE(IsSuspended());
-  AddBufferedRanges();
-  wmpi_->didLoadingProgress();
-  base::RunLoop().RunUntilIdle();
-  EXPECT_FALSE(IsSuspended());
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_AfterConstruction) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeIdlePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_AfterMetadata) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeIdlePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_AfterMetadata_AudioOnly) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, false);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeIdlePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  SetPaused(false);
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_AfterFutureData) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeBackgroundedPlayState();
-
-  if (base::FeatureList::IsEnabled(kResumeBackgroundVideo))
-    EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  else
-    EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  // Idle suspension is possible after HaveFutureData.
-  state = ComputeIdlePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_Playing) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetPaused(false);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeBackgroundedPlayState();
-  if (base::FeatureList::IsEnabled(kResumeBackgroundVideo))
-    EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  else
-    EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_PlayingThenUnderflow) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetPaused(false);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveCurrentData);
-
-  // Underflow should not trigger idle suspend. The user is still playing the
-  // the video, just waiting on the network.
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  // Background suspend should still be possible during underflow.
-  state = ComputeBackgroundedPlayState();
-  if (base::FeatureList::IsEnabled(kResumeBackgroundVideo))
-    EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  else
-    EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  // Forced suspend should still be possible during underflow.
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_Playing_AudioOnly) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, false);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetPaused(false);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  // Audio-only stays playing in the background.
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  // Backgrounding a paused audio only player should suspend, but keep the
-  // session alive for user interactions.
-  SetPaused(true);
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  state = ComputeMustSuspendPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_Paused_Seek) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetSeeking(true);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_Paused_Fullscreen) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetFullscreen(true);
-
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_Ended) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetEnded(true);
-
-  // The pipeline is not suspended immediately on ended.
-  state = ComputePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::ENDED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  state = ComputeIdlePlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::ENDED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_Suspended) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-
-  // Suspended players should be resumed unless we have reached the appropriate
-  // ready state and are not seeking.
-  SetPaused(true);
-  state = ComputePlayStateSuspended();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  // Paused players in the idle state are allowed to remain suspended.
-  state = ComputeIdleSuspendedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  SetPaused(false);
-  state = ComputePlayStateSuspended();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-
-  // Paused players should stay suspended.
-  SetPaused(true);
-  state = ComputePlayStateSuspended();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-
-  // Playing players should resume into the playing state.
-  SetPaused(false);
-  state = ComputePlayStateSuspended();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  // If seeking, the previously suspended state does not matter; the player
-  // should always be resumed.
-  SetSeeking(true);
-
-  SetPaused(true);
-  state = ComputePlayStateSuspended();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-
-  SetPaused(false);
-  state = ComputePlayStateSuspended();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, NaturalSizeChange) {
-  InitializeWebMediaPlayerImpl();
-  PipelineMetadata metadata;
-  metadata.has_video = true;
-  metadata.natural_size = gfx::Size(320, 240);
-
-  OnMetadata(metadata);
-  ASSERT_EQ(blink::WebSize(320, 240), wmpi_->naturalSize());
-
-  // TODO(sandersd): Verify that the client is notified of the size change?
-  OnVideoNaturalSizeChange(gfx::Size(1920, 1080));
-  ASSERT_EQ(blink::WebSize(1920, 1080), wmpi_->naturalSize());
-}
-
-TEST_F(WebMediaPlayerImplTest, NaturalSizeChange_Rotated) {
-  InitializeWebMediaPlayerImpl();
-  PipelineMetadata metadata;
-  metadata.has_video = true;
-  metadata.natural_size = gfx::Size(320, 240);
-  metadata.video_rotation = VIDEO_ROTATION_90;
-
-  // For 90/270deg rotations, the natural size should be transposed.
-  OnMetadata(metadata);
-  ASSERT_EQ(blink::WebSize(240, 320), wmpi_->naturalSize());
-
-  OnVideoNaturalSizeChange(gfx::Size(1920, 1080));
-  ASSERT_EQ(blink::WebSize(1080, 1920), wmpi_->naturalSize());
-}
-
-// Audible backgrounded videos are not suspended if delegate_ allows it.
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_BackgroundedVideoPlaying) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-
-  SetupForResumingBackgroundVideo();
-
-  EXPECT_CALL(delegate_, IsPlayingBackgroundVideo())
-      .WillRepeatedly(Return(true));
-  EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true));
-
-  SetPaused(false);
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
-  EXPECT_TRUE(state.is_memory_reporting_enabled);
-  EXPECT_FALSE(state.is_suspended);
-}
-
-// Backgrounding audible videos should suspend them and report as paused, not
-// gone.
-TEST_F(WebMediaPlayerImplTest, ComputePlayState_BackgroundedVideoPaused) {
-  InitializeWebMediaPlayerImpl();
-  WebMediaPlayerImpl::PlayState state;
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-
-  SetupForResumingBackgroundVideo();
-
-  EXPECT_CALL(delegate_, IsPlayingBackgroundVideo()).WillOnce(Return(false));
-  EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true));
-
-  state = ComputeBackgroundedPlayState();
-  EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
-  EXPECT_FALSE(state.is_memory_reporting_enabled);
-  EXPECT_TRUE(state.is_suspended);
-}
-
-TEST_F(WebMediaPlayerImplTest, AutoplayMuted_StartsAndStops) {
-  InitializeWebMediaPlayerImpl();
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetPaused(false);
-
-  EXPECT_CALL(delegate_, DidPlay(_, true, false, false, _));
-  client_.set_is_autoplaying_muted(true);
-  SetDelegateState(WebMediaPlayerImpl::DelegateState::PLAYING);
-
-  EXPECT_CALL(delegate_, DidPlay(_, true, true, false, _));
-  client_.set_is_autoplaying_muted(false);
-  SetDelegateState(WebMediaPlayerImpl::DelegateState::PLAYING);
-}
-
-TEST_F(WebMediaPlayerImplTest, AutoplayMuted_SetVolume) {
-  InitializeWebMediaPlayerImpl();
-  SetMetadata(true, true);
-  SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
-  SetPaused(false);
-
-  EXPECT_CALL(delegate_, DidPlay(_, true, false, false, _));
-  client_.set_is_autoplaying_muted(true);
-  SetDelegateState(WebMediaPlayerImpl::DelegateState::PLAYING);
-
-  EXPECT_CALL(delegate_, DidPlay(_, true, true, false, _));
-  client_.set_is_autoplaying_muted(false);
-  wmpi_->setVolume(1.0);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webmediaplayer_params.cc b/src/cobalt/media/blink/webmediaplayer_params.cc
deleted file mode 100644
index 9f63e01..0000000
--- a/src/cobalt/media/blink/webmediaplayer_params.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webmediaplayer_params.h"
-
-#include "base/single_thread_task_runner.h"
-#include "base/task_runner.h"
-#include "cobalt/media/base/audio_renderer_sink.h"
-#include "cobalt/media/base/media_log.h"
-
-namespace cobalt {
-namespace media {
-
-WebMediaPlayerParams::WebMediaPlayerParams(
-    const DeferLoadCB& defer_load_cb,
-    const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink,
-    const scoped_refptr<MediaLog>& media_log,
-    const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
-    const scoped_refptr<base::TaskRunner>& worker_task_runner,
-    const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
-    const Context3DCB& context_3d_cb,
-    const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb,
-    blink::WebContentDecryptionModule* initial_cdm,
-    SurfaceManager* surface_manager)
-    : defer_load_cb_(defer_load_cb),
-      audio_renderer_sink_(audio_renderer_sink),
-      media_log_(media_log),
-      media_task_runner_(media_task_runner),
-      worker_task_runner_(worker_task_runner),
-      compositor_task_runner_(compositor_task_runner),
-      context_3d_cb_(context_3d_cb),
-      adjust_allocated_memory_cb_(adjust_allocated_memory_cb),
-      initial_cdm_(initial_cdm),
-      surface_manager_(surface_manager) {}
-
-WebMediaPlayerParams::~WebMediaPlayerParams() {}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webmediaplayer_params.h b/src/cobalt/media/blink/webmediaplayer_params.h
deleted file mode 100644
index e51d5f8..0000000
--- a/src/cobalt/media/blink/webmediaplayer_params.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
-#define COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "cobalt/media/filters/context_3d.h"
-#include "starboard/types.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-class TaskRunner;
-}
-
-namespace blink {
-class WebContentDecryptionModule;
-class WebMediaPlayerClient;
-}
-
-namespace cobalt {
-namespace media {
-
-class SwitchableAudioRendererSink;
-class MediaLog;
-class SurfaceManager;
-
-// Holds parameters for constructing WebMediaPlayerImpl without having
-// to plumb arguments through various abstraction layers.
-class MEDIA_BLINK_EXPORT WebMediaPlayerParams {
- public:
-  typedef base::Callback<void(const base::Closure&)> DeferLoadCB;
-  typedef base::Callback<Context3D()> Context3DCB;
-
-  // Callback to tell V8 about the amount of memory used by the WebMediaPlayer
-  // instance.  The input parameter is the delta in bytes since the last call to
-  // AdjustAllocatedMemoryCB and the return value is the total number of bytes
-  // used by objects external to V8.  Note: this value includes things that are
-  // not the WebMediaPlayer!
-  typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB;
-
-  // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and
-  // |context_3d_cb| may be null.
-  WebMediaPlayerParams(
-      const DeferLoadCB& defer_load_cb,
-      const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink,
-      const scoped_refptr<MediaLog>& media_log,
-      const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
-      const scoped_refptr<base::TaskRunner>& worker_task_runner,
-      const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
-      const Context3DCB& context_3d,
-      const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb,
-      blink::WebContentDecryptionModule* initial_cdm,
-      SurfaceManager* surface_manager);
-
-  ~WebMediaPlayerParams();
-
-  DeferLoadCB defer_load_cb() const { return defer_load_cb_; }
-
-  const scoped_refptr<SwitchableAudioRendererSink>& audio_renderer_sink()
-      const {
-    return audio_renderer_sink_;
-  }
-
-  const scoped_refptr<MediaLog>& media_log() const { return media_log_; }
-
-  const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner() const {
-    return media_task_runner_;
-  }
-
-  const scoped_refptr<base::TaskRunner> worker_task_runner() const {
-    return worker_task_runner_;
-  }
-
-  const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner()
-      const {
-    return compositor_task_runner_;
-  }
-
-  Context3DCB context_3d_cb() const { return context_3d_cb_; }
-
-  blink::WebContentDecryptionModule* initial_cdm() const {
-    return initial_cdm_;
-  }
-
-  AdjustAllocatedMemoryCB adjust_allocated_memory_cb() const {
-    return adjust_allocated_memory_cb_;
-  }
-
-  SurfaceManager* surface_manager() const { return surface_manager_; }
-
- private:
-  DeferLoadCB defer_load_cb_;
-  scoped_refptr<SwitchableAudioRendererSink> audio_renderer_sink_;
-  scoped_refptr<MediaLog> media_log_;
-  scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
-  scoped_refptr<base::TaskRunner> worker_task_runner_;
-  scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
-  Context3DCB context_3d_cb_;
-  AdjustAllocatedMemoryCB adjust_allocated_memory_cb_;
-
-  blink::WebContentDecryptionModule* initial_cdm_;
-  SurfaceManager* surface_manager_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_
diff --git a/src/cobalt/media/blink/webmediaplayer_util.cc b/src/cobalt/media/blink/webmediaplayer_util.cc
deleted file mode 100644
index 8fae2a6..0000000
--- a/src/cobalt/media/blink/webmediaplayer_util.cc
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webmediaplayer_util.h"
-
-#include <math.h>
-#include <string>
-#include <utility>
-
-#include "base/metrics/histogram.h"
-#include "cobalt/media/base/bind_to_current_loop.h"
-#include "cobalt/media/base/media_client.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/URLConversion.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.h"
-
-namespace cobalt {
-namespace media {
-
-blink::WebTimeRanges ConvertToWebTimeRanges(
-    const Ranges<base::TimeDelta>& ranges) {
-  blink::WebTimeRanges result(ranges.size());
-  for (size_t i = 0; i < ranges.size(); ++i) {
-    result[i].start = ranges.start(i).InSecondsF();
-    result[i].end = ranges.end(i).InSecondsF();
-  }
-  return result;
-}
-
-blink::WebMediaPlayer::NetworkState PipelineErrorToNetworkState(
-    PipelineStatus error) {
-  switch (error) {
-    case PIPELINE_ERROR_NETWORK:
-    case PIPELINE_ERROR_READ:
-    case CHUNK_DEMUXER_ERROR_EOS_STATUS_NETWORK_ERROR:
-      return blink::WebMediaPlayer::NetworkStateNetworkError;
-
-    case PIPELINE_ERROR_INITIALIZATION_FAILED:
-    case PIPELINE_ERROR_COULD_NOT_RENDER:
-    case PIPELINE_ERROR_EXTERNAL_RENDERER_FAILED:
-    case DEMUXER_ERROR_COULD_NOT_OPEN:
-    case DEMUXER_ERROR_COULD_NOT_PARSE:
-    case DEMUXER_ERROR_NO_SUPPORTED_STREAMS:
-    case DECODER_ERROR_NOT_SUPPORTED:
-      return blink::WebMediaPlayer::NetworkStateFormatError;
-
-    case PIPELINE_ERROR_DECODE:
-    case PIPELINE_ERROR_ABORT:
-    case PIPELINE_ERROR_INVALID_STATE:
-    case CHUNK_DEMUXER_ERROR_APPEND_FAILED:
-    case CHUNK_DEMUXER_ERROR_EOS_STATUS_DECODE_ERROR:
-    case AUDIO_RENDERER_ERROR:
-    case AUDIO_RENDERER_ERROR_SPLICE_FAILED:
-      return blink::WebMediaPlayer::NetworkStateDecodeError;
-
-    case PIPELINE_OK:
-      NOTREACHED() << "Unexpected status! " << error;
-  }
-  return blink::WebMediaPlayer::NetworkStateFormatError;
-}
-
-namespace {
-
-// Helper enum for reporting scheme histograms.
-enum URLSchemeForHistogram {
-  kUnknownURLScheme,
-  kMissingURLScheme,
-  kHttpURLScheme,
-  kHttpsURLScheme,
-  kFtpURLScheme,
-  kChromeExtensionURLScheme,
-  kJavascriptURLScheme,
-  kFileURLScheme,
-  kBlobURLScheme,
-  kDataURLScheme,
-  kFileSystemScheme,
-  kMaxURLScheme = kFileSystemScheme  // Must be equal to highest enum value.
-};
-
-URLSchemeForHistogram URLScheme(const GURL& url) {
-  if (!url.has_scheme()) return kMissingURLScheme;
-  if (url.SchemeIs("http")) return kHttpURLScheme;
-  if (url.SchemeIs("https")) return kHttpsURLScheme;
-  if (url.SchemeIs("ftp")) return kFtpURLScheme;
-  if (url.SchemeIs("chrome-extension")) return kChromeExtensionURLScheme;
-  if (url.SchemeIs("javascript")) return kJavascriptURLScheme;
-  if (url.SchemeIs("file")) return kFileURLScheme;
-  if (url.SchemeIs("blob")) return kBlobURLScheme;
-  if (url.SchemeIs("data")) return kDataURLScheme;
-  if (url.SchemeIs("filesystem")) return kFileSystemScheme;
-
-  return kUnknownURLScheme;
-}
-
-std::string LoadTypeToString(blink::WebMediaPlayer::LoadType load_type) {
-  switch (load_type) {
-    case blink::WebMediaPlayer::LoadTypeURL:
-      return "SRC";
-    case blink::WebMediaPlayer::LoadTypeMediaSource:
-      return "MSE";
-    case blink::WebMediaPlayer::LoadTypeMediaStream:
-      return "MS";
-  }
-
-  NOTREACHED();
-  return "Unknown";
-}
-
-}  // namespace
-
-void ReportMetrics(blink::WebMediaPlayer::LoadType load_type, const GURL& url,
-                   const blink::WebSecurityOrigin& security_origin) {
-  // Report URL scheme, such as http, https, file, blob etc.
-  UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url),
-                            kMaxURLScheme + 1);
-
-  // Report load type, such as URL, MediaSource or MediaStream.
-  UMA_HISTOGRAM_ENUMERATION("Media.LoadType", load_type,
-                            blink::WebMediaPlayer::LoadTypeMax + 1);
-
-  // Report the origin from where the media player is created.
-  if (GetMediaClient()) {
-    GURL security_origin_url(
-        blink::WebStringToGURL(security_origin.toString()));
-
-    GetMediaClient()->RecordRapporURL(
-        "Media.OriginUrl." + LoadTypeToString(load_type), security_origin_url);
-
-    // For MSE, also report usage by secure/insecure origin.
-    if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource) {
-      if (security_origin.isPotentiallyTrustworthy()) {
-        GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Secure",
-                                          security_origin_url);
-      } else {
-        GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Insecure",
-                                          security_origin_url);
-      }
-    }
-  }
-}
-
-void ReportPipelineError(blink::WebMediaPlayer::LoadType load_type,
-                         const blink::WebSecurityOrigin& security_origin,
-                         PipelineStatus error) {
-  DCHECK_NE(PIPELINE_OK, error);
-
-  // Report the origin from where the media player is created.
-  if (!GetMediaClient()) return;
-
-  GetMediaClient()->RecordRapporURL(
-      "Media.OriginUrl." + LoadTypeToString(load_type) + ".PipelineError",
-      blink::WebStringToGURL(security_origin.toString()));
-}
-
-void RecordOriginOfHLSPlayback(const GURL& origin_url) {
-  if (media::GetMediaClient())
-    GetMediaClient()->RecordRapporURL("Media.OriginUrl.HLS", origin_url);
-}
-
-EmeInitDataType ConvertToEmeInitDataType(
-    blink::WebEncryptedMediaInitDataType init_data_type) {
-  switch (init_data_type) {
-    case blink::WebEncryptedMediaInitDataType::Webm:
-      return EmeInitDataType::WEBM;
-    case blink::WebEncryptedMediaInitDataType::Cenc:
-      return EmeInitDataType::CENC;
-    case blink::WebEncryptedMediaInitDataType::Keyids:
-      return EmeInitDataType::KEYIDS;
-    case blink::WebEncryptedMediaInitDataType::Unknown:
-      return EmeInitDataType::UNKNOWN;
-  }
-
-  NOTREACHED();
-  return EmeInitDataType::UNKNOWN;
-}
-
-blink::WebEncryptedMediaInitDataType ConvertToWebInitDataType(
-    EmeInitDataType init_data_type) {
-  switch (init_data_type) {
-    case EmeInitDataType::WEBM:
-      return blink::WebEncryptedMediaInitDataType::Webm;
-    case EmeInitDataType::CENC:
-      return blink::WebEncryptedMediaInitDataType::Cenc;
-    case EmeInitDataType::KEYIDS:
-      return blink::WebEncryptedMediaInitDataType::Keyids;
-    case EmeInitDataType::UNKNOWN:
-      return blink::WebEncryptedMediaInitDataType::Unknown;
-  }
-
-  NOTREACHED();
-  return blink::WebEncryptedMediaInitDataType::Unknown;
-}
-
-namespace {
-// This class wraps a scoped blink::WebSetSinkIdCallbacks pointer such that
-// copying objects of this class actually performs moving, thus
-// maintaining clear ownership of the blink::WebSetSinkIdCallbacks pointer.
-// The rationale for this class is that the SwichOutputDevice method
-// can make a copy of its base::Callback parameter, which implies
-// copying its bound parameters.
-// SwitchOutputDevice actually wants to move its base::Callback
-// parameter since only the final copy will be run, but base::Callback
-// does not support move semantics and there is no base::MovableCallback.
-// Since scoped pointers are not copyable, we cannot bind them directly
-// to a base::Callback in this case. Thus, we use this helper class,
-// whose copy constructor transfers ownership of the scoped pointer.
-
-class SetSinkIdCallback {
- public:
-  explicit SetSinkIdCallback(blink::WebSetSinkIdCallbacks* web_callback)
-      : web_callback_(web_callback) {}
-  SetSinkIdCallback(const SetSinkIdCallback& other)
-      : web_callback_(std::move(other.web_callback_)) {}
-  ~SetSinkIdCallback() {}
-  friend void RunSetSinkIdCallback(const SetSinkIdCallback& callback,
-                                   OutputDeviceStatus result);
-
- private:
-  // Mutable is required so that Pass() can be called in the copy
-  // constructor.
-  mutable std::unique_ptr<blink::WebSetSinkIdCallbacks> web_callback_;
-};
-
-void RunSetSinkIdCallback(const SetSinkIdCallback& callback,
-                          OutputDeviceStatus result) {
-  if (!callback.web_callback_) return;
-
-  switch (result) {
-    case OUTPUT_DEVICE_STATUS_OK:
-      callback.web_callback_->onSuccess();
-      break;
-    case OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND:
-      callback.web_callback_->onError(blink::WebSetSinkIdError::NotFound);
-      break;
-    case OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED:
-      callback.web_callback_->onError(blink::WebSetSinkIdError::NotAuthorized);
-      break;
-    case OUTPUT_DEVICE_STATUS_ERROR_INTERNAL:
-      callback.web_callback_->onError(blink::WebSetSinkIdError::Aborted);
-      break;
-    default:
-      NOTREACHED();
-  }
-
-  callback.web_callback_ = NULL;
-}
-
-}  // namespace
-
-OutputDeviceStatusCB ConvertToOutputDeviceStatusCB(
-    blink::WebSetSinkIdCallbacks* web_callbacks) {
-  return media::BindToCurrentLoop(
-      base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks)));
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webmediaplayer_util.h b/src/cobalt/media/blink/webmediaplayer_util.h
deleted file mode 100644
index 81ce886..0000000
--- a/src/cobalt/media/blink/webmediaplayer_util.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_
-#define COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_
-
-#include "base/time.h"
-#include "cobalt/media/base/audio_renderer_sink.h"
-#include "cobalt/media/base/eme_constants.h"
-#include "cobalt/media/base/pipeline_status.h"
-#include "cobalt/media/base/ranges.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "googleurl/src/gurl.h"
-#include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
-#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
-#include "third_party/WebKit/public/platform/WebSetSinkIdCallbacks.h"
-#include "third_party/WebKit/public/platform/WebTimeRange.h"
-
-namespace cobalt {
-namespace media {
-
-blink::WebTimeRanges MEDIA_BLINK_EXPORT
-ConvertToWebTimeRanges(const Ranges<base::TimeDelta>& ranges);
-
-blink::WebMediaPlayer::NetworkState MEDIA_BLINK_EXPORT
-PipelineErrorToNetworkState(PipelineStatus error);
-
-// Report various metrics to UMA and RAPPOR.
-void MEDIA_BLINK_EXPORT
-ReportMetrics(blink::WebMediaPlayer::LoadType load_type, const GURL& url,
-              const blink::WebSecurityOrigin& security_origin);
-
-// Report metrics about pipeline errors.
-void MEDIA_BLINK_EXPORT ReportPipelineError(
-    blink::WebMediaPlayer::LoadType load_type,
-    const blink::WebSecurityOrigin& security_origin, PipelineStatus error);
-
-// Record a RAPPOR metric for the origin of an HLS playback.
-void MEDIA_BLINK_EXPORT RecordOriginOfHLSPlayback(const GURL& origin_url);
-
-// TODO(ddorwin): Move this function to an EME-specific file.
-// We may also want to move the next one and pass Blink types to WMPI.
-EmeInitDataType MEDIA_BLINK_EXPORT
-ConvertToEmeInitDataType(blink::WebEncryptedMediaInitDataType init_data_type);
-
-blink::WebEncryptedMediaInitDataType MEDIA_BLINK_EXPORT
-ConvertToWebInitDataType(EmeInitDataType init_data_type);
-
-// Wraps a blink::WebSetSinkIdCallbacks into a media::OutputDeviceStatusCB
-// and binds it to the current thread
-OutputDeviceStatusCB MEDIA_BLINK_EXPORT
-ConvertToOutputDeviceStatusCB(blink::WebSetSinkIdCallbacks* web_callbacks);
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_
diff --git a/src/cobalt/media/blink/webmediasource_impl.cc b/src/cobalt/media/blink/webmediasource_impl.cc
deleted file mode 100644
index 1fa9e8f..0000000
--- a/src/cobalt/media/blink/webmediasource_impl.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/webmediasource_impl.h"
-
-#include "base/guid.h"
-#include "cobalt/media/base/mime_util.h"
-#include "cobalt/media/blink/websourcebuffer_impl.h"
-#include "cobalt/media/filters/chunk_demuxer.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-using ::blink::WebString;
-using ::blink::WebMediaSource;
-
-namespace cobalt {
-namespace media {
-
-#define STATIC_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \
-  static_assert(static_cast<int>(WebMediaSource::webkit_name) ==       \
-                    static_cast<int>(ChunkDemuxer::chromium_name),     \
-                "mismatching status enum values: " #webkit_name)
-STATIC_ASSERT_MATCHING_STATUS_ENUM(AddStatusOk, kOk);
-STATIC_ASSERT_MATCHING_STATUS_ENUM(AddStatusNotSupported, kNotSupported);
-STATIC_ASSERT_MATCHING_STATUS_ENUM(AddStatusReachedIdLimit, kReachedIdLimit);
-#undef STATIC_ASSERT_MATCHING_STATUS_ENUM
-
-WebMediaSourceImpl::WebMediaSourceImpl(ChunkDemuxer* demuxer,
-                                       const scoped_refptr<MediaLog>& media_log)
-    : demuxer_(demuxer), media_log_(media_log) {
-  DCHECK(demuxer_);
-}
-
-WebMediaSourceImpl::~WebMediaSourceImpl() {}
-
-WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer(
-    const blink::WebString& type, const blink::WebString& codecs,
-    blink::WebSourceBuffer** source_buffer) {
-  std::string id = base::GenerateGUID();
-
-  WebMediaSource::AddStatus result = static_cast<WebMediaSource::AddStatus>(
-      demuxer_->AddId(id, type.utf8().data(), codecs.utf8().data()));
-
-  if (result == WebMediaSource::AddStatusOk)
-    *source_buffer = new WebSourceBufferImpl(id, demuxer_);
-
-  return result;
-}
-
-double WebMediaSourceImpl::duration() { return demuxer_->GetDuration(); }
-
-void WebMediaSourceImpl::setDuration(double new_duration) {
-  DCHECK_GE(new_duration, 0);
-  demuxer_->SetDuration(new_duration);
-}
-
-void WebMediaSourceImpl::markEndOfStream(
-    WebMediaSource::EndOfStreamStatus status) {
-  PipelineStatus pipeline_status = PIPELINE_OK;
-
-  switch (status) {
-    case WebMediaSource::EndOfStreamStatusNoError:
-      break;
-    case WebMediaSource::EndOfStreamStatusNetworkError:
-      pipeline_status = CHUNK_DEMUXER_ERROR_EOS_STATUS_NETWORK_ERROR;
-      break;
-    case WebMediaSource::EndOfStreamStatusDecodeError:
-      pipeline_status = CHUNK_DEMUXER_ERROR_EOS_STATUS_DECODE_ERROR;
-      break;
-  }
-
-  demuxer_->MarkEndOfStream(pipeline_status);
-}
-
-void WebMediaSourceImpl::unmarkEndOfStream() { demuxer_->UnmarkEndOfStream(); }
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/webmediasource_impl.h b/src/cobalt/media/blink/webmediasource_impl.h
deleted file mode 100644
index 7d83b03..0000000
--- a/src/cobalt/media/blink/webmediasource_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBMEDIASOURCE_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBMEDIASOURCE_IMPL_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "cobalt/media/base/media_log.h"
-#include "cobalt/media/blink/media_blink_export.h"
-#include "third_party/WebKit/public/platform/WebMediaSource.h"
-
-namespace cobalt {
-namespace media {
-class ChunkDemuxer;
-
-class MEDIA_BLINK_EXPORT WebMediaSourceImpl
-    : NON_EXPORTED_BASE(public blink::WebMediaSource) {
- public:
-  WebMediaSourceImpl(ChunkDemuxer* demuxer,
-                     const scoped_refptr<MediaLog>& media_log);
-  ~WebMediaSourceImpl() OVERRIDE;
-
-  // blink::WebMediaSource implementation.
-  AddStatus addSourceBuffer(const blink::WebString& type,
-                            const blink::WebString& codecs,
-                            blink::WebSourceBuffer** source_buffer) OVERRIDE;
-  double duration() OVERRIDE;
-  void setDuration(double duration) OVERRIDE;
-  void markEndOfStream(EndOfStreamStatus status) OVERRIDE;
-  void unmarkEndOfStream() OVERRIDE;
-
- private:
-  ChunkDemuxer* demuxer_;  // Owned by WebMediaPlayerImpl.
-  scoped_refptr<MediaLog> media_log_;
-
-  DISALLOW_COPY_AND_ASSIGN(WebMediaSourceImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBMEDIASOURCE_IMPL_H_
diff --git a/src/cobalt/media/blink/websourcebuffer_impl.cc b/src/cobalt/media/blink/websourcebuffer_impl.cc
deleted file mode 100644
index 35265c1..0000000
--- a/src/cobalt/media/blink/websourcebuffer_impl.cc
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2013 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 "cobalt/media/blink/websourcebuffer_impl.h"
-
-#include <cmath>
-#include <limits>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/callback_helpers.h"
-#include "base/string_number_conversions.h"
-#include "cobalt/media/base/media_tracks.h"
-#include "cobalt/media/base/timestamp_constants.h"
-#include "cobalt/media/filters/chunk_demuxer.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
-#include "third_party/WebKit/public/platform/WebSourceBufferClient.h"
-
-namespace cobalt {
-namespace media {
-
-static base::TimeDelta DoubleToTimeDelta(double time) {
-  DCHECK(!std::isnan(time));
-  DCHECK_NE(time, -std::numeric_limits<double>::infinity());
-
-  if (time == std::numeric_limits<double>::infinity()) return kInfiniteDuration;
-
-  // Don't use base::TimeDelta::Max() here, as we want the largest finite time
-  // delta.
-  base::TimeDelta max_time = base::TimeDelta::FromInternalValue(
-      std::numeric_limits<int64_t>::max() - 1);
-  double max_time_in_seconds = max_time.InSecondsF();
-
-  if (time >= max_time_in_seconds) return max_time;
-
-  return base::TimeDelta::FromMicroseconds(time *
-                                           base::Time::kMicrosecondsPerSecond);
-}
-
-WebSourceBufferImpl::WebSourceBufferImpl(const std::string& id,
-                                         ChunkDemuxer* demuxer)
-    : id_(id),
-      demuxer_(demuxer),
-      client_(NULL),
-      append_window_end_(kInfiniteDuration) {
-  DCHECK(demuxer_);
-  demuxer_->SetTracksWatcher(
-      id, base::Bind(&WebSourceBufferImpl::InitSegmentReceived,
-                     base::Unretained(this)));
-}
-
-WebSourceBufferImpl::~WebSourceBufferImpl() {
-  DCHECK(!demuxer_) << "Object destroyed w/o removedFromMediaSource() call";
-  DCHECK(!client_);
-}
-
-void WebSourceBufferImpl::setClient(blink::WebSourceBufferClient* client) {
-  DCHECK(client);
-  DCHECK(!client_);
-  client_ = client;
-}
-
-bool WebSourceBufferImpl::setMode(WebSourceBuffer::AppendMode mode) {
-  if (demuxer_->IsParsingMediaSegment(id_)) return false;
-
-  switch (mode) {
-    case WebSourceBuffer::AppendModeSegments:
-      demuxer_->SetSequenceMode(id_, false);
-      return true;
-    case WebSourceBuffer::AppendModeSequence:
-      demuxer_->SetSequenceMode(id_, true);
-      return true;
-  }
-
-  NOTREACHED();
-  return false;
-}
-
-blink::WebTimeRanges WebSourceBufferImpl::buffered() {
-  Ranges<base::TimeDelta> ranges = demuxer_->GetBufferedRanges(id_);
-  blink::WebTimeRanges result(ranges.size());
-  for (size_t i = 0; i < ranges.size(); i++) {
-    result[i].start = ranges.start(i).InSecondsF();
-    result[i].end = ranges.end(i).InSecondsF();
-  }
-  return result;
-}
-
-double WebSourceBufferImpl::highestPresentationTimestamp() {
-  return demuxer_->GetHighestPresentationTimestamp(id_).InSecondsF();
-}
-
-bool WebSourceBufferImpl::evictCodedFrames(double currentPlaybackTime,
-                                           size_t newDataSize) {
-  return demuxer_->EvictCodedFrames(
-      id_, base::TimeDelta::FromSecondsD(currentPlaybackTime), newDataSize);
-}
-
-bool WebSourceBufferImpl::append(const unsigned char* data, unsigned length,
-                                 double* timestamp_offset) {
-  base::TimeDelta old_offset = timestamp_offset_;
-  bool success = demuxer_->AppendData(id_, data, length, append_window_start_,
-                                      append_window_end_, &timestamp_offset_);
-
-  // Coded frame processing may update the timestamp offset. If the caller
-  // provides a non-NULL |timestamp_offset| and frame processing changes the
-  // timestamp offset, report the new offset to the caller. Do not update the
-  // caller's offset otherwise, to preserve any pre-existing value that may have
-  // more than microsecond precision.
-  if (timestamp_offset && old_offset != timestamp_offset_)
-    *timestamp_offset = timestamp_offset_.InSecondsF();
-
-  return success;
-}
-
-void WebSourceBufferImpl::resetParserState() {
-  demuxer_->ResetParserState(id_, append_window_start_, append_window_end_,
-                             &timestamp_offset_);
-
-  // TODO(wolenetz): resetParserState should be able to modify the caller
-  // timestamp offset (just like WebSourceBufferImpl::append).
-  // See http://crbug.com/370229 for further details.
-}
-
-void WebSourceBufferImpl::remove(double start, double end) {
-  DCHECK_GE(start, 0);
-  DCHECK_GE(end, 0);
-  demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end));
-}
-
-bool WebSourceBufferImpl::setTimestampOffset(double offset) {
-  if (demuxer_->IsParsingMediaSegment(id_)) return false;
-
-  timestamp_offset_ = DoubleToTimeDelta(offset);
-
-  // http://www.w3.org/TR/media-source/#widl-SourceBuffer-timestampOffset
-  // Step 6: If the mode attribute equals "sequence", then set the group start
-  // timestamp to new timestamp offset.
-  demuxer_->SetGroupStartTimestampIfInSequenceMode(id_, timestamp_offset_);
-  return true;
-}
-
-void WebSourceBufferImpl::setAppendWindowStart(double start) {
-  DCHECK_GE(start, 0);
-  append_window_start_ = DoubleToTimeDelta(start);
-}
-
-void WebSourceBufferImpl::setAppendWindowEnd(double end) {
-  DCHECK_GE(end, 0);
-  append_window_end_ = DoubleToTimeDelta(end);
-}
-
-void WebSourceBufferImpl::removedFromMediaSource() {
-  demuxer_->RemoveId(id_);
-  demuxer_ = NULL;
-  client_ = NULL;
-}
-
-blink::WebMediaPlayer::TrackType mediaTrackTypeToBlink(MediaTrack::Type type) {
-  switch (type) {
-    case MediaTrack::Audio:
-      return blink::WebMediaPlayer::AudioTrack;
-    case MediaTrack::Text:
-      return blink::WebMediaPlayer::TextTrack;
-    case MediaTrack::Video:
-      return blink::WebMediaPlayer::VideoTrack;
-  }
-  NOTREACHED();
-  return blink::WebMediaPlayer::AudioTrack;
-}
-
-void WebSourceBufferImpl::InitSegmentReceived(
-    std::unique_ptr<MediaTracks> tracks) {
-  DCHECK(tracks.get());
-  DVLOG(1) << __func__ << " tracks=" << tracks->tracks().size();
-
-  std::vector<blink::WebSourceBufferClient::MediaTrackInfo> trackInfoVector;
-  for (const auto& track : tracks->tracks()) {
-    blink::WebSourceBufferClient::MediaTrackInfo trackInfo;
-    trackInfo.trackType = mediaTrackTypeToBlink(track->type());
-    trackInfo.id = blink::WebString::fromUTF8(track->id());
-    trackInfo.byteStreamTrackID = blink::WebString::fromUTF8(
-        base::UintToString(track->bytestream_track_id()));
-    trackInfo.kind = blink::WebString::fromUTF8(track->kind());
-    trackInfo.label = blink::WebString::fromUTF8(track->label());
-    trackInfo.language = blink::WebString::fromUTF8(track->language());
-    trackInfoVector.push_back(trackInfo);
-  }
-
-  client_->initializationSegmentReceived(trackInfoVector);
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/blink/websourcebuffer_impl.h b/src/cobalt/media/blink/websourcebuffer_impl.h
deleted file mode 100644
index f1349fa..0000000
--- a/src/cobalt/media/blink/websourcebuffer_impl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_
-#define COBALT_MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_
-
-#include <memory>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/time.h"
-#include "starboard/types.h"
-#include "third_party/WebKit/public/platform/WebSourceBuffer.h"
-
-namespace cobalt {
-namespace media {
-class ChunkDemuxer;
-class MediaTracks;
-
-class WebSourceBufferImpl : public blink::WebSourceBuffer {
- public:
-  WebSourceBufferImpl(const std::string& id, ChunkDemuxer* demuxer);
-  ~WebSourceBufferImpl() OVERRIDE;
-
-  // blink::WebSourceBuffer implementation.
-  void setClient(blink::WebSourceBufferClient* client) OVERRIDE;
-  bool setMode(AppendMode mode) OVERRIDE;
-  blink::WebTimeRanges buffered() OVERRIDE;
-  double highestPresentationTimestamp() OVERRIDE;
-  bool evictCodedFrames(double currentPlaybackTime,
-                        size_t newDataSize) OVERRIDE;
-  bool append(const unsigned char* data, unsigned length,
-              double* timestamp_offset) OVERRIDE;
-  void resetParserState() OVERRIDE;
-  void remove(double start, double end) OVERRIDE;
-  bool setTimestampOffset(double offset) OVERRIDE;
-  void setAppendWindowStart(double start) OVERRIDE;
-  void setAppendWindowEnd(double end) OVERRIDE;
-  void removedFromMediaSource() OVERRIDE;
-
- private:
-  // Demuxer callback handler to process an initialization segment received
-  // during an append() call.
-  void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks);
-
-  std::string id_;
-  ChunkDemuxer* demuxer_;  // Owned by WebMediaPlayerImpl.
-
-  blink::WebSourceBufferClient* client_;
-
-  // Controls the offset applied to timestamps when processing appended media
-  // segments. It is initially 0, which indicates that no offset is being
-  // applied. Both setTimestampOffset() and append() may update this value.
-  base::TimeDelta timestamp_offset_;
-
-  base::TimeDelta append_window_start_;
-  base::TimeDelta append_window_end_;
-
-  DISALLOW_COPY_AND_ASSIGN(WebSourceBufferImpl);
-};
-
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_BLINK_WEBSOURCEBUFFER_IMPL_H_
diff --git a/src/cobalt/media/cast/BUILD.gn b/src/cobalt/media/cast/BUILD.gn
deleted file mode 100644
index 1d10f3e..0000000
--- a/src/cobalt/media/cast/BUILD.gn
+++ /dev/null
@@ -1,516 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/config/android/config.gni")
-import("//build/config/features.gni")
-import("//build/config/ui.gni")
-import("//testing/test.gni")
-import("//third_party/protobuf/proto_library.gni")
-
-proto_library("logging_proto") {
-  sources = [
-    "logging/proto/raw_events.proto",
-  ]
-}
-
-# Common code shared by all cast components.
-source_set("common") {
-  sources = [
-    "cast_config.cc",
-    "cast_config.h",
-    "cast_environment.cc",
-    "cast_environment.h",
-    "common/clock_drift_smoother.cc",
-    "common/clock_drift_smoother.h",
-    "common/expanded_value_base.h",
-    "common/frame_id.cc",
-    "common/frame_id.h",
-    "common/rtp_time.cc",
-    "common/rtp_time.h",
-    "common/transport_encryption_handler.cc",
-    "common/transport_encryption_handler.h",
-    "constants.h",
-    "logging/encoding_event_subscriber.cc",
-    "logging/encoding_event_subscriber.h",
-    "logging/log_deserializer.cc",
-    "logging/log_deserializer.h",
-    "logging/log_event_dispatcher.cc",
-    "logging/log_event_dispatcher.h",
-    "logging/log_serializer.cc",
-    "logging/log_serializer.h",
-    "logging/logging_defines.cc",
-    "logging/logging_defines.h",
-    "logging/proto/proto_utils.cc",
-    "logging/raw_event_subscriber.h",
-    "logging/raw_event_subscriber_bundle.cc",
-    "logging/raw_event_subscriber_bundle.h",
-    "logging/receiver_time_offset_estimator.h",
-    "logging/receiver_time_offset_estimator_impl.cc",
-    "logging/receiver_time_offset_estimator_impl.h",
-    "logging/simple_event_subscriber.cc",
-    "logging/simple_event_subscriber.h",
-    "logging/stats_event_subscriber.cc",
-    "logging/stats_event_subscriber.h",
-  ]
-
-  deps = [
-    ":logging_proto",
-    "//base",
-    "//crypto",
-    "//net",
-    "//third_party/zlib",
-  ]
-
-  public_deps = [
-    # The generated headers reference headers within protobuf_lite, so
-    # dependencies must be able to find those headers too.
-    ":logging_proto",
-  ]
-}
-
-source_set("net") {
-  sources = [
-    "net/cast_transport.h",
-    "net/cast_transport_config.cc",
-    "net/cast_transport_config.h",
-    "net/cast_transport_defines.h",
-    "net/cast_transport_impl.cc",
-    "net/cast_transport_impl.h",
-    "net/pacing/paced_sender.cc",
-    "net/pacing/paced_sender.h",
-    "net/rtcp/receiver_rtcp_event_subscriber.cc",
-    "net/rtcp/receiver_rtcp_session.cc",
-    "net/rtcp/receiver_rtcp_session.h",
-    "net/rtcp/rtcp_builder.cc",
-    "net/rtcp/rtcp_builder.h",
-    "net/rtcp/rtcp_defines.cc",
-    "net/rtcp/rtcp_defines.h",
-    "net/rtcp/rtcp_utility.cc",
-    "net/rtcp/rtcp_utility.h",
-    "net/rtcp/sender_rtcp_session.cc",
-    "net/rtcp/sender_rtcp_session.h",
-    "net/rtp/packet_storage.cc",
-    "net/rtp/packet_storage.h",
-    "net/rtp/rtp_defines.cc",
-    "net/rtp/rtp_defines.h",
-    "net/rtp/rtp_packetizer.cc",
-    "net/rtp/rtp_packetizer.h",
-    "net/rtp/rtp_parser.cc",
-    "net/rtp/rtp_parser.h",
-    "net/rtp/rtp_sender.cc",
-    "net/rtp/rtp_sender.h",
-    "net/udp_transport.cc",
-    "net/udp_transport.h",
-  ]
-
-  deps = [
-    ":common",
-  ]
-
-  public_deps = [
-    ":common",
-  ]
-}
-
-source_set("sender") {
-  sources = [
-    "cast_sender.h",
-    "cast_sender_impl.cc",
-    "cast_sender_impl.h",
-    "sender/audio_encoder.cc",
-    "sender/audio_encoder.h",
-    "sender/audio_sender.cc",
-    "sender/audio_sender.h",
-    "sender/congestion_control.cc",
-    "sender/congestion_control.h",
-    "sender/external_video_encoder.cc",
-    "sender/external_video_encoder.h",
-    "sender/fake_software_video_encoder.cc",
-    "sender/fake_software_video_encoder.h",
-    "sender/frame_sender.cc",
-    "sender/frame_sender.h",
-    "sender/performance_metrics_overlay.cc",
-    "sender/performance_metrics_overlay.h",
-    "sender/sender_encoded_frame.cc",
-    "sender/sender_encoded_frame.h",
-    "sender/size_adaptable_video_encoder_base.cc",
-    "sender/size_adaptable_video_encoder_base.h",
-    "sender/software_video_encoder.h",
-    "sender/video_encoder.cc",
-    "sender/video_encoder.h",
-    "sender/video_encoder_impl.cc",
-    "sender/video_encoder_impl.h",
-    "sender/video_frame_factory.h",
-    "sender/video_sender.cc",
-    "sender/video_sender.h",
-    "sender/vp8_encoder.cc",
-    "sender/vp8_encoder.h",
-    "sender/vp8_quantizer_parser.cc",
-    "sender/vp8_quantizer_parser.h",
-  ]
-
-  deps = [
-    ":common",
-    ":net",
-    "//media",
-    "//media:media_features",
-    "//media:shared_memory_support",
-    "//third_party/libvpx",
-    "//third_party/opus",
-    "//ui/gfx/geometry",
-  ]
-
-  libs = []
-
-  # iOS and OS X encoders
-  if (is_ios || is_mac) {
-    sources += [
-      "sender/h264_vt_encoder.cc",
-      "sender/h264_vt_encoder.h",
-    ]
-
-    libs += [
-      "AudioToolbox.framework",
-      "CoreVideo.framework",
-    ]
-  }
-}
-
-source_set("receiver") {
-  sources = [
-    "cast_receiver.h",
-    "net/rtp/cast_message_builder.cc",
-    "net/rtp/cast_message_builder.h",
-    "net/rtp/frame_buffer.cc",
-    "net/rtp/frame_buffer.h",
-    "net/rtp/framer.cc",
-    "net/rtp/framer.h",
-    "net/rtp/receiver_stats.cc",
-    "net/rtp/receiver_stats.h",
-    "receiver/audio_decoder.cc",
-    "receiver/audio_decoder.h",
-    "receiver/cast_receiver_impl.cc",
-    "receiver/cast_receiver_impl.h",
-    "receiver/frame_receiver.cc",
-    "receiver/frame_receiver.h",
-    "receiver/video_decoder.cc",
-    "receiver/video_decoder.h",
-  ]
-
-  deps = [
-    ":common",
-    ":net",
-    "//media",
-    "//media:shared_memory_support",
-    "//third_party/libvpx",
-    "//third_party/libyuv",
-    "//third_party/opus",
-    "//ui/gfx/geometry",
-  ]
-}
-
-static_library("test_support") {
-  testonly = true
-  sources = [
-    "test/fake_receiver_time_offset_estimator.cc",
-    "test/fake_receiver_time_offset_estimator.h",
-    "test/loopback_transport.cc",
-    "test/loopback_transport.h",
-    "test/skewed_single_thread_task_runner.cc",
-    "test/skewed_single_thread_task_runner.h",
-    "test/skewed_tick_clock.cc",
-    "test/skewed_tick_clock.h",
-    "test/utility/audio_utility.cc",
-    "test/utility/audio_utility.h",
-    "test/utility/barcode.cc",
-    "test/utility/barcode.h",
-    "test/utility/default_config.cc",
-    "test/utility/default_config.h",
-    "test/utility/in_process_receiver.cc",
-    "test/utility/in_process_receiver.h",
-    "test/utility/input_builder.cc",
-    "test/utility/input_builder.h",
-    "test/utility/net_utility.cc",
-    "test/utility/net_utility.h",
-    "test/utility/standalone_cast_environment.cc",
-    "test/utility/standalone_cast_environment.h",
-    "test/utility/test_util.cc",
-    "test/utility/test_util.h",
-    "test/utility/udp_proxy.cc",
-    "test/utility/udp_proxy.h",
-    "test/utility/video_utility.cc",
-    "test/utility/video_utility.h",
-  ]
-
-  deps = [
-    ":net",
-    ":receiver",
-    "//base/test:test_support",
-    "//media:test_support",
-    "//media/base:test_support",
-    "//testing/gtest",
-    "//third_party/libyuv",
-    "//third_party/mt19937ar",
-    "//ui/gfx:test_support",
-  ]
-
-  # FFMPEG software video decoders are not available on Android and/or
-  # Chromecast content_shell builds.
-  #
-  # TODO(miu): There *are* hardware decoder APIs available via FFMPEG, and we
-  # should use those for the Android receiver.  See media's BUILD.gn for usage
-  # details.  http://crbug.com/558714
-  if (!is_android && !is_chromecast) {
-    sources += [
-      "test/fake_media_source.cc",
-      "test/fake_media_source.h",
-    ]
-    deps += [ "//third_party/ffmpeg" ]
-  }
-}
-
-test("cast_unittests") {
-  sources = [
-    "common/expanded_value_base_unittest.cc",
-    "common/rtp_time_unittest.cc",
-    "logging/encoding_event_subscriber_unittest.cc",
-    "logging/receiver_time_offset_estimator_impl_unittest.cc",
-    "logging/serialize_deserialize_test.cc",
-    "logging/simple_event_subscriber_unittest.cc",
-    "logging/stats_event_subscriber_unittest.cc",
-    "net/cast_transport_impl_unittest.cc",
-    "net/mock_cast_transport.cc",
-    "net/mock_cast_transport.h",
-    "net/pacing/mock_paced_packet_sender.cc",
-    "net/pacing/mock_paced_packet_sender.h",
-    "net/pacing/paced_sender_unittest.cc",
-    "net/rtcp/receiver_rtcp_event_subscriber_unittest.cc",
-    "net/rtcp/rtcp_builder_unittest.cc",
-    "net/rtcp/rtcp_unittest.cc",
-    "net/rtcp/rtcp_utility_unittest.cc",
-
-    # TODO(miu): The following two are test utility modules.  Rename/move the
-    # files.
-    "net/rtcp/test_rtcp_packet_builder.cc",
-    "net/rtcp/test_rtcp_packet_builder.h",
-    "net/rtp/cast_message_builder_unittest.cc",
-    "net/rtp/frame_buffer_unittest.cc",
-    "net/rtp/framer_unittest.cc",
-    "net/rtp/mock_rtp_payload_feedback.cc",
-    "net/rtp/mock_rtp_payload_feedback.h",
-    "net/rtp/packet_storage_unittest.cc",
-    "net/rtp/receiver_stats_unittest.cc",
-    "net/rtp/rtp_packet_builder.cc",
-    "net/rtp/rtp_packetizer_unittest.cc",
-    "net/rtp/rtp_parser_unittest.cc",
-    "net/udp_transport_unittest.cc",
-    "receiver/audio_decoder_unittest.cc",
-    "receiver/frame_receiver_unittest.cc",
-    "receiver/video_decoder_unittest.cc",
-    "sender/audio_encoder_unittest.cc",
-    "sender/audio_sender_unittest.cc",
-    "sender/congestion_control_unittest.cc",
-    "sender/external_video_encoder_unittest.cc",
-    "sender/fake_video_encode_accelerator_factory.cc",
-    "sender/fake_video_encode_accelerator_factory.h",
-    "sender/video_encoder_unittest.cc",
-    "sender/video_sender_unittest.cc",
-    "sender/vp8_quantizer_parser_unittest.cc",
-    "test/end2end_unittest.cc",
-    "test/utility/audio_utility_unittest.cc",
-    "test/utility/barcode_unittest.cc",
-  ]
-
-  deps = [
-    ":common",
-    ":receiver",
-    ":sender",
-    ":test_support",
-    "//base/test:run_all_unittests",
-    "//testing/gmock",
-    "//testing/gtest",
-  ]
-
-  if (is_android) {
-    deps += [ "//testing/android/native_test:native_test_native_code" ]
-  }
-
-  if (is_ios || is_mac) {
-    sources += [ "sender/h264_vt_encoder_unittest.cc" ]
-
-    deps += [ "//third_party/ffmpeg" ]
-  }
-}
-
-if (is_win || is_mac || (is_linux && !is_chromeos)) {
-  # This is a target for the collection of cast development tools.  They are
-  # not built/linked into the Chromium browser.
-  group("testing_tools") {
-    testonly = true
-    deps = [
-      ":cast_benchmarks",
-      ":cast_receiver_app",
-      ":cast_sender_app",
-      ":cast_simulator",
-      ":generate_barcode_video",
-      ":generate_timecode_audio",
-      ":udp_proxy",
-    ]
-  }
-
-  test("cast_benchmarks") {
-    testonly = true
-    sources = [
-      "test/cast_benchmarks.cc",
-    ]
-    deps = [
-      ":common",
-      ":net",
-      ":receiver",
-      ":sender",
-      ":test_support",
-      "//net",
-      "//testing/gtest",
-    ]
-  }
-
-  executable("cast_receiver_app") {
-    testonly = true
-    sources = [
-      "test/receiver.cc",
-    ]
-    deps = [
-      ":common",
-      ":net",
-      ":receiver",
-      ":test_support",
-      "//build/win:default_exe_manifest",
-    ]
-
-    if (is_linux && !is_chromeos && use_x11) {
-      sources += [
-        "test/linux_output_window.cc",
-        "test/linux_output_window.h",
-      ]
-      configs += [
-        "//build/config/linux:x11",
-        "//build/config/linux:xext",
-      ]
-      deps += [ "//third_party/libyuv" ]
-    }
-  }
-
-  executable("cast_sender_app") {
-    testonly = true
-    sources = [
-      "test/sender.cc",
-    ]
-    deps = [
-      ":common",
-      ":net",
-      ":sender",
-      ":test_support",
-      "//build/win:default_exe_manifest",
-    ]
-  }
-
-  proto_library("network_simulation_model_proto") {
-    visibility = [ ":cast_simulator" ]
-    sources = [
-      "test/proto/network_simulation_model.proto",
-    ]
-  }
-
-  executable("cast_simulator") {
-    testonly = true
-    sources = [
-      "test/simulator.cc",
-    ]
-    deps = [
-      ":common",
-      ":net",
-      ":network_simulation_model_proto",
-      ":sender",
-      ":test_support",
-      "//build/win:default_exe_manifest",
-    ]
-  }
-
-  executable("generate_barcode_video") {
-    testonly = true
-    sources = [
-      "test/utility/generate_barcode_video.cc",
-    ]
-    deps = [
-      ":test_support",
-      "//base",
-      "//build/config/sanitizers:deps",
-      "//build/win:default_exe_manifest",
-      "//media",
-    ]
-  }
-
-  executable("generate_timecode_audio") {
-    testonly = true
-    sources = [
-      "test/utility/generate_timecode_audio.cc",
-    ]
-    deps = [
-      ":test_support",
-      "//base",
-      "//build/config/sanitizers:deps",
-      "//build/win:default_exe_manifest",
-      "//media",
-    ]
-  }
-
-  executable("udp_proxy") {
-    testonly = true
-    sources = [
-      "test/utility/udp_proxy_main.cc",
-    ]
-    deps = [
-      ":test_support",
-      "//base",
-      "//build/config/sanitizers:deps",
-      "//build/win:default_exe_manifest",
-    ]
-  }
-} else {  # !(is_win || is_mac || (is_linux && !is_chromeos))
-  # The testing tools are only built for the desktop platforms.
-  group("testing_tools") {
-  }
-}
-
-if (is_linux && !is_chromeos) {
-  test("tap_proxy") {
-    sources = [
-      "test/utility/tap_proxy.cc",
-    ]
-
-    deps = [
-      ":test_support",
-      "//base",
-      "//media",
-    ]
-  }
-}
-
-# Projects external to Chromium can build cast_sender and/or cast_receiver to
-# produce libraries to link with their applications.  Chromium targets should
-# not reference these.
-
-static_library("cast_sender") {
-  complete_static_lib = true
-  deps = [
-    ":sender",
-  ]
-}
-
-static_library("cast_receiver") {
-  complete_static_lib = true
-  deps = [
-    ":receiver",
-  ]
-}
diff --git a/src/cobalt/media/cast/cast_config.cc b/src/cobalt/media/cast/cast_config.cc
deleted file mode 100644
index 6709215..0000000
--- a/src/cobalt/media/cast/cast_config.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/cast/cast_config.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-VideoCodecParams::VideoCodecParams()
-    : max_qp(kDefaultMaxQp),
-      min_qp(kDefaultMinQp),
-      max_cpu_saver_qp(kDefaultMaxCpuSaverQp),
-      max_number_of_video_buffers_used(kDefaultNumberOfVideoBuffers),
-      number_of_encode_threads(1) {}
-
-VideoCodecParams::VideoCodecParams(const VideoCodecParams& other) = default;
-
-VideoCodecParams::~VideoCodecParams() {}
-
-// TODO(miu): Provide IsValidConfig() functions?
-
-FrameSenderConfig::FrameSenderConfig()
-    : sender_ssrc(0),
-      receiver_ssrc(0),
-      min_playout_delay(
-          base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)),
-      max_playout_delay(
-          base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs)),
-      animated_playout_delay(min_playout_delay),
-      rtp_payload_type(RtpPayloadType::UNKNOWN),
-      use_external_encoder(false),
-      rtp_timebase(0),
-      channels(0),
-      max_bitrate(0),
-      min_bitrate(0),
-      start_bitrate(0),
-      max_frame_rate(kDefaultMaxFrameRate),
-      codec(CODEC_UNKNOWN) {}
-
-FrameSenderConfig::FrameSenderConfig(const FrameSenderConfig& other) = default;
-
-FrameSenderConfig::~FrameSenderConfig() {}
-
-FrameReceiverConfig::FrameReceiverConfig()
-    : receiver_ssrc(0),
-      sender_ssrc(0),
-      rtp_max_delay_ms(kDefaultRtpMaxDelayMs),
-      rtp_payload_type(RtpPayloadType::UNKNOWN),
-      rtp_timebase(0),
-      channels(0),
-      target_frame_rate(0),
-      codec(CODEC_UNKNOWN) {}
-
-FrameReceiverConfig::FrameReceiverConfig(const FrameReceiverConfig& other) =
-    default;
-
-FrameReceiverConfig::~FrameReceiverConfig() {}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/cast_config.h b/src/cobalt/media/cast/cast_config.h
deleted file mode 100644
index a02c65b..0000000
--- a/src/cobalt/media/cast/cast_config.h
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_CAST_CAST_CONFIG_H_
-#define COBALT_MEDIA_CAST_CAST_CONFIG_H_
-
-#include <string>
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/shared_memory.h"
-#include "base/single_thread_task_runner.h"
-#include "base/time/time.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-class VideoEncodeAccelerator;
-
-namespace cast {
-
-// TODO(miu): Eliminate these after moving "default config" into the top-level
-// media/cast directory.  http://crbug.com/530839
-enum SuggestedDefaults {
-  // Audio encoder bitrate.  Zero means "auto," which asks the encoder to select
-  // a bitrate that dynamically adjusts to the content.  Otherwise, a constant
-  // bitrate is used.
-  kDefaultAudioEncoderBitrate = 0,
-
-  // Suggested default audio sampling rate.
-  kDefaultAudioSamplingRate = 48000,
-
-  // RTP timebase for media remoting RTP streams.
-  kRemotingRtpTimebase = 90000,
-
-  // Suggested default maximum video frame rate.
-  kDefaultMaxFrameRate = 30,
-
-  // End-to-end latency in milliseconds.
-  //
-  // DO NOT USE THIS (400 ms is proven as ideal for general-purpose use).
-  //
-  // TODO(miu): Change to 400, and confirm nothing has broken in later change.
-  // http://crbug.com/530839
-  kDefaultRtpMaxDelayMs = 100,
-
-  // Suggested minimum and maximum video bitrates for general-purpose use (up to
-  // 1080p, 30 FPS).
-  kDefaultMinVideoBitrate = 300000,
-  kDefaultMaxVideoBitrate = 5000000,
-
-  // Minimum and Maximum VP8 quantizer in default configuration.
-  kDefaultMaxQp = 63,
-  kDefaultMinQp = 4,
-
-  kDefaultMaxCpuSaverQp = 25,
-
-  // Number of video buffers in default configuration (applies only to certain
-  // external codecs).
-  kDefaultNumberOfVideoBuffers = 1,
-};
-
-// These parameters are only for video encoders.
-struct VideoCodecParams {
-  VideoCodecParams();
-  VideoCodecParams(const VideoCodecParams& other);
-  ~VideoCodecParams();
-
-  int max_qp;
-  int min_qp;
-
-  // The maximum |min_quantizer| set to the encoder when CPU is constrained.
-  // This is a trade-off between higher resolution with lower encoding quality
-  // and lower resolution with higher encoding quality. The set value indicates
-  // the maximum quantizer that the encoder might produce better quality video
-  // at this resolution than lowering resolution with similar CPU usage and
-  // smaller quantizer. The set value has to be between |min_qp| and |max_qp|.
-  // Suggested value range: [4, 30]. It is only used by software VP8 codec.
-  int max_cpu_saver_qp;
-
-  // This field is used differently by various encoders.
-  //
-  // It defaults to 1.
-  //
-  // For VP8, this field is ignored.
-  //
-  // For H.264 on Mac or iOS, it controls the max number of frames the encoder
-  // may hold before emitting a frame. A larger window may allow higher encoding
-  // efficiency at the cost of latency and memory. Set to 0 to let the encoder
-  // choose a suitable value for the platform and other encoding settings.
-  int max_number_of_video_buffers_used;
-
-  int number_of_encode_threads;
-};
-
-struct FrameSenderConfig {
-  FrameSenderConfig();
-  FrameSenderConfig(const FrameSenderConfig& other);
-  ~FrameSenderConfig();
-
-  // The sender's SSRC identifier.
-  uint32_t sender_ssrc;
-
-  // The receiver's SSRC identifier.
-  uint32_t receiver_ssrc;
-
-  // The total amount of time between a frame's capture/recording on the sender
-  // and its playback on the receiver (i.e., shown to a user).  This should be
-  // set to a value large enough to give the system sufficient time to encode,
-  // transmit/retransmit, receive, decode, and render; given its run-time
-  // environment (sender/receiver hardware performance, network conditions,
-  // etc.).
-  base::TimeDelta min_playout_delay;
-  base::TimeDelta max_playout_delay;
-
-  // Starting playout delay when streaming animated content.
-  base::TimeDelta animated_playout_delay;
-
-  // RTP payload type enum: Specifies the type/encoding of frame data.
-  RtpPayloadType rtp_payload_type;
-
-  // If true, use an external HW encoder rather than the built-in
-  // software-based one.
-  bool use_external_encoder;
-
-  // RTP timebase: The number of RTP units advanced per one second.  For audio,
-  // this is the sampling rate.  For video, by convention, this is 90 kHz.
-  int rtp_timebase;
-
-  // Number of channels.  For audio, this is normally 2.  For video, this must
-  // be 1 as Cast does not have support for stereoscopic video.
-  int channels;
-
-  // For now, only fixed bitrate is used for audio encoding. So for audio,
-  // |max_bitrate| is used, and the other two will be overriden if they are not
-  // equal to |max_bitrate|.
-  int max_bitrate;
-  int min_bitrate;
-  int start_bitrate;
-
-  double max_frame_rate;
-
-  // Codec used for the compression of signal data.
-  Codec codec;
-
-  // The AES crypto key and initialization vector.  Each of these strings
-  // contains the data in binary form, of size kAesKeySize.  If they are empty
-  // strings, crypto is not being used.
-  std::string aes_key;
-  std::string aes_iv_mask;
-
-  // These are codec specific parameters for video streams only.
-  VideoCodecParams video_codec_params;
-};
-
-// TODO(miu): Naming and minor type changes are badly needed in a later CL.
-struct FrameReceiverConfig {
-  FrameReceiverConfig();
-  FrameReceiverConfig(const FrameReceiverConfig& other);
-  ~FrameReceiverConfig();
-
-  // The receiver's SSRC identifier.
-  uint32_t receiver_ssrc;
-
-  // The sender's SSRC identifier.
-  uint32_t sender_ssrc;
-
-  // The total amount of time between a frame's capture/recording on the sender
-  // and its playback on the receiver (i.e., shown to a user).  This is fixed as
-  // a value large enough to give the system sufficient time to encode,
-  // transmit/retransmit, receive, decode, and render; given its run-time
-  // environment (sender/receiver hardware performance, network conditions,
-  // etc.).
-  int rtp_max_delay_ms;  // TODO(miu): Change to TimeDelta target_playout_delay.
-
-  // RTP payload type enum: Specifies the type/encoding of frame data.
-  RtpPayloadType rtp_payload_type;
-
-  // RTP timebase: The number of RTP units advanced per one second.  For audio,
-  // this is the sampling rate.  For video, by convention, this is 90 kHz.
-  int rtp_timebase;
-
-  // Number of channels.  For audio, this is normally 2.  For video, this must
-  // be 1 as Cast does not have support for stereoscopic video.
-  int channels;
-
-  // The target frame rate.  For audio, this is normally 100 (i.e., frames have
-  // a duration of 10ms each).  For video, this is normally 30, but any frame
-  // rate is supported.
-  double target_frame_rate;
-
-  // Codec used for the compression of signal data.
-  // TODO(miu): Merge the AudioCodec and VideoCodec enums into one so this union
-  // is not necessary.
-  Codec codec;
-
-  // The AES crypto key and initialization vector.  Each of these strings
-  // contains the data in binary form, of size kAesKeySize.  If they are empty
-  // strings, crypto is not being used.
-  std::string aes_key;
-  std::string aes_iv_mask;
-};
-
-// TODO(miu): Remove the CreateVEA callbacks.  http://crbug.com/454029
-typedef base::Callback<void(scoped_refptr<base::SingleThreadTaskRunner>,
-                            std::unique_ptr<media::VideoEncodeAccelerator>)>
-    ReceiveVideoEncodeAcceleratorCallback;
-typedef base::Callback<void(const ReceiveVideoEncodeAcceleratorCallback&)>
-    CreateVideoEncodeAcceleratorCallback;
-typedef base::Callback<void(std::unique_ptr<base::SharedMemory>)>
-    ReceiveVideoEncodeMemoryCallback;
-typedef base::Callback<void(size_t size,
-                            const ReceiveVideoEncodeMemoryCallback&)>
-    CreateVideoEncodeMemoryCallback;
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_CAST_CONFIG_H_
diff --git a/src/cobalt/media/cast/cast_environment.cc b/src/cobalt/media/cast/cast_environment.cc
deleted file mode 100644
index f2dba37..0000000
--- a/src/cobalt/media/cast/cast_environment.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/cast/cast_environment.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/logging.h"
-
-using base::SingleThreadTaskRunner;
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-CastEnvironment::CastEnvironment(
-    std::unique_ptr<base::TickClock> clock,
-    scoped_refptr<SingleThreadTaskRunner> main_thread_proxy,
-    scoped_refptr<SingleThreadTaskRunner> audio_thread_proxy,
-    scoped_refptr<SingleThreadTaskRunner> video_thread_proxy)
-    : main_thread_proxy_(main_thread_proxy),
-      audio_thread_proxy_(audio_thread_proxy),
-      video_thread_proxy_(video_thread_proxy),
-      clock_(std::move(clock)),
-      logger_(this) {}
-
-CastEnvironment::~CastEnvironment() {}
-
-bool CastEnvironment::PostTask(ThreadId identifier,
-                               const tracked_objects::Location& from_here,
-                               const base::Closure& task) {
-  return GetTaskRunner(identifier)->PostTask(from_here, task);
-}
-
-bool CastEnvironment::PostDelayedTask(
-    ThreadId identifier, const tracked_objects::Location& from_here,
-    const base::Closure& task, base::TimeDelta delay) {
-  return GetTaskRunner(identifier)->PostDelayedTask(from_here, task, delay);
-}
-
-scoped_refptr<SingleThreadTaskRunner> CastEnvironment::GetTaskRunner(
-    ThreadId identifier) const {
-  switch (identifier) {
-    case CastEnvironment::MAIN:
-      return main_thread_proxy_;
-    case CastEnvironment::AUDIO:
-      return audio_thread_proxy_;
-    case CastEnvironment::VIDEO:
-      return video_thread_proxy_;
-    default:
-      NOTREACHED() << "Invalid Thread identifier";
-      return NULL;
-  }
-}
-
-bool CastEnvironment::CurrentlyOn(ThreadId identifier) {
-  switch (identifier) {
-    case CastEnvironment::MAIN:
-      return main_thread_proxy_.get() &&
-             main_thread_proxy_->RunsTasksOnCurrentThread();
-    case CastEnvironment::AUDIO:
-      return audio_thread_proxy_.get() &&
-             audio_thread_proxy_->RunsTasksOnCurrentThread();
-    case CastEnvironment::VIDEO:
-      return video_thread_proxy_.get() &&
-             video_thread_proxy_->RunsTasksOnCurrentThread();
-    default:
-      NOTREACHED() << "Invalid thread identifier";
-      return false;
-  }
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/cast_environment.h b/src/cobalt/media/cast/cast_environment.h
deleted file mode 100644
index 947b5cd..0000000
--- a/src/cobalt/media/cast/cast_environment.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_CAST_CAST_ENVIRONMENT_H_
-#define COBALT_MEDIA_CAST_CAST_ENVIRONMENT_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-#include "media/cast/logging/log_event_dispatcher.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class CastEnvironment : public base::RefCountedThreadSafe<CastEnvironment> {
- public:
-  // An enumeration of the cast threads.
-  enum ThreadId {
-    // The main thread is where the cast system is configured and where timers
-    // and network IO is performed.
-    MAIN,
-    // The audio thread is where all send side audio processing is done,
-    // primarily encoding / decoding but also re-sampling.
-    AUDIO,
-    // The video encoder thread is where the video processing is done.
-    VIDEO,
-  };
-
-  CastEnvironment(
-      std::unique_ptr<base::TickClock> clock,
-      scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy,
-      scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy,
-      scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy);
-
-  // These are the same methods in message_loop.h, but are guaranteed to either
-  // get posted to the MessageLoop if it's still alive, or be deleted otherwise.
-  // They return true iff the thread existed and the task was posted.  Note that
-  // even if the task is posted, there's no guarantee that it will run, since
-  // the target thread may already have a Quit message in its queue.
-  bool PostTask(ThreadId identifier, const tracked_objects::Location& from_here,
-                const base::Closure& task);
-
-  bool PostDelayedTask(ThreadId identifier,
-                       const tracked_objects::Location& from_here,
-                       const base::Closure& task, base::TimeDelta delay);
-
-  bool CurrentlyOn(ThreadId identifier);
-
-  // All of the media::cast implementation must use this TickClock.
-  base::TickClock* Clock() const { return clock_.get(); }
-
-  // Thread-safe log event dispatcher.
-  LogEventDispatcher* logger() { return &logger_; }
-
-  scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
-      ThreadId identifier) const;
-
-  bool HasAudioThread() { return audio_thread_proxy_.get() ? true : false; }
-
-  bool HasVideoThread() { return video_thread_proxy_.get() ? true : false; }
-
- protected:
-  virtual ~CastEnvironment();
-
-  // Subclasses may final these.
-  scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy_;
-  scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy_;
-  scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy_;
-  std::unique_ptr<base::TickClock> clock_;
-  LogEventDispatcher logger_;
-
- private:
-  friend class base::RefCountedThreadSafe<CastEnvironment>;
-
-  DISALLOW_COPY_AND_ASSIGN(CastEnvironment);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_CAST_ENVIRONMENT_H_
diff --git a/src/cobalt/media/cast/cast_receiver.h b/src/cobalt/media/cast/cast_receiver.h
deleted file mode 100644
index 0469ebe..0000000
--- a/src/cobalt/media/cast/cast_receiver.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 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 is the main interface for the cast receiver. All configuration are done
-// at creation.
-
-#ifndef COBALT_MEDIA_CAST_CAST_RECEIVER_H_
-#define COBALT_MEDIA_CAST_CAST_RECEIVER_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/time/time.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/net/cast_transport.h"
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-
-namespace cast {
-
-// The following callbacks are used to deliver decoded audio/video frame data,
-// the frame's corresponding play-out time, and a continuity flag.
-// |is_continuous| will be false to indicate the loss of data due to a loss of
-// frames (or decoding errors).  This allows the client to take steps to smooth
-// discontinuities for playback.  Note: A NULL pointer can be returned when data
-// is not available (e.g., bad/missing packet).
-typedef base::Callback<void(std::unique_ptr<AudioBus> audio_bus,
-                            const base::TimeTicks& playout_time,
-                            bool is_continuous)> AudioFrameDecodedCallback;
-// TODO(miu): |video_frame| includes a timestamp, so use that instead.
-typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame,
-                            const base::TimeTicks& playout_time,
-                            bool is_continuous)> VideoFrameDecodedCallback;
-
-// The following callback delivers encoded frame data and metadata.  The client
-// should examine the |frame_id| field to determine whether any frames have been
-// dropped (i.e., frame_id should be incrementing by one each time).  Note: A
-// NULL pointer can be returned on error.
-typedef base::Callback<void(std::unique_ptr<EncodedFrame>)>
-    ReceiveEncodedFrameCallback;
-
-class CastReceiver {
- public:
-  static std::unique_ptr<CastReceiver> Create(
-      scoped_refptr<CastEnvironment> cast_environment,
-      const FrameReceiverConfig& audio_config,
-      const FrameReceiverConfig& video_config, CastTransport* const transport);
-
-  // All received RTP and RTCP packets for the call should be sent to this
-  // PacketReceiver.  Can be called from any thread.
-  virtual void ReceivePacket(std::unique_ptr<Packet> packet) = 0;
-
-  // Polling interface to get audio and video frames from the CastReceiver.  The
-  // the RequestDecodedXXXXXFrame() methods utilize internal software-based
-  // decoding, while the RequestEncodedXXXXXFrame() methods provides
-  // still-encoded frames for use with external/hardware decoders.
-  //
-  // In all cases, the given |callback| is guaranteed to be run at some point in
-  // the future, except for those requests still enqueued at destruction time.
-  //
-  // These methods should all be called on the CastEnvironment's MAIN thread.
-  virtual void RequestDecodedAudioFrame(
-      const AudioFrameDecodedCallback& callback) = 0;
-  virtual void RequestEncodedAudioFrame(
-      const ReceiveEncodedFrameCallback& callback) = 0;
-  virtual void RequestDecodedVideoFrame(
-      const VideoFrameDecodedCallback& callback) = 0;
-  virtual void RequestEncodedVideoFrame(
-      const ReceiveEncodedFrameCallback& callback) = 0;
-
-  virtual ~CastReceiver() {}
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_CAST_RECEIVER_H_
diff --git a/src/cobalt/media/cast/cast_sender.h b/src/cobalt/media/cast/cast_sender.h
deleted file mode 100644
index 881e60a..0000000
--- a/src/cobalt/media/cast/cast_sender.h
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2013 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 is the main interface for the cast sender.
-//
-// The AudioFrameInput, VideoFrameInput and PacketReciever interfaces should
-// be accessed from the main thread.
-
-#ifndef COBALT_MEDIA_CAST_CAST_SENDER_H_
-#define COBALT_MEDIA_CAST_CAST_SENDER_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/net/cast_transport.h"
-
-namespace gfx {
-class Size;
-}
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-
-namespace cast {
-class AudioSender;
-class VideoSender;
-
-class VideoFrameInput : public base::RefCountedThreadSafe<VideoFrameInput> {
- public:
-  // Insert video frames into Cast sender. Frames will be encoded, packetized
-  // and sent to the network.
-  virtual void InsertRawVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& capture_time) = 0;
-
-  // Creates a |VideoFrame| optimized for the encoder. When available, these
-  // frames offer performance benefits, such as memory copy elimination. The
-  // format is guaranteed to be I420 or NV12.
-  //
-  // Not every encoder supports this method. Use |CanCreateOptimizedFrames| to
-  // determine if you can and should use this method.
-  //
-  // Even if |CanCreateOptimizedFrames| indicates support, there are transient
-  // conditions during a session where optimized frames cannot be provided.  In
-  // this case, the caller must be able to account for a nullptr return value
-  // and instantiate its own media::VideoFrames.
-  virtual scoped_refptr<VideoFrame> MaybeCreateOptimizedFrame(
-      const gfx::Size& frame_size, base::TimeDelta timestamp) = 0;
-
-  // Returns true if the encoder supports creating optimized frames.
-  virtual bool CanCreateOptimizedFrames() const = 0;
-
- protected:
-  virtual ~VideoFrameInput() {}
-
- private:
-  friend class base::RefCountedThreadSafe<VideoFrameInput>;
-};
-
-class AudioFrameInput : public base::RefCountedThreadSafe<AudioFrameInput> {
- public:
-  // Insert audio frames into Cast sender. Frames will be encoded, packetized
-  // and sent to the network.
-  virtual void InsertAudio(std::unique_ptr<AudioBus> audio_bus,
-                           const base::TimeTicks& recorded_time) = 0;
-
- protected:
-  virtual ~AudioFrameInput() {}
-
- private:
-  friend class base::RefCountedThreadSafe<AudioFrameInput>;
-};
-
-// Callback that is run to update the client with current status.  This is used
-// to allow the client to wait for asynchronous initialization to complete
-// before sending frames, and also to be notified of any runtime errors that
-// have halted the session.
-using StatusChangeCallback = base::Callback<void(OperationalStatus)>;
-
-// All methods of CastSender must be called on the main thread.
-// Provided CastTransport will also be called on the main thread.
-class CastSender {
- public:
-  static std::unique_ptr<CastSender> Create(
-      scoped_refptr<CastEnvironment> cast_environment,
-      CastTransport* const transport_sender);
-
-  virtual ~CastSender() {}
-
-  // All video frames for the session should be inserted to this object.
-  virtual scoped_refptr<VideoFrameInput> video_frame_input() = 0;
-
-  // All audio frames for the session should be inserted to this object.
-  virtual scoped_refptr<AudioFrameInput> audio_frame_input() = 0;
-
-  // Initialize the audio stack. Must be called in order to send audio frames.
-  // |status_change_cb| will be run as operational status changes.
-  virtual void InitializeAudio(
-      const FrameSenderConfig& audio_config,
-      const StatusChangeCallback& status_change_cb) = 0;
-
-  // Initialize the video stack. Must be called in order to send video frames.
-  // |status_change_cb| will be run as operational status changes.
-  //
-  // TODO(miu): Remove the VEA-specific callbacks.  http://crbug.com/454029
-  virtual void InitializeVideo(
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) = 0;
-
-  // Change the target delay. This is only valid if the receiver
-  // supports the "adaptive_target_delay" rtp extension.
-  virtual void SetTargetPlayoutDelay(
-      base::TimeDelta new_target_playout_delay) = 0;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_CAST_SENDER_H_
diff --git a/src/cobalt/media/cast/cast_sender_impl.cc b/src/cobalt/media/cast/cast_sender_impl.cc
deleted file mode 100644
index 71d7a55..0000000
--- a/src/cobalt/media/cast/cast_sender_impl.cc
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/cast/cast_sender_impl.h"
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "media/base/video_frame.h"
-#include "media/cast/sender/video_frame_factory.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// The LocalVideoFrameInput class posts all incoming video frames to the main
-// cast thread for processing.
-class LocalVideoFrameInput : public VideoFrameInput {
- public:
-  LocalVideoFrameInput(scoped_refptr<CastEnvironment> cast_environment,
-                       base::WeakPtr<VideoSender> video_sender)
-      : cast_environment_(cast_environment),
-        video_sender_(video_sender),
-        video_frame_factory_(
-            video_sender.get()
-                ? video_sender->CreateVideoFrameFactory().release()
-                : nullptr) {}
-
-  void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
-                           const base::TimeTicks& capture_time) final {
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(&VideoSender::InsertRawVideoFrame, video_sender_,
-                   video_frame, capture_time));
-  }
-
-  scoped_refptr<VideoFrame> MaybeCreateOptimizedFrame(
-      const gfx::Size& frame_size, base::TimeDelta timestamp) final {
-    return video_frame_factory_
-               ? video_frame_factory_->MaybeCreateFrame(frame_size, timestamp)
-               : nullptr;
-  }
-
-  bool CanCreateOptimizedFrames() const final {
-    return video_frame_factory_.get() != nullptr;
-  }
-
- protected:
-  ~LocalVideoFrameInput() final {}
-
- private:
-  friend class base::RefCountedThreadSafe<LocalVideoFrameInput>;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const base::WeakPtr<VideoSender> video_sender_;
-  const std::unique_ptr<VideoFrameFactory> video_frame_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(LocalVideoFrameInput);
-};
-
-// The LocalAudioFrameInput class posts all incoming audio frames to the main
-// cast thread for processing. Therefore frames can be inserted from any thread.
-class LocalAudioFrameInput : public AudioFrameInput {
- public:
-  LocalAudioFrameInput(scoped_refptr<CastEnvironment> cast_environment,
-                       base::WeakPtr<AudioSender> audio_sender)
-      : cast_environment_(cast_environment), audio_sender_(audio_sender) {}
-
-  void InsertAudio(std::unique_ptr<AudioBus> audio_bus,
-                   const base::TimeTicks& recorded_time) final {
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(&AudioSender::InsertAudio, audio_sender_,
-                   base::Passed(&audio_bus), recorded_time));
-  }
-
- protected:
-  ~LocalAudioFrameInput() final {}
-
- private:
-  friend class base::RefCountedThreadSafe<LocalAudioFrameInput>;
-
-  scoped_refptr<CastEnvironment> cast_environment_;
-  base::WeakPtr<AudioSender> audio_sender_;
-
-  DISALLOW_COPY_AND_ASSIGN(LocalAudioFrameInput);
-};
-
-std::unique_ptr<CastSender> CastSender::Create(
-    scoped_refptr<CastEnvironment> cast_environment,
-    CastTransport* const transport_sender) {
-  CHECK(cast_environment.get());
-  return std::unique_ptr<CastSender>(
-      new CastSenderImpl(cast_environment, transport_sender));
-}
-
-CastSenderImpl::CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment,
-                               CastTransport* const transport_sender)
-    : cast_environment_(cast_environment),
-      transport_sender_(transport_sender),
-      weak_factory_(this) {
-  CHECK(cast_environment.get());
-}
-
-void CastSenderImpl::InitializeAudio(
-    const FrameSenderConfig& audio_config,
-    const StatusChangeCallback& status_change_cb) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  CHECK(audio_config.use_external_encoder ||
-        cast_environment_->HasAudioThread());
-
-  VLOG(1) << "CastSenderImpl@" << this << "::InitializeAudio()";
-
-  audio_sender_.reset(
-      new AudioSender(cast_environment_, audio_config,
-                      base::Bind(&CastSenderImpl::OnAudioStatusChange,
-                                 weak_factory_.GetWeakPtr(), status_change_cb),
-                      transport_sender_));
-  if (video_sender_) {
-    DCHECK(audio_sender_->GetTargetPlayoutDelay() ==
-           video_sender_->GetTargetPlayoutDelay());
-  }
-}
-
-void CastSenderImpl::InitializeVideo(
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb,
-    const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-    const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()";
-
-  video_sender_.reset(new VideoSender(
-      cast_environment_, video_config,
-      base::Bind(&CastSenderImpl::OnVideoStatusChange,
-                 weak_factory_.GetWeakPtr(), status_change_cb),
-      create_vea_cb, create_video_encode_mem_cb, transport_sender_,
-      base::Bind(&CastSenderImpl::SetTargetPlayoutDelay,
-                 weak_factory_.GetWeakPtr())));
-  if (audio_sender_) {
-    DCHECK(audio_sender_->GetTargetPlayoutDelay() ==
-           video_sender_->GetTargetPlayoutDelay());
-  }
-}
-
-CastSenderImpl::~CastSenderImpl() {
-  VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()";
-}
-
-scoped_refptr<AudioFrameInput> CastSenderImpl::audio_frame_input() {
-  return audio_frame_input_;
-}
-
-scoped_refptr<VideoFrameInput> CastSenderImpl::video_frame_input() {
-  return video_frame_input_;
-}
-
-void CastSenderImpl::SetTargetPlayoutDelay(
-    base::TimeDelta new_target_playout_delay) {
-  VLOG(1) << "CastSenderImpl@" << this << "::SetTargetPlayoutDelay("
-          << new_target_playout_delay.InMilliseconds() << " ms)";
-  if (audio_sender_) {
-    audio_sender_->SetTargetPlayoutDelay(new_target_playout_delay);
-  }
-  if (video_sender_) {
-    video_sender_->SetTargetPlayoutDelay(new_target_playout_delay);
-  }
-}
-
-void CastSenderImpl::OnAudioStatusChange(
-    const StatusChangeCallback& status_change_cb, OperationalStatus status) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (status == STATUS_INITIALIZED && !audio_frame_input_) {
-    audio_frame_input_ =
-        new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr());
-  }
-  status_change_cb.Run(status);
-}
-
-void CastSenderImpl::OnVideoStatusChange(
-    const StatusChangeCallback& status_change_cb, OperationalStatus status) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (status == STATUS_INITIALIZED && !video_frame_input_) {
-    video_frame_input_ =
-        new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
-  }
-  status_change_cb.Run(status);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/cast_sender_impl.h b/src/cobalt/media/cast/cast_sender_impl.h
deleted file mode 100644
index f4a6056..0000000
--- a/src/cobalt/media/cast/cast_sender_impl.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2013 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 COBALT_MEDIA_CAST_CAST_SENDER_IMPL_H_
-#define COBALT_MEDIA_CAST_CAST_SENDER_IMPL_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/sender/audio_sender.h"
-#include "media/cast/sender/video_sender.h"
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-
-namespace cast {
-class AudioSender;
-class VideoSender;
-
-// This class combines all required sending objects such as the audio and video
-// senders, pacer, packet receiver and frame input.
-class CastSenderImpl : public CastSender {
- public:
-  CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment,
-                 CastTransport* const transport_sender);
-
-  void InitializeAudio(const FrameSenderConfig& audio_config,
-                       const StatusChangeCallback& status_change_cb) final;
-  void InitializeVideo(
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) final;
-
-  void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay) final;
-
-  ~CastSenderImpl() final;
-
-  scoped_refptr<AudioFrameInput> audio_frame_input() final;
-  scoped_refptr<VideoFrameInput> video_frame_input() final;
-
- private:
-  void ReceivedPacket(std::unique_ptr<Packet> packet);
-  void OnAudioStatusChange(const StatusChangeCallback& status_change_cb,
-                           OperationalStatus status);
-  void OnVideoStatusChange(const StatusChangeCallback& status_change_cb,
-                           OperationalStatus status);
-
-  std::unique_ptr<AudioSender> audio_sender_;
-  std::unique_ptr<VideoSender> video_sender_;
-  scoped_refptr<AudioFrameInput> audio_frame_input_;
-  scoped_refptr<VideoFrameInput> video_frame_input_;
-  scoped_refptr<CastEnvironment> cast_environment_;
-  // The transport sender is owned by the owner of the CastSender, and should be
-  // valid throughout the lifetime of the CastSender.
-  CastTransport* const transport_sender_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<CastSenderImpl> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(CastSenderImpl);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_CAST_SENDER_IMPL_H_
diff --git a/src/cobalt/media/cast/common/clock_drift_smoother.cc b/src/cobalt/media/cast/common/clock_drift_smoother.cc
deleted file mode 100644
index ab44407..0000000
--- a/src/cobalt/media/cast/common/clock_drift_smoother.cc
+++ /dev/null
@@ -1,61 +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.
-
-#include "media/cast/common/clock_drift_smoother.h"
-
-#include "base/logging.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-ClockDriftSmoother::ClockDriftSmoother(base::TimeDelta time_constant)
-    : time_constant_(time_constant), estimate_us_(0.0) {
-  DCHECK(time_constant_ > base::TimeDelta());
-}
-
-ClockDriftSmoother::~ClockDriftSmoother() {}
-
-base::TimeDelta ClockDriftSmoother::Current() const {
-  DCHECK(!last_update_time_.is_null());
-  return base::TimeDelta::FromMicroseconds(static_cast<int64_t>(
-      estimate_us_ + 0.5));  // Round to nearest microsecond.
-}
-
-void ClockDriftSmoother::Reset(base::TimeTicks now,
-                               base::TimeDelta measured_offset) {
-  DCHECK(!now.is_null());
-  last_update_time_ = now;
-  estimate_us_ = static_cast<double>(measured_offset.InMicroseconds());
-}
-
-void ClockDriftSmoother::Update(base::TimeTicks now,
-                                base::TimeDelta measured_offset) {
-  DCHECK(!now.is_null());
-  if (last_update_time_.is_null()) {
-    Reset(now, measured_offset);
-  } else if (now < last_update_time_) {
-    // |now| is not monotonically non-decreasing.
-    NOTREACHED();
-  } else {
-    const double elapsed_us =
-        static_cast<double>((now - last_update_time_).InMicroseconds());
-    last_update_time_ = now;
-    const double weight =
-        elapsed_us / (elapsed_us + time_constant_.InMicroseconds());
-    estimate_us_ = weight * measured_offset.InMicroseconds() +
-                   (1.0 - weight) * estimate_us_;
-  }
-}
-
-// static
-base::TimeDelta ClockDriftSmoother::GetDefaultTimeConstant() {
-  static const int kDefaultTimeConstantInSeconds = 30;
-  return base::TimeDelta::FromSeconds(kDefaultTimeConstantInSeconds);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/common/clock_drift_smoother.h b/src/cobalt/media/cast/common/clock_drift_smoother.h
deleted file mode 100644
index 5ba5963..0000000
--- a/src/cobalt/media/cast/common/clock_drift_smoother.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_COMMON_CLOCK_DRIFT_SMOOTHER_H_
-#define COBALT_MEDIA_CAST_COMMON_CLOCK_DRIFT_SMOOTHER_H_
-
-#include "base/time/time.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Tracks the jitter and drift between clocks, providing a smoothed offset.
-// Internally, a Simple IIR filter is used to maintain a running average that
-// moves at a rate based on the passage of time.
-class ClockDriftSmoother {
- public:
-  // |time_constant| is the amount of time an impulse signal takes to decay by
-  // ~62.6%.  Interpretation: If the value passed to several Update() calls is
-  // held constant for T seconds, then the running average will have moved
-  // towards the value by ~62.6% from where it started.
-  explicit ClockDriftSmoother(base::TimeDelta time_constant);
-  ~ClockDriftSmoother();
-
-  // Returns the current offset.
-  base::TimeDelta Current() const;
-
-  // Discard all history and reset to exactly |offset|, measured |now|.
-  void Reset(base::TimeTicks now, base::TimeDelta offset);
-
-  // Update the current offset, which was measured |now|.  The weighting that
-  // |measured_offset| will have on the running average is influenced by how
-  // much time has passed since the last call to this method (or Reset()).
-  // |now| should be monotonically non-decreasing over successive calls of this
-  // method.
-  void Update(base::TimeTicks now, base::TimeDelta measured_offset);
-
-  // Returns a time constant suitable for most use cases, where the clocks
-  // are expected to drift very little with respect to each other, and the
-  // jitter caused by clock imprecision is effectively canceled out.
-  static base::TimeDelta GetDefaultTimeConstant();
-
- private:
-  const base::TimeDelta time_constant_;
-  base::TimeTicks last_update_time_;
-  double estimate_us_;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_COMMON_CLOCK_DRIFT_SMOOTHER_H_
diff --git a/src/cobalt/media/cast/common/expanded_value_base.h b/src/cobalt/media/cast/common/expanded_value_base.h
deleted file mode 100644
index 55d92c7..0000000
--- a/src/cobalt/media/cast/common/expanded_value_base.h
+++ /dev/null
@@ -1,147 +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 COBALT_MEDIA_CAST_COMMON_EXPANDED_VALUE_BASE_H_
-#define COBALT_MEDIA_CAST_COMMON_EXPANDED_VALUE_BASE_H_
-
-#include <limits>
-
-#include "base/logging.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Abstract base template class for common "sequence value" data types such as
-// RtpTimeTicks, FrameId, or PacketId which generally increment/decrement in
-// predictable amounts as media is streamed, and which often need to be reliably
-// truncated and re-expanded for over-the-wire transmission.
-//
-// FullWidthInteger should be a signed integer POD type that is of sufficiently
-// high width (in bits) such that it is never expected to under/overflow during
-// the longest reasonable length of continuous system operation.  Subclass is
-// the class inheriting the common functionality provided in this template, and
-// is used to provide operator overloads.  The Subclass must friend this class
-// to enable these operator overloads.
-//
-// Please see RtpTimeTicks and unit test code for examples of how to define
-// Subclasses and add features specific to their concrete data type, and how to
-// use data types derived from ExpandedValueBase.  For example, a RtpTimeTicks
-// adds math operators consisting of the meaningful and valid set of operations
-// allowed for doing "time math."  On the other hand, FrameId only adds math
-// operators for incrementing/decrementing since multiplication and division are
-// meaningless.
-template <typename FullWidthInteger, class Subclass>
-class ExpandedValueBase {
-  static_assert(std::numeric_limits<FullWidthInteger>::is_signed,
-                "FullWidthInteger must be a signed integer.");
-  static_assert(std::numeric_limits<FullWidthInteger>::is_integer,
-                "FullWidthInteger must be a signed integer.");
-
- public:
-  // Methods that return the lower bits of this value.  This should only be used
-  // for serializing/wire-formatting, and not to subvert the restricted set of
-  // operators allowed on this data type.
-  uint8_t lower_8_bits() const { return static_cast<uint8_t>(value_); }
-  uint16_t lower_16_bits() const { return static_cast<uint16_t>(value_); }
-  uint32_t lower_32_bits() const { return static_cast<uint32_t>(value_); }
-
-  // Compute the greatest value less than or equal to |this| value whose lower
-  // bits are those of |x|.  The purpose of this method is to re-instantiate an
-  // original value from its truncated form, usually when deserializing
-  // off-the-wire, when |this| value is known to be the greatest possible valid
-  // value.
-  //
-  // Use case example: Start with an original 32-bit value of 0x000001fe (510
-  // decimal) and truncate, throwing away its upper 24 bits: 0xfe.  Now, send
-  // this truncated value over-the-wire to a peer who needs to expand it back to
-  // the original 32-bit value.  The peer knows that the greatest possible valid
-  // value is 0x00000202 (514 decimal).  This method will initially attempt to
-  // just concatenate the upper 24 bits of |this->value_| with |x| (the 8-bit
-  // value), and get a result of 0x000002fe (766 decimal).  However, this is
-  // greater than |this->value_|, so the upper 24 bits are subtracted by one to
-  // get 0x000001fe, which is the original value.
-  template <typename ShortUnsigned>
-  Subclass ExpandLessThanOrEqual(ShortUnsigned x) const {
-    static_assert(!std::numeric_limits<ShortUnsigned>::is_signed,
-                  "|x| must be an unsigned integer.");
-    static_assert(std::numeric_limits<ShortUnsigned>::is_integer,
-                  "|x| must be an unsigned integer.");
-    static_assert(sizeof(ShortUnsigned) <= sizeof(FullWidthInteger),
-                  "|x| must fit within the FullWidthInteger.");
-
-    if (sizeof(ShortUnsigned) < sizeof(FullWidthInteger)) {
-      // Initially, the |result| is composed of upper bits from |value_| and
-      // lower bits from |x|.
-      const FullWidthInteger short_max =
-          std::numeric_limits<ShortUnsigned>::max();
-      FullWidthInteger result = (value_ & ~short_max) | x;
-
-      // If the |result| is larger than |value_|, decrement the upper bits by
-      // one.  In other words, |x| must always be interpreted as a truncated
-      // version of a value less than or equal to |value_|.
-      if (result > value_) result -= short_max + 1;
-
-      return Subclass(result);
-    } else {
-      // Debug builds: Ensure the highest bit is not set (which would cause
-      // overflow when casting to the signed integer).
-      DCHECK_EQ(static_cast<ShortUnsigned>(0),
-                x & (static_cast<ShortUnsigned>(1) << ((sizeof(x) * 8) - 1)));
-      return Subclass(x);
-    }
-  }
-
-  // Compute the value closest to |this| value whose lower bits are those of
-  // |x|.  The result is always within |max_distance_for_expansion()| of |this|
-  // value.  The purpose of this method is to re-instantiate an original value
-  // from its truncated form, usually when deserializing off-the-wire.  See
-  // comments for ExpandLessThanOrEqual() above for further explanation.
-  template <typename ShortUnsigned>
-  Subclass Expand(ShortUnsigned x) const {
-    const Subclass maximum_possible_result(
-        value_ + max_distance_for_expansion<ShortUnsigned>());
-    return maximum_possible_result.ExpandLessThanOrEqual(x);
-  }
-
-  // Comparison operators.
-  bool operator==(Subclass rhs) const { return value_ == rhs.value_; }
-  bool operator!=(Subclass rhs) const { return value_ != rhs.value_; }
-  bool operator<(Subclass rhs) const { return value_ < rhs.value_; }
-  bool operator>(Subclass rhs) const { return value_ > rhs.value_; }
-  bool operator<=(Subclass rhs) const { return value_ <= rhs.value_; }
-  bool operator>=(Subclass rhs) const { return value_ >= rhs.value_; }
-
-  // (De)Serialize for transmission over IPC.  Do not use these to subvert the
-  // valid set of operators allowed by this class or its Subclass.
-  uint64_t SerializeForIPC() const {
-    static_assert(sizeof(uint64_t) >= sizeof(FullWidthInteger),
-                  "Cannot serialize FullWidthInteger into an uint64_t.");
-    return static_cast<uint64_t>(value_);
-  }
-  static Subclass DeserializeForIPC(uint64_t serialized) {
-    return Subclass(static_cast<FullWidthInteger>(serialized));
-  }
-
-  // Design limit: Values that are truncated to the ShortUnsigned type must be
-  // no more than this maximum distance from each other in order to ensure the
-  // original value can be determined correctly.
-  template <typename ShortUnsigned>
-  static constexpr FullWidthInteger max_distance_for_expansion() {
-    return std::numeric_limits<ShortUnsigned>::max() / 2;
-  }
-
- protected:
-  // Only subclasses are permitted to instantiate directly.
-  explicit ExpandedValueBase(FullWidthInteger value) : value_(value) {}
-
-  FullWidthInteger value_;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_COMMON_EXPANDED_VALUE_BASE_H_
diff --git a/src/cobalt/media/cast/common/expanded_value_base_unittest.cc b/src/cobalt/media/cast/common/expanded_value_base_unittest.cc
deleted file mode 100644
index ad60431..0000000
--- a/src/cobalt/media/cast/common/expanded_value_base_unittest.cc
+++ /dev/null
@@ -1,109 +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 "media/cast/common/expanded_value_base.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-// A basic subclass of ExpandedValueBase to use for testing.
-class TestValue : public ExpandedValueBase<int64_t, TestValue> {
- public:
-  explicit TestValue(int64_t value) : ExpandedValueBase(value) {}
-};
-
-}  // namespace
-
-// Tests the various scenarios of truncating and then re-expanding values, and
-// confirming the correct behavior.  Note that, while the code below just tests
-// truncation/expansion to/from 8 bits, the 16- and 32-bit cases are implicitly
-// confirmed because the Expand() method uses the compiler to derive all of its
-// constants (based on the type of its argument).
-TEST(ExpandedValueBaseTest, TruncationAndExpansion) {
-  // Test that expansion works when the reference is always equal to the value
-  // that was truncated.
-  for (int64_t i = -512; i <= 512; ++i) {
-    const TestValue original_value(i);
-    const uint8_t truncated = original_value.lower_8_bits();
-    const TestValue reference(i);
-    ASSERT_EQ(original_value, reference.Expand(truncated)) << "i=" << i;
-  }
-
-  // Test that expansion works when the reference is always one less than the
-  // value that was truncated.
-  for (int64_t i = -512; i <= 512; ++i) {
-    const TestValue original_value(i);
-    const uint8_t truncated = original_value.lower_8_bits();
-    const TestValue reference(i - 1);
-    ASSERT_EQ(original_value, reference.Expand(truncated)) << "i=" << i;
-  }
-
-  // Test that expansion works when the reference is always one greater than the
-  // value that was truncated.
-  for (int64_t i = -512; i <= 512; ++i) {
-    const TestValue original_value(i);
-    const uint8_t truncated = original_value.lower_8_bits();
-    const TestValue reference(i + 1);
-    ASSERT_EQ(original_value, reference.Expand(truncated)) << "i=" << i;
-  }
-
-  // Test cases where the difference between the original value and the fixed
-  // reference is within the range [-128,+127].  The truncated value should
-  // always be re-expanded to the original value.
-  for (int64_t bias = -5; bias <= 5; ++bias) {
-    for (int64_t i = -128; i <= 127; ++i) {
-      const TestValue original_value(bias + i);
-      const uint8_t truncated = original_value.lower_8_bits();
-      const TestValue reference(bias);
-      ASSERT_EQ(original_value, reference.Expand(truncated)) << "bias=" << bias
-                                                             << ", i=" << i;
-    }
-  }
-
-  // Test cases where the difference between the original value and the fixed
-  // reference is within the range [+128,+255].  When the truncated value is
-  // re-expanded, it should be 256 less than the original value.
-  for (int64_t bias = -5; bias <= 5; ++bias) {
-    for (int64_t i = 128; i <= 255; ++i) {
-      // Example: Let |original_value| be 192.  Then, the truncated 8-bit value
-      // will be 0xc0.  When a |reference| of zero is asked to expand 0xc0 back
-      // to the original value, it should produce -64 since -64 is closer to
-      // |reference| than 192.
-      const TestValue original_value(bias + i);
-      const uint8_t truncated = original_value.lower_8_bits();
-      const TestValue reexpanded_value(bias + i - 256);
-      ASSERT_EQ(reexpanded_value.lower_8_bits(), truncated);
-      const TestValue reference(bias);
-      ASSERT_EQ(reexpanded_value, reference.Expand(truncated))
-          << "bias=" << bias << ", i=" << i;
-    }
-  }
-
-  // Test cases where the difference between the original value and the fixed
-  // reference is within the range [-256,-129].  When the truncated value is
-  // re-expanded, it should be 256 more than the original value.
-  for (int64_t bias = -5; bias <= 5; ++bias) {
-    for (int64_t i = -256; i <= -129; ++i) {
-      // Example: Let |original_value| be -192.  Then, the truncated 8-bit value
-      // will be 0x40.  When a |reference| of zero is asked to expand 0x40 back
-      // to the original value, it should produce 64 since 64 is closer to the
-      // |reference| than -192.
-      const TestValue original_value(bias + i);
-      const uint8_t truncated = original_value.lower_8_bits();
-      const TestValue reexpanded_value(bias + i + 256);
-      ASSERT_EQ(reexpanded_value.lower_8_bits(), truncated);
-      const TestValue reference(bias);
-      ASSERT_EQ(reexpanded_value, reference.Expand(truncated))
-          << "bias=" << bias << ", i=" << i;
-    }
-  }
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/common/frame_id.cc b/src/cobalt/media/cast/common/frame_id.cc
deleted file mode 100644
index cd5dafe..0000000
--- a/src/cobalt/media/cast/common/frame_id.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/cast/common/frame_id.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-std::ostream& operator<<(std::ostream& out, const FrameId rhs) {
-  out << "F";
-  if (rhs.is_null()) return out << "<null>";
-  return out << rhs.value();
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/common/frame_id.h b/src/cobalt/media/cast/common/frame_id.h
deleted file mode 100644
index 245c9f7..0000000
--- a/src/cobalt/media/cast/common/frame_id.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_COMMON_FRAME_ID_H_
-#define COBALT_MEDIA_CAST_COMMON_FRAME_ID_H_
-
-#include <limits>
-#include <sstream>
-
-#include "media/cast/common/expanded_value_base.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Forward declaration (see below).
-class FrameId;
-
-// Convenience operator overloads for logging.
-std::ostream& operator<<(std::ostream& out, const FrameId rhs);
-
-// Unique identifier for a frame in a RTP media stream.  FrameIds are truncated
-// to 8-bit values in RTP and RTCP headers, and then expanded back by the other
-// endpoint when parsing the headers.
-//
-// Usage example:
-//
-//   // Distance/offset math.
-//   FrameId first = FrameId::first();
-//   FrameId second = first + 1;
-//   FrameId third = second + 1;
-//   int64_t offset = third - first;
-//   FrameId fourth = second + offset;
-//
-//   // Logging convenience.
-//   DLOG(INFO) << "The current frame is " << fourth;
-class FrameId : public ExpandedValueBase<int64_t, FrameId> {
- public:
-  // The "null" FrameId constructor.  Represents a FrameId field that has not
-  // been set and/or a "not applicable" indicator.
-  FrameId() : FrameId(std::numeric_limits<int64_t>::min()) {}
-
-  // Allow copy construction and assignment.
-  FrameId(const FrameId&) = default;
-  FrameId& operator=(const FrameId&) = default;
-
-  // Returns true if this is the special value representing null.
-  bool is_null() const { return *this == FrameId(); }
-
-  // Distance operator.
-  int64_t operator-(FrameId rhs) const {
-    DCHECK(!is_null());
-    DCHECK(!rhs.is_null());
-    return value_ - rhs.value_;
-  }
-
-  // Operators to compute advancement by incremental amounts.
-  FrameId operator+(int64_t rhs) const {
-    DCHECK(!is_null());
-    return FrameId(value_ + rhs);
-  }
-  FrameId operator-(int64_t rhs) const {
-    DCHECK(!is_null());
-    return FrameId(value_ - rhs);
-  }
-  FrameId& operator+=(int64_t rhs) {
-    DCHECK(!is_null());
-    return (*this = (*this + rhs));
-  }
-  FrameId& operator-=(int64_t rhs) {
-    DCHECK(!is_null());
-    return (*this = (*this - rhs));
-  }
-  FrameId& operator++() {
-    DCHECK(!is_null());
-    ++value_;
-    return *this;
-  }
-  FrameId& operator--() {
-    DCHECK(!is_null());
-    --value_;
-    return *this;
-  }
-  FrameId operator++(int) {
-    DCHECK(!is_null());
-    return FrameId(value_++);
-  }
-  FrameId operator--(int) {
-    DCHECK(!is_null());
-    return FrameId(value_--);
-  }
-
-  // The identifier for the first frame in a stream.
-  static FrameId first() { return FrameId(0); }
-
- private:
-  friend class ExpandedValueBase<int64_t, FrameId>;
-  friend std::ostream& operator<<(std::ostream& out, const FrameId rhs);
-
-  explicit FrameId(int64_t value) : ExpandedValueBase(value) {}
-
-  // Accessor used by ostream output function.
-  int64_t value() const { return value_; }
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_COMMON_FRAME_ID_H_
diff --git a/src/cobalt/media/cast/common/mod_util.h b/src/cobalt/media/cast/common/mod_util.h
deleted file mode 100644
index 034532e..0000000
--- a/src/cobalt/media/cast/common/mod_util.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_COMMON_MOD_UTIL_H_
-#define COBALT_MEDIA_CAST_COMMON_MOD_UTIL_H_
-
-#include <map>
-#include "base/logging.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// MAP is a map<uint??, ...> where the unsigned integer is
-// assumed to wrap around, but only a small range is used at a time.
-// Return the oldest entry in the map.
-template <class MAP>
-typename MAP::iterator ModMapOldest(MAP* map) {
-  typename MAP::iterator ret = map->begin();
-  if (ret != map->end()) {
-    typename MAP::key_type lower_quarter = 0;
-    lower_quarter--;
-    lower_quarter >>= 1;
-    if (ret->first < lower_quarter) {
-      typename MAP::iterator tmp = map->upper_bound(lower_quarter * 3);
-      if (tmp != map->end()) ret = tmp;
-    }
-  }
-  return ret;
-}
-
-// MAP is a map<uint??, ...> where the unsigned integer is
-// assumed to wrap around, but only a small range is used at a time.
-// Returns the previous entry in the map.
-template <class MAP>
-typename MAP::iterator ModMapPrevious(MAP* map, typename MAP::iterator i) {
-  DCHECK(!map->empty());
-  typename MAP::iterator ret = i;
-  if (i == map->begin()) {
-    ret = map->end();
-  }
-  ret--;
-  if (i == ret) return map->end();
-  if ((i->first - ret->first) > ((typename MAP::key_type(0) - 1)) >> 1)
-    return map->end();
-  return ret;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_COMMON_MOD_UTIL_H_
diff --git a/src/cobalt/media/cast/common/rtp_time.cc b/src/cobalt/media/cast/common/rtp_time.cc
deleted file mode 100644
index 5a86736..0000000
--- a/src/cobalt/media/cast/common/rtp_time.cc
+++ /dev/null
@@ -1,76 +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 "media/cast/common/rtp_time.h"
-
-#include <limits>
-#include <sstream>
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-// Returns the base::TimeDelta nearest to the time represented by a tick count
-// in the given timebase.
-base::TimeDelta TicksToTimeDelta(int64_t ticks, int timebase) {
-  DCHECK_GT(timebase, 0);
-  const double micros = static_cast<double>(ticks) / timebase *
-                            base::Time::kMicrosecondsPerSecond +
-                        0.5 /* rounding */;
-  DCHECK_LT(micros, static_cast<double>(std::numeric_limits<int64_t>::max()));
-  return base::TimeDelta::FromMicroseconds(static_cast<int64_t>(micros));
-}
-
-// Returns the tick count in the given timebase nearest to the base::TimeDelta.
-int64_t TimeDeltaToTicks(base::TimeDelta delta, int timebase) {
-  DCHECK_GT(timebase, 0);
-  const double ticks = delta.InSecondsF() * timebase + 0.5 /* rounding */;
-  DCHECK_LT(ticks, static_cast<double>(std::numeric_limits<int64_t>::max()));
-  return static_cast<int64_t>(ticks);
-}
-
-}  // namespace
-
-std::ostream& operator<<(std::ostream& out, const RtpTimeDelta rhs) {
-  if (rhs.value_ >= 0)
-    out << "RTP+";
-  else
-    out << "RTP";
-  return out << rhs.value_;
-}
-
-std::ostream& operator<<(std::ostream& out, const RtpTimeTicks rhs) {
-  return out << "RTP@" << rhs.value_;
-}
-
-base::TimeDelta RtpTimeDelta::ToTimeDelta(int rtp_timebase) const {
-  return TicksToTimeDelta(value_, rtp_timebase);
-}
-
-// static
-RtpTimeDelta RtpTimeDelta::FromTimeDelta(base::TimeDelta delta,
-                                         int rtp_timebase) {
-  return RtpTimeDelta(TimeDeltaToTicks(delta, rtp_timebase));
-}
-
-// static
-RtpTimeDelta RtpTimeDelta::FromTicks(int64_t ticks) {
-  return RtpTimeDelta(ticks);
-}
-
-base::TimeDelta RtpTimeTicks::ToTimeDelta(int rtp_timebase) const {
-  return TicksToTimeDelta(value_, rtp_timebase);
-}
-
-// static
-RtpTimeTicks RtpTimeTicks::FromTimeDelta(base::TimeDelta delta,
-                                         int rtp_timebase) {
-  return RtpTimeTicks(TimeDeltaToTicks(delta, rtp_timebase));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/common/rtp_time.h b/src/cobalt/media/cast/common/rtp_time.h
deleted file mode 100644
index e4a3ecc..0000000
--- a/src/cobalt/media/cast/common/rtp_time.h
+++ /dev/null
@@ -1,202 +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 COBALT_MEDIA_CAST_COMMON_RTP_TIME_H_
-#define COBALT_MEDIA_CAST_COMMON_RTP_TIME_H_
-
-#include <limits>
-#include <sstream>
-
-#include "base/time/time.h"
-#include "media/cast/common/expanded_value_base.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Forward declarations (see below).
-class RtpTimeDelta;
-class RtpTimeTicks;
-
-// Convenience operator overloads for logging.
-std::ostream& operator<<(std::ostream& out, const RtpTimeDelta rhs);
-std::ostream& operator<<(std::ostream& out, const RtpTimeTicks rhs);
-
-// The difference between two RtpTimeTicks values.  This data type is modeled
-// off of base::TimeDelta, and used for performing compiler-checked arithmetic
-// with RtpTimeTicks.
-//
-// This data type wraps a value, providing only the meaningful set of math
-// operations that may be performed on the value.  RtpTimeDeltas may be
-// added/subtracted with other RtpTimeDeltas to produce a RtpTimeDelta holding
-// the sum/difference.  RtpTimeDeltas may also be multiplied or divided by
-// integer amounts.  Finally, RtpTimeDeltas may be divided by other
-// RtpTimeDeltas to compute a number of periods (floor'ed to an integer), or
-// modulo each other to determine a time period remainder.
-//
-// The base class provides bit truncation/extension features for
-// wire-formatting, and also the comparison operators.
-//
-// Usage example:
-//
-//   // Time math.
-//   RtpTimeDelta zero;
-//   RtpTimeDelta one_second_later =
-//       zero + RtpTimeDelta::FromTicks(kAudioSamplingRate);
-//   RtpTimeDelta ten_seconds_later = one_second_later * 10;
-//   int64_t ten_periods = ten_seconds_later / one_second_later;
-//
-//   // Logging convenience.
-//   DLOG(INFO) << "The RTP time offset is " << ten_seconds_later;
-//
-//   // Convert (approximately!) between RTP timebase and microsecond timebase:
-//   base::TimeDelta nine_seconds_offset =
-//       (ten_seconds_later - one_second_later).ToTimeDelta(kAudioSamplingRate);
-//   RtpTimeDelta nine_seconds_rtp =
-//       RtpTimeDelta::FromTimeDelta(nine_seconds_offset, kAudioSamplingRate);
-class RtpTimeDelta : public ExpandedValueBase<int64_t, RtpTimeDelta> {
- public:
-  RtpTimeDelta() : ExpandedValueBase(0) {}
-
-  // Arithmetic operators (with other deltas).
-  RtpTimeDelta operator+(RtpTimeDelta rhs) const {
-    return RtpTimeDelta(value_ + rhs.value_);
-  }
-  RtpTimeDelta operator-(RtpTimeDelta rhs) const {
-    return RtpTimeDelta(value_ - rhs.value_);
-  }
-  RtpTimeDelta& operator+=(RtpTimeDelta rhs) { return (*this = (*this + rhs)); }
-  RtpTimeDelta& operator-=(RtpTimeDelta rhs) { return (*this = (*this - rhs)); }
-  RtpTimeDelta operator-() const { return RtpTimeDelta(-value_); }
-
-  // Multiplicative operators (with other deltas).
-  int64_t operator/(RtpTimeDelta rhs) const { return value_ / rhs.value_; }
-  RtpTimeDelta operator%(RtpTimeDelta rhs) const {
-    return RtpTimeDelta(value_ % rhs.value_);
-  }
-  RtpTimeDelta& operator%=(RtpTimeDelta rhs) { return (*this = (*this % rhs)); }
-
-  // Multiplicative operators (with integer types).
-  template <typename IntType>
-  RtpTimeDelta operator*(IntType rhs) const {
-    static_assert(std::numeric_limits<IntType>::is_integer,
-                  "|rhs| must be a POD integer type");
-    return RtpTimeDelta(value_ * rhs);
-  }
-  template <typename IntType>
-  RtpTimeDelta operator/(IntType rhs) const {
-    static_assert(std::numeric_limits<IntType>::is_integer,
-                  "|rhs| must be a POD integer type");
-    return RtpTimeDelta(value_ / rhs);
-  }
-  template <typename IntType>
-  RtpTimeDelta& operator*=(IntType rhs) {
-    return (*this = (*this * rhs));
-  }
-  template <typename IntType>
-  RtpTimeDelta& operator/=(IntType rhs) {
-    return (*this = (*this / rhs));
-  }
-
-  // Maps this RtpTimeDelta to an approximate TimeDelta using the given
-  // RTP timebase.  Assumes a zero-valued TimeDelta corresponds to a zero-valued
-  // RtpTimeDelta.
-  base::TimeDelta ToTimeDelta(int rtp_timebase) const;
-
-  // Maps the TimeDelta to an approximate RtpTimeDelta using the given RTP
-  // timebase.  Assumes a zero-valued TimeDelta corresponds to a zero-valued
-  // RtpTimeDelta.
-  static RtpTimeDelta FromTimeDelta(base::TimeDelta delta, int rtp_timebase);
-
-  // Construct a RtpTimeDelta from an exact number of ticks.
-  static RtpTimeDelta FromTicks(int64_t ticks);
-
- private:
-  friend class ExpandedValueBase<int64_t, RtpTimeDelta>;
-  friend class RtpTimeTicks;
-  friend std::ostream& operator<<(std::ostream& out, const RtpTimeDelta rhs);
-
-  explicit RtpTimeDelta(int64_t ticks) : ExpandedValueBase(ticks) {}
-
-  int64_t value() const { return value_; }
-};
-
-// A media timestamp whose timebase matches the periodicity of the content
-// (e.g., for audio, the timebase would be the sampling frequency).  This data
-// type is modeled off of base::TimeTicks.
-//
-// This data type wraps a value, providing only the meaningful set of math
-// operations that may be performed on the value.  The difference between two
-// RtpTimeTicks is a RtpTimeDelta.  Likewise, adding or subtracting a
-// RtpTimeTicks with a RtpTimeDelta produces an off-set RtpTimeTicks.
-//
-// The base class provides bit truncation/extension features for
-// wire-formatting, and also the comparison operators.
-//
-// Usage example:
-//
-//   // Time math.
-//   RtpTimeTicks origin;
-//   RtpTimeTicks at_one_second =
-//       origin + RtpTimeDelta::FromTicks(kAudioSamplingRate);
-//   RtpTimeTicks at_two_seconds =
-//       at_one_second + RtpTimeDelta::FromTicks(kAudioSamplingRate);
-//   RtpTimeDelta elasped_in_between = at_two_seconds - at_one_second;
-//   RtpTimeDelta thrice_as_much_elasped = elasped_in_between * 3;
-//   RtpTimeTicks at_four_seconds = at_one_second + thrice_as_much_elasped;
-//
-//   // Logging convenience.
-//   DLOG(INFO) << "The RTP timestamp is " << at_four_seconds;
-//
-//   // Convert (approximately!) between RTP timebase and media timestamps in
-//   // microsecond timebase:
-//   base::TimeDelta four_seconds_timestamp =
-//       at_four_seconds.ToTimeDelta(kAudioSamplingRate);
-//   video_frame->set_timestamp(four_seconds_timestamp);
-//   RtpTimeTicks four_seconds_rtp = RtpTimeDelta::FromTimeDelta(
-//       video_frame->timestamp(), kAudioSamplingRate);
-class RtpTimeTicks : public ExpandedValueBase<int64_t, RtpTimeTicks> {
- public:
-  RtpTimeTicks() : ExpandedValueBase(0) {}
-
-  // Compute the difference between two RtpTimeTickses.
-  RtpTimeDelta operator-(RtpTimeTicks rhs) const {
-    return RtpTimeDelta(value_ - rhs.value_);
-  }
-
-  // Return a new RtpTimeTicks before or after this one.
-  RtpTimeTicks operator+(RtpTimeDelta rhs) const {
-    return RtpTimeTicks(value_ + rhs.value());
-  }
-  RtpTimeTicks operator-(RtpTimeDelta rhs) const {
-    return RtpTimeTicks(value_ - rhs.value());
-  }
-  RtpTimeTicks& operator+=(RtpTimeDelta rhs) { return (*this = (*this + rhs)); }
-  RtpTimeTicks& operator-=(RtpTimeDelta rhs) { return (*this = (*this - rhs)); }
-
-  // Maps this RtpTimeTicks to an approximate TimeDelta using the given
-  // RTP timebase.  Assumes a zero-valued TimeDelta corresponds to a zero-valued
-  // RtpTimeTicks.
-  base::TimeDelta ToTimeDelta(int rtp_timebase) const;
-
-  // Maps the TimeDelta to an approximate RtpTimeTicks using the given RTP
-  // timebase.  Assumes a zero-valued TimeDelta corresponds to a zero-valued
-  // RtpTimeTicks.
-  static RtpTimeTicks FromTimeDelta(base::TimeDelta delta, int rtp_timebase);
-
- private:
-  friend class ExpandedValueBase<int64_t, RtpTimeTicks>;
-  friend std::ostream& operator<<(std::ostream& out, const RtpTimeTicks rhs);
-
-  explicit RtpTimeTicks(int64_t value) : ExpandedValueBase(value) {}
-
-  int64_t value() const { return value_; }
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_COMMON_RTP_TIME_H_
diff --git a/src/cobalt/media/cast/common/rtp_time_unittest.cc b/src/cobalt/media/cast/common/rtp_time_unittest.cc
deleted file mode 100644
index 15c36d5..0000000
--- a/src/cobalt/media/cast/common/rtp_time_unittest.cc
+++ /dev/null
@@ -1,74 +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 "media/cast/common/rtp_time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Tests that conversions between base::TimeDelta and RtpTimeDelta are accurate.
-// Note that this implicitly tests the conversions to/from RtpTimeTicks as well
-// due to shared implementation.
-TEST(RtpTimeDeltaTest, ConversionToAndFromTimeDelta) {
-  const int kTimebase = 48000;
-
-  // Origin in both timelines is equivalent.
-  ASSERT_EQ(RtpTimeDelta(), RtpTimeDelta::FromTicks(0));
-  ASSERT_EQ(RtpTimeDelta(),
-            RtpTimeDelta::FromTimeDelta(base::TimeDelta(), kTimebase));
-  ASSERT_EQ(base::TimeDelta(),
-            RtpTimeDelta::FromTicks(0).ToTimeDelta(kTimebase));
-
-  // Conversions that are exact (i.e., do not require rounding).
-  ASSERT_EQ(RtpTimeDelta::FromTicks(480),
-            RtpTimeDelta::FromTimeDelta(base::TimeDelta::FromMilliseconds(10),
-                                        kTimebase));
-  ASSERT_EQ(
-      RtpTimeDelta::FromTicks(96000),
-      RtpTimeDelta::FromTimeDelta(base::TimeDelta::FromSeconds(2), kTimebase));
-  ASSERT_EQ(base::TimeDelta::FromMilliseconds(10),
-            RtpTimeDelta::FromTicks(480).ToTimeDelta(kTimebase));
-  ASSERT_EQ(base::TimeDelta::FromSeconds(2),
-            RtpTimeDelta::FromTicks(96000).ToTimeDelta(kTimebase));
-
-  // Conversions that are approximate (i.e., are rounded).
-  for (int error_us = -3; error_us <= +3; ++error_us) {
-    ASSERT_EQ(RtpTimeDelta::FromTicks(0),
-              RtpTimeDelta::FromTimeDelta(
-                  base::TimeDelta::FromMicroseconds(0 + error_us), kTimebase));
-    ASSERT_EQ(RtpTimeDelta::FromTicks(1),
-              RtpTimeDelta::FromTimeDelta(
-                  base::TimeDelta::FromMicroseconds(21 + error_us), kTimebase));
-    ASSERT_EQ(RtpTimeDelta::FromTicks(2),
-              RtpTimeDelta::FromTimeDelta(
-                  base::TimeDelta::FromMicroseconds(42 + error_us), kTimebase));
-    ASSERT_EQ(RtpTimeDelta::FromTicks(3),
-              RtpTimeDelta::FromTimeDelta(
-                  base::TimeDelta::FromMicroseconds(63 + error_us), kTimebase));
-    ASSERT_EQ(RtpTimeDelta::FromTicks(4),
-              RtpTimeDelta::FromTimeDelta(
-                  base::TimeDelta::FromMicroseconds(83 + error_us), kTimebase));
-    ASSERT_EQ(
-        RtpTimeDelta::FromTicks(11200000000000),
-        RtpTimeDelta::FromTimeDelta(base::TimeDelta::FromMicroseconds(
-                                        INT64_C(233333333333333) + error_us),
-                                    kTimebase));
-  }
-  ASSERT_EQ(base::TimeDelta::FromMicroseconds(21),
-            RtpTimeDelta::FromTicks(1).ToTimeDelta(kTimebase));
-  ASSERT_EQ(base::TimeDelta::FromMicroseconds(42),
-            RtpTimeDelta::FromTicks(2).ToTimeDelta(kTimebase));
-  ASSERT_EQ(base::TimeDelta::FromMicroseconds(63),
-            RtpTimeDelta::FromTicks(3).ToTimeDelta(kTimebase));
-  ASSERT_EQ(base::TimeDelta::FromMicroseconds(83),
-            RtpTimeDelta::FromTicks(4).ToTimeDelta(kTimebase));
-  ASSERT_EQ(base::TimeDelta::FromMicroseconds(INT64_C(233333333333333)),
-            RtpTimeDelta::FromTicks(11200000000000).ToTimeDelta(kTimebase));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/common/transport_encryption_handler.cc b/src/cobalt/media/cast/common/transport_encryption_handler.cc
deleted file mode 100644
index cf058de..0000000
--- a/src/cobalt/media/cast/common/transport_encryption_handler.cc
+++ /dev/null
@@ -1,102 +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.
-
-#include "media/cast/common/transport_encryption_handler.h"
-
-#include "base/logging.h"
-#include "crypto/encryptor.h"
-#include "crypto/symmetric_key.h"
-#include "media/cast/net/cast_transport_defines.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-// Crypto.
-const size_t kAesBlockSize = 16;
-const size_t kAesKeySize = 16;
-
-std::string GetAesNonce(FrameId frame_id, const std::string& iv_mask) {
-  DCHECK(!frame_id.is_null());
-
-  std::string aes_nonce(kAesBlockSize, 0);
-
-  // Serializing frame_id in big-endian order (aes_nonce[8] is the most
-  // significant byte of frame_id).
-  const uint32_t truncated_id = frame_id.lower_32_bits();
-  aes_nonce[11] = truncated_id & 0xff;
-  aes_nonce[10] = (truncated_id >> 8) & 0xff;
-  aes_nonce[9] = (truncated_id >> 16) & 0xff;
-  aes_nonce[8] = (truncated_id >> 24) & 0xff;
-
-  for (size_t i = 0; i < kAesBlockSize; ++i) {
-    aes_nonce[i] ^= iv_mask[i];
-  }
-  return aes_nonce;
-}
-
-}  // namespace
-
-TransportEncryptionHandler::TransportEncryptionHandler()
-    : key_(), encryptor_(), iv_mask_(), is_activated_(false) {}
-
-TransportEncryptionHandler::~TransportEncryptionHandler() {}
-
-bool TransportEncryptionHandler::Initialize(const std::string& aes_key,
-                                            const std::string& aes_iv_mask) {
-  is_activated_ = false;
-  if (aes_iv_mask.size() == kAesKeySize && aes_key.size() == kAesKeySize) {
-    iv_mask_ = aes_iv_mask;
-    key_ = crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, aes_key);
-    encryptor_.reset(new crypto::Encryptor());
-    encryptor_->Init(key_.get(), crypto::Encryptor::CTR, std::string());
-    is_activated_ = true;
-  } else if (aes_iv_mask.size() != 0 || aes_key.size() != 0) {
-    DCHECK_EQ(aes_iv_mask.size(), 0u)
-        << "Invalid Crypto configuration: aes_iv_mask.size";
-    DCHECK_EQ(aes_key.size(), 0u)
-        << "Invalid Crypto configuration: aes_key.size";
-    return false;
-  }
-  return true;
-}
-
-bool TransportEncryptionHandler::Encrypt(FrameId frame_id,
-                                         const base::StringPiece& data,
-                                         std::string* encrypted_data) {
-  if (!is_activated_) return false;
-  if (!encryptor_->SetCounter(GetAesNonce(frame_id, iv_mask_))) {
-    NOTREACHED() << "Failed to set counter";
-    return false;
-  }
-  if (!encryptor_->Encrypt(data, encrypted_data)) {
-    NOTREACHED() << "Encrypt error";
-    return false;
-  }
-  return true;
-}
-
-bool TransportEncryptionHandler::Decrypt(FrameId frame_id,
-                                         const base::StringPiece& ciphertext,
-                                         std::string* plaintext) {
-  if (!is_activated_) {
-    return false;
-  }
-  if (!encryptor_->SetCounter(GetAesNonce(frame_id, iv_mask_))) {
-    NOTREACHED() << "Failed to set counter";
-    return false;
-  }
-  if (!encryptor_->Decrypt(ciphertext, plaintext)) {
-    VLOG(1) << "Decryption error";
-    return false;
-  }
-  return true;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/common/transport_encryption_handler.h b/src/cobalt/media/cast/common/transport_encryption_handler.h
deleted file mode 100644
index 00cc269..0000000
--- a/src/cobalt/media/cast/common/transport_encryption_handler.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
-#define COBALT_MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
-
-// Helper class to handle encryption for the Cast Transport library.
-
-#include <memory>
-#include <string>
-
-#include "base/macros.h"
-#include "base/strings/string_piece.h"
-#include "base/threading/non_thread_safe.h"
-#include "media/cast/common/frame_id.h"
-#include "starboard/types.h"
-
-namespace crypto {
-class Encryptor;
-class SymmetricKey;
-}
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class TransportEncryptionHandler : public base::NonThreadSafe {
- public:
-  TransportEncryptionHandler();
-  ~TransportEncryptionHandler();
-
-  bool Initialize(const std::string& aes_key, const std::string& aes_iv_mask);
-
-  bool Encrypt(FrameId frame_id, const base::StringPiece& data,
-               std::string* encrypted_data);
-
-  bool Decrypt(FrameId frame_id, const base::StringPiece& ciphertext,
-               std::string* plaintext);
-
-  bool is_activated() const { return is_activated_; }
-
- private:
-  std::unique_ptr<crypto::SymmetricKey> key_;
-  std::unique_ptr<crypto::Encryptor> encryptor_;
-  std::string iv_mask_;
-  bool is_activated_;
-
-  DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
diff --git a/src/cobalt/media/cast/constants.h b/src/cobalt/media/cast/constants.h
deleted file mode 100644
index 135640c..0000000
--- a/src/cobalt/media/cast/constants.h
+++ /dev/null
@@ -1,74 +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 COBALT_MEDIA_CAST_CONSTANTS_H_
-#define COBALT_MEDIA_CAST_CONSTANTS_H_
-
-////////////////////////////////////////////////////////////////////////////////
-// NOTE: This file should only contain constants that are reasonably globally
-// used (i.e., by many modules, and in all or nearly all subdirs).  Do NOT add
-// non-POD constants, functions, interfaces, or any logic to this module.
-////////////////////////////////////////////////////////////////////////////////
-
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Integer constants set either by the Cast Streaming Protocol Spec or due to
-// design limitations.
-enum Specifications {
-  // Target number of milliseconds between the sending of RTCP reports.  Both
-  // senders and receivers regularly send RTCP reports to their peer.
-  kRtcpReportIntervalMs = 500,
-
-  // This is an important system-wide constant.  This limits how much history
-  // the implementation must retain in order to process the acknowledgements of
-  // past frames.
-  //
-  // This value is carefully choosen such that it fits in the 8-bits range for
-  // frame IDs. It is also less than half of the full 8-bits range such that
-  // logic can handle wrap around and compare two frame IDs meaningfully.
-  kMaxUnackedFrames = 120,
-
-  // The spec declares RTP timestamps must always have a timebase of 90000 ticks
-  // per second for video.
-  kVideoFrequency = 90000,
-};
-
-// Success/in-progress/failure status codes reported to clients to indicate
-// readiness state.
-enum OperationalStatus {
-  // Client should not send frames yet (sender), or should not expect to receive
-  // frames yet (receiver).
-  STATUS_UNINITIALIZED,
-
-  // Client may now send or receive frames.
-  STATUS_INITIALIZED,
-
-  // Codec is being re-initialized.  Client may continue sending frames, but
-  // some may be ignored/dropped until a transition back to STATUS_INITIALIZED.
-  STATUS_CODEC_REINIT_PENDING,
-
-  // Session has halted due to invalid configuration.
-  STATUS_INVALID_CONFIGURATION,
-
-  // Session has halted due to an unsupported codec.
-  STATUS_UNSUPPORTED_CODEC,
-
-  // Session has halted due to a codec initialization failure.  Note that this
-  // can be reported after STATUS_INITIALIZED/STATUS_CODEC_REINIT_PENDING if the
-  // codec was re-initialized during the session.
-  STATUS_CODEC_INIT_FAILED,
-
-  // Session has halted due to a codec runtime failure.
-  STATUS_CODEC_RUNTIME_ERROR,
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_CONSTANTS_H_
diff --git a/src/cobalt/media/cast/receiver/audio_decoder.cc b/src/cobalt/media/cast/receiver/audio_decoder.cc
deleted file mode 100644
index 3e805d1..0000000
--- a/src/cobalt/media/cast/receiver/audio_decoder.cc
+++ /dev/null
@@ -1,230 +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.
-
-#include "media/cast/receiver/audio_decoder.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/sys_byteorder.h"
-#include "build/build_config.h"
-#include "starboard/types.h"
-#include "third_party/opus/src/include/opus.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Base class that handles the common problem of detecting dropped frames, and
-// then invoking the Decode() method implemented by the subclasses to convert
-// the encoded payload data into usable audio data.
-class AudioDecoder::ImplBase
-    : public base::RefCountedThreadSafe<AudioDecoder::ImplBase> {
- public:
-  ImplBase(const scoped_refptr<CastEnvironment>& cast_environment, Codec codec,
-           int num_channels, int sampling_rate)
-      : cast_environment_(cast_environment),
-        codec_(codec),
-        num_channels_(num_channels),
-        operational_status_(STATUS_UNINITIALIZED) {
-    if (num_channels_ <= 0 || sampling_rate <= 0 || sampling_rate % 100 != 0)
-      operational_status_ = STATUS_INVALID_CONFIGURATION;
-  }
-
-  OperationalStatus InitializationResult() const { return operational_status_; }
-
-  void DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
-                   const DecodeFrameCallback& callback) {
-    DCHECK_EQ(operational_status_, STATUS_INITIALIZED);
-
-    bool is_continuous = true;
-    DCHECK(!encoded_frame->frame_id.is_null());
-    if (!last_frame_id_.is_null()) {
-      if (encoded_frame->frame_id > (last_frame_id_ + 1)) {
-        RecoverBecauseFramesWereDropped();
-        is_continuous = false;
-      }
-    }
-    last_frame_id_ = encoded_frame->frame_id;
-
-    std::unique_ptr<AudioBus> decoded_audio =
-        Decode(encoded_frame->mutable_bytes(),
-               static_cast<int>(encoded_frame->data.size()));
-
-    std::unique_ptr<FrameEvent> event(new FrameEvent());
-    event->timestamp = cast_environment_->Clock()->NowTicks();
-    event->type = FRAME_DECODED;
-    event->media_type = AUDIO_EVENT;
-    event->rtp_timestamp = encoded_frame->rtp_timestamp;
-    event->frame_id = encoded_frame->frame_id;
-    cast_environment_->logger()->DispatchFrameEvent(std::move(event));
-
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(callback, base::Passed(&decoded_audio), is_continuous));
-  }
-
- protected:
-  friend class base::RefCountedThreadSafe<ImplBase>;
-  virtual ~ImplBase() {}
-
-  virtual void RecoverBecauseFramesWereDropped() {}
-
-  // Note: Implementation of Decode() is allowed to mutate |data|.
-  virtual std::unique_ptr<AudioBus> Decode(uint8_t* data, int len) = 0;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const Codec codec_;
-  const int num_channels_;
-
-  // Subclass' ctor is expected to set this to STATUS_INITIALIZED.
-  OperationalStatus operational_status_;
-
- private:
-  FrameId last_frame_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(ImplBase);
-};
-
-class AudioDecoder::OpusImpl : public AudioDecoder::ImplBase {
- public:
-  OpusImpl(const scoped_refptr<CastEnvironment>& cast_environment,
-           int num_channels, int sampling_rate)
-      : ImplBase(cast_environment, CODEC_AUDIO_OPUS, num_channels,
-                 sampling_rate),
-        decoder_memory_(new uint8_t[opus_decoder_get_size(num_channels)]),
-        opus_decoder_(reinterpret_cast<OpusDecoder*>(decoder_memory_.get())),
-        max_samples_per_frame_(kOpusMaxFrameDurationMillis * sampling_rate /
-                               1000),
-        buffer_(new float[max_samples_per_frame_ * num_channels]) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) return;
-    if (opus_decoder_init(opus_decoder_, sampling_rate, num_channels) !=
-        OPUS_OK) {
-      ImplBase::operational_status_ = STATUS_INVALID_CONFIGURATION;
-      return;
-    }
-    ImplBase::operational_status_ = STATUS_INITIALIZED;
-  }
-
- private:
-  ~OpusImpl() final {}
-
-  void RecoverBecauseFramesWereDropped() final {
-    // Passing NULL for the input data notifies the decoder of frame loss.
-    const opus_int32 result = opus_decode_float(
-        opus_decoder_, NULL, 0, buffer_.get(), max_samples_per_frame_, 0);
-    DCHECK_GE(result, 0);
-  }
-
-  std::unique_ptr<AudioBus> Decode(uint8_t* data, int len) final {
-    std::unique_ptr<AudioBus> audio_bus;
-    const opus_int32 num_samples_decoded = opus_decode_float(
-        opus_decoder_, data, len, buffer_.get(), max_samples_per_frame_, 0);
-    if (num_samples_decoded <= 0) return audio_bus;  // Decode error.
-
-    // Copy interleaved samples from |buffer_| into a new AudioBus (where
-    // samples are stored in planar format, for each channel).
-    audio_bus = AudioBus::Create(num_channels_, num_samples_decoded);
-    // TODO(miu): This should be moved into AudioBus::FromInterleaved().
-    for (int ch = 0; ch < num_channels_; ++ch) {
-      const float* src = buffer_.get() + ch;
-      const float* const src_end = src + num_samples_decoded * num_channels_;
-      float* dest = audio_bus->channel(ch);
-      for (; src < src_end; src += num_channels_, ++dest) *dest = *src;
-    }
-    return audio_bus;
-  }
-
-  const std::unique_ptr<uint8_t[]> decoder_memory_;
-  OpusDecoder* const opus_decoder_;
-  const int max_samples_per_frame_;
-  const std::unique_ptr<float[]> buffer_;
-
-  // According to documentation in third_party/opus/src/include/opus.h, we must
-  // provide enough space in |buffer_| to contain 120ms of samples.  At 48 kHz,
-  // then, that means 5760 samples times the number of channels.
-  static const int kOpusMaxFrameDurationMillis = 120;
-
-  DISALLOW_COPY_AND_ASSIGN(OpusImpl);
-};
-
-class AudioDecoder::Pcm16Impl : public AudioDecoder::ImplBase {
- public:
-  Pcm16Impl(const scoped_refptr<CastEnvironment>& cast_environment,
-            int num_channels, int sampling_rate)
-      : ImplBase(cast_environment, CODEC_AUDIO_PCM16, num_channels,
-                 sampling_rate) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) return;
-    ImplBase::operational_status_ = STATUS_INITIALIZED;
-  }
-
- private:
-  ~Pcm16Impl() final {}
-
-  std::unique_ptr<AudioBus> Decode(uint8_t* data, int len) final {
-    std::unique_ptr<AudioBus> audio_bus;
-    const int num_samples = len / sizeof(int16_t) / num_channels_;
-    if (num_samples <= 0) return audio_bus;
-
-    int16_t* const pcm_data = reinterpret_cast<int16_t*>(data);
-#if defined(ARCH_CPU_LITTLE_ENDIAN)
-    // Convert endianness.
-    const int num_elements = num_samples * num_channels_;
-    for (int i = 0; i < num_elements; ++i)
-      pcm_data[i] = static_cast<int16_t>(base::NetToHost16(pcm_data[i]));
-#endif
-    audio_bus = AudioBus::Create(num_channels_, num_samples);
-    audio_bus->FromInterleaved(pcm_data, num_samples, sizeof(int16_t));
-    return audio_bus;
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(Pcm16Impl);
-};
-
-AudioDecoder::AudioDecoder(
-    const scoped_refptr<CastEnvironment>& cast_environment, int channels,
-    int sampling_rate, Codec codec)
-    : cast_environment_(cast_environment) {
-  switch (codec) {
-    case CODEC_AUDIO_OPUS:
-      impl_ = new OpusImpl(cast_environment, channels, sampling_rate);
-      break;
-    case CODEC_AUDIO_PCM16:
-      impl_ = new Pcm16Impl(cast_environment, channels, sampling_rate);
-      break;
-    default:
-      NOTREACHED() << "Unknown or unspecified codec.";
-      break;
-  }
-}
-
-AudioDecoder::~AudioDecoder() {}
-
-OperationalStatus AudioDecoder::InitializationResult() const {
-  if (impl_.get()) return impl_->InitializationResult();
-  return STATUS_UNSUPPORTED_CODEC;
-}
-
-void AudioDecoder::DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
-                               const DecodeFrameCallback& callback) {
-  DCHECK(encoded_frame.get());
-  DCHECK(!callback.is_null());
-  if (!impl_.get() || impl_->InitializationResult() != STATUS_INITIALIZED) {
-    callback.Run(base::WrapUnique<AudioBus>(NULL), false);
-    return;
-  }
-  cast_environment_->PostTask(
-      CastEnvironment::AUDIO, FROM_HERE,
-      base::Bind(&AudioDecoder::ImplBase::DecodeFrame, impl_,
-                 base::Passed(&encoded_frame), callback));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/receiver/audio_decoder.h b/src/cobalt/media/cast/receiver/audio_decoder.h
deleted file mode 100644
index 4733900..0000000
--- a/src/cobalt/media/cast/receiver/audio_decoder.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_
-#define COBALT_MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/net/cast_transport_config.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class AudioDecoder {
- public:
-  // Callback passed to DecodeFrame, to deliver decoded audio data from the
-  // decoder.  The number of samples in |audio_bus| may vary, and |audio_bus|
-  // can be NULL when errors occur.  |is_continuous| is normally true, but will
-  // be false if the decoder has detected a frame skip since the last decode
-  // operation; and the client should take steps to smooth audio discontinuities
-  // in this case.
-  typedef base::Callback<void(std::unique_ptr<AudioBus> audio_bus,
-                              bool is_continuous)> DecodeFrameCallback;
-
-  AudioDecoder(const scoped_refptr<CastEnvironment>& cast_environment,
-               int channels, int sampling_rate, Codec codec);
-  virtual ~AudioDecoder();
-
-  // Returns STATUS_INITIALIZED if the decoder was successfully constructed.  If
-  // this method returns any other value, calls to DecodeFrame() will not
-  // succeed.
-  OperationalStatus InitializationResult() const;
-
-  // Decode the payload in |encoded_frame| asynchronously.  |callback| will be
-  // invoked on the CastEnvironment::MAIN thread with the result.
-  //
-  // In the normal case, |encoded_frame->frame_id| will be
-  // monotonically-increasing by 1 for each successive call to this method.
-  // When it is not, the decoder will assume one or more frames have been
-  // dropped (e.g., due to packet loss), and will perform recovery actions.
-  void DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
-                   const DecodeFrameCallback& callback);
-
- private:
-  class ImplBase;
-  class OpusImpl;
-  class Pcm16Impl;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  scoped_refptr<ImplBase> impl_;
-
-  DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_RECEIVER_AUDIO_DECODER_H_
diff --git a/src/cobalt/media/cast/receiver/audio_decoder_unittest.cc b/src/cobalt/media/cast/receiver/audio_decoder_unittest.cc
deleted file mode 100644
index 7095b22..0000000
--- a/src/cobalt/media/cast/receiver/audio_decoder_unittest.cc
+++ /dev/null
@@ -1,235 +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.
-
-#include <vector>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/macros.h"
-#include "base/synchronization/condition_variable.h"
-#include "base/synchronization/lock.h"
-#include "base/sys_byteorder.h"
-#include "base/time/time.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/receiver/audio_decoder.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "media/cast/test/utility/standalone_cast_environment.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/opus/src/include/opus.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-struct TestScenario {
-  Codec codec;
-  int num_channels;
-  int sampling_rate;
-
-  TestScenario(Codec c, int n, int s)
-      : codec(c), num_channels(n), sampling_rate(s) {}
-};
-}  // namespace
-
-class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> {
- public:
-  AudioDecoderTest()
-      : cast_environment_(new StandaloneCastEnvironment()), cond_(&lock_) {}
-
-  virtual ~AudioDecoderTest() {
-    // Make sure all threads have stopped before the environment goes away.
-    cast_environment_->Shutdown();
-  }
-
- protected:
-  void SetUp() final {
-    audio_decoder_.reset(
-        new AudioDecoder(cast_environment_, GetParam().num_channels,
-                         GetParam().sampling_rate, GetParam().codec));
-    CHECK_EQ(STATUS_INITIALIZED, audio_decoder_->InitializationResult());
-
-    audio_bus_factory_.reset(new TestAudioBusFactory(
-        GetParam().num_channels, GetParam().sampling_rate,
-        TestAudioBusFactory::kMiddleANoteFreq, 0.5f));
-    last_frame_id_ = FrameId::first();
-    seen_a_decoded_frame_ = false;
-
-    if (GetParam().codec == CODEC_AUDIO_OPUS) {
-      opus_encoder_memory_.reset(
-          new uint8_t[opus_encoder_get_size(GetParam().num_channels)]);
-      OpusEncoder* const opus_encoder =
-          reinterpret_cast<OpusEncoder*>(opus_encoder_memory_.get());
-      CHECK_EQ(OPUS_OK, opus_encoder_init(
-                            opus_encoder, GetParam().sampling_rate,
-                            GetParam().num_channels, OPUS_APPLICATION_AUDIO));
-      CHECK_EQ(OPUS_OK,
-               opus_encoder_ctl(opus_encoder, OPUS_SET_BITRATE(OPUS_AUTO)));
-    }
-
-    total_audio_feed_in_ = base::TimeDelta();
-    total_audio_decoded_ = base::TimeDelta();
-  }
-
-  // Called from the unit test thread to create another EncodedFrame and push it
-  // into the decoding pipeline.
-  void FeedMoreAudio(const base::TimeDelta& duration, int num_dropped_frames) {
-    // Prepare a simulated EncodedFrame to feed into the AudioDecoder.
-    std::unique_ptr<EncodedFrame> encoded_frame(new EncodedFrame());
-    encoded_frame->dependency = EncodedFrame::KEY;
-    encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames;
-    encoded_frame->referenced_frame_id = encoded_frame->frame_id;
-    last_frame_id_ = encoded_frame->frame_id;
-
-    const std::unique_ptr<AudioBus> audio_bus(
-        audio_bus_factory_->NextAudioBus(duration));
-
-    // Encode |audio_bus| into |encoded_frame->data|.
-    const int num_elements = audio_bus->channels() * audio_bus->frames();
-    std::vector<int16_t> interleaved(num_elements);
-    audio_bus->ToInterleaved(audio_bus->frames(), sizeof(int16_t),
-                             &interleaved.front());
-    if (GetParam().codec == CODEC_AUDIO_PCM16) {
-      encoded_frame->data.resize(num_elements * sizeof(int16_t));
-      int16_t* const pcm_data =
-          reinterpret_cast<int16_t*>(encoded_frame->mutable_bytes());
-      for (size_t i = 0; i < interleaved.size(); ++i)
-        pcm_data[i] = static_cast<int16_t>(base::HostToNet16(interleaved[i]));
-    } else if (GetParam().codec == CODEC_AUDIO_OPUS) {
-      OpusEncoder* const opus_encoder =
-          reinterpret_cast<OpusEncoder*>(opus_encoder_memory_.get());
-      const int kOpusEncodeBufferSize = 4000;
-      encoded_frame->data.resize(kOpusEncodeBufferSize);
-      const int payload_size = opus_encode(
-          opus_encoder, &interleaved.front(), audio_bus->frames(),
-          encoded_frame->mutable_bytes(), encoded_frame->data.size());
-      CHECK_GT(payload_size, 1);
-      encoded_frame->data.resize(payload_size);
-    } else {
-      ASSERT_TRUE(false);  // Not reached.
-    }
-
-    {
-      base::AutoLock auto_lock(lock_);
-      total_audio_feed_in_ += duration;
-    }
-
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(
-            &AudioDecoder::DecodeFrame, base::Unretained(audio_decoder_.get()),
-            base::Passed(&encoded_frame),
-            base::Bind(&AudioDecoderTest::OnDecodedFrame,
-                       base::Unretained(this), num_dropped_frames == 0)));
-  }
-
-  // Blocks the caller until all audio that has been feed in has been decoded.
-  void WaitForAllAudioToBeDecoded() {
-    DCHECK(!cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-    base::AutoLock auto_lock(lock_);
-    while (total_audio_decoded_ < total_audio_feed_in_) cond_.Wait();
-    EXPECT_EQ(total_audio_feed_in_.InMicroseconds(),
-              total_audio_decoded_.InMicroseconds());
-  }
-
- private:
-  // Called by |audio_decoder_| to deliver each frame of decoded audio.
-  void OnDecodedFrame(bool should_be_continuous,
-                      std::unique_ptr<AudioBus> audio_bus, bool is_continuous) {
-    DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-    // A NULL |audio_bus| indicates a decode error, which we don't expect.
-    ASSERT_TRUE(audio_bus);
-
-    // Did the decoder detect whether frames were dropped?
-    EXPECT_EQ(should_be_continuous, is_continuous);
-
-    // Does the audio data seem to be intact?  For Opus, we have to ignore the
-    // first frame seen at the start (and immediately after dropped packet
-    // recovery) because it introduces a tiny, significant delay.
-    bool examine_signal = true;
-    if (GetParam().codec == CODEC_AUDIO_OPUS) {
-      examine_signal = seen_a_decoded_frame_ && should_be_continuous;
-      seen_a_decoded_frame_ = true;
-    }
-    if (examine_signal) {
-      for (int ch = 0; ch < audio_bus->channels(); ++ch) {
-        EXPECT_NEAR(
-            TestAudioBusFactory::kMiddleANoteFreq * 2 * audio_bus->frames() /
-                GetParam().sampling_rate,
-            CountZeroCrossings(audio_bus->channel(ch), audio_bus->frames()), 1);
-      }
-    }
-
-    // Signal the main test thread that more audio was decoded.
-    base::AutoLock auto_lock(lock_);
-    total_audio_decoded_ += base::TimeDelta::FromSeconds(1) *
-                            audio_bus->frames() / GetParam().sampling_rate;
-    cond_.Signal();
-  }
-
-  const scoped_refptr<StandaloneCastEnvironment> cast_environment_;
-  std::unique_ptr<AudioDecoder> audio_decoder_;
-  std::unique_ptr<TestAudioBusFactory> audio_bus_factory_;
-  FrameId last_frame_id_;
-  bool seen_a_decoded_frame_;
-  std::unique_ptr<uint8_t[]> opus_encoder_memory_;
-
-  base::Lock lock_;
-  base::ConditionVariable cond_;
-  base::TimeDelta total_audio_feed_in_;
-  base::TimeDelta total_audio_decoded_;
-
-  DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest);
-};
-
-TEST_P(AudioDecoderTest, DecodesFramesWithSameDuration) {
-  const base::TimeDelta kTenMilliseconds =
-      base::TimeDelta::FromMilliseconds(10);
-  const int kNumFrames = 10;
-  for (int i = 0; i < kNumFrames; ++i) FeedMoreAudio(kTenMilliseconds, 0);
-  WaitForAllAudioToBeDecoded();
-}
-
-TEST_P(AudioDecoderTest, DecodesFramesWithVaryingDuration) {
-  // These are the set of frame durations supported by the Opus encoder.
-  const int kFrameDurationMs[] = {5, 10, 20, 40, 60};
-
-  const int kNumFrames = 10;
-  for (size_t i = 0; i < arraysize(kFrameDurationMs); ++i)
-    for (int j = 0; j < kNumFrames; ++j)
-      FeedMoreAudio(base::TimeDelta::FromMilliseconds(kFrameDurationMs[i]), 0);
-  WaitForAllAudioToBeDecoded();
-}
-
-TEST_P(AudioDecoderTest, RecoversFromDroppedFrames) {
-  const base::TimeDelta kTenMilliseconds =
-      base::TimeDelta::FromMilliseconds(10);
-  const int kNumFrames = 100;
-  int next_drop_at = 3;
-  int next_num_dropped = 1;
-  for (int i = 0; i < kNumFrames; ++i) {
-    if (i == next_drop_at) {
-      const int num_dropped = next_num_dropped++;
-      next_drop_at *= 2;
-      i += num_dropped;
-      FeedMoreAudio(kTenMilliseconds, num_dropped);
-    } else {
-      FeedMoreAudio(kTenMilliseconds, 0);
-    }
-  }
-  WaitForAllAudioToBeDecoded();
-}
-
-INSTANTIATE_TEST_CASE_P(
-    AudioDecoderTestScenarios, AudioDecoderTest,
-    ::testing::Values(TestScenario(CODEC_AUDIO_PCM16, 1, 8000),
-                      TestScenario(CODEC_AUDIO_PCM16, 2, 48000),
-                      TestScenario(CODEC_AUDIO_OPUS, 1, 8000),
-                      TestScenario(CODEC_AUDIO_OPUS, 2, 48000)));
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/receiver/cast_receiver_impl.cc b/src/cobalt/media/cast/receiver/cast_receiver_impl.cc
deleted file mode 100644
index 62b0c66..0000000
--- a/src/cobalt/media/cast/receiver/cast_receiver_impl.cc
+++ /dev/null
@@ -1,216 +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.
-
-#include "media/cast/receiver/cast_receiver_impl.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback.h"
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-#include "base/message_loop/message_loop.h"
-#include "base/trace_event/trace_event.h"
-#include "media/cast/net/rtcp/rtcp_utility.h"
-#include "media/cast/receiver/audio_decoder.h"
-#include "media/cast/receiver/video_decoder.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-std::unique_ptr<CastReceiver> CastReceiver::Create(
-    scoped_refptr<CastEnvironment> cast_environment,
-    const FrameReceiverConfig& audio_config,
-    const FrameReceiverConfig& video_config, CastTransport* const transport) {
-  return std::unique_ptr<CastReceiver>(new CastReceiverImpl(
-      cast_environment, audio_config, video_config, transport));
-}
-
-CastReceiverImpl::CastReceiverImpl(
-    scoped_refptr<CastEnvironment> cast_environment,
-    const FrameReceiverConfig& audio_config,
-    const FrameReceiverConfig& video_config, CastTransport* const transport)
-    : cast_environment_(cast_environment),
-      audio_receiver_(cast_environment, audio_config, AUDIO_EVENT, transport),
-      video_receiver_(cast_environment, video_config, VIDEO_EVENT, transport),
-      ssrc_of_audio_sender_(audio_config.sender_ssrc),
-      ssrc_of_video_sender_(video_config.sender_ssrc),
-      num_audio_channels_(audio_config.channels),
-      audio_sampling_rate_(audio_config.rtp_timebase),
-      audio_codec_(audio_config.codec),
-      video_codec_(video_config.codec) {}
-
-CastReceiverImpl::~CastReceiverImpl() {}
-
-void CastReceiverImpl::ReceivePacket(std::unique_ptr<Packet> packet) {
-  const uint8_t* const data = &packet->front();
-  const size_t length = packet->size();
-
-  uint32_t ssrc_of_sender;
-  if (IsRtcpPacket(data, length)) {
-    ssrc_of_sender = GetSsrcOfSender(data, length);
-  } else if (!RtpParser::ParseSsrc(data, length, &ssrc_of_sender)) {
-    VLOG(1) << "Invalid RTP packet.";
-    return;
-  }
-
-  base::WeakPtr<FrameReceiver> target;
-  if (ssrc_of_sender == ssrc_of_video_sender_) {
-    target = video_receiver_.AsWeakPtr();
-  } else if (ssrc_of_sender == ssrc_of_audio_sender_) {
-    target = audio_receiver_.AsWeakPtr();
-  } else {
-    VLOG(1) << "Dropping packet with a non matching sender SSRC: "
-            << ssrc_of_sender;
-    return;
-  }
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(base::IgnoreResult(&FrameReceiver::ProcessPacket), target,
-                 base::Passed(&packet)));
-}
-
-void CastReceiverImpl::RequestDecodedAudioFrame(
-    const AudioFrameDecodedCallback& callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!callback.is_null());
-  audio_receiver_.RequestEncodedFrame(base::Bind(
-      &CastReceiverImpl::DecodeEncodedAudioFrame,
-      // Note: Use of Unretained is safe since this Closure is guaranteed to be
-      // invoked or discarded by |audio_receiver_| before destruction of |this|.
-      base::Unretained(this), callback));
-}
-
-void CastReceiverImpl::RequestEncodedAudioFrame(
-    const ReceiveEncodedFrameCallback& callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  audio_receiver_.RequestEncodedFrame(callback);
-}
-
-void CastReceiverImpl::RequestDecodedVideoFrame(
-    const VideoFrameDecodedCallback& callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!callback.is_null());
-  video_receiver_.RequestEncodedFrame(base::Bind(
-      &CastReceiverImpl::DecodeEncodedVideoFrame,
-      // Note: Use of Unretained is safe since this Closure is guaranteed to be
-      // invoked or discarded by |video_receiver_| before destruction of |this|.
-      base::Unretained(this), callback));
-}
-
-void CastReceiverImpl::RequestEncodedVideoFrame(
-    const ReceiveEncodedFrameCallback& callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  video_receiver_.RequestEncodedFrame(callback);
-}
-
-void CastReceiverImpl::DecodeEncodedAudioFrame(
-    const AudioFrameDecodedCallback& callback,
-    std::unique_ptr<EncodedFrame> encoded_frame) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (!encoded_frame) {
-    callback.Run(base::WrapUnique<AudioBus>(NULL), base::TimeTicks(), false);
-    return;
-  }
-
-  if (!audio_decoder_) {
-    audio_decoder_.reset(new AudioDecoder(cast_environment_,
-                                          num_audio_channels_,
-                                          audio_sampling_rate_, audio_codec_));
-  }
-  const FrameId frame_id = encoded_frame->frame_id;
-  const RtpTimeTicks rtp_timestamp = encoded_frame->rtp_timestamp;
-  const base::TimeTicks playout_time = encoded_frame->reference_time;
-  audio_decoder_->DecodeFrame(
-      std::move(encoded_frame),
-      base::Bind(&CastReceiverImpl::EmitDecodedAudioFrame, cast_environment_,
-                 callback, frame_id, rtp_timestamp, playout_time));
-}
-
-void CastReceiverImpl::DecodeEncodedVideoFrame(
-    const VideoFrameDecodedCallback& callback,
-    std::unique_ptr<EncodedFrame> encoded_frame) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (!encoded_frame) {
-    callback.Run(make_scoped_refptr<VideoFrame>(NULL), base::TimeTicks(),
-                 false);
-    return;
-  }
-
-  // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
-  TRACE_EVENT_INSTANT2(
-      "cast_perf_test", "PullEncodedVideoFrame", TRACE_EVENT_SCOPE_THREAD,
-      "rtp_timestamp", encoded_frame->rtp_timestamp.lower_32_bits(),
-      "render_time", encoded_frame->reference_time.ToInternalValue());
-
-  if (!video_decoder_)
-    video_decoder_.reset(new VideoDecoder(cast_environment_, video_codec_));
-  const FrameId frame_id = encoded_frame->frame_id;
-  const RtpTimeTicks rtp_timestamp = encoded_frame->rtp_timestamp;
-  const base::TimeTicks playout_time = encoded_frame->reference_time;
-  video_decoder_->DecodeFrame(
-      std::move(encoded_frame),
-      base::Bind(&CastReceiverImpl::EmitDecodedVideoFrame, cast_environment_,
-                 callback, frame_id, rtp_timestamp, playout_time));
-}
-
-// static
-void CastReceiverImpl::EmitDecodedAudioFrame(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const AudioFrameDecodedCallback& callback, FrameId frame_id,
-    RtpTimeTicks rtp_timestamp, const base::TimeTicks& playout_time,
-    std::unique_ptr<AudioBus> audio_bus, bool is_continuous) {
-  DCHECK(cast_environment->CurrentlyOn(CastEnvironment::MAIN));
-
-  if (audio_bus.get()) {
-    // TODO(miu): This is reporting incorrect timestamp and delay.
-    // http://crbug.com/547251
-    std::unique_ptr<FrameEvent> playout_event(new FrameEvent());
-    playout_event->timestamp = cast_environment->Clock()->NowTicks();
-    playout_event->type = FRAME_PLAYOUT;
-    playout_event->media_type = AUDIO_EVENT;
-    playout_event->rtp_timestamp = rtp_timestamp;
-    playout_event->frame_id = frame_id;
-    playout_event->delay_delta = playout_time - playout_event->timestamp;
-    cast_environment->logger()->DispatchFrameEvent(std::move(playout_event));
-  }
-
-  callback.Run(std::move(audio_bus), playout_time, is_continuous);
-}
-
-// static
-void CastReceiverImpl::EmitDecodedVideoFrame(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const VideoFrameDecodedCallback& callback, FrameId frame_id,
-    RtpTimeTicks rtp_timestamp, const base::TimeTicks& playout_time,
-    const scoped_refptr<VideoFrame>& video_frame, bool is_continuous) {
-  DCHECK(cast_environment->CurrentlyOn(CastEnvironment::MAIN));
-
-  if (video_frame.get()) {
-    // TODO(miu): This is reporting incorrect timestamp and delay.
-    // http://crbug.com/547251
-    std::unique_ptr<FrameEvent> playout_event(new FrameEvent());
-    playout_event->timestamp = cast_environment->Clock()->NowTicks();
-    playout_event->type = FRAME_PLAYOUT;
-    playout_event->media_type = VIDEO_EVENT;
-    playout_event->rtp_timestamp = rtp_timestamp;
-    playout_event->frame_id = frame_id;
-    playout_event->delay_delta = playout_time - playout_event->timestamp;
-    cast_environment->logger()->DispatchFrameEvent(std::move(playout_event));
-
-    // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
-    TRACE_EVENT_INSTANT1("cast_perf_test", "FrameDecoded",
-                         TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
-                         rtp_timestamp.lower_32_bits());
-  }
-
-  callback.Run(video_frame, playout_time, is_continuous);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/receiver/cast_receiver_impl.h b/src/cobalt/media/cast/receiver/cast_receiver_impl.h
deleted file mode 100644
index dc11b01..0000000
--- a/src/cobalt/media/cast/receiver/cast_receiver_impl.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_
-#define COBALT_MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/net/pacing/paced_sender.h"
-#include "media/cast/receiver/frame_receiver.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class AudioDecoder;
-class VideoDecoder;
-
-// This is a pure owner class that groups all required receiver-related objects
-// together, such as the paced packet sender, audio/video RTP frame receivers,
-// and software decoders (created on-demand).
-class CastReceiverImpl : public CastReceiver {
- public:
-  CastReceiverImpl(scoped_refptr<CastEnvironment> cast_environment,
-                   const FrameReceiverConfig& audio_config,
-                   const FrameReceiverConfig& video_config,
-                   CastTransport* const transport);
-
-  ~CastReceiverImpl() final;
-
-  // CastReceiver implementation.
-  void ReceivePacket(std::unique_ptr<Packet> packet) final;
-  void RequestDecodedAudioFrame(
-      const AudioFrameDecodedCallback& callback) final;
-  void RequestEncodedAudioFrame(
-      const ReceiveEncodedFrameCallback& callback) final;
-  void RequestDecodedVideoFrame(
-      const VideoFrameDecodedCallback& callback) final;
-  void RequestEncodedVideoFrame(
-      const ReceiveEncodedFrameCallback& callback) final;
-
- private:
-  // Feeds an EncodedFrame into |audio_decoder_|.  RequestDecodedAudioFrame()
-  // uses this as a callback for RequestEncodedAudioFrame().
-  void DecodeEncodedAudioFrame(const AudioFrameDecodedCallback& callback,
-                               std::unique_ptr<EncodedFrame> encoded_frame);
-
-  // Feeds an EncodedFrame into |video_decoder_|.  RequestDecodedVideoFrame()
-  // uses this as a callback for RequestEncodedVideoFrame().
-  void DecodeEncodedVideoFrame(const VideoFrameDecodedCallback& callback,
-                               std::unique_ptr<EncodedFrame> encoded_frame);
-
-  // Receives an AudioBus from |audio_decoder_|, logs the event, and passes the
-  // data on by running the given |callback|.  This method is static to ensure
-  // it can be called after a CastReceiverImpl instance is destroyed.
-  // DecodeEncodedAudioFrame() uses this as a callback for
-  // AudioDecoder::DecodeFrame().
-  static void EmitDecodedAudioFrame(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const AudioFrameDecodedCallback& callback, FrameId frame_id,
-      RtpTimeTicks rtp_timestamp, const base::TimeTicks& playout_time,
-      std::unique_ptr<AudioBus> audio_bus, bool is_continuous);
-
-  // Receives a VideoFrame from |video_decoder_|, logs the event, and passes the
-  // data on by running the given |callback|.  This method is static to ensure
-  // it can be called after a CastReceiverImpl instance is destroyed.
-  // DecodeEncodedVideoFrame() uses this as a callback for
-  // VideoDecoder::DecodeFrame().
-  static void EmitDecodedVideoFrame(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const VideoFrameDecodedCallback& callback, FrameId frame_id,
-      RtpTimeTicks rtp_timestamp, const base::TimeTicks& playout_time,
-      const scoped_refptr<VideoFrame>& video_frame, bool is_continuous);
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  FrameReceiver audio_receiver_;
-  FrameReceiver video_receiver_;
-
-  // Used by DispatchReceivedPacket() to direct packets to the appropriate frame
-  // receiver.
-  const uint32_t ssrc_of_audio_sender_;
-  const uint32_t ssrc_of_video_sender_;
-
-  // Parameters for the decoders that are created on-demand.  The values here
-  // might be nonsense if the client of CastReceiverImpl never intends to use
-  // the internal software-based decoders.
-  const int num_audio_channels_;
-  const int audio_sampling_rate_;
-  const Codec audio_codec_;
-  const Codec video_codec_;
-
-  // Created on-demand to decode frames from |audio_receiver_| into AudioBuses
-  // for playback.
-  std::unique_ptr<AudioDecoder> audio_decoder_;
-
-  // Created on-demand to decode frames from |video_receiver_| into VideoFrame
-  // images for playback.
-  std::unique_ptr<VideoDecoder> video_decoder_;
-
-  DISALLOW_COPY_AND_ASSIGN(CastReceiverImpl);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_RECEIVER_CAST_RECEIVER_IMPL_H_
diff --git a/src/cobalt/media/cast/receiver/frame_receiver.cc b/src/cobalt/media/cast/receiver/frame_receiver.cc
deleted file mode 100644
index 75ceb89..0000000
--- a/src/cobalt/media/cast/receiver/frame_receiver.cc
+++ /dev/null
@@ -1,386 +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.
-
-#include "media/cast/receiver/frame_receiver.h"
-
-#include <algorithm>
-#include <string>
-
-#include "base/big_endian.h"
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "base/numerics/safe_conversions.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/net/rtcp/rtcp_utility.h"
-
-namespace {
-
-const int kMinSchedulingDelayMs = 1;
-
-media::cast::RtcpTimeData CreateRtcpTimeData(base::TimeTicks now) {
-  media::cast::RtcpTimeData ret;
-  ret.timestamp = now;
-  media::cast::ConvertTimeTicksToNtp(now, &ret.ntp_seconds, &ret.ntp_fraction);
-  return ret;
-}
-
-}  // namespace
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-FrameReceiver::FrameReceiver(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const FrameReceiverConfig& config, EventMediaType event_media_type,
-    CastTransport* const transport)
-    : cast_environment_(cast_environment),
-      transport_(transport),
-      packet_parser_(
-          config.sender_ssrc,
-          config.rtp_payload_type <= RtpPayloadType::AUDIO_LAST ? 127 : 96),
-      stats_(cast_environment->Clock()),
-      event_media_type_(event_media_type),
-      event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type),
-      rtp_timebase_(config.rtp_timebase),
-      target_playout_delay_(
-          base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)),
-      expected_frame_duration_(
-          base::TimeDelta::FromSecondsD(1.0 / config.target_frame_rate)),
-      reports_are_scheduled_(false),
-      framer_(cast_environment->Clock(), this, config.sender_ssrc, true,
-              static_cast<int>(config.rtp_max_delay_ms *
-                               config.target_frame_rate / 1000)),
-      rtcp_(cast_environment_->Clock(), config.receiver_ssrc,
-            config.sender_ssrc),
-      is_waiting_for_consecutive_frame_(false),
-      lip_sync_drift_(ClockDriftSmoother::GetDefaultTimeConstant()),
-      weak_factory_(this) {
-  transport_->AddValidRtpReceiver(config.sender_ssrc, config.receiver_ssrc);
-  DCHECK_GT(config.rtp_max_delay_ms, 0);
-  DCHECK_GT(config.target_frame_rate, 0);
-  decryptor_.Initialize(config.aes_key, config.aes_iv_mask);
-  cast_environment_->logger()->Subscribe(&event_subscriber_);
-}
-
-FrameReceiver::~FrameReceiver() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  cast_environment_->logger()->Unsubscribe(&event_subscriber_);
-}
-
-void FrameReceiver::RequestEncodedFrame(
-    const ReceiveEncodedFrameCallback& callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  frame_request_queue_.push_back(callback);
-  EmitAvailableEncodedFrames();
-}
-
-bool FrameReceiver::ProcessPacket(std::unique_ptr<Packet> packet) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  if (IsRtcpPacket(&packet->front(), packet->size())) {
-    rtcp_.IncomingRtcpPacket(&packet->front(), packet->size());
-  } else {
-    RtpCastHeader rtp_header;
-    const uint8_t* payload_data;
-    size_t payload_size;
-    if (!packet_parser_.ParsePacket(&packet->front(), packet->size(),
-                                    &rtp_header, &payload_data,
-                                    &payload_size)) {
-      return false;
-    }
-
-    ProcessParsedPacket(rtp_header, payload_data, payload_size);
-    stats_.UpdateStatistics(rtp_header, rtp_timebase_);
-  }
-
-  if (!reports_are_scheduled_) {
-    ScheduleNextRtcpReport();
-    ScheduleNextCastMessage();
-    reports_are_scheduled_ = true;
-  }
-
-  return true;
-}
-
-void FrameReceiver::ProcessParsedPacket(const RtpCastHeader& rtp_header,
-                                        const uint8_t* payload_data,
-                                        size_t payload_size) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
-
-  frame_id_to_rtp_timestamp_[rtp_header.frame_id.lower_8_bits()] =
-      rtp_header.rtp_timestamp;
-
-  std::unique_ptr<PacketEvent> receive_event(new PacketEvent());
-  receive_event->timestamp = now;
-  receive_event->type = PACKET_RECEIVED;
-  receive_event->media_type = event_media_type_;
-  receive_event->rtp_timestamp = rtp_header.rtp_timestamp;
-  receive_event->frame_id = rtp_header.frame_id;
-  receive_event->packet_id = rtp_header.packet_id;
-  receive_event->max_packet_id = rtp_header.max_packet_id;
-  receive_event->size = base::checked_cast<uint32_t>(payload_size);
-  cast_environment_->logger()->DispatchPacketEvent(std::move(receive_event));
-
-  bool duplicate = false;
-  const bool complete =
-      framer_.InsertPacket(payload_data, payload_size, rtp_header, &duplicate);
-
-  // Duplicate packets are ignored.
-  if (duplicate) return;
-
-  // Update lip-sync values upon receiving the first packet of each frame, or if
-  // they have never been set yet.
-  if (rtp_header.packet_id == 0 || lip_sync_reference_time_.is_null()) {
-    RtpTimeTicks fresh_sync_rtp;
-    base::TimeTicks fresh_sync_reference;
-    if (!rtcp_.GetLatestLipSyncTimes(&fresh_sync_rtp, &fresh_sync_reference)) {
-      // HACK: The sender should have provided Sender Reports before the first
-      // frame was sent.  However, the spec does not currently require this.
-      // Therefore, when the data is missing, the local clock is used to
-      // generate reference timestamps.
-      VLOG(2) << "Lip sync info missing.  Falling-back to local clock.";
-      fresh_sync_rtp = rtp_header.rtp_timestamp;
-      fresh_sync_reference = now;
-    }
-    // |lip_sync_reference_time_| is always incremented according to the time
-    // delta computed from the difference in RTP timestamps.  Then,
-    // |lip_sync_drift_| accounts for clock drift and also smoothes-out any
-    // sudden/discontinuous shifts in the series of reference time values.
-    if (lip_sync_reference_time_.is_null()) {
-      lip_sync_reference_time_ = fresh_sync_reference;
-    } else {
-      // Note: It's okay for the conversion ToTimeDelta() to be approximate
-      // because |lip_sync_drift_| will account for accumulated errors.
-      lip_sync_reference_time_ +=
-          (fresh_sync_rtp - lip_sync_rtp_timestamp_).ToTimeDelta(rtp_timebase_);
-    }
-    lip_sync_rtp_timestamp_ = fresh_sync_rtp;
-    lip_sync_drift_.Update(now,
-                           fresh_sync_reference - lip_sync_reference_time_);
-  }
-
-  // Another frame is complete from a non-duplicate packet.  Attempt to emit
-  // more frames to satisfy enqueued requests.
-  if (complete) EmitAvailableEncodedFrames();
-}
-
-void FrameReceiver::CastFeedback(const RtcpCastMessage& cast_message) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  base::TimeTicks now = cast_environment_->Clock()->NowTicks();
-  RtpTimeTicks rtp_timestamp =
-      frame_id_to_rtp_timestamp_[cast_message.ack_frame_id.lower_8_bits()];
-
-  std::unique_ptr<FrameEvent> ack_sent_event(new FrameEvent());
-  ack_sent_event->timestamp = now;
-  ack_sent_event->type = FRAME_ACK_SENT;
-  ack_sent_event->media_type = event_media_type_;
-  ack_sent_event->rtp_timestamp = rtp_timestamp;
-  ack_sent_event->frame_id = cast_message.ack_frame_id;
-  cast_environment_->logger()->DispatchFrameEvent(std::move(ack_sent_event));
-
-  ReceiverRtcpEventSubscriber::RtcpEvents rtcp_events;
-  event_subscriber_.GetRtcpEventsWithRedundancy(&rtcp_events);
-  SendRtcpReport(rtcp_.local_ssrc(), rtcp_.remote_ssrc(),
-                 CreateRtcpTimeData(now), &cast_message, nullptr,
-                 target_playout_delay_, &rtcp_events, nullptr);
-}
-
-void FrameReceiver::EmitAvailableEncodedFrames() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  while (!frame_request_queue_.empty()) {
-    // Attempt to peek at the next completed frame from the |framer_|.
-    // TODO(miu): We should only be peeking at the metadata, and not copying the
-    // payload yet!  Or, at least, peek using a StringPiece instead of a copy.
-    std::unique_ptr<EncodedFrame> encoded_frame(new EncodedFrame());
-    bool is_consecutively_next_frame = false;
-    bool have_multiple_complete_frames = false;
-    if (!framer_.GetEncodedFrame(encoded_frame.get(),
-                                 &is_consecutively_next_frame,
-                                 &have_multiple_complete_frames)) {
-      VLOG(1) << "Wait for more packets to produce a completed frame.";
-      return;  // ProcessParsedPacket() will invoke this method in the future.
-    }
-
-    const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
-    const base::TimeTicks playout_time = GetPlayoutTime(*encoded_frame);
-
-    // If we have multiple decodable frames, and the current frame is
-    // too old, then skip it and decode the next frame instead.
-    if (have_multiple_complete_frames && now > playout_time) {
-      framer_.ReleaseFrame(encoded_frame->frame_id);
-      continue;
-    }
-
-    // If |framer_| has a frame ready that is out of sequence, examine the
-    // playout time to determine whether it's acceptable to continue, thereby
-    // skipping one or more frames.  Skip if the missing frame wouldn't complete
-    // playing before the start of playback of the available frame.
-    if (!is_consecutively_next_frame) {
-      // This assumes that decoding takes as long as playing, which might
-      // not be true.
-      const base::TimeTicks earliest_possible_end_time_of_missing_frame =
-          now + expected_frame_duration_ * 2;
-      if (earliest_possible_end_time_of_missing_frame < playout_time) {
-        VLOG(1) << "Wait for next consecutive frame instead of skipping.";
-        if (!is_waiting_for_consecutive_frame_) {
-          is_waiting_for_consecutive_frame_ = true;
-          cast_environment_->PostDelayedTask(
-              CastEnvironment::MAIN, FROM_HERE,
-              base::Bind(&FrameReceiver::EmitAvailableEncodedFramesAfterWaiting,
-                         weak_factory_.GetWeakPtr()),
-              playout_time - now);
-        }
-        return;
-      }
-    }
-
-    // At this point, we have the complete next frame, or a decodable
-    // frame from somewhere later in the stream, AND we have given up
-    // on waiting for any frames in between, so now we can ACK the frame.
-    framer_.AckFrame(encoded_frame->frame_id);
-
-    // Decrypt the payload data in the frame, if crypto is being used.
-    if (decryptor_.is_activated()) {
-      std::string decrypted_data;
-      if (!decryptor_.Decrypt(encoded_frame->frame_id, encoded_frame->data,
-                              &decrypted_data)) {
-        // Decryption failed.  Give up on this frame.
-        framer_.ReleaseFrame(encoded_frame->frame_id);
-        continue;
-      }
-      encoded_frame->data.swap(decrypted_data);
-    }
-
-    // At this point, we have a decrypted EncodedFrame ready to be emitted.
-    encoded_frame->reference_time = playout_time;
-    framer_.ReleaseFrame(encoded_frame->frame_id);
-    if (encoded_frame->new_playout_delay_ms) {
-      target_playout_delay_ = base::TimeDelta::FromMilliseconds(
-          encoded_frame->new_playout_delay_ms);
-    }
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(&FrameReceiver::EmitOneFrame, weak_factory_.GetWeakPtr(),
-                   frame_request_queue_.front(), base::Passed(&encoded_frame)));
-    frame_request_queue_.pop_front();
-  }
-}
-
-void FrameReceiver::EmitAvailableEncodedFramesAfterWaiting() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(is_waiting_for_consecutive_frame_);
-  is_waiting_for_consecutive_frame_ = false;
-  EmitAvailableEncodedFrames();
-}
-
-void FrameReceiver::EmitOneFrame(
-    const ReceiveEncodedFrameCallback& callback,
-    std::unique_ptr<EncodedFrame> encoded_frame) const {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (!callback.is_null()) callback.Run(std::move(encoded_frame));
-}
-
-base::TimeTicks FrameReceiver::GetPlayoutTime(const EncodedFrame& frame) const {
-  base::TimeDelta target_playout_delay = target_playout_delay_;
-  if (frame.new_playout_delay_ms) {
-    target_playout_delay =
-        base::TimeDelta::FromMilliseconds(frame.new_playout_delay_ms);
-  }
-  return lip_sync_reference_time_ + lip_sync_drift_.Current() +
-         (frame.rtp_timestamp - lip_sync_rtp_timestamp_)
-             .ToTimeDelta(rtp_timebase_) +
-         target_playout_delay;
-}
-
-void FrameReceiver::ScheduleNextCastMessage() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  base::TimeTicks send_time;
-  framer_.TimeToSendNextCastMessage(&send_time);
-  base::TimeDelta time_to_send =
-      send_time - cast_environment_->Clock()->NowTicks();
-  time_to_send = std::max(
-      time_to_send, base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
-  cast_environment_->PostDelayedTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(&FrameReceiver::SendNextCastMessage,
-                 weak_factory_.GetWeakPtr()),
-      time_to_send);
-}
-
-void FrameReceiver::SendNextCastMessage() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  framer_.SendCastMessage();  // Will only send a message if it is time.
-  ScheduleNextCastMessage();
-}
-
-void FrameReceiver::ScheduleNextRtcpReport() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  cast_environment_->PostDelayedTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(&FrameReceiver::SendNextRtcpReport,
-                 weak_factory_.GetWeakPtr()),
-      base::TimeDelta::FromMilliseconds(kRtcpReportIntervalMs));
-}
-
-void FrameReceiver::SendNextRtcpReport() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
-  RtpReceiverStatistics stats = stats_.GetStatistics();
-  SendRtcpReport(rtcp_.local_ssrc(), rtcp_.remote_ssrc(),
-                 CreateRtcpTimeData(now), nullptr, nullptr, base::TimeDelta(),
-                 nullptr, &stats);
-  ScheduleNextRtcpReport();
-}
-
-void FrameReceiver::SendRtcpReport(
-    uint32_t rtp_receiver_ssrc, uint32_t rtp_sender_ssrc,
-    const RtcpTimeData& time_data, const RtcpCastMessage* cast_message,
-    const RtcpPliMessage* pli_message, base::TimeDelta target_delay,
-    const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
-    const RtpReceiverStatistics* rtp_receiver_statistics) {
-  transport_->InitializeRtpReceiverRtcpBuilder(rtp_receiver_ssrc, time_data);
-  RtcpReportBlock report_block;
-  if (rtp_receiver_statistics) {
-    report_block.remote_ssrc = 0;  // Not needed to set send side.
-    report_block.media_ssrc =
-        rtp_sender_ssrc;  // SSRC of the RTP packet sender.
-    report_block.fraction_lost = rtp_receiver_statistics->fraction_lost;
-    report_block.cumulative_lost = rtp_receiver_statistics->cumulative_lost;
-    report_block.extended_high_sequence_number =
-        rtp_receiver_statistics->extended_high_sequence_number;
-    report_block.jitter = rtp_receiver_statistics->jitter;
-    report_block.last_sr = rtcp_.last_report_truncated_ntp();
-    base::TimeTicks last_report_received_time =
-        rtcp_.time_last_report_received();
-    if (!last_report_received_time.is_null()) {
-      uint32_t delay_seconds = 0;
-      uint32_t delay_fraction = 0;
-      base::TimeDelta delta = time_data.timestamp - last_report_received_time;
-      ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds,
-                             &delay_fraction);
-      report_block.delay_since_last_sr =
-          ConvertToNtpDiff(delay_seconds, delay_fraction);
-    } else {
-      report_block.delay_since_last_sr = 0;
-    }
-    transport_->AddRtpReceiverReport(report_block);
-  }
-  if (cast_message) transport_->AddCastFeedback(*cast_message, target_delay);
-  if (pli_message) transport_->AddPli(*pli_message);
-  if (rtcp_events) transport_->AddRtcpEvents(*rtcp_events);
-  transport_->SendRtcpFromRtpReceiver();
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/receiver/frame_receiver.h b/src/cobalt/media/cast/receiver/frame_receiver.h
deleted file mode 100644
index 9ccb3c9..0000000
--- a/src/cobalt/media/cast/receiver/frame_receiver.h
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
-#define COBALT_MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
-
-#include <list>
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/time/time.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/common/clock_drift_smoother.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/common/transport_encryption_handler.h"
-#include "media/cast/logging/logging_defines.h"
-#include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
-#include "media/cast/net/rtcp/receiver_rtcp_session.h"
-#include "media/cast/net/rtp/framer.h"
-#include "media/cast/net/rtp/receiver_stats.h"
-#include "media/cast/net/rtp/rtp_defines.h"
-#include "media/cast/net/rtp/rtp_parser.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class CastEnvironment;
-
-// FrameReceiver receives packets out-of-order while clients make requests for
-// complete frames in-order.  (A frame consists of one or more packets.)
-//
-// FrameReceiver also includes logic for computing the playout time for each
-// frame, accounting for a constant targeted playout delay.  The purpose of the
-// playout delay is to provide a fixed window of time between the capture event
-// on the sender and the playout on the receiver.  This is important because
-// each step of the pipeline (i.e., encode frame, then transmit/retransmit from
-// the sender, then receive and re-order packets on the receiver, then decode
-// frame) can vary in duration and is typically very hard to predict.
-//
-// Each request for a frame includes a callback which FrameReceiver guarantees
-// will be called at some point in the future unless the FrameReceiver is
-// destroyed.  Clients should generally limit the number of outstanding requests
-// (perhaps to just one or two).
-//
-// This class is not thread safe.  Should only be called from the Main cast
-// thread.
-class FrameReceiver : public RtpPayloadFeedback,
-                      public base::SupportsWeakPtr<FrameReceiver> {
- public:
-  FrameReceiver(const scoped_refptr<CastEnvironment>& cast_environment,
-                const FrameReceiverConfig& config,
-                EventMediaType event_media_type,
-                CastTransport* const transport);
-
-  ~FrameReceiver() final;
-
-  // Request an encoded frame.
-  //
-  // The given |callback| is guaranteed to be run at some point in the future,
-  // except for those requests still enqueued at destruction time.
-  void RequestEncodedFrame(const ReceiveEncodedFrameCallback& callback);
-
-  // Called to deliver another packet, possibly a duplicate, and possibly
-  // out-of-order.  Returns true if the parsing of the packet succeeded.
-  bool ProcessPacket(std::unique_ptr<Packet> packet);
-
- protected:
-  friend class FrameReceiverTest;  // Invokes ProcessParsedPacket().
-
-  void ProcessParsedPacket(const RtpCastHeader& rtp_header,
-                           const uint8_t* payload_data, size_t payload_size);
-
-  // RtpPayloadFeedback implementation.
-  void CastFeedback(const RtcpCastMessage& cast_message) final;
-
- private:
-  // Processes ready-to-consume packets from |framer_|, decrypting each packet's
-  // payload data, and then running the enqueued callbacks in order (one for
-  // each packet).  This method may post a delayed task to re-invoke itself in
-  // the future to wait for missing/incomplete frames.
-  void EmitAvailableEncodedFrames();
-
-  // Clears the |is_waiting_for_consecutive_frame_| flag and invokes
-  // EmitAvailableEncodedFrames().
-  void EmitAvailableEncodedFramesAfterWaiting();
-
-  // Helper that runs |callback|, passing ownership of |encoded_frame| to it.
-  // This method is used by EmitAvailableEncodedFrames() to return to the event
-  // loop, but make sure that FrameReceiver is still alive before the callback
-  // is run.
-  void EmitOneFrame(const ReceiveEncodedFrameCallback& callback,
-                    std::unique_ptr<EncodedFrame> encoded_frame) const;
-
-  // Computes the playout time for a frame with the given |rtp_timestamp|.
-  // Because lip-sync info is refreshed regularly, calling this method with the
-  // same argument may return different results.
-  base::TimeTicks GetPlayoutTime(const EncodedFrame& frame) const;
-
-  // Schedule timing for the next cast message.
-  void ScheduleNextCastMessage();
-
-  // Schedule timing for the next RTCP report.
-  void ScheduleNextRtcpReport();
-
-  // Actually send the next cast message.
-  void SendNextCastMessage();
-
-  // Actually send the next RTCP report.
-  void SendNextRtcpReport();
-
-  // Interface to send RTCP reports.
-  // |cast_message|, |rtcp_events| and |rtp_receiver_statistics| are optional;
-  // if |cast_message| is provided the RTCP receiver report will contain a Cast
-  // ACK/NACK feedback message; |target_delay| is sent together with
-  // |cast_message|. If |rtcp_events| is provided the RTCP receiver report will
-  // include event log messages
-  void SendRtcpReport(
-      uint32_t rtp_receiver_ssrc, uint32_t rtp_sender_ssrc,
-      const RtcpTimeData& time_data, const RtcpCastMessage* cast_message,
-      const RtcpPliMessage* pli_message, base::TimeDelta target_delay,
-      const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
-      const RtpReceiverStatistics* rtp_receiver_statistics);
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-
-  // Transport used to send data back.
-  CastTransport* const transport_;
-
-  // Deserializes a packet into a RtpHeader + payload bytes.
-  RtpParser packet_parser_;
-
-  // Accumulates packet statistics, including packet loss, counts, and jitter.
-  ReceiverStats stats_;
-
-  // Partitions logged events by the type of media passing through.
-  EventMediaType event_media_type_;
-
-  // Subscribes to raw events.
-  // Processes raw events to be sent over to the cast sender via RTCP.
-  ReceiverRtcpEventSubscriber event_subscriber_;
-
-  // RTP timebase: The number of RTP units advanced per one second.
-  const int rtp_timebase_;
-
-  // The total amount of time between a frame's capture/recording on the sender
-  // and its playback on the receiver (i.e., shown to a user).  This is fixed as
-  // a value large enough to give the system sufficient time to encode,
-  // transmit/retransmit, receive, decode, and render; given its run-time
-  // environment (sender/receiver hardware performance, network conditions,
-  // etc.).
-  base::TimeDelta target_playout_delay_;
-
-  // Hack: This is used in logic that determines whether to skip frames.
-  // TODO(miu): Revisit this.  Logic needs to also account for expected decode
-  // time.
-  const base::TimeDelta expected_frame_duration_;
-
-  // Set to false initially, then set to true after scheduling the periodic
-  // sending of reports back to the sender.  Reports are first scheduled just
-  // after receiving a first packet (since the first packet identifies the
-  // sender for the remainder of the session).
-  bool reports_are_scheduled_;
-
-  // Assembles packets into frames, providing this receiver with complete,
-  // decodable EncodedFrames.
-  Framer framer_;
-
-  // Manages sending/receiving of RTCP packets, including sender/receiver
-  // reports.
-  ReceiverRtcpSession rtcp_;
-
-  // Decrypts encrypted frames.
-  TransportEncryptionHandler decryptor_;
-
-  // Outstanding callbacks to run to deliver on client requests for frames.
-  std::list<ReceiveEncodedFrameCallback> frame_request_queue_;
-
-  // True while there's an outstanding task to re-invoke
-  // EmitAvailableEncodedFrames().
-  bool is_waiting_for_consecutive_frame_;
-
-  // This mapping allows us to log FRAME_ACK_SENT as a frame event. In addition
-  // it allows the event to be transmitted via RTCP.  The index into this ring
-  // buffer is the lower 8 bits of the FrameId.
-  RtpTimeTicks frame_id_to_rtp_timestamp_[256];
-
-  // Lip-sync values used to compute the playout time of each frame from its RTP
-  // timestamp.  These are updated each time the first packet of a frame is
-  // received.
-  RtpTimeTicks lip_sync_rtp_timestamp_;
-  base::TimeTicks lip_sync_reference_time_;
-  ClockDriftSmoother lip_sync_drift_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<FrameReceiver> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(FrameReceiver);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
diff --git a/src/cobalt/media/cast/receiver/frame_receiver_unittest.cc b/src/cobalt/media/cast/receiver/frame_receiver_unittest.cc
deleted file mode 100644
index 8016d85..0000000
--- a/src/cobalt/media/cast/receiver/frame_receiver_unittest.cc
+++ /dev/null
@@ -1,455 +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.
-
-#include "media/cast/receiver/frame_receiver.h"
-
-#include <deque>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/logging/simple_event_subscriber.h"
-#include "media/cast/net/cast_transport_impl.h"
-#include "media/cast/net/mock_cast_transport.h"
-#include "media/cast/net/rtcp/rtcp_utility.h"
-#include "media/cast/net/rtcp/test_rtcp_packet_builder.h"
-#include "media/cast/test/utility/default_config.h"
-#include "starboard/types.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-using ::testing::_;
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-const int kPacketSize = 1500;
-const int kPlayoutDelayMillis = 100;
-
-FrameId GetFirstTestFrameId() { return FrameId::first() + 1234; }
-
-class FakeFrameClient {
- public:
-  FakeFrameClient() : num_called_(0) {}
-  virtual ~FakeFrameClient() {}
-
-  void AddExpectedResult(FrameId expected_frame_id,
-                         const base::TimeTicks& expected_playout_time) {
-    expected_results_.push_back(
-        std::make_pair(expected_frame_id, expected_playout_time));
-  }
-
-  void DeliverEncodedFrame(std::unique_ptr<EncodedFrame> frame) {
-    SCOPED_TRACE(::testing::Message() << "num_called_ is " << num_called_);
-    ASSERT_TRUE(frame)
-        << "If at shutdown: There were unsatisfied requests enqueued.";
-    ASSERT_FALSE(expected_results_.empty());
-    EXPECT_EQ(expected_results_.front().first, frame->frame_id);
-    EXPECT_EQ(expected_results_.front().second, frame->reference_time);
-    expected_results_.pop_front();
-    ++num_called_;
-  }
-
-  int number_times_called() const { return num_called_; }
-
- private:
-  std::deque<std::pair<FrameId, base::TimeTicks>> expected_results_;
-  int num_called_;
-
-  DISALLOW_COPY_AND_ASSIGN(FakeFrameClient);
-};
-}  // namespace
-
-class FrameReceiverTest : public ::testing::Test {
- protected:
-  FrameReceiverTest() {
-    testing_clock_ = new base::SimpleTestTickClock();
-    testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
-    start_time_ = testing_clock_->NowTicks();
-    task_runner_ = new FakeSingleThreadTaskRunner(testing_clock_);
-
-    cast_environment_ =
-        new CastEnvironment(std::unique_ptr<base::TickClock>(testing_clock_),
-                            task_runner_, task_runner_, task_runner_);
-  }
-
-  ~FrameReceiverTest() override {}
-
-  void SetUp() final {
-    payload_.assign(kPacketSize, 0);
-
-    // Always start with a key frame.
-    rtp_header_.is_key_frame = true;
-    rtp_header_.frame_id = GetFirstTestFrameId();
-    rtp_header_.packet_id = 0;
-    rtp_header_.max_packet_id = 0;
-    rtp_header_.reference_frame_id = rtp_header_.frame_id;
-    rtp_header_.rtp_timestamp = RtpTimeTicks();
-  }
-
-  void CreateFrameReceiverOfAudio() {
-    config_ = GetDefaultAudioReceiverConfig();
-    config_.rtp_max_delay_ms = kPlayoutDelayMillis;
-
-    receiver_.reset(new FrameReceiver(cast_environment_, config_, AUDIO_EVENT,
-                                      &mock_transport_));
-  }
-
-  void CreateFrameReceiverOfVideo() {
-    config_ = GetDefaultVideoReceiverConfig();
-    config_.rtp_max_delay_ms = kPlayoutDelayMillis;
-    // Note: Frame rate must divide 1000 without remainder so the test code
-    // doesn't have to account for rounding errors.
-    config_.target_frame_rate = 25;
-
-    receiver_.reset(new FrameReceiver(cast_environment_, config_, VIDEO_EVENT,
-                                      &mock_transport_));
-  }
-
-  void FeedOneFrameIntoReceiver() {
-    // Note: For testing purposes, a frame consists of only a single packet.
-    receiver_->ProcessParsedPacket(rtp_header_, &payload_[0], payload_.size());
-  }
-
-  void FeedLipSyncInfoIntoReceiver() {
-    const base::TimeTicks now = testing_clock_->NowTicks();
-    const RtpTimeTicks rtp_timestamp =
-        RtpTimeTicks::FromTimeDelta(now - start_time_, config_.rtp_timebase);
-    CHECK_LE(RtpTimeTicks(), rtp_timestamp);
-    uint32_t ntp_seconds;
-    uint32_t ntp_fraction;
-    ConvertTimeTicksToNtp(now, &ntp_seconds, &ntp_fraction);
-    TestRtcpPacketBuilder rtcp_packet;
-    rtcp_packet.AddSrWithNtp(config_.sender_ssrc, ntp_seconds, ntp_fraction,
-                             rtp_timestamp.lower_32_bits());
-    ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket()));
-  }
-
-  FrameReceiverConfig config_;
-  std::vector<uint8_t> payload_;
-  RtpCastHeader rtp_header_;
-  base::SimpleTestTickClock* testing_clock_;  // Owned by CastEnvironment.
-  base::TimeTicks start_time_;
-  MockCastTransport mock_transport_;
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  scoped_refptr<CastEnvironment> cast_environment_;
-  FakeFrameClient frame_client_;
-
-  // Important for the FrameReceiver to be declared last, since its dependencies
-  // must remain alive until after its destruction.
-  std::unique_ptr<FrameReceiver> receiver_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(FrameReceiverTest);
-};
-
-TEST_F(FrameReceiverTest, RejectsUnparsablePackets) {
-  EXPECT_CALL(mock_transport_, AddValidRtpReceiver(_, _))
-      .WillRepeatedly(testing::Return());
-
-  CreateFrameReceiverOfVideo();
-
-  SimpleEventSubscriber event_subscriber;
-  cast_environment_->logger()->Subscribe(&event_subscriber);
-
-  const bool success = receiver_->ProcessPacket(
-      std::unique_ptr<Packet>(new Packet(kPacketSize, 0xff)));
-  EXPECT_FALSE(success);
-
-  // Confirm no log events.
-  std::vector<FrameEvent> frame_events;
-  event_subscriber.GetFrameEventsAndReset(&frame_events);
-  EXPECT_TRUE(frame_events.empty());
-  cast_environment_->logger()->Unsubscribe(&event_subscriber);
-}
-
-TEST_F(FrameReceiverTest, ReceivesOneFrame) {
-  EXPECT_CALL(mock_transport_, AddValidRtpReceiver(_, _))
-      .WillRepeatedly(testing::Return());
-
-  CreateFrameReceiverOfAudio();
-
-  SimpleEventSubscriber event_subscriber;
-  cast_environment_->logger()->Subscribe(&event_subscriber);
-
-  EXPECT_CALL(mock_transport_, InitializeRtpReceiverRtcpBuilder(_, _))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddCastFeedback(_, _))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddPli(_)).WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddRtcpEvents(_))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, SendRtcpFromRtpReceiver())
-      .WillRepeatedly(testing::Return());
-
-  FeedLipSyncInfoIntoReceiver();
-  task_runner_->RunTasks();
-
-  // Enqueue a request for a frame.
-  receiver_->RequestEncodedFrame(base::Bind(
-      &FakeFrameClient::DeliverEncodedFrame, base::Unretained(&frame_client_)));
-
-  // The request should not be satisfied since no packets have been received.
-  task_runner_->RunTasks();
-  EXPECT_EQ(0, frame_client_.number_times_called());
-
-  // Deliver one frame to the receiver and expect to get one frame back.
-  const base::TimeDelta target_playout_delay =
-      base::TimeDelta::FromMilliseconds(kPlayoutDelayMillis);
-  frame_client_.AddExpectedResult(
-      GetFirstTestFrameId(), testing_clock_->NowTicks() + target_playout_delay);
-  FeedOneFrameIntoReceiver();
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Was the frame logged?
-  std::vector<FrameEvent> frame_events;
-  event_subscriber.GetFrameEventsAndReset(&frame_events);
-  ASSERT_TRUE(!frame_events.empty());
-  EXPECT_EQ(FRAME_ACK_SENT, frame_events.begin()->type);
-  EXPECT_EQ(AUDIO_EVENT, frame_events.begin()->media_type);
-  EXPECT_EQ(rtp_header_.frame_id, frame_events.begin()->frame_id);
-  EXPECT_EQ(rtp_header_.rtp_timestamp, frame_events.begin()->rtp_timestamp);
-  cast_environment_->logger()->Unsubscribe(&event_subscriber);
-}
-
-TEST_F(FrameReceiverTest, ReceivesFramesSkippingWhenAppropriate) {
-  EXPECT_CALL(mock_transport_, AddValidRtpReceiver(_, _))
-      .WillRepeatedly(testing::Return());
-
-  CreateFrameReceiverOfAudio();
-
-  SimpleEventSubscriber event_subscriber;
-  cast_environment_->logger()->Subscribe(&event_subscriber);
-
-  EXPECT_CALL(mock_transport_, InitializeRtpReceiverRtcpBuilder(_, _))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddCastFeedback(_, _))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddPli(_)).WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddRtcpEvents(_))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, SendRtcpFromRtpReceiver())
-      .WillRepeatedly(testing::Return());
-
-  const base::TimeDelta time_advance_per_frame =
-      base::TimeDelta::FromSeconds(1) / config_.target_frame_rate;
-  const RtpTimeDelta rtp_advance_per_frame =
-      RtpTimeDelta::FromTimeDelta(time_advance_per_frame, config_.rtp_timebase);
-
-  // Feed and process lip sync in receiver.
-  FeedLipSyncInfoIntoReceiver();
-  task_runner_->RunTasks();
-  const base::TimeTicks first_frame_capture_time = testing_clock_->NowTicks();
-
-  // Enqueue a request for a frame.
-  const ReceiveEncodedFrameCallback frame_encoded_callback = base::Bind(
-      &FakeFrameClient::DeliverEncodedFrame, base::Unretained(&frame_client_));
-  receiver_->RequestEncodedFrame(frame_encoded_callback);
-  task_runner_->RunTasks();
-  EXPECT_EQ(0, frame_client_.number_times_called());
-
-  // Receive one frame and expect to see the first request satisfied.
-  const base::TimeDelta target_playout_delay =
-      base::TimeDelta::FromMilliseconds(kPlayoutDelayMillis);
-  frame_client_.AddExpectedResult(
-      GetFirstTestFrameId(), first_frame_capture_time + target_playout_delay);
-  rtp_header_.rtp_timestamp = RtpTimeTicks();
-  FeedOneFrameIntoReceiver();  // Frame 1
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Enqueue a second request for a frame, but it should not be fulfilled yet.
-  receiver_->RequestEncodedFrame(frame_encoded_callback);
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Receive one frame out-of-order: Make sure that we are not continuous and
-  // that the RTP timestamp represents a time in the future.
-  rtp_header_.frame_id = GetFirstTestFrameId() + 2;  // "Frame 3"
-  rtp_header_.reference_frame_id = rtp_header_.frame_id;
-  rtp_header_.rtp_timestamp += rtp_advance_per_frame * 2;
-  frame_client_.AddExpectedResult(rtp_header_.frame_id,
-                                  first_frame_capture_time +
-                                      2 * time_advance_per_frame +
-                                      target_playout_delay);
-  FeedOneFrameIntoReceiver();  // Frame 3
-
-  // Frame 2 should not come out at this point in time.
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Enqueue a third request for a frame.
-  receiver_->RequestEncodedFrame(frame_encoded_callback);
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Now, advance time forward such that the receiver is convinced it should
-  // skip Frame 2.  Frame 3 is emitted (to satisfy the second request) because a
-  // decision was made to skip over the no-show Frame 2.
-  testing_clock_->Advance(2 * time_advance_per_frame + target_playout_delay);
-  task_runner_->RunTasks();
-  EXPECT_EQ(2, frame_client_.number_times_called());
-
-  // Receive Frame 4 and expect it to fulfill the third request immediately.
-  rtp_header_.frame_id = GetFirstTestFrameId() + 3;  // "Frame 4"
-  rtp_header_.reference_frame_id = rtp_header_.frame_id;
-  rtp_header_.rtp_timestamp += rtp_advance_per_frame;
-  frame_client_.AddExpectedResult(rtp_header_.frame_id,
-                                  first_frame_capture_time +
-                                      3 * time_advance_per_frame +
-                                      target_playout_delay);
-  FeedOneFrameIntoReceiver();  // Frame 4
-  task_runner_->RunTasks();
-  EXPECT_EQ(3, frame_client_.number_times_called());
-
-  // Move forward to the playout time of an unreceived Frame 5.  Expect no
-  // additional frames were emitted.
-  testing_clock_->Advance(3 * time_advance_per_frame);
-  task_runner_->RunTasks();
-  EXPECT_EQ(3, frame_client_.number_times_called());
-
-  // Were only non-skipped frames logged?
-  std::vector<FrameEvent> frame_events;
-  event_subscriber.GetFrameEventsAndReset(&frame_events);
-  ASSERT_TRUE(!frame_events.empty());
-  for (size_t i = 0; i < frame_events.size(); ++i) {
-    EXPECT_EQ(FRAME_ACK_SENT, frame_events[i].type);
-    EXPECT_EQ(AUDIO_EVENT, frame_events[i].media_type);
-    EXPECT_LE(GetFirstTestFrameId(), frame_events[i].frame_id);
-    EXPECT_GE(GetFirstTestFrameId() + 4, frame_events[i].frame_id);
-    const int frame_offset = frame_events[i].frame_id - GetFirstTestFrameId();
-    EXPECT_NE(frame_offset, 1);  // Frame 2 never received.
-    EXPECT_EQ(RtpTimeTicks() + (rtp_advance_per_frame * frame_offset),
-              frame_events[i].rtp_timestamp);
-  }
-  cast_environment_->logger()->Unsubscribe(&event_subscriber);
-}
-
-TEST_F(FrameReceiverTest, ReceivesFramesRefusingToSkipAny) {
-  EXPECT_CALL(mock_transport_, AddValidRtpReceiver(_, _))
-      .WillRepeatedly(testing::Return());
-
-  CreateFrameReceiverOfVideo();
-
-  SimpleEventSubscriber event_subscriber;
-  cast_environment_->logger()->Subscribe(&event_subscriber);
-
-  EXPECT_CALL(mock_transport_, InitializeRtpReceiverRtcpBuilder(_, _))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddCastFeedback(_, _))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddPli(_)).WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, AddRtcpEvents(_))
-      .WillRepeatedly(testing::Return());
-  EXPECT_CALL(mock_transport_, SendRtcpFromRtpReceiver())
-      .WillRepeatedly(testing::Return());
-
-  const base::TimeDelta time_advance_per_frame =
-      base::TimeDelta::FromSeconds(1) / config_.target_frame_rate;
-  const RtpTimeDelta rtp_advance_per_frame =
-      RtpTimeDelta::FromTimeDelta(time_advance_per_frame, config_.rtp_timebase);
-
-  // Feed and process lip sync in receiver.
-  FeedLipSyncInfoIntoReceiver();
-  task_runner_->RunTasks();
-  const base::TimeTicks first_frame_capture_time = testing_clock_->NowTicks();
-
-  // Enqueue a request for a frame.
-  const ReceiveEncodedFrameCallback frame_encoded_callback = base::Bind(
-      &FakeFrameClient::DeliverEncodedFrame, base::Unretained(&frame_client_));
-  receiver_->RequestEncodedFrame(frame_encoded_callback);
-  task_runner_->RunTasks();
-  EXPECT_EQ(0, frame_client_.number_times_called());
-
-  // Receive one frame and expect to see the first request satisfied.
-  const base::TimeDelta target_playout_delay =
-      base::TimeDelta::FromMilliseconds(kPlayoutDelayMillis);
-  frame_client_.AddExpectedResult(
-      GetFirstTestFrameId(), first_frame_capture_time + target_playout_delay);
-  rtp_header_.rtp_timestamp = RtpTimeTicks();
-  FeedOneFrameIntoReceiver();  // Frame 1
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Enqueue a second request for a frame, but it should not be fulfilled yet.
-  receiver_->RequestEncodedFrame(frame_encoded_callback);
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Receive one frame out-of-order: Make sure that we are not continuous and
-  // that the RTP timestamp represents a time in the future.
-  rtp_header_.is_key_frame = false;
-  rtp_header_.frame_id = GetFirstTestFrameId() + 2;            // "Frame 3"
-  rtp_header_.reference_frame_id = GetFirstTestFrameId() + 1;  // "Frame 2"
-  rtp_header_.rtp_timestamp += rtp_advance_per_frame * 2;
-  FeedOneFrameIntoReceiver();  // Frame 3
-
-  // Frame 2 should not come out at this point in time.
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Enqueue a third request for a frame.
-  receiver_->RequestEncodedFrame(frame_encoded_callback);
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Now, advance time forward such that Frame 2 is now too late for playback.
-  // Regardless, the receiver must NOT emit Frame 3 yet because it is not
-  // allowed to skip frames when dependencies are not satisfied.  In other
-  // words, Frame 3 is not decodable without Frame 2.
-  testing_clock_->Advance(2 * time_advance_per_frame + target_playout_delay);
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, frame_client_.number_times_called());
-
-  // Now receive Frame 2 and expect both the second and third requests to be
-  // fulfilled immediately.
-  frame_client_.AddExpectedResult(GetFirstTestFrameId() + 1,  // "Frame 2"
-                                  first_frame_capture_time +
-                                      1 * time_advance_per_frame +
-                                      target_playout_delay);
-  frame_client_.AddExpectedResult(GetFirstTestFrameId() + 2,  // "Frame 3"
-                                  first_frame_capture_time +
-                                      2 * time_advance_per_frame +
-                                      target_playout_delay);
-  --rtp_header_.frame_id;            // "Frame 2"
-  --rtp_header_.reference_frame_id;  // "Frame 1"
-  rtp_header_.rtp_timestamp -= rtp_advance_per_frame;
-  FeedOneFrameIntoReceiver();  // Frame 2
-  task_runner_->RunTasks();
-  EXPECT_EQ(3, frame_client_.number_times_called());
-
-  // Move forward to the playout time of an unreceived Frame 5.  Expect no
-  // additional frames were emitted.
-  testing_clock_->Advance(3 * time_advance_per_frame);
-  task_runner_->RunTasks();
-  EXPECT_EQ(3, frame_client_.number_times_called());
-
-  // Sanity-check logging results.
-  std::vector<FrameEvent> frame_events;
-  event_subscriber.GetFrameEventsAndReset(&frame_events);
-  ASSERT_TRUE(!frame_events.empty());
-  for (size_t i = 0; i < frame_events.size(); ++i) {
-    EXPECT_EQ(FRAME_ACK_SENT, frame_events[i].type);
-    EXPECT_EQ(VIDEO_EVENT, frame_events[i].media_type);
-    EXPECT_LE(GetFirstTestFrameId(), frame_events[i].frame_id);
-    EXPECT_GE(GetFirstTestFrameId() + 3, frame_events[i].frame_id);
-    const int frame_offset = frame_events[i].frame_id - GetFirstTestFrameId();
-    EXPECT_EQ(RtpTimeTicks() + (rtp_advance_per_frame * frame_offset),
-              frame_events[i].rtp_timestamp);
-  }
-  cast_environment_->logger()->Unsubscribe(&event_subscriber);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/receiver/video_decoder.cc b/src/cobalt/media/cast/receiver/video_decoder.cc
deleted file mode 100644
index e1aa9b9..0000000
--- a/src/cobalt/media/cast/receiver/video_decoder.cc
+++ /dev/null
@@ -1,257 +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.
-
-#include "media/cast/receiver/video_decoder.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/json/json_reader.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/values.h"
-#include "media/base/video_frame_pool.h"
-#include "media/base/video_util.h"
-#include "media/cast/cast_environment.h"
-// VPX_CODEC_DISABLE_COMPAT excludes parts of the libvpx API that provide
-// backwards compatibility for legacy applications using the library.
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "starboard/types.h"
-#include "third_party/libvpx/source/libvpx/vpx/vp8dx.h"
-#include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h"
-#include "third_party/libyuv/include/libyuv/convert.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Base class that handles the common problem of detecting dropped frames, and
-// then invoking the Decode() method implemented by the subclasses to convert
-// the encoded payload data into a usable video frame.
-class VideoDecoder::ImplBase
-    : public base::RefCountedThreadSafe<VideoDecoder::ImplBase> {
- public:
-  ImplBase(const scoped_refptr<CastEnvironment>& cast_environment, Codec codec)
-      : cast_environment_(cast_environment),
-        codec_(codec),
-        operational_status_(STATUS_UNINITIALIZED) {}
-
-  OperationalStatus InitializationResult() const { return operational_status_; }
-
-  void DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
-                   const DecodeFrameCallback& callback) {
-    DCHECK_EQ(operational_status_, STATUS_INITIALIZED);
-
-    bool is_continuous = true;
-    DCHECK(!encoded_frame->frame_id.is_null());
-    if (!last_frame_id_.is_null()) {
-      if (encoded_frame->frame_id > (last_frame_id_ + 1)) {
-        RecoverBecauseFramesWereDropped();
-        is_continuous = false;
-      }
-    }
-    last_frame_id_ = encoded_frame->frame_id;
-
-    const scoped_refptr<VideoFrame> decoded_frame =
-        Decode(encoded_frame->mutable_bytes(),
-               static_cast<int>(encoded_frame->data.size()));
-    decoded_frame->set_timestamp(
-        encoded_frame->rtp_timestamp.ToTimeDelta(kVideoFrequency));
-
-    std::unique_ptr<FrameEvent> decode_event(new FrameEvent());
-    decode_event->timestamp = cast_environment_->Clock()->NowTicks();
-    decode_event->type = FRAME_DECODED;
-    decode_event->media_type = VIDEO_EVENT;
-    decode_event->rtp_timestamp = encoded_frame->rtp_timestamp;
-    decode_event->frame_id = encoded_frame->frame_id;
-    cast_environment_->logger()->DispatchFrameEvent(std::move(decode_event));
-
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(callback, decoded_frame, is_continuous));
-  }
-
- protected:
-  friend class base::RefCountedThreadSafe<ImplBase>;
-  virtual ~ImplBase() {}
-
-  virtual void RecoverBecauseFramesWereDropped() {}
-
-  // Note: Implementation of Decode() is allowed to mutate |data|.
-  virtual scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) = 0;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const Codec codec_;
-
-  // Subclass' ctor is expected to set this to STATUS_INITIALIZED.
-  OperationalStatus operational_status_;
-
-  // Pool of VideoFrames to decode incoming frames into.
-  media::VideoFramePool video_frame_pool_;
-
- private:
-  FrameId last_frame_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(ImplBase);
-};
-
-class VideoDecoder::Vp8Impl : public VideoDecoder::ImplBase {
- public:
-  explicit Vp8Impl(const scoped_refptr<CastEnvironment>& cast_environment)
-      : ImplBase(cast_environment, CODEC_VIDEO_VP8) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) return;
-
-    vpx_codec_dec_cfg_t cfg = {0};
-    // TODO(miu): Revisit this for typical multi-core desktop use case.  This
-    // feels like it should be 4 or 8.
-    cfg.threads = 1;
-
-    DCHECK(vpx_codec_get_caps(vpx_codec_vp8_dx()) & VPX_CODEC_CAP_POSTPROC);
-    if (vpx_codec_dec_init(&context_, vpx_codec_vp8_dx(), &cfg,
-                           VPX_CODEC_USE_POSTPROC) != VPX_CODEC_OK) {
-      ImplBase::operational_status_ = STATUS_INVALID_CONFIGURATION;
-      return;
-    }
-    ImplBase::operational_status_ = STATUS_INITIALIZED;
-  }
-
- private:
-  ~Vp8Impl() final {
-    if (ImplBase::operational_status_ == STATUS_INITIALIZED)
-      CHECK_EQ(VPX_CODEC_OK, vpx_codec_destroy(&context_));
-  }
-
-  scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) final {
-    if (len <= 0 ||
-        vpx_codec_decode(&context_, data, static_cast<unsigned int>(len), NULL,
-                         0) != VPX_CODEC_OK) {
-      return NULL;
-    }
-
-    vpx_codec_iter_t iter = NULL;
-    vpx_image_t* const image = vpx_codec_get_frame(&context_, &iter);
-    if (!image) return NULL;
-    if (image->fmt != VPX_IMG_FMT_I420) {
-      NOTREACHED() << "Only pixel format supported is I420, got " << image->fmt;
-      return NULL;
-    }
-    DCHECK(vpx_codec_get_frame(&context_, &iter) == NULL)
-        << "Should have only decoded exactly one frame.";
-
-    const gfx::Size frame_size(image->d_w, image->d_h);
-    // Note: Timestamp for the VideoFrame will be set in VideoReceiver.
-    // |decoded_frame| will be returned to |video_frame_pool_| on destruction to
-    // be reused.
-    const scoped_refptr<VideoFrame> decoded_frame =
-        video_frame_pool_.CreateFrame(PIXEL_FORMAT_I420, frame_size,
-                                      gfx::Rect(frame_size), frame_size,
-                                      base::TimeDelta());
-    libyuv::I420Copy(image->planes[VPX_PLANE_Y], image->stride[VPX_PLANE_Y],
-                     image->planes[VPX_PLANE_U], image->stride[VPX_PLANE_U],
-                     image->planes[VPX_PLANE_V], image->stride[VPX_PLANE_V],
-                     decoded_frame->visible_data(media::VideoFrame::kYPlane),
-                     decoded_frame->stride(media::VideoFrame::kYPlane),
-                     decoded_frame->visible_data(media::VideoFrame::kUPlane),
-                     decoded_frame->stride(media::VideoFrame::kUPlane),
-                     decoded_frame->visible_data(media::VideoFrame::kVPlane),
-                     decoded_frame->stride(media::VideoFrame::kVPlane),
-                     frame_size.width(), frame_size.height());
-    return decoded_frame;
-  }
-
-  // VPX decoder context (i.e., an instantiation).
-  vpx_codec_ctx_t context_;
-
-  DISALLOW_COPY_AND_ASSIGN(Vp8Impl);
-};
-
-#ifndef OFFICIAL_BUILD
-// A fake video decoder that always output 2x2 black frames.
-class VideoDecoder::FakeImpl : public VideoDecoder::ImplBase {
- public:
-  explicit FakeImpl(const scoped_refptr<CastEnvironment>& cast_environment)
-      : ImplBase(cast_environment, CODEC_VIDEO_FAKE), last_decoded_id_(-1) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) return;
-    ImplBase::operational_status_ = STATUS_INITIALIZED;
-  }
-
- private:
-  ~FakeImpl() final {}
-
-  scoped_refptr<VideoFrame> Decode(uint8_t* data, int len) final {
-    // Make sure this is a JSON string.
-    if (!len || data[0] != '{') return NULL;
-    base::JSONReader reader;
-    std::unique_ptr<base::Value> values(
-        reader.Read(base::StringPiece(reinterpret_cast<char*>(data), len)));
-    if (!values) return NULL;
-    base::DictionaryValue* dict = NULL;
-    values->GetAsDictionary(&dict);
-
-    bool key = false;
-    int id = 0;
-    int ref = 0;
-    dict->GetBoolean("key", &key);
-    dict->GetInteger("id", &id);
-    dict->GetInteger("ref", &ref);
-    DCHECK(id == last_decoded_id_ + 1);
-    last_decoded_id_ = id;
-    return media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2));
-  }
-
-  int last_decoded_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(FakeImpl);
-};
-#endif
-
-VideoDecoder::VideoDecoder(
-    const scoped_refptr<CastEnvironment>& cast_environment, Codec codec)
-    : cast_environment_(cast_environment) {
-  switch (codec) {
-#ifndef OFFICIAL_BUILD
-    case CODEC_VIDEO_FAKE:
-      impl_ = new FakeImpl(cast_environment);
-      break;
-#endif
-    case CODEC_VIDEO_VP8:
-      impl_ = new Vp8Impl(cast_environment);
-      break;
-    case CODEC_VIDEO_H264:
-      // TODO(miu): Need implementation.
-      NOTIMPLEMENTED();
-      break;
-    default:
-      NOTREACHED() << "Unknown or unspecified codec.";
-      break;
-  }
-}
-
-VideoDecoder::~VideoDecoder() {}
-
-OperationalStatus VideoDecoder::InitializationResult() const {
-  if (impl_.get()) return impl_->InitializationResult();
-  return STATUS_UNSUPPORTED_CODEC;
-}
-
-void VideoDecoder::DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
-                               const DecodeFrameCallback& callback) {
-  DCHECK(encoded_frame.get());
-  DCHECK(!callback.is_null());
-  if (!impl_.get() || impl_->InitializationResult() != STATUS_INITIALIZED) {
-    callback.Run(make_scoped_refptr<VideoFrame>(NULL), false);
-    return;
-  }
-  cast_environment_->PostTask(
-      CastEnvironment::VIDEO, FROM_HERE,
-      base::Bind(&VideoDecoder::ImplBase::DecodeFrame, impl_,
-                 base::Passed(&encoded_frame), callback));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/receiver/video_decoder.h b/src/cobalt/media/cast/receiver/video_decoder.h
deleted file mode 100644
index e3bcd17..0000000
--- a/src/cobalt/media/cast/receiver/video_decoder.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_RECEIVER_VIDEO_DECODER_H_
-#define COBALT_MEDIA_CAST_RECEIVER_VIDEO_DECODER_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "media/base/video_frame.h"
-#include "media/cast/constants.h"
-#include "media/cast/net/cast_transport_config.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class CastEnvironment;
-
-class VideoDecoder {
- public:
-  // Callback passed to DecodeFrame, to deliver a decoded video frame from the
-  // decoder.  |frame| can be NULL when errors occur.  |is_continuous| is
-  // normally true, but will be false if the decoder has detected a frame skip
-  // since the last decode operation; and the client might choose to take steps
-  // to smooth/interpolate video discontinuities in this case.
-  typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame,
-                              bool is_continuous)> DecodeFrameCallback;
-
-  VideoDecoder(const scoped_refptr<CastEnvironment>& cast_environment,
-               Codec codec);
-  virtual ~VideoDecoder();
-
-  // Returns STATUS_INITIALIZED if the decoder was successfully constructed.  If
-  // this method returns any other value, calls to DecodeFrame() will not
-  // succeed.
-  OperationalStatus InitializationResult() const;
-
-  // Decode the payload in |encoded_frame| asynchronously.  |callback| will be
-  // invoked on the CastEnvironment::MAIN thread with the result.
-  //
-  // In the normal case, |encoded_frame->frame_id| will be
-  // monotonically-increasing by 1 for each successive call to this method.
-  // When it is not, the decoder will assume one or more frames have been
-  // dropped (e.g., due to packet loss), and will perform recovery actions.
-  void DecodeFrame(std::unique_ptr<EncodedFrame> encoded_frame,
-                   const DecodeFrameCallback& callback);
-
- private:
-  class FakeImpl;
-  class ImplBase;
-  class Vp8Impl;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  scoped_refptr<ImplBase> impl_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoDecoder);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_RECEIVER_VIDEO_DECODER_H_
diff --git a/src/cobalt/media/cast/receiver/video_decoder_unittest.cc b/src/cobalt/media/cast/receiver/video_decoder_unittest.cc
deleted file mode 100644
index 779ea2f..0000000
--- a/src/cobalt/media/cast/receiver/video_decoder_unittest.cc
+++ /dev/null
@@ -1,235 +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.
-
-#include <vector>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/macros.h"
-#include "base/synchronization/condition_variable.h"
-#include "base/synchronization/lock.h"
-#include "base/time/time.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/receiver/video_decoder.h"
-#include "media/cast/sender/sender_encoded_frame.h"
-#include "media/cast/sender/vp8_encoder.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/standalone_cast_environment.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-const int kStartingWidth = 360;
-const int kStartingHeight = 240;
-const int kFrameRate = 10;
-
-FrameSenderConfig GetVideoSenderConfigForTest() {
-  FrameSenderConfig config = GetDefaultVideoSenderConfig();
-  config.max_frame_rate = kFrameRate;
-  return config;
-}
-
-}  // namespace
-
-class VideoDecoderTest : public ::testing::TestWithParam<Codec> {
- public:
-  VideoDecoderTest()
-      : cast_environment_(new StandaloneCastEnvironment()),
-        vp8_encoder_(GetVideoSenderConfigForTest()),
-        cond_(&lock_) {
-    vp8_encoder_.Initialize();
-  }
-
-  virtual ~VideoDecoderTest() {
-    // Make sure all threads have stopped before the environment goes away.
-    cast_environment_->Shutdown();
-  }
-
- protected:
-  void SetUp() final {
-    video_decoder_.reset(new VideoDecoder(cast_environment_, GetParam()));
-    CHECK_EQ(STATUS_INITIALIZED, video_decoder_->InitializationResult());
-
-    next_frame_size_ = gfx::Size(kStartingWidth, kStartingHeight);
-    next_frame_timestamp_ = base::TimeDelta();
-    last_frame_id_ = FrameId::first();
-    seen_a_decoded_frame_ = false;
-
-    total_video_frames_feed_in_ = 0;
-    total_video_frames_decoded_ = 0;
-  }
-
-  void SetNextFrameSize(const gfx::Size& size) { next_frame_size_ = size; }
-
-  // Called from the unit test thread to create another EncodedFrame and push it
-  // into the decoding pipeline.
-  void FeedMoreVideo(int num_dropped_frames) {
-    DCHECK(!cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-    // Prepare a simulated VideoFrame to feed into the VideoEncoder.
-    const scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateFrame(
-        PIXEL_FORMAT_YV12, next_frame_size_, gfx::Rect(next_frame_size_),
-        next_frame_size_, next_frame_timestamp_);
-    const base::TimeTicks reference_time =
-        base::TimeTicks::UnixEpoch() + next_frame_timestamp_;
-    next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate;
-    PopulateVideoFrame(video_frame.get(), 0);
-
-    // Encode |frame| into |encoded_frame->data|.
-    std::unique_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame());
-    // Test only supports VP8, currently.
-    CHECK_EQ(CODEC_VIDEO_VP8, GetParam());
-    vp8_encoder_.Encode(video_frame, reference_time, encoded_frame.get());
-    // Rewrite frame IDs for testing purposes.
-    encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames;
-    if (encoded_frame->dependency == EncodedFrame::KEY)
-      encoded_frame->referenced_frame_id = encoded_frame->frame_id;
-    else
-      encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
-    last_frame_id_ = encoded_frame->frame_id;
-    ASSERT_EQ(reference_time, encoded_frame->reference_time);
-
-    ++total_video_frames_feed_in_;
-
-    // Post a task to decode the encoded frame.
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(&VideoDecoder::DecodeFrame,
-                   base::Unretained(video_decoder_.get()),
-                   base::Passed(&encoded_frame),
-                   base::Bind(&VideoDecoderTest::OnDecodedFrame,
-                              base::Unretained(this), video_frame,
-                              num_dropped_frames == 0)));
-  }
-
-  // Blocks the caller until all video that has been feed in has been decoded.
-  void WaitForAllVideoToBeDecoded() {
-    DCHECK(!cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-    base::AutoLock auto_lock(lock_);
-    while (total_video_frames_decoded_ < total_video_frames_feed_in_)
-      cond_.Wait();
-    EXPECT_EQ(total_video_frames_feed_in_, total_video_frames_decoded_);
-  }
-
- private:
-  // Called by |vp8_decoder_| to deliver each frame of decoded video.
-  void OnDecodedFrame(const scoped_refptr<VideoFrame>& expected_video_frame,
-                      bool should_be_continuous,
-                      const scoped_refptr<VideoFrame>& video_frame,
-                      bool is_continuous) {
-    DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-    // A NULL |video_frame| indicates a decode error, which we don't expect.
-    ASSERT_TRUE(video_frame.get());
-
-    // Did the decoder detect whether frames were dropped?
-    EXPECT_EQ(should_be_continuous, is_continuous);
-
-    // Does the video data seem to be intact?
-    EXPECT_EQ(expected_video_frame->coded_size().width(),
-              video_frame->coded_size().width());
-    EXPECT_EQ(expected_video_frame->coded_size().height(),
-              video_frame->coded_size().height());
-    EXPECT_LT(40.0, I420PSNR(expected_video_frame, video_frame));
-    // TODO(miu): Once we start using VideoFrame::timestamp_, check that here.
-
-    // Signal the main test thread that more video was decoded.
-    base::AutoLock auto_lock(lock_);
-    ++total_video_frames_decoded_;
-    cond_.Signal();
-  }
-
-  const scoped_refptr<StandaloneCastEnvironment> cast_environment_;
-  std::unique_ptr<VideoDecoder> video_decoder_;
-  gfx::Size next_frame_size_;
-  base::TimeDelta next_frame_timestamp_;
-  FrameId last_frame_id_;
-  bool seen_a_decoded_frame_;
-
-  Vp8Encoder vp8_encoder_;
-
-  // Unlike |total_video_frames_decoded_|, this is only read/written on a single
-  // thread.
-  int total_video_frames_feed_in_;
-
-  base::Lock lock_;
-  base::ConditionVariable cond_;
-  int total_video_frames_decoded_;  // Protected by |lock_|.
-
-  DISALLOW_COPY_AND_ASSIGN(VideoDecoderTest);
-};
-
-TEST_P(VideoDecoderTest, DecodesFrames) {
-  const int kNumFrames = 3;
-  for (int i = 0; i < kNumFrames; ++i) FeedMoreVideo(0);
-  WaitForAllVideoToBeDecoded();
-}
-
-TEST_P(VideoDecoderTest, RecoversFromDroppedFrames) {
-  // Feed 20 frames and expect 20 to be decoded.  At random points, drop one or
-  // more frames.
-  FeedMoreVideo(0);
-  FeedMoreVideo(2);  // Two frames dropped.
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(1);  // One frame dropped.
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(1);  // One frame dropped.
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(3);  // Three frames dropped.
-  FeedMoreVideo(0);
-  FeedMoreVideo(0);
-  FeedMoreVideo(10);  // Ten frames dropped.
-  FeedMoreVideo(0);
-  FeedMoreVideo(1);  // One frame dropped.
-  FeedMoreVideo(0);
-  WaitForAllVideoToBeDecoded();
-}
-
-TEST_P(VideoDecoderTest, DecodesFramesOfVaryingSizes) {
-  std::vector<gfx::Size> frame_sizes;
-  frame_sizes.push_back(gfx::Size(128, 72));
-  frame_sizes.push_back(gfx::Size(64, 36));    // Shrink both dimensions.
-  frame_sizes.push_back(gfx::Size(30, 20));    // Shrink both dimensions again.
-  frame_sizes.push_back(gfx::Size(20, 30));    // Same area.
-  frame_sizes.push_back(gfx::Size(60, 40));    // Grow both dimensions.
-  frame_sizes.push_back(gfx::Size(58, 40));    // Shrink only one dimension.
-  frame_sizes.push_back(gfx::Size(58, 38));    // Shrink the other dimension.
-  frame_sizes.push_back(gfx::Size(32, 18));    // Shrink both dimensions again.
-  frame_sizes.push_back(gfx::Size(34, 18));    // Grow only one dimension.
-  frame_sizes.push_back(gfx::Size(34, 20));    // Grow the other dimension.
-  frame_sizes.push_back(gfx::Size(192, 108));  // Grow both dimensions again.
-
-  // Encode one frame at each size.
-  for (const auto& frame_size : frame_sizes) {
-    SetNextFrameSize(frame_size);
-    FeedMoreVideo(0);
-  }
-
-  // Encode 3 frames at each size.
-  for (const auto& frame_size : frame_sizes) {
-    SetNextFrameSize(frame_size);
-    const int kNumFrames = 3;
-    for (int i = 0; i < kNumFrames; ++i) FeedMoreVideo(0);
-  }
-
-  WaitForAllVideoToBeDecoded();
-}
-
-INSTANTIATE_TEST_CASE_P(, VideoDecoderTest, ::testing::Values(CODEC_VIDEO_VP8));
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/audio_encoder.cc b/src/cobalt/media/cast/sender/audio_encoder.cc
deleted file mode 100644
index 98a3f46..0000000
--- a/src/cobalt/media/cast/sender/audio_encoder.cc
+++ /dev/null
@@ -1,776 +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.
-
-#include "media/cast/sender/audio_encoder.h"
-
-#include <algorithm>
-#include <limits>
-#include <string>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/location.h"
-#include "base/macros.h"
-#include "base/stl_util.h"
-#include "base/sys_byteorder.h"
-#include "base/time/time.h"
-#include "base/trace_event/trace_event.h"
-#include "build/build_config.h"
-#include "media/base/audio_sample_types.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/constants.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-
-#if !defined(OS_IOS)
-#include "third_party/opus/src/include/opus.h"
-#endif
-
-#if defined(OS_MACOSX)
-#include <AudioToolbox/AudioToolbox.h>
-#endif
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-const int kUnderrunSkipThreshold = 3;
-const int kDefaultFramesPerSecond = 100;
-
-}  // namespace
-
-// Base class that handles the common problem of feeding one or more AudioBus'
-// data into a buffer and then, once the buffer is full, encoding the signal and
-// emitting a SenderEncodedFrame via the FrameEncodedCallback.
-//
-// Subclasses complete the implementation by handling the actual encoding
-// details.
-class AudioEncoder::ImplBase
-    : public base::RefCountedThreadSafe<AudioEncoder::ImplBase> {
- public:
-  ImplBase(const scoped_refptr<CastEnvironment>& cast_environment, Codec codec,
-           int num_channels, int sampling_rate, int samples_per_frame,
-           const FrameEncodedCallback& callback)
-      : cast_environment_(cast_environment),
-        codec_(codec),
-        num_channels_(num_channels),
-        samples_per_frame_(samples_per_frame),
-        callback_(callback),
-        operational_status_(STATUS_UNINITIALIZED),
-        frame_duration_(base::TimeDelta::FromMicroseconds(
-            base::Time::kMicrosecondsPerSecond * samples_per_frame_ /
-            sampling_rate)),
-        buffer_fill_end_(0),
-        frame_id_(FrameId::first()),
-        samples_dropped_from_buffer_(0) {
-    // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration.
-    const int kMaxSamplesTimesChannelsPerFrame = 48 * 2 * 100;
-    if (num_channels_ <= 0 || samples_per_frame_ <= 0 ||
-        frame_duration_.is_zero() ||
-        samples_per_frame_ * num_channels_ > kMaxSamplesTimesChannelsPerFrame) {
-      operational_status_ = STATUS_INVALID_CONFIGURATION;
-    }
-  }
-
-  OperationalStatus InitializationResult() const { return operational_status_; }
-
-  int samples_per_frame() const { return samples_per_frame_; }
-
-  base::TimeDelta frame_duration() const { return frame_duration_; }
-
-  void EncodeAudio(std::unique_ptr<AudioBus> audio_bus,
-                   const base::TimeTicks& recorded_time) {
-    DCHECK_EQ(operational_status_, STATUS_INITIALIZED);
-    DCHECK(!recorded_time.is_null());
-
-    // Determine whether |recorded_time| is consistent with the amount of audio
-    // data having been processed in the past.  Resolve the underrun problem by
-    // dropping data from the internal buffer and skipping ahead the next
-    // frame's RTP timestamp by the estimated number of frames missed.  On the
-    // other hand, don't attempt to resolve overruns: A receiver should
-    // gracefully deal with an excess of audio data.
-    base::TimeDelta buffer_fill_duration =
-        buffer_fill_end_ * frame_duration_ / samples_per_frame_;
-    if (!frame_capture_time_.is_null()) {
-      const base::TimeDelta amount_ahead_by =
-          recorded_time - (frame_capture_time_ + buffer_fill_duration);
-      const int64_t num_frames_missed = amount_ahead_by / frame_duration_;
-      if (num_frames_missed > kUnderrunSkipThreshold) {
-        samples_dropped_from_buffer_ += buffer_fill_end_;
-        buffer_fill_end_ = 0;
-        buffer_fill_duration = base::TimeDelta();
-        frame_rtp_timestamp_ +=
-            RtpTimeDelta::FromTicks(num_frames_missed * samples_per_frame_);
-        DVLOG(1) << "Skipping RTP timestamp ahead to account for "
-                 << num_frames_missed * samples_per_frame_
-                 << " samples' worth of underrun.";
-        TRACE_EVENT_INSTANT2("cast.stream", "Audio Skip",
-                             TRACE_EVENT_SCOPE_THREAD, "frames missed",
-                             num_frames_missed, "samples dropped",
-                             samples_dropped_from_buffer_);
-      }
-    }
-    frame_capture_time_ = recorded_time - buffer_fill_duration;
-
-    // Encode all audio in |audio_bus| into zero or more frames.
-    int src_pos = 0;
-    while (src_pos < audio_bus->frames()) {
-      // Note: This is used to compute the encoder utilization and so it uses
-      // the real-world clock instead of the CastEnvironment clock, the latter
-      // of which might be simulated.
-      const base::TimeTicks start_time = base::TimeTicks::Now();
-
-      const int num_samples_to_xfer = std::min(
-          samples_per_frame_ - buffer_fill_end_, audio_bus->frames() - src_pos);
-      DCHECK_EQ(audio_bus->channels(), num_channels_);
-      TransferSamplesIntoBuffer(audio_bus.get(), src_pos, buffer_fill_end_,
-                                num_samples_to_xfer);
-      src_pos += num_samples_to_xfer;
-      buffer_fill_end_ += num_samples_to_xfer;
-
-      if (buffer_fill_end_ < samples_per_frame_) break;
-
-      std::unique_ptr<SenderEncodedFrame> audio_frame(new SenderEncodedFrame());
-      audio_frame->dependency = EncodedFrame::KEY;
-      audio_frame->frame_id = frame_id_;
-      audio_frame->referenced_frame_id = frame_id_;
-      audio_frame->rtp_timestamp = frame_rtp_timestamp_;
-      audio_frame->reference_time = frame_capture_time_;
-
-      TRACE_EVENT_ASYNC_BEGIN2("cast.stream", "Audio Encode", audio_frame.get(),
-                               "frame_id", frame_id_.lower_32_bits(),
-                               "rtp_timestamp",
-                               frame_rtp_timestamp_.lower_32_bits());
-      if (EncodeFromFilledBuffer(&audio_frame->data)) {
-        // Compute encoder utilization as the real-world time elapsed divided
-        // by the signal duration.
-        audio_frame->encoder_utilization =
-            (base::TimeTicks::Now() - start_time).InSecondsF() /
-            frame_duration_.InSecondsF();
-
-        TRACE_EVENT_ASYNC_END1("cast.stream", "Audio Encode", audio_frame.get(),
-                               "encoder_utilization",
-                               audio_frame->encoder_utilization);
-
-        audio_frame->encode_completion_time =
-            cast_environment_->Clock()->NowTicks();
-        cast_environment_->PostTask(
-            CastEnvironment::MAIN, FROM_HERE,
-            base::Bind(callback_, base::Passed(&audio_frame),
-                       samples_dropped_from_buffer_));
-        samples_dropped_from_buffer_ = 0;
-      }
-
-      // Reset the internal buffer, frame ID, and timestamps for the next frame.
-      buffer_fill_end_ = 0;
-      ++frame_id_;
-      frame_rtp_timestamp_ += RtpTimeDelta::FromTicks(samples_per_frame_);
-      frame_capture_time_ += frame_duration_;
-    }
-  }
-
- protected:
-  friend class base::RefCountedThreadSafe<ImplBase>;
-  virtual ~ImplBase() {}
-
-  virtual void TransferSamplesIntoBuffer(const AudioBus* audio_bus,
-                                         int source_offset,
-                                         int buffer_fill_offset,
-                                         int num_samples) = 0;
-  virtual bool EncodeFromFilledBuffer(std::string* out) = 0;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const Codec codec_;
-  const int num_channels_;
-  const int samples_per_frame_;
-  const FrameEncodedCallback callback_;
-
-  // Subclass' ctor is expected to set this to STATUS_INITIALIZED.
-  OperationalStatus operational_status_;
-
-  // The duration of one frame of encoded audio samples. Derived from
-  // |samples_per_frame_| and the sampling rate.
-  const base::TimeDelta frame_duration_;
-
- private:
-  // In the case where a call to EncodeAudio() cannot completely fill the
-  // buffer, this points to the position at which to populate data in a later
-  // call.
-  int buffer_fill_end_;
-
-  // A counter used to label EncodedFrames.
-  FrameId frame_id_;
-
-  // The RTP timestamp for the next frame of encoded audio.  This is defined as
-  // the number of audio samples encoded so far, plus the estimated number of
-  // samples that were missed due to data underruns.  A receiver uses this value
-  // to detect gaps in the audio signal data being provided.
-  RtpTimeTicks frame_rtp_timestamp_;
-
-  // The local system time associated with the start of the next frame of
-  // encoded audio.  This value is passed on to a receiver as a reference clock
-  // timestamp for the purposes of synchronizing audio and video.  Its
-  // progression is expected to drift relative to the elapsed time implied by
-  // the RTP timestamps.
-  base::TimeTicks frame_capture_time_;
-
-  // Set to non-zero to indicate the next output frame skipped over audio
-  // samples in order to recover from an input underrun.
-  int samples_dropped_from_buffer_;
-
-  DISALLOW_COPY_AND_ASSIGN(ImplBase);
-};
-
-#if !defined(OS_IOS)
-class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase {
- public:
-  OpusImpl(const scoped_refptr<CastEnvironment>& cast_environment,
-           int num_channels, int sampling_rate, int bitrate,
-           const FrameEncodedCallback& callback)
-      : ImplBase(cast_environment, CODEC_AUDIO_OPUS, num_channels,
-                 sampling_rate,
-                 sampling_rate / kDefaultFramesPerSecond, /* 10 ms frames */
-                 callback),
-        encoder_memory_(new uint8_t[opus_encoder_get_size(num_channels)]),
-        opus_encoder_(reinterpret_cast<OpusEncoder*>(encoder_memory_.get())),
-        buffer_(new float[num_channels * samples_per_frame_]) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED ||
-        sampling_rate % samples_per_frame_ != 0 ||
-        !IsValidFrameDuration(frame_duration_)) {
-      return;
-    }
-    if (opus_encoder_init(opus_encoder_, sampling_rate, num_channels,
-                          OPUS_APPLICATION_AUDIO) != OPUS_OK) {
-      ImplBase::operational_status_ = STATUS_INVALID_CONFIGURATION;
-      return;
-    }
-    ImplBase::operational_status_ = STATUS_INITIALIZED;
-
-    if (bitrate <= 0) {
-      // Note: As of 2013-10-31, the encoder in "auto bitrate" mode would use a
-      // variable bitrate up to 102kbps for 2-channel, 48 kHz audio and a 10 ms
-      // frame size.  The opus library authors may, of course, adjust this in
-      // later versions.
-      bitrate = OPUS_AUTO;
-    }
-    CHECK_EQ(opus_encoder_ctl(opus_encoder_, OPUS_SET_BITRATE(bitrate)),
-             OPUS_OK);
-  }
-
- private:
-  ~OpusImpl() final {}
-
-  void TransferSamplesIntoBuffer(const AudioBus* audio_bus, int source_offset,
-                                 int buffer_fill_offset,
-                                 int num_samples) final {
-    DCHECK_EQ(audio_bus->channels(), num_channels_);
-    float* dest = buffer_.get() + (buffer_fill_offset * num_channels_);
-    audio_bus->ToInterleavedPartial<Float32SampleTypeTraits>(source_offset,
-                                                             num_samples, dest);
-  }
-
-  bool EncodeFromFilledBuffer(std::string* out) final {
-    out->resize(kOpusMaxPayloadSize);
-    const opus_int32 result = opus_encode_float(
-        opus_encoder_, buffer_.get(), samples_per_frame_,
-        reinterpret_cast<uint8_t*>(base::string_as_array(out)),
-        kOpusMaxPayloadSize);
-    if (result > 1) {
-      out->resize(result);
-      return true;
-    } else if (result < 0) {
-      LOG(ERROR) << "Error code from opus_encode_float(): " << result;
-      return false;
-    } else {
-      // Do nothing: The documentation says that a return value of zero or
-      // one byte means the packet does not need to be transmitted.
-      return false;
-    }
-  }
-
-  static bool IsValidFrameDuration(base::TimeDelta duration) {
-    // See https://tools.ietf.org/html/rfc6716#section-2.1.4
-    return duration == base::TimeDelta::FromMicroseconds(2500) ||
-           duration == base::TimeDelta::FromMilliseconds(5) ||
-           duration == base::TimeDelta::FromMilliseconds(10) ||
-           duration == base::TimeDelta::FromMilliseconds(20) ||
-           duration == base::TimeDelta::FromMilliseconds(40) ||
-           duration == base::TimeDelta::FromMilliseconds(60);
-  }
-
-  const std::unique_ptr<uint8_t[]> encoder_memory_;
-  OpusEncoder* const opus_encoder_;
-  const std::unique_ptr<float[]> buffer_;
-
-  // This is the recommended value, according to documentation in
-  // third_party/opus/src/include/opus.h, so that the Opus encoder does not
-  // degrade the audio due to memory constraints.
-  //
-  // Note: Whereas other RTP implementations do not, the cast library is
-  // perfectly capable of transporting larger than MTU-sized audio frames.
-  static const int kOpusMaxPayloadSize = 4000;
-
-  DISALLOW_COPY_AND_ASSIGN(OpusImpl);
-};
-#endif
-
-#if defined(OS_MACOSX)
-class AudioEncoder::AppleAacImpl : public AudioEncoder::ImplBase {
-  // AAC-LC has two access unit sizes (960 and 1024). The Apple encoder only
-  // supports the latter.
-  static const int kAccessUnitSamples = 1024;
-
-  // Size of an ADTS header (w/o checksum). See
-  // http://wiki.multimedia.cx/index.php?title=ADTS
-  static const int kAdtsHeaderSize = 7;
-
- public:
-  AppleAacImpl(const scoped_refptr<CastEnvironment>& cast_environment,
-               int num_channels, int sampling_rate, int bitrate,
-               const FrameEncodedCallback& callback)
-      : ImplBase(cast_environment, CODEC_AUDIO_AAC, num_channels, sampling_rate,
-                 kAccessUnitSamples, callback),
-        input_buffer_(AudioBus::Create(num_channels, kAccessUnitSamples)),
-        input_bus_(AudioBus::CreateWrapper(num_channels)),
-        max_access_unit_size_(0),
-        output_buffer_(nullptr),
-        converter_(nullptr),
-        file_(nullptr),
-        num_access_units_(0) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) {
-      return;
-    }
-    if (!Initialize(sampling_rate, bitrate)) {
-      ImplBase::operational_status_ = STATUS_INVALID_CONFIGURATION;
-      return;
-    }
-    ImplBase::operational_status_ = STATUS_INITIALIZED;
-  }
-
- private:
-  ~AppleAacImpl() final { Teardown(); }
-
-  // Destroys the existing audio converter and file, if any.
-  void Teardown() {
-    if (converter_) {
-      AudioConverterDispose(converter_);
-      converter_ = nullptr;
-    }
-    if (file_) {
-      AudioFileClose(file_);
-      file_ = nullptr;
-    }
-  }
-
-  // Initializes the audio converter and file. Calls Teardown to destroy any
-  // existing state. This is so that Initialize() may be called to setup another
-  // converter after a non-resumable interruption.
-  bool Initialize(int sampling_rate, int bitrate) {
-    // Teardown previous audio converter and file.
-    Teardown();
-
-    // Input data comes from AudioBus objects, which carry non-interleaved
-    // packed native-endian float samples. Note that in Core Audio, a frame is
-    // one sample across all channels at a given point in time. When describing
-    // a non-interleaved samples format, the "per frame" fields mean "per
-    // channel" or "per stream", with the exception of |mChannelsPerFrame|. For
-    // uncompressed formats, one packet contains one frame.
-    AudioStreamBasicDescription in_asbd;
-    in_asbd.mSampleRate = sampling_rate;
-    in_asbd.mFormatID = kAudioFormatLinearPCM;
-    in_asbd.mFormatFlags =
-        kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;
-    in_asbd.mChannelsPerFrame = num_channels_;
-    in_asbd.mBitsPerChannel = sizeof(float) * 8;
-    in_asbd.mFramesPerPacket = 1;
-    in_asbd.mBytesPerPacket = in_asbd.mBytesPerFrame = sizeof(float);
-    in_asbd.mReserved = 0;
-
-    // Request AAC-LC encoding, with no downmixing or downsampling.
-    AudioStreamBasicDescription out_asbd;
-    SbMemorySet(&out_asbd, 0, sizeof(AudioStreamBasicDescription));
-    out_asbd.mSampleRate = sampling_rate;
-    out_asbd.mFormatID = kAudioFormatMPEG4AAC;
-    out_asbd.mChannelsPerFrame = num_channels_;
-    UInt32 prop_size = sizeof(out_asbd);
-    if (AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, nullptr,
-                               &prop_size, &out_asbd) != noErr) {
-      return false;
-    }
-
-    if (AudioConverterNew(&in_asbd, &out_asbd, &converter_) != noErr) {
-      return false;
-    }
-
-    // The converter will fully specify the output format and update the
-    // relevant fields of the structure, which we can now query.
-    prop_size = sizeof(out_asbd);
-    if (AudioConverterGetProperty(converter_,
-                                  kAudioConverterCurrentOutputStreamDescription,
-                                  &prop_size, &out_asbd) != noErr) {
-      return false;
-    }
-
-    // If bitrate is <= 0, allow the encoder to pick a suitable value.
-    // Otherwise, set the bitrate (which can fail if the value is not suitable
-    // or compatible with the output sampling rate or channels).
-    if (bitrate > 0) {
-      prop_size = sizeof(int);
-      if (AudioConverterSetProperty(converter_, kAudioConverterEncodeBitRate,
-                                    prop_size, &bitrate) != noErr) {
-        return false;
-      }
-    }
-
-    // Figure out the maximum size of an access unit that the encoder can
-    // produce. |mBytesPerPacket| will be 0 for variable size configurations,
-    // in which case we must query the value.
-    uint32_t max_access_unit_size = out_asbd.mBytesPerPacket;
-    if (max_access_unit_size == 0) {
-      prop_size = sizeof(max_access_unit_size);
-      if (AudioConverterGetProperty(
-              converter_, kAudioConverterPropertyMaximumOutputPacketSize,
-              &prop_size, &max_access_unit_size) != noErr) {
-        return false;
-      }
-    }
-
-    // This is the only location where the implementation modifies
-    // |max_access_unit_size_|.
-    const_cast<uint32_t&>(max_access_unit_size_) = max_access_unit_size;
-
-    // Allocate a buffer to store one access unit. This is the only location
-    // where the implementation modifies |access_unit_buffer_|.
-    const_cast<std::unique_ptr<uint8_t[]>&>(access_unit_buffer_)
-        .reset(new uint8_t[max_access_unit_size]);
-
-    // Initialize the converter ABL. Note that the buffer size has to be set
-    // before every encode operation, since the field is modified to indicate
-    // the size of the output data (on input it indicates the buffer capacity).
-    converter_abl_.mNumberBuffers = 1;
-    converter_abl_.mBuffers[0].mNumberChannels = num_channels_;
-    converter_abl_.mBuffers[0].mData = access_unit_buffer_.get();
-
-    // The "magic cookie" is an encoder state vector required for decoding and
-    // packetization. It is queried now from |converter_| then set on |file_|
-    // after initialization.
-    UInt32 cookie_size;
-    if (AudioConverterGetPropertyInfo(converter_,
-                                      kAudioConverterCompressionMagicCookie,
-                                      &cookie_size, nullptr) != noErr) {
-      return false;
-    }
-    std::unique_ptr<uint8_t[]> cookie_data(new uint8_t[cookie_size]);
-    if (AudioConverterGetProperty(converter_,
-                                  kAudioConverterCompressionMagicCookie,
-                                  &cookie_size, cookie_data.get()) != noErr) {
-      return false;
-    }
-
-    if (AudioFileInitializeWithCallbacks(
-            this, &FileReadCallback, &FileWriteCallback, &FileGetSizeCallback,
-            &FileSetSizeCallback, kAudioFileAAC_ADTSType, &out_asbd, 0,
-            &file_) != noErr) {
-      return false;
-    }
-
-    if (AudioFileSetProperty(file_, kAudioFilePropertyMagicCookieData,
-                             cookie_size, cookie_data.get()) != noErr) {
-      return false;
-    }
-
-    // Initially the input bus points to the input buffer. See the comment on
-    // |input_bus_| for more on this optimization.
-    input_bus_->set_frames(kAccessUnitSamples);
-    for (int ch = 0; ch < input_buffer_->channels(); ++ch) {
-      input_bus_->SetChannelData(ch, input_buffer_->channel(ch));
-    }
-
-    return true;
-  }
-
-  void TransferSamplesIntoBuffer(const AudioBus* audio_bus, int source_offset,
-                                 int buffer_fill_offset,
-                                 int num_samples) final {
-    DCHECK_EQ(audio_bus->channels(), input_buffer_->channels());
-
-    // See the comment on |input_bus_| for more on this optimization. Note that
-    // we cannot elide the copy if the source offset would result in an
-    // unaligned pointer.
-    if (num_samples == kAccessUnitSamples &&
-        source_offset * sizeof(float) % AudioBus::kChannelAlignment == 0) {
-      DCHECK_EQ(buffer_fill_offset, 0);
-      for (int ch = 0; ch < audio_bus->channels(); ++ch) {
-        auto* samples = const_cast<float*>(audio_bus->channel(ch));
-        input_bus_->SetChannelData(ch, samples + source_offset);
-      }
-      return;
-    }
-
-    // Copy the samples into the input buffer.
-    DCHECK_EQ(input_bus_->channel(0), input_buffer_->channel(0));
-    audio_bus->CopyPartialFramesTo(source_offset, num_samples,
-                                   buffer_fill_offset, input_buffer_.get());
-  }
-
-  bool EncodeFromFilledBuffer(std::string* out) final {
-    // Reset the buffer size field to the buffer capacity.
-    converter_abl_.mBuffers[0].mDataByteSize = max_access_unit_size_;
-
-    // Encode the current input buffer. This is a sychronous call.
-    OSStatus oserr;
-    UInt32 io_num_packets = 1;
-    AudioStreamPacketDescription packet_description;
-    oserr = AudioConverterFillComplexBuffer(
-        converter_, &ConverterFillDataCallback, this, &io_num_packets,
-        &converter_abl_, &packet_description);
-    if (oserr != noErr || io_num_packets == 0) {
-      return false;
-    }
-
-    // Reserve space in the output buffer to write the packet.
-    out->reserve(packet_description.mDataByteSize + kAdtsHeaderSize);
-
-    // Set the current output buffer and emit an ADTS-wrapped AAC access unit.
-    // This is a synchronous call. After it returns, reset the output buffer.
-    output_buffer_ = out;
-    oserr = AudioFileWritePackets(
-        file_, false, converter_abl_.mBuffers[0].mDataByteSize,
-        &packet_description, num_access_units_, &io_num_packets,
-        converter_abl_.mBuffers[0].mData);
-    output_buffer_ = nullptr;
-    if (oserr != noErr || io_num_packets == 0) {
-      return false;
-    }
-    num_access_units_ += io_num_packets;
-    return true;
-  }
-
-  // The |AudioConverterFillComplexBuffer| input callback function. Configures
-  // the provided |AudioBufferList| to alias |input_bus_|. The implementation
-  // can only supply |kAccessUnitSamples| samples as a result of not copying
-  // samples or tracking read and write positions. Note that this function is
-  // called synchronously by |AudioConverterFillComplexBuffer|.
-  static OSStatus ConverterFillDataCallback(
-      AudioConverterRef in_converter, UInt32* io_num_packets,
-      AudioBufferList* io_data, AudioStreamPacketDescription** out_packet_desc,
-      void* in_encoder) {
-    DCHECK(in_encoder);
-    auto* encoder = reinterpret_cast<AppleAacImpl*>(in_encoder);
-    auto* input_buffer = encoder->input_buffer_.get();
-    auto* input_bus = encoder->input_bus_.get();
-
-    DCHECK_EQ(static_cast<int>(*io_num_packets), kAccessUnitSamples);
-    DCHECK_EQ(io_data->mNumberBuffers,
-              static_cast<unsigned>(input_bus->channels()));
-    for (int i_buf = 0, end = io_data->mNumberBuffers; i_buf < end; ++i_buf) {
-      io_data->mBuffers[i_buf].mNumberChannels = 1;
-      io_data->mBuffers[i_buf].mDataByteSize = sizeof(float) * *io_num_packets;
-      io_data->mBuffers[i_buf].mData = input_bus->channel(i_buf);
-
-      // Reset the input bus back to the input buffer. See the comment on
-      // |input_bus_| for more on this optimization.
-      input_bus->SetChannelData(i_buf, input_buffer->channel(i_buf));
-    }
-    return noErr;
-  }
-
-  // The AudioFile read callback function.
-  static OSStatus FileReadCallback(void* in_encoder, SInt64 in_position,
-                                   UInt32 in_size, void* in_buffer,
-                                   UInt32* out_size) {
-    // This class only does writing.
-    NOTREACHED();
-    return kAudioFileNotOpenError;
-  }
-
-  // The AudioFile write callback function. Appends the data to the encoder's
-  // current |output_buffer_|.
-  static OSStatus FileWriteCallback(void* in_encoder, SInt64 in_position,
-                                    UInt32 in_size, const void* in_buffer,
-                                    UInt32* out_size) {
-    DCHECK(in_encoder);
-    DCHECK(in_buffer);
-    auto* encoder = reinterpret_cast<const AppleAacImpl*>(in_encoder);
-    auto* buffer = reinterpret_cast<const std::string::value_type*>(in_buffer);
-
-    std::string* const output_buffer = encoder->output_buffer_;
-    DCHECK(output_buffer);
-
-    output_buffer->append(buffer, in_size);
-    *out_size = in_size;
-    return noErr;
-  }
-
-  // The AudioFile getsize callback function.
-  static SInt64 FileGetSizeCallback(void* in_encoder) {
-    // This class only does writing.
-    NOTREACHED();
-    return 0;
-  }
-
-  // The AudioFile setsize callback function.
-  static OSStatus FileSetSizeCallback(void* in_encoder, SInt64 in_size) {
-    return noErr;
-  }
-
-  // Buffer that holds one AAC access unit worth of samples. The input callback
-  // function provides samples from this buffer via |input_bus_| to the encoder.
-  const std::unique_ptr<AudioBus> input_buffer_;
-
-  // Wrapper AudioBus used by the input callback function. Normally it wraps
-  // |input_buffer_|. However, as an optimization when the client submits a
-  // buffer containing exactly one access unit worth of samples, the bus is
-  // redirected to the client buffer temporarily. We know that the base
-  // implementation will call us right after to encode the buffer and thus we
-  // can eliminate the copy into |input_buffer_|.
-  const std::unique_ptr<AudioBus> input_bus_;
-
-  // A buffer that holds one AAC access unit. Initialized in |Initialize| once
-  // the maximum access unit size is known.
-  const std::unique_ptr<uint8_t[]> access_unit_buffer_;
-
-  // The maximum size of an access unit that the encoder can emit.
-  const uint32_t max_access_unit_size_;
-
-  // A temporary pointer to the current output buffer. Only non-null when
-  // writing an access unit. Accessed by the AudioFile write callback function.
-  std::string* output_buffer_;
-
-  // The |AudioConverter| is responsible for AAC encoding. This is a Core Audio
-  // object, not to be confused with |media::AudioConverter|.
-  AudioConverterRef converter_;
-
-  // The |AudioFile| is responsible for ADTS packetization.
-  AudioFileID file_;
-
-  // An |AudioBufferList| passed to the converter to store encoded samples.
-  AudioBufferList converter_abl_;
-
-  // The number of access units emitted so far by the encoder.
-  uint64_t num_access_units_;
-
-  DISALLOW_COPY_AND_ASSIGN(AppleAacImpl);
-};
-#endif  // defined(OS_MACOSX)
-
-class AudioEncoder::Pcm16Impl : public AudioEncoder::ImplBase {
- public:
-  Pcm16Impl(const scoped_refptr<CastEnvironment>& cast_environment,
-            int num_channels, int sampling_rate,
-            const FrameEncodedCallback& callback)
-      : ImplBase(cast_environment, CODEC_AUDIO_PCM16, num_channels,
-                 sampling_rate,
-                 sampling_rate / kDefaultFramesPerSecond, /* 10 ms frames */
-                 callback),
-        buffer_(new int16_t[num_channels * samples_per_frame_]) {
-    if (ImplBase::operational_status_ != STATUS_UNINITIALIZED) return;
-    operational_status_ = STATUS_INITIALIZED;
-  }
-
- private:
-  ~Pcm16Impl() final {}
-
-  void TransferSamplesIntoBuffer(const AudioBus* audio_bus, int source_offset,
-                                 int buffer_fill_offset,
-                                 int num_samples) final {
-    audio_bus->ToInterleavedPartial(
-        source_offset, num_samples, sizeof(int16_t),
-        buffer_.get() + buffer_fill_offset * num_channels_);
-  }
-
-  bool EncodeFromFilledBuffer(std::string* out) final {
-    // Output 16-bit PCM integers in big-endian byte order.
-    out->resize(num_channels_ * samples_per_frame_ * sizeof(int16_t));
-    const int16_t* src = buffer_.get();
-    const int16_t* const src_end = src + num_channels_ * samples_per_frame_;
-    uint16_t* dest = reinterpret_cast<uint16_t*>(&out->at(0));
-    for (; src < src_end; ++src, ++dest) *dest = base::HostToNet16(*src);
-    return true;
-  }
-
- private:
-  const std::unique_ptr<int16_t[]> buffer_;
-
-  DISALLOW_COPY_AND_ASSIGN(Pcm16Impl);
-};
-
-AudioEncoder::AudioEncoder(
-    const scoped_refptr<CastEnvironment>& cast_environment, int num_channels,
-    int sampling_rate, int bitrate, Codec codec,
-    const FrameEncodedCallback& frame_encoded_callback)
-    : cast_environment_(cast_environment) {
-  // Note: It doesn't matter which thread constructs AudioEncoder, just so long
-  // as all calls to InsertAudio() are by the same thread.
-  insert_thread_checker_.DetachFromThread();
-  switch (codec) {
-#if !defined(OS_IOS)
-    case CODEC_AUDIO_OPUS:
-      impl_ = new OpusImpl(cast_environment, num_channels, sampling_rate,
-                           bitrate, frame_encoded_callback);
-      break;
-#endif
-#if defined(OS_MACOSX)
-    case CODEC_AUDIO_AAC:
-      impl_ = new AppleAacImpl(cast_environment, num_channels, sampling_rate,
-                               bitrate, frame_encoded_callback);
-      break;
-#endif  // defined(OS_MACOSX)
-    case CODEC_AUDIO_PCM16:
-      impl_ = new Pcm16Impl(cast_environment, num_channels, sampling_rate,
-                            frame_encoded_callback);
-      break;
-    default:
-      NOTREACHED() << "Unsupported or unspecified codec for audio encoder";
-      break;
-  }
-}
-
-AudioEncoder::~AudioEncoder() {}
-
-OperationalStatus AudioEncoder::InitializationResult() const {
-  DCHECK(insert_thread_checker_.CalledOnValidThread());
-  if (impl_.get()) {
-    return impl_->InitializationResult();
-  }
-  return STATUS_UNSUPPORTED_CODEC;
-}
-
-int AudioEncoder::GetSamplesPerFrame() const {
-  DCHECK(insert_thread_checker_.CalledOnValidThread());
-  if (InitializationResult() != STATUS_INITIALIZED) {
-    NOTREACHED();
-    return std::numeric_limits<int>::max();
-  }
-  return impl_->samples_per_frame();
-}
-
-base::TimeDelta AudioEncoder::GetFrameDuration() const {
-  DCHECK(insert_thread_checker_.CalledOnValidThread());
-  if (InitializationResult() != STATUS_INITIALIZED) {
-    NOTREACHED();
-    return base::TimeDelta();
-  }
-  return impl_->frame_duration();
-}
-
-void AudioEncoder::InsertAudio(std::unique_ptr<AudioBus> audio_bus,
-                               const base::TimeTicks& recorded_time) {
-  DCHECK(insert_thread_checker_.CalledOnValidThread());
-  DCHECK(audio_bus.get());
-  if (InitializationResult() != STATUS_INITIALIZED) {
-    NOTREACHED();
-    return;
-  }
-  cast_environment_->PostTask(
-      CastEnvironment::AUDIO, FROM_HERE,
-      base::Bind(&AudioEncoder::ImplBase::EncodeAudio, impl_,
-                 base::Passed(&audio_bus), recorded_time));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/audio_encoder.h b/src/cobalt/media/cast/sender/audio_encoder.h
deleted file mode 100644
index 6cf4d77..0000000
--- a/src/cobalt/media/cast/sender/audio_encoder.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_AUDIO_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_AUDIO_ENCODER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/threading/thread_checker.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/sender/sender_encoded_frame.h"
-
-namespace base {
-class TimeTicks;
-}
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class AudioEncoder {
- public:
-  // Callback to deliver each SenderEncodedFrame, plus the number of audio
-  // samples skipped since the last frame.
-  using FrameEncodedCallback =
-      base::Callback<void(std::unique_ptr<SenderEncodedFrame>, int)>;
-
-  AudioEncoder(const scoped_refptr<CastEnvironment>& cast_environment,
-               int num_channels, int sampling_rate, int bitrate, Codec codec,
-               const FrameEncodedCallback& frame_encoded_callback);
-  virtual ~AudioEncoder();
-
-  OperationalStatus InitializationResult() const;
-
-  int GetSamplesPerFrame() const;
-  base::TimeDelta GetFrameDuration() const;
-
-  void InsertAudio(std::unique_ptr<AudioBus> audio_bus,
-                   const base::TimeTicks& recorded_time);
-
- private:
-  class ImplBase;
-  class OpusImpl;
-  class Pcm16Impl;
-  class AppleAacImpl;
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  scoped_refptr<ImplBase> impl_;
-
-  // Used to ensure only one thread invokes InsertAudio().
-  base::ThreadChecker insert_thread_checker_;
-
-  DISALLOW_COPY_AND_ASSIGN(AudioEncoder);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_AUDIO_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/audio_encoder_unittest.cc b/src/cobalt/media/cast/sender/audio_encoder_unittest.cc
deleted file mode 100644
index 5595a52..0000000
--- a/src/cobalt/media/cast/sender/audio_encoder_unittest.cc
+++ /dev/null
@@ -1,243 +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.
-
-#include "media/cast/sender/audio_encoder.h"
-
-#include <memory>
-#include <sstream>
-#include <string>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/macros.h"
-#include "build/build_config.h"
-#include "media/base/audio_bus.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/media.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-static const int kNumChannels = 2;
-
-namespace {
-
-class TestEncodedAudioFrameReceiver {
- public:
-  TestEncodedAudioFrameReceiver() : frames_received_(0) {}
-  virtual ~TestEncodedAudioFrameReceiver() {}
-
-  int frames_received() const { return frames_received_; }
-
-  void SetCaptureTimeBounds(const base::TimeTicks& lower_bound,
-                            const base::TimeTicks& upper_bound) {
-    lower_bound_ = lower_bound;
-    upper_bound_ = upper_bound;
-  }
-
-  void SetSamplesPerFrame(int samples_per_frame) {
-    samples_per_frame_ = samples_per_frame;
-  }
-
-  void FrameEncoded(std::unique_ptr<SenderEncodedFrame> encoded_frame,
-                    int samples_skipped) {
-    EXPECT_EQ(encoded_frame->dependency, EncodedFrame::KEY);
-    EXPECT_EQ(frames_received_, encoded_frame->frame_id - FrameId::first());
-    EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id);
-    // RTP timestamps should be monotonically increasing and integer multiples
-    // of the fixed frame size.
-    EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp);
-    rtp_lower_bound_ = encoded_frame->rtp_timestamp;
-    EXPECT_EQ(RtpTimeDelta(), (encoded_frame->rtp_timestamp - RtpTimeTicks()) %
-                                  RtpTimeDelta::FromTicks(samples_per_frame_));
-    EXPECT_TRUE(!encoded_frame->data.empty());
-
-    EXPECT_LE(lower_bound_, encoded_frame->reference_time);
-    lower_bound_ = encoded_frame->reference_time;
-    EXPECT_GT(upper_bound_, encoded_frame->reference_time);
-
-    EXPECT_LE(0.0, encoded_frame->encoder_utilization);
-    EXPECT_EQ(-1.0, encoded_frame->lossy_utilization);
-
-    ++frames_received_;
-  }
-
- private:
-  int frames_received_;
-  RtpTimeTicks rtp_lower_bound_;
-  int samples_per_frame_;
-  base::TimeTicks lower_bound_;
-  base::TimeTicks upper_bound_;
-
-  DISALLOW_COPY_AND_ASSIGN(TestEncodedAudioFrameReceiver);
-};
-
-struct TestScenario {
-  const int64_t* durations_in_ms;
-  size_t num_durations;
-
-  TestScenario(const int64_t* d, size_t n)
-      : durations_in_ms(d), num_durations(n) {}
-
-  std::string ToString() const {
-    std::ostringstream out;
-    for (size_t i = 0; i < num_durations; ++i) {
-      if (i > 0) out << ", ";
-      out << durations_in_ms[i];
-    }
-    return out.str();
-  }
-};
-
-}  // namespace
-
-class AudioEncoderTest : public ::testing::TestWithParam<TestScenario> {
- public:
-  AudioEncoderTest() {
-    InitializeMediaLibrary();
-    testing_clock_ = new base::SimpleTestTickClock();
-    testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
-  }
-
-  void SetUp() final {
-    task_runner_ = new FakeSingleThreadTaskRunner(testing_clock_);
-    cast_environment_ =
-        new CastEnvironment(std::unique_ptr<base::TickClock>(testing_clock_),
-                            task_runner_, task_runner_, task_runner_);
-  }
-
-  virtual ~AudioEncoderTest() {}
-
-  void RunTestForCodec(Codec codec) {
-    const TestScenario& scenario = GetParam();
-    SCOPED_TRACE(::testing::Message() << "Durations: " << scenario.ToString());
-
-    CreateObjectsForCodec(codec);
-
-    const base::TimeDelta frame_duration = audio_encoder_->GetFrameDuration();
-
-    for (size_t i = 0; i < scenario.num_durations; ++i) {
-      const bool simulate_missing_data = scenario.durations_in_ms[i] < 0;
-      const base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
-          std::abs(scenario.durations_in_ms[i]));
-      receiver_->SetCaptureTimeBounds(
-          testing_clock_->NowTicks() - frame_duration,
-          testing_clock_->NowTicks() + duration);
-      if (simulate_missing_data) {
-        task_runner_->RunTasks();
-        testing_clock_->Advance(duration);
-      } else {
-        audio_encoder_->InsertAudio(audio_bus_factory_->NextAudioBus(duration),
-                                    testing_clock_->NowTicks());
-        task_runner_->RunTasks();
-        testing_clock_->Advance(duration);
-      }
-    }
-
-    DVLOG(1) << "Received " << receiver_->frames_received()
-             << " frames for this test run: " << scenario.ToString();
-  }
-
- private:
-  void CreateObjectsForCodec(Codec codec) {
-    audio_bus_factory_.reset(
-        new TestAudioBusFactory(kNumChannels, kDefaultAudioSamplingRate,
-                                TestAudioBusFactory::kMiddleANoteFreq, 0.5f));
-
-    receiver_.reset(new TestEncodedAudioFrameReceiver());
-
-    audio_encoder_.reset(new AudioEncoder(
-        cast_environment_, kNumChannels, kDefaultAudioSamplingRate,
-        kDefaultAudioEncoderBitrate, codec,
-        base::Bind(&TestEncodedAudioFrameReceiver::FrameEncoded,
-                   base::Unretained(receiver_.get()))));
-
-    receiver_->SetSamplesPerFrame(audio_encoder_->GetSamplesPerFrame());
-  }
-
-  base::SimpleTestTickClock* testing_clock_;  // Owned by CastEnvironment.
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  std::unique_ptr<TestAudioBusFactory> audio_bus_factory_;
-  std::unique_ptr<TestEncodedAudioFrameReceiver> receiver_;
-  std::unique_ptr<AudioEncoder> audio_encoder_;
-  scoped_refptr<CastEnvironment> cast_environment_;
-
-  DISALLOW_COPY_AND_ASSIGN(AudioEncoderTest);
-};
-
-TEST_P(AudioEncoderTest, EncodeOpus) { RunTestForCodec(CODEC_AUDIO_OPUS); }
-
-TEST_P(AudioEncoderTest, EncodePcm16) { RunTestForCodec(CODEC_AUDIO_PCM16); }
-
-#if defined(OS_MACOSX)
-TEST_P(AudioEncoderTest, EncodeAac) { RunTestForCodec(CODEC_AUDIO_AAC); }
-#endif
-
-static const int64_t kOneCall_3Millis[] = {3};
-static const int64_t kOneCall_10Millis[] = {10};
-static const int64_t kOneCall_13Millis[] = {13};
-static const int64_t kOneCall_20Millis[] = {20};
-
-static const int64_t kTwoCalls_3Millis[] = {3, 3};
-static const int64_t kTwoCalls_10Millis[] = {10, 10};
-static const int64_t kTwoCalls_Mixed1[] = {3, 10};
-static const int64_t kTwoCalls_Mixed2[] = {10, 3};
-static const int64_t kTwoCalls_Mixed3[] = {3, 17};
-static const int64_t kTwoCalls_Mixed4[] = {17, 3};
-
-static const int64_t kManyCalls_3Millis[] = {3, 3, 3, 3, 3, 3, 3, 3,
-                                             3, 3, 3, 3, 3, 3, 3};
-static const int64_t kManyCalls_10Millis[] = {10, 10, 10, 10, 10, 10, 10, 10,
-                                              10, 10, 10, 10, 10, 10, 10};
-static const int64_t kManyCalls_Mixed1[] = {3,  10, 3,  10, 3,  10, 3,  10, 3,
-                                            10, 3,  10, 3,  10, 3,  10, 3,  10};
-static const int64_t kManyCalls_Mixed2[] = {10, 3, 10, 3, 10, 3, 10, 3, 10, 3,
-                                            10, 3, 10, 3, 10, 3, 10, 3, 10, 3};
-static const int64_t kManyCalls_Mixed3[] = {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8,
-                                            9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4};
-static const int64_t kManyCalls_Mixed4[] = {31, 4, 15, 9,  26, 53, 5,  8, 9,
-                                            7,  9, 32, 38, 4,  62, 64, 3};
-static const int64_t kManyCalls_Mixed5[] = {3, 14, 15, 9, 26, 53, 58, 9, 7,
-                                            9, 3,  23, 8, 4,  6,  2,  6, 43};
-
-static const int64_t kOneBigUnderrun[] = {10, 10, 10, 10, -1000, 10, 10, 10};
-static const int64_t kTwoBigUnderruns[] = {10, 10, 10,    10, -712, 10,
-                                           10, 10, -1311, 10, 10,   10};
-static const int64_t kMixedUnderruns[] = {31, -64, 4, 15, 9,  26, -53, 5,   8,
-                                          -9, 7,   9, 32, 38, -4, 62,  -64, 3};
-
-INSTANTIATE_TEST_CASE_P(
-    AudioEncoderTestScenarios, AudioEncoderTest,
-    ::testing::Values(
-        TestScenario(kOneCall_3Millis, arraysize(kOneCall_3Millis)),
-        TestScenario(kOneCall_10Millis, arraysize(kOneCall_10Millis)),
-        TestScenario(kOneCall_13Millis, arraysize(kOneCall_13Millis)),
-        TestScenario(kOneCall_20Millis, arraysize(kOneCall_20Millis)),
-        TestScenario(kTwoCalls_3Millis, arraysize(kTwoCalls_3Millis)),
-        TestScenario(kTwoCalls_10Millis, arraysize(kTwoCalls_10Millis)),
-        TestScenario(kTwoCalls_Mixed1, arraysize(kTwoCalls_Mixed1)),
-        TestScenario(kTwoCalls_Mixed2, arraysize(kTwoCalls_Mixed2)),
-        TestScenario(kTwoCalls_Mixed3, arraysize(kTwoCalls_Mixed3)),
-        TestScenario(kTwoCalls_Mixed4, arraysize(kTwoCalls_Mixed4)),
-        TestScenario(kManyCalls_3Millis, arraysize(kManyCalls_3Millis)),
-        TestScenario(kManyCalls_10Millis, arraysize(kManyCalls_10Millis)),
-        TestScenario(kManyCalls_Mixed1, arraysize(kManyCalls_Mixed1)),
-        TestScenario(kManyCalls_Mixed2, arraysize(kManyCalls_Mixed2)),
-        TestScenario(kManyCalls_Mixed3, arraysize(kManyCalls_Mixed3)),
-        TestScenario(kManyCalls_Mixed4, arraysize(kManyCalls_Mixed4)),
-        TestScenario(kManyCalls_Mixed5, arraysize(kManyCalls_Mixed5)),
-        TestScenario(kOneBigUnderrun, arraysize(kOneBigUnderrun)),
-        TestScenario(kTwoBigUnderruns, arraysize(kTwoBigUnderruns)),
-        TestScenario(kMixedUnderruns, arraysize(kMixedUnderruns))));
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/audio_sender.cc b/src/cobalt/media/cast/sender/audio_sender.cc
deleted file mode 100644
index 54ba404..0000000
--- a/src/cobalt/media/cast/sender/audio_sender.cc
+++ /dev/null
@@ -1,98 +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.
-
-#include "media/cast/sender/audio_sender.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/sender/audio_encoder.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
-                         const FrameSenderConfig& audio_config,
-                         const StatusChangeCallback& status_change_cb,
-                         CastTransport* const transport_sender)
-    : FrameSender(cast_environment, transport_sender, audio_config,
-                  NewFixedCongestionControl(audio_config.max_bitrate)),
-      samples_in_encoder_(0),
-      weak_factory_(this) {
-  if (!audio_config.use_external_encoder) {
-    audio_encoder_.reset(new AudioEncoder(
-        cast_environment, audio_config.channels, audio_config.rtp_timebase,
-        audio_config.max_bitrate, audio_config.codec,
-        base::Bind(&AudioSender::OnEncodedAudioFrame,
-                   weak_factory_.GetWeakPtr(), audio_config.max_bitrate)));
-  }
-
-  // AudioEncoder provides no operational status changes during normal use.
-  // Post a task now with its initialization result status to allow the client
-  // to start sending frames.
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(status_change_cb, audio_encoder_
-                                       ? audio_encoder_->InitializationResult()
-                                       : STATUS_INVALID_CONFIGURATION));
-
-  // The number of samples per encoded audio frame depends on the codec and its
-  // initialization parameters. Now that we have an encoder, we can calculate
-  // the maximum frame rate.
-  max_frame_rate_ =
-      audio_config.rtp_timebase / audio_encoder_->GetSamplesPerFrame();
-}
-
-AudioSender::~AudioSender() {}
-
-void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus,
-                              const base::TimeTicks& recorded_time) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  if (!audio_encoder_) {
-    NOTREACHED();
-    return;
-  }
-
-  const base::TimeDelta next_frame_duration =
-      RtpTimeDelta::FromTicks(audio_bus->frames()).ToTimeDelta(rtp_timebase());
-  if (ShouldDropNextFrame(next_frame_duration)) return;
-
-  samples_in_encoder_ += audio_bus->frames();
-
-  audio_encoder_->InsertAudio(std::move(audio_bus), recorded_time);
-}
-
-int AudioSender::GetNumberOfFramesInEncoder() const {
-  // Note: It's possible for a partial frame to be in the encoder, but returning
-  // the floor() is good enough for the "design limit" check in FrameSender.
-  return samples_in_encoder_ / audio_encoder_->GetSamplesPerFrame();
-}
-
-base::TimeDelta AudioSender::GetInFlightMediaDuration() const {
-  const int samples_in_flight =
-      samples_in_encoder_ +
-      GetUnacknowledgedFrameCount() * audio_encoder_->GetSamplesPerFrame();
-  return RtpTimeDelta::FromTicks(samples_in_flight).ToTimeDelta(rtp_timebase());
-}
-
-void AudioSender::OnEncodedAudioFrame(
-    int encoder_bitrate, std::unique_ptr<SenderEncodedFrame> encoded_frame,
-    int samples_skipped) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped;
-  DCHECK_GE(samples_in_encoder_, 0);
-
-  SendEncodedFrame(encoder_bitrate, std::move(encoded_frame));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/audio_sender.h b/src/cobalt/media/cast/sender/audio_sender.h
deleted file mode 100644
index e375280..0000000
--- a/src/cobalt/media/cast/sender/audio_sender.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_AUDIO_SENDER_H_
-#define COBALT_MEDIA_CAST_SENDER_AUDIO_SENDER_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/sender/frame_sender.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class AudioEncoder;
-
-// Not thread safe. Only called from the main cast thread.
-// This class owns all objects related to sending audio, objects that create RTP
-// packets, congestion control, audio encoder, parsing and sending of
-// RTCP packets.
-// Additionally it posts a bunch of delayed tasks to the main thread for various
-// timeouts.
-class AudioSender : public FrameSender,
-                    public base::NonThreadSafe,
-                    public base::SupportsWeakPtr<AudioSender> {
- public:
-  AudioSender(scoped_refptr<CastEnvironment> cast_environment,
-              const FrameSenderConfig& audio_config,
-              const StatusChangeCallback& status_change_cb,
-              CastTransport* const transport_sender);
-
-  ~AudioSender() final;
-
-  // Note: It is not guaranteed that |audio_frame| will actually be encoded and
-  // sent, if AudioSender detects too many frames in flight.  Therefore, clients
-  // should be careful about the rate at which this method is called.
-  void InsertAudio(std::unique_ptr<AudioBus> audio_bus,
-                   const base::TimeTicks& recorded_time);
-
- protected:
-  int GetNumberOfFramesInEncoder() const final;
-  base::TimeDelta GetInFlightMediaDuration() const final;
-
- private:
-  // Called by the |audio_encoder_| with the next EncodedFrame to send.
-  void OnEncodedAudioFrame(int encoder_bitrate,
-                           std::unique_ptr<SenderEncodedFrame> encoded_frame,
-                           int samples_skipped);
-
-  // Encodes AudioBuses into EncodedFrames.
-  std::unique_ptr<AudioEncoder> audio_encoder_;
-
-  // The number of audio samples enqueued in |audio_encoder_|.
-  int samples_in_encoder_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<AudioSender> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(AudioSender);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_AUDIO_SENDER_H_
diff --git a/src/cobalt/media/cast/sender/audio_sender_unittest.cc b/src/cobalt/media/cast/sender/audio_sender_unittest.cc
deleted file mode 100644
index 7af4486..0000000
--- a/src/cobalt/media/cast/sender/audio_sender_unittest.cc
+++ /dev/null
@@ -1,170 +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.
-
-#include "media/cast/sender/audio_sender.h"
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/values.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/media.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/net/cast_transport_impl.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-void SaveOperationalStatus(OperationalStatus* out_status,
-                           OperationalStatus in_status) {
-  DVLOG(1) << "OperationalStatus transitioning from " << *out_status << " to "
-           << in_status;
-  *out_status = in_status;
-}
-
-class TransportClient : public CastTransport::Client {
- public:
-  TransportClient() {}
-
-  void OnStatusChanged(CastTransportStatus status) final {
-    EXPECT_EQ(TRANSPORT_STREAM_INITIALIZED, status);
-  };
-  void OnLoggingEventsReceived(
-      std::unique_ptr<std::vector<FrameEvent>> frame_events,
-      std::unique_ptr<std::vector<PacketEvent>> packet_events) final{};
-  void ProcessRtpPacket(std::unique_ptr<Packet> packet) final{};
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(TransportClient);
-};
-
-}  // namespace
-
-class TestPacketSender : public PacketTransport {
- public:
-  TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {}
-
-  bool SendPacket(PacketRef packet, const base::Closure& cb) final {
-    if (IsRtcpPacket(&packet->data[0], packet->data.size())) {
-      ++number_of_rtcp_packets_;
-    } else {
-      // Check that at least one RTCP packet was sent before the first RTP
-      // packet.  This confirms that the receiver will have the necessary lip
-      // sync info before it has to calculate the playout time of the first
-      // frame.
-      if (number_of_rtp_packets_ == 0) EXPECT_LE(1, number_of_rtcp_packets_);
-      ++number_of_rtp_packets_;
-    }
-    return true;
-  }
-
-  int64_t GetBytesSent() final { return 0; }
-
-  void StartReceiving(
-      const PacketReceiverCallbackWithStatus& packet_receiver) final {}
-
-  void StopReceiving() final {}
-
-  int number_of_rtp_packets() const { return number_of_rtp_packets_; }
-
-  int number_of_rtcp_packets() const { return number_of_rtcp_packets_; }
-
- private:
-  int number_of_rtp_packets_;
-  int number_of_rtcp_packets_;
-
-  DISALLOW_COPY_AND_ASSIGN(TestPacketSender);
-};
-
-class AudioSenderTest : public ::testing::Test {
- protected:
-  AudioSenderTest() {
-    InitializeMediaLibrary();
-    testing_clock_ = new base::SimpleTestTickClock();
-    testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
-    task_runner_ = new FakeSingleThreadTaskRunner(testing_clock_);
-    cast_environment_ =
-        new CastEnvironment(std::unique_ptr<base::TickClock>(testing_clock_),
-                            task_runner_, task_runner_, task_runner_);
-    audio_config_.codec = CODEC_AUDIO_OPUS;
-    audio_config_.use_external_encoder = false;
-    audio_config_.rtp_timebase = kDefaultAudioSamplingRate;
-    audio_config_.channels = 2;
-    audio_config_.max_bitrate = kDefaultAudioEncoderBitrate;
-    audio_config_.rtp_payload_type = RtpPayloadType::AUDIO_OPUS;
-
-    transport_ = new TestPacketSender();
-    transport_sender_.reset(new CastTransportImpl(
-        testing_clock_, base::TimeDelta(), base::MakeUnique<TransportClient>(),
-        base::WrapUnique(transport_), task_runner_));
-    OperationalStatus operational_status = STATUS_UNINITIALIZED;
-    audio_sender_.reset(
-        new AudioSender(cast_environment_, audio_config_,
-                        base::Bind(&SaveOperationalStatus, &operational_status),
-                        transport_sender_.get()));
-    task_runner_->RunTasks();
-    CHECK_EQ(STATUS_INITIALIZED, operational_status);
-  }
-
-  ~AudioSenderTest() override {}
-
-  base::SimpleTestTickClock* testing_clock_;  // Owned by CastEnvironment.
-  TestPacketSender* transport_;               // Owned by CastTransport.
-  std::unique_ptr<CastTransportImpl> transport_sender_;
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  std::unique_ptr<AudioSender> audio_sender_;
-  scoped_refptr<CastEnvironment> cast_environment_;
-  FrameSenderConfig audio_config_;
-};
-
-TEST_F(AudioSenderTest, Encode20ms) {
-  const base::TimeDelta kDuration = base::TimeDelta::FromMilliseconds(20);
-  std::unique_ptr<AudioBus> bus(
-      TestAudioBusFactory(audio_config_.channels, audio_config_.rtp_timebase,
-                          TestAudioBusFactory::kMiddleANoteFreq, 0.5f)
-          .NextAudioBus(kDuration));
-
-  audio_sender_->InsertAudio(std::move(bus), testing_clock_->NowTicks());
-  task_runner_->RunTasks();
-  EXPECT_LE(1, transport_->number_of_rtp_packets());
-  EXPECT_LE(1, transport_->number_of_rtcp_packets());
-}
-
-TEST_F(AudioSenderTest, RtcpTimer) {
-  const base::TimeDelta kDuration = base::TimeDelta::FromMilliseconds(20);
-  std::unique_ptr<AudioBus> bus(
-      TestAudioBusFactory(audio_config_.channels, audio_config_.rtp_timebase,
-                          TestAudioBusFactory::kMiddleANoteFreq, 0.5f)
-          .NextAudioBus(kDuration));
-
-  audio_sender_->InsertAudio(std::move(bus), testing_clock_->NowTicks());
-  task_runner_->RunTasks();
-
-  // Make sure that we send at least one RTCP packet.
-  base::TimeDelta max_rtcp_timeout =
-      base::TimeDelta::FromMilliseconds(1 + kRtcpReportIntervalMs * 3 / 2);
-  testing_clock_->Advance(max_rtcp_timeout);
-  task_runner_->RunTasks();
-  EXPECT_LE(1, transport_->number_of_rtp_packets());
-  EXPECT_LE(1, transport_->number_of_rtcp_packets());
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/congestion_control.cc b/src/cobalt/media/cast/sender/congestion_control.cc
deleted file mode 100644
index f599d92..0000000
--- a/src/cobalt/media/cast/sender/congestion_control.cc
+++ /dev/null
@@ -1,389 +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.
-
-// The purpose of this file is determine what bitrate to use for mirroring.
-// Ideally this should be as much as possible, without causing any frames to
-// arrive late.
-
-// The current algorithm is to measure how much bandwidth we've been using
-// recently. We also keep track of how much data has been queued up for sending
-// in a virtual "buffer" (this virtual buffer represents all the buffers between
-// the sender and the receiver, including retransmissions and so forth.)
-// If we estimate that our virtual buffer is mostly empty, we try to use
-// more bandwidth than our recent usage, otherwise we use less.
-
-#include "media/cast/sender/congestion_control.h"
-
-#include <algorithm>
-#include <deque>
-
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/trace_event/trace_event.h"
-#include "media/cast/constants.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class AdaptiveCongestionControl : public CongestionControl {
- public:
-  AdaptiveCongestionControl(base::TickClock* clock, int max_bitrate_configured,
-                            int min_bitrate_configured, double max_frame_rate);
-
-  ~AdaptiveCongestionControl() final;
-
-  // CongestionControl implementation.
-  void UpdateRtt(base::TimeDelta rtt) final;
-  void UpdateTargetPlayoutDelay(base::TimeDelta delay) final;
-  void SendFrameToTransport(FrameId frame_id, size_t frame_size_in_bits,
-                            base::TimeTicks when) final;
-  void AckFrame(FrameId frame_id, base::TimeTicks when) final;
-  void AckLaterFrames(std::vector<FrameId> received_frames,
-                      base::TimeTicks when) final;
-  int GetBitrate(base::TimeTicks playout_time,
-                 base::TimeDelta playout_delay) final;
-
- private:
-  struct FrameStats {
-    FrameStats();
-    // Time this frame was first enqueued for transport.
-    base::TimeTicks enqueue_time;
-    // Time this frame was acked.
-    base::TimeTicks ack_time;
-    // Size of encoded frame in bits.
-    size_t frame_size_in_bits;
-  };
-
-  // Calculate how much "dead air" (idle time) there is between two frames.
-  static base::TimeDelta DeadTime(const FrameStats& a, const FrameStats& b);
-  // Get the FrameStats for a given |frame_id|.  Never returns nullptr.
-  // Note: Older FrameStats will be removed automatically.
-  FrameStats* GetFrameStats(FrameId frame_id);
-  // Discard old FrameStats.
-  void PruneFrameStats();
-  // Calculate a safe bitrate. This is based on how much we've been
-  // sending in the past.
-  double CalculateSafeBitrate();
-
-  // Estimate when the transport will start sending the data for a given frame.
-  // |estimated_bitrate| is the current estimated transmit bitrate in bits per
-  // second.
-  base::TimeTicks EstimatedSendingTime(FrameId frame_id,
-                                       double estimated_bitrate);
-
-  base::TickClock* const clock_;  // Not owned by this class.
-  const int max_bitrate_configured_;
-  const int min_bitrate_configured_;
-  const double max_frame_rate_;
-  std::deque<FrameStats> frame_stats_;
-  FrameId last_frame_stats_;
-  // This is the latest known frame that all previous frames (having smaller
-  // |frame_id|) and this frame were acked by receiver.
-  FrameId last_checkpoint_frame_;
-  // This is the first time that |last_checkpoint_frame_| is marked.
-  base::TimeTicks last_checkpoint_time_;
-  FrameId last_enqueued_frame_;
-  base::TimeDelta rtt_;
-  size_t history_size_;
-  size_t acked_bits_in_history_;
-  base::TimeDelta dead_time_in_history_;
-
-  DISALLOW_COPY_AND_ASSIGN(AdaptiveCongestionControl);
-};
-
-class FixedCongestionControl : public CongestionControl {
- public:
-  explicit FixedCongestionControl(int bitrate) : bitrate_(bitrate) {}
-  ~FixedCongestionControl() final {}
-
-  // CongestionControl implementation.
-  void UpdateRtt(base::TimeDelta rtt) final {}
-  void UpdateTargetPlayoutDelay(base::TimeDelta delay) final {}
-  void SendFrameToTransport(FrameId frame_id, size_t frame_size_in_bits,
-                            base::TimeTicks when) final {}
-  void AckFrame(FrameId frame_id, base::TimeTicks when) final {}
-  void AckLaterFrames(std::vector<FrameId> received_frames,
-                      base::TimeTicks when) final {}
-  int GetBitrate(base::TimeTicks playout_time,
-                 base::TimeDelta playout_delay) final {
-    return bitrate_;
-  }
-
- private:
-  const int bitrate_;
-
-  DISALLOW_COPY_AND_ASSIGN(FixedCongestionControl);
-};
-
-CongestionControl* NewAdaptiveCongestionControl(base::TickClock* clock,
-                                                int max_bitrate_configured,
-                                                int min_bitrate_configured,
-                                                double max_frame_rate) {
-  return new AdaptiveCongestionControl(clock, max_bitrate_configured,
-                                       min_bitrate_configured, max_frame_rate);
-}
-
-CongestionControl* NewFixedCongestionControl(int bitrate) {
-  return new FixedCongestionControl(bitrate);
-}
-
-// This means that we *try* to keep our buffer 90% empty.
-// If it is less full, we increase the bandwidth, if it is more
-// we decrease the bandwidth. Making this smaller makes the
-// congestion control more aggressive.
-static const double kTargetEmptyBufferFraction = 0.9;
-
-// This is the size of our history in frames. Larger values makes the
-// congestion control adapt slower.
-static const size_t kHistorySize = 100;
-
-AdaptiveCongestionControl::FrameStats::FrameStats() : frame_size_in_bits(0) {}
-
-AdaptiveCongestionControl::AdaptiveCongestionControl(base::TickClock* clock,
-                                                     int max_bitrate_configured,
-                                                     int min_bitrate_configured,
-                                                     double max_frame_rate)
-    : clock_(clock),
-      max_bitrate_configured_(max_bitrate_configured),
-      min_bitrate_configured_(min_bitrate_configured),
-      max_frame_rate_(max_frame_rate),
-      last_frame_stats_(FrameId::first() - 1),
-      last_checkpoint_frame_(FrameId::first() - 1),
-      last_enqueued_frame_(FrameId::first() - 1),
-      history_size_(kHistorySize),
-      acked_bits_in_history_(0) {
-  DCHECK_GE(max_bitrate_configured, min_bitrate_configured) << "Invalid config";
-  DCHECK_GT(min_bitrate_configured, 0);
-  frame_stats_.resize(2);
-  base::TimeTicks now = clock->NowTicks();
-  frame_stats_[0].ack_time = now;
-  frame_stats_[0].enqueue_time = now;
-  frame_stats_[1].ack_time = now;
-  frame_stats_[1].enqueue_time = now;
-  last_checkpoint_time_ = now;
-  DCHECK(!frame_stats_[0].ack_time.is_null());
-}
-
-CongestionControl::~CongestionControl() {}
-AdaptiveCongestionControl::~AdaptiveCongestionControl() {}
-
-void AdaptiveCongestionControl::UpdateRtt(base::TimeDelta rtt) {
-  rtt_ = (7 * rtt_ + rtt) / 8;
-}
-
-void AdaptiveCongestionControl::UpdateTargetPlayoutDelay(
-    base::TimeDelta delay) {
-  const int max_unacked_frames = std::min<int>(
-      kMaxUnackedFrames, 1 + static_cast<int>(delay * max_frame_rate_ /
-                                              base::TimeDelta::FromSeconds(1)));
-  DCHECK_GT(max_unacked_frames, 0);
-  history_size_ = max_unacked_frames + kHistorySize;
-  PruneFrameStats();
-}
-
-// Calculate how much "dead air" there is between two frames.
-base::TimeDelta AdaptiveCongestionControl::DeadTime(const FrameStats& a,
-                                                    const FrameStats& b) {
-  if (b.enqueue_time > a.ack_time) {
-    return b.enqueue_time - a.ack_time;
-  } else {
-    return base::TimeDelta();
-  }
-}
-
-double AdaptiveCongestionControl::CalculateSafeBitrate() {
-  double transmit_time =
-      (GetFrameStats(last_checkpoint_frame_)->ack_time -
-       frame_stats_.front().enqueue_time - dead_time_in_history_)
-          .InSecondsF();
-
-  if (acked_bits_in_history_ == 0 || transmit_time <= 0.0) {
-    return min_bitrate_configured_;
-  }
-  return acked_bits_in_history_ / std::max(transmit_time, 1E-3);
-}
-
-AdaptiveCongestionControl::FrameStats* AdaptiveCongestionControl::GetFrameStats(
-    FrameId frame_id) {
-  DCHECK_LT(frame_id - last_frame_stats_, static_cast<int64_t>(kHistorySize));
-  int offset = frame_id - last_frame_stats_;
-  if (offset > 0) {
-    frame_stats_.resize(frame_stats_.size() + offset);
-    last_frame_stats_ += offset;
-    offset = 0;
-  }
-  PruneFrameStats();
-  offset += frame_stats_.size() - 1;
-  // TODO(miu): Change the following to DCHECK once crash fix is confirmed.
-  // http://crbug.com/517145
-  CHECK(offset >= 0 && offset < static_cast<int32_t>(frame_stats_.size()));
-  return &frame_stats_[offset];
-}
-
-void AdaptiveCongestionControl::PruneFrameStats() {
-  while (frame_stats_.size() > history_size_) {
-    DCHECK_GT(frame_stats_.size(), 1UL);
-    DCHECK(!frame_stats_[0].ack_time.is_null());
-    acked_bits_in_history_ -= frame_stats_[0].frame_size_in_bits;
-    dead_time_in_history_ -= DeadTime(frame_stats_[0], frame_stats_[1]);
-    DCHECK_GE(acked_bits_in_history_, 0UL);
-    VLOG(2) << "DT: " << dead_time_in_history_.InSecondsF();
-    DCHECK_GE(dead_time_in_history_.InSecondsF(), 0.0);
-    frame_stats_.pop_front();
-  }
-}
-
-void AdaptiveCongestionControl::AckFrame(FrameId frame_id,
-                                         base::TimeTicks when) {
-  FrameStats* frame_stats = GetFrameStats(last_checkpoint_frame_);
-  while (last_checkpoint_frame_ < frame_id) {
-    FrameStats* last_frame_stats = frame_stats;
-    frame_stats = GetFrameStats(last_checkpoint_frame_ + 1);
-    if (frame_stats->enqueue_time.is_null()) {
-      // Can't ack a frame that hasn't been sent yet.
-      return;
-    }
-    last_checkpoint_frame_++;
-    if (when < frame_stats->enqueue_time) when = frame_stats->enqueue_time;
-    // Don't overwrite the ack time for those frames that were already acked in
-    // previous extended ACKs.
-    if (frame_stats->ack_time.is_null()) frame_stats->ack_time = when;
-    DCHECK_GE(when, frame_stats->ack_time);
-    acked_bits_in_history_ += frame_stats->frame_size_in_bits;
-    dead_time_in_history_ += DeadTime(*last_frame_stats, *frame_stats);
-    last_checkpoint_time_ = when;
-  }
-}
-
-void AdaptiveCongestionControl::AckLaterFrames(
-    std::vector<FrameId> received_frames, base::TimeTicks when) {
-  for (FrameId frame_id : received_frames) {
-    if (last_checkpoint_frame_ < frame_id) {
-      FrameStats* frame_stats = GetFrameStats(frame_id);
-      if (frame_stats->enqueue_time.is_null()) {
-        // Can't ack a frame that hasn't been sent yet.
-        continue;
-      }
-      if (when < frame_stats->enqueue_time) when = frame_stats->enqueue_time;
-      // Don't overwrite the ack time for those frames that were acked before.
-      if (frame_stats->ack_time.is_null()) frame_stats->ack_time = when;
-      DCHECK_GE(when, frame_stats->ack_time);
-    }
-  }
-}
-
-void AdaptiveCongestionControl::SendFrameToTransport(FrameId frame_id,
-                                                     size_t frame_size_in_bits,
-                                                     base::TimeTicks when) {
-  last_enqueued_frame_ = frame_id;
-  FrameStats* frame_stats = GetFrameStats(frame_id);
-  frame_stats->enqueue_time = when;
-  frame_stats->frame_size_in_bits = frame_size_in_bits;
-}
-
-base::TimeTicks AdaptiveCongestionControl::EstimatedSendingTime(
-    FrameId frame_id, double estimated_bitrate) {
-  const base::TimeTicks now = clock_->NowTicks();
-
-  // Starting with the time of the latest acknowledgement, extrapolate forward
-  // to determine an estimated sending time for |frame_id|.
-  //
-  // |estimated_sending_time| will contain the estimated sending time for each
-  // frame after the last ACK'ed frame.  It is possible for multiple frames to
-  // be in-flight; and therefore it is common for the |estimated_sending_time|
-  // for those frames to be before |now|.  The initial estimate is based on the
-  // last ACKed frame and the RTT.
-  base::TimeTicks estimated_sending_time = last_checkpoint_time_ - rtt_;
-  for (FrameId f = last_checkpoint_frame_ + 1; f < frame_id; ++f) {
-    FrameStats* const stats = GetFrameStats(f);
-
-    // |estimated_ack_time| is the local time when the sender receives the ACK,
-    // and not the time when the ACK left the receiver.
-    base::TimeTicks estimated_ack_time = stats->ack_time;
-
-    // Do not update the estimate if this frame's packets will never again enter
-    // the packet send queue; unless there is no estimate yet.
-    if (!estimated_ack_time.is_null()) continue;
-
-    // Model: The |estimated_sending_time| is the time at which the first byte
-    // of the encoded frame is transmitted.  Then, assume the transmission of
-    // the remaining bytes is paced such that the last byte has just left the
-    // sender at |frame_transmit_time| later.  This last byte then takes
-    // ~RTT/2 amount of time to travel to the receiver.  Finally, the ACK from
-    // the receiver is sent and this takes another ~RTT/2 amount of time to
-    // reach the sender.
-    const base::TimeDelta frame_transmit_time = base::TimeDelta::FromSecondsD(
-        stats->frame_size_in_bits / estimated_bitrate);
-    estimated_ack_time = std::max(estimated_sending_time, stats->enqueue_time) +
-                         frame_transmit_time + rtt_;
-
-    if (estimated_ack_time < now) {
-      // The current frame has not yet been ACK'ed and the yet the computed
-      // |estimated_ack_time| is before |now|.  This contradiction must be
-      // resolved.
-      //
-      // The solution below is a little counter-intuitive, but it seems to
-      // work.  Basically, when we estimate that the ACK should have already
-      // happened, we figure out how long ago it should have happened and
-      // guess that the ACK will happen half of that time in the future.  This
-      // will cause some over-estimation when acks are late, which is actually
-      // the desired behavior.
-      estimated_ack_time = now + (now - estimated_ack_time) / 2;
-    }
-
-    // Since we [in the common case] do not wait for an ACK before we start
-    // sending the next frame, estimate the next frame's sending time as the
-    // time just after the last byte of the current frame left the sender (see
-    // Model comment above).
-    estimated_sending_time =
-        std::max(estimated_sending_time, estimated_ack_time - rtt_);
-  }
-
-  FrameStats* const frame_stats = GetFrameStats(frame_id);
-  if (frame_stats->enqueue_time.is_null()) {
-    // The frame has not yet been enqueued for transport.  Since it cannot be
-    // enqueued in the past, ensure the result is lower-bounded by |now|.
-    estimated_sending_time = std::max(estimated_sending_time, now);
-  } else {
-    // |frame_stats->enqueue_time| is the time the frame was enqueued for
-    // transport.  The frame may not actually start being sent until a
-    // point-in-time after that, because the transport is waiting for prior
-    // frames to be acknowledged.
-    estimated_sending_time =
-        std::max(estimated_sending_time, frame_stats->enqueue_time);
-  }
-
-  return estimated_sending_time;
-}
-
-int AdaptiveCongestionControl::GetBitrate(base::TimeTicks playout_time,
-                                          base::TimeDelta playout_delay) {
-  double safe_bitrate = CalculateSafeBitrate();
-  // Estimate when we might start sending the next frame.
-  base::TimeDelta time_to_catch_up =
-      playout_time -
-      EstimatedSendingTime(last_enqueued_frame_ + 1, safe_bitrate);
-
-  double empty_buffer_fraction =
-      time_to_catch_up.InSecondsF() / playout_delay.InSecondsF();
-  empty_buffer_fraction = std::min(empty_buffer_fraction, 1.0);
-  empty_buffer_fraction = std::max(empty_buffer_fraction, 0.0);
-
-  int bits_per_second = static_cast<int>(safe_bitrate * empty_buffer_fraction /
-                                         kTargetEmptyBufferFraction);
-  VLOG(3) << " FBR:" << (bits_per_second / 1E6)
-          << " EBF:" << empty_buffer_fraction
-          << " SBR:" << (safe_bitrate / 1E6);
-  TRACE_COUNTER_ID1("cast.stream", "Empty Buffer Fraction", this,
-                    empty_buffer_fraction);
-  bits_per_second = std::max(bits_per_second, min_bitrate_configured_);
-  bits_per_second = std::min(bits_per_second, max_bitrate_configured_);
-
-  return bits_per_second;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/congestion_control.h b/src/cobalt/media/cast/sender/congestion_control.h
deleted file mode 100644
index dda9a52..0000000
--- a/src/cobalt/media/cast/sender/congestion_control.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_CONGESTION_CONTROL_H_
-#define COBALT_MEDIA_CAST_SENDER_CONGESTION_CONTROL_H_
-
-#include <memory>
-#include <vector>
-
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-#include "media/cast/common/frame_id.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class CongestionControl {
- public:
-  virtual ~CongestionControl();
-
-  // Called with latest measured rtt value.
-  virtual void UpdateRtt(base::TimeDelta rtt) = 0;
-
-  // Called with an updated target playout delay value.
-  virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) = 0;
-
-  // Called when an encoded frame is enqueued for transport.
-  virtual void SendFrameToTransport(FrameId frame_id, size_t frame_size_in_bits,
-                                    base::TimeTicks when) = 0;
-
-  // Called when we receive an ACK for a frame.
-  virtual void AckFrame(FrameId frame_id, base::TimeTicks when) = 0;
-
-  // Called when the RTP receiver received frames that have frame ID larger
-  // than |last_acked_frame_|.
-  virtual void AckLaterFrames(std::vector<FrameId> received_frames,
-                              base::TimeTicks when) = 0;
-
-  // Returns the bitrate we should use for the next frame.
-  virtual int GetBitrate(base::TimeTicks playout_time,
-                         base::TimeDelta playout_delay) = 0;
-};
-
-CongestionControl* NewAdaptiveCongestionControl(base::TickClock* clock,
-                                                int max_bitrate_configured,
-                                                int min_bitrate_configured,
-                                                double max_frame_rate);
-
-CongestionControl* NewFixedCongestionControl(int bitrate);
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_CONGESTION_CONTROL_H_
diff --git a/src/cobalt/media/cast/sender/congestion_control_unittest.cc b/src/cobalt/media/cast/sender/congestion_control_unittest.cc
deleted file mode 100644
index ae82017..0000000
--- a/src/cobalt/media/cast/sender/congestion_control_unittest.cc
+++ /dev/null
@@ -1,139 +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.
-
-#include <vector>
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/macros.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/cast/sender/congestion_control.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-static const int kMaxBitrateConfigured = 5000000;
-static const int kMinBitrateConfigured = 500000;
-static const int64_t kFrameDelayMs = 33;
-static const double kMaxFrameRate = 1000.0 / kFrameDelayMs;
-static const int64_t kStartMillisecond = INT64_C(12345678900000);
-static const double kTargetEmptyBufferFraction = 0.9;
-
-class CongestionControlTest : public ::testing::Test {
- protected:
-  CongestionControlTest()
-      : task_runner_(new FakeSingleThreadTaskRunner(&testing_clock_)) {
-    testing_clock_.Advance(
-        base::TimeDelta::FromMilliseconds(kStartMillisecond));
-    congestion_control_.reset(
-        NewAdaptiveCongestionControl(&testing_clock_, kMaxBitrateConfigured,
-                                     kMinBitrateConfigured, kMaxFrameRate));
-    const int max_unacked_frames = 10;
-    const base::TimeDelta target_playout_delay =
-        (max_unacked_frames - 1) * base::TimeDelta::FromSeconds(1) /
-        kMaxFrameRate;
-    congestion_control_->UpdateTargetPlayoutDelay(target_playout_delay);
-  }
-
-  void AckFrame(FrameId frame_id) {
-    congestion_control_->AckFrame(frame_id, testing_clock_.NowTicks());
-  }
-
-  void Run(int num_frames, size_t frame_size, base::TimeDelta rtt,
-           base::TimeDelta frame_delay, base::TimeDelta ack_time) {
-    const FrameId end = FrameId::first() + num_frames;
-    for (frame_id_ = FrameId::first(); frame_id_ < end; frame_id_++) {
-      congestion_control_->UpdateRtt(rtt);
-      congestion_control_->SendFrameToTransport(frame_id_, frame_size,
-                                                testing_clock_.NowTicks());
-      task_runner_->PostDelayedTask(
-          FROM_HERE, base::Bind(&CongestionControlTest::AckFrame,
-                                base::Unretained(this), frame_id_),
-          ack_time);
-      task_runner_->Sleep(frame_delay);
-    }
-  }
-
-  base::SimpleTestTickClock testing_clock_;
-  std::unique_ptr<CongestionControl> congestion_control_;
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  FrameId frame_id_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CongestionControlTest);
-};
-
-// Tests that AdaptiveCongestionControl returns reasonable bitrates based on
-// estimations of network bandwidth and how much is in-flight (i.e, using the
-// "target buffer fill" model).
-TEST_F(CongestionControlTest, SimpleRun) {
-  uint32_t frame_size = 10000 * 8;
-  Run(500, frame_size, base::TimeDelta::FromMilliseconds(10),
-      base::TimeDelta::FromMilliseconds(kFrameDelayMs),
-      base::TimeDelta::FromMilliseconds(45));
-  // Empty the buffer.
-  task_runner_->Sleep(base::TimeDelta::FromMilliseconds(100));
-
-  uint32_t safe_bitrate = frame_size * 1000 / kFrameDelayMs;
-  uint32_t bitrate = congestion_control_->GetBitrate(
-      testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300),
-      base::TimeDelta::FromMilliseconds(300));
-  EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction, bitrate,
-              safe_bitrate * 0.05);
-
-  bitrate = congestion_control_->GetBitrate(
-      testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(200),
-      base::TimeDelta::FromMilliseconds(300));
-  EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 2 / 3, bitrate,
-              safe_bitrate * 0.05);
-
-  bitrate = congestion_control_->GetBitrate(
-      testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(100),
-      base::TimeDelta::FromMilliseconds(300));
-  EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 1 / 3, bitrate,
-              safe_bitrate * 0.05);
-
-  // Add a large (100ms) frame.
-  congestion_control_->SendFrameToTransport(
-      frame_id_++, safe_bitrate * 100 / 1000, testing_clock_.NowTicks());
-
-  // Results should show that we have ~200ms to send.
-  bitrate = congestion_control_->GetBitrate(
-      testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300),
-      base::TimeDelta::FromMilliseconds(300));
-  EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 2 / 3, bitrate,
-              safe_bitrate * 0.05);
-
-  // Add another large (100ms) frame.
-  congestion_control_->SendFrameToTransport(
-      frame_id_++, safe_bitrate * 100 / 1000, testing_clock_.NowTicks());
-
-  // Results should show that we have ~100ms to send.
-  bitrate = congestion_control_->GetBitrate(
-      testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300),
-      base::TimeDelta::FromMilliseconds(300));
-  EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 1 / 3, bitrate,
-              safe_bitrate * 0.05);
-
-  // Ack the last frame.
-  std::vector<FrameId> received_frames;
-  received_frames.push_back(frame_id_ - 1);
-  congestion_control_->AckLaterFrames(received_frames,
-                                      testing_clock_.NowTicks());
-
-  // Results should show that we have ~200ms to send.
-  bitrate = congestion_control_->GetBitrate(
-      testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300),
-      base::TimeDelta::FromMilliseconds(300));
-  EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 2 / 3, bitrate,
-              safe_bitrate * 0.05);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/external_video_encoder.cc b/src/cobalt/media/cast/sender/external_video_encoder.cc
deleted file mode 100644
index dc38e76..0000000
--- a/src/cobalt/media/cast/sender/external_video_encoder.cc
+++ /dev/null
@@ -1,882 +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.
-
-#include "media/cast/sender/external_video_encoder.h"
-
-#include <algorithm>
-#include <cmath>
-#include <list>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/debug/crash_logging.h"
-#include "base/debug/dump_without_crashing.h"
-#include "base/format_macros.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/memory/shared_memory.h"
-#include "base/message_loop/message_loop.h"
-#include "base/metrics/histogram.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "build/build_config.h"
-#include "media/base/bind_to_current_loop.h"
-#include "media/base/media_switches.h"
-#include "media/base/video_frame.h"
-#include "media/base/video_types.h"
-#include "media/base/video_util.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/logging/logging_defines.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/sender/vp8_quantizer_parser.h"
-#include "media/filters/h264_parser.h"
-#include "starboard/memory.h"
-
-namespace {
-
-enum { MAX_H264_QUANTIZER = 51 };
-
-// Number of buffers for encoded bit stream.
-constexpr size_t kOutputBufferCount = 3;
-
-// Maximum number of extra input buffers for encoder. The input buffers are only
-// used when copy is needed to match the required coded size.
-constexpr size_t kExtraInputBufferCount = 2;
-
-// This value is used to calculate the encoder utilization. The encoder is
-// assumed to be in full usage when the number of frames in progress reaches it.
-constexpr int kBacklogRedlineThreshold = 4;
-
-}  // namespace
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Container for the associated data of a video frame being processed.
-struct InProgressFrameEncode {
-  // The source content to encode.
-  const scoped_refptr<VideoFrame> video_frame;
-
-  // The reference time for this frame.
-  const base::TimeTicks reference_time;
-
-  // The callback to run when the result is ready.
-  const VideoEncoder::FrameEncodedCallback frame_encoded_callback;
-
-  // The target encode bit rate.
-  const int target_bit_rate;
-
-  // The real-world encode start time.  This is used to compute the encoded
-  // frame's |encoder_utilization| and so it uses the real-world clock instead
-  // of the CastEnvironment clock, the latter of which might be simulated.
-  const base::TimeTicks start_time;
-
-  InProgressFrameEncode(const scoped_refptr<VideoFrame>& v_frame,
-                        base::TimeTicks r_time,
-                        VideoEncoder::FrameEncodedCallback callback,
-                        int bit_rate)
-      : video_frame(v_frame),
-        reference_time(r_time),
-        frame_encoded_callback(callback),
-        target_bit_rate(bit_rate),
-        start_time(base::TimeTicks::Now()) {}
-};
-
-// Owns a VideoEncoderAccelerator instance and provides the necessary adapters
-// to encode media::VideoFrames and emit media::cast::EncodedFrames.  All
-// methods must be called on the thread associated with the given
-// SingleThreadTaskRunner, except for the task_runner() accessor.
-class ExternalVideoEncoder::VEAClientImpl
-    : public VideoEncodeAccelerator::Client,
-      public base::RefCountedThreadSafe<VEAClientImpl> {
- public:
-  VEAClientImpl(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const scoped_refptr<base::SingleThreadTaskRunner>& encoder_task_runner,
-      std::unique_ptr<media::VideoEncodeAccelerator> vea, double max_frame_rate,
-      const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb)
-      : cast_environment_(cast_environment),
-        task_runner_(encoder_task_runner),
-        max_frame_rate_(max_frame_rate),
-        status_change_cb_(status_change_cb),
-        create_video_encode_memory_cb_(create_video_encode_memory_cb),
-        video_encode_accelerator_(std::move(vea)),
-        encoder_active_(false),
-        next_frame_id_(FrameId::first()),
-        key_frame_encountered_(false),
-        codec_profile_(media::VIDEO_CODEC_PROFILE_UNKNOWN),
-        key_frame_quantizer_parsable_(false),
-        requested_bit_rate_(-1),
-        has_seen_zero_length_encoded_frame_(false),
-        max_allowed_input_buffers_(0),
-        allocate_input_buffer_in_progress_(false) {}
-
-  base::SingleThreadTaskRunner* task_runner() const {
-    return task_runner_.get();
-  }
-
-  void Initialize(const gfx::Size& frame_size, VideoCodecProfile codec_profile,
-                  int start_bit_rate, FrameId first_frame_id) {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    requested_bit_rate_ = start_bit_rate;
-    encoder_active_ = video_encode_accelerator_->Initialize(
-        media::PIXEL_FORMAT_I420, frame_size, codec_profile, start_bit_rate,
-        this);
-    next_frame_id_ = first_frame_id;
-    codec_profile_ = codec_profile;
-
-    UMA_HISTOGRAM_BOOLEAN("Cast.Sender.VideoEncodeAcceleratorInitializeSuccess",
-                          encoder_active_);
-
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(status_change_cb_, encoder_active_
-                                          ? STATUS_INITIALIZED
-                                          : STATUS_CODEC_INIT_FAILED));
-  }
-
-  void SetBitRate(int bit_rate) {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    requested_bit_rate_ = bit_rate;
-    video_encode_accelerator_->RequestEncodingParametersChange(
-        bit_rate, static_cast<uint32_t>(max_frame_rate_ + 0.5));
-  }
-
-  // The destruction call back of the copied video frame to free its use of
-  // the input buffer.
-  void ReturnInputBufferToPool(int index) {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-    DCHECK_GE(index, 0);
-    DCHECK_LT(index, static_cast<int>(input_buffers_.size()));
-    free_input_buffer_index_.push_back(index);
-  }
-
-  void EncodeVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& reference_time, bool key_frame_requested,
-      const VideoEncoder::FrameEncodedCallback& frame_encoded_callback) {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    if (!encoder_active_) return;
-
-    in_progress_frame_encodes_.push_back(
-        InProgressFrameEncode(video_frame, reference_time,
-                              frame_encoded_callback, requested_bit_rate_));
-
-    scoped_refptr<media::VideoFrame> frame = video_frame;
-    if (video_frame->coded_size() != frame_coded_size_) {
-      DCHECK_GE(frame_coded_size_.width(), video_frame->visible_rect().width());
-      DCHECK_GE(frame_coded_size_.height(),
-                video_frame->visible_rect().height());
-
-      if (free_input_buffer_index_.empty()) {
-        if (!allocate_input_buffer_in_progress_ &&
-            input_buffers_.size() < max_allowed_input_buffers_) {
-          allocate_input_buffer_in_progress_ = true;
-          create_video_encode_memory_cb_.Run(
-              media::VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420,
-                                                frame_coded_size_),
-              base::Bind(&VEAClientImpl::OnCreateInputSharedMemory, this));
-        }
-        ExitEncodingWithErrors();
-        return;
-      }
-
-      int index = free_input_buffer_index_.back();
-      base::SharedMemory* input_buffer = input_buffers_[index].get();
-      frame = VideoFrame::WrapExternalSharedMemory(
-          video_frame->format(), frame_coded_size_, video_frame->visible_rect(),
-          video_frame->visible_rect().size(),
-          static_cast<uint8_t*>(input_buffer->memory()),
-          input_buffer->mapped_size(), input_buffer->handle(), 0,
-          video_frame->timestamp());
-      if (!frame || !media::I420CopyWithPadding(*video_frame, frame.get())) {
-        LOG(DFATAL) << "Error: ExternalVideoEncoder: copy failed.";
-        ExitEncodingWithErrors();
-        return;
-      }
-
-      frame->AddDestructionObserver(media::BindToCurrentLoop(base::Bind(
-          &ExternalVideoEncoder::VEAClientImpl::ReturnInputBufferToPool, this,
-          index)));
-      free_input_buffer_index_.pop_back();
-    }
-
-    // BitstreamBufferReady will be called once the encoder is done.
-    video_encode_accelerator_->Encode(frame, key_frame_requested);
-  }
-
- protected:
-  void NotifyError(VideoEncodeAccelerator::Error error) final {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    DCHECK(error != VideoEncodeAccelerator::kInvalidArgumentError &&
-           error != VideoEncodeAccelerator::kIllegalStateError);
-
-    encoder_active_ = false;
-
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(status_change_cb_, STATUS_CODEC_RUNTIME_ERROR));
-
-    // TODO: Force-flush all |in_progress_frame_encodes_| immediately so pending
-    // frames do not become stuck, freezing VideoSender.
-  }
-
-  // Called to allocate the input and output buffers.
-  void RequireBitstreamBuffers(unsigned int input_count,
-                               const gfx::Size& input_coded_size,
-                               size_t output_buffer_size) final {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    frame_coded_size_ = input_coded_size;
-
-    max_allowed_input_buffers_ = input_count + kExtraInputBufferCount;
-
-    for (size_t j = 0; j < kOutputBufferCount; ++j) {
-      create_video_encode_memory_cb_.Run(
-          output_buffer_size,
-          base::Bind(&VEAClientImpl::OnCreateSharedMemory, this));
-    }
-  }
-
-  // Encoder has encoded a frame and it's available in one of the output
-  // buffers.  Package the result in a media::cast::EncodedFrame and post it
-  // to the Cast MAIN thread via the supplied callback.
-  void BitstreamBufferReady(int32_t bitstream_buffer_id, size_t payload_size,
-                            bool key_frame,
-                            base::TimeDelta /* timestamp */) final {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-    if (bitstream_buffer_id < 0 ||
-        bitstream_buffer_id >= static_cast<int32_t>(output_buffers_.size())) {
-      NOTREACHED();
-      VLOG(1) << "BitstreamBufferReady(): invalid bitstream_buffer_id="
-              << bitstream_buffer_id;
-      NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
-      return;
-    }
-    base::SharedMemory* output_buffer =
-        output_buffers_[bitstream_buffer_id].get();
-    if (payload_size > output_buffer->mapped_size()) {
-      NOTREACHED();
-      VLOG(1) << "BitstreamBufferReady(): invalid payload_size = "
-              << payload_size;
-      NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
-      return;
-    }
-    if (key_frame) key_frame_encountered_ = true;
-    if (!key_frame_encountered_) {
-      // Do not send video until we have encountered the first key frame.
-      // Save the bitstream buffer in |stream_header_| to be sent later along
-      // with the first key frame.
-      //
-      // TODO(miu): Should |stream_header_| be an std::ostringstream for
-      // performance reasons?
-      stream_header_.append(static_cast<const char*>(output_buffer->memory()),
-                            payload_size);
-    } else if (!in_progress_frame_encodes_.empty()) {
-      const InProgressFrameEncode& request = in_progress_frame_encodes_.front();
-
-      std::unique_ptr<SenderEncodedFrame> encoded_frame(
-          new SenderEncodedFrame());
-      encoded_frame->dependency =
-          key_frame ? EncodedFrame::KEY : EncodedFrame::DEPENDENT;
-      encoded_frame->frame_id = next_frame_id_++;
-      if (key_frame)
-        encoded_frame->referenced_frame_id = encoded_frame->frame_id;
-      else
-        encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
-      encoded_frame->rtp_timestamp = RtpTimeTicks::FromTimeDelta(
-          request.video_frame->timestamp(), kVideoFrequency);
-      encoded_frame->reference_time = request.reference_time;
-      if (!stream_header_.empty()) {
-        encoded_frame->data = stream_header_;
-        stream_header_.clear();
-      }
-      encoded_frame->data.append(
-          static_cast<const char*>(output_buffer->memory()), payload_size);
-
-      // If FRAME_DURATION metadata was provided in the source VideoFrame,
-      // compute the utilization metrics.
-      base::TimeDelta frame_duration;
-      if (request.video_frame->metadata()->GetTimeDelta(
-              media::VideoFrameMetadata::FRAME_DURATION, &frame_duration) &&
-          frame_duration > base::TimeDelta()) {
-        // Compute encoder utilization in terms of the number of frames in
-        // backlog, including the current frame encode that is finishing
-        // here. This "backlog" model works as follows: First, assume that all
-        // frames utilize the encoder by the same amount. This is actually a
-        // false assumption, but it still works well because any frame that
-        // takes longer to encode will naturally cause the backlog to
-        // increase, and this will result in a higher computed utilization for
-        // the offending frame. If the backlog continues to increase, because
-        // the following frames are also taking too long to encode, the
-        // computed utilization for each successive frame will be higher. At
-        // some point, upstream control logic will decide that the data volume
-        // must be reduced.
-        encoded_frame->encoder_utilization =
-            static_cast<double>(in_progress_frame_encodes_.size()) /
-            kBacklogRedlineThreshold;
-
-        const double actual_bit_rate =
-            encoded_frame->data.size() * 8.0 / frame_duration.InSecondsF();
-        DCHECK_GT(request.target_bit_rate, 0);
-        const double bitrate_utilization =
-            actual_bit_rate / request.target_bit_rate;
-        double quantizer = QuantizerEstimator::NO_RESULT;
-        // If the quantizer can be parsed from the key frame, try to parse
-        // the following delta frames as well.
-        // Otherwise, switch back to entropy estimation for the key frame
-        // and all the following delta frames.
-        if (key_frame || key_frame_quantizer_parsable_) {
-          if (codec_profile_ == media::VP8PROFILE_ANY) {
-            quantizer = ParseVp8HeaderQuantizer(
-                reinterpret_cast<const uint8_t*>(encoded_frame->data.data()),
-                encoded_frame->data.size());
-          } else if (codec_profile_ == media::H264PROFILE_MAIN) {
-            quantizer = GetH264FrameQuantizer(
-                reinterpret_cast<const uint8_t*>(encoded_frame->data.data()),
-                encoded_frame->data.size());
-          } else {
-            NOTIMPLEMENTED();
-          }
-          if (quantizer < 0) {
-            LOG(ERROR) << "Unable to parse quantizer from encoded "
-                       << (key_frame ? "key" : "delta")
-                       << " frame, id=" << encoded_frame->frame_id;
-            if (key_frame) {
-              key_frame_quantizer_parsable_ = false;
-              quantizer = quantizer_estimator_.EstimateForKeyFrame(
-                  *request.video_frame);
-            }
-          } else {
-            if (key_frame) {
-              key_frame_quantizer_parsable_ = true;
-            }
-          }
-        } else {
-          quantizer =
-              quantizer_estimator_.EstimateForDeltaFrame(*request.video_frame);
-        }
-        if (quantizer >= 0) {
-          const double max_quantizer =
-              codec_profile_ == media::VP8PROFILE_ANY
-                  ? static_cast<int>(QuantizerEstimator::MAX_VP8_QUANTIZER)
-                  : static_cast<int>(MAX_H264_QUANTIZER);
-          encoded_frame->lossy_utilization =
-              bitrate_utilization * (quantizer / max_quantizer);
-        }
-      } else {
-        quantizer_estimator_.Reset();
-      }
-
-      // TODO(miu): Determine when/why encoding can produce zero-length data,
-      // which causes crypto crashes.  http://crbug.com/519022
-      if (!has_seen_zero_length_encoded_frame_ && encoded_frame->data.empty()) {
-        has_seen_zero_length_encoded_frame_ = true;
-
-        const char kZeroEncodeDetails[] = "zero-encode-details";
-        const std::string details = base::StringPrintf(
-            ("%c/%c,id=%" PRIu32 ",rtp=%" PRIu32 ",br=%d,q=%" PRIuS
-             ",act=%c,ref=%" PRIu32),
-            codec_profile_ == media::VP8PROFILE_ANY ? 'V' : 'H',
-            key_frame ? 'K' : 'D', encoded_frame->frame_id.lower_32_bits(),
-            encoded_frame->rtp_timestamp.lower_32_bits(),
-            request.target_bit_rate / 1000, in_progress_frame_encodes_.size(),
-            encoder_active_ ? 'Y' : 'N',
-            encoded_frame->referenced_frame_id.lower_32_bits() % 1000);
-        base::debug::SetCrashKeyValue(kZeroEncodeDetails, details);
-        // Please forward crash reports to http://crbug.com/519022:
-        base::debug::DumpWithoutCrashing();
-        base::debug::ClearCrashKey(kZeroEncodeDetails);
-      }
-
-      encoded_frame->encode_completion_time =
-          cast_environment_->Clock()->NowTicks();
-      cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
-                                  base::Bind(request.frame_encoded_callback,
-                                             base::Passed(&encoded_frame)));
-
-      in_progress_frame_encodes_.pop_front();
-    } else {
-      VLOG(1) << "BitstreamBufferReady(): no encoded frame data available";
-    }
-
-    // We need to re-add the output buffer to the encoder after we are done
-    // with it.
-    video_encode_accelerator_->UseOutputBitstreamBuffer(media::BitstreamBuffer(
-        bitstream_buffer_id, output_buffers_[bitstream_buffer_id]->handle(),
-        output_buffers_[bitstream_buffer_id]->mapped_size()));
-  }
-
- private:
-  friend class base::RefCountedThreadSafe<VEAClientImpl>;
-
-  ~VEAClientImpl() final {
-    // According to the media::VideoEncodeAccelerator interface, Destroy()
-    // should be called instead of invoking its private destructor.
-    task_runner_->PostTask(
-        FROM_HERE,
-        base::Bind(&media::VideoEncodeAccelerator::Destroy,
-                   base::Unretained(video_encode_accelerator_.release())));
-  }
-
-  // Note: This method can be called on any thread.
-  void OnCreateSharedMemory(std::unique_ptr<base::SharedMemory> memory) {
-    task_runner_->PostTask(
-        FROM_HERE, base::Bind(&VEAClientImpl::OnReceivedSharedMemory, this,
-                              base::Passed(&memory)));
-  }
-
-  void OnCreateInputSharedMemory(std::unique_ptr<base::SharedMemory> memory) {
-    task_runner_->PostTask(
-        FROM_HERE, base::Bind(&VEAClientImpl::OnReceivedInputSharedMemory, this,
-                              base::Passed(&memory)));
-  }
-
-  void OnReceivedSharedMemory(std::unique_ptr<base::SharedMemory> memory) {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    output_buffers_.push_back(std::move(memory));
-
-    // Wait until all requested buffers are received.
-    if (output_buffers_.size() < kOutputBufferCount) return;
-
-    // Immediately provide all output buffers to the VEA.
-    for (size_t i = 0; i < output_buffers_.size(); ++i) {
-      video_encode_accelerator_->UseOutputBitstreamBuffer(
-          media::BitstreamBuffer(static_cast<int32_t>(i),
-                                 output_buffers_[i]->handle(),
-                                 output_buffers_[i]->mapped_size()));
-    }
-  }
-
-  void OnReceivedInputSharedMemory(std::unique_ptr<base::SharedMemory> memory) {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    if (memory.get()) {
-      input_buffers_.push_back(std::move(memory));
-      free_input_buffer_index_.push_back(input_buffers_.size() - 1);
-    }
-    allocate_input_buffer_in_progress_ = false;
-  }
-
-  // This is called when copy errors occur in encoding process when there is
-  // need to copy the VideoFrames to match the required coded size for encoder.
-  void ExitEncodingWithErrors() {
-    DCHECK(task_runner_->RunsTasksOnCurrentThread());
-
-    std::unique_ptr<SenderEncodedFrame> no_result(nullptr);
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(in_progress_frame_encodes_.back().frame_encoded_callback,
-                   base::Passed(&no_result)));
-    in_progress_frame_encodes_.pop_back();
-  }
-
-  // Parse H264 SPS, PPS, and Slice header, and return the averaged frame
-  // quantizer in the range of [0, 51], or -1 on parse error.
-  double GetH264FrameQuantizer(const uint8_t* encoded_data, off_t size) {
-    DCHECK(encoded_data);
-    if (!size) return -1;
-    h264_parser_.SetStream(encoded_data, size);
-    double total_quantizer = 0;
-    int num_slices = 0;
-
-    while (true) {
-      H264NALU nalu;
-      H264Parser::Result res = h264_parser_.AdvanceToNextNALU(&nalu);
-      if (res == H264Parser::kEOStream) break;
-      if (res != H264Parser::kOk) return -1;
-      switch (nalu.nal_unit_type) {
-        case H264NALU::kIDRSlice:
-        case H264NALU::kNonIDRSlice: {
-          H264SliceHeader slice_header;
-          if (h264_parser_.ParseSliceHeader(nalu, &slice_header) !=
-              H264Parser::kOk)
-            return -1;
-          const H264PPS* pps =
-              h264_parser_.GetPPS(slice_header.pic_parameter_set_id);
-          if (!pps) return -1;
-          ++num_slices;
-          int slice_quantizer =
-              26 +
-              ((slice_header.IsSPSlice() || slice_header.IsSISlice())
-                   ? pps->pic_init_qs_minus26 + slice_header.slice_qs_delta
-                   : pps->pic_init_qp_minus26 + slice_header.slice_qp_delta);
-          DCHECK_GE(slice_quantizer, 0);
-          DCHECK_LE(slice_quantizer, MAX_H264_QUANTIZER);
-          total_quantizer += slice_quantizer;
-          break;
-        }
-        case H264NALU::kSPS: {
-          int id;
-          if (h264_parser_.ParseSPS(&id) != H264Parser::kOk) return -1;
-          break;
-        }
-        case H264NALU::kPPS: {
-          int id;
-          if (h264_parser_.ParsePPS(&id) != H264Parser::kOk) return -1;
-          break;
-        }
-        default:
-          // Skip other NALUs.
-          break;
-      }
-    }
-    return (num_slices == 0) ? -1 : (total_quantizer / num_slices);
-  }
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  const double max_frame_rate_;
-  const StatusChangeCallback status_change_cb_;  // Must be run on MAIN thread.
-  const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_;
-  std::unique_ptr<media::VideoEncodeAccelerator> video_encode_accelerator_;
-  bool encoder_active_;
-  FrameId next_frame_id_;
-  bool key_frame_encountered_;
-  std::string stream_header_;
-  VideoCodecProfile codec_profile_;
-  bool key_frame_quantizer_parsable_;
-  H264Parser h264_parser_;
-
-  // Shared memory buffers for output with the VideoAccelerator.
-  std::vector<std::unique_ptr<base::SharedMemory>> output_buffers_;
-
-  // Shared memory buffers for input video frames with the VideoAccelerator.
-  // These buffers will be allocated only when copy is needed to match the
-  // required coded size for encoder. They are allocated on-demand, up to
-  // |max_allowed_input_buffers_|.
-  std::vector<std::unique_ptr<base::SharedMemory>> input_buffers_;
-
-  // Available input buffer index. These buffers are used in FILO order.
-  std::vector<int> free_input_buffer_index_;
-
-  // FIFO list.
-  std::list<InProgressFrameEncode> in_progress_frame_encodes_;
-
-  // The requested encode bit rate for the next frame.
-  int requested_bit_rate_;
-
-  // Used to compute utilization metrics for each frame.
-  QuantizerEstimator quantizer_estimator_;
-
-  // Set to true once a frame with zero-length encoded data has been
-  // encountered.
-  // TODO(miu): Remove after discovering cause.  http://crbug.com/519022
-  bool has_seen_zero_length_encoded_frame_;
-
-  // The coded size of the video frame required by Encoder. This size is
-  // obtained from VEA through |RequireBitstreamBuffers()|.
-  gfx::Size frame_coded_size_;
-
-  // The maximum number of input buffers. These buffers are used to copy
-  // VideoFrames in order to match the required coded size for encoder.
-  size_t max_allowed_input_buffers_;
-
-  // Set to true when the allocation of an input buffer is in progress, and
-  // reset to false after the allocated buffer is received.
-  bool allocate_input_buffer_in_progress_;
-
-  DISALLOW_COPY_AND_ASSIGN(VEAClientImpl);
-};
-
-// static
-bool ExternalVideoEncoder::IsSupported(const FrameSenderConfig& video_config) {
-  if (video_config.codec != CODEC_VIDEO_VP8 &&
-      video_config.codec != CODEC_VIDEO_H264)
-    return false;
-
-  // TODO(miu): "Layering hooks" are needed to be able to query outside of
-  // libmedia, to determine whether the system provides a hardware encoder.  For
-  // now, assume that this was already checked by this point.
-  // http://crbug.com/454029
-  return video_config.use_external_encoder;
-}
-
-ExternalVideoEncoder::ExternalVideoEncoder(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const FrameSenderConfig& video_config, const gfx::Size& frame_size,
-    FrameId first_frame_id, const StatusChangeCallback& status_change_cb,
-    const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-    const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb)
-    : cast_environment_(cast_environment),
-      create_video_encode_memory_cb_(create_video_encode_memory_cb),
-      frame_size_(frame_size),
-      bit_rate_(video_config.start_bitrate),
-      key_frame_requested_(false),
-      weak_factory_(this) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK_GT(video_config.max_frame_rate, 0);
-  DCHECK(!frame_size_.IsEmpty());
-  DCHECK(!status_change_cb.is_null());
-  DCHECK(!create_vea_cb.is_null());
-  DCHECK(!create_video_encode_memory_cb_.is_null());
-  DCHECK_GT(bit_rate_, 0);
-
-  create_vea_cb.Run(
-      base::Bind(&ExternalVideoEncoder::OnCreateVideoEncodeAccelerator,
-                 weak_factory_.GetWeakPtr(), video_config, first_frame_id,
-                 status_change_cb));
-}
-
-ExternalVideoEncoder::~ExternalVideoEncoder() {}
-
-bool ExternalVideoEncoder::EncodeVideoFrame(
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time,
-    const FrameEncodedCallback& frame_encoded_callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!frame_encoded_callback.is_null());
-
-  if (!client_ || video_frame->visible_rect().size() != frame_size_)
-    return false;
-
-  client_->task_runner()->PostTask(
-      FROM_HERE,
-      base::Bind(&VEAClientImpl::EncodeVideoFrame, client_, video_frame,
-                 reference_time, key_frame_requested_, frame_encoded_callback));
-  key_frame_requested_ = false;
-  return true;
-}
-
-void ExternalVideoEncoder::SetBitRate(int new_bit_rate) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK_GT(new_bit_rate, 0);
-
-  bit_rate_ = new_bit_rate;
-  if (!client_) return;
-  client_->task_runner()->PostTask(
-      FROM_HERE, base::Bind(&VEAClientImpl::SetBitRate, client_, bit_rate_));
-}
-
-void ExternalVideoEncoder::GenerateKeyFrame() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  key_frame_requested_ = true;
-}
-
-void ExternalVideoEncoder::OnCreateVideoEncodeAccelerator(
-    const FrameSenderConfig& video_config, FrameId first_frame_id,
-    const StatusChangeCallback& status_change_cb,
-    scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner,
-    std::unique_ptr<media::VideoEncodeAccelerator> vea) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  // The callback will be invoked with null pointers in the case where the
-  // system does not support or lacks the resources to provide GPU-accelerated
-  // video encoding.
-  if (!encoder_task_runner || !vea) {
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(status_change_cb, STATUS_CODEC_INIT_FAILED));
-    return;
-  }
-
-  VideoCodecProfile codec_profile;
-  switch (video_config.codec) {
-    case CODEC_VIDEO_VP8:
-      codec_profile = media::VP8PROFILE_ANY;
-      break;
-    case CODEC_VIDEO_H264:
-      codec_profile = media::H264PROFILE_MAIN;
-      break;
-    case CODEC_VIDEO_FAKE:
-      NOTREACHED() << "Fake software video encoder cannot be external";
-    // ...flow through to next case...
-    default:
-      cast_environment_->PostTask(
-          CastEnvironment::MAIN, FROM_HERE,
-          base::Bind(status_change_cb, STATUS_UNSUPPORTED_CODEC));
-      return;
-  }
-
-  DCHECK(!client_);
-  client_ = new VEAClientImpl(cast_environment_, encoder_task_runner,
-                              std::move(vea), video_config.max_frame_rate,
-                              status_change_cb, create_video_encode_memory_cb_);
-  client_->task_runner()->PostTask(
-      FROM_HERE, base::Bind(&VEAClientImpl::Initialize, client_, frame_size_,
-                            codec_profile, bit_rate_, first_frame_id));
-}
-
-SizeAdaptableExternalVideoEncoder::SizeAdaptableExternalVideoEncoder(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb,
-    const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-    const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb)
-    : SizeAdaptableVideoEncoderBase(cast_environment, video_config,
-                                    status_change_cb),
-      create_vea_cb_(create_vea_cb),
-      create_video_encode_memory_cb_(create_video_encode_memory_cb) {}
-
-SizeAdaptableExternalVideoEncoder::~SizeAdaptableExternalVideoEncoder() {}
-
-std::unique_ptr<VideoEncoder>
-SizeAdaptableExternalVideoEncoder::CreateEncoder() {
-  return std::unique_ptr<VideoEncoder>(new ExternalVideoEncoder(
-      cast_environment(), video_config(), frame_size(), next_frame_id(),
-      CreateEncoderStatusChangeCallback(), create_vea_cb_,
-      create_video_encode_memory_cb_));
-}
-
-QuantizerEstimator::QuantizerEstimator() {}
-
-QuantizerEstimator::~QuantizerEstimator() {}
-
-void QuantizerEstimator::Reset() { last_frame_pixel_buffer_.reset(); }
-
-double QuantizerEstimator::EstimateForKeyFrame(const VideoFrame& frame) {
-  if (!CanExamineFrame(frame)) return NO_RESULT;
-
-  // If the size of the frame is different from the last frame, allocate a new
-  // buffer.  The buffer only needs to be a fraction of the size of the entire
-  // frame, since the entropy analysis only examines a subset of each frame.
-  const gfx::Size size = frame.visible_rect().size();
-  const int rows_in_subset =
-      std::max(1, size.height() * FRAME_SAMPLING_PERCENT / 100);
-  if (last_frame_size_ != size || !last_frame_pixel_buffer_) {
-    last_frame_pixel_buffer_.reset(new uint8_t[size.width() * rows_in_subset]);
-    last_frame_size_ = size;
-  }
-
-  // Compute a histogram where each bucket represents the number of times two
-  // neighboring pixels were different by a specific amount.  511 buckets are
-  // needed, one for each integer in the range [-255,255].
-  int histogram[511];
-  SbMemorySet(histogram, 0, sizeof(histogram));
-  const int row_skip = size.height() / rows_in_subset;
-  int y = 0;
-  for (int i = 0; i < rows_in_subset; ++i, y += row_skip) {
-    const uint8_t* const row_begin = frame.visible_data(VideoFrame::kYPlane) +
-                                     y * frame.stride(VideoFrame::kYPlane);
-    const uint8_t* const row_end = row_begin + size.width();
-    int left_hand_pixel_value = static_cast<int>(*row_begin);
-    for (const uint8_t* p = row_begin + 1; p < row_end; ++p) {
-      const int right_hand_pixel_value = static_cast<int>(*p);
-      const int difference = right_hand_pixel_value - left_hand_pixel_value;
-      const int histogram_index = difference + 255;
-      ++histogram[histogram_index];
-      left_hand_pixel_value = right_hand_pixel_value;  // For next iteration.
-    }
-
-    // Copy the row of pixels into the buffer.  This will be used when
-    // generating histograms for future delta frames.
-    SbMemoryCopy(last_frame_pixel_buffer_.get() + i * size.width(), row_begin,
-                 size.width());
-  }
-
-  // Estimate a quantizer value depending on the difference data in the
-  // histogram and return it.
-  const int num_samples = (size.width() - 1) * rows_in_subset;
-  return ToQuantizerEstimate(ComputeEntropyFromHistogram(
-      histogram, arraysize(histogram), num_samples));
-}
-
-double QuantizerEstimator::EstimateForDeltaFrame(const VideoFrame& frame) {
-  if (!CanExamineFrame(frame)) return NO_RESULT;
-
-  // If the size of the |frame| has changed, no difference can be examined.
-  // In this case, process this frame as if it were a key frame.
-  const gfx::Size size = frame.visible_rect().size();
-  if (last_frame_size_ != size || !last_frame_pixel_buffer_)
-    return EstimateForKeyFrame(frame);
-  const int rows_in_subset =
-      std::max(1, size.height() * FRAME_SAMPLING_PERCENT / 100);
-
-  // Compute a histogram where each bucket represents the number of times the
-  // same pixel in this frame versus the last frame was different by a specific
-  // amount.  511 buckets are needed, one for each integer in the range
-  // [-255,255].
-  int histogram[511];
-  SbMemorySet(histogram, 0, sizeof(histogram));
-  const int row_skip = size.height() / rows_in_subset;
-  int y = 0;
-  for (int i = 0; i < rows_in_subset; ++i, y += row_skip) {
-    const uint8_t* const row_begin = frame.visible_data(VideoFrame::kYPlane) +
-                                     y * frame.stride(VideoFrame::kYPlane);
-    const uint8_t* const row_end = row_begin + size.width();
-    uint8_t* const last_frame_row_begin =
-        last_frame_pixel_buffer_.get() + i * size.width();
-    for (const uint8_t *p = row_begin, *q = last_frame_row_begin; p < row_end;
-         ++p, ++q) {
-      const int difference = static_cast<int>(*p) - static_cast<int>(*q);
-      const int histogram_index = difference + 255;
-      ++histogram[histogram_index];
-    }
-
-    // Copy the row of pixels into the buffer.  This will be used when
-    // generating histograms for future delta frames.
-    SbMemoryCopy(last_frame_row_begin, row_begin, size.width());
-  }
-
-  // Estimate a quantizer value depending on the difference data in the
-  // histogram and return it.
-  const int num_samples = size.width() * rows_in_subset;
-  return ToQuantizerEstimate(ComputeEntropyFromHistogram(
-      histogram, arraysize(histogram), num_samples));
-}
-
-// static
-bool QuantizerEstimator::CanExamineFrame(const VideoFrame& frame) {
-  DCHECK_EQ(8, VideoFrame::PlaneHorizontalBitsPerPixel(frame.format(),
-                                                       VideoFrame::kYPlane));
-  return media::IsYuvPlanar(frame.format()) && !frame.visible_rect().IsEmpty();
-}
-
-// static
-double QuantizerEstimator::ComputeEntropyFromHistogram(const int* histogram,
-                                                       size_t num_buckets,
-                                                       int num_samples) {
-#if defined(OS_ANDROID)
-  // Android does not currently provide a log2() function in their C++ standard
-  // library.  This is a substitute.
-  const auto log2 = [](double num) -> double {
-    return log(num) / 0.69314718055994528622676398299518041312694549560546875;
-  };
-#endif
-
-  DCHECK_LT(0, num_samples);
-  double entropy = 0.0;
-  for (size_t i = 0; i < num_buckets; ++i) {
-    const double probability = static_cast<double>(histogram[i]) / num_samples;
-    if (probability > 0.0) entropy = entropy - probability * log2(probability);
-  }
-  return entropy;
-}
-
-// static
-double QuantizerEstimator::ToQuantizerEstimate(double shannon_entropy) {
-  DCHECK_GE(shannon_entropy, 0.0);
-
-  // This math is based on an analysis of data produced by running a wide range
-  // of mirroring content in a Cast streaming session on a Chromebook Pixel
-  // (2013 edition).  The output from the Pixel's built-in hardware encoder was
-  // compared to an identically-configured software implementation (libvpx)
-  // running alongside.  Based on an analysis of the data, the following linear
-  // mapping seems to produce reasonable VP8 quantizer values from the
-  // |shannon_entropy| values.
-  //
-  // TODO(miu): Confirm whether this model and value work well on other
-  // platforms.
-  const double kEntropyAtMaxQuantizer = 7.5;
-  const double slope =
-      (MAX_VP8_QUANTIZER - MIN_VP8_QUANTIZER) / kEntropyAtMaxQuantizer;
-  const double quantizer = std::min<double>(
-      MAX_VP8_QUANTIZER, MIN_VP8_QUANTIZER + slope * shannon_entropy);
-  return quantizer;
-}
-
-}  //  namespace cast
-}  //  namespace media
diff --git a/src/cobalt/media/cast/sender/external_video_encoder.h b/src/cobalt/media/cast/sender/external_video_encoder.h
deleted file mode 100644
index eb6ef0e..0000000
--- a/src/cobalt/media/cast/sender/external_video_encoder.h
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/sender/size_adaptable_video_encoder_base.h"
-#include "media/cast/sender/video_encoder.h"
-#include "media/video/video_encode_accelerator.h"
-#include "starboard/types.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Cast MAIN thread proxy to the internal media::VideoEncodeAccelerator
-// implementation running on a separate thread.  Encodes media::VideoFrames and
-// emits media::cast::EncodedFrames.
-class ExternalVideoEncoder : public VideoEncoder {
- public:
-  // Returns true if the current platform and system configuration supports
-  // using ExternalVideoEncoder with the given |video_config|.
-  static bool IsSupported(const FrameSenderConfig& video_config);
-
-  ExternalVideoEncoder(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const FrameSenderConfig& video_config, const gfx::Size& frame_size,
-      FrameId first_frame_id, const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb);
-
-  ~ExternalVideoEncoder() final;
-
-  // VideoEncoder implementation.
-  bool EncodeVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& reference_time,
-      const FrameEncodedCallback& frame_encoded_callback) final;
-  void SetBitRate(int new_bit_rate) final;
-  void GenerateKeyFrame() final;
-
- private:
-  class VEAClientImpl;
-
-  // Method invoked by the CreateVideoEncodeAcceleratorCallback to construct a
-  // VEAClientImpl to own and interface with a new |vea|.  Upon return,
-  // |client_| holds a reference to the new VEAClientImpl.
-  void OnCreateVideoEncodeAccelerator(
-      const FrameSenderConfig& video_config, FrameId first_frame_id,
-      const StatusChangeCallback& status_change_cb,
-      scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner,
-      std::unique_ptr<media::VideoEncodeAccelerator> vea);
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_;
-
-  // The size of the visible region of the video frames to be encoded.
-  const gfx::Size frame_size_;
-
-  int bit_rate_;
-  bool key_frame_requested_;
-
-  scoped_refptr<VEAClientImpl> client_;
-
-  // Provides a weak pointer for the OnCreateVideoEncoderAccelerator() callback.
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<ExternalVideoEncoder> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoder);
-};
-
-// An implementation of SizeAdaptableVideoEncoderBase to proxy for
-// ExternalVideoEncoder instances.
-class SizeAdaptableExternalVideoEncoder : public SizeAdaptableVideoEncoderBase {
- public:
-  SizeAdaptableExternalVideoEncoder(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb);
-
-  ~SizeAdaptableExternalVideoEncoder() final;
-
- protected:
-  std::unique_ptr<VideoEncoder> CreateEncoder() final;
-
- private:
-  // Special callbacks needed by media::cast::ExternalVideoEncoder.
-  // TODO(miu): Remove these.  http://crbug.com/454029
-  const CreateVideoEncodeAcceleratorCallback create_vea_cb_;
-  const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_;
-
-  DISALLOW_COPY_AND_ASSIGN(SizeAdaptableExternalVideoEncoder);
-};
-
-// A utility class for examining the sequence of frames sent to an external
-// encoder, and returning an estimate of the what the software VP8 encoder would
-// have used for a quantizer value when encoding each frame.  The quantizer
-// value is related to the complexity of the content of the frame.
-class QuantizerEstimator {
- public:
-  enum {
-    NO_RESULT = -1,
-    MIN_VP8_QUANTIZER = 4,
-    MAX_VP8_QUANTIZER = 63,
-  };
-
-  QuantizerEstimator();
-  ~QuantizerEstimator();
-
-  // Discard any state related to the processing of prior frames.
-  void Reset();
-
-  // Examine |frame| and estimate and return the quantizer value the software
-  // VP8 encoder would have used when encoding the frame, in the range
-  // [4.0,63.0].  If |frame| is not in planar YUV format, or its size is empty,
-  // this returns |NO_RESULT|.
-  double EstimateForKeyFrame(const VideoFrame& frame);
-  double EstimateForDeltaFrame(const VideoFrame& frame);
-
- private:
-  enum {
-    // The percentage of each frame to sample.  This value is based on an
-    // analysis that showed sampling 10% of the rows of a frame generated
-    // reasonably accurate results.
-    FRAME_SAMPLING_PERCENT = 10,
-  };
-
-  // Returns true if the frame is in planar YUV format.
-  static bool CanExamineFrame(const VideoFrame& frame);
-
-  // Returns a value in the range [0,log2(num_buckets)], the Shannon Entropy
-  // based on the probabilities of values falling within each of the buckets of
-  // the given |histogram|.
-  static double ComputeEntropyFromHistogram(const int* histogram,
-                                            size_t num_buckets,
-                                            int num_samples);
-
-  // Map the |shannon_entropy| to its corresponding software VP8 quantizer.
-  static double ToQuantizerEstimate(double shannon_entropy);
-
-  // A cache of a subset of rows of pixels from the last frame examined.  This
-  // is used to compute the entropy of the difference between frames, which in
-  // turn is used to compute the entropy and quantizer.
-  std::unique_ptr<uint8_t[]> last_frame_pixel_buffer_;
-  gfx::Size last_frame_size_;
-
-  DISALLOW_COPY_AND_ASSIGN(QuantizerEstimator);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/external_video_encoder_unittest.cc b/src/cobalt/media/cast/sender/external_video_encoder_unittest.cc
deleted file mode 100644
index f7a39ce..0000000
--- a/src/cobalt/media/cast/sender/external_video_encoder_unittest.cc
+++ /dev/null
@@ -1,82 +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 "media/cast/sender/external_video_encoder.h"
-
-#include "media/base/video_frame.h"
-#include "media/base/video_types.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-scoped_refptr<VideoFrame> CreateFrame(const uint8_t* y_plane_data,
-                                      const gfx::Size& size) {
-  scoped_refptr<VideoFrame> result = VideoFrame::CreateFrame(
-      PIXEL_FORMAT_I420, size, gfx::Rect(size), size, base::TimeDelta());
-  for (int y = 0, y_end = size.height(); y < y_end; ++y) {
-    SbMemoryCopy(result->visible_data(VideoFrame::kYPlane) +
-                     y * result->stride(VideoFrame::kYPlane),
-                 y_plane_data + y * size.width(), size.width());
-  }
-  return result;
-}
-
-}  // namespace
-
-TEST(QuantizerEstimator, EstimatesForTrivialFrames) {
-  QuantizerEstimator qe;
-
-  const gfx::Size frame_size(320, 180);
-  const std::unique_ptr<uint8_t[]> black_frame_data(
-      new uint8_t[frame_size.GetArea()]);
-  SbMemorySet(black_frame_data.get(), 0, frame_size.GetArea());
-  const scoped_refptr<VideoFrame> black_frame =
-      CreateFrame(black_frame_data.get(), frame_size);
-
-  // A solid color frame should always generate a minimum quantizer value (4.0)
-  // as a key frame.  If it is provided repeatedly as delta frames, the minimum
-  // quantizer value should be repeatedly generated since there is no difference
-  // between frames.
-  EXPECT_EQ(4.0, qe.EstimateForKeyFrame(*black_frame));
-  for (int i = 0; i < 3; ++i)
-    EXPECT_EQ(4.0, qe.EstimateForDeltaFrame(*black_frame));
-
-  const std::unique_ptr<uint8_t[]> checkerboard_frame_data(
-      new uint8_t[frame_size.GetArea()]);
-  for (int i = 0, end = frame_size.GetArea(); i < end; ++i)
-    checkerboard_frame_data.get()[i] = (((i % 2) == 0) ? 0 : 255);
-  const scoped_refptr<VideoFrame> checkerboard_frame =
-      CreateFrame(checkerboard_frame_data.get(), frame_size);
-
-  // Now, introduce a frame with a checkerboard pattern.  Half of the pixels
-  // will have a difference of 255, and half will have zero difference.
-  // Therefore, the Shannon Entropy should be 1.0 and the resulting quantizer
-  // estimate should be ~11.9.
-  EXPECT_NEAR(11.9, qe.EstimateForDeltaFrame(*checkerboard_frame), 0.1);
-
-  // Now, introduce a series of frames with "random snow" in them.  Expect this
-  // results in high quantizer estimates.
-  for (int i = 0; i < 3; ++i) {
-    int rand_seed = 0xdeadbeef + i;
-    const std::unique_ptr<uint8_t[]> random_frame_data(
-        new uint8_t[frame_size.GetArea()]);
-    for (int j = 0, end = frame_size.GetArea(); j < end; ++j) {
-      rand_seed = (1103515245 * rand_seed + 12345) % (1 << 31);
-      random_frame_data.get()[j] = static_cast<uint8_t>(rand_seed & 0xff);
-    }
-    const scoped_refptr<VideoFrame> random_frame =
-        CreateFrame(random_frame_data.get(), frame_size);
-    EXPECT_LE(50.0, qe.EstimateForDeltaFrame(*random_frame));
-  }
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/fake_software_video_encoder.cc b/src/cobalt/media/cast/sender/fake_software_video_encoder.cc
deleted file mode 100644
index 70a833c..0000000
--- a/src/cobalt/media/cast/sender/fake_software_video_encoder.cc
+++ /dev/null
@@ -1,86 +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.
-
-#include "media/cast/sender/fake_software_video_encoder.h"
-
-#include <algorithm>
-
-#include "base/json/json_writer.h"
-#include "base/values.h"
-#include "media/base/video_frame.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/constants.h"
-#include "starboard/types.h"
-
-#ifndef OFFICIAL_BUILD
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-FakeSoftwareVideoEncoder::FakeSoftwareVideoEncoder(
-    const FrameSenderConfig& video_config)
-    : video_config_(video_config),
-      next_frame_is_key_(true),
-      frame_id_(FrameId::first()),
-      frame_size_(0) {
-  DCHECK_GT(video_config_.max_frame_rate, 0);
-}
-
-FakeSoftwareVideoEncoder::~FakeSoftwareVideoEncoder() {}
-
-void FakeSoftwareVideoEncoder::Initialize() {}
-
-void FakeSoftwareVideoEncoder::Encode(
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time, SenderEncodedFrame* encoded_frame) {
-  DCHECK(encoded_frame);
-
-  if (video_frame->visible_rect().size() != last_frame_size_) {
-    next_frame_is_key_ = true;
-    last_frame_size_ = video_frame->visible_rect().size();
-  }
-
-  encoded_frame->frame_id = frame_id_++;
-  if (next_frame_is_key_) {
-    encoded_frame->dependency = EncodedFrame::KEY;
-    encoded_frame->referenced_frame_id = encoded_frame->frame_id;
-    next_frame_is_key_ = false;
-  } else {
-    encoded_frame->dependency = EncodedFrame::DEPENDENT;
-    encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
-  }
-  encoded_frame->rtp_timestamp =
-      RtpTimeTicks::FromTimeDelta(video_frame->timestamp(), kVideoFrequency);
-  encoded_frame->reference_time = reference_time;
-
-  base::DictionaryValue values;
-  values.SetBoolean("key", encoded_frame->dependency == EncodedFrame::KEY);
-  values.SetInteger("ref", encoded_frame->referenced_frame_id.lower_32_bits());
-  values.SetInteger("id", encoded_frame->frame_id.lower_32_bits());
-  values.SetInteger("size", frame_size_);
-  base::JSONWriter::Write(values, &encoded_frame->data);
-  encoded_frame->data.resize(
-      std::max<size_t>(encoded_frame->data.size(), frame_size_), ' ');
-
-  if (encoded_frame->dependency == EncodedFrame::KEY) {
-    encoded_frame->encoder_utilization = 1.0;
-    encoded_frame->lossy_utilization = 6.0;
-  } else {
-    encoded_frame->encoder_utilization = 0.8;
-    encoded_frame->lossy_utilization = 0.8;
-  }
-}
-
-void FakeSoftwareVideoEncoder::UpdateRates(uint32_t new_bitrate) {
-  frame_size_ = new_bitrate / video_config_.max_frame_rate / 8;
-}
-
-void FakeSoftwareVideoEncoder::GenerateKeyFrame() { next_frame_is_key_ = true; }
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif
diff --git a/src/cobalt/media/cast/sender/fake_software_video_encoder.h b/src/cobalt/media/cast/sender/fake_software_video_encoder.h
deleted file mode 100644
index 778b58d..0000000
--- a/src/cobalt/media/cast/sender/fake_software_video_encoder.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_FAKE_SOFTWARE_VIDEO_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_FAKE_SOFTWARE_VIDEO_ENCODER_H_
-
-#include "media/cast/cast_config.h"
-#include "media/cast/sender/software_video_encoder.h"
-#include "starboard/types.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class FakeSoftwareVideoEncoder : public SoftwareVideoEncoder {
- public:
-  FakeSoftwareVideoEncoder(const FrameSenderConfig& video_config);
-  ~FakeSoftwareVideoEncoder() final;
-
-  // SoftwareVideoEncoder implementations.
-  void Initialize() final;
-  void Encode(const scoped_refptr<media::VideoFrame>& video_frame,
-              const base::TimeTicks& reference_time,
-              SenderEncodedFrame* encoded_frame) final;
-  void UpdateRates(uint32_t new_bitrate) final;
-  void GenerateKeyFrame() final;
-
- private:
-  const FrameSenderConfig video_config_;
-  gfx::Size last_frame_size_;
-  bool next_frame_is_key_;
-  FrameId frame_id_;
-  int frame_size_;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_FAKE_SOFTWARE_VIDEO_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/fake_video_encode_accelerator_factory.cc b/src/cobalt/media/cast/sender/fake_video_encode_accelerator_factory.cc
deleted file mode 100644
index dd6a0a1..0000000
--- a/src/cobalt/media/cast/sender/fake_video_encode_accelerator_factory.cc
+++ /dev/null
@@ -1,82 +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 "media/cast/sender/fake_video_encode_accelerator_factory.h"
-
-#include <utility>
-
-#include "base/callback_helpers.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-FakeVideoEncodeAcceleratorFactory::FakeVideoEncodeAcceleratorFactory(
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
-    : task_runner_(task_runner),
-      will_init_succeed_(true),
-      auto_respond_(false),
-      vea_response_count_(0),
-      shm_response_count_(0),
-      last_response_vea_(nullptr),
-      last_response_shm_(nullptr) {}
-
-FakeVideoEncodeAcceleratorFactory::~FakeVideoEncodeAcceleratorFactory() {}
-
-void FakeVideoEncodeAcceleratorFactory::SetInitializationWillSucceed(
-    bool will_init_succeed) {
-  will_init_succeed_ = will_init_succeed;
-}
-
-void FakeVideoEncodeAcceleratorFactory::SetAutoRespond(bool auto_respond) {
-  auto_respond_ = auto_respond;
-  if (auto_respond_) {
-    if (!vea_response_callback_.is_null()) RespondWithVideoEncodeAccelerator();
-    if (!shm_response_callback_.is_null()) RespondWithSharedMemory();
-  }
-}
-
-void FakeVideoEncodeAcceleratorFactory::CreateVideoEncodeAccelerator(
-    const ReceiveVideoEncodeAcceleratorCallback& callback) {
-  DCHECK(!callback.is_null());
-  DCHECK(!next_response_vea_);
-
-  FakeVideoEncodeAccelerator* const vea =
-      new FakeVideoEncodeAccelerator(task_runner_);
-  vea->SetWillInitializationSucceed(will_init_succeed_);
-  next_response_vea_.reset(vea);
-  vea_response_callback_ = callback;
-  if (auto_respond_) RespondWithVideoEncodeAccelerator();
-}
-
-void FakeVideoEncodeAcceleratorFactory::CreateSharedMemory(
-    size_t size, const ReceiveVideoEncodeMemoryCallback& callback) {
-  DCHECK(!callback.is_null());
-  DCHECK(!next_response_shm_);
-
-  next_response_shm_.reset(new base::SharedMemory());
-  CHECK(next_response_shm_->CreateAndMapAnonymous(size));
-  shm_response_callback_ = callback;
-  if (auto_respond_) RespondWithSharedMemory();
-}
-
-void FakeVideoEncodeAcceleratorFactory::RespondWithVideoEncodeAccelerator() {
-  DCHECK(next_response_vea_.get());
-  last_response_vea_ = next_response_vea_.get();
-  ++vea_response_count_;
-  base::ResetAndReturn(&vea_response_callback_)
-      .Run(task_runner_, std::move(next_response_vea_));
-}
-
-void FakeVideoEncodeAcceleratorFactory::RespondWithSharedMemory() {
-  DCHECK(next_response_shm_.get());
-  last_response_shm_ = next_response_shm_.get();
-  ++shm_response_count_;
-  base::ResetAndReturn(&shm_response_callback_)
-      .Run(std::move(next_response_shm_));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/fake_video_encode_accelerator_factory.h b/src/cobalt/media/cast/sender/fake_video_encode_accelerator_factory.h
deleted file mode 100644
index 738c592..0000000
--- a/src/cobalt/media/cast/sender/fake_video_encode_accelerator_factory.h
+++ /dev/null
@@ -1,88 +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 COBALT_MEDIA_CAST_SENDER_FAKE_VIDEO_ENCODE_ACCELERATOR_FACTORY_H_
-#define COBALT_MEDIA_CAST_SENDER_FAKE_VIDEO_ENCODE_ACCELERATOR_FACTORY_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/shared_memory.h"
-#include "base/single_thread_task_runner.h"
-#include "media/cast/cast_config.h"
-#include "media/video/fake_video_encode_accelerator.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Used by test code to create fake VideoEncodeAccelerators.  The test code
-// controls when the response callback is invoked.
-class FakeVideoEncodeAcceleratorFactory {
- public:
-  explicit FakeVideoEncodeAcceleratorFactory(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
-  ~FakeVideoEncodeAcceleratorFactory();
-
-  int vea_response_count() const { return vea_response_count_; }
-  int shm_response_count() const { return shm_response_count_; }
-
-  // These return the instance last responded.  It is up to the caller to
-  // determine whether the pointer is still valid, since this factory does not
-  // own these objects anymore.
-  media::FakeVideoEncodeAccelerator* last_response_vea() const {
-    return static_cast<media::FakeVideoEncodeAccelerator*>(last_response_vea_);
-  }
-  base::SharedMemory* last_response_shm() const { return last_response_shm_; }
-
-  // Set whether the next created media::FakeVideoEncodeAccelerator will
-  // initialize successfully.
-  void SetInitializationWillSucceed(bool will_init_succeed);
-
-  // Enable/disable auto-respond mode.  Default is disabled.
-  void SetAutoRespond(bool auto_respond);
-
-  // Creates a media::FakeVideoEncodeAccelerator.  If in auto-respond mode,
-  // |callback| is run synchronously (i.e., before this method returns).
-  void CreateVideoEncodeAccelerator(
-      const ReceiveVideoEncodeAcceleratorCallback& callback);
-
-  // Creates shared memory of the requested |size|.  If in auto-respond mode,
-  // |callback| is run synchronously (i.e., before this method returns).
-  void CreateSharedMemory(size_t size,
-                          const ReceiveVideoEncodeMemoryCallback& callback);
-
-  // Runs the |callback| provided to the last call to
-  // CreateVideoEncodeAccelerator() with the new VideoEncodeAccelerator
-  // instance.
-  void RespondWithVideoEncodeAccelerator();
-
-  // Runs the |callback| provided to the last call to
-  // CreateSharedMemory() with the new base::SharedMemory instance.
-  void RespondWithSharedMemory();
-
- private:
-  const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  bool will_init_succeed_;
-  bool auto_respond_;
-  std::unique_ptr<media::VideoEncodeAccelerator> next_response_vea_;
-  ReceiveVideoEncodeAcceleratorCallback vea_response_callback_;
-  std::unique_ptr<base::SharedMemory> next_response_shm_;
-  ReceiveVideoEncodeMemoryCallback shm_response_callback_;
-  int vea_response_count_;
-  int shm_response_count_;
-  media::VideoEncodeAccelerator* last_response_vea_;
-  base::SharedMemory* last_response_shm_;
-
-  DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAcceleratorFactory);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_FAKE_VIDEO_ENCODE_ACCELERATOR_FACTORY_H_
diff --git a/src/cobalt/media/cast/sender/frame_sender.cc b/src/cobalt/media/cast/sender/frame_sender.cc
deleted file mode 100644
index b5772fc..0000000
--- a/src/cobalt/media/cast/sender/frame_sender.cc
+++ /dev/null
@@ -1,466 +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.
-
-#include "media/cast/sender/frame_sender.h"
-
-#include <algorithm>
-#include <limits>
-#include <utility>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/trace_event/trace_event.h"
-#include "media/cast/constants.h"
-#include "media/cast/sender/sender_encoded_frame.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace {
-
-const int kMinSchedulingDelayMs = 1;
-const int kNumAggressiveReportsSentAtStart = 100;
-
-// The additional number of frames that can be in-flight when input exceeds the
-// maximum frame rate.
-const int kMaxFrameBurst = 5;
-
-}  // namespace
-
-// Convenience macro used in logging statements throughout this file.
-#define SENDER_SSRC (is_audio_ ? "AUDIO[" : "VIDEO[") << ssrc_ << "] "
-
-FrameSender::RtcpClient::RtcpClient(base::WeakPtr<FrameSender> frame_sender)
-    : frame_sender_(frame_sender) {}
-
-FrameSender::RtcpClient::~RtcpClient() {}
-
-void FrameSender::RtcpClient::OnReceivedCastMessage(
-    const RtcpCastMessage& cast_message) {
-  if (frame_sender_) frame_sender_->OnReceivedCastFeedback(cast_message);
-}
-
-void FrameSender::RtcpClient::OnReceivedRtt(base::TimeDelta round_trip_time) {
-  if (frame_sender_) frame_sender_->OnMeasuredRoundTripTime(round_trip_time);
-}
-
-void FrameSender::RtcpClient::OnReceivedPli() {
-  if (frame_sender_) frame_sender_->OnReceivedPli();
-}
-
-FrameSender::FrameSender(scoped_refptr<CastEnvironment> cast_environment,
-                         CastTransport* const transport_sender,
-                         const FrameSenderConfig& config,
-                         CongestionControl* congestion_control)
-    : cast_environment_(cast_environment),
-      transport_sender_(transport_sender),
-      ssrc_(config.sender_ssrc),
-      min_playout_delay_(config.min_playout_delay.is_zero()
-                             ? config.max_playout_delay
-                             : config.min_playout_delay),
-      max_playout_delay_(config.max_playout_delay),
-      animated_playout_delay_(config.animated_playout_delay.is_zero()
-                                  ? config.max_playout_delay
-                                  : config.animated_playout_delay),
-      send_target_playout_delay_(false),
-      max_frame_rate_(config.max_frame_rate),
-      num_aggressive_rtcp_reports_sent_(0),
-      duplicate_ack_counter_(0),
-      congestion_control_(congestion_control),
-      picture_lost_at_receiver_(false),
-      rtp_timebase_(config.rtp_timebase),
-      is_audio_(config.rtp_payload_type <= RtpPayloadType::AUDIO_LAST),
-      weak_factory_(this) {
-  DCHECK(transport_sender_);
-  DCHECK_GT(rtp_timebase_, 0);
-  DCHECK(congestion_control_);
-  // We assume animated content to begin with since that is the common use
-  // case today.
-  VLOG(1) << SENDER_SSRC << "min latency "
-          << min_playout_delay_.InMilliseconds() << "max latency "
-          << max_playout_delay_.InMilliseconds() << "animated latency "
-          << animated_playout_delay_.InMilliseconds();
-  SetTargetPlayoutDelay(animated_playout_delay_);
-
-  CastTransportRtpConfig transport_config;
-  transport_config.ssrc = config.sender_ssrc;
-  transport_config.feedback_ssrc = config.receiver_ssrc;
-  transport_config.rtp_payload_type = config.rtp_payload_type;
-  transport_config.aes_key = config.aes_key;
-  transport_config.aes_iv_mask = config.aes_iv_mask;
-
-  transport_sender->InitializeStream(
-      transport_config,
-      base::MakeUnique<FrameSender::RtcpClient>(weak_factory_.GetWeakPtr()));
-}
-
-FrameSender::~FrameSender() {}
-
-void FrameSender::ScheduleNextRtcpReport() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  cast_environment_->PostDelayedTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(&FrameSender::SendRtcpReport, weak_factory_.GetWeakPtr(),
-                 true),
-      base::TimeDelta::FromMilliseconds(kRtcpReportIntervalMs));
-}
-
-void FrameSender::SendRtcpReport(bool schedule_future_reports) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  // Sanity-check: We should have sent at least the first frame by this point.
-  DCHECK(!last_send_time_.is_null());
-
-  // Create lip-sync info for the sender report.  The last sent frame's
-  // reference time and RTP timestamp are used to estimate an RTP timestamp in
-  // terms of "now."  Note that |now| is never likely to be precise to an exact
-  // frame boundary; and so the computation here will result in a
-  // |now_as_rtp_timestamp| value that is rarely equal to any one emitted by the
-  // encoder.
-  const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
-  const base::TimeDelta time_delta =
-      now - GetRecordedReferenceTime(last_sent_frame_id_);
-  const RtpTimeDelta rtp_delta =
-      RtpTimeDelta::FromTimeDelta(time_delta, rtp_timebase_);
-  const RtpTimeTicks now_as_rtp_timestamp =
-      GetRecordedRtpTimestamp(last_sent_frame_id_) + rtp_delta;
-  transport_sender_->SendSenderReport(ssrc_, now, now_as_rtp_timestamp);
-
-  if (schedule_future_reports) ScheduleNextRtcpReport();
-}
-
-void FrameSender::OnMeasuredRoundTripTime(base::TimeDelta rtt) {
-  DCHECK(rtt > base::TimeDelta());
-  current_round_trip_time_ = rtt;
-}
-
-void FrameSender::SetTargetPlayoutDelay(
-    base::TimeDelta new_target_playout_delay) {
-  if (send_target_playout_delay_ &&
-      target_playout_delay_ == new_target_playout_delay) {
-    return;
-  }
-  new_target_playout_delay =
-      std::max(new_target_playout_delay, min_playout_delay_);
-  new_target_playout_delay =
-      std::min(new_target_playout_delay, max_playout_delay_);
-  VLOG(2) << SENDER_SSRC << "Target playout delay changing from "
-          << target_playout_delay_.InMilliseconds() << " ms to "
-          << new_target_playout_delay.InMilliseconds() << " ms.";
-  target_playout_delay_ = new_target_playout_delay;
-  send_target_playout_delay_ = true;
-  congestion_control_->UpdateTargetPlayoutDelay(target_playout_delay_);
-}
-
-void FrameSender::ResendCheck() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!last_send_time_.is_null());
-  const base::TimeDelta time_since_last_send =
-      cast_environment_->Clock()->NowTicks() - last_send_time_;
-  if (time_since_last_send > target_playout_delay_) {
-    if (latest_acked_frame_id_ == last_sent_frame_id_) {
-      // Last frame acked, no point in doing anything
-    } else {
-      VLOG(1) << SENDER_SSRC
-              << "ACK timeout; last acked frame: " << latest_acked_frame_id_;
-      ResendForKickstart();
-    }
-  }
-  ScheduleNextResendCheck();
-}
-
-void FrameSender::ScheduleNextResendCheck() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!last_send_time_.is_null());
-  base::TimeDelta time_to_next = last_send_time_ -
-                                 cast_environment_->Clock()->NowTicks() +
-                                 target_playout_delay_;
-  time_to_next = std::max(
-      time_to_next, base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
-  cast_environment_->PostDelayedTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(&FrameSender::ResendCheck, weak_factory_.GetWeakPtr()),
-      time_to_next);
-}
-
-void FrameSender::ResendForKickstart() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!last_send_time_.is_null());
-  VLOG(1) << SENDER_SSRC << "Resending last packet of frame "
-          << last_sent_frame_id_ << " to kick-start.";
-  last_send_time_ = cast_environment_->Clock()->NowTicks();
-  transport_sender_->ResendFrameForKickstart(ssrc_, last_sent_frame_id_);
-}
-
-void FrameSender::RecordLatestFrameTimestamps(FrameId frame_id,
-                                              base::TimeTicks reference_time,
-                                              RtpTimeTicks rtp_timestamp) {
-  DCHECK(!reference_time.is_null());
-  frame_reference_times_[frame_id.lower_8_bits()] = reference_time;
-  frame_rtp_timestamps_[frame_id.lower_8_bits()] = rtp_timestamp;
-}
-
-base::TimeTicks FrameSender::GetRecordedReferenceTime(FrameId frame_id) const {
-  return frame_reference_times_[frame_id.lower_8_bits()];
-}
-
-RtpTimeTicks FrameSender::GetRecordedRtpTimestamp(FrameId frame_id) const {
-  return frame_rtp_timestamps_[frame_id.lower_8_bits()];
-}
-
-int FrameSender::GetUnacknowledgedFrameCount() const {
-  if (last_send_time_.is_null()) return 0;
-  const int count = last_sent_frame_id_ - latest_acked_frame_id_;
-  DCHECK_GE(count, 0);
-  return count;
-}
-
-base::TimeDelta FrameSender::GetAllowedInFlightMediaDuration() const {
-  // The total amount allowed in-flight media should equal the amount that fits
-  // within the entire playout delay window, plus the amount of time it takes to
-  // receive an ACK from the receiver.
-  // TODO(miu): Research is needed, but there is likely a better formula.
-  return target_playout_delay_ + (current_round_trip_time_ / 2);
-}
-
-void FrameSender::SendEncodedFrame(
-    int requested_bitrate_before_encode,
-    std::unique_ptr<SenderEncodedFrame> encoded_frame) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  VLOG(2) << SENDER_SSRC
-          << "About to send another frame: last_sent=" << last_sent_frame_id_
-          << ", latest_acked=" << latest_acked_frame_id_;
-
-  const FrameId frame_id = encoded_frame->frame_id;
-  const bool is_first_frame_to_be_sent = last_send_time_.is_null();
-
-  if (picture_lost_at_receiver_ &&
-      (encoded_frame->dependency == EncodedFrame::KEY)) {
-    picture_lost_at_receiver_ = false;
-    DCHECK(frame_id > latest_acked_frame_id_);
-    // Cancel sending remaining frames.
-    std::vector<FrameId> cancel_sending_frames;
-    for (FrameId id = latest_acked_frame_id_ + 1; id < frame_id; ++id) {
-      cancel_sending_frames.push_back(id);
-    }
-    transport_sender_->CancelSendingFrames(ssrc_, cancel_sending_frames);
-  }
-
-  last_send_time_ = cast_environment_->Clock()->NowTicks();
-  last_sent_frame_id_ = frame_id;
-  // If this is the first frame about to be sent, fake the value of
-  // |latest_acked_frame_id_| to indicate the receiver starts out all caught up.
-  // Also, schedule the periodic frame re-send checks.
-  if (is_first_frame_to_be_sent) {
-    latest_acked_frame_id_ = frame_id - 1;
-    ScheduleNextResendCheck();
-  }
-
-  VLOG_IF(1, !is_audio_ && encoded_frame->dependency == EncodedFrame::KEY)
-      << SENDER_SSRC << "Sending encoded key frame, id=" << frame_id;
-
-  std::unique_ptr<FrameEvent> encode_event(new FrameEvent());
-  encode_event->timestamp = encoded_frame->encode_completion_time;
-  encode_event->type = FRAME_ENCODED;
-  encode_event->media_type = is_audio_ ? AUDIO_EVENT : VIDEO_EVENT;
-  encode_event->rtp_timestamp = encoded_frame->rtp_timestamp;
-  encode_event->frame_id = frame_id;
-  encode_event->size = base::checked_cast<uint32_t>(encoded_frame->data.size());
-  encode_event->key_frame = encoded_frame->dependency == EncodedFrame::KEY;
-  encode_event->target_bitrate = requested_bitrate_before_encode;
-  encode_event->encoder_cpu_utilization = encoded_frame->encoder_utilization;
-  encode_event->idealized_bitrate_utilization =
-      encoded_frame->lossy_utilization;
-  cast_environment_->logger()->DispatchFrameEvent(std::move(encode_event));
-
-  RecordLatestFrameTimestamps(frame_id, encoded_frame->reference_time,
-                              encoded_frame->rtp_timestamp);
-
-  if (!is_audio_) {
-    // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
-    TRACE_EVENT_INSTANT1("cast_perf_test", "VideoFrameEncoded",
-                         TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
-                         encoded_frame->rtp_timestamp.lower_32_bits());
-  }
-
-  // At the start of the session, it's important to send reports before each
-  // frame so that the receiver can properly compute playout times.  The reason
-  // more than one report is sent is because transmission is not guaranteed,
-  // only best effort, so send enough that one should almost certainly get
-  // through.
-  if (num_aggressive_rtcp_reports_sent_ < kNumAggressiveReportsSentAtStart) {
-    // SendRtcpReport() will schedule future reports to be made if this is the
-    // last "aggressive report."
-    ++num_aggressive_rtcp_reports_sent_;
-    const bool is_last_aggressive_report =
-        (num_aggressive_rtcp_reports_sent_ == kNumAggressiveReportsSentAtStart);
-    VLOG_IF(1, is_last_aggressive_report) << SENDER_SSRC
-                                          << "Sending last aggressive report.";
-    SendRtcpReport(is_last_aggressive_report);
-  }
-
-  congestion_control_->SendFrameToTransport(
-      frame_id, encoded_frame->data.size() * 8, last_send_time_);
-
-  if (send_target_playout_delay_) {
-    encoded_frame->new_playout_delay_ms =
-        target_playout_delay_.InMilliseconds();
-  }
-
-  TRACE_EVENT_ASYNC_BEGIN1("cast.stream",
-                           is_audio_ ? "Audio Transport" : "Video Transport",
-                           frame_id.lower_32_bits(), "rtp_timestamp",
-                           encoded_frame->rtp_timestamp.lower_32_bits());
-  transport_sender_->InsertFrame(ssrc_, *encoded_frame);
-}
-
-void FrameSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  const bool have_valid_rtt = current_round_trip_time_ > base::TimeDelta();
-  if (have_valid_rtt) {
-    congestion_control_->UpdateRtt(current_round_trip_time_);
-
-    // Having the RTT value implies the receiver sent back a receiver report
-    // based on it having received a report from here.  Therefore, ensure this
-    // sender stops aggressively sending reports.
-    if (num_aggressive_rtcp_reports_sent_ < kNumAggressiveReportsSentAtStart) {
-      VLOG(1) << SENDER_SSRC
-              << "No longer a need to send reports aggressively (sent "
-              << num_aggressive_rtcp_reports_sent_ << ").";
-      num_aggressive_rtcp_reports_sent_ = kNumAggressiveReportsSentAtStart;
-      ScheduleNextRtcpReport();
-    }
-  }
-
-  if (last_send_time_.is_null())
-    return;  // Cannot get an ACK without having first sent a frame.
-
-  if (cast_feedback.missing_frames_and_packets.empty() &&
-      cast_feedback.received_later_frames.empty()) {
-    if (latest_acked_frame_id_ == cast_feedback.ack_frame_id) {
-      VLOG(1) << SENDER_SSRC << "Received duplicate ACK for frame "
-              << latest_acked_frame_id_;
-      TRACE_EVENT_INSTANT2(
-          "cast.stream", "Duplicate ACK", TRACE_EVENT_SCOPE_THREAD,
-          "ack_frame_id", cast_feedback.ack_frame_id.lower_32_bits(),
-          "last_sent_frame_id", last_sent_frame_id_.lower_32_bits());
-    }
-    // We only count duplicate ACKs when we have sent newer frames.
-    if (latest_acked_frame_id_ == cast_feedback.ack_frame_id &&
-        latest_acked_frame_id_ != last_sent_frame_id_) {
-      duplicate_ack_counter_++;
-    } else {
-      duplicate_ack_counter_ = 0;
-    }
-    // TODO(miu): The values "2" and "3" should be derived from configuration.
-    if (duplicate_ack_counter_ >= 2 && duplicate_ack_counter_ % 3 == 2) {
-      ResendForKickstart();
-    }
-  } else {
-    // Only count duplicated ACKs if there is no NACK request in between.
-    // This is to avoid aggresive resend.
-    duplicate_ack_counter_ = 0;
-  }
-
-  base::TimeTicks now = cast_environment_->Clock()->NowTicks();
-  congestion_control_->AckFrame(cast_feedback.ack_frame_id, now);
-  if (!cast_feedback.received_later_frames.empty()) {
-    // Ack the received frames.
-    congestion_control_->AckLaterFrames(cast_feedback.received_later_frames,
-                                        now);
-  }
-
-  std::unique_ptr<FrameEvent> ack_event(new FrameEvent());
-  ack_event->timestamp = now;
-  ack_event->type = FRAME_ACK_RECEIVED;
-  ack_event->media_type = is_audio_ ? AUDIO_EVENT : VIDEO_EVENT;
-  ack_event->rtp_timestamp =
-      GetRecordedRtpTimestamp(cast_feedback.ack_frame_id);
-  ack_event->frame_id = cast_feedback.ack_frame_id;
-  cast_environment_->logger()->DispatchFrameEvent(std::move(ack_event));
-
-  const bool is_acked_out_of_order =
-      cast_feedback.ack_frame_id < latest_acked_frame_id_;
-  VLOG(2) << SENDER_SSRC << "Received ACK"
-          << (is_acked_out_of_order ? " out-of-order" : "") << " for frame "
-          << cast_feedback.ack_frame_id;
-  if (is_acked_out_of_order) {
-    TRACE_EVENT_INSTANT2(
-        "cast.stream", "ACK out of order", TRACE_EVENT_SCOPE_THREAD,
-        "ack_frame_id", cast_feedback.ack_frame_id.lower_32_bits(),
-        "latest_acked_frame_id", latest_acked_frame_id_.lower_32_bits());
-  } else if (latest_acked_frame_id_ < cast_feedback.ack_frame_id) {
-    // Cancel resends of acked frames.
-    std::vector<FrameId> frames_to_cancel;
-    frames_to_cancel.reserve(cast_feedback.ack_frame_id -
-                             latest_acked_frame_id_);
-    do {
-      ++latest_acked_frame_id_;
-      frames_to_cancel.push_back(latest_acked_frame_id_);
-      // This is a good place to match the trace for frame ids
-      // since this ensures we not only track frame ids that are
-      // implicitly ACKed, but also handles duplicate ACKs
-      TRACE_EVENT_ASYNC_END1(
-          "cast.stream", is_audio_ ? "Audio Transport" : "Video Transport",
-          latest_acked_frame_id_.lower_32_bits(), "RTT_usecs",
-          current_round_trip_time_.InMicroseconds());
-    } while (latest_acked_frame_id_ < cast_feedback.ack_frame_id);
-    transport_sender_->CancelSendingFrames(ssrc_, frames_to_cancel);
-  }
-}
-
-void FrameSender::OnReceivedPli() { picture_lost_at_receiver_ = true; }
-
-bool FrameSender::ShouldDropNextFrame(base::TimeDelta frame_duration) const {
-  // Check that accepting the next frame won't cause more frames to become
-  // in-flight than the system's design limit.
-  const int count_frames_in_flight =
-      GetUnacknowledgedFrameCount() + GetNumberOfFramesInEncoder();
-  if (count_frames_in_flight >= kMaxUnackedFrames) {
-    VLOG(1) << SENDER_SSRC << "Dropping: Too many frames would be in-flight.";
-    return true;
-  }
-
-  // Check that accepting the next frame won't exceed the configured maximum
-  // frame rate, allowing for short-term bursts.
-  base::TimeDelta duration_in_flight = GetInFlightMediaDuration();
-  const double max_frames_in_flight =
-      max_frame_rate_ * duration_in_flight.InSecondsF();
-  if (count_frames_in_flight >= max_frames_in_flight + kMaxFrameBurst) {
-    VLOG(1) << SENDER_SSRC << "Dropping: Burst threshold would be exceeded.";
-    return true;
-  }
-
-  // Check that accepting the next frame won't exceed the allowed in-flight
-  // media duration.
-  const base::TimeDelta duration_would_be_in_flight =
-      duration_in_flight + frame_duration;
-  const base::TimeDelta allowed_in_flight = GetAllowedInFlightMediaDuration();
-  if (VLOG_IS_ON(1)) {
-    const int64_t percent =
-        allowed_in_flight > base::TimeDelta()
-            ? 100 * duration_would_be_in_flight / allowed_in_flight
-            : std::numeric_limits<int64_t>::max();
-    VLOG_IF(1, percent > 50)
-        << SENDER_SSRC << duration_in_flight.InMicroseconds()
-        << " usec in-flight + " << frame_duration.InMicroseconds()
-        << " usec for next frame --> " << percent << "% of allowed in-flight.";
-  }
-  if (duration_would_be_in_flight > allowed_in_flight) {
-    VLOG(1) << SENDER_SSRC << "Dropping: In-flight duration would be too high.";
-    return true;
-  }
-
-  // Next frame is accepted.
-  return false;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/frame_sender.h b/src/cobalt/media/cast/sender/frame_sender.h
deleted file mode 100644
index 355d4ca..0000000
--- a/src/cobalt/media/cast/sender/frame_sender.h
+++ /dev/null
@@ -1,208 +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 is the base class for an object that send frames to a receiver.
-// TODO(hclam): Refactor such that there is no separate AudioSender vs.
-// VideoSender, and the functionality of both is rolled into this class.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_FRAME_SENDER_H_
-#define COBALT_MEDIA_CAST_SENDER_FRAME_SENDER_H_
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/time/time.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/net/cast_transport.h"
-#include "media/cast/net/rtcp/rtcp_defines.h"
-#include "media/cast/sender/congestion_control.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-struct SenderEncodedFrame;
-
-class FrameSender {
- public:
-  FrameSender(scoped_refptr<CastEnvironment> cast_environment,
-              CastTransport* const transport_sender,
-              const FrameSenderConfig& config,
-              CongestionControl* congestion_control);
-  virtual ~FrameSender();
-
-  int rtp_timebase() const { return rtp_timebase_; }
-
-  // Calling this function is only valid if the receiver supports the
-  // "extra_playout_delay", rtp extension.
-  void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay);
-
-  base::TimeDelta GetTargetPlayoutDelay() const {
-    return target_playout_delay_;
-  }
-
-  // Called by the encoder with the next EncodeFrame to send.
-  void SendEncodedFrame(int requested_bitrate_before_encode,
-                        std::unique_ptr<SenderEncodedFrame> encoded_frame);
-
- protected:
-  // Returns the number of frames in the encoder's backlog.
-  virtual int GetNumberOfFramesInEncoder() const = 0;
-
-  // Returns the duration of the data in the encoder's backlog plus the duration
-  // of sent, unacknowledged frames.
-  virtual base::TimeDelta GetInFlightMediaDuration() const = 0;
-
- protected:
-  class RtcpClient : public RtcpObserver {
-   public:
-    explicit RtcpClient(base::WeakPtr<FrameSender> frame_sender);
-    ~RtcpClient() override;
-
-    void OnReceivedCastMessage(const RtcpCastMessage& cast_message) override;
-    void OnReceivedRtt(base::TimeDelta round_trip_time) override;
-    void OnReceivedPli() override;
-
-   private:
-    const base::WeakPtr<FrameSender> frame_sender_;
-  };
-  // Schedule and execute periodic sending of RTCP report.
-  void ScheduleNextRtcpReport();
-  void SendRtcpReport(bool schedule_future_reports);
-
-  // Protected for testability.
-  void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback);
-
-  // Called when a Pli message is received.
-  void OnReceivedPli();
-
-  void OnMeasuredRoundTripTime(base::TimeDelta rtt);
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-
-  // Sends encoded frames over the configured transport (e.g., UDP).  In
-  // Chromium, this could be a proxy that first sends the frames from a renderer
-  // process to the browser process over IPC, with the browser process being
-  // responsible for "packetizing" the frames and pushing packets into the
-  // network layer.
-  CastTransport* const transport_sender_;
-
-  const uint32_t ssrc_;
-
- protected:
-  // Schedule and execute periodic checks for re-sending packets.  If no
-  // acknowledgements have been received for "too long," AudioSender will
-  // speculatively re-send certain packets of an unacked frame to kick-start
-  // re-transmission.  This is a last resort tactic to prevent the session from
-  // getting stuck after a long outage.
-  void ScheduleNextResendCheck();
-  void ResendCheck();
-  void ResendForKickstart();
-
-  // Returns true if too many frames would be in-flight by encoding and sending
-  // the next frame having the given |frame_duration|.
-  bool ShouldDropNextFrame(base::TimeDelta frame_duration) const;
-
-  // Record or retrieve a recent history of each frame's timestamps.
-  // Warning: If a frame ID too far in the past is requested, the getters will
-  // silently succeed but return incorrect values.  Be sure to respect
-  // media::cast::kMaxUnackedFrames.
-  void RecordLatestFrameTimestamps(FrameId frame_id,
-                                   base::TimeTicks reference_time,
-                                   RtpTimeTicks rtp_timestamp);
-  base::TimeTicks GetRecordedReferenceTime(FrameId frame_id) const;
-  RtpTimeTicks GetRecordedRtpTimestamp(FrameId frame_id) const;
-
-  // Returns the number of frames that were sent but not yet acknowledged.
-  int GetUnacknowledgedFrameCount() const;
-
-  // Playout delay represents total amount of time between a frame's
-  // capture/recording on the sender and its playback on the receiver
-  // (i.e., shown to a user).  This should be a value large enough to
-  // give the system sufficient time to encode, transmit/retransmit,
-  // receive, decode, and render; given its run-time environment
-  // (sender/receiver hardware performance, network conditions,etc.).
-
-  // The |target_playout delay_| is the current delay that is adaptively
-  // adjusted based on feedback from video capture engine and the congestion
-  // control. In case of interactive content, the target is adjusted to start
-  // at |min_playout_delay_| and in case of animated content, it starts out at
-  // |animated_playout_delay_| and then adaptively adjust based on feedback
-  // from congestion control.
-  base::TimeDelta target_playout_delay_;
-  const base::TimeDelta min_playout_delay_;
-  const base::TimeDelta max_playout_delay_;
-  // Starting playout delay for animated content.
-  const base::TimeDelta animated_playout_delay_;
-
-  // If true, we transmit the target playout delay to the receiver.
-  bool send_target_playout_delay_;
-
-  // Max encoded frames generated per second.
-  double max_frame_rate_;
-
-  // Counts how many RTCP reports are being "aggressively" sent (i.e., one per
-  // frame) at the start of the session.  Once a threshold is reached, RTCP
-  // reports are instead sent at the configured interval + random drift.
-  int num_aggressive_rtcp_reports_sent_;
-
-  // This is "null" until the first frame is sent.  Thereafter, this tracks the
-  // last time any frame was sent or re-sent.
-  base::TimeTicks last_send_time_;
-
-  // The ID of the last frame sent.  This member is invalid until
-  // |!last_send_time_.is_null()|.
-  FrameId last_sent_frame_id_;
-
-  // The ID of the latest (not necessarily the last) frame that has been
-  // acknowledged.  This member is invalid until |!last_send_time_.is_null()|.
-  FrameId latest_acked_frame_id_;
-
-  // Counts the number of duplicate ACK that are being received.  When this
-  // number reaches a threshold, the sender will take this as a sign that the
-  // receiver hasn't yet received the first packet of the next frame.  In this
-  // case, VideoSender will trigger a re-send of the next frame.
-  int duplicate_ack_counter_;
-
-  // This object controls how we change the bitrate to make sure the
-  // buffer doesn't overflow.
-  std::unique_ptr<CongestionControl> congestion_control_;
-
-  // The most recently measured round trip time.
-  base::TimeDelta current_round_trip_time_;
-
-  // This flag is set true when a Pli message is received. It is cleared once
-  // the FrameSender scheduled an encoded key frame to be sent.
-  bool picture_lost_at_receiver_;
-
- private:
-  // Returns the maximum media duration currently allowed in-flight.  This
-  // fluctuates in response to the currently-measured network latency.
-  base::TimeDelta GetAllowedInFlightMediaDuration() const;
-
-  // RTP timestamp increment representing one second.
-  const int rtp_timebase_;
-
-  const bool is_audio_;
-
-  // Ring buffers to keep track of recent frame timestamps (both in terms of
-  // local reference time and RTP media time).  These should only be accessed
-  // through the Record/GetXXX() methods.  The index into this ring
-  // buffer is the lower 8 bits of the FrameId.
-  base::TimeTicks frame_reference_times_[256];
-  RtpTimeTicks frame_rtp_timestamps_[256];
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<FrameSender> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(FrameSender);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_FRAME_SENDER_H_
diff --git a/src/cobalt/media/cast/sender/h264_vt_encoder.cc b/src/cobalt/media/cast/sender/h264_vt_encoder.cc
deleted file mode 100644
index 567d0bc..0000000
--- a/src/cobalt/media/cast/sender/h264_vt_encoder.cc
+++ /dev/null
@@ -1,581 +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.
-
-#include "media/cast/sender/h264_vt_encoder.h"
-
-#include <string>
-#include <vector>
-
-#include "base/big_endian.h"
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/power_monitor/power_monitor.h"
-#include "base/synchronization/lock.h"
-#include "build/build_config.h"
-#include "media/base/mac/corevideo_glue.h"
-#include "media/base/mac/video_frame_mac.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/constants.h"
-#include "media/cast/sender/video_frame_factory.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-// Container for the associated data of a video frame being processed.
-struct InProgressFrameEncode {
-  const RtpTimeTicks rtp_timestamp;
-  const base::TimeTicks reference_time;
-  const VideoEncoder::FrameEncodedCallback frame_encoded_callback;
-
-  InProgressFrameEncode(RtpTimeTicks rtp, base::TimeTicks r_time,
-                        VideoEncoder::FrameEncodedCallback callback)
-      : rtp_timestamp(rtp),
-        reference_time(r_time),
-        frame_encoded_callback(callback) {}
-};
-
-}  // namespace
-
-class H264VideoToolboxEncoder::VideoFrameFactoryImpl
-    : public base::RefCountedThreadSafe<VideoFrameFactoryImpl>,
-      public VideoFrameFactory {
- public:
-  // Type that proxies the VideoFrameFactory interface to this class.
-  class Proxy;
-
-  VideoFrameFactoryImpl(const base::WeakPtr<H264VideoToolboxEncoder>& encoder,
-                        const scoped_refptr<CastEnvironment>& cast_environment)
-      : encoder_(encoder), cast_environment_(cast_environment) {}
-
-  scoped_refptr<VideoFrame> MaybeCreateFrame(const gfx::Size& frame_size,
-                                             base::TimeDelta timestamp) final {
-    if (frame_size.IsEmpty()) {
-      DVLOG(1) << "Rejecting empty video frame.";
-      return nullptr;
-    }
-
-    base::AutoLock auto_lock(lock_);
-
-    // If the pool size does not match, speculatively reset the encoder to use
-    // the new size and return null. Cache the new frame size right away and
-    // toss away the pixel buffer pool to avoid spurious tasks until the encoder
-    // is done resetting.
-    if (frame_size != pool_frame_size_) {
-      DVLOG(1) << "MaybeCreateFrame: Detected frame size change.";
-      cast_environment_->PostTask(
-          CastEnvironment::MAIN, FROM_HERE,
-          base::Bind(&H264VideoToolboxEncoder::UpdateFrameSize, encoder_,
-                     frame_size));
-      pool_frame_size_ = frame_size;
-      pool_.reset();
-      return nullptr;
-    }
-
-    if (!pool_) {
-      DVLOG(1) << "MaybeCreateFrame: No pixel buffer pool.";
-      return nullptr;
-    }
-
-    // Allocate a pixel buffer from the pool and return a wrapper VideoFrame.
-    base::ScopedCFTypeRef<CVPixelBufferRef> buffer;
-    auto status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, pool_,
-                                                     buffer.InitializeInto());
-    if (status != kCVReturnSuccess) {
-      DLOG(ERROR) << "CVPixelBufferPoolCreatePixelBuffer failed: " << status;
-      return nullptr;
-    }
-
-    DCHECK(buffer);
-    return VideoFrame::WrapCVPixelBuffer(buffer, timestamp);
-  }
-
-  void Update(const base::ScopedCFTypeRef<CVPixelBufferPoolRef>& pool,
-              const gfx::Size& frame_size) {
-    base::AutoLock auto_lock(lock_);
-    pool_ = pool;
-    pool_frame_size_ = frame_size;
-  }
-
- private:
-  friend class base::RefCountedThreadSafe<VideoFrameFactoryImpl>;
-  ~VideoFrameFactoryImpl() final {}
-
-  base::Lock lock_;
-  base::ScopedCFTypeRef<CVPixelBufferPoolRef> pool_;
-  gfx::Size pool_frame_size_;
-
-  // Weak back reference to the encoder and the cast envrionment so we can
-  // message the encoder when the frame size changes.
-  const base::WeakPtr<H264VideoToolboxEncoder> encoder_;
-  const scoped_refptr<CastEnvironment> cast_environment_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoFrameFactoryImpl);
-};
-
-class H264VideoToolboxEncoder::VideoFrameFactoryImpl::Proxy
-    : public VideoFrameFactory {
- public:
-  explicit Proxy(
-      const scoped_refptr<VideoFrameFactoryImpl>& video_frame_factory)
-      : video_frame_factory_(video_frame_factory) {
-    DCHECK(video_frame_factory_);
-  }
-
-  scoped_refptr<VideoFrame> MaybeCreateFrame(const gfx::Size& frame_size,
-                                             base::TimeDelta timestamp) final {
-    return video_frame_factory_->MaybeCreateFrame(frame_size, timestamp);
-  }
-
- private:
-  ~Proxy() final {}
-
-  const scoped_refptr<VideoFrameFactoryImpl> video_frame_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(Proxy);
-};
-
-// static
-bool H264VideoToolboxEncoder::IsSupported(
-    const FrameSenderConfig& video_config) {
-  return video_config.codec == CODEC_VIDEO_H264 && VideoToolboxGlue::Get();
-}
-
-H264VideoToolboxEncoder::H264VideoToolboxEncoder(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb)
-    : cast_environment_(cast_environment),
-      videotoolbox_glue_(VideoToolboxGlue::Get()),
-      video_config_(video_config),
-      status_change_cb_(status_change_cb),
-      next_frame_id_(FrameId::first()),
-      encode_next_frame_as_keyframe_(false),
-      power_suspended_(false),
-      weak_factory_(this) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!status_change_cb_.is_null());
-
-  OperationalStatus operational_status =
-      H264VideoToolboxEncoder::IsSupported(video_config)
-          ? STATUS_INITIALIZED
-          : STATUS_UNSUPPORTED_CODEC;
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(status_change_cb_, operational_status));
-
-  if (operational_status == STATUS_INITIALIZED) {
-    // Create the shared video frame factory. It persists for the combined
-    // lifetime of the encoder and all video frame factory proxies created by
-    // |CreateVideoFrameFactory| that reference it.
-    video_frame_factory_ =
-        scoped_refptr<VideoFrameFactoryImpl>(new VideoFrameFactoryImpl(
-            weak_factory_.GetWeakPtr(), cast_environment_));
-
-    // Register for power state changes.
-    auto* power_monitor = base::PowerMonitor::Get();
-    if (power_monitor) {
-      power_monitor->AddObserver(this);
-      VLOG(1) << "Registered for power state changes.";
-    } else {
-      DLOG(WARNING) << "No power monitor. Process suspension will invalidate "
-                       "the encoder.";
-    }
-  }
-}
-
-H264VideoToolboxEncoder::~H264VideoToolboxEncoder() {
-  DestroyCompressionSession();
-
-  // If video_frame_factory_ is not null, the encoder registered for power state
-  // changes in the ctor and it must now unregister.
-  if (video_frame_factory_) {
-    auto* power_monitor = base::PowerMonitor::Get();
-    if (power_monitor) power_monitor->RemoveObserver(this);
-  }
-}
-
-void H264VideoToolboxEncoder::ResetCompressionSession() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  // Ignore reset requests while power suspended.
-  if (power_suspended_) return;
-
-  // Notify that we're resetting the encoder.
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(status_change_cb_, STATUS_CODEC_REINIT_PENDING));
-
-  // Destroy the current session, if any.
-  DestroyCompressionSession();
-
-  // On OS X, allow the hardware encoder. Don't require it, it does not support
-  // all configurations (some of which are used for testing).
-  base::ScopedCFTypeRef<CFDictionaryRef> encoder_spec;
-#if !defined(OS_IOS)
-  encoder_spec = video_toolbox::DictionaryWithKeyValue(
-      videotoolbox_glue_
-          ->kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder(),
-      kCFBooleanTrue);
-#endif
-
-  // Force 420v so that clients can easily use these buffers as GPU textures.
-  const int format[] = {
-      CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange};
-
-  // Keep these attachment settings in-sync with those in ConfigureSession().
-  CFTypeRef attachments_keys[] = {kCVImageBufferColorPrimariesKey,
-                                  kCVImageBufferTransferFunctionKey,
-                                  kCVImageBufferYCbCrMatrixKey};
-  CFTypeRef attachments_values[] = {kCVImageBufferColorPrimaries_ITU_R_709_2,
-                                    kCVImageBufferTransferFunction_ITU_R_709_2,
-                                    kCVImageBufferYCbCrMatrix_ITU_R_709_2};
-  CFTypeRef buffer_attributes_keys[] = {kCVPixelBufferPixelFormatTypeKey,
-                                        kCVBufferPropagatedAttachmentsKey};
-  CFTypeRef buffer_attributes_values[] = {
-      video_toolbox::ArrayWithIntegers(format, arraysize(format)).release(),
-      video_toolbox::DictionaryWithKeysAndValues(
-          attachments_keys, attachments_values, arraysize(attachments_keys))
-          .release()};
-  const base::ScopedCFTypeRef<CFDictionaryRef> buffer_attributes =
-      video_toolbox::DictionaryWithKeysAndValues(
-          buffer_attributes_keys, buffer_attributes_values,
-          arraysize(buffer_attributes_keys));
-  for (auto* v : buffer_attributes_values) CFRelease(v);
-
-  // Create the compression session.
-
-  // Note that the encoder object is given to the compression session as the
-  // callback context using a raw pointer. The C API does not allow us to use a
-  // smart pointer, nor is this encoder ref counted. However, this is still
-  // safe, because we 1) we own the compression session and 2) we tear it down
-  // safely. When destructing the encoder, the compression session is flushed
-  // and invalidated. Internally, VideoToolbox will join all of its threads
-  // before returning to the client. Therefore, when control returns to us, we
-  // are guaranteed that the output callback will not execute again.
-  OSStatus status = videotoolbox_glue_->VTCompressionSessionCreate(
-      kCFAllocatorDefault, frame_size_.width(), frame_size_.height(),
-      CoreMediaGlue::kCMVideoCodecType_H264, encoder_spec, buffer_attributes,
-      nullptr /* compressedDataAllocator */,
-      &H264VideoToolboxEncoder::CompressionCallback,
-      reinterpret_cast<void*>(this), compression_session_.InitializeInto());
-  if (status != noErr) {
-    DLOG(ERROR) << " VTCompressionSessionCreate failed: " << status;
-    // Notify that reinitialization has failed.
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(status_change_cb_, STATUS_CODEC_INIT_FAILED));
-    return;
-  }
-
-  // Configure the session (apply session properties based on the current state
-  // of the encoder, experimental tuning and requirements).
-  ConfigureCompressionSession();
-
-  // Update the video frame factory.
-  base::ScopedCFTypeRef<CVPixelBufferPoolRef> pool(
-      videotoolbox_glue_->VTCompressionSessionGetPixelBufferPool(
-          compression_session_),
-      base::scoped_policy::RETAIN);
-  video_frame_factory_->Update(pool, frame_size_);
-
-  // Notify that reinitialization is done.
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(status_change_cb_, STATUS_INITIALIZED));
-}
-
-void H264VideoToolboxEncoder::ConfigureCompressionSession() {
-  video_toolbox::SessionPropertySetter session_property_setter(
-      compression_session_, videotoolbox_glue_);
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_ProfileLevel(),
-      videotoolbox_glue_->kVTProfileLevel_H264_Main_AutoLevel());
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_RealTime(), true);
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_AllowFrameReordering(),
-      false);
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_MaxKeyFrameInterval(), 240);
-  session_property_setter.Set(
-      videotoolbox_glue_
-          ->kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration(),
-      240);
-  // TODO(jfroy): implement better bitrate control
-  //              https://crbug.com/425352
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_AverageBitRate(),
-      (video_config_.min_bitrate + video_config_.max_bitrate) / 2);
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_ExpectedFrameRate(),
-      static_cast<int>(video_config_.max_frame_rate + 0.5));
-  // Keep these attachment settings in-sync with those in Initialize().
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_ColorPrimaries(),
-      kCVImageBufferColorPrimaries_ITU_R_709_2);
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_TransferFunction(),
-      kCVImageBufferTransferFunction_ITU_R_709_2);
-  session_property_setter.Set(
-      videotoolbox_glue_->kVTCompressionPropertyKey_YCbCrMatrix(),
-      kCVImageBufferYCbCrMatrix_ITU_R_709_2);
-  if (video_config_.video_codec_params.max_number_of_video_buffers_used > 0) {
-    session_property_setter.Set(
-        videotoolbox_glue_->kVTCompressionPropertyKey_MaxFrameDelayCount(),
-        video_config_.video_codec_params.max_number_of_video_buffers_used);
-  }
-}
-
-void H264VideoToolboxEncoder::DestroyCompressionSession() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  // If the compression session exists, invalidate it. This blocks until all
-  // pending output callbacks have returned and any internal threads have
-  // joined, ensuring no output callback ever sees a dangling encoder pointer.
-  //
-  // Before destroying the compression session, the video frame factory's pool
-  // is updated to null so that no thread will produce new video frames via the
-  // factory until a new compression session is created. The current frame size
-  // is passed to prevent the video frame factory from posting |UpdateFrameSize|
-  // tasks. Indeed, |DestroyCompressionSession| is either called from
-  // |ResetCompressionSession|, in which case a new pool and frame size will be
-  // set, or from callsites that require that there be no compression session
-  // (ex: the dtor).
-  if (compression_session_) {
-    video_frame_factory_->Update(
-        base::ScopedCFTypeRef<CVPixelBufferPoolRef>(nullptr), frame_size_);
-    videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_);
-    compression_session_.reset();
-  }
-}
-
-bool H264VideoToolboxEncoder::EncodeVideoFrame(
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time,
-    const FrameEncodedCallback& frame_encoded_callback) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  DCHECK(!frame_encoded_callback.is_null());
-
-  // Reject empty video frames.
-  const gfx::Size frame_size = video_frame->visible_rect().size();
-  if (frame_size.IsEmpty()) {
-    DVLOG(1) << "Rejecting empty video frame.";
-    return false;
-  }
-
-  // Handle frame size changes. This will reset the compression session.
-  if (frame_size != frame_size_) {
-    DVLOG(1) << "EncodeVideoFrame: Detected frame size change.";
-    UpdateFrameSize(frame_size);
-  }
-
-  // Need a compression session to continue.
-  if (!compression_session_) {
-    DLOG(ERROR) << "No compression session.";
-    return false;
-  }
-
-  // Wrap the VideoFrame in a CVPixelBuffer. In all cases, no data will be
-  // copied. If the VideoFrame was created by this encoder's video frame
-  // factory, then the returned CVPixelBuffer will have been obtained from the
-  // compression session's pixel buffer pool. This will eliminate a copy of the
-  // frame into memory visible by the hardware encoder. The VideoFrame's
-  // lifetime is extended for the lifetime of the returned CVPixelBuffer.
-  auto pixel_buffer = media::WrapVideoFrameInCVPixelBuffer(*video_frame);
-  if (!pixel_buffer) {
-    DLOG(ERROR) << "WrapVideoFrameInCVPixelBuffer failed.";
-    return false;
-  }
-
-  // Convert the frame timestamp to CMTime.
-  auto timestamp_cm = CoreMediaGlue::CMTimeMake(
-      video_frame->timestamp().InMicroseconds(), USEC_PER_SEC);
-
-  // Wrap information we'll need after the frame is encoded in a heap object.
-  // We'll get the pointer back from the VideoToolbox completion callback.
-  std::unique_ptr<InProgressFrameEncode> request(new InProgressFrameEncode(
-      RtpTimeTicks::FromTimeDelta(video_frame->timestamp(), kVideoFrequency),
-      reference_time, frame_encoded_callback));
-
-  // Build a suitable frame properties dictionary for keyframes.
-  base::ScopedCFTypeRef<CFDictionaryRef> frame_props;
-  if (encode_next_frame_as_keyframe_) {
-    frame_props = video_toolbox::DictionaryWithKeyValue(
-        videotoolbox_glue_->kVTEncodeFrameOptionKey_ForceKeyFrame(),
-        kCFBooleanTrue);
-    encode_next_frame_as_keyframe_ = false;
-  }
-
-  // Submit the frame to the compression session. The function returns as soon
-  // as the frame has been enqueued.
-  OSStatus status = videotoolbox_glue_->VTCompressionSessionEncodeFrame(
-      compression_session_, pixel_buffer, timestamp_cm,
-      CoreMediaGlue::CMTime{0, 0, 0, 0}, frame_props,
-      reinterpret_cast<void*>(request.release()), nullptr);
-  if (status != noErr) {
-    DLOG(ERROR) << " VTCompressionSessionEncodeFrame failed: " << status;
-    return false;
-  }
-
-  return true;
-}
-
-void H264VideoToolboxEncoder::UpdateFrameSize(const gfx::Size& size_needed) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  // Our video frame factory posts a task to update the frame size when its
-  // cache of the frame size differs from what the client requested. To avoid
-  // spurious encoder resets, check again here.
-  if (size_needed == frame_size_) {
-    DCHECK(compression_session_);
-    return;
-  }
-
-  VLOG(1) << "Resetting compression session (for frame size change from "
-          << frame_size_.ToString() << " to " << size_needed.ToString() << ").";
-
-  // If there is an existing session, finish every pending frame.
-  if (compression_session_) {
-    EmitFrames();
-  }
-
-  // Store the new frame size.
-  frame_size_ = size_needed;
-
-  // Reset the compression session.
-  ResetCompressionSession();
-}
-
-void H264VideoToolboxEncoder::SetBitRate(int /*new_bit_rate*/) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  // VideoToolbox does not seem to support bitrate reconfiguration.
-}
-
-void H264VideoToolboxEncoder::GenerateKeyFrame() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  encode_next_frame_as_keyframe_ = true;
-}
-
-std::unique_ptr<VideoFrameFactory>
-H264VideoToolboxEncoder::CreateVideoFrameFactory() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  return std::unique_ptr<VideoFrameFactory>(
-      new VideoFrameFactoryImpl::Proxy(video_frame_factory_));
-}
-
-void H264VideoToolboxEncoder::EmitFrames() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (!compression_session_) return;
-
-  OSStatus status = videotoolbox_glue_->VTCompressionSessionCompleteFrames(
-      compression_session_, CoreMediaGlue::CMTime{0, 0, 0, 0});
-  if (status != noErr) {
-    DLOG(ERROR) << " VTCompressionSessionCompleteFrames failed: " << status;
-  }
-}
-
-void H264VideoToolboxEncoder::OnSuspend() {
-  VLOG(1)
-      << "OnSuspend: Emitting all frames and destroying compression session.";
-  EmitFrames();
-  DestroyCompressionSession();
-  power_suspended_ = true;
-}
-
-void H264VideoToolboxEncoder::OnResume() {
-  power_suspended_ = false;
-
-  // Reset the compression session only if the frame size is not zero (which
-  // will obviously fail). It is possible for the frame size to be zero if no
-  // frame was submitted for encoding or requested from the video frame factory
-  // before suspension.
-  if (!frame_size_.IsEmpty()) {
-    VLOG(1) << "OnResume: Resetting compression session.";
-    ResetCompressionSession();
-  }
-}
-
-void H264VideoToolboxEncoder::CompressionCallback(void* encoder_opaque,
-                                                  void* request_opaque,
-                                                  OSStatus status,
-                                                  VTEncodeInfoFlags info,
-                                                  CMSampleBufferRef sbuf) {
-  auto* encoder = reinterpret_cast<H264VideoToolboxEncoder*>(encoder_opaque);
-  const std::unique_ptr<InProgressFrameEncode> request(
-      reinterpret_cast<InProgressFrameEncode*>(request_opaque));
-  bool keyframe = false;
-  bool has_frame_data = false;
-
-  if (status != noErr) {
-    DLOG(ERROR) << " encoding failed: " << status;
-    encoder->cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(encoder->status_change_cb_, STATUS_CODEC_RUNTIME_ERROR));
-  } else if ((info & VideoToolboxGlue::kVTEncodeInfo_FrameDropped)) {
-    DVLOG(2) << " frame dropped";
-  } else {
-    auto* sample_attachments =
-        static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(
-            CoreMediaGlue::CMSampleBufferGetSampleAttachmentsArray(sbuf, true),
-            0));
-
-    // If the NotSync key is not present, it implies Sync, which indicates a
-    // keyframe (at least I think, VT documentation is, erm, sparse). Could
-    // alternatively use kCMSampleAttachmentKey_DependsOnOthers == false.
-    keyframe = !CFDictionaryContainsKey(
-        sample_attachments, CoreMediaGlue::kCMSampleAttachmentKey_NotSync());
-    has_frame_data = true;
-  }
-
-  // Grab the next frame ID and increment |next_frame_id_| for next time.
-  // VideoToolbox calls the output callback serially, so this is safe.
-  const FrameId frame_id = encoder->next_frame_id_++;
-
-  std::unique_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame());
-  encoded_frame->frame_id = frame_id;
-  encoded_frame->reference_time = request->reference_time;
-  encoded_frame->rtp_timestamp = request->rtp_timestamp;
-  if (keyframe) {
-    encoded_frame->dependency = EncodedFrame::KEY;
-    encoded_frame->referenced_frame_id = frame_id;
-  } else {
-    encoded_frame->dependency = EncodedFrame::DEPENDENT;
-    // H.264 supports complex frame reference schemes (multiple reference
-    // frames, slice references, backward and forward references, etc). Cast
-    // doesn't support the concept of forward-referencing frame dependencies or
-    // multiple frame dependencies; so pretend that all frames are only
-    // decodable after their immediately preceding frame is decoded. This will
-    // ensure a Cast receiver only attempts to decode the frames sequentially
-    // and in order. Furthermore, the encoder is configured to never use forward
-    // references (see |kVTCompressionPropertyKey_AllowFrameReordering|). There
-    // is no way to prevent multiple reference frames.
-    encoded_frame->referenced_frame_id = frame_id - 1;
-  }
-
-  if (has_frame_data) {
-    video_toolbox::CopySampleBufferToAnnexBBuffer(sbuf, keyframe,
-                                                  &encoded_frame->data);
-  }
-
-  // TODO(miu): Compute and populate the |encoder_utilization| and
-  // |lossy_utilization| performance metrics in |encoded_frame|.
-
-  encoded_frame->encode_completion_time =
-      encoder->cast_environment_->Clock()->NowTicks();
-  encoder->cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(request->frame_encoded_callback,
-                 base::Passed(&encoded_frame)));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/h264_vt_encoder.h b/src/cobalt/media/cast/sender/h264_vt_encoder.h
deleted file mode 100644
index 6fde2cd..0000000
--- a/src/cobalt/media/cast/sender/h264_vt_encoder.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
-
-#include "base/mac/scoped_cftyperef.h"
-#include "base/macros.h"
-#include "base/power_monitor/power_observer.h"
-#include "base/threading/thread_checker.h"
-#include "media/base/mac/videotoolbox_glue.h"
-#include "media/base/mac/videotoolbox_helpers.h"
-#include "media/cast/sender/size_adaptable_video_encoder_base.h"
-#include "media/cast/sender/video_encoder.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// VideoToolbox implementation of the media::cast::VideoEncoder interface.
-// VideoToolbox makes no guarantees that it is thread safe, so this object is
-// pinned to the thread on which it is constructed. Supports changing frame
-// sizes directly. Implements the base::PowerObserver interface to reset the
-// compression session when the host process is suspended.
-class H264VideoToolboxEncoder : public VideoEncoder,
-                                public base::PowerObserver {
-  typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef;
-  typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef;
-  typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags;
-
- public:
-  // Returns true if the current platform and system configuration supports
-  // using H264VideoToolboxEncoder with the given |video_config|.
-  static bool IsSupported(const FrameSenderConfig& video_config);
-
-  H264VideoToolboxEncoder(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb);
-  ~H264VideoToolboxEncoder() final;
-
-  // media::cast::VideoEncoder implementation
-  bool EncodeVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& reference_time,
-      const FrameEncodedCallback& frame_encoded_callback) final;
-  void SetBitRate(int new_bit_rate) final;
-  void GenerateKeyFrame() final;
-  std::unique_ptr<VideoFrameFactory> CreateVideoFrameFactory() final;
-  void EmitFrames() final;
-
-  // base::PowerObserver
-  void OnSuspend() final;
-  void OnResume() final;
-
- private:
-  // VideoFrameFactory tied to the VideoToolbox encoder.
-  class VideoFrameFactoryImpl;
-
-  // Reset the encoder's compression session by destroying the existing one
-  // using DestroyCompressionSession() and creating a new one. The new session
-  // is configured using ConfigureCompressionSession().
-  void ResetCompressionSession();
-
-  // Configure the current compression session using current encoder settings.
-  void ConfigureCompressionSession();
-
-  // Destroy the current compression session if any. Blocks until all pending
-  // frames have been flushed out (similar to EmitFrames without doing any
-  // encoding work).
-  void DestroyCompressionSession();
-
-  // Update the encoder's target frame size by resetting the compression
-  // session. This will also update the video frame factory.
-  void UpdateFrameSize(const gfx::Size& size_needed);
-
-  // Compression session callback function to handle compressed frames.
-  static void CompressionCallback(void* encoder_opaque, void* request_opaque,
-                                  OSStatus status, VTEncodeInfoFlags info,
-                                  CMSampleBufferRef sbuf);
-
-  // The cast environment (contains worker threads & more).
-  const scoped_refptr<CastEnvironment> cast_environment_;
-
-  // VideoToolboxGlue provides access to VideoToolbox at runtime.
-  const VideoToolboxGlue* const videotoolbox_glue_;
-
-  // VideoSenderConfig copy so we can create compression sessions on demand.
-  // This is needed to recover from backgrounding and other events that can
-  // invalidate compression sessions.
-  const FrameSenderConfig video_config_;
-
-  // Frame size of the current compression session. Can be changed by submitting
-  // a frame of a different size, which will cause a compression session reset.
-  gfx::Size frame_size_;
-
-  // Callback used to report initialization status and runtime errors.
-  const StatusChangeCallback status_change_cb_;
-
-  // Thread checker to enforce that this object is used on a specific thread.
-  base::ThreadChecker thread_checker_;
-
-  // The compression session.
-  base::ScopedCFTypeRef<VTCompressionSessionRef> compression_session_;
-
-  // Video frame factory tied to the encoder.
-  scoped_refptr<VideoFrameFactoryImpl> video_frame_factory_;
-
-  // The ID for the next frame to be emitted.
-  FrameId next_frame_id_;
-
-  // Force next frame to be a keyframe.
-  bool encode_next_frame_as_keyframe_;
-
-  // Power suspension state.
-  bool power_suspended_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<H264VideoToolboxEncoder> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/h264_vt_encoder_unittest.cc b/src/cobalt/media/cast/sender/h264_vt_encoder_unittest.cc
deleted file mode 100644
index e9fceab..0000000
--- a/src/cobalt/media/cast/sender/h264_vt_encoder_unittest.cc
+++ /dev/null
@@ -1,416 +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.
-
-#include <queue>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "base/power_monitor/power_monitor.h"
-#include "base/run_loop.h"
-#include "base/test/launcher/unit_test_launcher.h"
-#include "base/test/power_monitor_test_base.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/test/test_suite.h"
-#include "media/base/cdm_context.h"
-#include "media/base/decoder_buffer.h"
-#include "media/base/media.h"
-#include "media/base/media_switches.h"
-#include "media/base/media_util.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/constants.h"
-#include "media/cast/sender/h264_vt_encoder.h"
-#include "media/cast/sender/video_frame_factory.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "media/ffmpeg/ffmpeg_common.h"
-#include "media/filters/ffmpeg_glue.h"
-#include "media/filters/ffmpeg_video_decoder.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-const int kVideoWidth = 1280;
-const int kVideoHeight = 720;
-
-class MediaTestSuite : public base::TestSuite {
- public:
-  MediaTestSuite(int argc, char** argv) : TestSuite(argc, argv) {}
-  ~MediaTestSuite() final {}
-
- protected:
-  void Initialize() final;
-};
-
-void MediaTestSuite::Initialize() {
-  base::TestSuite::Initialize();
-  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
-  command_line->AppendSwitch(switches::kEnableInbandTextTracks);
-  media::InitializeMediaLibrary();
-}
-
-}  // namespace
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// See comment in end2end_unittest.cc for details on this value.
-const double kVideoAcceptedPSNR = 38.0;
-
-void SaveDecoderInitResult(bool* out_result, bool in_result) {
-  *out_result = in_result;
-}
-
-void SaveOperationalStatus(OperationalStatus* out_status,
-                           OperationalStatus in_status) {
-  *out_status = in_status;
-}
-
-class MetadataRecorder : public base::RefCountedThreadSafe<MetadataRecorder> {
- public:
-  MetadataRecorder() : count_frames_delivered_(0) {}
-
-  int count_frames_delivered() const { return count_frames_delivered_; }
-
-  void PushExpectation(FrameId expected_frame_id,
-                       FrameId expected_last_referenced_frame_id,
-                       RtpTimeTicks expected_rtp_timestamp,
-                       const base::TimeTicks& expected_reference_time) {
-    expectations_.push(
-        Expectation{expected_frame_id, expected_last_referenced_frame_id,
-                    expected_rtp_timestamp, expected_reference_time});
-  }
-
-  void CompareFrameWithExpected(
-      std::unique_ptr<SenderEncodedFrame> encoded_frame) {
-    ASSERT_LT(0u, expectations_.size());
-    auto e = expectations_.front();
-    expectations_.pop();
-    if (e.expected_frame_id != e.expected_last_referenced_frame_id) {
-      EXPECT_EQ(EncodedFrame::DEPENDENT, encoded_frame->dependency);
-    } else {
-      EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency);
-    }
-    EXPECT_EQ(e.expected_frame_id, encoded_frame->frame_id);
-    EXPECT_EQ(e.expected_last_referenced_frame_id,
-              encoded_frame->referenced_frame_id)
-        << "frame id: " << e.expected_frame_id;
-    EXPECT_EQ(e.expected_rtp_timestamp, encoded_frame->rtp_timestamp);
-    EXPECT_EQ(e.expected_reference_time, encoded_frame->reference_time);
-    EXPECT_FALSE(encoded_frame->data.empty());
-    ++count_frames_delivered_;
-  }
-
- private:
-  friend class base::RefCountedThreadSafe<MetadataRecorder>;
-  virtual ~MetadataRecorder() {}
-
-  int count_frames_delivered_;
-
-  struct Expectation {
-    FrameId expected_frame_id;
-    FrameId expected_last_referenced_frame_id;
-    RtpTimeTicks expected_rtp_timestamp;
-    base::TimeTicks expected_reference_time;
-  };
-  std::queue<Expectation> expectations_;
-
-  DISALLOW_COPY_AND_ASSIGN(MetadataRecorder);
-};
-
-class EndToEndFrameChecker
-    : public base::RefCountedThreadSafe<EndToEndFrameChecker> {
- public:
-  explicit EndToEndFrameChecker(const VideoDecoderConfig& config)
-      : decoder_(), count_frames_checked_(0) {
-    bool decoder_init_result;
-    decoder_.Initialize(
-        config, false, nullptr,
-        base::Bind(&SaveDecoderInitResult, &decoder_init_result),
-        base::Bind(&EndToEndFrameChecker::CompareFrameWithExpected,
-                   base::Unretained(this)));
-    base::RunLoop().RunUntilIdle();
-    EXPECT_TRUE(decoder_init_result);
-  }
-
-  void PushExpectation(const scoped_refptr<VideoFrame>& frame) {
-    expectations_.push(frame);
-  }
-
-  void EncodeDone(std::unique_ptr<SenderEncodedFrame> encoded_frame) {
-    auto buffer = DecoderBuffer::CopyFrom(encoded_frame->bytes(),
-                                          encoded_frame->data.size());
-    decoder_.Decode(buffer, base::Bind(&EndToEndFrameChecker::DecodeDone,
-                                       base::Unretained(this)));
-  }
-
-  void CompareFrameWithExpected(const scoped_refptr<VideoFrame>& frame) {
-    ASSERT_LT(0u, expectations_.size());
-    auto& e = expectations_.front();
-    expectations_.pop();
-    EXPECT_LE(kVideoAcceptedPSNR, I420PSNR(e, frame));
-    ++count_frames_checked_;
-  }
-
-  void DecodeDone(DecodeStatus status) { EXPECT_EQ(DecodeStatus::OK, status); }
-
-  int count_frames_checked() const { return count_frames_checked_; }
-
- private:
-  friend class base::RefCountedThreadSafe<EndToEndFrameChecker>;
-  virtual ~EndToEndFrameChecker() {}
-
-  FFmpegVideoDecoder decoder_;
-  std::queue<scoped_refptr<VideoFrame>> expectations_;
-  int count_frames_checked_;
-
-  DISALLOW_COPY_AND_ASSIGN(EndToEndFrameChecker);
-};
-
-void CreateFrameAndMemsetPlane(VideoFrameFactory* const video_frame_factory) {
-  const scoped_refptr<media::VideoFrame> video_frame =
-      video_frame_factory->MaybeCreateFrame(
-          gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta());
-  ASSERT_TRUE(video_frame.get());
-  auto* cv_pixel_buffer = video_frame->cv_pixel_buffer();
-  ASSERT_TRUE(cv_pixel_buffer);
-  CVPixelBufferLockBaseAddress(cv_pixel_buffer, 0);
-  auto* ptr = CVPixelBufferGetBaseAddressOfPlane(cv_pixel_buffer, 0);
-  ASSERT_TRUE(ptr);
-  SbMemorySet(ptr, 0xfe,
-              CVPixelBufferGetBytesPerRowOfPlane(cv_pixel_buffer, 0) *
-                  CVPixelBufferGetHeightOfPlane(cv_pixel_buffer, 0));
-  CVPixelBufferUnlockBaseAddress(cv_pixel_buffer, 0);
-}
-
-void NoopFrameEncodedCallback(
-    std::unique_ptr<media::cast::SenderEncodedFrame> /*encoded_frame*/) {}
-
-class TestPowerSource : public base::PowerMonitorSource {
- public:
-  void GenerateSuspendEvent() {
-    ProcessPowerEvent(SUSPEND_EVENT);
-    base::RunLoop().RunUntilIdle();
-  }
-  void GenerateResumeEvent() {
-    ProcessPowerEvent(RESUME_EVENT);
-    base::RunLoop().RunUntilIdle();
-  }
-
- private:
-  bool IsOnBatteryPowerImpl() final { return false; }
-};
-
-class H264VideoToolboxEncoderTest : public ::testing::Test {
- protected:
-  H264VideoToolboxEncoderTest() = default;
-
-  void SetUp() final {
-    CHECK(VideoToolboxGlue::Get())
-        << "VideoToolbox is not available. Requires OS X 10.8 or iOS 8.0.";
-    clock_ = new base::SimpleTestTickClock();
-    clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
-
-    power_source_ = new TestPowerSource();
-    power_monitor_.reset(new base::PowerMonitor(
-        std::unique_ptr<TestPowerSource>(power_source_)));
-
-    cast_environment_ = new CastEnvironment(
-        std::unique_ptr<base::TickClock>(clock_), message_loop_.task_runner(),
-        message_loop_.task_runner(), message_loop_.task_runner());
-    encoder_.reset(new H264VideoToolboxEncoder(
-        cast_environment_, video_sender_config_,
-        base::Bind(&SaveOperationalStatus, &operational_status_)));
-    base::RunLoop().RunUntilIdle();
-    EXPECT_EQ(STATUS_INITIALIZED, operational_status_);
-  }
-
-  void TearDown() final {
-    encoder_.reset();
-    base::RunLoop().RunUntilIdle();
-    power_monitor_.reset();
-  }
-
-  void AdvanceClockAndVideoFrameTimestamp() {
-    clock_->Advance(base::TimeDelta::FromMilliseconds(33));
-    frame_->set_timestamp(frame_->timestamp() +
-                          base::TimeDelta::FromMilliseconds(33));
-  }
-
-  static void SetUpTestCase() {
-    // Reusable test data.
-    video_sender_config_ = GetDefaultVideoSenderConfig();
-    video_sender_config_.codec = CODEC_VIDEO_H264;
-    const gfx::Size size(kVideoWidth, kVideoHeight);
-    frame_ = media::VideoFrame::CreateFrame(
-        PIXEL_FORMAT_I420, size, gfx::Rect(size), size, base::TimeDelta());
-    PopulateVideoFrame(frame_.get(), 123);
-  }
-
-  static void TearDownTestCase() { frame_ = nullptr; }
-
-  static scoped_refptr<media::VideoFrame> frame_;
-  static FrameSenderConfig video_sender_config_;
-
-  base::SimpleTestTickClock* clock_;  // Owned by CastEnvironment.
-  base::MessageLoop message_loop_;
-  scoped_refptr<CastEnvironment> cast_environment_;
-  std::unique_ptr<VideoEncoder> encoder_;
-  OperationalStatus operational_status_;
-  TestPowerSource* power_source_;  // Owned by the power monitor.
-  std::unique_ptr<base::PowerMonitor> power_monitor_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoderTest);
-};
-
-// static
-scoped_refptr<media::VideoFrame> H264VideoToolboxEncoderTest::frame_;
-FrameSenderConfig H264VideoToolboxEncoderTest::video_sender_config_;
-
-// Failed on mac_chromium_rel_ng trybot. http://crbug.com/627260
-TEST_F(H264VideoToolboxEncoderTest, DISABLED_CheckFrameMetadataSequence) {
-  scoped_refptr<MetadataRecorder> metadata_recorder(new MetadataRecorder());
-  VideoEncoder::FrameEncodedCallback cb = base::Bind(
-      &MetadataRecorder::CompareFrameWithExpected, metadata_recorder.get());
-
-  metadata_recorder->PushExpectation(
-      FrameId::first(), FrameId::first(),
-      RtpTimeTicks::FromTimeDelta(frame_->timestamp(), kVideoFrequency),
-      clock_->NowTicks());
-  EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-  base::RunLoop().RunUntilIdle();
-
-  for (FrameId frame_id = FrameId::first() + 1;
-       frame_id < FrameId::first() + 10; ++frame_id) {
-    AdvanceClockAndVideoFrameTimestamp();
-    metadata_recorder->PushExpectation(
-        frame_id, frame_id - 1,
-        RtpTimeTicks::FromTimeDelta(frame_->timestamp(), kVideoFrequency),
-        clock_->NowTicks());
-    EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-  }
-
-  encoder_.reset();
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_EQ(10, metadata_recorder->count_frames_delivered());
-}
-
-#if defined(USE_PROPRIETARY_CODECS)
-// Failed on mac_chromium_rel_ng trybot. http://crbug.com/627260
-TEST_F(H264VideoToolboxEncoderTest, DISABLED_CheckFramesAreDecodable) {
-  VideoDecoderConfig config(kCodecH264, H264PROFILE_MAIN, frame_->format(),
-                            COLOR_SPACE_UNSPECIFIED, frame_->coded_size(),
-                            frame_->visible_rect(), frame_->natural_size(),
-                            EmptyExtraData(), Unencrypted());
-  scoped_refptr<EndToEndFrameChecker> checker(new EndToEndFrameChecker(config));
-
-  VideoEncoder::FrameEncodedCallback cb =
-      base::Bind(&EndToEndFrameChecker::EncodeDone, checker.get());
-  for (FrameId frame_id = FrameId::first(); frame_id < FrameId::first() + 6;
-       ++frame_id) {
-    checker->PushExpectation(frame_);
-    EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-    AdvanceClockAndVideoFrameTimestamp();
-  }
-
-  encoder_.reset();
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_EQ(5, checker->count_frames_checked());
-}
-#endif
-
-TEST_F(H264VideoToolboxEncoderTest, CheckVideoFrameFactory) {
-  auto video_frame_factory = encoder_->CreateVideoFrameFactory();
-  ASSERT_TRUE(video_frame_factory.get());
-  // The first call to |MaybeCreateFrame| will return null but post a task to
-  // the encoder to initialize for the specified frame size. We then drain the
-  // message loop. After that, the encoder should have initialized and we
-  // request a frame again.
-  ASSERT_FALSE(video_frame_factory->MaybeCreateFrame(
-      gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta()));
-  base::RunLoop().RunUntilIdle();
-  CreateFrameAndMemsetPlane(video_frame_factory.get());
-}
-
-TEST_F(H264VideoToolboxEncoderTest, CheckPowerMonitoring) {
-  // Encode a frame, suspend, encode a frame, resume, encode a frame.
-
-  VideoEncoder::FrameEncodedCallback cb = base::Bind(&NoopFrameEncodedCallback);
-  EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-  power_source_->GenerateSuspendEvent();
-  EXPECT_FALSE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-  power_source_->GenerateResumeEvent();
-  EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-}
-
-TEST_F(H264VideoToolboxEncoderTest, CheckPowerMonitoringNoInitialFrame) {
-  // Suspend, encode a frame, resume, encode a frame.
-
-  VideoEncoder::FrameEncodedCallback cb = base::Bind(&NoopFrameEncodedCallback);
-  power_source_->GenerateSuspendEvent();
-  EXPECT_FALSE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-  power_source_->GenerateResumeEvent();
-  EXPECT_TRUE(encoder_->EncodeVideoFrame(frame_, clock_->NowTicks(), cb));
-}
-
-TEST_F(H264VideoToolboxEncoderTest, CheckPowerMonitoringVideoFrameFactory) {
-  VideoEncoder::FrameEncodedCallback cb = base::Bind(&NoopFrameEncodedCallback);
-  auto video_frame_factory = encoder_->CreateVideoFrameFactory();
-  ASSERT_TRUE(video_frame_factory.get());
-
-  // The first call to |MaybeCreateFrame| will return null but post a task to
-  // the encoder to initialize for the specified frame size. We then drain the
-  // message loop. After that, the encoder should have initialized and we
-  // request a frame again.
-  ASSERT_FALSE(video_frame_factory->MaybeCreateFrame(
-      gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta()));
-  base::RunLoop().RunUntilIdle();
-  CreateFrameAndMemsetPlane(video_frame_factory.get());
-
-  // After a power suspension, the factory should not produce frames.
-  power_source_->GenerateSuspendEvent();
-
-  ASSERT_FALSE(video_frame_factory->MaybeCreateFrame(
-      gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta()));
-  base::RunLoop().RunUntilIdle();
-  ASSERT_FALSE(video_frame_factory->MaybeCreateFrame(
-      gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta()));
-
-  // After a power resume event, the factory should produce frames right away
-  // because the encoder re-initializes on its own.
-  power_source_->GenerateResumeEvent();
-  CreateFrameAndMemsetPlane(video_frame_factory.get());
-}
-
-TEST_F(H264VideoToolboxEncoderTest,
-       CheckPowerMonitoringVideoFrameFactoryNoInitialFrame) {
-  VideoEncoder::FrameEncodedCallback cb = base::Bind(&NoopFrameEncodedCallback);
-  auto video_frame_factory = encoder_->CreateVideoFrameFactory();
-  ASSERT_TRUE(video_frame_factory.get());
-
-  // After a power suspension, the factory should not produce frames.
-  power_source_->GenerateSuspendEvent();
-
-  ASSERT_FALSE(video_frame_factory->MaybeCreateFrame(
-      gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta()));
-  base::RunLoop().RunUntilIdle();
-  ASSERT_FALSE(video_frame_factory->MaybeCreateFrame(
-      gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta()));
-
-  // After a power resume event, the factory should produce frames right away
-  // because the encoder re-initializes on its own.
-  power_source_->GenerateResumeEvent();
-  CreateFrameAndMemsetPlane(video_frame_factory.get());
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/performance_metrics_overlay.cc b/src/cobalt/media/cast/sender/performance_metrics_overlay.cc
deleted file mode 100644
index 32257ea..0000000
--- a/src/cobalt/media/cast/sender/performance_metrics_overlay.cc
+++ /dev/null
@@ -1,306 +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 "media/cast/sender/performance_metrics_overlay.h"
-
-#include <algorithm>
-#include <string>
-
-#include "base/logging.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/strings/stringprintf.h"
-#include "media/base/video_frame.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-const int kScale = 4;             // Physical pixels per one logical pixel.
-const int kCharacterWidth = 3;    // Logical pixel width of one character.
-const int kCharacterHeight = 5;   // Logical pixel height of one character.
-const int kCharacterSpacing = 1;  // Logical pixels between each character.
-const int kLineSpacing = 2;  // Logical pixels between each line of characters.
-const int kPlane = 0;        // Y-plane in YUV formats.
-
-// For each pixel in the |rect| (logical coordinates), either decrease the
-// intensity or increase it so that the resulting pixel has a perceivably
-// different value than it did before.  |p_ul| is a pointer to the pixel at
-// coordinate (0,0) in a single-channel 8bpp bitmap.  |stride| is the number of
-// bytes per row in the output bitmap.
-void DivergePixels(const gfx::Rect& rect, uint8_t* p_ul, int stride) {
-  DCHECK(p_ul);
-  DCHECK_GT(stride, 0);
-
-  // These constants and heuristics were chosen based on experimenting with a
-  // wide variety of content, and converging on a readable result.  The amount
-  // by which the darker pixels are changed is less because each unit of change
-  // has a larger visual impact on the darker end of the spectrum.  Each pixel's
-  // intensity value is changed as follows:
-  //
-  //    [16,31] --> [32,63]   (always a difference of +16)
-  //    [32,64] --> 16        (a difference between -16 and -48)
-  //   [65,235] --> [17,187]  (always a difference of -48)
-  const int kDivergeDownThreshold = 32;
-  const int kDivergeDownAmount = 48;
-  const int kDivergeUpAmount = 32;
-  const int kMinIntensity = 16;
-
-  const int top = rect.y() * kScale;
-  const int bottom = rect.bottom() * kScale;
-  const int left = rect.x() * kScale;
-  const int right = rect.right() * kScale;
-  for (int y = top; y < bottom; ++y) {
-    uint8_t* const p_l = p_ul + y * stride;
-    for (int x = left; x < right; ++x) {
-      int intensity = p_l[x];
-      if (intensity >= kDivergeDownThreshold)
-        intensity = std::max(kMinIntensity, intensity - kDivergeDownAmount);
-      else
-        intensity += kDivergeUpAmount;
-      p_l[x] = static_cast<uint8_t>(intensity);
-    }
-  }
-}
-
-// Render |line| into |frame| at physical pixel row |top| and aligned to the
-// right edge.  Only number digits and a smattering of punctuation characters
-// will be rendered.
-void RenderLineOfText(const std::string& line, int top, VideoFrame* frame) {
-  // Compute number of physical pixels wide the rendered |line| would be,
-  // including padding.
-  const int line_width =
-      (((kCharacterWidth + kCharacterSpacing) * static_cast<int>(line.size())) +
-       kCharacterSpacing) *
-      kScale;
-
-  // Determine if any characters would render past the left edge of the frame,
-  // and compute the index of the first character to be rendered.
-  const int pixels_per_char = (kCharacterWidth + kCharacterSpacing) * kScale;
-  const size_t first_idx =
-      (line_width < frame->visible_rect().width())
-          ? 0u
-          : static_cast<size_t>(((line_width - frame->visible_rect().width()) /
-                                 pixels_per_char) +
-                                1);
-
-  // Compute the pointer to the pixel at the upper-left corner of the first
-  // character to be rendered.
-  const int stride = frame->stride(kPlane);
-  uint8_t* p_ul =
-      // Start at the first pixel in the first row...
-      frame->visible_data(kPlane) + (stride * top)
-      // ...now move to the right edge of the visible part of the frame...
-      + frame->visible_rect().width()
-      // ...now move left to where line[0] would be rendered...
-      - line_width
-      // ...now move right to where line[first_idx] would be rendered.
-      + first_idx * pixels_per_char;
-
-  // Render each character.
-  for (size_t i = first_idx; i < line.size(); ++i, p_ul += pixels_per_char) {
-    switch (line[i]) {
-      case '0':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 1, 1, 3), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 3), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '1':
-        DivergePixels(gfx::Rect(1, 0, 1, 5), p_ul, stride);
-        break;
-      case '2':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '3':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '4':
-        DivergePixels(gfx::Rect(0, 0, 1, 2), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 0, 1, 5), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 2, 1), p_ul, stride);
-        break;
-      case '5':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '6':
-        DivergePixels(gfx::Rect(1, 0, 2, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '7':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 2), p_ul, stride);
-        DivergePixels(gfx::Rect(1, 3, 1, 2), p_ul, stride);
-        break;
-      case '8':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '9':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 2, 1), p_ul, stride);
-        break;
-      case 'e':
-      case 'E':
-        DivergePixels(gfx::Rect(0, 0, 3, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 2, 2, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 4, 3, 1), p_ul, stride);
-        break;
-      case '.':
-        DivergePixels(gfx::Rect(1, 4, 1, 1), p_ul, stride);
-        break;
-      case '+':
-        DivergePixels(gfx::Rect(1, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(1, 3, 1, 1), p_ul, stride);
-      // ...fall through...
-      case '-':
-        DivergePixels(gfx::Rect(0, 2, 3, 1), p_ul, stride);
-        break;
-      case 'x':
-        DivergePixels(gfx::Rect(0, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(1, 2, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 3, 1, 1), p_ul, stride);
-        break;
-      case ':':
-        DivergePixels(gfx::Rect(1, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(1, 3, 1, 1), p_ul, stride);
-        break;
-      case '!':
-        DivergePixels(gfx::Rect(1, 0, 1, 3), p_ul, stride);
-        DivergePixels(gfx::Rect(1, 4, 1, 1), p_ul, stride);
-        break;
-      case '%':
-        DivergePixels(gfx::Rect(0, 0, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 1, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(1, 2, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(0, 3, 1, 1), p_ul, stride);
-        DivergePixels(gfx::Rect(2, 4, 1, 1), p_ul, stride);
-        break;
-      case ' ':
-      default:
-        break;
-    }
-  }
-}
-
-}  // namespace
-
-void MaybeRenderPerformanceMetricsOverlay(base::TimeDelta target_playout_delay,
-                                          bool in_low_latency_mode,
-                                          int target_bitrate, int frames_ago,
-                                          double encoder_utilization,
-                                          double lossy_utilization,
-                                          VideoFrame* frame) {
-  if (VideoFrame::PlaneHorizontalBitsPerPixel(frame->format(), kPlane) != 8) {
-    DLOG(WARNING) << "Cannot render overlay: Plane " << kPlane << " not 8bpp.";
-    return;
-  }
-
-  // Can't render to unmappable memory (DmaBuf, CVPixelBuffer).
-  if (!frame->IsMappable()) {
-    DVLOG(2) << "Cannot render overlay: frame uses unmappable memory.";
-    return;
-  }
-
-  // Compute the physical pixel top row for the bottom-most line of text.
-  const int line_height = (kCharacterHeight + kLineSpacing) * kScale;
-  int top = frame->visible_rect().height() - line_height;
-  if (top < 0 || !VLOG_IS_ON(1)) return;
-
-  // Line 3: Frame duration, resolution, and timestamp.
-  int frame_duration_ms = 0;
-  int frame_duration_ms_frac = 0;
-  base::TimeDelta frame_duration;
-  if (frame->metadata()->GetTimeDelta(VideoFrameMetadata::FRAME_DURATION,
-                                      &frame_duration)) {
-    const int decimilliseconds = base::saturated_cast<int>(
-        frame_duration.InMicroseconds() / 100.0 + 0.5);
-    frame_duration_ms = decimilliseconds / 10;
-    frame_duration_ms_frac = decimilliseconds % 10;
-  }
-  base::TimeDelta rem = frame->timestamp();
-  const int minutes = rem.InMinutes();
-  rem -= base::TimeDelta::FromMinutes(minutes);
-  const int seconds = static_cast<int>(rem.InSeconds());
-  rem -= base::TimeDelta::FromSeconds(seconds);
-  const int hundredth_seconds = static_cast<int>(rem.InMilliseconds() / 10);
-  RenderLineOfText(
-      base::StringPrintf("%d.%01d %dx%d %d:%02d.%02d", frame_duration_ms,
-                         frame_duration_ms_frac, frame->visible_rect().width(),
-                         frame->visible_rect().height(), minutes, seconds,
-                         hundredth_seconds),
-      top, frame);
-
-  // Move up one line's worth of pixels.
-  top -= line_height;
-  if (top < 0 || !VLOG_IS_ON(2)) return;
-
-  // Line 2: Capture duration, target playout delay, low-latency mode, and
-  // target bitrate.
-  int capture_duration_ms = 0;
-  base::TimeTicks capture_begin_time, capture_end_time;
-  if (frame->metadata()->GetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME,
-                                      &capture_begin_time) &&
-      frame->metadata()->GetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME,
-                                      &capture_end_time)) {
-    capture_duration_ms = base::saturated_cast<int>(
-        (capture_end_time - capture_begin_time).InMillisecondsF() + 0.5);
-  }
-  const int target_playout_delay_ms =
-      static_cast<int>(target_playout_delay.InMillisecondsF() + 0.5);
-  const int target_kbits = target_bitrate / 1000;
-  RenderLineOfText(
-      base::StringPrintf("%d %4.1d%c %4.1d", capture_duration_ms,
-                         target_playout_delay_ms,
-                         in_low_latency_mode ? '!' : '.', target_kbits),
-      top, frame);
-
-  // Move up one line's worth of pixels.
-  top -= line_height;
-  if (top < 0 || !VLOG_IS_ON(3)) return;
-
-  // Line 1: Recent utilization metrics.
-  const int encoder_pct =
-      base::saturated_cast<int>(encoder_utilization * 100.0 + 0.5);
-  const int lossy_pct =
-      base::saturated_cast<int>(lossy_utilization * 100.0 + 0.5);
-  RenderLineOfText(base::StringPrintf("%d %3.1d%% %3.1d%%", frames_ago,
-                                      encoder_pct, lossy_pct),
-                   top, frame);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/performance_metrics_overlay.h b/src/cobalt/media/cast/sender/performance_metrics_overlay.h
deleted file mode 100644
index f20065d..0000000
--- a/src/cobalt/media/cast/sender/performance_metrics_overlay.h
+++ /dev/null
@@ -1,75 +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 COBALT_MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_
-#define COBALT_MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_
-
-#include "base/time/time.h"
-
-// This module provides a display of frame-level performance metrics, rendered
-// in the lower-right corner of a VideoFrame.  It looks like this:
-//
-// +---------------------------------------------------------------------+
-// |                         @@@@@@@@@@@@@@@@@@@@@@@                     |
-// |                 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                     |
-// |              @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@                   |
-// |             @@@@@@@@@@@@@                    @@@@                   |
-// |            @@@@@@@@@@                        @@@@                   |
-// |           @@@@@  @@@               @@@       @@@@                   |
-// |           @@@     @    @@@         @@@@      @@@@                   |
-// |          @@@@          @@@@                  @@@@                   |
-// |          @@@@                  @@@           @@@                    |
-// |            @@@@                 @@           @@@                    |
-// |             @@@@@      @@@            @@@   @@@                     |
-// |              @@@@@     @@@@@        @@@@   @@@@                     |
-// |               @@@@@      @@@@@@@@@@@@@    @@@@                      |
-// |                @@@@@@                    @@@@           1  45%  75% |
-// |                    @@@@@@@@         @@@@@@            22  400. 4000 |
-// |                         @@@@@@@@@@@@@@@@      16.7 1280x720 0:15.12 |
-// +---------------------------------------------------------------------+
-//
-// Line 1: Reads as, "1 frame ago, the encoder utilization for the frame was 45%
-// and the lossy utilization was 75%."  For CPU-bound encoders, encoder
-// utilization is usually measured as the amount of real-world time it took to
-// encode the frame, divided by the maximum amount of time allowed.  Lossy
-// utilization is the amount of "complexity" in the frame's content versus the
-// target encoded byte size, where a value over 100% means the frame's content
-// is too complex to encode within the target number of bytes.
-//
-// Line 2: Reads as, "Capture of this frame took 22 ms.  The current target
-// playout delay is 400 ms and low-latency adjustment mode is not active.  The
-// target bitrate for this frame is 4000 kbps."  If there were an exclamation
-// mark (!) after the playout delay number instead of a period (.), it would
-// indicate low-latency adjustment mode is active.  See VideoSender for more
-// details.
-//
-// Line 3: Contains the frame's duration (16.7 milliseconds), resolution, and
-// media timestamp in minutes:seconds.hundredths format.
-
-namespace cobalt {
-namespace media {
-
-class VideoFrame;
-
-namespace cast {
-
-// Renders an overlay of frame-level performance metrics in the lower-right
-// corner of the |frame|, as described above.  The verbose logging level for
-// video_frame_overlay.cc determines which lines, if any, are rendered: VLOG
-// level 1 renders the bottom line only, level 2 renders the bottom and middle
-// lines, and level 3 renders all three lines.  So, use the
-// --vmodule=performance_metrics_overlay=3 command line argument to turn on
-// rendering of the entire overlay.
-void MaybeRenderPerformanceMetricsOverlay(base::TimeDelta target_playout_delay,
-                                          bool in_low_latency_mode,
-                                          int target_bitrate, int frames_ago,
-                                          double encoder_utilization,
-                                          double lossy_utilization,
-                                          VideoFrame* frame);
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_
diff --git a/src/cobalt/media/cast/sender/sender_encoded_frame.cc b/src/cobalt/media/cast/sender/sender_encoded_frame.cc
deleted file mode 100644
index 78ded0e..0000000
--- a/src/cobalt/media/cast/sender/sender_encoded_frame.cc
+++ /dev/null
@@ -1,17 +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 "media/cast/sender/sender_encoded_frame.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-SenderEncodedFrame::SenderEncodedFrame()
-    : EncodedFrame(), encoder_utilization(-1.0), lossy_utilization(-1.0) {}
-
-SenderEncodedFrame::~SenderEncodedFrame() {}
-
-}  //  namespace cast
-}  //  namespace media
diff --git a/src/cobalt/media/cast/sender/sender_encoded_frame.h b/src/cobalt/media/cast/sender/sender_encoded_frame.h
deleted file mode 100644
index eb8f153..0000000
--- a/src/cobalt/media/cast/sender/sender_encoded_frame.h
+++ /dev/null
@@ -1,54 +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 COBALT_MEDIA_CAST_SENDER_SENDER_ENCODED_FRAME_H_
-#define COBALT_MEDIA_CAST_SENDER_SENDER_ENCODED_FRAME_H_
-
-#include "base/time/time.h"
-#include "media/cast/net/cast_transport_config.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Extends EncodedFrame with additional fields used within the sender-side of
-// the library.
-struct SenderEncodedFrame : public EncodedFrame {
-  SenderEncodedFrame();
-  ~SenderEncodedFrame() final;
-
-  // The amount the encoder was utilized for this frame. Example: For the
-  // software VP8 encoder, this would be the elapsed encode time (according to
-  // the base::TimeTicks clock) divided by the VideoFrame's duration.
-  //
-  // Meaningful values are non-negative, with 0.0 [impossibly] representing 0%
-  // utilization, 1.0 representing 100% utilization, and values greater than 1.0
-  // indicating the encoder utilized more resources than a maximum sustainable
-  // rate, based on the data volume of the input.  Negative values indicate the
-  // field was not computed.
-  double encoder_utilization;
-
-  // The amount of "lossiness" needed to encode the frame within the targeted
-  // bandwidth.  More-complex frame content and/or lower target encode bitrates
-  // will cause this value to rise.
-  //
-  // Meaningful values are non-negative, with 0.0 indicating the frame is very
-  // simple and/or the target encode bitrate is very large, 1.0 indicating the
-  // frame contains very complex content and/or the target encode bitrate is
-  // very small, and values greater than 1.0 indicating the encoder cannot
-  // encode the frame within the target bitrate (even at its lowest quality
-  // setting).  Negative values indicate the field was not computed.
-  //
-  // TODO(miu): Rename to idealized_bitrate_utilization.
-  double lossy_utilization;
-
-  // The time at which the encode of the frame completed.
-  base::TimeTicks encode_completion_time;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_SENDER_ENCODED_FRAME_H_
diff --git a/src/cobalt/media/cast/sender/size_adaptable_video_encoder_base.cc b/src/cobalt/media/cast/sender/size_adaptable_video_encoder_base.cc
deleted file mode 100644
index 11b80f6..0000000
--- a/src/cobalt/media/cast/sender/size_adaptable_video_encoder_base.cc
+++ /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.
-
-#include "media/cast/sender/size_adaptable_video_encoder_base.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "media/base/video_frame.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-SizeAdaptableVideoEncoderBase::SizeAdaptableVideoEncoderBase(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb)
-    : cast_environment_(cast_environment),
-      video_config_(video_config),
-      status_change_cb_(status_change_cb),
-      frames_in_encoder_(0),
-      next_frame_id_(FrameId::first()),
-      weak_factory_(this) {
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(status_change_cb_, STATUS_INITIALIZED));
-}
-
-SizeAdaptableVideoEncoderBase::~SizeAdaptableVideoEncoderBase() {
-  DestroyEncoder();
-}
-
-bool SizeAdaptableVideoEncoderBase::EncodeVideoFrame(
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time,
-    const FrameEncodedCallback& frame_encoded_callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  const gfx::Size frame_size = video_frame->visible_rect().size();
-  if (frame_size.IsEmpty()) {
-    DVLOG(1) << "Rejecting empty video frame.";
-    return false;
-  }
-  if (frames_in_encoder_ == kEncoderIsInitializing) {
-    VLOG(1) << "Dropping frame since encoder initialization is in-progress.";
-    return false;
-  }
-  if (frame_size != frame_size_ || !encoder_) {
-    VLOG(1) << "Dropping this frame, and future frames until a replacement "
-               "encoder is spun-up to handle size "
-            << frame_size.ToString();
-    TrySpawningReplacementEncoder(frame_size);
-    return false;
-  }
-
-  const bool is_frame_accepted = encoder_->EncodeVideoFrame(
-      video_frame, reference_time,
-      base::Bind(&SizeAdaptableVideoEncoderBase::OnEncodedVideoFrame,
-                 weak_factory_.GetWeakPtr(), frame_encoded_callback));
-  if (is_frame_accepted) ++frames_in_encoder_;
-  return is_frame_accepted;
-}
-
-void SizeAdaptableVideoEncoderBase::SetBitRate(int new_bit_rate) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  video_config_.start_bitrate = new_bit_rate;
-  if (encoder_) encoder_->SetBitRate(new_bit_rate);
-}
-
-void SizeAdaptableVideoEncoderBase::GenerateKeyFrame() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (encoder_) encoder_->GenerateKeyFrame();
-}
-
-std::unique_ptr<VideoFrameFactory>
-SizeAdaptableVideoEncoderBase::CreateVideoFrameFactory() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  return nullptr;
-}
-
-void SizeAdaptableVideoEncoderBase::EmitFrames() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (encoder_) encoder_->EmitFrames();
-}
-
-StatusChangeCallback
-SizeAdaptableVideoEncoderBase::CreateEncoderStatusChangeCallback() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  return base::Bind(&SizeAdaptableVideoEncoderBase::OnEncoderStatusChange,
-                    weak_factory_.GetWeakPtr());
-}
-
-void SizeAdaptableVideoEncoderBase::OnEncoderReplaced(
-    VideoEncoder* replacement_encoder) {}
-
-void SizeAdaptableVideoEncoderBase::DestroyEncoder() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  // The weak pointers are invalidated to prevent future calls back to |this|.
-  // This effectively cancels any of |encoder_|'s posted tasks that have not yet
-  // run.
-  weak_factory_.InvalidateWeakPtrs();
-  encoder_.reset();
-}
-
-void SizeAdaptableVideoEncoderBase::TrySpawningReplacementEncoder(
-    const gfx::Size& size_needed) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  // If prior frames are still encoding in the current encoder, let them finish
-  // first.
-  if (frames_in_encoder_ > 0) {
-    encoder_->EmitFrames();
-    // Check again, since EmitFrames() is a synchronous operation for some
-    // encoders.
-    if (frames_in_encoder_ > 0) return;
-  }
-
-  if (frames_in_encoder_ == kEncoderIsInitializing) return;  // Already spawned.
-
-  DestroyEncoder();
-  frames_in_encoder_ = kEncoderIsInitializing;
-  OnEncoderStatusChange(STATUS_CODEC_REINIT_PENDING);
-  VLOG(1) << "Creating replacement video encoder (for frame size change from "
-          << frame_size_.ToString() << " to " << size_needed.ToString() << ").";
-  frame_size_ = size_needed;
-  encoder_ = CreateEncoder();
-  DCHECK(encoder_);
-}
-
-void SizeAdaptableVideoEncoderBase::OnEncoderStatusChange(
-    OperationalStatus status) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (frames_in_encoder_ == kEncoderIsInitializing &&
-      status == STATUS_INITIALIZED) {
-    // Begin using the replacement encoder.
-    frames_in_encoder_ = 0;
-    OnEncoderReplaced(encoder_.get());
-  }
-  status_change_cb_.Run(status);
-}
-
-void SizeAdaptableVideoEncoderBase::OnEncodedVideoFrame(
-    const FrameEncodedCallback& frame_encoded_callback,
-    std::unique_ptr<SenderEncodedFrame> encoded_frame) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  --frames_in_encoder_;
-  DCHECK_GE(frames_in_encoder_, 0);
-
-  if (encoded_frame) next_frame_id_ = encoded_frame->frame_id + 1;
-  frame_encoded_callback.Run(std::move(encoded_frame));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/size_adaptable_video_encoder_base.h b/src/cobalt/media/cast/sender/size_adaptable_video_encoder_base.h
deleted file mode 100644
index a476912..0000000
--- a/src/cobalt/media/cast/sender/size_adaptable_video_encoder_base.h
+++ /dev/null
@@ -1,117 +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 COBALT_MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_
-#define COBALT_MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/sender/video_encoder.h"
-#include "starboard/types.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Creates and owns a VideoEncoder instance.  The owned instance is an
-// implementation that does not support changing frame sizes, and so
-// SizeAdaptableVideoEncoderBase acts as a proxy to automatically detect when
-// the owned instance should be replaced with one that can handle the new frame
-// size.
-class SizeAdaptableVideoEncoderBase : public VideoEncoder {
- public:
-  SizeAdaptableVideoEncoderBase(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb);
-
-  ~SizeAdaptableVideoEncoderBase() override;
-
-  // VideoEncoder implementation.
-  bool EncodeVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& reference_time,
-      const FrameEncodedCallback& frame_encoded_callback) final;
-  void SetBitRate(int new_bit_rate) final;
-  void GenerateKeyFrame() final;
-  std::unique_ptr<VideoFrameFactory> CreateVideoFrameFactory() final;
-  void EmitFrames() final;
-
- protected:
-  // Accessors for subclasses.
-  CastEnvironment* cast_environment() const { return cast_environment_.get(); }
-  const FrameSenderConfig& video_config() const { return video_config_; }
-  const gfx::Size& frame_size() const { return frame_size_; }
-  FrameId next_frame_id() const { return next_frame_id_; }
-
-  // Returns a callback that calls OnEncoderStatusChange().  The callback is
-  // canceled by invalidating its bound weak pointer just before a replacement
-  // encoder is instantiated.  In this scheme, OnEncoderStatusChange() can only
-  // be called by the most-recent encoder.
-  StatusChangeCallback CreateEncoderStatusChangeCallback();
-
-  // Overridden by subclasses to create a new encoder instance that handles
-  // frames of the size specified by |frame_size()|.
-  virtual std::unique_ptr<VideoEncoder> CreateEncoder() = 0;
-
-  // Overridden by subclasses to perform additional steps when
-  // |replacement_encoder| becomes the active encoder.
-  virtual void OnEncoderReplaced(VideoEncoder* replacement_encoder);
-
-  // Overridden by subclasses to perform additional steps before/after the
-  // current encoder is destroyed.
-  virtual void DestroyEncoder();
-
- private:
-  // Create and initialize a replacement video encoder, if this not already
-  // in-progress.  The replacement will call back to OnEncoderStatusChange()
-  // with success/fail status.
-  void TrySpawningReplacementEncoder(const gfx::Size& size_needed);
-
-  // Called when a status change is received from an encoder.
-  void OnEncoderStatusChange(OperationalStatus status);
-
-  // Called by the |encoder_| with the next EncodedFrame.
-  void OnEncodedVideoFrame(const FrameEncodedCallback& frame_encoded_callback,
-                           std::unique_ptr<SenderEncodedFrame> encoded_frame);
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-
-  // This is not const since |video_config_.starting_bitrate| is modified by
-  // SetBitRate(), for when a replacement encoder is spawned.
-  FrameSenderConfig video_config_;
-
-  // Run whenever the underlying encoder reports a status change.
-  const StatusChangeCallback status_change_cb_;
-
-  // The underlying platform video encoder and the frame size it expects.
-  std::unique_ptr<VideoEncoder> encoder_;
-  gfx::Size frame_size_;
-
-  // The number of frames in |encoder_|'s pipeline.  If this is set to
-  // kEncoderIsInitializing, |encoder_| is not yet ready to accept frames.
-  enum { kEncoderIsInitializing = -1 };
-  int frames_in_encoder_;
-
-  // The ID for the next frame to be emitted.
-  FrameId next_frame_id_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<SizeAdaptableVideoEncoderBase> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(SizeAdaptableVideoEncoderBase);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_SIZE_ADAPTABLE_VIDEO_ENCODER_BASE_H_
diff --git a/src/cobalt/media/cast/sender/software_video_encoder.h b/src/cobalt/media/cast/sender/software_video_encoder.h
deleted file mode 100644
index 5809346..0000000
--- a/src/cobalt/media/cast/sender/software_video_encoder.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_SOFTWARE_VIDEO_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_SOFTWARE_VIDEO_ENCODER_H_
-
-#include "base/memory/ref_counted.h"
-#include "media/cast/sender/sender_encoded_frame.h"
-#include "starboard/types.h"
-
-namespace base {
-class TimeTicks;
-}
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-}
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class SoftwareVideoEncoder {
- public:
-  virtual ~SoftwareVideoEncoder() {}
-
-  // Initialize the encoder before Encode() can be called. This method
-  // must be called on the thread that Encode() is called.
-  virtual void Initialize() = 0;
-
-  // Encode a raw image (as a part of a video stream).
-  virtual void Encode(const scoped_refptr<media::VideoFrame>& video_frame,
-                      const base::TimeTicks& reference_time,
-                      SenderEncodedFrame* encoded_frame) = 0;
-
-  // Update the encoder with a new target bit rate.
-  virtual void UpdateRates(uint32_t new_bitrate) = 0;
-
-  // Set the next frame to be a key frame.
-  virtual void GenerateKeyFrame() = 0;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_SOFTWARE_VIDEO_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/video_encoder.cc b/src/cobalt/media/cast/sender/video_encoder.cc
deleted file mode 100644
index cf3dd57..0000000
--- a/src/cobalt/media/cast/sender/video_encoder.cc
+++ /dev/null
@@ -1,62 +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.
-
-#include "media/cast/sender/video_encoder.h"
-
-#include "build/build_config.h"
-#include "media/cast/sender/external_video_encoder.h"
-#include "media/cast/sender/video_encoder_impl.h"
-
-#if defined(OS_MACOSX)
-#include "media/cast/sender/h264_vt_encoder.h"
-#endif
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// static
-std::unique_ptr<VideoEncoder> VideoEncoder::Create(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb,
-    const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-    const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) {
-// On MacOS or IOS, attempt to use the system VideoToolbox library to
-// perform optimized H.264 encoding.
-#if defined(OS_MACOSX) || defined(OS_IOS)
-  if (H264VideoToolboxEncoder::IsSupported(video_config)) {
-    return std::unique_ptr<VideoEncoder>(new H264VideoToolboxEncoder(
-        cast_environment, video_config, status_change_cb));
-  }
-#endif  // defined(OS_MACOSX)
-
-#if !defined(OS_IOS)
-  // If the system provides a hardware-accelerated encoder, use it.
-  if (ExternalVideoEncoder::IsSupported(video_config)) {
-    return std::unique_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder(
-        cast_environment, video_config, status_change_cb, create_vea_cb,
-        create_video_encode_memory_cb));
-  }
-
-  // Attempt to use the software encoder implementation.
-  if (VideoEncoderImpl::IsSupported(video_config)) {
-    return std::unique_ptr<VideoEncoder>(
-        new VideoEncoderImpl(cast_environment, video_config, status_change_cb));
-  }
-#endif  // !defined(OS_IOS)
-
-  // No encoder implementation will suffice.
-  return nullptr;
-}
-
-std::unique_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() {
-  return nullptr;
-}
-
-void VideoEncoder::EmitFrames() {}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/video_encoder.h b/src/cobalt/media/cast/sender/video_encoder.h
deleted file mode 100644
index 33bbb37..0000000
--- a/src/cobalt/media/cast/sender/video_encoder.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_VIDEO_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_VIDEO_ENCODER_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "base/time/time.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/sender/sender_encoded_frame.h"
-#include "media/cast/sender/video_frame_factory.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// All these functions are called from the main cast thread.
-class VideoEncoder {
- public:
-  // Callback used to deliver an encoded frame on the Cast MAIN thread.
-  using FrameEncodedCallback =
-      base::Callback<void(std::unique_ptr<SenderEncodedFrame>)>;
-
-  // Creates a VideoEncoder instance from the given |video_config| and based on
-  // the current platform's hardware/library support; or null if no
-  // implementation will suffice.  The instance will run |status_change_cb| at
-  // some point in the future to indicate initialization success/failure.
-  //
-  // All VideoEncoder instances returned by this function support encoding
-  // sequences of differently-size VideoFrames.
-  //
-  // TODO(miu): Remove the CreateVEA callbacks.  http://crbug.com/454029
-  static std::unique_ptr<VideoEncoder> Create(
-      const scoped_refptr<CastEnvironment>& cast_environment,
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb);
-
-  virtual ~VideoEncoder() {}
-
-  // If true is returned, the Encoder has accepted the request and will process
-  // it asynchronously, running |frame_encoded_callback| on the MAIN
-  // CastEnvironment thread with the result.  If false is returned, nothing
-  // happens and the callback will not be run.
-  virtual bool EncodeVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& reference_time,
-      const FrameEncodedCallback& frame_encoded_callback) = 0;
-
-  // Inform the encoder about the new target bit rate.
-  virtual void SetBitRate(int new_bit_rate) = 0;
-
-  // Inform the encoder to encode the next frame as a key frame.
-  virtual void GenerateKeyFrame() = 0;
-
-  // Creates a |VideoFrameFactory| object to vend |VideoFrame| object with
-  // encoder affinity (defined as offering some sort of performance benefit).
-  // This is an optional capability and by default returns null.
-  virtual std::unique_ptr<VideoFrameFactory> CreateVideoFrameFactory();
-
-  // Instructs the encoder to finish and emit all frames that have been
-  // submitted for encoding. An encoder may hold a certain number of frames for
-  // analysis. Under certain network conditions, particularly when there is
-  // network congestion, it is necessary to flush out of the encoder all
-  // submitted frames so that eventually new frames may be encoded. Like
-  // EncodeVideoFrame(), the encoder will process this request asynchronously.
-  virtual void EmitFrames();
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_VIDEO_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/video_encoder_impl.cc b/src/cobalt/media/cast/sender/video_encoder_impl.cc
deleted file mode 100644
index f8eb374..0000000
--- a/src/cobalt/media/cast/sender/video_encoder_impl.cc
+++ /dev/null
@@ -1,129 +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.
-
-#include "media/cast/sender/video_encoder_impl.h"
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "media/base/video_frame.h"
-#include "media/cast/sender/fake_software_video_encoder.h"
-#include "media/cast/sender/vp8_encoder.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-typedef base::Callback<void(Vp8Encoder*)> PassEncoderCallback;
-
-void InitializeEncoderOnEncoderThread(
-    const scoped_refptr<CastEnvironment>& environment,
-    SoftwareVideoEncoder* encoder) {
-  DCHECK(environment->CurrentlyOn(CastEnvironment::VIDEO));
-  encoder->Initialize();
-}
-
-void EncodeVideoFrameOnEncoderThread(
-    scoped_refptr<CastEnvironment> environment, SoftwareVideoEncoder* encoder,
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time,
-    const VideoEncoderImpl::CodecDynamicConfig& dynamic_config,
-    const VideoEncoderImpl::FrameEncodedCallback& frame_encoded_callback) {
-  DCHECK(environment->CurrentlyOn(CastEnvironment::VIDEO));
-  if (dynamic_config.key_frame_requested) {
-    encoder->GenerateKeyFrame();
-  }
-  encoder->UpdateRates(dynamic_config.bit_rate);
-
-  std::unique_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame());
-  encoder->Encode(video_frame, reference_time, encoded_frame.get());
-  encoded_frame->encode_completion_time = environment->Clock()->NowTicks();
-  environment->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(frame_encoded_callback, base::Passed(&encoded_frame)));
-}
-}  // namespace
-
-// static
-bool VideoEncoderImpl::IsSupported(const FrameSenderConfig& video_config) {
-#ifndef OFFICIAL_BUILD
-  if (video_config.codec == CODEC_VIDEO_FAKE) return true;
-#endif
-  return video_config.codec == CODEC_VIDEO_VP8;
-}
-
-VideoEncoderImpl::VideoEncoderImpl(
-    scoped_refptr<CastEnvironment> cast_environment,
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb)
-    : cast_environment_(cast_environment) {
-  CHECK(cast_environment_->HasVideoThread());
-  DCHECK(!status_change_cb.is_null());
-
-  if (video_config.codec == CODEC_VIDEO_VP8) {
-    encoder_.reset(new Vp8Encoder(video_config));
-    cast_environment_->PostTask(CastEnvironment::VIDEO, FROM_HERE,
-                                base::Bind(&InitializeEncoderOnEncoderThread,
-                                           cast_environment, encoder_.get()));
-#ifndef OFFICIAL_BUILD
-  } else if (video_config.codec == CODEC_VIDEO_FAKE) {
-    encoder_.reset(new FakeSoftwareVideoEncoder(video_config));
-#endif
-  } else {
-    DCHECK(false) << "Invalid config";  // Codec not supported.
-  }
-
-  dynamic_config_.key_frame_requested = false;
-  dynamic_config_.bit_rate = video_config.start_bitrate;
-
-  cast_environment_->PostTask(
-      CastEnvironment::MAIN, FROM_HERE,
-      base::Bind(status_change_cb, encoder_.get() ? STATUS_INITIALIZED
-                                                  : STATUS_UNSUPPORTED_CODEC));
-}
-
-VideoEncoderImpl::~VideoEncoderImpl() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (encoder_) {
-    cast_environment_->PostTask(
-        CastEnvironment::VIDEO, FROM_HERE,
-        base::Bind(&base::DeletePointer<SoftwareVideoEncoder>,
-                   encoder_.release()));
-  }
-}
-
-bool VideoEncoderImpl::EncodeVideoFrame(
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time,
-    const FrameEncodedCallback& frame_encoded_callback) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  DCHECK(!video_frame->visible_rect().IsEmpty());
-  DCHECK(!frame_encoded_callback.is_null());
-
-  cast_environment_->PostTask(
-      CastEnvironment::VIDEO, FROM_HERE,
-      base::Bind(&EncodeVideoFrameOnEncoderThread, cast_environment_,
-                 encoder_.get(), video_frame, reference_time, dynamic_config_,
-                 frame_encoded_callback));
-
-  dynamic_config_.key_frame_requested = false;
-  return true;
-}
-
-// Inform the encoder about the new target bit rate.
-void VideoEncoderImpl::SetBitRate(int new_bit_rate) {
-  dynamic_config_.bit_rate = new_bit_rate;
-}
-
-// Inform the encoder to encode the next frame as a key frame.
-void VideoEncoderImpl::GenerateKeyFrame() {
-  dynamic_config_.key_frame_requested = true;
-}
-
-}  //  namespace cast
-}  //  namespace media
diff --git a/src/cobalt/media/cast/sender/video_encoder_impl.h b/src/cobalt/media/cast/sender/video_encoder_impl.h
deleted file mode 100644
index be7a730..0000000
--- a/src/cobalt/media/cast/sender/video_encoder_impl.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_
-#define COBALT_MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/sender/software_video_encoder.h"
-#include "media/cast/sender/video_encoder.h"
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-
-namespace cast {
-
-// This object is called external from the main cast thread and internally from
-// the video encoder thread.
-class VideoEncoderImpl : public VideoEncoder {
- public:
-  struct CodecDynamicConfig {
-    bool key_frame_requested;
-    int bit_rate;
-  };
-
-  // Returns true if VideoEncoderImpl can be used with the given |video_config|.
-  static bool IsSupported(const FrameSenderConfig& video_config);
-
-  VideoEncoderImpl(scoped_refptr<CastEnvironment> cast_environment,
-                   const FrameSenderConfig& video_config,
-                   const StatusChangeCallback& status_change_cb);
-
-  ~VideoEncoderImpl() final;
-
-  // VideoEncoder implementation.
-  bool EncodeVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& reference_time,
-      const FrameEncodedCallback& frame_encoded_callback) final;
-  void SetBitRate(int new_bit_rate) final;
-  void GenerateKeyFrame() final;
-
- private:
-  scoped_refptr<CastEnvironment> cast_environment_;
-  CodecDynamicConfig dynamic_config_;
-
-  // This member belongs to the video encoder thread. It must not be
-  // dereferenced on the main thread. We manage the lifetime of this member
-  // manually because it needs to be initialize, used and destroyed on the
-  // video encoder thread and video encoder thread can out-live the main thread.
-  std::unique_ptr<SoftwareVideoEncoder> encoder_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoEncoderImpl);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_
diff --git a/src/cobalt/media/cast/sender/video_encoder_unittest.cc b/src/cobalt/media/cast/sender/video_encoder_unittest.cc
deleted file mode 100644
index 1646bba..0000000
--- a/src/cobalt/media/cast/sender/video_encoder_unittest.cc
+++ /dev/null
@@ -1,411 +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.
-
-#include "media/cast/sender/video_encoder.h"
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "build/build_config.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/sender/fake_video_encode_accelerator_factory.h"
-#include "media/cast/sender/video_frame_factory.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if defined(OS_MACOSX)
-#include "media/cast/sender/h264_vt_encoder.h"
-#endif
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class VideoEncoderTest
-    : public ::testing::TestWithParam<std::pair<Codec, bool>> {
- protected:
-  VideoEncoderTest()
-      : testing_clock_(new base::SimpleTestTickClock()),
-        task_runner_(new FakeSingleThreadTaskRunner(testing_clock_)),
-        cast_environment_(new CastEnvironment(
-            std::unique_ptr<base::TickClock>(testing_clock_), task_runner_,
-            task_runner_, task_runner_)),
-        video_config_(GetDefaultVideoSenderConfig()),
-        operational_status_(STATUS_UNINITIALIZED),
-        count_frames_delivered_(0) {
-    testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
-    first_frame_time_ = testing_clock_->NowTicks();
-  }
-
-  ~VideoEncoderTest() override {}
-
-  void SetUp() final {
-    video_config_.codec = GetParam().first;
-    video_config_.use_external_encoder = GetParam().second;
-
-    if (video_config_.use_external_encoder)
-      vea_factory_.reset(new FakeVideoEncodeAcceleratorFactory(task_runner_));
-  }
-
-  void TearDown() final {
-    video_encoder_.reset();
-    RunTasksAndAdvanceClock();
-  }
-
-  void CreateEncoder() {
-    ASSERT_EQ(STATUS_UNINITIALIZED, operational_status_);
-    video_config_.video_codec_params.max_number_of_video_buffers_used = 1;
-    video_encoder_ = VideoEncoder::Create(
-        cast_environment_, video_config_,
-        base::Bind(&VideoEncoderTest::OnOperationalStatusChange,
-                   base::Unretained(this)),
-        base::Bind(
-            &FakeVideoEncodeAcceleratorFactory::CreateVideoEncodeAccelerator,
-            base::Unretained(vea_factory_.get())),
-        base::Bind(&FakeVideoEncodeAcceleratorFactory::CreateSharedMemory,
-                   base::Unretained(vea_factory_.get())));
-    RunTasksAndAdvanceClock();
-    if (is_encoder_present())
-      ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-  }
-
-  bool is_encoder_present() const { return !!video_encoder_; }
-
-  bool is_testing_software_vp8_encoder() const {
-    return video_config_.codec == CODEC_VIDEO_VP8 &&
-           !video_config_.use_external_encoder;
-  }
-
-  bool is_testing_video_toolbox_encoder() const {
-    return
-#if defined(OS_MACOSX)
-        (!video_config_.use_external_encoder &&
-         H264VideoToolboxEncoder::IsSupported(video_config_)) ||
-#endif
-        false;
-  }
-
-  bool is_testing_platform_encoder() const {
-    return video_config_.use_external_encoder ||
-           is_testing_video_toolbox_encoder();
-  }
-
-  bool encoder_has_resize_delay() const {
-    return is_testing_platform_encoder() && !is_testing_video_toolbox_encoder();
-  }
-
-  VideoEncoder* video_encoder() const { return video_encoder_.get(); }
-
-  void DestroyEncoder() { video_encoder_.reset(); }
-
-  base::TimeTicks Now() const { return testing_clock_->NowTicks(); }
-
-  void RunTasksAndAdvanceClock() const {
-    DCHECK_GT(video_config_.max_frame_rate, 0);
-    const base::TimeDelta frame_duration = base::TimeDelta::FromMicroseconds(
-        1000000.0 / video_config_.max_frame_rate);
-#if defined(OS_MACOSX)
-    if (is_testing_video_toolbox_encoder()) {
-      // The H264VideoToolboxEncoder (on MAC_OSX and IOS) is not a faked
-      // implementation in these tests, and performs its encoding asynchronously
-      // on an unknown set of threads.  Therefore, sleep the current thread for
-      // the real amount of time to avoid excessively spinning the CPU while
-      // waiting for something to happen.
-      base::PlatformThread::Sleep(frame_duration);
-    }
-#endif
-    task_runner_->RunTasks();
-    testing_clock_->Advance(frame_duration);
-  }
-
-  int count_frames_delivered() const { return count_frames_delivered_; }
-
-  void WaitForAllFramesToBeDelivered(int total_expected) const {
-    video_encoder_->EmitFrames();
-    while (count_frames_delivered_ < total_expected) RunTasksAndAdvanceClock();
-  }
-
-  // Creates a new VideoFrame of the given |size|, filled with a test pattern.
-  // When available, it attempts to use the VideoFrameFactory provided by the
-  // encoder.
-  scoped_refptr<media::VideoFrame> CreateTestVideoFrame(const gfx::Size& size) {
-    const base::TimeDelta timestamp =
-        testing_clock_->NowTicks() - first_frame_time_;
-    scoped_refptr<media::VideoFrame> frame;
-    if (video_frame_factory_)
-      frame = video_frame_factory_->MaybeCreateFrame(size, timestamp);
-    if (!frame) {
-      frame = media::VideoFrame::CreateFrame(PIXEL_FORMAT_I420, size,
-                                             gfx::Rect(size), size, timestamp);
-    }
-    PopulateVideoFrame(frame.get(), 123);
-    return frame;
-  }
-
-  // Requests encoding the |video_frame| and has the resulting frame delivered
-  // via a callback that checks for expected results.  Returns false if the
-  // encoder rejected the request.
-  bool EncodeAndCheckDelivery(
-      const scoped_refptr<media::VideoFrame>& video_frame, FrameId frame_id,
-      FrameId reference_frame_id) {
-    return video_encoder_->EncodeVideoFrame(
-        video_frame, Now(),
-        base::Bind(&VideoEncoderTest::DeliverEncodedVideoFrame,
-                   base::Unretained(this), frame_id, reference_frame_id,
-                   RtpTimeTicks::FromTimeDelta(video_frame->timestamp(),
-                                               kVideoFrequency),
-                   Now()));
-  }
-
-  // If the implementation of |video_encoder_| is ExternalVideoEncoder, check
-  // that the VEA factory has responded (by running the callbacks) a specific
-  // number of times.  Otherwise, check that the VEA factory is inactive.
-  void ExpectVEAResponsesForExternalVideoEncoder(int vea_response_count,
-                                                 int shm_response_count) const {
-    if (!vea_factory_) return;
-    EXPECT_EQ(vea_response_count, vea_factory_->vea_response_count());
-    EXPECT_EQ(shm_response_count, vea_factory_->shm_response_count());
-  }
-
-  void SetVEAFactoryAutoRespond(bool auto_respond) {
-    if (vea_factory_) vea_factory_->SetAutoRespond(auto_respond);
-  }
-
- private:
-  void OnOperationalStatusChange(OperationalStatus status) {
-    DVLOG(1) << "OnOperationalStatusChange: from " << operational_status_
-             << " to " << status;
-    operational_status_ = status;
-
-    EXPECT_TRUE(operational_status_ == STATUS_CODEC_REINIT_PENDING ||
-                operational_status_ == STATUS_INITIALIZED);
-
-    // Create the VideoFrameFactory the first time status changes to
-    // STATUS_INITIALIZED.
-    if (operational_status_ == STATUS_INITIALIZED && !video_frame_factory_)
-      video_frame_factory_ = video_encoder_->CreateVideoFrameFactory();
-  }
-
-  // Checks that |encoded_frame| matches expected values.  This is the method
-  // bound in the callback returned from EncodeAndCheckDelivery().
-  void DeliverEncodedVideoFrame(
-      FrameId expected_frame_id, FrameId expected_last_referenced_frame_id,
-      RtpTimeTicks expected_rtp_timestamp,
-      const base::TimeTicks& expected_reference_time,
-      std::unique_ptr<SenderEncodedFrame> encoded_frame) {
-    EXPECT_TRUE(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-    EXPECT_EQ(expected_frame_id, encoded_frame->frame_id);
-    EXPECT_EQ(expected_rtp_timestamp, encoded_frame->rtp_timestamp);
-    EXPECT_EQ(expected_reference_time, encoded_frame->reference_time);
-
-    // The platform encoders are "black boxes" and may choose to vend key frames
-    // and/or empty data at any time.  The software encoders, however, should
-    // strictly adhere to expected behavior.
-    if (is_testing_platform_encoder()) {
-      const bool expected_key_frame =
-          expected_frame_id == expected_last_referenced_frame_id;
-      const bool have_key_frame =
-          encoded_frame->dependency == EncodedFrame::KEY;
-      EXPECT_EQ(have_key_frame,
-                encoded_frame->frame_id == encoded_frame->referenced_frame_id);
-      LOG_IF(WARNING, expected_key_frame != have_key_frame)
-          << "Platform encoder chose to emit a "
-          << (have_key_frame ? "key" : "delta")
-          << " frame instead of the expected kind @ frame_id="
-          << encoded_frame->frame_id;
-      LOG_IF(WARNING, encoded_frame->data.empty())
-          << "Platform encoder returned an empty frame @ frame_id="
-          << encoded_frame->frame_id;
-    } else {
-      if (expected_frame_id != expected_last_referenced_frame_id) {
-        EXPECT_EQ(EncodedFrame::DEPENDENT, encoded_frame->dependency);
-      } else if (video_config_.video_codec_params
-                     .max_number_of_video_buffers_used == 1) {
-        EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency);
-      }
-      EXPECT_EQ(expected_last_referenced_frame_id,
-                encoded_frame->referenced_frame_id);
-      EXPECT_FALSE(encoded_frame->data.empty());
-      ASSERT_TRUE(std::isfinite(encoded_frame->encoder_utilization));
-      EXPECT_LE(0.0, encoded_frame->encoder_utilization);
-      ASSERT_TRUE(std::isfinite(encoded_frame->lossy_utilization));
-      EXPECT_LE(0.0, encoded_frame->lossy_utilization);
-    }
-
-    ++count_frames_delivered_;
-  }
-
-  base::SimpleTestTickClock* const testing_clock_;  // Owned by CastEnvironment.
-  const scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  FrameSenderConfig video_config_;
-  std::unique_ptr<FakeVideoEncodeAcceleratorFactory> vea_factory_;
-  base::TimeTicks first_frame_time_;
-  OperationalStatus operational_status_;
-  std::unique_ptr<VideoEncoder> video_encoder_;
-  std::unique_ptr<VideoFrameFactory> video_frame_factory_;
-
-  int count_frames_delivered_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoEncoderTest);
-};
-
-// A simple test to encode three frames of video, expecting to see one key frame
-// followed by two delta frames.
-TEST_P(VideoEncoderTest, GeneratesKeyFrameThenOnlyDeltaFrames) {
-  CreateEncoder();
-  SetVEAFactoryAutoRespond(true);
-
-  EXPECT_EQ(0, count_frames_delivered());
-  ExpectVEAResponsesForExternalVideoEncoder(0, 0);
-
-  FrameId frame_id = FrameId::first();
-  FrameId reference_frame_id = FrameId::first();
-  const gfx::Size frame_size(1280, 720);
-
-  // Some encoders drop one or more frames initially while the encoder
-  // initializes. Then, for all encoders, expect one key frame is delivered.
-  bool accepted_first_frame = false;
-  do {
-    accepted_first_frame = EncodeAndCheckDelivery(
-        CreateTestVideoFrame(frame_size), frame_id, reference_frame_id);
-    if (!encoder_has_resize_delay()) EXPECT_TRUE(accepted_first_frame);
-    RunTasksAndAdvanceClock();
-  } while (!accepted_first_frame);
-  ExpectVEAResponsesForExternalVideoEncoder(1, 3);
-
-  // Expect the remaining frames are encoded as delta frames.
-  for (++frame_id; frame_id < FrameId::first() + 3;
-       ++frame_id, ++reference_frame_id) {
-    EXPECT_TRUE(EncodeAndCheckDelivery(CreateTestVideoFrame(frame_size),
-                                       frame_id, reference_frame_id));
-    RunTasksAndAdvanceClock();
-  }
-
-  WaitForAllFramesToBeDelivered(3);
-  ExpectVEAResponsesForExternalVideoEncoder(1, 3);
-}
-
-// Tests that the encoder continues to output EncodedFrames as the frame size
-// changes.  See media/cast/receiver/video_decoder_unittest.cc for a complete
-// encode/decode cycle of varied frame sizes that actually checks the frame
-// content.
-TEST_P(VideoEncoderTest, EncodesVariedFrameSizes) {
-  CreateEncoder();
-  SetVEAFactoryAutoRespond(true);
-
-  EXPECT_EQ(0, count_frames_delivered());
-  ExpectVEAResponsesForExternalVideoEncoder(0, 0);
-
-  std::vector<gfx::Size> frame_sizes;
-  frame_sizes.push_back(gfx::Size(128, 72));
-  frame_sizes.push_back(gfx::Size(64, 36));    // Shrink both dimensions.
-  frame_sizes.push_back(gfx::Size(30, 20));    // Shrink both dimensions again.
-  frame_sizes.push_back(gfx::Size(20, 30));    // Same area.
-  frame_sizes.push_back(gfx::Size(60, 40));    // Grow both dimensions.
-  frame_sizes.push_back(gfx::Size(58, 40));    // Shrink only one dimension.
-  frame_sizes.push_back(gfx::Size(58, 38));    // Shrink the other dimension.
-  frame_sizes.push_back(gfx::Size(32, 18));    // Shrink both dimensions again.
-  frame_sizes.push_back(gfx::Size(34, 18));    // Grow only one dimension.
-  frame_sizes.push_back(gfx::Size(34, 20));    // Grow the other dimension.
-  frame_sizes.push_back(gfx::Size(192, 108));  // Grow both dimensions again.
-
-  FrameId frame_id = FrameId::first();
-
-  // Encode one frame at each size. For encoders with a resize delay, except no
-  // frames to be delivered since each frame size change will sprun
-  // re-initialization of the underlying encoder. Otherwise expect all key
-  // frames to come out.
-  for (const auto& frame_size : frame_sizes) {
-    EXPECT_EQ(!encoder_has_resize_delay(),
-              EncodeAndCheckDelivery(CreateTestVideoFrame(frame_size), frame_id,
-                                     frame_id));
-    RunTasksAndAdvanceClock();
-    if (!encoder_has_resize_delay()) ++frame_id;
-  }
-
-  // Encode three frames at each size. For encoders with a resize delay, expect
-  // the first one or more frames are dropped while the encoder re-inits. Then,
-  // for all encoders, expect one key frame followed by all delta frames.
-  for (const auto& frame_size : frame_sizes) {
-    bool accepted_first_frame = false;
-    do {
-      accepted_first_frame = EncodeAndCheckDelivery(
-          CreateTestVideoFrame(frame_size), frame_id, frame_id);
-      if (!encoder_has_resize_delay()) EXPECT_TRUE(accepted_first_frame);
-      RunTasksAndAdvanceClock();
-    } while (!accepted_first_frame);
-    ++frame_id;
-    for (int i = 1; i < 3; ++i, ++frame_id) {
-      EXPECT_TRUE(EncodeAndCheckDelivery(CreateTestVideoFrame(frame_size),
-                                         frame_id, frame_id - 1));
-      RunTasksAndAdvanceClock();
-    }
-  }
-
-  WaitForAllFramesToBeDelivered(3 * frame_sizes.size());
-  ExpectVEAResponsesForExternalVideoEncoder(2 * frame_sizes.size(),
-                                            6 * frame_sizes.size());
-}
-
-// Verify that everything goes well even if ExternalVideoEncoder is destroyed
-// before it has a chance to receive the VEA creation callback.  For all other
-// encoders, this tests that the encoder can be safely destroyed before the task
-// is run that delivers the first EncodedFrame.
-TEST_P(VideoEncoderTest, CanBeDestroyedBeforeVEAIsCreated) {
-  CreateEncoder();
-
-  // Send a frame to spawn creation of the ExternalVideoEncoder instance.
-  EncodeAndCheckDelivery(CreateTestVideoFrame(gfx::Size(128, 72)),
-                         FrameId::first(), FrameId::first());
-
-  // Destroy the encoder, and confirm the VEA Factory did not respond yet.
-  DestroyEncoder();
-  ExpectVEAResponsesForExternalVideoEncoder(0, 0);
-
-  // Allow the VEA Factory to respond by running the creation callback.  When
-  // the task runs, it will be a no-op since the weak pointers to the
-  // ExternalVideoEncoder were invalidated.
-  SetVEAFactoryAutoRespond(true);
-  RunTasksAndAdvanceClock();
-  ExpectVEAResponsesForExternalVideoEncoder(1, 0);
-}
-
-namespace {
-std::vector<std::pair<Codec, bool>> DetermineEncodersToTest() {
-  std::vector<std::pair<Codec, bool>> values;
-  // Fake encoder.
-  values.push_back(std::make_pair(CODEC_VIDEO_FAKE, false));
-  // Software VP8 encoder.
-  values.push_back(std::make_pair(CODEC_VIDEO_VP8, false));
-  // Hardware-accelerated encoder (faked).
-  values.push_back(std::make_pair(CODEC_VIDEO_VP8, true));
-#if defined(OS_MACOSX)
-  // VideoToolbox encoder (when VideoToolbox is present).
-  FrameSenderConfig video_config = GetDefaultVideoSenderConfig();
-  video_config.use_external_encoder = false;
-  video_config.codec = CODEC_VIDEO_H264;
-  if (H264VideoToolboxEncoder::IsSupported(video_config))
-    values.push_back(std::make_pair(CODEC_VIDEO_H264, false));
-#endif
-  return values;
-}
-}  // namespace
-
-INSTANTIATE_TEST_CASE_P(, VideoEncoderTest,
-                        ::testing::ValuesIn(DetermineEncodersToTest()));
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/video_frame_factory.h b/src/cobalt/media/cast/sender/video_frame_factory.h
deleted file mode 100644
index f91875a..0000000
--- a/src/cobalt/media/cast/sender/video_frame_factory.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_VIDEO_FRAME_FACTORY_H_
-#define COBALT_MEDIA_CAST_SENDER_VIDEO_FRAME_FACTORY_H_
-
-#include <memory>
-
-#include "base/time/time.h"
-
-namespace gfx {
-class Size;
-}
-
-namespace cobalt {
-namespace media {
-
-class VideoFrame;
-
-namespace cast {
-
-// Interface for an object capable of vending video frames. There is no
-// requirement for a |VideoFrameFactory| to be concurrent but it must not be
-// pinned to a specific thread. Indeed, |VideoFrameFactory| implementations are
-// created by cast on the main cast thread then used by unknown client threads
-// via the |VideoFrameInput| interface.
-//
-// Clients are responsible for serialzing access to a |VideoFrameFactory|.
-// Generally speaking, it is expected that a client will be using these objects
-// from a rendering thread or callback (which may execute on different threads
-// but never concurrently with itself).
-class VideoFrameFactory {
- public:
-  virtual ~VideoFrameFactory() {}
-
-  // Creates a |VideoFrame| suitable for input via |InsertRawVideoFrame|. Frames
-  // obtained in this manner may provide benefits such memory reuse and affinity
-  // with the encoder. The format is guaranteed to be I420 or NV12.
-  //
-  // This can transiently return null if the encoder is not yet initialized or
-  // is re-initializing. Note however that if an encoder does support optimized
-  // frames, its |VideoFrameFactory| must eventually return frames. In practice,
-  // this means that |MaybeCreateFrame| must somehow signal the encoder to
-  // perform whatever initialization is needed to eventually produce frames.
-  virtual scoped_refptr<VideoFrame> MaybeCreateFrame(
-      const gfx::Size& frame_size, base::TimeDelta timestamp) = 0;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_VIDEO_FRAME_FACTORY_H_
diff --git a/src/cobalt/media/cast/sender/video_sender.cc b/src/cobalt/media/cast/sender/video_sender.cc
deleted file mode 100644
index d435917..0000000
--- a/src/cobalt/media/cast/sender/video_sender.cc
+++ /dev/null
@@ -1,332 +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.
-
-#include "media/cast/sender/video_sender.h"
-
-#include <algorithm>
-#include <cmath>
-#include <cstring>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/trace_event/trace_event.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/sender/performance_metrics_overlay.h"
-#include "media/cast/sender/video_encoder.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-// The following two constants are used to adjust the target
-// playout delay (when allowed). They were calculated using
-// a combination of cast_benchmark runs and manual testing.
-//
-// This is how many round trips we think we need on the network.
-const int kRoundTripsNeeded = 4;
-
-// This is an estimate of all the the constant time needed independent of
-// network quality (e.g., additional time that accounts for encode and decode
-// time).
-const int kConstantTimeMs = 75;
-
-// The target maximum utilization of the encoder and network resources.  This is
-// used to attenuate the actual measured utilization values in order to provide
-// "breathing room" (i.e., to ensure there will be sufficient CPU and bandwidth
-// available to handle the occasional more-complex frames).
-const int kTargetUtilizationPercentage = 75;
-
-// This is the minimum duration in milliseconds that the sender sends key frame
-// request to the encoder on receiving Pli messages. This is used to prevent
-// sending multiple requests while the sender is waiting for an encoded key
-// frame or receiving multiple Pli messages in a short period.
-const int64_t kMinKeyFrameRequestOnPliIntervalMs = 500;
-
-// Extract capture begin/end timestamps from |video_frame|'s metadata and log
-// it.
-void LogVideoCaptureTimestamps(CastEnvironment* cast_environment,
-                               const media::VideoFrame& video_frame,
-                               RtpTimeTicks rtp_timestamp) {
-  std::unique_ptr<FrameEvent> capture_begin_event(new FrameEvent());
-  capture_begin_event->type = FRAME_CAPTURE_BEGIN;
-  capture_begin_event->media_type = VIDEO_EVENT;
-  capture_begin_event->rtp_timestamp = rtp_timestamp;
-
-  std::unique_ptr<FrameEvent> capture_end_event(new FrameEvent());
-  capture_end_event->type = FRAME_CAPTURE_END;
-  capture_end_event->media_type = VIDEO_EVENT;
-  capture_end_event->rtp_timestamp = rtp_timestamp;
-  capture_end_event->width = video_frame.visible_rect().width();
-  capture_end_event->height = video_frame.visible_rect().height();
-
-  if (!video_frame.metadata()->GetTimeTicks(
-          media::VideoFrameMetadata::CAPTURE_BEGIN_TIME,
-          &capture_begin_event->timestamp) ||
-      !video_frame.metadata()->GetTimeTicks(
-          media::VideoFrameMetadata::CAPTURE_END_TIME,
-          &capture_end_event->timestamp)) {
-    // The frame capture timestamps were not provided by the video capture
-    // source.  Simply log the events as happening right now.
-    capture_begin_event->timestamp = capture_end_event->timestamp =
-        cast_environment->Clock()->NowTicks();
-  }
-
-  cast_environment->logger()->DispatchFrameEvent(
-      std::move(capture_begin_event));
-  cast_environment->logger()->DispatchFrameEvent(std::move(capture_end_event));
-}
-
-}  // namespace
-
-// Note, we use a fixed bitrate value when external video encoder is used.
-// Some hardware encoder shows bad behavior if we set the bitrate too
-// frequently, e.g. quality drop, not abiding by target bitrate, etc.
-// See details: crbug.com/392086.
-VideoSender::VideoSender(
-    scoped_refptr<CastEnvironment> cast_environment,
-    const FrameSenderConfig& video_config,
-    const StatusChangeCallback& status_change_cb,
-    const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-    const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb,
-    CastTransport* const transport_sender,
-    const PlayoutDelayChangeCB& playout_delay_change_cb)
-    : FrameSender(
-          cast_environment, transport_sender, video_config,
-          video_config.use_external_encoder
-              ? NewFixedCongestionControl(
-                    (video_config.min_bitrate + video_config.max_bitrate) / 2)
-              : NewAdaptiveCongestionControl(
-                    cast_environment->Clock(), video_config.max_bitrate,
-                    video_config.min_bitrate, video_config.max_frame_rate)),
-      frames_in_encoder_(0),
-      last_bitrate_(0),
-      playout_delay_change_cb_(playout_delay_change_cb),
-      low_latency_mode_(false),
-      last_reported_encoder_utilization_(-1.0),
-      last_reported_lossy_utilization_(-1.0),
-      weak_factory_(this) {
-  video_encoder_ =
-      VideoEncoder::Create(cast_environment_, video_config, status_change_cb,
-                           create_vea_cb, create_video_encode_mem_cb);
-  if (!video_encoder_) {
-    cast_environment_->PostTask(
-        CastEnvironment::MAIN, FROM_HERE,
-        base::Bind(status_change_cb, STATUS_UNSUPPORTED_CODEC));
-  }
-}
-
-VideoSender::~VideoSender() {}
-
-void VideoSender::InsertRawVideoFrame(
-    const scoped_refptr<media::VideoFrame>& video_frame,
-    const base::TimeTicks& reference_time) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  if (!video_encoder_) {
-    NOTREACHED();
-    return;
-  }
-
-  const RtpTimeTicks rtp_timestamp =
-      RtpTimeTicks::FromTimeDelta(video_frame->timestamp(), kVideoFrequency);
-  LogVideoCaptureTimestamps(cast_environment_.get(), *video_frame,
-                            rtp_timestamp);
-
-  // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
-  TRACE_EVENT_INSTANT2("cast_perf_test", "InsertRawVideoFrame",
-                       TRACE_EVENT_SCOPE_THREAD, "timestamp",
-                       reference_time.ToInternalValue(), "rtp_timestamp",
-                       rtp_timestamp.lower_32_bits());
-
-  bool low_latency_mode;
-  if (video_frame->metadata()->GetBoolean(
-          VideoFrameMetadata::INTERACTIVE_CONTENT, &low_latency_mode)) {
-    if (low_latency_mode && !low_latency_mode_) {
-      VLOG(1) << "Interactive mode playout time " << min_playout_delay_;
-      playout_delay_change_cb_.Run(min_playout_delay_);
-    }
-    low_latency_mode_ = low_latency_mode;
-  }
-
-  // Drop the frame if either its RTP or reference timestamp is not an increase
-  // over the last frame's.  This protects: 1) the duration calculations that
-  // assume timestamps are monotonically non-decreasing, and 2) assumptions made
-  // deeper in the implementation where each frame's RTP timestamp needs to be
-  // unique.
-  if (!last_enqueued_frame_reference_time_.is_null() &&
-      (rtp_timestamp <= last_enqueued_frame_rtp_timestamp_ ||
-       reference_time <= last_enqueued_frame_reference_time_)) {
-    VLOG(1) << "Dropping video frame: RTP or reference time did not increase.";
-    TRACE_EVENT_INSTANT2("cast.stream", "Video Frame Drop",
-                         TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
-                         rtp_timestamp.lower_32_bits(), "reason",
-                         "time did not increase");
-    return;
-  }
-
-  // Request a key frame when a Pli message was received, and it has been passed
-  // long enough from the last time sending key frame request on receiving a Pli
-  // message.
-  if (picture_lost_at_receiver_) {
-    const int64_t min_attemp_interval_ms =
-        std::max(kMinKeyFrameRequestOnPliIntervalMs,
-                 6 * target_playout_delay_.InMilliseconds());
-    if (last_time_attempted_to_resolve_pli_.is_null() ||
-        ((reference_time - last_time_attempted_to_resolve_pli_)
-             .InMilliseconds() > min_attemp_interval_ms)) {
-      video_encoder_->GenerateKeyFrame();
-      last_time_attempted_to_resolve_pli_ = reference_time;
-    }
-  }
-
-  // Two video frames are needed to compute the exact media duration added by
-  // the next frame.  If there are no frames in the encoder, compute a guess
-  // based on the configured |max_frame_rate_|.  Any error introduced by this
-  // guess will be eliminated when |duration_in_encoder_| is updated in
-  // OnEncodedVideoFrame().
-  const base::TimeDelta duration_added_by_next_frame =
-      frames_in_encoder_ > 0
-          ? reference_time - last_enqueued_frame_reference_time_
-          : base::TimeDelta::FromSecondsD(1.0 / max_frame_rate_);
-
-  if (ShouldDropNextFrame(duration_added_by_next_frame)) {
-    base::TimeDelta new_target_delay =
-        std::min(current_round_trip_time_ * kRoundTripsNeeded +
-                     base::TimeDelta::FromMilliseconds(kConstantTimeMs),
-                 max_playout_delay_);
-    // In case of low latency mode, we prefer frame drops over increasing
-    // playout time.
-    if (!low_latency_mode_ && new_target_delay > target_playout_delay_) {
-      // In case we detect user is no longer in a low latency mode and there is
-      // a need to drop a frame, we ensure the playout delay is at-least the
-      // the starting value for playing animated content.
-      // This is intended to minimize freeze when moving from an interactive
-      // session to watching animating content while being limited by end-to-end
-      // delay.
-      VLOG(1) << "Ensure playout time is at least " << animated_playout_delay_;
-      if (new_target_delay < animated_playout_delay_)
-        new_target_delay = animated_playout_delay_;
-      VLOG(1) << "New target delay: " << new_target_delay.InMilliseconds();
-      playout_delay_change_cb_.Run(new_target_delay);
-    }
-
-    // Some encoder implementations have a frame window for analysis. Since we
-    // are dropping this frame, unless we instruct the encoder to flush all the
-    // frames that have been enqueued for encoding, frames_in_encoder_ and
-    // last_enqueued_frame_reference_time_ will never be updated and we will
-    // drop every subsequent frame for the rest of the session.
-    video_encoder_->EmitFrames();
-
-    TRACE_EVENT_INSTANT2("cast.stream", "Video Frame Drop",
-                         TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
-                         rtp_timestamp.lower_32_bits(), "reason",
-                         "too much in flight");
-    return;
-  }
-
-  if (video_frame->visible_rect().IsEmpty()) {
-    VLOG(1) << "Rejecting empty video frame.";
-    return;
-  }
-
-  const int bitrate = congestion_control_->GetBitrate(
-      reference_time + target_playout_delay_, target_playout_delay_);
-  if (bitrate != last_bitrate_) {
-    video_encoder_->SetBitRate(bitrate);
-    last_bitrate_ = bitrate;
-  }
-
-  TRACE_COUNTER_ID1("cast.stream", "Video Target Bitrate", this, bitrate);
-
-  MaybeRenderPerformanceMetricsOverlay(
-      GetTargetPlayoutDelay(), low_latency_mode_, bitrate,
-      frames_in_encoder_ + 1, last_reported_encoder_utilization_,
-      last_reported_lossy_utilization_, video_frame.get());
-
-  if (video_encoder_->EncodeVideoFrame(
-          video_frame, reference_time,
-          base::Bind(&VideoSender::OnEncodedVideoFrame,
-                     weak_factory_.GetWeakPtr(), video_frame, bitrate))) {
-    TRACE_EVENT_ASYNC_BEGIN1("cast.stream", "Video Encode", video_frame.get(),
-                             "rtp_timestamp", rtp_timestamp.lower_32_bits());
-    frames_in_encoder_++;
-    duration_in_encoder_ += duration_added_by_next_frame;
-    last_enqueued_frame_rtp_timestamp_ = rtp_timestamp;
-    last_enqueued_frame_reference_time_ = reference_time;
-  } else {
-    VLOG(1) << "Encoder rejected a frame.  Skipping...";
-    TRACE_EVENT_INSTANT1("cast.stream", "Video Encode Reject",
-                         TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
-                         rtp_timestamp.lower_32_bits());
-  }
-}
-
-std::unique_ptr<VideoFrameFactory> VideoSender::CreateVideoFrameFactory() {
-  return video_encoder_ ? video_encoder_->CreateVideoFrameFactory() : nullptr;
-}
-
-int VideoSender::GetNumberOfFramesInEncoder() const {
-  return frames_in_encoder_;
-}
-
-base::TimeDelta VideoSender::GetInFlightMediaDuration() const {
-  if (GetUnacknowledgedFrameCount() > 0) {
-    const FrameId oldest_unacked_frame_id = latest_acked_frame_id_ + 1;
-    return last_enqueued_frame_reference_time_ -
-           GetRecordedReferenceTime(oldest_unacked_frame_id);
-  } else {
-    return duration_in_encoder_;
-  }
-}
-
-void VideoSender::OnEncodedVideoFrame(
-    const scoped_refptr<media::VideoFrame>& video_frame, int encoder_bitrate,
-    std::unique_ptr<SenderEncodedFrame> encoded_frame) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  frames_in_encoder_--;
-  DCHECK_GE(frames_in_encoder_, 0);
-
-  // Encoding was exited with errors.
-  if (!encoded_frame) return;
-
-  duration_in_encoder_ =
-      last_enqueued_frame_reference_time_ - encoded_frame->reference_time;
-
-  last_reported_encoder_utilization_ = encoded_frame->encoder_utilization;
-  last_reported_lossy_utilization_ = encoded_frame->lossy_utilization;
-
-  TRACE_EVENT_ASYNC_END2("cast.stream", "Video Encode", video_frame.get(),
-                         "encoder_utilization",
-                         last_reported_encoder_utilization_,
-                         "lossy_utilization", last_reported_lossy_utilization_);
-
-  // Report the resource utilization for processing this frame.  Take the
-  // greater of the two utilization values and attenuate them such that the
-  // target utilization is reported as the maximum sustainable amount.
-  const double attenuated_utilization =
-      std::max(last_reported_encoder_utilization_,
-               last_reported_lossy_utilization_) /
-      (kTargetUtilizationPercentage / 100.0);
-  if (attenuated_utilization >= 0.0) {
-    // Key frames are artificially capped to 1.0 because their actual
-    // utilization is atypical compared to the other frames in the stream, and
-    // this can misguide the producer of the input video frames.
-    video_frame->metadata()->SetDouble(
-        media::VideoFrameMetadata::RESOURCE_UTILIZATION,
-        encoded_frame->dependency == EncodedFrame::KEY
-            ? std::min(1.0, attenuated_utilization)
-            : attenuated_utilization);
-  }
-
-  SendEncodedFrame(encoder_bitrate, std::move(encoded_frame));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/video_sender.h b/src/cobalt/media/cast/sender/video_sender.h
deleted file mode 100644
index 71de592..0000000
--- a/src/cobalt/media/cast/sender/video_sender.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_VIDEO_SENDER_H_
-#define COBALT_MEDIA_CAST_SENDER_VIDEO_SENDER_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/common/rtp_time.h"
-#include "media/cast/sender/congestion_control.h"
-#include "media/cast/sender/frame_sender.h"
-
-namespace cobalt {
-namespace media {
-
-class VideoFrame;
-
-namespace cast {
-
-class CastTransport;
-class VideoEncoder;
-class VideoFrameFactory;
-
-typedef base::Callback<void(base::TimeDelta)> PlayoutDelayChangeCB;
-
-// Not thread safe. Only called from the main cast thread.
-// This class owns all objects related to sending video, objects that create RTP
-// packets, congestion control, video encoder, parsing and sending of
-// RTCP packets.
-// Additionally it posts a bunch of delayed tasks to the main thread for various
-// timeouts.
-class VideoSender : public FrameSender,
-                    public base::NonThreadSafe,
-                    public base::SupportsWeakPtr<VideoSender> {
- public:
-  VideoSender(scoped_refptr<CastEnvironment> cast_environment,
-              const FrameSenderConfig& video_config,
-              const StatusChangeCallback& status_change_cb,
-              const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-              const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb,
-              CastTransport* const transport_sender,
-              const PlayoutDelayChangeCB& playout_delay_change_cb);
-
-  ~VideoSender() override;
-
-  // Note: It is not guaranteed that |video_frame| will actually be encoded and
-  // sent, if VideoSender detects too many frames in flight.  Therefore, clients
-  // should be careful about the rate at which this method is called.
-  void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
-                           const base::TimeTicks& reference_time);
-
-  // Creates a |VideoFrameFactory| object to vend |VideoFrame| object with
-  // encoder affinity (defined as offering some sort of performance benefit). If
-  // the encoder does not have any such capability, returns null.
-  std::unique_ptr<VideoFrameFactory> CreateVideoFrameFactory();
-
- protected:
-  int GetNumberOfFramesInEncoder() const final;
-  base::TimeDelta GetInFlightMediaDuration() const final;
-
- private:
-  // Called by the |video_encoder_| with the next EncodedFrame to send.
-  void OnEncodedVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
-                           int encoder_bitrate,
-                           std::unique_ptr<SenderEncodedFrame> encoded_frame);
-
-  // Encodes media::VideoFrame images into EncodedFrames.  Per configuration,
-  // this will point to either the internal software-based encoder or a proxy to
-  // a hardware-based encoder.
-  std::unique_ptr<VideoEncoder> video_encoder_;
-
-  // The number of frames queued for encoding, but not yet sent.
-  int frames_in_encoder_;
-
-  // The duration of video queued for encoding, but not yet sent.
-  base::TimeDelta duration_in_encoder_;
-
-  // The timestamp of the frame that was last enqueued in |video_encoder_|.
-  RtpTimeTicks last_enqueued_frame_rtp_timestamp_;
-  base::TimeTicks last_enqueued_frame_reference_time_;
-
-  // Remember what we set the bitrate to before, no need to set it again if
-  // we get the same value.
-  int last_bitrate_;
-
-  PlayoutDelayChangeCB playout_delay_change_cb_;
-
-  // Indicates we are operating in a mode where the target playout latency is
-  // low for best user experience. When operating in low latency mode, we
-  // prefer dropping frames over increasing target playout time.
-  bool low_latency_mode_;
-
-  // The video encoder's performance metrics as of the last call to
-  // OnEncodedVideoFrame().  See header file comments for SenderEncodedFrame for
-  // an explanation of these values.
-  double last_reported_encoder_utilization_;
-  double last_reported_lossy_utilization_;
-
-  // This tracks the time when the request was sent to encoder to encode a key
-  // frame on receiving a Pli message. It is used to limit the sender not
-  // to duplicately respond to multiple Pli messages in a short period.
-  base::TimeTicks last_time_attempted_to_resolve_pli_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<VideoSender> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(VideoSender);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_VIDEO_SENDER_H_
diff --git a/src/cobalt/media/cast/sender/video_sender_unittest.cc b/src/cobalt/media/cast/sender/video_sender_unittest.cc
deleted file mode 100644
index d91aa4a..0000000
--- a/src/cobalt/media/cast/sender/video_sender_unittest.cc
+++ /dev/null
@@ -1,632 +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.
-
-#include "media/cast/sender/video_sender.h"
-
-#include <memory>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/constants.h"
-#include "media/cast/logging/simple_event_subscriber.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/net/cast_transport_impl.h"
-#include "media/cast/net/pacing/paced_sender.h"
-#include "media/cast/sender/fake_video_encode_accelerator_factory.h"
-#include "media/cast/sender/video_frame_factory.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "media/video/fake_video_encode_accelerator.h"
-#include "starboard/types.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-static const uint8_t kPixelValue = 123;
-static const int kWidth = 320;
-static const int kHeight = 240;
-
-using testing::_;
-using testing::AtLeast;
-
-void SaveOperationalStatus(OperationalStatus* out_status,
-                           OperationalStatus in_status) {
-  DVLOG(1) << "OperationalStatus transitioning from " << *out_status << " to "
-           << in_status;
-  *out_status = in_status;
-}
-
-class TestPacketSender : public PacketTransport {
- public:
-  TestPacketSender()
-      : number_of_rtp_packets_(0), number_of_rtcp_packets_(0), paused_(false) {}
-
-  // A singular packet implies a RTCP packet.
-  bool SendPacket(PacketRef packet, const base::Closure& cb) final {
-    if (paused_) {
-      stored_packet_ = packet;
-      callback_ = cb;
-      return false;
-    }
-    if (IsRtcpPacket(&packet->data[0], packet->data.size())) {
-      ++number_of_rtcp_packets_;
-    } else {
-      // Check that at least one RTCP packet was sent before the first RTP
-      // packet.  This confirms that the receiver will have the necessary lip
-      // sync info before it has to calculate the playout time of the first
-      // frame.
-      if (number_of_rtp_packets_ == 0) EXPECT_LE(1, number_of_rtcp_packets_);
-      ++number_of_rtp_packets_;
-    }
-    return true;
-  }
-
-  int64_t GetBytesSent() final { return 0; }
-
-  void StartReceiving(
-      const PacketReceiverCallbackWithStatus& packet_receiver) final {}
-
-  void StopReceiving() final {}
-
-  int number_of_rtp_packets() const { return number_of_rtp_packets_; }
-
-  int number_of_rtcp_packets() const { return number_of_rtcp_packets_; }
-
-  void SetPause(bool paused) {
-    paused_ = paused;
-    if (!paused && stored_packet_.get()) {
-      SendPacket(stored_packet_, callback_);
-      callback_.Run();
-    }
-  }
-
- private:
-  int number_of_rtp_packets_;
-  int number_of_rtcp_packets_;
-  bool paused_;
-  base::Closure callback_;
-  PacketRef stored_packet_;
-
-  DISALLOW_COPY_AND_ASSIGN(TestPacketSender);
-};
-
-void IgnorePlayoutDelayChanges(base::TimeDelta unused_playout_delay) {}
-
-class PeerVideoSender : public VideoSender {
- public:
-  PeerVideoSender(
-      scoped_refptr<CastEnvironment> cast_environment,
-      const FrameSenderConfig& video_config,
-      const StatusChangeCallback& status_change_cb,
-      const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
-      const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb,
-      CastTransport* const transport_sender)
-      : VideoSender(cast_environment, video_config, status_change_cb,
-                    create_vea_cb, create_video_encode_mem_cb, transport_sender,
-                    base::Bind(&IgnorePlayoutDelayChanges)) {}
-  using VideoSender::OnReceivedCastFeedback;
-  using VideoSender::OnReceivedPli;
-};
-
-class TransportClient : public CastTransport::Client {
- public:
-  TransportClient() {}
-
-  void OnStatusChanged(CastTransportStatus status) final {
-    EXPECT_EQ(TRANSPORT_STREAM_INITIALIZED, status);
-  };
-  void OnLoggingEventsReceived(
-      std::unique_ptr<std::vector<FrameEvent>> frame_events,
-      std::unique_ptr<std::vector<PacketEvent>> packet_events) final{};
-  void ProcessRtpPacket(std::unique_ptr<Packet> packet) final{};
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(TransportClient);
-};
-
-}  // namespace
-
-class VideoSenderTest : public ::testing::Test {
- protected:
-  VideoSenderTest()
-      : testing_clock_(new base::SimpleTestTickClock()),
-        task_runner_(new FakeSingleThreadTaskRunner(testing_clock_)),
-        cast_environment_(new CastEnvironment(
-            std::unique_ptr<base::TickClock>(testing_clock_), task_runner_,
-            task_runner_, task_runner_)),
-        operational_status_(STATUS_UNINITIALIZED),
-        vea_factory_(task_runner_) {
-    testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
-    vea_factory_.SetAutoRespond(true);
-    last_pixel_value_ = kPixelValue;
-    transport_ = new TestPacketSender();
-    transport_sender_.reset(new CastTransportImpl(
-        testing_clock_, base::TimeDelta(), base::MakeUnique<TransportClient>(),
-        base::WrapUnique(transport_), task_runner_));
-  }
-
-  ~VideoSenderTest() override {}
-
-  void TearDown() final {
-    video_sender_.reset();
-    task_runner_->RunTasks();
-  }
-
-  // If |external| is true then external video encoder (VEA) is used.
-  // |expect_init_success| is true if initialization is expected to succeed.
-  void InitEncoder(bool external, bool expect_init_success) {
-    FrameSenderConfig video_config = GetDefaultVideoSenderConfig();
-    video_config.use_external_encoder = external;
-
-    ASSERT_EQ(operational_status_, STATUS_UNINITIALIZED);
-
-    if (external) {
-      vea_factory_.SetInitializationWillSucceed(expect_init_success);
-      video_sender_.reset(new PeerVideoSender(
-          cast_environment_, video_config,
-          base::Bind(&SaveOperationalStatus, &operational_status_),
-          base::Bind(
-              &FakeVideoEncodeAcceleratorFactory::CreateVideoEncodeAccelerator,
-              base::Unretained(&vea_factory_)),
-          base::Bind(&FakeVideoEncodeAcceleratorFactory::CreateSharedMemory,
-                     base::Unretained(&vea_factory_)),
-          transport_sender_.get()));
-    } else {
-      video_sender_.reset(new PeerVideoSender(
-          cast_environment_, video_config,
-          base::Bind(&SaveOperationalStatus, &operational_status_),
-          CreateDefaultVideoEncodeAcceleratorCallback(),
-          CreateDefaultVideoEncodeMemoryCallback(), transport_sender_.get()));
-    }
-    task_runner_->RunTasks();
-  }
-
-  scoped_refptr<media::VideoFrame> GetNewVideoFrame() {
-    if (first_frame_timestamp_.is_null())
-      first_frame_timestamp_ = testing_clock_->NowTicks();
-    gfx::Size size(kWidth, kHeight);
-    scoped_refptr<media::VideoFrame> video_frame =
-        media::VideoFrame::CreateFrame(
-            PIXEL_FORMAT_I420, size, gfx::Rect(size), size,
-            testing_clock_->NowTicks() - first_frame_timestamp_);
-    PopulateVideoFrame(video_frame.get(), last_pixel_value_++);
-    return video_frame;
-  }
-
-  scoped_refptr<media::VideoFrame> GetLargeNewVideoFrame() {
-    if (first_frame_timestamp_.is_null())
-      first_frame_timestamp_ = testing_clock_->NowTicks();
-    gfx::Size size(kWidth, kHeight);
-    scoped_refptr<media::VideoFrame> video_frame =
-        media::VideoFrame::CreateFrame(
-            PIXEL_FORMAT_I420, size, gfx::Rect(size), size,
-            testing_clock_->NowTicks() - first_frame_timestamp_);
-    PopulateVideoFrameWithNoise(video_frame.get());
-    return video_frame;
-  }
-
-  void RunTasks(int during_ms) {
-    task_runner_->Sleep(base::TimeDelta::FromMilliseconds(during_ms));
-  }
-
-  base::SimpleTestTickClock* const testing_clock_;  // Owned by CastEnvironment.
-  const scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  OperationalStatus operational_status_;
-  FakeVideoEncodeAcceleratorFactory vea_factory_;
-  TestPacketSender* transport_;  // Owned by CastTransport.
-  std::unique_ptr<CastTransportImpl> transport_sender_;
-  std::unique_ptr<PeerVideoSender> video_sender_;
-  int last_pixel_value_;
-  base::TimeTicks first_frame_timestamp_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(VideoSenderTest);
-};
-
-TEST_F(VideoSenderTest, BuiltInEncoder) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-
-  const base::TimeTicks reference_time = testing_clock_->NowTicks();
-  video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-
-  task_runner_->RunTasks();
-  EXPECT_LE(1, transport_->number_of_rtp_packets());
-  EXPECT_LE(1, transport_->number_of_rtcp_packets());
-}
-
-TEST_F(VideoSenderTest, ExternalEncoder) {
-  InitEncoder(true, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  // The SizeAdaptableExternalVideoEncoder initally reports STATUS_INITIALIZED
-  // so that frames will be sent to it.  Therefore, no encoder activity should
-  // have occurred at this point.  Send a frame to spurn creation of the
-  // underlying ExternalVideoEncoder instance.
-  if (vea_factory_.vea_response_count() == 0) {
-    video_sender_->InsertRawVideoFrame(GetNewVideoFrame(),
-                                       testing_clock_->NowTicks());
-    task_runner_->RunTasks();
-  }
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-  RunTasks(33);
-
-  // VideoSender created an encoder for 1280x720 frames, in order to provide the
-  // INITIALIZED status.
-  EXPECT_EQ(1, vea_factory_.vea_response_count());
-  EXPECT_EQ(3, vea_factory_.shm_response_count());
-
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-
-  for (int i = 0; i < 3; ++i) {
-    const base::TimeTicks reference_time = testing_clock_->NowTicks();
-    video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-    RunTasks(33);
-    // VideoSender re-created the encoder for the 320x240 frames we're
-    // providing.
-    EXPECT_EQ(1, vea_factory_.vea_response_count());
-    EXPECT_EQ(3, vea_factory_.shm_response_count());
-  }
-
-  video_sender_.reset(NULL);
-  task_runner_->RunTasks();
-  EXPECT_EQ(1, vea_factory_.vea_response_count());
-  EXPECT_EQ(3, vea_factory_.shm_response_count());
-}
-
-TEST_F(VideoSenderTest, ExternalEncoderInitFails) {
-  InitEncoder(true, false);
-
-  // The SizeAdaptableExternalVideoEncoder initally reports STATUS_INITIALIZED
-  // so that frames will be sent to it.  Send a frame to spurn creation of the
-  // underlying ExternalVideoEncoder instance, which should result in failure.
-  if (operational_status_ == STATUS_INITIALIZED ||
-      operational_status_ == STATUS_CODEC_REINIT_PENDING) {
-    video_sender_->InsertRawVideoFrame(GetNewVideoFrame(),
-                                       testing_clock_->NowTicks());
-    task_runner_->RunTasks();
-  }
-  EXPECT_EQ(STATUS_CODEC_INIT_FAILED, operational_status_);
-
-  video_sender_.reset(NULL);
-  task_runner_->RunTasks();
-}
-
-TEST_F(VideoSenderTest, RtcpTimer) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-
-  const base::TimeTicks reference_time = testing_clock_->NowTicks();
-  video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-
-  // Make sure that we send at least one RTCP packet.
-  base::TimeDelta max_rtcp_timeout =
-      base::TimeDelta::FromMilliseconds(1 + kRtcpReportIntervalMs * 3 / 2);
-
-  RunTasks(max_rtcp_timeout.InMilliseconds());
-  EXPECT_LE(1, transport_->number_of_rtp_packets());
-  EXPECT_LE(1, transport_->number_of_rtcp_packets());
-  // Build Cast msg and expect RTCP packet.
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-  video_sender_->OnReceivedCastFeedback(cast_feedback);
-  RunTasks(max_rtcp_timeout.InMilliseconds());
-  EXPECT_LE(1, transport_->number_of_rtcp_packets());
-}
-
-TEST_F(VideoSenderTest, ResendTimer) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-
-  const base::TimeTicks reference_time = testing_clock_->NowTicks();
-  video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-
-  // ACK the key frame.
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-  video_sender_->OnReceivedCastFeedback(cast_feedback);
-
-  video_frame = GetNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-
-  base::TimeDelta max_resend_timeout =
-      base::TimeDelta::FromMilliseconds(1 + kDefaultRtpMaxDelayMs);
-
-  // Make sure that we do a re-send.
-  RunTasks(max_resend_timeout.InMilliseconds());
-  // Should have sent at least 3 packets.
-  EXPECT_LE(3, transport_->number_of_rtp_packets() +
-                   transport_->number_of_rtcp_packets());
-}
-
-TEST_F(VideoSenderTest, LogAckReceivedEvent) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  SimpleEventSubscriber event_subscriber;
-  cast_environment_->logger()->Subscribe(&event_subscriber);
-
-  int num_frames = 10;
-  for (int i = 0; i < num_frames; i++) {
-    scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-
-    const base::TimeTicks reference_time = testing_clock_->NowTicks();
-    video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-    RunTasks(33);
-  }
-
-  task_runner_->RunTasks();
-
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.ack_frame_id = FrameId::first() + num_frames - 1;
-
-  video_sender_->OnReceivedCastFeedback(cast_feedback);
-
-  std::vector<FrameEvent> frame_events;
-  event_subscriber.GetFrameEventsAndReset(&frame_events);
-
-  ASSERT_TRUE(!frame_events.empty());
-  EXPECT_EQ(FRAME_ACK_RECEIVED, frame_events.rbegin()->type);
-  EXPECT_EQ(VIDEO_EVENT, frame_events.rbegin()->media_type);
-  EXPECT_EQ(FrameId::first() + num_frames - 1, frame_events.rbegin()->frame_id);
-
-  cast_environment_->logger()->Unsubscribe(&event_subscriber);
-}
-
-TEST_F(VideoSenderTest, StopSendingInTheAbsenceOfAck) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  // Send a stream of frames and don't ACK; by default we shouldn't have more
-  // than 4 frames in flight.
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-  RunTasks(33);
-
-  // Send 3 more frames and record the number of packets sent.
-  for (int i = 0; i < 3; ++i) {
-    scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-    video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-    RunTasks(33);
-  }
-  const int number_of_packets_sent = transport_->number_of_rtp_packets();
-
-  // Send 3 more frames - they should not be encoded, as we have not received
-  // any acks.
-  for (int i = 0; i < 3; ++i) {
-    scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-    video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-    RunTasks(33);
-  }
-
-  // We expect a frame to be retransmitted because of duplicated ACKs.
-  // Only one packet of the frame is re-transmitted.
-  EXPECT_EQ(number_of_packets_sent + 1, transport_->number_of_rtp_packets());
-
-  // Start acking and make sure we're back to steady-state.
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-  video_sender_->OnReceivedCastFeedback(cast_feedback);
-  EXPECT_LE(4, transport_->number_of_rtp_packets() +
-                   transport_->number_of_rtcp_packets());
-
-  // Empty the pipeline.
-  RunTasks(100);
-  // Should have sent at least 7 packets.
-  EXPECT_LE(7, transport_->number_of_rtp_packets() +
-                   transport_->number_of_rtcp_packets());
-}
-
-TEST_F(VideoSenderTest, DuplicateAckRetransmit) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-  RunTasks(33);
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-
-  // Send 3 more frames but don't ACK.
-  for (int i = 0; i < 3; ++i) {
-    scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-    video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-    RunTasks(33);
-  }
-  const int number_of_packets_sent = transport_->number_of_rtp_packets();
-
-  // Send duplicated ACKs and mix some invalid NACKs.
-  for (int i = 0; i < 10; ++i) {
-    RtcpCastMessage ack_feedback(1);
-    ack_feedback.remote_ssrc = 2;
-    ack_feedback.ack_frame_id = FrameId::first();
-    RtcpCastMessage nack_feedback(1);
-    nack_feedback.remote_ssrc = 2;
-    nack_feedback.missing_frames_and_packets[FrameId::first() + 255] =
-        PacketIdSet();
-    video_sender_->OnReceivedCastFeedback(ack_feedback);
-    video_sender_->OnReceivedCastFeedback(nack_feedback);
-  }
-  EXPECT_EQ(number_of_packets_sent, transport_->number_of_rtp_packets());
-
-  // Re-transmit one packet because of duplicated ACKs.
-  for (int i = 0; i < 3; ++i) {
-    RtcpCastMessage ack_feedback(1);
-    ack_feedback.remote_ssrc = 2;
-    ack_feedback.ack_frame_id = FrameId::first();
-    video_sender_->OnReceivedCastFeedback(ack_feedback);
-  }
-  EXPECT_EQ(number_of_packets_sent + 1, transport_->number_of_rtp_packets());
-}
-
-TEST_F(VideoSenderTest, DuplicateAckRetransmitDoesNotCancelRetransmits) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-  RunTasks(33);
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-
-  // Send 2 more frames but don't ACK.
-  for (int i = 0; i < 2; ++i) {
-    scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-    video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-    RunTasks(33);
-  }
-  // Pause the transport
-  transport_->SetPause(true);
-
-  // Insert one more video frame.
-  video_frame = GetLargeNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-  RunTasks(33);
-
-  const int number_of_packets_sent = transport_->number_of_rtp_packets();
-
-  // Send duplicated ACKs and mix some invalid NACKs.
-  for (int i = 0; i < 10; ++i) {
-    RtcpCastMessage ack_feedback(1);
-    ack_feedback.remote_ssrc = 2;
-    ack_feedback.ack_frame_id = FrameId::first();
-    RtcpCastMessage nack_feedback(1);
-    nack_feedback.remote_ssrc = 2;
-    nack_feedback.missing_frames_and_packets[FrameId::first() + 255] =
-        PacketIdSet();
-    video_sender_->OnReceivedCastFeedback(ack_feedback);
-    video_sender_->OnReceivedCastFeedback(nack_feedback);
-  }
-  EXPECT_EQ(number_of_packets_sent, transport_->number_of_rtp_packets());
-
-  // Re-transmit one packet because of duplicated ACKs.
-  for (int i = 0; i < 3; ++i) {
-    RtcpCastMessage ack_feedback(1);
-    ack_feedback.remote_ssrc = 2;
-    ack_feedback.ack_frame_id = FrameId::first();
-    video_sender_->OnReceivedCastFeedback(ack_feedback);
-  }
-
-  transport_->SetPause(false);
-  RunTasks(100);
-  EXPECT_LT(number_of_packets_sent + 1, transport_->number_of_rtp_packets());
-}
-
-TEST_F(VideoSenderTest, AcksCancelRetransmits) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  transport_->SetPause(true);
-  scoped_refptr<media::VideoFrame> video_frame = GetLargeNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-  RunTasks(33);
-
-  // Frame should be in buffer, waiting. Now let's ack it.
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-  video_sender_->OnReceivedCastFeedback(cast_feedback);
-
-  transport_->SetPause(false);
-  RunTasks(33);
-  EXPECT_EQ(0, transport_->number_of_rtp_packets());
-}
-
-TEST_F(VideoSenderTest, CheckVideoFrameFactoryIsNull) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  EXPECT_EQ(nullptr, video_sender_->CreateVideoFrameFactory().get());
-}
-
-TEST_F(VideoSenderTest, PopulatesResourceUtilizationInFrameMetadata) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  for (int i = 0; i < 3; ++i) {
-    scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-    ASSERT_FALSE(video_frame->metadata()->HasKey(
-        media::VideoFrameMetadata::RESOURCE_UTILIZATION));
-
-    const base::TimeTicks reference_time = testing_clock_->NowTicks();
-    video_sender_->InsertRawVideoFrame(video_frame, reference_time);
-
-    // Run encode tasks.  VideoSender::OnEncodedVideoFrame() will be called once
-    // encoding of the frame is complete, and this is when the
-    // RESOURCE_UTILIZATION metadata is populated.
-    RunTasks(33);
-
-    // Check that the RESOURCE_UTILIZATION value is set and non-negative.  Don't
-    // check for specific values because they are dependent on real-world CPU
-    // encode time, which can vary across test runs.
-    double utilization = -1.0;
-    EXPECT_TRUE(video_frame->metadata()->GetDouble(
-        media::VideoFrameMetadata::RESOURCE_UTILIZATION, &utilization));
-    EXPECT_LE(0.0, utilization);
-    if (i == 0) EXPECT_GE(1.0, utilization);  // Key frames never exceed 1.0.
-    DVLOG(1) << "Utilization computed by VideoSender is: " << utilization;
-  }
-}
-
-TEST_F(VideoSenderTest, CancelSendingOnReceivingPli) {
-  InitEncoder(false, true);
-  ASSERT_EQ(STATUS_INITIALIZED, operational_status_);
-
-  // Send a frame and ACK it.
-  scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-  RunTasks(33);
-
-  RtcpCastMessage cast_feedback(1);
-  cast_feedback.remote_ssrc = 2;
-  cast_feedback.ack_frame_id = FrameId::first();
-  video_sender_->OnReceivedCastFeedback(cast_feedback);
-
-  transport_->SetPause(true);
-  // Send three more frames.
-  for (int i = 0; i < 3; i++) {
-    video_frame = GetNewVideoFrame();
-    video_sender_->InsertRawVideoFrame(video_frame, testing_clock_->NowTicks());
-    RunTasks(33);
-  }
-  EXPECT_EQ(1, transport_->number_of_rtp_packets());
-
-  // Frames should be in buffer, waiting.
-  // Received PLI from receiver.
-  video_sender_->OnReceivedPli();
-  video_frame = GetNewVideoFrame();
-  video_sender_->InsertRawVideoFrame(
-      video_frame,
-      testing_clock_->NowTicks() + base::TimeDelta::FromMilliseconds(1000));
-  RunTasks(33);
-  transport_->SetPause(false);
-  RunTasks(33);
-  EXPECT_EQ(2, transport_->number_of_rtp_packets());
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/vp8_encoder.cc b/src/cobalt/media/cast/sender/vp8_encoder.cc
deleted file mode 100644
index 73f2cd1..0000000
--- a/src/cobalt/media/cast/sender/vp8_encoder.cc
+++ /dev/null
@@ -1,416 +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.
-
-#include "media/cast/sender/vp8_encoder.h"
-
-#include <algorithm>
-#include <string>
-
-#include "base/debug/crash_logging.h"
-#include "base/debug/dump_without_crashing.h"
-#include "base/format_macros.h"
-#include "base/logging.h"
-#include "base/strings/stringprintf.h"
-#include "media/base/video_frame.h"
-#include "media/cast/constants.h"
-#include "third_party/libvpx/source/libvpx/vpx/vp8cx.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-// After a pause in the video stream, what is the maximum duration amount to
-// pass to the encoder for the next frame (in terms of 1/max_fps sized periods)?
-// This essentially controls the encoded size of the first frame that follows a
-// pause in the video stream.
-const int kRestartFramePeriods = 3;
-
-// The following constants are used to automactically tune the encoder
-// parameters: |cpu_used| and |min_quantizer|.
-
-// The |half-life| of the encoding speed accumulator.
-// The smaller, the shorter of the time averaging window.
-const int kEncodingSpeedAccHalfLife = 120000;  // 0.12 second.
-
-// The target encoder utilization signal. This is a trade-off between quality
-// and less CPU usage. The range of this value is [0, 1]. Higher the value,
-// better the quality and higher the CPU usage.
-//
-// For machines with more than two encoding threads.
-const double kHiTargetEncoderUtilization = 0.7;
-// For machines with two encoding threads.
-const double kMidTargetEncoderUtilization = 0.6;
-// For machines with single encoding thread.
-const double kLoTargetEncoderUtilization = 0.5;
-
-// This is the equivalent change on encoding speed for the change on each
-// quantizer step.
-const double kEquivalentEncodingSpeedStepPerQpStep = 1 / 20.0;
-
-// Highest/lowest allowed encoding speed set to the encoder. The valid range
-// is [4, 16]. Experiments show that with speed higher than 12, the saving of
-// the encoding time is not worth the dropping of the quality. And with speed
-// lower than 6, the increasing of quality is not worth the increasing of
-// encoding time.
-const int kHighestEncodingSpeed = 12;
-const int kLowestEncodingSpeed = 6;
-
-bool HasSufficientFeedback(
-    const FeedbackSignalAccumulator<base::TimeDelta>& accumulator) {
-  const base::TimeDelta amount_of_history =
-      accumulator.update_time() - accumulator.reset_time();
-  return amount_of_history.InMicroseconds() >= 250000;  // 0.25 second.
-}
-
-}  // namespace
-
-Vp8Encoder::Vp8Encoder(const FrameSenderConfig& video_config)
-    : cast_config_(video_config),
-      target_encoder_utilization_(
-          video_config.video_codec_params.number_of_encode_threads > 2
-              ? kHiTargetEncoderUtilization
-              : (video_config.video_codec_params.number_of_encode_threads > 1
-                     ? kMidTargetEncoderUtilization
-                     : kLoTargetEncoderUtilization)),
-      key_frame_requested_(true),
-      bitrate_kbit_(cast_config_.start_bitrate / 1000),
-      next_frame_id_(FrameId::first()),
-      has_seen_zero_length_encoded_frame_(false),
-      encoding_speed_acc_(
-          base::TimeDelta::FromMicroseconds(kEncodingSpeedAccHalfLife)),
-      encoding_speed_(kHighestEncodingSpeed) {
-  config_.g_timebase.den = 0;  // Not initialized.
-  DCHECK_LE(cast_config_.video_codec_params.min_qp,
-            cast_config_.video_codec_params.max_cpu_saver_qp);
-  DCHECK_LE(cast_config_.video_codec_params.max_cpu_saver_qp,
-            cast_config_.video_codec_params.max_qp);
-
-  thread_checker_.DetachFromThread();
-}
-
-Vp8Encoder::~Vp8Encoder() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (is_initialized()) vpx_codec_destroy(&encoder_);
-}
-
-void Vp8Encoder::Initialize() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  DCHECK(!is_initialized());
-  // The encoder will be created/configured when the first frame encode is
-  // requested.
-}
-
-void Vp8Encoder::ConfigureForNewFrameSize(const gfx::Size& frame_size) {
-  if (is_initialized()) {
-    // Workaround for VP8 bug: If the new size is strictly less-than-or-equal to
-    // the old size, in terms of area, the existing encoder instance can
-    // continue.  Otherwise, completely tear-down and re-create a new encoder to
-    // avoid a shutdown crash.
-    if (frame_size.GetArea() <= gfx::Size(config_.g_w, config_.g_h).GetArea()) {
-      DVLOG(1) << "Continuing to use existing encoder at smaller frame size: "
-               << gfx::Size(config_.g_w, config_.g_h).ToString() << " --> "
-               << frame_size.ToString();
-      config_.g_w = frame_size.width();
-      config_.g_h = frame_size.height();
-      config_.rc_min_quantizer = cast_config_.video_codec_params.min_qp;
-      if (vpx_codec_enc_config_set(&encoder_, &config_) == VPX_CODEC_OK) return;
-      DVLOG(1) << "libvpx rejected the attempt to use a smaller frame size in "
-                  "the current instance.";
-    }
-
-    DVLOG(1) << "Destroying/Re-Creating encoder for larger frame size: "
-             << gfx::Size(config_.g_w, config_.g_h).ToString() << " --> "
-             << frame_size.ToString();
-    vpx_codec_destroy(&encoder_);
-  } else {
-    DVLOG(1) << "Creating encoder for the first frame; size: "
-             << frame_size.ToString();
-  }
-
-  // Populate encoder configuration with default values.
-  CHECK_EQ(vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &config_, 0),
-           VPX_CODEC_OK);
-
-  config_.g_threads = cast_config_.video_codec_params.number_of_encode_threads;
-  config_.g_w = frame_size.width();
-  config_.g_h = frame_size.height();
-  // Set the timebase to match that of base::TimeDelta.
-  config_.g_timebase.num = 1;
-  config_.g_timebase.den = base::Time::kMicrosecondsPerSecond;
-
-  // |g_pass| and |g_lag_in_frames| must be "one pass" and zero, respectively,
-  // in order for VP8 to support changing frame sizes during encoding:
-  config_.g_pass = VPX_RC_ONE_PASS;
-  config_.g_lag_in_frames = 0;  // Immediate data output for each frame.
-
-  // Rate control settings.
-  config_.rc_dropframe_thresh = 0;  // The encoder may not drop any frames.
-  config_.rc_resize_allowed = 0;    // TODO(miu): Why not?  Investigate this.
-  config_.rc_end_usage = VPX_CBR;
-  config_.rc_target_bitrate = bitrate_kbit_;
-  config_.rc_min_quantizer = cast_config_.video_codec_params.min_qp;
-  config_.rc_max_quantizer = cast_config_.video_codec_params.max_qp;
-  // TODO(miu): Revisit these now that the encoder is being successfully
-  // micro-managed.
-  config_.rc_undershoot_pct = 100;
-  config_.rc_overshoot_pct = 15;
-  // TODO(miu): Document why these rc_buf_*_sz values were chosen and/or
-  // research for better values.  Should they be computed from the target
-  // playout delay?
-  config_.rc_buf_initial_sz = 500;
-  config_.rc_buf_optimal_sz = 600;
-  config_.rc_buf_sz = 1000;
-
-  config_.kf_mode = VPX_KF_DISABLED;
-
-  vpx_codec_flags_t flags = 0;
-  CHECK_EQ(vpx_codec_enc_init(&encoder_, vpx_codec_vp8_cx(), &config_, flags),
-           VPX_CODEC_OK);
-
-  // Raise the threshold for considering macroblocks as static.  The default is
-  // zero, so this setting makes the encoder less sensitive to motion.  This
-  // lowers the probability of needing to utilize more CPU to search for motion
-  // vectors.
-  CHECK_EQ(vpx_codec_control(&encoder_, VP8E_SET_STATIC_THRESHOLD, 1),
-           VPX_CODEC_OK);
-
-  // This cpu_used setting is a trade-off between cpu usage and encoded video
-  // quality. The default is zero, with increasingly less CPU to be used as the
-  // value is more negative or more positive. The encoder does some automatic
-  // adjust on encoding speed for positive values, however at least at this
-  // stage the experiments show that this automatic behaviour is not reliable on
-  // windows machines. We choose to set negative values instead to directly set
-  // the encoding speed to the encoder. Starting with the highest encoding speed
-  // to avoid large cpu usage from the beginning.
-  encoding_speed_ = kHighestEncodingSpeed;
-  CHECK_EQ(vpx_codec_control(&encoder_, VP8E_SET_CPUUSED, -encoding_speed_),
-           VPX_CODEC_OK);
-}
-
-void Vp8Encoder::Encode(const scoped_refptr<media::VideoFrame>& video_frame,
-                        const base::TimeTicks& reference_time,
-                        SenderEncodedFrame* encoded_frame) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  DCHECK(encoded_frame);
-
-  // Note: This is used to compute the |encoder_utilization| and so it uses the
-  // real-world clock instead of the CastEnvironment clock, the latter of which
-  // might be simulated.
-  const base::TimeTicks start_time = base::TimeTicks::Now();
-
-  // Initialize on-demand.  Later, if the video frame size has changed, update
-  // the encoder configuration.
-  const gfx::Size frame_size = video_frame->visible_rect().size();
-  if (!is_initialized() || gfx::Size(config_.g_w, config_.g_h) != frame_size)
-    ConfigureForNewFrameSize(frame_size);
-
-  // Wrapper for vpx_codec_encode() to access the YUV data in the |video_frame|.
-  // Only the VISIBLE rectangle within |video_frame| is exposed to the codec.
-  vpx_image_t vpx_image;
-  vpx_image_t* const result = vpx_img_wrap(
-      &vpx_image, VPX_IMG_FMT_I420, frame_size.width(), frame_size.height(), 1,
-      video_frame->data(VideoFrame::kYPlane));
-  DCHECK_EQ(result, &vpx_image);
-  vpx_image.planes[VPX_PLANE_Y] =
-      video_frame->visible_data(VideoFrame::kYPlane);
-  vpx_image.planes[VPX_PLANE_U] =
-      video_frame->visible_data(VideoFrame::kUPlane);
-  vpx_image.planes[VPX_PLANE_V] =
-      video_frame->visible_data(VideoFrame::kVPlane);
-  vpx_image.stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane);
-  vpx_image.stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane);
-  vpx_image.stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane);
-
-  // The frame duration given to the VP8 codec affects a number of important
-  // behaviors, including: per-frame bandwidth, CPU time spent encoding,
-  // temporal quality trade-offs, and key/golden/alt-ref frame generation
-  // intervals.  Bound the prediction to account for the fact that the frame
-  // rate can be highly variable, including long pauses in the video stream.
-  const base::TimeDelta minimum_frame_duration =
-      base::TimeDelta::FromSecondsD(1.0 / cast_config_.max_frame_rate);
-  const base::TimeDelta maximum_frame_duration = base::TimeDelta::FromSecondsD(
-      static_cast<double>(kRestartFramePeriods) / cast_config_.max_frame_rate);
-  base::TimeDelta predicted_frame_duration;
-  if (!video_frame->metadata()->GetTimeDelta(
-          media::VideoFrameMetadata::FRAME_DURATION,
-          &predicted_frame_duration) ||
-      predicted_frame_duration <= base::TimeDelta()) {
-    // The source of the video frame did not provide the frame duration.  Use
-    // the actual amount of time between the current and previous frame as a
-    // prediction for the next frame's duration.
-    predicted_frame_duration = video_frame->timestamp() - last_frame_timestamp_;
-  }
-  predicted_frame_duration =
-      std::max(minimum_frame_duration,
-               std::min(maximum_frame_duration, predicted_frame_duration));
-  last_frame_timestamp_ = video_frame->timestamp();
-
-  // Encode the frame.  The presentation time stamp argument here is fixed to
-  // zero to force the encoder to base its single-frame bandwidth calculations
-  // entirely on |predicted_frame_duration| and the target bitrate setting being
-  // micro-managed via calls to UpdateRates().
-  CHECK_EQ(vpx_codec_encode(&encoder_, &vpx_image, 0,
-                            predicted_frame_duration.InMicroseconds(),
-                            key_frame_requested_ ? VPX_EFLAG_FORCE_KF : 0,
-                            VPX_DL_REALTIME),
-           VPX_CODEC_OK)
-      << "BUG: Invalid arguments passed to vpx_codec_encode().";
-
-  // Pull data from the encoder, populating a new EncodedFrame.
-  encoded_frame->frame_id = next_frame_id_++;
-  const vpx_codec_cx_pkt_t* pkt = NULL;
-  vpx_codec_iter_t iter = NULL;
-  while ((pkt = vpx_codec_get_cx_data(&encoder_, &iter)) != NULL) {
-    if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) continue;
-    if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
-      // TODO(hubbe): Replace "dependency" with a "bool is_key_frame".
-      encoded_frame->dependency = EncodedFrame::KEY;
-      encoded_frame->referenced_frame_id = encoded_frame->frame_id;
-    } else {
-      encoded_frame->dependency = EncodedFrame::DEPENDENT;
-      // Frame dependencies could theoretically be relaxed by looking for the
-      // VPX_FRAME_IS_DROPPABLE flag, but in recent testing (Oct 2014), this
-      // flag never seems to be set.
-      encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
-    }
-    encoded_frame->rtp_timestamp =
-        RtpTimeTicks::FromTimeDelta(video_frame->timestamp(), kVideoFrequency);
-    encoded_frame->reference_time = reference_time;
-    encoded_frame->data.assign(
-        static_cast<const uint8_t*>(pkt->data.frame.buf),
-        static_cast<const uint8_t*>(pkt->data.frame.buf) + pkt->data.frame.sz);
-    break;  // Done, since all data is provided in one CX_FRAME_PKT packet.
-  }
-  DCHECK(!encoded_frame->data.empty())
-      << "BUG: Encoder must provide data since lagged encoding is disabled.";
-
-  // TODO(miu): Determine when/why encoding can produce zero-length data,
-  // which causes crypto crashes.  http://crbug.com/519022
-  if (!has_seen_zero_length_encoded_frame_ && encoded_frame->data.empty()) {
-    has_seen_zero_length_encoded_frame_ = true;
-
-    const char kZeroEncodeDetails[] = "zero-encode-details";
-    const std::string details = base::StringPrintf(
-        "SV/%c,id=%" PRIu32 ",rtp=%" PRIu32 ",br=%d,kfr=%c",
-        encoded_frame->dependency == EncodedFrame::KEY ? 'K' : 'D',
-        encoded_frame->frame_id.lower_32_bits(),
-        encoded_frame->rtp_timestamp.lower_32_bits(),
-        static_cast<int>(config_.rc_target_bitrate),
-        key_frame_requested_ ? 'Y' : 'N');
-    base::debug::SetCrashKeyValue(kZeroEncodeDetails, details);
-    // Please forward crash reports to http://crbug.com/519022:
-    base::debug::DumpWithoutCrashing();
-    base::debug::ClearCrashKey(kZeroEncodeDetails);
-  }
-
-  // Compute encoder utilization as the real-world time elapsed divided by the
-  // frame duration.
-  const base::TimeDelta processing_time = base::TimeTicks::Now() - start_time;
-  encoded_frame->encoder_utilization =
-      processing_time.InSecondsF() / predicted_frame_duration.InSecondsF();
-
-  // Compute lossy utilization.  The VP8 encoder took an estimated guess at what
-  // quantizer value would produce an encoded frame size as close to the target
-  // as possible.  Now that the frame has been encoded and the number of bytes
-  // is known, the perfect quantizer value (i.e., the one that should have been
-  // used) can be determined.  This perfect quantizer is then normalized and
-  // used as the lossy utilization.
-  const double actual_bitrate =
-      encoded_frame->data.size() * 8.0 / predicted_frame_duration.InSecondsF();
-  const double target_bitrate = 1000.0 * config_.rc_target_bitrate;
-  DCHECK_GT(target_bitrate, 0.0);
-  const double bitrate_utilization = actual_bitrate / target_bitrate;
-  int quantizer = -1;
-  CHECK_EQ(vpx_codec_control(&encoder_, VP8E_GET_LAST_QUANTIZER_64, &quantizer),
-           VPX_CODEC_OK);
-  const double perfect_quantizer = bitrate_utilization * std::max(0, quantizer);
-  // Side note: If it was possible for the encoder to encode within the target
-  // number of bytes, the |perfect_quantizer| will be in the range [0.0,63.0].
-  // If it was never possible, the value will be greater than 63.0.
-  encoded_frame->lossy_utilization = perfect_quantizer / 63.0;
-
-  DVLOG(2) << "VP8 encoded frame_id " << encoded_frame->frame_id
-           << ", sized: " << encoded_frame->data.size()
-           << ", encoder_utilization: " << encoded_frame->encoder_utilization
-           << ", lossy_utilization: " << encoded_frame->lossy_utilization
-           << " (quantizer chosen by the encoder was " << quantizer << ')';
-
-  if (encoded_frame->dependency == EncodedFrame::KEY) {
-    key_frame_requested_ = false;
-  }
-  if (encoded_frame->dependency == EncodedFrame::KEY) {
-    encoding_speed_acc_.Reset(kHighestEncodingSpeed, video_frame->timestamp());
-  } else {
-    // Equivalent encoding speed considering both cpu_used setting and
-    // quantizer.
-    double actual_encoding_speed =
-        encoding_speed_ +
-        kEquivalentEncodingSpeedStepPerQpStep *
-            std::max(0, quantizer - cast_config_.video_codec_params.min_qp);
-    double adjusted_encoding_speed = actual_encoding_speed *
-                                     encoded_frame->encoder_utilization /
-                                     target_encoder_utilization_;
-    encoding_speed_acc_.Update(adjusted_encoding_speed,
-                               video_frame->timestamp());
-  }
-
-  if (HasSufficientFeedback(encoding_speed_acc_)) {
-    // Predict |encoding_speed_| and |min_quantizer| for next frame.
-    // When CPU is constrained, increase encoding speed and increase
-    // |min_quantizer| if needed.
-    double next_encoding_speed = encoding_speed_acc_.current();
-    int next_min_qp;
-    if (next_encoding_speed > kHighestEncodingSpeed) {
-      double remainder = next_encoding_speed - kHighestEncodingSpeed;
-      next_encoding_speed = kHighestEncodingSpeed;
-      next_min_qp =
-          static_cast<int>(remainder / kEquivalentEncodingSpeedStepPerQpStep +
-                           cast_config_.video_codec_params.min_qp + 0.5);
-      next_min_qp = std::min(next_min_qp,
-                             cast_config_.video_codec_params.max_cpu_saver_qp);
-    } else {
-      next_encoding_speed =
-          std::max<double>(kLowestEncodingSpeed, next_encoding_speed) + 0.5;
-      next_min_qp = cast_config_.video_codec_params.min_qp;
-    }
-    if (encoding_speed_ != static_cast<int>(next_encoding_speed)) {
-      encoding_speed_ = static_cast<int>(next_encoding_speed);
-      CHECK_EQ(vpx_codec_control(&encoder_, VP8E_SET_CPUUSED, -encoding_speed_),
-               VPX_CODEC_OK);
-    }
-    if (config_.rc_min_quantizer != static_cast<unsigned int>(next_min_qp)) {
-      config_.rc_min_quantizer = static_cast<unsigned int>(next_min_qp);
-      CHECK_EQ(vpx_codec_enc_config_set(&encoder_, &config_), VPX_CODEC_OK);
-    }
-  }
-}
-
-void Vp8Encoder::UpdateRates(uint32_t new_bitrate) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  if (!is_initialized()) return;
-
-  uint32_t new_bitrate_kbit = new_bitrate / 1000;
-  if (config_.rc_target_bitrate == new_bitrate_kbit) return;
-
-  config_.rc_target_bitrate = bitrate_kbit_ = new_bitrate_kbit;
-
-  // Update encoder context.
-  if (vpx_codec_enc_config_set(&encoder_, &config_)) {
-    NOTREACHED() << "Invalid return value";
-  }
-
-  VLOG(1) << "VP8 new rc_target_bitrate: " << new_bitrate_kbit << " kbps";
-}
-
-void Vp8Encoder::GenerateKeyFrame() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  key_frame_requested_ = true;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/sender/vp8_encoder.h b/src/cobalt/media/cast/sender/vp8_encoder.h
deleted file mode 100644
index 0beda7e..0000000
--- a/src/cobalt/media/cast/sender/vp8_encoder.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_VP8_ENCODER_H_
-#define COBALT_MEDIA_CAST_SENDER_VP8_ENCODER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/threading/thread_checker.h"
-#include "media/base/feedback_signal_accumulator.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/sender/software_video_encoder.h"
-#include "starboard/types.h"
-#include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-}
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-class Vp8Encoder : public SoftwareVideoEncoder {
- public:
-  explicit Vp8Encoder(const FrameSenderConfig& video_config);
-
-  ~Vp8Encoder() final;
-
-  // SoftwareVideoEncoder implementations.
-  void Initialize() final;
-  void Encode(const scoped_refptr<media::VideoFrame>& video_frame,
-              const base::TimeTicks& reference_time,
-              SenderEncodedFrame* encoded_frame) final;
-  void UpdateRates(uint32_t new_bitrate) final;
-  void GenerateKeyFrame() final;
-
- private:
-  bool is_initialized() const {
-    // ConfigureForNewFrameSize() sets the timebase denominator value to
-    // non-zero if the encoder is successfully initialized, and it is zero
-    // otherwise.
-    return config_.g_timebase.den != 0;
-  }
-
-  // If the |encoder_| is live, attempt reconfiguration to allow it to encode
-  // frames at a new |frame_size|.  Otherwise, tear it down and re-create a new
-  // |encoder_| instance.
-  void ConfigureForNewFrameSize(const gfx::Size& frame_size);
-
-  const FrameSenderConfig cast_config_;
-
-  const double target_encoder_utilization_;
-
-  // VP8 internal objects.  These are valid for use only while is_initialized()
-  // returns true.
-  vpx_codec_enc_cfg_t config_;
-  vpx_codec_ctx_t encoder_;
-
-  // Set to true to request the next frame emitted by Vp8Encoder be a key frame.
-  bool key_frame_requested_;
-
-  // Saves the current bitrate setting, for when the |encoder_| is reconfigured
-  // for different frame sizes.
-  int bitrate_kbit_;
-
-  // The |VideoFrame::timestamp()| of the last encoded frame.  This is used to
-  // predict the duration of the next frame.
-  base::TimeDelta last_frame_timestamp_;
-
-  // The ID for the next frame to be emitted.
-  FrameId next_frame_id_;
-
-  // This is bound to the thread where Initialize() is called.
-  base::ThreadChecker thread_checker_;
-
-  // Set to true once a frame with zero-length encoded data has been
-  // encountered.
-  // TODO(miu): Remove after discovering cause.  http://crbug.com/519022
-  bool has_seen_zero_length_encoded_frame_;
-
-  // The accumulator (time averaging) of the encoding speed.
-  FeedbackSignalAccumulator<base::TimeDelta> encoding_speed_acc_;
-
-  // The higher the speed, the less CPU usage, and the lower quality.
-  int encoding_speed_;
-
-  DISALLOW_COPY_AND_ASSIGN(Vp8Encoder);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_VP8_ENCODER_H_
diff --git a/src/cobalt/media/cast/sender/vp8_quantizer_parser.cc b/src/cobalt/media/cast/sender/vp8_quantizer_parser.cc
deleted file mode 100644
index a48ac40..0000000
--- a/src/cobalt/media/cast/sender/vp8_quantizer_parser.cc
+++ /dev/null
@@ -1,211 +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/logging.h"
-#include "base/macros.h"
-#include "media/cast/sender/vp8_quantizer_parser.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-// Vp8BitReader is a re-implementation of a subset of the VP8 entropy decoder.
-// It is used to decompress the VP8 bitstream for the purposes of quickly
-// parsing the VP8 frame headers.  It is mostly the exact same implementation
-// found in third_party/libvpx/.../vp8/decoder/dboolhuff.h except that only
-// the portion of the implementation needed to parse the frame headers is
-// present. As of this writing, the implementation in libvpx could not be
-// re-used because of the way that the code is structured, and lack of the
-// necessary parts being exported.
-class Vp8BitReader {
- public:
-  Vp8BitReader(const uint8_t* data, size_t size)
-      : encoded_data_(data), encoded_data_end_(data + size) {
-    Vp8DecoderReadBytes();
-  }
-  ~Vp8BitReader() {}
-
-  // Decode one bit. The output is 0 or 1.
-  unsigned int DecodeBit();
-  // Decode a value with |num_bits|. The decoding order is MSB first.
-  unsigned int DecodeValue(unsigned int num_bits);
-
- private:
-  // Read new bytes frome the encoded data buffer until |bit_count_| > 0.
-  void Vp8DecoderReadBytes();
-
-  const uint8_t* encoded_data_;            // Current byte to decode.
-  const uint8_t* const encoded_data_end_;  // The end of the byte to decode.
-  // The following two variables are maintained by the decoder.
-  // General decoding rule:
-  // If |value_| is in the range of 0 to half of |range_|, output 0.
-  // Otherwise output 1.
-  // |range_| and |value_| need to be shifted when necessary to avoid underflow.
-  unsigned int range_ = 255;
-  unsigned int value_ = 0;
-  // Number of valid bits left to decode. Initializing it to -8 to let the
-  // decoder load two bytes at the beginning. The lower byte is used as
-  // a buffer byte. During the decoding, decoder needs to call
-  // Vp8DecoderReadBytes() to load new bytes when it becomes negative.
-  int bit_count_ = -8;
-
-  DISALLOW_COPY_AND_ASSIGN(Vp8BitReader);
-};
-
-// The number of bits to be left-shifted to make the variable range_ over 128.
-const uint8_t vp8_shift[128] = {
-    0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-
-// Mapping from the q_index(0-127) to the quantizer value(0-63).
-const uint8_t vp8_quantizer_lookup[128] = {
-    0,  1,  2,  3,  4,  5,  6,  6,  7,  8,  9,  10, 10, 11, 12, 12, 13, 13, 14,
-    15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 27, 28, 28, 29, 29,
-    30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39,
-    39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46,
-    46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52,
-    53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59,
-    59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63};
-
-void Vp8BitReader::Vp8DecoderReadBytes() {
-  int shift = -bit_count_;
-  while ((shift >= 0) && (encoded_data_ < encoded_data_end_)) {
-    bit_count_ += 8;
-    value_ |= static_cast<unsigned int>(*encoded_data_) << shift;
-    ++encoded_data_;
-    shift -= 8;
-  }
-}
-
-unsigned int Vp8BitReader::DecodeBit() {
-  unsigned int decoded_bit = 0;
-  unsigned int split = 1 + (((range_ - 1) * 128) >> 8);
-  if (bit_count_ < 0) {
-    Vp8DecoderReadBytes();
-  }
-  DCHECK_GE(bit_count_, 0);
-  unsigned int shifted_split = split << 8;
-  if (value_ >= shifted_split) {
-    range_ -= split;
-    value_ -= shifted_split;
-    decoded_bit = 1;
-  } else {
-    range_ = split;
-  }
-  if (range_ < 128) {
-    int shift = vp8_shift[range_];
-    range_ <<= shift;
-    value_ <<= shift;
-    bit_count_ -= shift;
-  }
-  return decoded_bit;
-}
-
-unsigned int Vp8BitReader::DecodeValue(unsigned int num_bits) {
-  unsigned int decoded_value = 0;
-  for (int i = static_cast<int>(num_bits) - 1; i >= 0; i--) {
-    decoded_value |= (DecodeBit() << i);
-  }
-  return decoded_value;
-}
-
-// Parse the Segment Header part in the first partition.
-void ParseSegmentHeader(Vp8BitReader* bit_reader) {
-  const bool segmentation_enabled = (bit_reader->DecodeBit() != 0);
-  DVLOG(2) << "segmentation_enabled:" << segmentation_enabled;
-  if (segmentation_enabled) {
-    const bool update_mb_segmentation_map = (bit_reader->DecodeBit() != 0);
-    const bool update_mb_segmentation_data = (bit_reader->DecodeBit() != 0);
-    DVLOG(2) << "update_mb_segmentation_data:" << update_mb_segmentation_data;
-    if (update_mb_segmentation_data) {
-      bit_reader->DecodeBit();
-      for (int i = 0; i < 4; ++i) {
-        if (bit_reader->DecodeBit()) {
-          bit_reader->DecodeValue(7 + 1);  // Parse 7 bits value + 1 sign bit.
-        }
-      }
-      for (int i = 0; i < 4; ++i) {
-        if (bit_reader->DecodeBit()) {
-          bit_reader->DecodeValue(6 + 1);  // Parse 6 bits value + 1 sign bit.
-        }
-      }
-    }
-
-    if (update_mb_segmentation_map) {
-      for (int i = 0; i < 3; ++i) {
-        if (bit_reader->DecodeBit()) {
-          bit_reader->DecodeValue(8);
-        }
-      }
-    }
-  }
-}
-
-// Parse the Filter Header in the first partition.
-void ParseFilterHeader(Vp8BitReader* bit_reader) {
-  // Parse 1 bit filter_type + 6 bits loop_filter_level + 3 bits
-  // sharpness_level.
-  bit_reader->DecodeValue(1 + 6 + 3);
-  if (bit_reader->DecodeBit()) {
-    if (bit_reader->DecodeBit()) {
-      for (int i = 0; i < 4; ++i) {
-        if (bit_reader->DecodeBit()) {
-          bit_reader->DecodeValue(6 + 1);  // Parse 6 bits value + 1 sign bit.
-        }
-      }
-      for (int i = 0; i < 4; ++i) {
-        if (bit_reader->DecodeBit()) {
-          bit_reader->DecodeValue(6 + 1);  // Parse 6 bits value + 1 sign bit.
-        }
-      }
-    }
-  }
-}
-}  // unnamed namespace
-
-int ParseVp8HeaderQuantizer(const uint8_t* encoded_data, size_t size) {
-  DCHECK(encoded_data);
-  if (size <= 3) {
-    return -1;
-  }
-  const bool is_key = !(encoded_data[0] & 1);
-  const unsigned int header_3bytes =
-      encoded_data[0] | (encoded_data[1] << 8) | (encoded_data[2] << 16);
-  // Parse the size of the first partition.
-  unsigned int partition_size = (header_3bytes >> 5);
-  encoded_data += 3;  // Skip 3 bytes.
-  size -= 3;
-  if (is_key) {
-    if (size <= 7) {
-      return -1;
-    }
-    encoded_data += 7;  // Skip 7 bytes.
-    size -= 7;
-  }
-  if (size < partition_size) {
-    return -1;
-  }
-  Vp8BitReader bit_reader(encoded_data, partition_size);
-  if (is_key) {
-    bit_reader.DecodeValue(1 + 1);  // Parse two bits: color_space + clamp_type.
-  }
-  ParseSegmentHeader(&bit_reader);
-  ParseFilterHeader(&bit_reader);
-  // Parse the number of coefficient data partitions.
-  bit_reader.DecodeValue(2);
-  // Parse the base q_index.
-  uint8_t q_index = static_cast<uint8_t>(bit_reader.DecodeValue(7));
-  if (q_index > 127) {
-    return 63;
-  }
-  return vp8_quantizer_lookup[q_index];
-}
-
-}  //  namespace cast
-}  //  namespace media
diff --git a/src/cobalt/media/cast/sender/vp8_quantizer_parser.h b/src/cobalt/media/cast/sender/vp8_quantizer_parser.h
deleted file mode 100644
index 9951785..0000000
--- a/src/cobalt/media/cast/sender/vp8_quantizer_parser.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_SENDER_VP8_QUANTIZER_PARSER_H_
-#define COBALT_MEDIA_CAST_SENDER_VP8_QUANTIZER_PARSER_H_
-
-#include "media/cast/cast_config.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Partially parse / skip data in the header and the first partition,
-// and return the base quantizer in the range [0,63], or -1 on parse error.
-int ParseVp8HeaderQuantizer(const uint8_t* data, size_t size);
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_SENDER_VP8_QUANTIZER_PARSER_H_
diff --git a/src/cobalt/media/cast/sender/vp8_quantizer_parser_unittest.cc b/src/cobalt/media/cast/sender/vp8_quantizer_parser_unittest.cc
deleted file mode 100644
index 85b6254..0000000
--- a/src/cobalt/media/cast/sender/vp8_quantizer_parser_unittest.cc
+++ /dev/null
@@ -1,154 +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 <cstdlib>
-
-#include "base/macros.h"
-#include "base/time/time.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/receiver/video_decoder.h"
-#include "media/cast/sender/sender_encoded_frame.h"
-#include "media/cast/sender/vp8_encoder.h"
-#include "media/cast/sender/vp8_quantizer_parser.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-const int kWidth = 32;
-const int kHeight = 32;
-const int kFrameRate = 10;
-const int kQp = 20;
-
-FrameSenderConfig GetVideoConfigForTest() {
-  FrameSenderConfig config = GetDefaultVideoSenderConfig();
-  config.codec = CODEC_VIDEO_VP8;
-  config.use_external_encoder = false;
-  config.max_frame_rate = kFrameRate;
-  config.video_codec_params.min_qp = kQp;
-  config.video_codec_params.max_qp = kQp;
-  config.video_codec_params.max_cpu_saver_qp = kQp;
-  return config;
-}
-}  // unnamed namespace
-
-class Vp8QuantizerParserTest : public ::testing::Test {
- public:
-  Vp8QuantizerParserTest() : video_config_(GetVideoConfigForTest()) {}
-
-  // Call vp8 software encoder to encode one randomly generated frame.
-  void EncodeOneFrame(SenderEncodedFrame* encoded_frame) {
-    const gfx::Size frame_size = gfx::Size(kWidth, kHeight);
-    const scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateFrame(
-        PIXEL_FORMAT_YV12, frame_size, gfx::Rect(frame_size), frame_size,
-        next_frame_timestamp_);
-    const base::TimeTicks reference_time =
-        base::TimeTicks::UnixEpoch() + next_frame_timestamp_;
-    next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate;
-    PopulateVideoFrameWithNoise(video_frame.get());
-    vp8_encoder_->Encode(video_frame, reference_time, encoded_frame);
-  }
-
-  // Update the vp8 encoder with the new quantizer.
-  void UpdateQuantizer(int qp) {
-    DCHECK((qp > 3) && (qp < 64));
-    video_config_.video_codec_params.min_qp = qp;
-    video_config_.video_codec_params.max_qp = qp;
-    video_config_.video_codec_params.max_cpu_saver_qp = qp;
-    RecreateVp8Encoder();
-  }
-
- protected:
-  void SetUp() final {
-    next_frame_timestamp_ = base::TimeDelta();
-    RecreateVp8Encoder();
-  }
-
- private:
-  // Reconstruct a vp8 encoder with new config since the Vp8Encoder
-  // class has no interface to update the config.
-  void RecreateVp8Encoder() {
-    vp8_encoder_.reset(new Vp8Encoder(video_config_));
-    vp8_encoder_->Initialize();
-  }
-
-  base::TimeDelta next_frame_timestamp_;
-  FrameSenderConfig video_config_;
-  std::unique_ptr<Vp8Encoder> vp8_encoder_;
-
-  DISALLOW_COPY_AND_ASSIGN(Vp8QuantizerParserTest);
-};
-
-// Encode 3 frames to test the cases with insufficient data input.
-TEST_F(Vp8QuantizerParserTest, InsufficientData) {
-  for (int i = 0; i < 3; ++i) {
-    std::unique_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame());
-    const uint8_t* encoded_data =
-        reinterpret_cast<const uint8_t*>(encoded_frame->data.data());
-    // Null input.
-    int decoded_quantizer =
-        ParseVp8HeaderQuantizer(encoded_data, encoded_frame->data.size());
-    EXPECT_EQ(-1, decoded_quantizer);
-    EncodeOneFrame(encoded_frame.get());
-    encoded_data = reinterpret_cast<const uint8_t*>(encoded_frame->data.data());
-    // Zero bytes should not be enough to decode the quantizer value.
-    decoded_quantizer = ParseVp8HeaderQuantizer(encoded_data, 0);
-    EXPECT_EQ(-1, decoded_quantizer);
-    // Three bytes should not be enough to decode the quantizer value..
-    decoded_quantizer = ParseVp8HeaderQuantizer(encoded_data, 3);
-    EXPECT_EQ(-1, decoded_quantizer);
-    unsigned int first_partition_size =
-        (encoded_data[0] | (encoded_data[1] << 8) | (encoded_data[2] << 16)) >>
-        5;
-    if (encoded_frame->dependency == EncodedFrame::KEY) {
-      // Ten bytes should not be enough to decode the quanitizer value
-      // for a Key frame.
-      decoded_quantizer = ParseVp8HeaderQuantizer(encoded_data, 10);
-      EXPECT_EQ(-1, decoded_quantizer);
-      // One byte less than needed to decode the quantizer value.
-      decoded_quantizer =
-          ParseVp8HeaderQuantizer(encoded_data, 10 + first_partition_size - 1);
-      EXPECT_EQ(-1, decoded_quantizer);
-      // Minimum number of bytes to decode the quantizer value.
-      decoded_quantizer =
-          ParseVp8HeaderQuantizer(encoded_data, 10 + first_partition_size);
-      EXPECT_EQ(kQp, decoded_quantizer);
-    } else {
-      // One byte less than needed to decode the quantizer value.
-      decoded_quantizer =
-          ParseVp8HeaderQuantizer(encoded_data, 3 + first_partition_size - 1);
-      EXPECT_EQ(-1, decoded_quantizer);
-      // Minimum number of bytes to decode the quantizer value.
-      decoded_quantizer =
-          ParseVp8HeaderQuantizer(encoded_data, 3 + first_partition_size);
-      EXPECT_EQ(kQp, decoded_quantizer);
-    }
-  }
-}
-
-// Encode 3 fames for every quantizer value in the range of [4,63].
-TEST_F(Vp8QuantizerParserTest, VariedQuantizer) {
-  int decoded_quantizer = -1;
-  for (int qp = 4; qp <= 63; qp += 10) {
-    UpdateQuantizer(qp);
-    for (int i = 0; i < 3; ++i) {
-      std::unique_ptr<SenderEncodedFrame> encoded_frame(
-          new SenderEncodedFrame());
-      EncodeOneFrame(encoded_frame.get());
-      decoded_quantizer = ParseVp8HeaderQuantizer(
-          reinterpret_cast<const uint8_t*>(encoded_frame->data.data()),
-          encoded_frame->data.size());
-      EXPECT_EQ(qp, decoded_quantizer);
-    }
-  }
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/cast_benchmarks.cc b/src/cobalt/media/cast/test/cast_benchmarks.cc
deleted file mode 100644
index 3d9ce56..0000000
--- a/src/cobalt/media/cast/test/cast_benchmarks.cc
+++ /dev/null
@@ -1,707 +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 program benchmarks the theoretical throughput of the cast library.
-// It runs using a fake clock, simulated network and fake codecs. This allows
-// tests to run much faster than real time.
-// To run the program, run:
-// $ ./out/Release/cast_benchmarks | tee benchmarkoutput.asc
-// This may take a while, when it is done, you can view the data with
-// meshlab by running:
-// $ meshlab benchmarkoutput.asc
-// After starting meshlab, turn on Render->Show Axis. The red axis will
-// represent bandwidth (in megabits) the blue axis will be packet drop
-// (in percent) and the green axis will be latency (in milliseconds).
-//
-// This program can also be used for profiling. On linux it has
-// built-in support for this. Simply set the environment variable
-// PROFILE_FILE before running it, like so:
-// $ export PROFILE_FILE=cast_benchmark.profile
-// Then after running the program, you can view the profile with:
-// $ pprof ./out/Release/cast_benchmarks $PROFILE_FILE --gv
-
-#include <math.h>
-
-#include <map>
-#include <utility>
-#include <vector>
-
-#include "base/at_exit.h"
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/command_line.h"
-#include "base/debug/profiler.h"
-#include "base/memory/ptr_util.h"
-#include "base/memory/weak_ptr.h"
-#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/stl_util.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/stringprintf.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/threading/thread.h"
-#include "base/time/tick_clock.h"
-#include "media/base/audio_bus.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/logging/simple_event_subscriber.h"
-#include "media/cast/net/cast_transport.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/net/cast_transport_defines.h"
-#include "media/cast/net/cast_transport_impl.h"
-#include "media/cast/test/loopback_transport.h"
-#include "media/cast/test/skewed_single_thread_task_runner.h"
-#include "media/cast/test/skewed_tick_clock.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/test_util.h"
-#include "media/cast/test/utility/udp_proxy.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-static const int64_t kStartMillisecond = INT64_C(1245);
-static const int kTargetPlayoutDelayMs = 400;
-
-void ExpectVideoSuccess(OperationalStatus status) {
-  EXPECT_EQ(STATUS_INITIALIZED, status);
-}
-
-void ExpectAudioSuccess(OperationalStatus status) {
-  EXPECT_EQ(STATUS_INITIALIZED, status);
-}
-
-}  // namespace
-
-// Wraps a CastTransport and records some statistics about
-// the data that goes through it.
-class CastTransportWrapper : public CastTransport {
- public:
-  // Takes ownership of |transport|.
-  void Init(CastTransport* transport, uint64_t* encoded_video_bytes,
-            uint64_t* encoded_audio_bytes) {
-    transport_.reset(transport);
-    encoded_video_bytes_ = encoded_video_bytes;
-    encoded_audio_bytes_ = encoded_audio_bytes;
-  }
-
-  void InitializeStream(const CastTransportRtpConfig& config,
-                        std::unique_ptr<RtcpObserver> rtcp_observer) final {
-    if (config.rtp_payload_type <= RtpPayloadType::AUDIO_LAST)
-      audio_ssrc_ = config.ssrc;
-    else
-      video_ssrc_ = config.ssrc;
-    transport_->InitializeStream(config, std::move(rtcp_observer));
-  }
-
-  void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final {
-    if (ssrc == audio_ssrc_) {
-      *encoded_audio_bytes_ += frame.data.size();
-    } else if (ssrc == video_ssrc_) {
-      *encoded_video_bytes_ += frame.data.size();
-    }
-    transport_->InsertFrame(ssrc, frame);
-  }
-
-  void SendSenderReport(uint32_t ssrc, base::TimeTicks current_time,
-                        RtpTimeTicks current_time_as_rtp_timestamp) final {
-    transport_->SendSenderReport(ssrc, current_time,
-                                 current_time_as_rtp_timestamp);
-  }
-
-  void CancelSendingFrames(uint32_t ssrc,
-                           const std::vector<FrameId>& frame_ids) final {
-    transport_->CancelSendingFrames(ssrc, frame_ids);
-  }
-
-  void ResendFrameForKickstart(uint32_t ssrc, FrameId frame_id) final {
-    transport_->ResendFrameForKickstart(ssrc, frame_id);
-  }
-
-  PacketReceiverCallback PacketReceiverForTesting() final {
-    return transport_->PacketReceiverForTesting();
-  }
-
-  void AddValidRtpReceiver(uint32_t rtp_sender_ssrc,
-                           uint32_t rtp_receiver_ssrc) final {
-    return transport_->AddValidRtpReceiver(rtp_sender_ssrc, rtp_receiver_ssrc);
-  }
-
-  void InitializeRtpReceiverRtcpBuilder(uint32_t rtp_receiver_ssrc,
-                                        const RtcpTimeData& time_data) final {
-    transport_->InitializeRtpReceiverRtcpBuilder(rtp_receiver_ssrc, time_data);
-  }
-
-  void AddCastFeedback(const RtcpCastMessage& cast_message,
-                       base::TimeDelta target_delay) final {
-    transport_->AddCastFeedback(cast_message, target_delay);
-  }
-
-  void AddRtcpEvents(
-      const ReceiverRtcpEventSubscriber::RtcpEvents& rtcp_events) final {
-    transport_->AddRtcpEvents(rtcp_events);
-  }
-
-  void AddRtpReceiverReport(const RtcpReportBlock& rtp_report_block) final {
-    transport_->AddRtpReceiverReport(rtp_report_block);
-  }
-
-  void AddPli(const RtcpPliMessage& pli_message) final {
-    transport_->AddPli(pli_message);
-  }
-
-  void SendRtcpFromRtpReceiver() final {
-    transport_->SendRtcpFromRtpReceiver();
-  }
-
-  void SetOptions(const base::DictionaryValue& options) final {}
-
- private:
-  std::unique_ptr<CastTransport> transport_;
-  uint32_t audio_ssrc_, video_ssrc_;
-  uint64_t* encoded_video_bytes_;
-  uint64_t* encoded_audio_bytes_;
-};
-
-struct MeasuringPoint {
-  MeasuringPoint(double bitrate_, double latency_, double percent_packet_drop_)
-      : bitrate(bitrate_),
-        latency(latency_),
-        percent_packet_drop(percent_packet_drop_) {}
-  bool operator<=(const MeasuringPoint& other) const {
-    return bitrate >= other.bitrate && latency <= other.latency &&
-           percent_packet_drop <= other.percent_packet_drop;
-  }
-  bool operator>=(const MeasuringPoint& other) const {
-    return bitrate <= other.bitrate && latency >= other.latency &&
-           percent_packet_drop >= other.percent_packet_drop;
-  }
-
-  std::string AsString() const {
-    return base::StringPrintf("%f Mbit/s %f ms %f %% ", bitrate, latency,
-                              percent_packet_drop);
-  }
-
-  double bitrate;
-  double latency;
-  double percent_packet_drop;
-};
-
-class RunOneBenchmark {
- public:
-  RunOneBenchmark()
-      : start_time_(),
-        task_runner_(new FakeSingleThreadTaskRunner(&testing_clock_)),
-        testing_clock_sender_(new test::SkewedTickClock(&testing_clock_)),
-        task_runner_sender_(
-            new test::SkewedSingleThreadTaskRunner(task_runner_)),
-        testing_clock_receiver_(new test::SkewedTickClock(&testing_clock_)),
-        task_runner_receiver_(
-            new test::SkewedSingleThreadTaskRunner(task_runner_)),
-        cast_environment_sender_(new CastEnvironment(
-            std::unique_ptr<base::TickClock>(testing_clock_sender_),
-            task_runner_sender_, task_runner_sender_, task_runner_sender_)),
-        cast_environment_receiver_(new CastEnvironment(
-            std::unique_ptr<base::TickClock>(testing_clock_receiver_),
-            task_runner_receiver_, task_runner_receiver_,
-            task_runner_receiver_)),
-        video_bytes_encoded_(0),
-        audio_bytes_encoded_(0),
-        frames_sent_(0) {
-    testing_clock_.Advance(
-        base::TimeDelta::FromMilliseconds(kStartMillisecond));
-  }
-
-  void Configure(Codec video_codec, Codec audio_codec) {
-    audio_sender_config_ = GetDefaultAudioSenderConfig();
-    audio_sender_config_.min_playout_delay =
-        audio_sender_config_.max_playout_delay =
-            base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs);
-    audio_sender_config_.codec = audio_codec;
-
-    audio_receiver_config_ = GetDefaultAudioReceiverConfig();
-    audio_receiver_config_.rtp_max_delay_ms =
-        audio_sender_config_.max_playout_delay.InMicroseconds();
-    audio_receiver_config_.codec = audio_codec;
-
-    video_sender_config_ = GetDefaultVideoSenderConfig();
-    video_sender_config_.min_playout_delay =
-        video_sender_config_.max_playout_delay =
-            base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs);
-    video_sender_config_.max_bitrate = 4000000;
-    video_sender_config_.min_bitrate = 4000000;
-    video_sender_config_.start_bitrate = 4000000;
-    video_sender_config_.codec = video_codec;
-
-    video_receiver_config_ = GetDefaultVideoReceiverConfig();
-    video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
-    video_receiver_config_.codec = video_codec;
-
-    DCHECK_GT(video_sender_config_.max_frame_rate, 0);
-    frame_duration_ = base::TimeDelta::FromSecondsD(
-        1.0 / video_sender_config_.max_frame_rate);
-  }
-
-  void SetSenderClockSkew(double skew, base::TimeDelta offset) {
-    testing_clock_sender_->SetSkew(skew, offset);
-    task_runner_sender_->SetSkew(1.0 / skew);
-  }
-
-  void SetReceiverClockSkew(double skew, base::TimeDelta offset) {
-    testing_clock_receiver_->SetSkew(skew, offset);
-    task_runner_receiver_->SetSkew(1.0 / skew);
-  }
-
-  void Create(const MeasuringPoint& p);
-
-  void ReceivePacket(std::unique_ptr<Packet> packet) {
-    cast_receiver_->ReceivePacket(std::move(packet));
-  }
-
-  virtual ~RunOneBenchmark() {
-    cast_sender_.reset();
-    cast_receiver_.reset();
-    task_runner_->RunTasks();
-  }
-
-  base::TimeDelta VideoTimestamp(int frame_number) {
-    return frame_number * base::TimeDelta::FromSecondsD(
-                              1.0 / video_sender_config_.max_frame_rate);
-  }
-
-  void SendFakeVideoFrame() {
-    // NB: Blackframe with timestamp
-    cast_sender_->video_frame_input()->InsertRawVideoFrame(
-        media::VideoFrame::CreateColorFrame(gfx::Size(2, 2), 0x00, 0x80, 0x80,
-                                            VideoTimestamp(frames_sent_)),
-        testing_clock_sender_->NowTicks());
-    frames_sent_++;
-  }
-
-  void RunTasks(base::TimeDelta duration) { task_runner_->Sleep(duration); }
-
-  void BasicPlayerGotVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& render_time, bool continuous) {
-    video_ticks_.push_back(
-        std::make_pair(testing_clock_receiver_->NowTicks(), render_time));
-    cast_receiver_->RequestDecodedVideoFrame(base::Bind(
-        &RunOneBenchmark::BasicPlayerGotVideoFrame, base::Unretained(this)));
-  }
-
-  void BasicPlayerGotAudioFrame(std::unique_ptr<AudioBus> audio_bus,
-                                const base::TimeTicks& playout_time,
-                                bool is_continuous) {
-    audio_ticks_.push_back(
-        std::make_pair(testing_clock_receiver_->NowTicks(), playout_time));
-    cast_receiver_->RequestDecodedAudioFrame(base::Bind(
-        &RunOneBenchmark::BasicPlayerGotAudioFrame, base::Unretained(this)));
-  }
-
-  void StartBasicPlayer() {
-    cast_receiver_->RequestDecodedVideoFrame(base::Bind(
-        &RunOneBenchmark::BasicPlayerGotVideoFrame, base::Unretained(this)));
-    cast_receiver_->RequestDecodedAudioFrame(base::Bind(
-        &RunOneBenchmark::BasicPlayerGotAudioFrame, base::Unretained(this)));
-  }
-
-  std::unique_ptr<test::PacketPipe> CreateSimplePipe(const MeasuringPoint& p) {
-    std::unique_ptr<test::PacketPipe> pipe = test::NewBuffer(65536, p.bitrate);
-    pipe->AppendToPipe(test::NewRandomDrop(p.percent_packet_drop / 100.0));
-    pipe->AppendToPipe(test::NewConstantDelay(p.latency / 1000.0));
-    return pipe;
-  }
-
-  void Run(const MeasuringPoint& p) {
-    available_bitrate_ = p.bitrate;
-    Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-    Create(p);
-    StartBasicPlayer();
-
-    for (int frame = 0; frame < 1000; frame++) {
-      SendFakeVideoFrame();
-      RunTasks(frame_duration_);
-    }
-    RunTasks(100 * frame_duration_);  // Empty the pipeline.
-    VLOG(1) << "=============INPUTS============";
-    VLOG(1) << "Bitrate: " << p.bitrate << " mbit/s";
-    VLOG(1) << "Latency: " << p.latency << " ms";
-    VLOG(1) << "Packet drop drop: " << p.percent_packet_drop << "%";
-    VLOG(1) << "=============OUTPUTS============";
-    VLOG(1) << "Frames lost: " << frames_lost();
-    VLOG(1) << "Late frames: " << late_frames();
-    VLOG(1) << "Playout margin: " << frame_playout_buffer().AsString();
-    VLOG(1) << "Video bandwidth used: " << video_bandwidth() << " mbit/s ("
-            << (video_bandwidth() * 100 / desired_video_bitrate()) << "%)";
-    VLOG(1) << "Good run: " << SimpleGood();
-  }
-
-  // Metrics
-  int frames_lost() const { return frames_sent_ - video_ticks_.size(); }
-
-  int late_frames() const {
-    int frames = 0;
-    // Ignore the first two seconds of video or so.
-    for (size_t i = 60; i < video_ticks_.size(); i++) {
-      if (video_ticks_[i].first > video_ticks_[i].second) {
-        frames++;
-      }
-    }
-    return frames;
-  }
-
-  test::MeanAndError frame_playout_buffer() const {
-    std::vector<double> values;
-    for (size_t i = 0; i < video_ticks_.size(); i++) {
-      values.push_back(
-          (video_ticks_[i].second - video_ticks_[i].first).InMillisecondsF());
-    }
-    return test::MeanAndError(values);
-  }
-
-  // Mbits per second
-  double video_bandwidth() const {
-    double seconds = (frame_duration_.InSecondsF() * frames_sent_);
-    double megabits = video_bytes_encoded_ * 8 / 1000000.0;
-    return megabits / seconds;
-  }
-
-  // Mbits per second
-  double audio_bandwidth() const {
-    double seconds = (frame_duration_.InSecondsF() * frames_sent_);
-    double megabits = audio_bytes_encoded_ * 8 / 1000000.0;
-    return megabits / seconds;
-  }
-
-  double desired_video_bitrate() {
-    return std::min<double>(available_bitrate_,
-                            video_sender_config_.max_bitrate / 1000000.0);
-  }
-
-  bool SimpleGood() {
-    return frames_lost() <= 1 && late_frames() <= 1 &&
-           video_bandwidth() > desired_video_bitrate() * 0.8 &&
-           video_bandwidth() < desired_video_bitrate() * 1.2;
-  }
-
- private:
-  FrameReceiverConfig audio_receiver_config_;
-  FrameReceiverConfig video_receiver_config_;
-  FrameSenderConfig audio_sender_config_;
-  FrameSenderConfig video_sender_config_;
-
-  base::TimeTicks start_time_;
-
-  // These run in "test time"
-  base::SimpleTestTickClock testing_clock_;
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-
-  // These run on the sender timeline.
-  test::SkewedTickClock* testing_clock_sender_;
-  scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_sender_;
-
-  // These run on the receiver timeline.
-  test::SkewedTickClock* testing_clock_receiver_;
-  scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_receiver_;
-
-  scoped_refptr<CastEnvironment> cast_environment_sender_;
-  scoped_refptr<CastEnvironment> cast_environment_receiver_;
-
-  LoopBackTransport* receiver_to_sender_;  // Owned by CastTransportImpl.
-  LoopBackTransport* sender_to_receiver_;  // Owned by CastTransportImpl.
-  CastTransportWrapper transport_sender_;
-  std::unique_ptr<CastTransport> transport_receiver_;
-  uint64_t video_bytes_encoded_;
-  uint64_t audio_bytes_encoded_;
-
-  std::unique_ptr<CastReceiver> cast_receiver_;
-  std::unique_ptr<CastSender> cast_sender_;
-
-  int frames_sent_;
-  base::TimeDelta frame_duration_;
-  double available_bitrate_;
-  std::vector<std::pair<base::TimeTicks, base::TimeTicks>> audio_ticks_;
-  std::vector<std::pair<base::TimeTicks, base::TimeTicks>> video_ticks_;
-};
-
-namespace {
-
-class TransportClient : public CastTransport::Client {
- public:
-  explicit TransportClient(RunOneBenchmark* run_one_benchmark)
-      : run_one_benchmark_(run_one_benchmark) {}
-
-  void OnStatusChanged(CastTransportStatus status) final {
-    EXPECT_EQ(TRANSPORT_STREAM_INITIALIZED, status);
-  };
-  void OnLoggingEventsReceived(
-      std::unique_ptr<std::vector<FrameEvent>> frame_events,
-      std::unique_ptr<std::vector<PacketEvent>> packet_events) final{};
-  void ProcessRtpPacket(std::unique_ptr<Packet> packet) final {
-    if (run_one_benchmark_)
-      run_one_benchmark_->ReceivePacket(std::move(packet));
-  };
-
- private:
-  RunOneBenchmark* const run_one_benchmark_;
-
-  DISALLOW_COPY_AND_ASSIGN(TransportClient);
-};
-
-}  // namespace
-
-void RunOneBenchmark::Create(const MeasuringPoint& p) {
-  sender_to_receiver_ = new LoopBackTransport(cast_environment_sender_);
-  transport_sender_.Init(
-      new CastTransportImpl(
-          testing_clock_sender_, base::TimeDelta::FromSeconds(1),
-          base::MakeUnique<TransportClient>(nullptr),
-          base::WrapUnique(sender_to_receiver_), task_runner_sender_),
-      &video_bytes_encoded_, &audio_bytes_encoded_);
-
-  receiver_to_sender_ = new LoopBackTransport(cast_environment_receiver_);
-  transport_receiver_.reset(new CastTransportImpl(
-      testing_clock_receiver_, base::TimeDelta::FromSeconds(1),
-      base::MakeUnique<TransportClient>(this),
-      base::WrapUnique(receiver_to_sender_), task_runner_receiver_));
-
-  cast_receiver_ =
-      CastReceiver::Create(cast_environment_receiver_, audio_receiver_config_,
-                           video_receiver_config_, transport_receiver_.get());
-
-  cast_sender_ =
-      CastSender::Create(cast_environment_sender_, &transport_sender_);
-
-  cast_sender_->InitializeAudio(audio_sender_config_,
-                                base::Bind(&ExpectAudioSuccess));
-  cast_sender_->InitializeVideo(video_sender_config_,
-                                base::Bind(&ExpectVideoSuccess),
-                                CreateDefaultVideoEncodeAcceleratorCallback(),
-                                CreateDefaultVideoEncodeMemoryCallback());
-
-  receiver_to_sender_->Initialize(CreateSimplePipe(p),
-                                  transport_sender_.PacketReceiverForTesting(),
-                                  task_runner_, &testing_clock_);
-  sender_to_receiver_->Initialize(
-      CreateSimplePipe(p), transport_receiver_->PacketReceiverForTesting(),
-      task_runner_, &testing_clock_);
-
-  task_runner_->RunTasks();
-}
-
-enum CacheResult { FOUND_TRUE, FOUND_FALSE, NOT_FOUND };
-
-template <class T>
-class BenchmarkCache {
- public:
-  CacheResult Lookup(const T& x) {
-    base::AutoLock key(lock_);
-    for (size_t i = 0; i < results_.size(); i++) {
-      if (results_[i].second) {
-        if (x <= results_[i].first) {
-          VLOG(2) << "TRUE because: " << x.AsString()
-                  << " <= " << results_[i].first.AsString();
-          return FOUND_TRUE;
-        }
-      } else {
-        if (x >= results_[i].first) {
-          VLOG(2) << "FALSE because: " << x.AsString()
-                  << " >= " << results_[i].first.AsString();
-          return FOUND_FALSE;
-        }
-      }
-    }
-    return NOT_FOUND;
-  }
-
-  void Add(const T& x, bool result) {
-    base::AutoLock key(lock_);
-    VLOG(2) << "Cache Insert: " << x.AsString() << " = " << result;
-    results_.push_back(std::make_pair(x, result));
-  }
-
- private:
-  base::Lock lock_;
-  std::vector<std::pair<T, bool>> results_;
-};
-
-struct SearchVariable {
-  SearchVariable() : base(0.0), grade(0.0) {}
-  SearchVariable(double b, double g) : base(b), grade(g) {}
-  SearchVariable blend(const SearchVariable& other, double factor) {
-    CHECK_GE(factor, 0);
-    CHECK_LE(factor, 1.0);
-    return SearchVariable(base * (1 - factor) + other.base * factor,
-                          grade * (1 - factor) + other.grade * factor);
-  }
-  double value(double x) const { return base + grade * x; }
-  double base;
-  double grade;
-};
-
-struct SearchVector {
-  SearchVector blend(const SearchVector& other, double factor) {
-    SearchVector ret;
-    ret.bitrate = bitrate.blend(other.bitrate, factor);
-    ret.latency = latency.blend(other.latency, factor);
-    ret.packet_drop = packet_drop.blend(other.packet_drop, factor);
-    return ret;
-  }
-
-  SearchVector average(const SearchVector& other) { return blend(other, 0.5); }
-
-  MeasuringPoint GetMeasuringPoint(double v) const {
-    return MeasuringPoint(bitrate.value(-v), latency.value(v),
-                          packet_drop.value(v));
-  }
-  std::string AsString(double v) { return GetMeasuringPoint(v).AsString(); }
-
-  SearchVariable bitrate;
-  SearchVariable latency;
-  SearchVariable packet_drop;
-};
-
-class CastBenchmark {
- public:
-  bool RunOnePoint(const SearchVector& v, double multiplier) {
-    MeasuringPoint p = v.GetMeasuringPoint(multiplier);
-    VLOG(1) << "RUN: v = " << multiplier << " p = " << p.AsString();
-    if (p.bitrate <= 0) {
-      return false;
-    }
-    switch (cache_.Lookup(p)) {
-      case FOUND_TRUE:
-        return true;
-      case FOUND_FALSE:
-        return false;
-      case NOT_FOUND:
-        // Keep going
-        break;
-    }
-    bool result = true;
-    for (int tries = 0; tries < 3 && result; tries++) {
-      RunOneBenchmark benchmark;
-      benchmark.Run(p);
-      result &= benchmark.SimpleGood();
-    }
-    cache_.Add(p, result);
-    return result;
-  }
-
-  void BinarySearch(SearchVector v, double accuracy) {
-    double min = 0.0;
-    double max = 1.0;
-    while (RunOnePoint(v, max)) {
-      min = max;
-      max *= 2;
-    }
-
-    while (max - min > accuracy) {
-      double avg = (min + max) / 2;
-      if (RunOnePoint(v, avg)) {
-        min = avg;
-      } else {
-        max = avg;
-      }
-    }
-
-    // Print a data point to stdout.
-    base::AutoLock key(lock_);
-    MeasuringPoint p = v.GetMeasuringPoint(min);
-    fprintf(stdout, "%f %f %f\n", p.bitrate, p.latency, p.percent_packet_drop);
-    fflush(stdout);
-  }
-
-  void SpanningSearch(int max, int x, int y, int skip, SearchVector a,
-                      SearchVector b, SearchVector c, double accuracy,
-                      std::vector<linked_ptr<base::Thread>>* threads) {
-    static int thread_num = 0;
-    if (x > max) return;
-    if (skip > max) {
-      if (y > x) return;
-      SearchVector ab = a.blend(b, static_cast<double>(x) / max);
-      SearchVector ac = a.blend(c, static_cast<double>(x) / max);
-      SearchVector v = ab.blend(ac, x == y ? 1.0 : static_cast<double>(y) / x);
-      thread_num++;
-      (*threads)[thread_num % threads->size()]
-          ->message_loop()
-          ->task_runner()
-          ->PostTask(FROM_HERE,
-                     base::Bind(&CastBenchmark::BinarySearch,
-                                base::Unretained(this), v, accuracy));
-    } else {
-      skip *= 2;
-      SpanningSearch(max, x, y, skip, a, b, c, accuracy, threads);
-      SpanningSearch(max, x + skip, y + skip, skip, a, b, c, accuracy, threads);
-      SpanningSearch(max, x + skip, y, skip, a, b, c, accuracy, threads);
-      SpanningSearch(max, x, y + skip, skip, a, b, c, accuracy, threads);
-    }
-  }
-
-  void Run() {
-    // Spanning search.
-
-    std::vector<linked_ptr<base::Thread>> threads;
-    for (int i = 0; i < 16; i++) {
-      threads.push_back(make_linked_ptr(
-          new base::Thread(base::StringPrintf("cast_bench_thread_%d", i))));
-      threads[i]->Start();
-    }
-
-    if (base::CommandLine::ForCurrentProcess()->HasSwitch("single-run")) {
-      SearchVector a;
-      a.bitrate.base = 100.0;
-      a.bitrate.grade = 1.0;
-      a.latency.grade = 1.0;
-      a.packet_drop.grade = 1.0;
-      threads[0]->message_loop()->task_runner()->PostTask(
-          FROM_HERE, base::Bind(base::IgnoreResult(&CastBenchmark::RunOnePoint),
-                                base::Unretained(this), a, 1.0));
-    } else {
-      SearchVector a, b, c;
-      a.bitrate.base = b.bitrate.base = c.bitrate.base = 100.0;
-      a.bitrate.grade = 1.0;
-      b.latency.grade = 1.0;
-      c.packet_drop.grade = 1.0;
-
-      SpanningSearch(512, 0, 0, 1, a, b, c, 0.01, &threads);
-    }
-
-    for (size_t i = 0; i < threads.size(); i++) {
-      threads[i]->Stop();
-    }
-  }
-
- private:
-  BenchmarkCache<MeasuringPoint> cache_;
-  base::Lock lock_;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-  media::cast::CastBenchmark benchmark;
-  if (getenv("PROFILE_FILE")) {
-    std::string profile_file(getenv("PROFILE_FILE"));
-    base::debug::StartProfiling(profile_file);
-    benchmark.Run();
-    base::debug::StopProfiling();
-  } else {
-    benchmark.Run();
-  }
-}
diff --git a/src/cobalt/media/cast/test/end2end_unittest.cc b/src/cobalt/media/cast/test/end2end_unittest.cc
deleted file mode 100644
index 9bb6e3d..0000000
--- a/src/cobalt/media/cast/test/end2end_unittest.cc
+++ /dev/null
@@ -1,1253 +0,0 @@
-// Copyright 2013 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 test generate synthetic data. For audio it's a sinusoid waveform with
-// frequency kSoundFrequency and different amplitudes. For video it's a pattern
-// that is shifting by one pixel per frame, each pixels neighbors right and down
-// is this pixels value +1, since the pixel value is 8 bit it will wrap
-// frequently within the image. Visually this will create diagonally color bands
-// that moves across the screen
-
-#include <math.h>
-
-#include <algorithm>
-#include <functional>
-#include <list>
-#include <map>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/memory/ptr_util.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/sys_byteorder.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/time/tick_clock.h"
-#include "media/base/audio_bus.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/logging/simple_event_subscriber.h"
-#include "media/cast/net/cast_transport.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/net/cast_transport_defines.h"
-#include "media/cast/net/cast_transport_impl.h"
-#include "media/cast/test/skewed_single_thread_task_runner.h"
-#include "media/cast/test/skewed_tick_clock.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/udp_proxy.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace {
-
-static const int64_t kStartMillisecond = INT64_C(1245);
-static const int kAudioChannels = 2;
-static const double kSoundFrequency = 314.15926535897;  // Freq of sine wave.
-static const float kSoundVolume = 0.5f;
-static const int kVideoWidth = 320;
-static const int kVideoHeight = 180;
-
-// Since the video encoded and decoded an error will be introduced; when
-// comparing individual pixels the error can be quite large; we allow a PSNR of
-// at least |kVideoAcceptedPSNR|.
-static const double kVideoAcceptedPSNR = 38.0;
-
-// The tests are commonly implemented with |kFrameTimerMs| RunTask function;
-// a normal video is 30 fps hence the 33 ms between frames.
-//
-// TODO(miu): The errors in timing will add up significantly.  Find an
-// alternative approach that eliminates use of this constant.
-static const int kFrameTimerMs = 33;
-
-// The size of audio frames.  The encoder joins/breaks all inserted audio into
-// chunks of this size.
-static const int kAudioFrameDurationMs = 10;
-
-// The amount of time between frame capture on the sender and playout on the
-// receiver.
-static const int kTargetPlayoutDelayMs = 100;
-
-// The maximum amount of deviation expected in the playout times emitted by the
-// receiver.
-static const int kMaxAllowedPlayoutErrorMs = 30;
-
-std::string ConvertFromBase16String(const std::string& base_16) {
-  std::string compressed;
-  DCHECK_EQ(base_16.size() % 2, 0u) << "Must be a multiple of 2";
-  compressed.reserve(base_16.size() / 2);
-
-  std::vector<uint8_t> v;
-  if (!base::HexStringToBytes(base_16, &v)) {
-    NOTREACHED();
-  }
-  compressed.assign(reinterpret_cast<const char*>(&v[0]), v.size());
-  return compressed;
-}
-
-void ExpectSuccessOperationalStatus(OperationalStatus status) {
-  EXPECT_EQ(STATUS_INITIALIZED, status);
-}
-
-// This is wrapped in a struct because it needs to be put into a std::map.
-typedef struct { int counter[kNumOfLoggingEvents]; } LoggingEventCounts;
-
-// Constructs a map from each frame (RTP timestamp) to counts of each event
-// type logged for that frame.
-std::map<RtpTimeTicks, LoggingEventCounts> GetEventCountsForFrameEvents(
-    const std::vector<FrameEvent>& frame_events) {
-  std::map<RtpTimeTicks, LoggingEventCounts> event_counter_for_frame;
-  for (const FrameEvent& frame_event : frame_events) {
-    auto map_it = event_counter_for_frame.find(frame_event.rtp_timestamp);
-    if (map_it == event_counter_for_frame.end()) {
-      LoggingEventCounts new_counter;
-      SbMemorySet(&new_counter, 0, sizeof(new_counter));
-      ++(new_counter.counter[frame_event.type]);
-      event_counter_for_frame.insert(
-          std::make_pair(frame_event.rtp_timestamp, new_counter));
-    } else {
-      ++(map_it->second.counter[frame_event.type]);
-    }
-  }
-  return event_counter_for_frame;
-}
-
-// Constructs a map from each packet (Packet ID) to counts of each event
-// type logged for that packet.
-std::map<uint16_t, LoggingEventCounts> GetEventCountsForPacketEvents(
-    const std::vector<PacketEvent>& packet_events) {
-  std::map<uint16_t, LoggingEventCounts> event_counter_for_packet;
-  for (const PacketEvent& packet_event : packet_events) {
-    auto map_it = event_counter_for_packet.find(packet_event.packet_id);
-    if (map_it == event_counter_for_packet.end()) {
-      LoggingEventCounts new_counter;
-      SbMemorySet(&new_counter, 0, sizeof(new_counter));
-      ++(new_counter.counter[packet_event.type]);
-      event_counter_for_packet.insert(
-          std::make_pair(packet_event.packet_id, new_counter));
-    } else {
-      ++(map_it->second.counter[packet_event.type]);
-    }
-  }
-  return event_counter_for_packet;
-}
-
-// Shim that turns forwards packets from a test::PacketPipe to a
-// PacketReceiverCallback.
-class LoopBackPacketPipe : public test::PacketPipe {
- public:
-  explicit LoopBackPacketPipe(const PacketReceiverCallback& packet_receiver)
-      : packet_receiver_(packet_receiver) {}
-
-  ~LoopBackPacketPipe() final {}
-
-  // PacketPipe implementations.
-  void Send(std::unique_ptr<Packet> packet) final {
-    packet_receiver_.Run(std::move(packet));
-  }
-
- private:
-  PacketReceiverCallback packet_receiver_;
-};
-
-// Class that sends the packet direct from sender into the receiver with the
-// ability to drop packets between the two.
-//
-// TODO(miu): This should be reconciled/merged into
-// media/cast/test/loopback_transport.*.  It's roughly the same class and has
-// exactly the same name (and when it was outside of the anonymous namespace bad
-// things happened when linking on Android!).
-class LoopBackTransport : public PacketTransport {
- public:
-  explicit LoopBackTransport(scoped_refptr<CastEnvironment> cast_environment)
-      : send_packets_(true),
-        drop_packets_belonging_to_odd_frames_(false),
-        cast_environment_(cast_environment),
-        bytes_sent_(0) {}
-
-  void SetPacketReceiver(
-      const PacketReceiverCallback& packet_receiver,
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock) {
-    std::unique_ptr<test::PacketPipe> loopback_pipe(
-        new LoopBackPacketPipe(packet_receiver));
-    if (packet_pipe_) {
-      packet_pipe_->AppendToPipe(std::move(loopback_pipe));
-    } else {
-      packet_pipe_ = std::move(loopback_pipe);
-    }
-    packet_pipe_->InitOnIOThread(task_runner, clock);
-  }
-
-  bool SendPacket(PacketRef packet, const base::Closure& cb) final {
-    DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-    if (!send_packets_) return true;
-
-    bytes_sent_ += packet->data.size();
-    if (drop_packets_belonging_to_odd_frames_) {
-      const uint8_t truncated_frame_id = packet->data[13];
-      if (truncated_frame_id % 2 == 1) return true;
-    }
-
-    std::unique_ptr<Packet> packet_copy(new Packet(packet->data));
-    packet_pipe_->Send(std::move(packet_copy));
-    return true;
-  }
-
-  int64_t GetBytesSent() final { return bytes_sent_; }
-
-  void StartReceiving(
-      const PacketReceiverCallbackWithStatus& packet_receiver) final {}
-
-  void StopReceiving() final {}
-
-  void SetSendPackets(bool send_packets) { send_packets_ = send_packets; }
-
-  void DropAllPacketsBelongingToOddFrames() {
-    drop_packets_belonging_to_odd_frames_ = true;
-  }
-
-  void SetPacketPipe(std::unique_ptr<test::PacketPipe> pipe) {
-    // Append the loopback pipe to the end.
-    pipe->AppendToPipe(std::move(packet_pipe_));
-    packet_pipe_ = std::move(pipe);
-  }
-
- private:
-  bool send_packets_;
-  bool drop_packets_belonging_to_odd_frames_;
-  scoped_refptr<CastEnvironment> cast_environment_;
-  std::unique_ptr<test::PacketPipe> packet_pipe_;
-  int64_t bytes_sent_;
-};
-
-// Class that verifies the audio frames coming out of the receiver.
-class TestReceiverAudioCallback
-    : public base::RefCountedThreadSafe<TestReceiverAudioCallback> {
- public:
-  struct ExpectedAudioFrame {
-    std::unique_ptr<AudioBus> audio_bus;
-    base::TimeTicks playout_time;
-  };
-
-  TestReceiverAudioCallback() : num_called_(0) {}
-
-  void SetExpectedSamplingFrequency(int expected_sampling_frequency) {
-    expected_sampling_frequency_ = expected_sampling_frequency;
-  }
-
-  void AddExpectedResult(const AudioBus& audio_bus,
-                         const base::TimeTicks& playout_time) {
-    std::unique_ptr<ExpectedAudioFrame> expected_audio_frame(
-        new ExpectedAudioFrame());
-    expected_audio_frame->audio_bus =
-        AudioBus::Create(audio_bus.channels(), audio_bus.frames());
-    audio_bus.CopyTo(expected_audio_frame->audio_bus.get());
-    expected_audio_frame->playout_time = playout_time;
-    expected_frames_.push_back(std::move(expected_audio_frame));
-  }
-
-  void IgnoreAudioFrame(std::unique_ptr<AudioBus> audio_bus,
-                        const base::TimeTicks& playout_time,
-                        bool is_continuous) {
-    ++num_called_;
-  }
-
-  void CheckAudioFrame(std::unique_ptr<AudioBus> audio_bus,
-                       const base::TimeTicks& playout_time,
-                       bool is_continuous) {
-    ++num_called_;
-
-    ASSERT_TRUE(audio_bus);
-    ASSERT_FALSE(expected_frames_.empty());
-    const std::unique_ptr<ExpectedAudioFrame> expected_audio_frame =
-        std::move(expected_frames_.front());
-    expected_frames_.pop_front();
-
-    EXPECT_EQ(audio_bus->channels(), kAudioChannels);
-    EXPECT_EQ(audio_bus->frames(), expected_audio_frame->audio_bus->frames());
-    for (int ch = 0; ch < audio_bus->channels(); ++ch) {
-      EXPECT_NEAR(
-          CountZeroCrossings(expected_audio_frame->audio_bus->channel(ch),
-                             expected_audio_frame->audio_bus->frames()),
-          CountZeroCrossings(audio_bus->channel(ch), audio_bus->frames()), 1);
-    }
-
-    EXPECT_NEAR(
-        (playout_time - expected_audio_frame->playout_time).InMillisecondsF(),
-        0.0, kMaxAllowedPlayoutErrorMs);
-    VLOG_IF(1, !last_playout_time_.is_null())
-        << "Audio frame playout time delta (compared to last frame) is "
-        << (playout_time - last_playout_time_).InMicroseconds() << " usec.";
-    last_playout_time_ = playout_time;
-
-    EXPECT_TRUE(is_continuous);
-  }
-
-  int number_times_called() const { return num_called_; }
-
- protected:
-  virtual ~TestReceiverAudioCallback() {}
-
- private:
-  friend class base::RefCountedThreadSafe<TestReceiverAudioCallback>;
-
-  int num_called_;
-  int expected_sampling_frequency_;
-  std::list<std::unique_ptr<ExpectedAudioFrame>> expected_frames_;
-  base::TimeTicks last_playout_time_;
-};
-
-// Class that verifies the video frames coming out of the receiver.
-class TestReceiverVideoCallback
-    : public base::RefCountedThreadSafe<TestReceiverVideoCallback> {
- public:
-  struct ExpectedVideoFrame {
-    int frame_number;
-    gfx::Size size;
-    base::TimeTicks playout_time;
-    bool should_be_continuous;
-  };
-
-  TestReceiverVideoCallback() : num_called_(0) {}
-
-  void AddExpectedResult(int frame_number, const gfx::Size& size,
-                         const base::TimeTicks& playout_time,
-                         bool should_be_continuous) {
-    ExpectedVideoFrame expected_video_frame;
-    expected_video_frame.frame_number = frame_number;
-    expected_video_frame.size = size;
-    expected_video_frame.playout_time = playout_time;
-    expected_video_frame.should_be_continuous = should_be_continuous;
-    expected_frame_.push_back(expected_video_frame);
-  }
-
-  void CheckVideoFrame(bool examine_content,
-                       const scoped_refptr<media::VideoFrame>& video_frame,
-                       const base::TimeTicks& playout_time,
-                       bool is_continuous) {
-    ++num_called_;
-
-    ASSERT_TRUE(video_frame.get());
-    ASSERT_FALSE(expected_frame_.empty());
-    ExpectedVideoFrame expected_video_frame = expected_frame_.front();
-    expected_frame_.pop_front();
-
-    EXPECT_EQ(expected_video_frame.size.width(),
-              video_frame->visible_rect().width());
-    EXPECT_EQ(expected_video_frame.size.height(),
-              video_frame->visible_rect().height());
-
-    if (examine_content && expected_video_frame.should_be_continuous) {
-      scoped_refptr<media::VideoFrame> expected_I420_frame =
-          media::VideoFrame::CreateFrame(
-              PIXEL_FORMAT_I420, expected_video_frame.size,
-              gfx::Rect(expected_video_frame.size), expected_video_frame.size,
-              base::TimeDelta());
-      PopulateVideoFrame(expected_I420_frame.get(),
-                         expected_video_frame.frame_number);
-      EXPECT_LE(kVideoAcceptedPSNR, I420PSNR(expected_I420_frame, video_frame));
-    }
-
-    EXPECT_NEAR(
-        (playout_time - expected_video_frame.playout_time).InMillisecondsF(),
-        0.0, kMaxAllowedPlayoutErrorMs);
-    VLOG_IF(1, !last_playout_time_.is_null())
-        << "Video frame playout time delta (compared to last frame) is "
-        << (playout_time - last_playout_time_).InMicroseconds() << " usec.";
-    last_playout_time_ = playout_time;
-
-    EXPECT_EQ(expected_video_frame.should_be_continuous, is_continuous);
-  }
-
-  int number_times_called() const { return num_called_; }
-
- protected:
-  virtual ~TestReceiverVideoCallback() {}
-
- private:
-  friend class base::RefCountedThreadSafe<TestReceiverVideoCallback>;
-
-  int num_called_;
-  std::list<ExpectedVideoFrame> expected_frame_;
-  base::TimeTicks last_playout_time_;
-};
-
-}  // namespace
-
-// The actual test class, generate synthetic data for both audio and video and
-// send those through the sender and receiver and analyzes the result.
-class End2EndTest : public ::testing::Test {
- public:
-  void ReceivePacket(std::unique_ptr<media::cast::Packet> packet) {
-    cast_receiver_->ReceivePacket(std::move(packet));
-  }
-
- protected:
-  End2EndTest()
-      : start_time_(),
-        task_runner_(new FakeSingleThreadTaskRunner(&testing_clock_)),
-        testing_clock_sender_(new test::SkewedTickClock(&testing_clock_)),
-        task_runner_sender_(
-            new test::SkewedSingleThreadTaskRunner(task_runner_)),
-        testing_clock_receiver_(new test::SkewedTickClock(&testing_clock_)),
-        task_runner_receiver_(
-            new test::SkewedSingleThreadTaskRunner(task_runner_)),
-        cast_environment_sender_(new CastEnvironment(
-            std::unique_ptr<base::TickClock>(testing_clock_sender_),
-            task_runner_sender_, task_runner_sender_, task_runner_sender_)),
-        cast_environment_receiver_(new CastEnvironment(
-            std::unique_ptr<base::TickClock>(testing_clock_receiver_),
-            task_runner_receiver_, task_runner_receiver_,
-            task_runner_receiver_)),
-        receiver_to_sender_(new LoopBackTransport(cast_environment_receiver_)),
-        sender_to_receiver_(new LoopBackTransport(cast_environment_sender_)),
-        test_receiver_audio_callback_(new TestReceiverAudioCallback()),
-        test_receiver_video_callback_(new TestReceiverVideoCallback()) {
-    testing_clock_.Advance(
-        base::TimeDelta::FromMilliseconds(kStartMillisecond));
-    cast_environment_sender_->logger()->Subscribe(&event_subscriber_sender_);
-  }
-
-  void Configure(Codec video_codec, Codec audio_codec) {
-    audio_sender_config_.sender_ssrc = 1;
-    audio_sender_config_.receiver_ssrc = 2;
-    audio_sender_config_.max_playout_delay =
-        base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs);
-    audio_sender_config_.rtp_payload_type = RtpPayloadType::AUDIO_OPUS;
-    audio_sender_config_.use_external_encoder = false;
-    audio_sender_config_.rtp_timebase = kDefaultAudioSamplingRate;
-    audio_sender_config_.channels = kAudioChannels;
-    audio_sender_config_.max_bitrate = kDefaultAudioEncoderBitrate;
-    audio_sender_config_.codec = audio_codec;
-    audio_sender_config_.aes_iv_mask =
-        ConvertFromBase16String("abcdeffedcba12345678900987654321");
-    audio_sender_config_.aes_key =
-        ConvertFromBase16String("deadbeefcafecafedeadbeefb0b0b0b0");
-
-    audio_receiver_config_.receiver_ssrc = audio_sender_config_.receiver_ssrc;
-    audio_receiver_config_.sender_ssrc = audio_sender_config_.sender_ssrc;
-    audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
-    audio_receiver_config_.rtp_payload_type =
-        audio_sender_config_.rtp_payload_type;
-    audio_receiver_config_.rtp_timebase = audio_sender_config_.rtp_timebase;
-    audio_receiver_config_.channels = kAudioChannels;
-    audio_receiver_config_.target_frame_rate = 100;
-    audio_receiver_config_.codec = audio_sender_config_.codec;
-    audio_receiver_config_.aes_iv_mask = audio_sender_config_.aes_iv_mask;
-    audio_receiver_config_.aes_key = audio_sender_config_.aes_key;
-
-    test_receiver_audio_callback_->SetExpectedSamplingFrequency(
-        audio_receiver_config_.rtp_timebase);
-
-    video_sender_config_.sender_ssrc = 3;
-    video_sender_config_.receiver_ssrc = 4;
-    video_sender_config_.max_playout_delay =
-        base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs);
-    video_sender_config_.rtp_payload_type = RtpPayloadType::VIDEO_VP8;
-    video_sender_config_.use_external_encoder = false;
-    video_sender_config_.rtp_timebase = kVideoFrequency;
-    video_sender_config_.max_bitrate = 50000;
-    video_sender_config_.min_bitrate = 10000;
-    video_sender_config_.start_bitrate = 10000;
-    video_sender_config_.video_codec_params.max_qp = 30;
-    video_sender_config_.video_codec_params.min_qp = 4;
-    video_sender_config_.max_frame_rate = 30;
-    video_sender_config_.codec = video_codec;
-    video_sender_config_.aes_iv_mask =
-        ConvertFromBase16String("1234567890abcdeffedcba0987654321");
-    video_sender_config_.aes_key =
-        ConvertFromBase16String("deadbeefcafeb0b0b0b0cafedeadbeef");
-
-    video_receiver_config_.receiver_ssrc = video_sender_config_.receiver_ssrc;
-    video_receiver_config_.sender_ssrc = video_sender_config_.sender_ssrc;
-    video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
-    video_receiver_config_.rtp_payload_type =
-        video_sender_config_.rtp_payload_type;
-    video_receiver_config_.rtp_timebase = kVideoFrequency;
-    video_receiver_config_.channels = 1;
-    video_receiver_config_.target_frame_rate =
-        video_sender_config_.max_frame_rate;
-    video_receiver_config_.codec = video_sender_config_.codec;
-    video_receiver_config_.aes_iv_mask = video_sender_config_.aes_iv_mask;
-    video_receiver_config_.aes_key = video_sender_config_.aes_key;
-  }
-
-  void SetReceiverSkew(double skew, base::TimeDelta offset) {
-    testing_clock_receiver_->SetSkew(skew, offset);
-    task_runner_receiver_->SetSkew(1.0 / skew);
-  }
-
-  // Specify the minimum/maximum difference in playout times between two
-  // consecutive frames.  Also, specify the maximum absolute rate of change over
-  // each three consecutive frames.
-  void SetExpectedVideoPlayoutSmoothness(base::TimeDelta min_delta,
-                                         base::TimeDelta max_delta,
-                                         base::TimeDelta max_curvature) {
-    min_video_playout_delta_ = min_delta;
-    max_video_playout_delta_ = max_delta;
-    max_video_playout_curvature_ = max_curvature;
-  }
-
-  void FeedAudioFrames(int count, bool will_be_checked) {
-    for (int i = 0; i < count; ++i) {
-      std::unique_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus(
-          base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs)));
-      const base::TimeTicks reference_time =
-          testing_clock_sender_->NowTicks() +
-          i * base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs);
-      if (will_be_checked) {
-        test_receiver_audio_callback_->AddExpectedResult(
-            *audio_bus, reference_time + base::TimeDelta::FromMilliseconds(
-                                             kTargetPlayoutDelayMs));
-      }
-      audio_frame_input_->InsertAudio(std::move(audio_bus), reference_time);
-    }
-  }
-
-  void FeedAudioFramesWithExpectedDelay(int count,
-                                        const base::TimeDelta& delay) {
-    for (int i = 0; i < count; ++i) {
-      std::unique_ptr<AudioBus> audio_bus(audio_bus_factory_->NextAudioBus(
-          base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs)));
-      const base::TimeTicks reference_time =
-          testing_clock_sender_->NowTicks() +
-          i * base::TimeDelta::FromMilliseconds(kAudioFrameDurationMs);
-      test_receiver_audio_callback_->AddExpectedResult(
-          *audio_bus,
-          reference_time + delay +
-              base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs));
-      audio_frame_input_->InsertAudio(std::move(audio_bus), reference_time);
-    }
-  }
-
-  void RequestAudioFrames(int count, bool with_check) {
-    for (int i = 0; i < count; ++i) {
-      cast_receiver_->RequestDecodedAudioFrame(
-          base::Bind(with_check ? &TestReceiverAudioCallback::CheckAudioFrame
-                                : &TestReceiverAudioCallback::IgnoreAudioFrame,
-                     test_receiver_audio_callback_));
-    }
-  }
-
-  void Create();
-
-  ~End2EndTest() override {
-    cast_environment_sender_->logger()->Unsubscribe(&event_subscriber_sender_);
-  }
-
-  void TearDown() final {
-    cast_sender_.reset();
-    cast_receiver_.reset();
-    task_runner_->RunTasks();
-  }
-
-  gfx::Size GetTestVideoFrameSize() const {
-    if (video_sender_config_.codec == CODEC_VIDEO_FAKE)
-      return gfx::Size(2, 2);
-    else
-      return gfx::Size(kVideoWidth, kVideoHeight);
-  }
-
-  void SendVideoFrame(int frame_number, const base::TimeTicks& reference_time) {
-    if (start_time_.is_null()) start_time_ = reference_time;
-    const base::TimeDelta time_diff = reference_time - start_time_;
-    scoped_refptr<media::VideoFrame> video_frame;
-    if (video_sender_config_.codec == CODEC_VIDEO_FAKE) {
-      video_frame =
-          media::VideoFrame::CreateBlackFrame(GetTestVideoFrameSize());
-    } else {
-      const gfx::Size size = GetTestVideoFrameSize();
-      video_frame = media::VideoFrame::CreateFrame(
-          PIXEL_FORMAT_I420, size, gfx::Rect(size), size, time_diff);
-      PopulateVideoFrame(video_frame.get(), frame_number);
-    }
-    video_frame->set_timestamp(reference_time - start_time_);
-    video_frame_input_->InsertRawVideoFrame(video_frame, reference_time);
-  }
-
-  void RunTasks(int ms) {
-    task_runner_->Sleep(base::TimeDelta::FromMilliseconds(ms));
-  }
-
-  // Send and receive audio and video frames for the given |duration|.  Returns
-  // the total number of audio and video frames sent.
-  std::pair<int, int> RunAudioVideoLoop(base::TimeDelta duration) {
-    base::TimeTicks next_video_frame_at = testing_clock_.NowTicks();
-    base::TimeTicks video_reference_time;
-    int audio_frames_sent = 0;
-    int video_frames_sent = 0;
-    const base::TimeTicks end_time = testing_clock_.NowTicks() + duration;
-    while (testing_clock_.NowTicks() < end_time) {
-      // Opus introduces a tiny delay before the sinewave starts; so don't
-      // examine the first audio frame's data receiver-side.
-      const bool verify_audio_data =
-          audio_frames_sent > 0 ||
-          audio_sender_config_.codec == CODEC_AUDIO_PCM16;
-      FeedAudioFrames(1, verify_audio_data);
-      ++audio_frames_sent;
-
-      const bool send_and_receive_a_video_frame =
-          testing_clock_.NowTicks() >= next_video_frame_at;
-      if (send_and_receive_a_video_frame) {
-        video_reference_time = next_video_frame_at;
-        next_video_frame_at += base::TimeDelta::FromMilliseconds(kFrameTimerMs);
-        test_receiver_video_callback_->AddExpectedResult(
-            video_frames_sent, GetTestVideoFrameSize(),
-            testing_clock_.NowTicks() +
-                base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs),
-            true);
-        SendVideoFrame(video_frames_sent, video_reference_time);
-        ++video_frames_sent;
-      }
-
-      RunTasks(kAudioFrameDurationMs);
-
-      RequestAudioFrames(1, verify_audio_data);
-      if (send_and_receive_a_video_frame) {
-        cast_receiver_->RequestDecodedVideoFrame(
-            base::Bind(&TestReceiverVideoCallback::CheckVideoFrame,
-                       test_receiver_video_callback_,
-                       video_sender_config_.codec != CODEC_VIDEO_FAKE));
-      }
-    }
-
-    // Verify all audio and video frames were received.
-    RunTasks(kFrameTimerMs + kTargetPlayoutDelayMs);  // Let the data flow.
-    EXPECT_EQ(audio_frames_sent,
-              test_receiver_audio_callback_->number_times_called());
-    EXPECT_EQ(video_frames_sent,
-              test_receiver_video_callback_->number_times_called());
-
-    return std::make_pair(audio_frames_sent, video_frames_sent);
-  }
-
-  // Queries the EventSubscriber for all accumulated frame and packet events for
-  // audio and video and verifies all logging information was captured
-  // correctly.
-  void VerifyLogging(int num_expected_audio_frames,
-                     int num_expected_video_frames) {
-    // Partition the frame and packet events into separate vectors for audio
-    // versus video.
-    std::vector<FrameEvent> all_frame_events;
-    event_subscriber_sender_.GetFrameEventsAndReset(&all_frame_events);
-    std::vector<FrameEvent> audio_frame_events;
-    std::vector<FrameEvent> video_frame_events;
-    for (const FrameEvent& event : all_frame_events) {
-      switch (event.media_type) {
-        case AUDIO_EVENT:
-          audio_frame_events.push_back(event);
-          break;
-        case VIDEO_EVENT:
-          video_frame_events.push_back(event);
-          break;
-        default:
-          FAIL();
-          return;
-      }
-    }
-    std::vector<PacketEvent> all_packet_events;
-    event_subscriber_sender_.GetPacketEventsAndReset(&all_packet_events);
-    std::vector<PacketEvent> audio_packet_events;
-    std::vector<PacketEvent> video_packet_events;
-    for (const PacketEvent& event : all_packet_events) {
-      switch (event.media_type) {
-        case AUDIO_EVENT:
-          audio_packet_events.push_back(event);
-          break;
-        case VIDEO_EVENT:
-          video_packet_events.push_back(event);
-          break;
-        default:
-          FAIL();
-          return;
-      }
-    }
-
-    // For each frame, count the number of events that occurred for each event
-    // for that frame.
-    std::map<RtpTimeTicks, LoggingEventCounts> audio_event_counts_by_frame =
-        GetEventCountsForFrameEvents(audio_frame_events);
-    EXPECT_EQ(static_cast<size_t>(num_expected_audio_frames),
-              audio_event_counts_by_frame.size());
-    std::map<RtpTimeTicks, LoggingEventCounts> video_event_counts_by_frame =
-        GetEventCountsForFrameEvents(video_frame_events);
-    EXPECT_EQ(static_cast<size_t>(num_expected_video_frames),
-              video_event_counts_by_frame.size());
-
-    // Examine the types of each frame and packet event and verify required
-    // events are present and unknown ones are not.
-    VerifyLoggingEventCounts(audio_event_counts_by_frame,
-                             GetEventCountsForPacketEvents(audio_packet_events),
-                             true);
-    VerifyLoggingEventCounts(video_event_counts_by_frame,
-                             GetEventCountsForPacketEvents(video_packet_events),
-                             false);
-  }
-
-  // Examines histograms of event types to verify all logging information was
-  // captured correctly.
-  static void VerifyLoggingEventCounts(
-      const std::map<RtpTimeTicks, LoggingEventCounts>& event_counts_by_frame,
-      const std::map<uint16_t, LoggingEventCounts>& event_counts_by_packet,
-      bool for_audio) {
-    // Verify that each frame has the expected types of events logged.
-    for (const auto& e : event_counts_by_frame) {
-      int total_event_count_for_frame = 0;
-      for (int i = 0; i < kNumOfLoggingEvents; ++i) {
-        total_event_count_for_frame += e.second.counter[i];
-      }
-
-      int count_of_valid_events = 0;
-      if (!for_audio) {
-        EXPECT_EQ(1, e.second.counter[FRAME_CAPTURE_BEGIN]);
-        ++count_of_valid_events;
-        EXPECT_EQ(1, e.second.counter[FRAME_CAPTURE_END]);
-        ++count_of_valid_events;
-      }
-      EXPECT_EQ(1, e.second.counter[FRAME_ENCODED]);
-      ++count_of_valid_events;
-      EXPECT_EQ(1, e.second.counter[FRAME_DECODED]);
-      ++count_of_valid_events;
-      EXPECT_EQ(1, e.second.counter[FRAME_PLAYOUT]);
-      ++count_of_valid_events;
-
-      // There is no guarantee that FRAME_ACK_SENT is logged exactly once per
-      // frame.
-      EXPECT_GT(e.second.counter[FRAME_ACK_SENT], 0);
-      count_of_valid_events += e.second.counter[FRAME_ACK_SENT];
-
-      // There is no guarantee that FRAME_ACK_RECEIVED is logged exactly once
-      // per frame.
-      EXPECT_GT(e.second.counter[FRAME_ACK_RECEIVED], 0);
-      count_of_valid_events += e.second.counter[FRAME_ACK_RECEIVED];
-
-      // Verify that there were no unexpected events logged with respect to this
-      // frame.
-      EXPECT_EQ(count_of_valid_events, total_event_count_for_frame);
-    }
-
-    // Verify that each packet has the expected types of events logged.
-    for (const auto& e : event_counts_by_packet) {
-      int total_event_count_for_packet = 0;
-      for (int i = 0; i < kNumOfLoggingEvents; ++i) {
-        total_event_count_for_packet += e.second.counter[i];
-      }
-
-      EXPECT_GT(e.second.counter[PACKET_RECEIVED], 0);
-      const int packets_received = e.second.counter[PACKET_RECEIVED];
-      const int packets_sent = e.second.counter[PACKET_SENT_TO_NETWORK];
-      EXPECT_EQ(packets_sent, packets_received);
-
-      // Verify that there were no other events logged with respect to this
-      // packet.  An assumption here is that there was no packet loss nor
-      // retransmits during the end-to-end run.
-      EXPECT_EQ(packets_received + packets_sent, total_event_count_for_packet);
-    }
-  }
-
-  void BasicPlayerGotVideoFrame(
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      const base::TimeTicks& playout_time, bool continuous) {
-    // The following tests that the sender and receiver clocks can be
-    // out-of-sync, drift, and jitter with respect to one another; and depsite
-    // this, the receiver will produce smoothly-progressing playout times.
-    // Both first-order and second-order effects are tested.
-    if (!last_video_playout_time_.is_null() &&
-        min_video_playout_delta_ > base::TimeDelta()) {
-      const base::TimeDelta delta = playout_time - last_video_playout_time_;
-      VLOG(1) << "Video frame playout time delta (compared to last frame) is "
-              << delta.InMicroseconds() << " usec.";
-      EXPECT_LE(min_video_playout_delta_.InMicroseconds(),
-                delta.InMicroseconds());
-      EXPECT_GE(max_video_playout_delta_.InMicroseconds(),
-                delta.InMicroseconds());
-      if (last_video_playout_delta_ > base::TimeDelta()) {
-        base::TimeDelta abs_curvature = delta - last_video_playout_delta_;
-        if (abs_curvature < base::TimeDelta()) abs_curvature = -abs_curvature;
-        EXPECT_GE(max_video_playout_curvature_.InMicroseconds(),
-                  abs_curvature.InMicroseconds());
-      }
-      last_video_playout_delta_ = delta;
-    }
-    last_video_playout_time_ = playout_time;
-
-    video_ticks_.push_back(
-        std::make_pair(testing_clock_receiver_->NowTicks(), playout_time));
-    cast_receiver_->RequestDecodedVideoFrame(base::Bind(
-        &End2EndTest::BasicPlayerGotVideoFrame, base::Unretained(this)));
-  }
-
-  void BasicPlayerGotAudioFrame(std::unique_ptr<AudioBus> audio_bus,
-                                const base::TimeTicks& playout_time,
-                                bool is_continuous) {
-    VLOG_IF(1, !last_audio_playout_time_.is_null())
-        << "Audio frame playout time delta (compared to last frame) is "
-        << (playout_time - last_audio_playout_time_).InMicroseconds()
-        << " usec.";
-    last_audio_playout_time_ = playout_time;
-
-    audio_ticks_.push_back(
-        std::make_pair(testing_clock_receiver_->NowTicks(), playout_time));
-    cast_receiver_->RequestDecodedAudioFrame(base::Bind(
-        &End2EndTest::BasicPlayerGotAudioFrame, base::Unretained(this)));
-  }
-
-  void StartBasicPlayer() {
-    cast_receiver_->RequestDecodedVideoFrame(base::Bind(
-        &End2EndTest::BasicPlayerGotVideoFrame, base::Unretained(this)));
-    cast_receiver_->RequestDecodedAudioFrame(base::Bind(
-        &End2EndTest::BasicPlayerGotAudioFrame, base::Unretained(this)));
-  }
-
-  FrameReceiverConfig audio_receiver_config_;
-  FrameReceiverConfig video_receiver_config_;
-  FrameSenderConfig audio_sender_config_;
-  FrameSenderConfig video_sender_config_;
-
-  base::TimeTicks start_time_;
-
-  // These run in "test time"
-  base::SimpleTestTickClock testing_clock_;
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
-
-  // These run on the sender timeline.
-  test::SkewedTickClock* testing_clock_sender_;
-  scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_sender_;
-
-  // These run on the receiver timeline.
-  test::SkewedTickClock* testing_clock_receiver_;
-  scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_receiver_;
-  base::TimeDelta min_video_playout_delta_;
-  base::TimeDelta max_video_playout_delta_;
-  base::TimeDelta max_video_playout_curvature_;
-  base::TimeTicks last_video_playout_time_;
-  base::TimeDelta last_video_playout_delta_;
-  base::TimeTicks last_audio_playout_time_;
-
-  scoped_refptr<CastEnvironment> cast_environment_sender_;
-  scoped_refptr<CastEnvironment> cast_environment_receiver_;
-
-  LoopBackTransport* receiver_to_sender_;  // Owned by CastTransport.
-  LoopBackTransport* sender_to_receiver_;  // Owned by CastTransport.
-
-  std::unique_ptr<CastTransportImpl> transport_sender_;
-  std::unique_ptr<CastTransportImpl> transport_receiver_;
-
-  std::unique_ptr<CastReceiver> cast_receiver_;
-  std::unique_ptr<CastSender> cast_sender_;
-  scoped_refptr<AudioFrameInput> audio_frame_input_;
-  scoped_refptr<VideoFrameInput> video_frame_input_;
-
-  scoped_refptr<TestReceiverAudioCallback> test_receiver_audio_callback_;
-  scoped_refptr<TestReceiverVideoCallback> test_receiver_video_callback_;
-
-  std::unique_ptr<TestAudioBusFactory> audio_bus_factory_;
-
-  SimpleEventSubscriber event_subscriber_sender_;
-
-  std::vector<std::pair<base::TimeTicks, base::TimeTicks>> audio_ticks_;
-  std::vector<std::pair<base::TimeTicks, base::TimeTicks>> video_ticks_;
-
-  // |transport_sender_| has a RepeatingTimer which needs a MessageLoop.
-  base::MessageLoop message_loop_;
-};
-
-namespace {
-
-class TransportClient : public CastTransport::Client {
- public:
-  TransportClient(LogEventDispatcher* log_event_dispatcher,
-                  End2EndTest* e2e_test)
-      : log_event_dispatcher_(log_event_dispatcher), e2e_test_(e2e_test) {}
-
-  void OnStatusChanged(media::cast::CastTransportStatus status) final {
-    EXPECT_EQ(TRANSPORT_STREAM_INITIALIZED, status);
-  };
-  void OnLoggingEventsReceived(
-      std::unique_ptr<std::vector<FrameEvent>> frame_events,
-      std::unique_ptr<std::vector<PacketEvent>> packet_events) final {
-    log_event_dispatcher_->DispatchBatchOfEvents(std::move(frame_events),
-                                                 std::move(packet_events));
-  };
-  void ProcessRtpPacket(std::unique_ptr<Packet> packet) final {
-    if (e2e_test_) e2e_test_->ReceivePacket(std::move(packet));
-  };
-
- private:
-  LogEventDispatcher* const log_event_dispatcher_;  // Not owned by this class.
-  End2EndTest* const e2e_test_;                     // Not owned by this class.
-
-  DISALLOW_COPY_AND_ASSIGN(TransportClient);
-};
-
-}  // namespace
-
-void End2EndTest::Create() {
-  transport_sender_.reset(new CastTransportImpl(
-      testing_clock_sender_, base::TimeDelta::FromMilliseconds(1),
-      base::MakeUnique<TransportClient>(cast_environment_sender_->logger(),
-                                        nullptr),
-      base::WrapUnique(sender_to_receiver_), task_runner_sender_));
-
-  transport_receiver_.reset(new CastTransportImpl(
-      testing_clock_sender_, base::TimeDelta::FromMilliseconds(1),
-      base::MakeUnique<TransportClient>(cast_environment_receiver_->logger(),
-                                        this),
-      base::WrapUnique(receiver_to_sender_), task_runner_sender_));
-
-  cast_receiver_ =
-      CastReceiver::Create(cast_environment_receiver_, audio_receiver_config_,
-                           video_receiver_config_, transport_receiver_.get());
-
-  cast_sender_ =
-      CastSender::Create(cast_environment_sender_, transport_sender_.get());
-
-  // Initializing audio and video senders.
-  cast_sender_->InitializeAudio(audio_sender_config_,
-                                base::Bind(&ExpectSuccessOperationalStatus));
-  cast_sender_->InitializeVideo(video_sender_config_,
-                                base::Bind(&ExpectSuccessOperationalStatus),
-                                CreateDefaultVideoEncodeAcceleratorCallback(),
-                                CreateDefaultVideoEncodeMemoryCallback());
-  task_runner_->RunTasks();
-
-  receiver_to_sender_->SetPacketReceiver(
-      transport_sender_->PacketReceiverForTesting(), task_runner_,
-      &testing_clock_);
-  sender_to_receiver_->SetPacketReceiver(
-      transport_receiver_->PacketReceiverForTesting(), task_runner_,
-      &testing_clock_);
-
-  audio_frame_input_ = cast_sender_->audio_frame_input();
-  video_frame_input_ = cast_sender_->video_frame_input();
-
-  audio_bus_factory_.reset(new TestAudioBusFactory(
-      audio_sender_config_.channels, audio_sender_config_.rtp_timebase,
-      kSoundFrequency, kSoundVolume));
-}
-
-TEST_F(End2EndTest, LoopWithLosslessEncoding) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  Create();
-
-  const auto frames_sent = RunAudioVideoLoop(base::TimeDelta::FromSeconds(3));
-
-  // Make sure that we send a RTCP message containing receiver log data, then
-  // verify the accumulated logging data.
-  RunTasks(750);
-  VerifyLogging(frames_sent.first, frames_sent.second);
-}
-
-TEST_F(End2EndTest, LoopWithLossyEncoding) {
-  Configure(CODEC_VIDEO_VP8, CODEC_AUDIO_OPUS);
-  Create();
-
-  const auto frames_sent = RunAudioVideoLoop(base::TimeDelta::FromSeconds(1));
-
-  // Run tasks for 750 ms to ensure RTCP messages containing log data from the
-  // receiver are sent and processed by the sender.  Then, verify the expected
-  // logging data is present.
-  RunTasks(750);
-  VerifyLogging(frames_sent.first, frames_sent.second);
-}
-
-// This tests start sending audio and video at start-up time before the receiver
-// is ready; it sends 2 frames before the receiver comes online.
-//
-// Test disabled due to flakiness: It appears that the RTCP synchronization
-// sometimes kicks in, and sometimes doesn't.  When it does, there's a sharp
-// discontinuity in the timeline, throwing off the test expectations.  See TODOs
-// in audio_receiver.cc for likely cause(s) of this bug.
-// http://crbug.com/573126 (history: http://crbug.com/314233)
-TEST_F(End2EndTest, DISABLED_StartSenderBeforeReceiver) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  Create();
-
-  int frame_number = 0;
-  int audio_diff = kFrameTimerMs;
-
-  sender_to_receiver_->SetSendPackets(false);
-
-  const int test_delay_ms = 100;
-
-  const int kNumVideoFramesBeforeReceiverStarted = 2;
-  const base::TimeTicks initial_send_time = testing_clock_sender_->NowTicks();
-  const base::TimeDelta expected_delay =
-      base::TimeDelta::FromMilliseconds(test_delay_ms + kFrameTimerMs);
-  for (int i = 0; i < kNumVideoFramesBeforeReceiverStarted; ++i) {
-    const int num_audio_frames = audio_diff / kAudioFrameDurationMs;
-    audio_diff -= num_audio_frames * kAudioFrameDurationMs;
-
-    if (num_audio_frames > 0)
-      FeedAudioFramesWithExpectedDelay(1, expected_delay);
-
-    // Frame will be rendered with 100mS delay, as the transmission is delayed.
-    // The receiver at this point cannot be synced to the sender's clock, as no
-    // packets, and specifically no RTCP packets were sent.
-    test_receiver_video_callback_->AddExpectedResult(
-        frame_number, GetTestVideoFrameSize(),
-        initial_send_time + expected_delay +
-            base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs),
-        true);
-    SendVideoFrame(frame_number++, testing_clock_sender_->NowTicks());
-
-    if (num_audio_frames > 0)
-      RunTasks(kAudioFrameDurationMs);  // Advance clock forward.
-    if (num_audio_frames > 1)
-      FeedAudioFramesWithExpectedDelay(num_audio_frames - 1, expected_delay);
-
-    RunTasks(kFrameTimerMs - kAudioFrameDurationMs);
-    audio_diff += kFrameTimerMs;
-  }
-
-  RunTasks(test_delay_ms);
-  sender_to_receiver_->SetSendPackets(true);
-
-  int num_audio_frames_requested = 0;
-  for (int j = 0; j < 10; ++j) {
-    const int num_audio_frames = audio_diff / kAudioFrameDurationMs;
-    audio_diff -= num_audio_frames * kAudioFrameDurationMs;
-
-    if (num_audio_frames > 0) FeedAudioFrames(1, true);
-
-    test_receiver_video_callback_->AddExpectedResult(
-        frame_number, GetTestVideoFrameSize(),
-        testing_clock_sender_->NowTicks() +
-            base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs),
-        true);
-    SendVideoFrame(frame_number++, testing_clock_sender_->NowTicks());
-
-    if (num_audio_frames > 0)
-      RunTasks(kAudioFrameDurationMs);  // Advance clock forward.
-    if (num_audio_frames > 1) FeedAudioFrames(num_audio_frames - 1, true);
-
-    RequestAudioFrames(num_audio_frames, true);
-    num_audio_frames_requested += num_audio_frames;
-
-    cast_receiver_->RequestDecodedVideoFrame(
-        base::Bind(&TestReceiverVideoCallback::CheckVideoFrame,
-                   test_receiver_video_callback_,
-                   video_sender_config_.codec != CODEC_VIDEO_FAKE));
-
-    RunTasks(kFrameTimerMs - kAudioFrameDurationMs);
-    audio_diff += kFrameTimerMs;
-  }
-  RunTasks(2 * kFrameTimerMs + 1);  // Empty the receiver pipeline.
-  EXPECT_EQ(num_audio_frames_requested,
-            test_receiver_audio_callback_->number_times_called());
-  EXPECT_EQ(10, test_receiver_video_callback_->number_times_called());
-}
-
-TEST_F(End2EndTest, BasicFakeSoftwareVideo) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  Create();
-  StartBasicPlayer();
-  SetReceiverSkew(1.0, base::TimeDelta::FromMilliseconds(1));
-
-  // Expect very smooth playout when there is no clock skew.
-  SetExpectedVideoPlayoutSmoothness(
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 99 / 100,
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 101 / 100,
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) / 100);
-
-  int frames_counter = 0;
-  for (; frames_counter < 30; ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  RunTasks(2 * kFrameTimerMs + 1);  // Empty the pipeline.
-  EXPECT_EQ(30ul, video_ticks_.size());
-}
-
-// The following tests run many many iterations to make sure that buffers don't
-// fill, timers don't go askew etc. However, these high-level tests are too
-// expensive when running under Valgrind or other sanitizer, or in non-optimized
-// debug builds. In these cases, we reduce the number of iterations.
-#if (defined(OS_WIN) && !defined(NVALGRIND)) || defined(ADDRESS_SANITIZER) || \
-    defined(LEAK_SANITIZER) || defined(MEMORY_SANITIZER) ||                   \
-    defined(THREAD_SANITIZER) || defined(UNDEFINED_SANITIZER)
-const int kLongTestIterations = 500;  // http://crbug.com/487033
-#elif defined(NDEBUG)
-const int kLongTestIterations = 10000;
-#else
-const int kLongTestIterations = 1000;
-#endif
-
-TEST_F(End2EndTest, ReceiverClockFast) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  Create();
-  StartBasicPlayer();
-  SetReceiverSkew(2.0, base::TimeDelta::FromMicroseconds(1234567));
-
-  for (int frames_counter = 0; frames_counter < kLongTestIterations;
-       ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  RunTasks(2 * kFrameTimerMs + 1);  // Empty the pipeline.
-  EXPECT_EQ(static_cast<size_t>(kLongTestIterations), video_ticks_.size());
-}
-
-TEST_F(End2EndTest, ReceiverClockSlow) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  Create();
-  StartBasicPlayer();
-  SetReceiverSkew(0.5, base::TimeDelta::FromMicroseconds(-765432));
-
-  for (int frames_counter = 0; frames_counter < kLongTestIterations;
-       ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  RunTasks(2 * kFrameTimerMs + 1);  // Empty the pipeline.
-  EXPECT_EQ(static_cast<size_t>(kLongTestIterations), video_ticks_.size());
-}
-
-TEST_F(End2EndTest, SmoothPlayoutWithFivePercentClockRateSkew) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  Create();
-  StartBasicPlayer();
-  SetReceiverSkew(1.05, base::TimeDelta::FromMilliseconds(-42));
-
-  // Expect smooth playout when there is 5% skew.
-  SetExpectedVideoPlayoutSmoothness(
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 90 / 100,
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 110 / 100,
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) / 10);
-
-  for (int frames_counter = 0; frames_counter < kLongTestIterations;
-       ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  RunTasks(2 * kFrameTimerMs + 1);  // Empty the pipeline.
-  EXPECT_EQ(static_cast<size_t>(kLongTestIterations), video_ticks_.size());
-}
-
-TEST_F(End2EndTest, EvilNetwork) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  receiver_to_sender_->SetPacketPipe(test::EvilNetwork());
-  sender_to_receiver_->SetPacketPipe(test::EvilNetwork());
-  Create();
-  StartBasicPlayer();
-
-  for (int frames_counter = 0; frames_counter < kLongTestIterations;
-       ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  base::TimeTicks test_end = testing_clock_receiver_->NowTicks();
-  RunTasks(100 * kFrameTimerMs + 1);  // Empty the pipeline.
-  EXPECT_LT(static_cast<size_t>(kLongTestIterations / 100),
-            video_ticks_.size());
-  VLOG(1) << "Fully transmitted " << video_ticks_.size() << " frames.";
-  EXPECT_GT(1000, (video_ticks_.back().second - test_end).InMilliseconds());
-}
-
-// Tests that a system configured for 30 FPS drops frames when input is provided
-// at a much higher frame rate.
-TEST_F(End2EndTest, ShoveHighFrameRateDownYerThroat) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  receiver_to_sender_->SetPacketPipe(test::EvilNetwork());
-  sender_to_receiver_->SetPacketPipe(test::EvilNetwork());
-  Create();
-  StartBasicPlayer();
-
-  for (int frames_counter = 0; frames_counter < kLongTestIterations;
-       ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(10 /* 10 ms, but 33.3 expected by system */);
-  }
-  base::TimeTicks test_end = testing_clock_receiver_->NowTicks();
-  RunTasks(100 * kFrameTimerMs + 1);  // Empty the pipeline.
-  EXPECT_LT(static_cast<size_t>(kLongTestIterations / 100),
-            video_ticks_.size());
-  EXPECT_GE(static_cast<size_t>(kLongTestIterations / 3), video_ticks_.size());
-  VLOG(1) << "Fully transmitted " << video_ticks_.size() << " frames.";
-  EXPECT_LT((video_ticks_.back().second - test_end).InMilliseconds(), 1000);
-}
-
-TEST_F(End2EndTest, OldPacketNetwork) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  sender_to_receiver_->SetPacketPipe(test::NewRandomDrop(0.01));
-  std::unique_ptr<test::PacketPipe> echo_chamber(
-      test::NewDuplicateAndDelay(1, 10 * kFrameTimerMs));
-  echo_chamber->AppendToPipe(test::NewDuplicateAndDelay(1, 20 * kFrameTimerMs));
-  echo_chamber->AppendToPipe(test::NewDuplicateAndDelay(1, 40 * kFrameTimerMs));
-  echo_chamber->AppendToPipe(test::NewDuplicateAndDelay(1, 80 * kFrameTimerMs));
-  echo_chamber->AppendToPipe(
-      test::NewDuplicateAndDelay(1, 160 * kFrameTimerMs));
-
-  receiver_to_sender_->SetPacketPipe(std::move(echo_chamber));
-  Create();
-  StartBasicPlayer();
-
-  SetExpectedVideoPlayoutSmoothness(
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 90 / 100,
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) * 110 / 100,
-      base::TimeDelta::FromMilliseconds(kFrameTimerMs) / 10);
-
-  for (int frames_counter = 0; frames_counter < kLongTestIterations;
-       ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  RunTasks(100 * kFrameTimerMs + 1);  // Empty the pipeline.
-
-  EXPECT_EQ(static_cast<size_t>(kLongTestIterations), video_ticks_.size());
-}
-
-TEST_F(End2EndTest, TestSetPlayoutDelay) {
-  Configure(CODEC_VIDEO_FAKE, CODEC_AUDIO_PCM16);
-  video_sender_config_.min_playout_delay =
-      video_sender_config_.max_playout_delay;
-  audio_sender_config_.min_playout_delay =
-      audio_sender_config_.max_playout_delay;
-  video_sender_config_.max_playout_delay = base::TimeDelta::FromSeconds(1);
-  audio_sender_config_.max_playout_delay = base::TimeDelta::FromSeconds(1);
-  Create();
-  StartBasicPlayer();
-  const int kNewDelay = 600;
-
-  int frames_counter = 0;
-  for (; frames_counter < 50; ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  cast_sender_->SetTargetPlayoutDelay(
-      base::TimeDelta::FromMilliseconds(kNewDelay));
-  for (; frames_counter < 100; ++frames_counter) {
-    SendVideoFrame(frames_counter, testing_clock_sender_->NowTicks());
-    RunTasks(kFrameTimerMs);
-  }
-  RunTasks(100 * kFrameTimerMs + 1);  // Empty the pipeline.
-  size_t jump = 0;
-  for (size_t i = 1; i < video_ticks_.size(); i++) {
-    int64_t delta =
-        (video_ticks_[i].second - video_ticks_[i - 1].second).InMilliseconds();
-    if (delta > 100) {
-      EXPECT_EQ(kNewDelay - kTargetPlayoutDelayMs + kFrameTimerMs, delta);
-      EXPECT_EQ(0u, jump);
-      jump = i;
-    }
-  }
-  EXPECT_GT(jump, 49u);
-  EXPECT_LT(jump, 120u);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/fake_media_source.cc b/src/cobalt/media/cast/test/fake_media_source.cc
deleted file mode 100644
index 88c20b2..0000000
--- a/src/cobalt/media/cast/test/fake_media_source.cc
+++ /dev/null
@@ -1,607 +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.
-
-#include "media/cast/test/fake_media_source.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/files/scoped_file.h"
-#include "base/logging.h"
-#include "base/rand_util.h"
-#include "base/strings/string_number_conversions.h"
-#include "media/base/audio_buffer.h"
-#include "media/base/audio_bus.h"
-#include "media/base/audio_fifo.h"
-#include "media/base/audio_timestamp_helper.h"
-#include "media/base/media.h"
-#include "media/base/video_frame.h"
-#include "media/base/video_util.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/types.h"
-#include "ui/gfx/geometry/size.h"
-
-// TODO(miu): Figure out why _mkdir() and _rmdir() are missing when compiling
-// third_party/ffmpeg/libavformat/os_support.h (lines 182, 183).
-// http://crbug.com/572986
-#if defined(OS_WIN)
-#include <direct.h>
-#include "media/ffmpeg/ffmpeg_common.h"
-#include "media/ffmpeg/ffmpeg_deleters.h"
-#include "media/filters/ffmpeg_glue.h"
-#include "media/filters/in_memory_url_protocol.h"
-#else
-#include "media/ffmpeg/ffmpeg_common.h"
-#include "media/ffmpeg/ffmpeg_deleters.h"
-#include "media/filters/ffmpeg_glue.h"
-#include "media/filters/in_memory_url_protocol.h"
-#endif  // defined(OS_WIN)
-
-namespace {
-
-static const int kSoundFrequency = 440;  // Frequency of sinusoid wave.
-static const float kSoundVolume = 0.10f;
-static const int kAudioFrameMs = 10;  // Each audio frame is exactly 10ms.
-static const int kAudioPacketsPerSecond = 1000 / kAudioFrameMs;
-
-// Bounds for variable frame size mode.
-static const int kMinFakeFrameWidth = 60;
-static const int kMinFakeFrameHeight = 34;
-static const int kStartingFakeFrameWidth = 854;
-static const int kStartingFakeFrameHeight = 480;
-static const int kMaxFakeFrameWidth = 1280;
-static const int kMaxFakeFrameHeight = 720;
-static const int kMaxFrameSizeChangeMillis = 5000;
-
-void AVFreeFrame(AVFrame* frame) { av_frame_free(&frame); }
-
-base::TimeDelta PtsToTimeDelta(int64_t pts, const AVRational& time_base) {
-  return pts * base::TimeDelta::FromSeconds(1) * time_base.num / time_base.den;
-}
-
-int64_t TimeDeltaToPts(base::TimeDelta delta, const AVRational& time_base) {
-  return static_cast<int64_t>(
-      delta.InSecondsF() * time_base.den / time_base.num + 0.5 /* rounding */);
-}
-
-}  // namespace
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-FakeMediaSource::FakeMediaSource(
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner,
-    base::TickClock* clock, const FrameSenderConfig& audio_config,
-    const FrameSenderConfig& video_config, bool keep_frames)
-    : task_runner_(task_runner),
-      output_audio_params_(AudioParameters::AUDIO_PCM_LINEAR,
-                           media::GuessChannelLayout(audio_config.channels),
-                           audio_config.rtp_timebase, 32,
-                           audio_config.rtp_timebase / kAudioPacketsPerSecond),
-      video_config_(video_config),
-      keep_frames_(keep_frames),
-      variable_frame_size_mode_(false),
-      synthetic_count_(0),
-      clock_(clock),
-      audio_frame_count_(0),
-      video_frame_count_(0),
-      av_format_context_(NULL),
-      audio_stream_index_(-1),
-      playback_rate_(1.0),
-      video_stream_index_(-1),
-      video_frame_rate_numerator_(video_config.max_frame_rate),
-      video_frame_rate_denominator_(1),
-      video_first_pts_(0),
-      video_first_pts_set_(false),
-      weak_factory_(this) {
-  CHECK(output_audio_params_.IsValid());
-  audio_bus_factory_.reset(
-      new TestAudioBusFactory(audio_config.channels, audio_config.rtp_timebase,
-                              kSoundFrequency, kSoundVolume));
-}
-
-FakeMediaSource::~FakeMediaSource() {}
-
-void FakeMediaSource::SetSourceFile(const base::FilePath& video_file,
-                                    int final_fps) {
-  DCHECK(!video_file.empty());
-
-  LOG(INFO) << "Source: " << video_file.value();
-  if (!file_data_.Initialize(video_file)) {
-    LOG(ERROR) << "Cannot load file.";
-    return;
-  }
-  protocol_.reset(
-      new InMemoryUrlProtocol(file_data_.data(), file_data_.length(), false));
-  glue_.reset(new FFmpegGlue(protocol_.get()));
-
-  if (!glue_->OpenContext()) {
-    LOG(ERROR) << "Cannot open file.";
-    return;
-  }
-
-  // AVFormatContext is owned by the glue.
-  av_format_context_ = glue_->format_context();
-  if (avformat_find_stream_info(av_format_context_, NULL) < 0) {
-    LOG(ERROR) << "Cannot find stream information.";
-    return;
-  }
-
-  // Prepare FFmpeg decoders.
-  for (unsigned int i = 0; i < av_format_context_->nb_streams; ++i) {
-    AVStream* av_stream = av_format_context_->streams[i];
-    AVCodecContext* av_codec_context = av_stream->codec;
-    AVCodec* av_codec = avcodec_find_decoder(av_codec_context->codec_id);
-
-    if (!av_codec) {
-      LOG(ERROR) << "Cannot find decoder for the codec: "
-                 << av_codec_context->codec_id;
-      continue;
-    }
-
-    // Number of threads for decoding.
-    av_codec_context->thread_count = 2;
-    av_codec_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
-    av_codec_context->request_sample_fmt = AV_SAMPLE_FMT_S16;
-
-    if (avcodec_open2(av_codec_context, av_codec, NULL) < 0) {
-      LOG(ERROR) << "Cannot open AVCodecContext for the codec: "
-                 << av_codec_context->codec_id;
-      return;
-    }
-
-    if (av_codec->type == AVMEDIA_TYPE_AUDIO) {
-      if (av_codec_context->sample_fmt == AV_SAMPLE_FMT_S16P) {
-        LOG(ERROR) << "Audio format not supported.";
-        continue;
-      }
-      ChannelLayout layout = ChannelLayoutToChromeChannelLayout(
-          av_codec_context->channel_layout, av_codec_context->channels);
-      if (layout == CHANNEL_LAYOUT_UNSUPPORTED) {
-        LOG(ERROR) << "Unsupported audio channels layout.";
-        continue;
-      }
-      if (audio_stream_index_ != -1) {
-        LOG(WARNING) << "Found multiple audio streams.";
-      }
-      audio_stream_index_ = static_cast<int>(i);
-      source_audio_params_.Reset(
-          AudioParameters::AUDIO_PCM_LINEAR, layout,
-          av_codec_context->sample_rate,
-          8 * av_get_bytes_per_sample(av_codec_context->sample_fmt),
-          av_codec_context->sample_rate / kAudioPacketsPerSecond);
-      source_audio_params_.set_channels_for_discrete(
-          av_codec_context->channels);
-      CHECK(source_audio_params_.IsValid());
-      LOG(INFO) << "Source file has audio.";
-    } else if (av_codec->type == AVMEDIA_TYPE_VIDEO) {
-      VideoPixelFormat format =
-          AVPixelFormatToVideoPixelFormat(av_codec_context->pix_fmt);
-      if (format != PIXEL_FORMAT_YV12) {
-        LOG(ERROR) << "Cannot handle non YV12 video format: " << format;
-        continue;
-      }
-      if (video_stream_index_ != -1) {
-        LOG(WARNING) << "Found multiple video streams.";
-      }
-      video_stream_index_ = static_cast<int>(i);
-      if (final_fps > 0) {
-        // If video is played at a manual speed audio needs to match.
-        playback_rate_ = 1.0 * final_fps * av_stream->r_frame_rate.den /
-                         av_stream->r_frame_rate.num;
-        video_frame_rate_numerator_ = final_fps;
-        video_frame_rate_denominator_ = 1;
-      } else {
-        playback_rate_ = 1.0;
-        video_frame_rate_numerator_ = av_stream->r_frame_rate.num;
-        video_frame_rate_denominator_ = av_stream->r_frame_rate.den;
-      }
-      LOG(INFO) << "Source file has video.";
-    } else {
-      LOG(ERROR) << "Unknown stream type; ignore.";
-    }
-  }
-
-  Rewind();
-}
-
-void FakeMediaSource::SetVariableFrameSizeMode(bool enabled) {
-  variable_frame_size_mode_ = enabled;
-}
-
-void FakeMediaSource::Start(scoped_refptr<AudioFrameInput> audio_frame_input,
-                            scoped_refptr<VideoFrameInput> video_frame_input) {
-  audio_frame_input_ = audio_frame_input;
-  video_frame_input_ = video_frame_input;
-
-  LOG(INFO) << "Max Frame rate: " << video_config_.max_frame_rate;
-  LOG(INFO) << "Source Frame rate: " << video_frame_rate_numerator_ << "/"
-            << video_frame_rate_denominator_ << " fps.";
-  LOG(INFO) << "Audio playback rate: " << playback_rate_;
-
-  if (start_time_.is_null()) start_time_ = clock_->NowTicks();
-
-  if (!is_transcoding_audio() && !is_transcoding_video()) {
-    // Send fake patterns.
-    task_runner_->PostTask(FROM_HERE,
-                           base::Bind(&FakeMediaSource::SendNextFakeFrame,
-                                      weak_factory_.GetWeakPtr()));
-    return;
-  }
-
-  // Send transcoding streams.
-  audio_algo_.Initialize(source_audio_params_);
-  audio_algo_.FlushBuffers();
-  audio_fifo_input_bus_ =
-      AudioBus::Create(source_audio_params_.channels(),
-                       source_audio_params_.frames_per_buffer());
-  // Audio FIFO can carry all data fron AudioRendererAlgorithm.
-  audio_fifo_.reset(new AudioFifo(source_audio_params_.channels(),
-                                  audio_algo_.QueueCapacity()));
-  audio_converter_.reset(new media::AudioConverter(source_audio_params_,
-                                                   output_audio_params_, true));
-  audio_converter_->AddInput(this);
-  task_runner_->PostTask(FROM_HERE, base::Bind(&FakeMediaSource::SendNextFrame,
-                                               weak_factory_.GetWeakPtr()));
-}
-
-void FakeMediaSource::SendNextFakeFrame() {
-  UpdateNextFrameSize();
-  scoped_refptr<VideoFrame> video_frame =
-      VideoFrame::CreateBlackFrame(current_frame_size_);
-  PopulateVideoFrame(video_frame.get(), synthetic_count_);
-  ++synthetic_count_;
-
-  const base::TimeTicks now = clock_->NowTicks();
-
-  base::TimeDelta video_time = VideoFrameTime(++video_frame_count_);
-  video_frame->set_timestamp(video_time);
-  if (keep_frames_) inserted_video_frame_queue_.push(video_frame);
-  video_frame_input_->InsertRawVideoFrame(video_frame,
-                                          start_time_ + video_time);
-
-  // Send just enough audio data to match next video frame's time.
-  base::TimeDelta audio_time = AudioFrameTime(audio_frame_count_);
-  while (audio_time < video_time) {
-    if (is_transcoding_audio()) {
-      Decode(true);
-      CHECK(!audio_bus_queue_.empty()) << "No audio decoded.";
-      std::unique_ptr<AudioBus> bus(audio_bus_queue_.front());
-      audio_bus_queue_.pop();
-      audio_frame_input_->InsertAudio(std::move(bus), start_time_ + audio_time);
-    } else {
-      audio_frame_input_->InsertAudio(
-          audio_bus_factory_->NextAudioBus(
-              base::TimeDelta::FromMilliseconds(kAudioFrameMs)),
-          start_time_ + audio_time);
-    }
-    audio_time = AudioFrameTime(++audio_frame_count_);
-  }
-
-  // This is the time since FakeMediaSource was started.
-  const base::TimeDelta elapsed_time = now - start_time_;
-
-  // Handle the case when frame generation cannot keep up.
-  // Move the time ahead to match the next frame.
-  while (video_time < elapsed_time) {
-    LOG(WARNING) << "Skipping one frame.";
-    video_time = VideoFrameTime(++video_frame_count_);
-  }
-
-  task_runner_->PostDelayedTask(FROM_HERE,
-                                base::Bind(&FakeMediaSource::SendNextFakeFrame,
-                                           weak_factory_.GetWeakPtr()),
-                                video_time - elapsed_time);
-}
-
-void FakeMediaSource::UpdateNextFrameSize() {
-  if (variable_frame_size_mode_) {
-    bool update_size_change_time = false;
-    if (current_frame_size_.IsEmpty()) {
-      current_frame_size_ =
-          gfx::Size(kStartingFakeFrameWidth, kStartingFakeFrameHeight);
-      update_size_change_time = true;
-    } else if (clock_->NowTicks() >= next_frame_size_change_time_) {
-      current_frame_size_ =
-          gfx::Size(base::RandInt(kMinFakeFrameWidth, kMaxFakeFrameWidth),
-                    base::RandInt(kMinFakeFrameHeight, kMaxFakeFrameHeight));
-      update_size_change_time = true;
-    }
-
-    if (update_size_change_time) {
-      next_frame_size_change_time_ =
-          clock_->NowTicks() +
-          base::TimeDelta::FromMillisecondsD(base::RandDouble() *
-                                             kMaxFrameSizeChangeMillis);
-    }
-  } else {
-    current_frame_size_ =
-        gfx::Size(kStartingFakeFrameWidth, kStartingFakeFrameHeight);
-    next_frame_size_change_time_ = base::TimeTicks();
-  }
-}
-
-bool FakeMediaSource::SendNextTranscodedVideo(base::TimeDelta elapsed_time) {
-  if (!is_transcoding_video()) return false;
-
-  Decode(false);
-  if (video_frame_queue_.empty()) return false;
-
-  const scoped_refptr<VideoFrame> video_frame = video_frame_queue_.front();
-  if (elapsed_time < video_frame->timestamp()) return false;
-  video_frame_queue_.pop();
-
-  // Use the timestamp from the file if we're transcoding.
-  video_frame->set_timestamp(ScaleTimestamp(video_frame->timestamp()));
-  if (keep_frames_) inserted_video_frame_queue_.push(video_frame);
-  video_frame_input_->InsertRawVideoFrame(
-      video_frame, start_time_ + video_frame->timestamp());
-
-  // Make sure queue is not empty.
-  Decode(false);
-  return true;
-}
-
-bool FakeMediaSource::SendNextTranscodedAudio(base::TimeDelta elapsed_time) {
-  if (!is_transcoding_audio()) return false;
-
-  Decode(true);
-  if (audio_bus_queue_.empty()) return false;
-
-  base::TimeDelta audio_time = audio_sent_ts_->GetTimestamp();
-  if (elapsed_time < audio_time) return false;
-  std::unique_ptr<AudioBus> bus(audio_bus_queue_.front());
-  audio_bus_queue_.pop();
-  audio_sent_ts_->AddFrames(bus->frames());
-  audio_frame_input_->InsertAudio(std::move(bus), start_time_ + audio_time);
-
-  // Make sure queue is not empty.
-  Decode(true);
-  return true;
-}
-
-void FakeMediaSource::SendNextFrame() {
-  // Send as much as possible. Audio is sent according to
-  // system time.
-  while (SendNextTranscodedAudio(clock_->NowTicks() - start_time_)) {
-  }
-
-  // Video is sync'ed to audio.
-  while (SendNextTranscodedVideo(audio_sent_ts_->GetTimestamp())) {
-  }
-
-  if (audio_bus_queue_.empty() && video_frame_queue_.empty()) {
-    // Both queues are empty can only mean that we have reached
-    // the end of the stream.
-    LOG(INFO) << "Rewind.";
-    Rewind();
-  }
-
-  // Send next send.
-  task_runner_->PostDelayedTask(
-      FROM_HERE,
-      base::Bind(&FakeMediaSource::SendNextFrame, weak_factory_.GetWeakPtr()),
-      base::TimeDelta::FromMilliseconds(kAudioFrameMs));
-}
-
-base::TimeDelta FakeMediaSource::VideoFrameTime(int frame_number) {
-  return frame_number * base::TimeDelta::FromSeconds(1) *
-         video_frame_rate_denominator_ / video_frame_rate_numerator_;
-}
-
-base::TimeDelta FakeMediaSource::ScaleTimestamp(base::TimeDelta timestamp) {
-  return base::TimeDelta::FromSecondsD(timestamp.InSecondsF() / playback_rate_);
-}
-
-base::TimeDelta FakeMediaSource::AudioFrameTime(int frame_number) {
-  return frame_number * base::TimeDelta::FromMilliseconds(kAudioFrameMs);
-}
-
-void FakeMediaSource::Rewind() {
-  CHECK(av_seek_frame(av_format_context_, -1, 0, AVSEEK_FLAG_BACKWARD) >= 0)
-      << "Failed to rewind to the beginning.";
-}
-
-ScopedAVPacket FakeMediaSource::DemuxOnePacket(bool* audio) {
-  ScopedAVPacket packet(new AVPacket());
-  if (av_read_frame(av_format_context_, packet.get()) < 0) {
-    VLOG(1) << "Failed to read one AVPacket.";
-    packet.reset();
-    return packet;
-  }
-
-  int stream_index = static_cast<int>(packet->stream_index);
-  if (stream_index == audio_stream_index_) {
-    *audio = true;
-  } else if (stream_index == video_stream_index_) {
-    *audio = false;
-  } else {
-    // Ignore unknown packet.
-    LOG(INFO) << "Unknown packet.";
-    packet.reset();
-  }
-  return packet;
-}
-
-void FakeMediaSource::DecodeAudio(ScopedAVPacket packet) {
-  // Audio.
-  AVFrame* avframe = av_frame_alloc();
-
-  // Make a shallow copy of packet so we can slide packet.data as frames are
-  // decoded from the packet; otherwise av_packet_unref() will corrupt memory.
-  AVPacket packet_temp = *packet.get();
-
-  do {
-    int frame_decoded = 0;
-    int result = avcodec_decode_audio4(av_audio_context(), avframe,
-                                       &frame_decoded, &packet_temp);
-    CHECK(result >= 0) << "Failed to decode audio.";
-    packet_temp.size -= result;
-    packet_temp.data += result;
-    if (!frame_decoded) continue;
-
-    int frames_read = avframe->nb_samples;
-    if (frames_read < 0) break;
-
-    if (!audio_sent_ts_) {
-      // Initialize the base time to the first packet in the file.
-      // This is set to the frequency we send to the receiver.
-      // Not the frequency of the source file. This is because we
-      // increment the frame count by samples we sent.
-      audio_sent_ts_.reset(
-          new AudioTimestampHelper(output_audio_params_.sample_rate()));
-      // For some files this is an invalid value.
-      base::TimeDelta base_ts;
-      audio_sent_ts_->SetBaseTimestamp(base_ts);
-    }
-
-    scoped_refptr<AudioBuffer> buffer = AudioBuffer::CopyFrom(
-        AVSampleFormatToSampleFormat(av_audio_context()->sample_fmt,
-                                     av_audio_context()->codec_id),
-        ChannelLayoutToChromeChannelLayout(av_audio_context()->channel_layout,
-                                           av_audio_context()->channels),
-        av_audio_context()->channels, av_audio_context()->sample_rate,
-        frames_read, &avframe->data[0],
-        PtsToTimeDelta(avframe->pkt_pts, av_audio_stream()->time_base));
-    audio_algo_.EnqueueBuffer(buffer);
-    av_frame_unref(avframe);
-  } while (packet_temp.size > 0);
-  av_frame_free(&avframe);
-
-  const int frames_needed_to_scale =
-      playback_rate_ * av_audio_context()->sample_rate / kAudioPacketsPerSecond;
-  while (frames_needed_to_scale <= audio_algo_.frames_buffered()) {
-    if (!audio_algo_.FillBuffer(audio_fifo_input_bus_.get(), 0,
-                                audio_fifo_input_bus_->frames(),
-                                playback_rate_)) {
-      // Nothing can be scaled. Decode some more.
-      return;
-    }
-
-    // Prevent overflow of audio data in the FIFO.
-    if (audio_fifo_input_bus_->frames() + audio_fifo_->frames() <=
-        audio_fifo_->max_frames()) {
-      audio_fifo_->Push(audio_fifo_input_bus_.get());
-    } else {
-      LOG(WARNING) << "Audio FIFO full; dropping samples.";
-    }
-
-    // Make sure there's enough data to resample audio.
-    if (audio_fifo_->frames() <
-        2 * source_audio_params_.sample_rate() / kAudioPacketsPerSecond) {
-      continue;
-    }
-
-    std::unique_ptr<media::AudioBus> resampled_bus(media::AudioBus::Create(
-        output_audio_params_.channels(),
-        output_audio_params_.sample_rate() / kAudioPacketsPerSecond));
-    audio_converter_->Convert(resampled_bus.get());
-    audio_bus_queue_.push(resampled_bus.release());
-  }
-}
-
-void FakeMediaSource::DecodeVideo(ScopedAVPacket packet) {
-  // Video.
-  int got_picture;
-  AVFrame* avframe = av_frame_alloc();
-  CHECK(avcodec_decode_video2(av_video_context(), avframe, &got_picture,
-                              packet.get()) >= 0)
-      << "Video decode error.";
-  if (!got_picture) {
-    av_frame_free(&avframe);
-    return;
-  }
-  gfx::Size size(av_video_context()->width, av_video_context()->height);
-
-  if (!video_first_pts_set_) {
-    video_first_pts_ = avframe->pkt_pts;
-    video_first_pts_set_ = true;
-  }
-  const AVRational& time_base = av_video_stream()->time_base;
-  base::TimeDelta timestamp =
-      PtsToTimeDelta(avframe->pkt_pts - video_first_pts_, time_base);
-  if (timestamp < last_video_frame_timestamp_) {
-    // Stream has rewound.  Rebase |video_first_pts_|.
-    const AVRational& frame_rate = av_video_stream()->r_frame_rate;
-    timestamp = last_video_frame_timestamp_ + (base::TimeDelta::FromSeconds(1) *
-                                               frame_rate.den / frame_rate.num);
-    const int64_t adjustment_pts = TimeDeltaToPts(timestamp, time_base);
-    video_first_pts_ = avframe->pkt_pts - adjustment_pts;
-  }
-
-  scoped_refptr<media::VideoFrame> video_frame =
-      VideoFrame::WrapExternalYuvData(
-          media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size,
-          avframe->linesize[0], avframe->linesize[1], avframe->linesize[2],
-          avframe->data[0], avframe->data[1], avframe->data[2], timestamp);
-  if (!video_frame) return;
-  video_frame_queue_.push(video_frame);
-  video_frame_queue_.back()->AddDestructionObserver(
-      base::Bind(&AVFreeFrame, avframe));
-  last_video_frame_timestamp_ = timestamp;
-}
-
-void FakeMediaSource::Decode(bool decode_audio) {
-  // Read the stream until one video frame can be decoded.
-  while (true) {
-    if (decode_audio && !audio_bus_queue_.empty()) return;
-    if (!decode_audio && !video_frame_queue_.empty()) return;
-
-    bool audio_packet = false;
-    ScopedAVPacket packet = DemuxOnePacket(&audio_packet);
-    if (!packet) {
-      VLOG(1) << "End of stream.";
-      return;
-    }
-
-    if (audio_packet)
-      DecodeAudio(std::move(packet));
-    else
-      DecodeVideo(std::move(packet));
-  }
-}
-
-double FakeMediaSource::ProvideInput(media::AudioBus* output_bus,
-                                     uint32_t frames_delayed) {
-  if (audio_fifo_->frames() >= output_bus->frames()) {
-    audio_fifo_->Consume(output_bus, 0, output_bus->frames());
-    return 1.0;
-  } else {
-    LOG(WARNING) << "Not enough audio data for resampling.";
-    output_bus->Zero();
-    return 0.0;
-  }
-}
-
-scoped_refptr<media::VideoFrame>
-FakeMediaSource::PopOldestInsertedVideoFrame() {
-  CHECK(!inserted_video_frame_queue_.empty());
-  scoped_refptr<media::VideoFrame> video_frame =
-      inserted_video_frame_queue_.front();
-  inserted_video_frame_queue_.pop();
-  return video_frame;
-}
-
-AVStream* FakeMediaSource::av_audio_stream() {
-  return av_format_context_->streams[audio_stream_index_];
-}
-
-AVStream* FakeMediaSource::av_video_stream() {
-  return av_format_context_->streams[video_stream_index_];
-}
-
-AVCodecContext* FakeMediaSource::av_audio_context() {
-  return av_audio_stream()->codec;
-}
-
-AVCodecContext* FakeMediaSource::av_video_context() {
-  return av_video_stream()->codec;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/fake_media_source.h b/src/cobalt/media/cast/test/fake_media_source.h
deleted file mode 100644
index 8acaddb..0000000
--- a/src/cobalt/media/cast/test/fake_media_source.h
+++ /dev/null
@@ -1,177 +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.
-
-// A fake media source that generates video and audio frames to a cast
-// sender.
-// This class can transcode a WebM file using FFmpeg. It can also
-// generate an animation and audio of fixed frequency.
-
-#ifndef COBALT_MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
-#define COBALT_MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
-
-#include <queue>
-
-#include "base/files/file_path.h"
-#include "base/files/memory_mapped_file.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/single_thread_task_runner.h"
-#include "base/time/tick_clock.h"
-#include "media/base/audio_converter.h"
-#include "media/base/audio_parameters.h"
-#include "media/cast/cast_config.h"
-#include "media/filters/audio_renderer_algorithm.h"
-#include "media/filters/ffmpeg_demuxer.h"
-#include "starboard/types.h"
-
-struct AVCodecContext;
-struct AVFormatContext;
-
-namespace cobalt {
-namespace media {
-
-class AudioBus;
-class AudioConverter;
-class AudioFifo;
-class AudioTimestampHelper;
-class FFmpegGlue;
-class InMemoryUrlProtocol;
-class VideoFrame;
-
-namespace cast {
-
-class AudioFrameInput;
-class VideoFrameInput;
-class TestAudioBusFactory;
-
-class FakeMediaSource : public media::AudioConverter::InputCallback {
- public:
-  // |task_runner| is to schedule decoding tasks.
-  // |clock| is used by this source but is not owned.
-  // |audio_config| is the desired audio config.
-  // |video_config| is the desired video config.
-  // |keep_frames| is true if all VideoFrames are saved in a queue.
-  FakeMediaSource(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
-                  base::TickClock* clock, const FrameSenderConfig& audio_config,
-                  const FrameSenderConfig& video_config, bool keep_frames);
-  ~FakeMediaSource() final;
-
-  // Transcode this file as the source of video and audio frames.
-  // If |final_fps| is non zero then the file is played at the desired rate.
-  void SetSourceFile(const base::FilePath& video_file, int final_fps);
-
-  // Set to true to randomly change the frame size at random points in time.
-  // Only applies when SetSourceFile() is not used.
-  void SetVariableFrameSizeMode(bool enabled);
-
-  void Start(scoped_refptr<AudioFrameInput> audio_frame_input,
-             scoped_refptr<VideoFrameInput> video_frame_input);
-
-  const FrameSenderConfig& get_video_config() const { return video_config_; }
-
-  scoped_refptr<media::VideoFrame> PopOldestInsertedVideoFrame();
-
- private:
-  bool is_transcoding_audio() const { return audio_stream_index_ >= 0; }
-  bool is_transcoding_video() const { return video_stream_index_ >= 0; }
-
-  void SendNextFrame();
-  void SendNextFakeFrame();
-
-  void UpdateNextFrameSize();
-
-  // Return true if a frame was sent.
-  bool SendNextTranscodedVideo(base::TimeDelta elapsed_time);
-
-  // Return true if a frame was sent.
-  bool SendNextTranscodedAudio(base::TimeDelta elapsed_time);
-
-  // Helper methods to compute timestamps for the frame number specified.
-  base::TimeDelta VideoFrameTime(int frame_number);
-
-  base::TimeDelta ScaleTimestamp(base::TimeDelta timestamp);
-
-  base::TimeDelta AudioFrameTime(int frame_number);
-
-  // Go to the beginning of the stream.
-  void Rewind();
-
-  // Call FFmpeg to fetch one packet.
-  ScopedAVPacket DemuxOnePacket(bool* audio);
-
-  void DecodeAudio(ScopedAVPacket packet);
-  void DecodeVideo(ScopedAVPacket packet);
-  void Decode(bool decode_audio);
-
-  // media::AudioConverter::InputCallback implementation.
-  double ProvideInput(media::AudioBus* output_bus,
-                      uint32_t frames_delayed) final;
-
-  AVStream* av_audio_stream();
-  AVStream* av_video_stream();
-  AVCodecContext* av_audio_context();
-  AVCodecContext* av_video_context();
-
-  const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  const media::AudioParameters output_audio_params_;
-  const FrameSenderConfig video_config_;
-  const bool keep_frames_;
-  bool variable_frame_size_mode_;
-  gfx::Size current_frame_size_;
-  base::TimeTicks next_frame_size_change_time_;
-  scoped_refptr<AudioFrameInput> audio_frame_input_;
-  scoped_refptr<VideoFrameInput> video_frame_input_;
-  uint8_t synthetic_count_;
-  base::TickClock* const clock_;  // Not owned by this class.
-
-  // Time when the stream starts.
-  base::TimeTicks start_time_;
-
-  // The following three members are used only for fake frames.
-  int audio_frame_count_;  // Each audio frame is exactly 10ms.
-  int video_frame_count_;
-  std::unique_ptr<TestAudioBusFactory> audio_bus_factory_;
-
-  base::MemoryMappedFile file_data_;
-  std::unique_ptr<InMemoryUrlProtocol> protocol_;
-  std::unique_ptr<FFmpegGlue> glue_;
-  AVFormatContext* av_format_context_;
-
-  int audio_stream_index_;
-  AudioParameters source_audio_params_;
-  double playback_rate_;
-
-  int video_stream_index_;
-  int video_frame_rate_numerator_;
-  int video_frame_rate_denominator_;
-
-  // These are used for audio resampling.
-  std::unique_ptr<media::AudioConverter> audio_converter_;
-  std::unique_ptr<media::AudioFifo> audio_fifo_;
-  std::unique_ptr<media::AudioBus> audio_fifo_input_bus_;
-  media::AudioRendererAlgorithm audio_algo_;
-
-  // Track the timestamp of audio sent to the receiver.
-  std::unique_ptr<media::AudioTimestampHelper> audio_sent_ts_;
-
-  std::queue<scoped_refptr<VideoFrame> > video_frame_queue_;
-  std::queue<scoped_refptr<VideoFrame> > inserted_video_frame_queue_;
-  int64_t video_first_pts_;
-  bool video_first_pts_set_;
-  base::TimeDelta last_video_frame_timestamp_;
-
-  std::queue<AudioBus*> audio_bus_queue_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<FakeMediaSource> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(FakeMediaSource);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
diff --git a/src/cobalt/media/cast/test/fake_receiver_time_offset_estimator.cc b/src/cobalt/media/cast/test/fake_receiver_time_offset_estimator.cc
deleted file mode 100644
index 027016e..0000000
--- a/src/cobalt/media/cast/test/fake_receiver_time_offset_estimator.cc
+++ /dev/null
@@ -1,38 +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.
-
-#include "media/cast/test/fake_receiver_time_offset_estimator.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-FakeReceiverTimeOffsetEstimator::FakeReceiverTimeOffsetEstimator(
-    base::TimeDelta offset)
-    : offset_(offset) {}
-
-FakeReceiverTimeOffsetEstimator::~FakeReceiverTimeOffsetEstimator() {}
-
-void FakeReceiverTimeOffsetEstimator::OnReceiveFrameEvent(
-    const FrameEvent& frame_event) {
-  // Do nothing.
-}
-
-void FakeReceiverTimeOffsetEstimator::OnReceivePacketEvent(
-    const PacketEvent& packet_event) {
-  // Do nothing.
-}
-
-bool FakeReceiverTimeOffsetEstimator::GetReceiverOffsetBounds(
-    base::TimeDelta* lower_bound, base::TimeDelta* upper_bound) {
-  *lower_bound = offset_;
-  *upper_bound = offset_;
-  return true;
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/fake_receiver_time_offset_estimator.h b/src/cobalt/media/cast/test/fake_receiver_time_offset_estimator.h
deleted file mode 100644
index c15c2d3..0000000
--- a/src/cobalt/media/cast/test/fake_receiver_time_offset_estimator.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_FAKE_RECEIVER_TIME_OFFSET_ESTIMATOR_H_
-#define COBALT_MEDIA_CAST_TEST_FAKE_RECEIVER_TIME_OFFSET_ESTIMATOR_H_
-
-#include "base/macros.h"
-#include "base/threading/thread_checker.h"
-#include "base/time/time.h"
-#include "media/cast/logging/logging_defines.h"
-#include "media/cast/logging/receiver_time_offset_estimator.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-// This class is used for testing. It will always return the |offset| value
-// provided during construction as offset bounds.
-class FakeReceiverTimeOffsetEstimator : public ReceiverTimeOffsetEstimator {
- public:
-  FakeReceiverTimeOffsetEstimator(base::TimeDelta offset);
-
-  ~FakeReceiverTimeOffsetEstimator() final;
-
-  // RawReventSubscriber implementations.
-  void OnReceiveFrameEvent(const FrameEvent& frame_event) final;
-  void OnReceivePacketEvent(const PacketEvent& packet_event) final;
-
-  // ReceiverTimeOffsetEstimator
-  bool GetReceiverOffsetBounds(base::TimeDelta* lower_bound,
-                               base::TimeDelta* upper_bound) final;
-
- private:
-  const base::TimeDelta offset_;
-  DISALLOW_COPY_AND_ASSIGN(FakeReceiverTimeOffsetEstimator);
-};
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_FAKE_RECEIVER_TIME_OFFSET_ESTIMATOR_H_
diff --git a/src/cobalt/media/cast/test/loopback_transport.cc b/src/cobalt/media/cast/test/loopback_transport.cc
deleted file mode 100644
index 49f11e1..0000000
--- a/src/cobalt/media/cast/test/loopback_transport.cc
+++ /dev/null
@@ -1,76 +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.
-
-#include "media/cast/test/loopback_transport.h"
-
-#include <utility>
-
-#include "base/macros.h"
-#include "base/single_thread_task_runner.h"
-#include "base/time/tick_clock.h"
-#include "media/cast/test/utility/udp_proxy.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace {
-
-// Shim that turns forwards packets from a test::PacketPipe to a
-// PacketReceiverCallback.
-class LoopBackPacketPipe : public test::PacketPipe {
- public:
-  explicit LoopBackPacketPipe(const PacketReceiverCallback& packet_receiver)
-      : packet_receiver_(packet_receiver) {}
-
-  ~LoopBackPacketPipe() final {}
-
-  // PacketPipe implementations.
-  void Send(std::unique_ptr<Packet> packet) final {
-    packet_receiver_.Run(std::move(packet));
-  }
-
- private:
-  PacketReceiverCallback packet_receiver_;
-
-  DISALLOW_COPY_AND_ASSIGN(LoopBackPacketPipe);
-};
-
-}  // namespace
-
-LoopBackTransport::LoopBackTransport(
-    scoped_refptr<CastEnvironment> cast_environment)
-    : cast_environment_(cast_environment), bytes_sent_(0) {}
-
-LoopBackTransport::~LoopBackTransport() {}
-
-bool LoopBackTransport::SendPacket(PacketRef packet, const base::Closure& cb) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  std::unique_ptr<Packet> packet_copy(new Packet(packet->data));
-  packet_pipe_->Send(std::move(packet_copy));
-  bytes_sent_ += packet->data.size();
-  return true;
-}
-
-int64_t LoopBackTransport::GetBytesSent() { return bytes_sent_; }
-
-void LoopBackTransport::Initialize(
-    std::unique_ptr<test::PacketPipe> pipe,
-    const PacketReceiverCallback& packet_receiver,
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-    base::TickClock* clock) {
-  std::unique_ptr<test::PacketPipe> loopback_pipe(
-      new LoopBackPacketPipe(packet_receiver));
-  if (pipe) {
-    // Append the loopback pipe to the end.
-    pipe->AppendToPipe(std::move(loopback_pipe));
-    packet_pipe_ = std::move(pipe);
-  } else {
-    packet_pipe_ = std::move(loopback_pipe);
-  }
-  packet_pipe_->InitOnIOThread(task_runner, clock);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/loopback_transport.h b/src/cobalt/media/cast/test/loopback_transport.h
deleted file mode 100644
index 8becb0f..0000000
--- a/src/cobalt/media/cast/test/loopback_transport.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_
-#define COBALT_MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "starboard/types.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-class TickClock;
-}  // namespace base
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-namespace test {
-class PacketPipe;
-}  // namespace test
-
-// Class that sends the packet to a receiver through a stack of PacketPipes.
-class LoopBackTransport : public PacketTransport {
- public:
-  explicit LoopBackTransport(scoped_refptr<CastEnvironment> cast_environment);
-  ~LoopBackTransport() final;
-
-  bool SendPacket(PacketRef packet, const base::Closure& cb) final;
-
-  int64_t GetBytesSent() final;
-
-  void StartReceiving(
-      const PacketReceiverCallbackWithStatus& packet_receiver) final {}
-
-  void StopReceiving() final {}
-
-  // Initiailize this loopback transport.
-  // Establish a flow of packets from |pipe| to |packet_receiver|.
-  //
-  // The data flow looks like:
-  // SendPacket() -> |pipe| -> Fake loopback pipe -> |packet_receiver|.
-  //
-  // If |pipe| is NULL then the data flow looks like:
-  // SendPacket() -> Fake loopback pipe -> |packet_receiver|.
-  void Initialize(
-      std::unique_ptr<test::PacketPipe> pipe,
-      const PacketReceiverCallback& packet_receiver,
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock);
-
- private:
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  std::unique_ptr<test::PacketPipe> packet_pipe_;
-  int64_t bytes_sent_;
-
-  DISALLOW_COPY_AND_ASSIGN(LoopBackTransport);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_
diff --git a/src/cobalt/media/cast/test/proto/BUILD.gn b/src/cobalt/media/cast/test/proto/BUILD.gn
deleted file mode 100644
index 53ba0e2..0000000
--- a/src/cobalt/media/cast/test/proto/BUILD.gn
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//third_party/protobuf/proto_library.gni")
-
-source_set("proto") {
-  public_deps = [
-    ":cast_network_simulation_proto",
-  ]
-  public_configs = [ "//third_party/protobuf:protobuf_config" ]
-}
-
-proto_library("cast_network_simulation_proto") {
-  visibility = [ ":proto" ]
-  sources = [
-    "network_simulation_model.proto",
-  ]
-}
diff --git a/src/cobalt/media/cast/test/proto/network_simulation_model.proto b/src/cobalt/media/cast/test/proto/network_simulation_model.proto
deleted file mode 100644
index 4785da3..0000000
--- a/src/cobalt/media/cast/test/proto/network_simulation_model.proto
+++ /dev/null
@@ -1,30 +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.
-
-// Contains parameters for a network simulation model.
-
-syntax = "proto2";
-
-option optimize_for = LITE_RUNTIME;
-
-package media.cast.proto;
-
-message NetworkSimulationModel {
-  optional NetworkSimulationModelType type = 1;
-  optional IPPModel ipp = 2;
-}
-
-enum NetworkSimulationModelType {
-  // Network simulation based on interrupted poisson process.
-  INTERRUPTED_POISSON_PROCESS = 1;
-
-  // No network simulation.
-  NO_SIMULATION = 2;
-}
-
-message IPPModel {
-  optional double coef_burstiness = 1;
-  optional double coef_variance = 2;
-  repeated double average_rate = 3;
-}
diff --git a/src/cobalt/media/cast/test/receiver.cc b/src/cobalt/media/cast/test/receiver.cc
deleted file mode 100644
index f28fec1..0000000
--- a/src/cobalt/media/cast/test/receiver.cc
+++ /dev/null
@@ -1,598 +0,0 @@
-// Copyright 2013 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 <limits.h>
-
-#include <algorithm>
-#include <climits>
-#include <cstdarg>
-#include <cstdio>
-#include <deque>
-#include <map>
-#include <memory>
-#include <string>
-#include <utility>
-
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/synchronization/lock.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread.h"
-#include "base/time/default_tick_clock.h"
-#include "base/time/time.h"
-#include "base/timer/timer.h"
-#include "media/audio/audio_io.h"
-#include "media/audio/audio_manager.h"
-#include "media/audio/fake_audio_log_factory.h"
-#include "media/base/audio_bus.h"
-#include "media/base/audio_parameters.h"
-#include "media/base/channel_layout.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/logging/logging_defines.h"
-#include "media/cast/net/udp_transport.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "media/cast/test/utility/barcode.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/in_process_receiver.h"
-#include "media/cast/test/utility/input_builder.h"
-#include "media/cast/test/utility/standalone_cast_environment.h"
-#include "net/base/ip_address.h"
-#include "starboard/types.h"
-
-#if defined(USE_X11)
-#include "media/cast/test/linux_output_window.h"
-#endif  // defined(USE_X11)
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Settings chosen to match default sender settings.
-#define DEFAULT_SEND_PORT "0"
-#define DEFAULT_RECEIVE_PORT "2344"
-#define DEFAULT_SEND_IP "0.0.0.0"
-#define DEFAULT_AUDIO_FEEDBACK_SSRC "2"
-#define DEFAULT_AUDIO_INCOMING_SSRC "1"
-#define DEFAULT_VIDEO_FEEDBACK_SSRC "12"
-#define DEFAULT_VIDEO_INCOMING_SSRC "11"
-
-#if defined(USE_X11)
-const char* kVideoWindowWidth = "1280";
-const char* kVideoWindowHeight = "720";
-#endif  // defined(USE_X11)
-
-void GetPorts(uint16_t* tx_port, uint16_t* rx_port) {
-  test::InputBuilder tx_input("Enter send port.", DEFAULT_SEND_PORT, 1, 65535);
-  *tx_port = static_cast<uint16_t>(tx_input.GetIntInput());
-
-  test::InputBuilder rx_input("Enter receive port.", DEFAULT_RECEIVE_PORT, 1,
-                              65535);
-  *rx_port = static_cast<uint16_t>(rx_input.GetIntInput());
-}
-
-std::string GetIpAddress(const std::string& display_text) {
-  test::InputBuilder input(display_text, DEFAULT_SEND_IP, INT_MIN, INT_MAX);
-  std::string ip_address = input.GetStringInput();
-  // Ensure IP address is either the default value or in correct form.
-  while (ip_address != DEFAULT_SEND_IP &&
-         std::count(ip_address.begin(), ip_address.end(), '.') != 3) {
-    ip_address = input.GetStringInput();
-  }
-  return ip_address;
-}
-
-void GetAudioSsrcs(FrameReceiverConfig* audio_config) {
-  test::InputBuilder input_tx("Choose audio sender SSRC.",
-                              DEFAULT_AUDIO_FEEDBACK_SSRC, 1, INT_MAX);
-  audio_config->receiver_ssrc = input_tx.GetIntInput();
-
-  test::InputBuilder input_rx("Choose audio receiver SSRC.",
-                              DEFAULT_AUDIO_INCOMING_SSRC, 1, INT_MAX);
-  audio_config->sender_ssrc = input_rx.GetIntInput();
-}
-
-void GetVideoSsrcs(FrameReceiverConfig* video_config) {
-  test::InputBuilder input_tx("Choose video sender SSRC.",
-                              DEFAULT_VIDEO_FEEDBACK_SSRC, 1, INT_MAX);
-  video_config->receiver_ssrc = input_tx.GetIntInput();
-
-  test::InputBuilder input_rx("Choose video receiver SSRC.",
-                              DEFAULT_VIDEO_INCOMING_SSRC, 1, INT_MAX);
-  video_config->sender_ssrc = input_rx.GetIntInput();
-}
-
-#if defined(USE_X11)
-void GetWindowSize(int* width, int* height) {
-  // Resolution values based on sender settings
-  test::InputBuilder input_w("Choose window width.", kVideoWindowWidth, 144,
-                             1920);
-  *width = input_w.GetIntInput();
-
-  test::InputBuilder input_h("Choose window height.", kVideoWindowHeight, 176,
-                             1080);
-  *height = input_h.GetIntInput();
-}
-#endif  // defined(USE_X11)
-
-void GetAudioPayloadtype(FrameReceiverConfig* audio_config) {
-  test::InputBuilder input(
-      "Choose audio receiver payload type.",
-      std::to_string(static_cast<int>(RtpPayloadType::AUDIO_OPUS)),
-      static_cast<int>(RtpPayloadType::AUDIO_OPUS) /* low_range */,
-      static_cast<int>(RtpPayloadType::AUDIO_LAST) /* high_range */);
-  audio_config->rtp_payload_type =
-      static_cast<RtpPayloadType>(input.GetIntInput());
-}
-
-FrameReceiverConfig GetAudioReceiverConfig() {
-  FrameReceiverConfig audio_config = GetDefaultAudioReceiverConfig();
-  GetAudioSsrcs(&audio_config);
-  GetAudioPayloadtype(&audio_config);
-  audio_config.rtp_max_delay_ms = 300;
-  return audio_config;
-}
-
-void GetVideoPayloadtype(FrameReceiverConfig* video_config) {
-  test::InputBuilder input(
-      "Choose video receiver payload type.",
-      std::to_string(static_cast<int>(RtpPayloadType::VIDEO_VP8)),
-      static_cast<int>(RtpPayloadType::VIDEO_VP8) /* low_range */,
-      static_cast<int>(RtpPayloadType::LAST) /* high_range */);
-  video_config->rtp_payload_type =
-      static_cast<RtpPayloadType>(input.GetIntInput());
-}
-
-FrameReceiverConfig GetVideoReceiverConfig() {
-  FrameReceiverConfig video_config = GetDefaultVideoReceiverConfig();
-  GetVideoSsrcs(&video_config);
-  GetVideoPayloadtype(&video_config);
-  video_config.rtp_max_delay_ms = 300;
-  return video_config;
-}
-
-AudioParameters ToAudioParameters(const FrameReceiverConfig& config) {
-  const int samples_in_10ms = config.rtp_timebase / 100;
-  return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
-                         GuessChannelLayout(config.channels),
-                         config.rtp_timebase, 32, samples_in_10ms);
-}
-
-// An InProcessReceiver that renders video frames to a LinuxOutputWindow and
-// audio frames via Chromium's audio stack.
-//
-// InProcessReceiver pushes audio and video frames to this subclass, and these
-// frames are pushed into a queue.  Then, for audio, the Chromium audio stack
-// will make polling calls on a separate, unknown thread whereby audio frames
-// are pulled out of the audio queue as needed.  For video, however, NaivePlayer
-// is responsible for scheduling updates to the screen itself.  For both, the
-// queues are pruned (i.e., received frames are skipped) when the system is not
-// able to play back as fast as frames are entering the queue.
-//
-// This is NOT a good reference implementation for a Cast receiver player since:
-// 1. It only skips frames to handle slower-than-expected playout, or halts
-//    playback to handle frame underruns.
-// 2. It makes no attempt to synchronize the timing of playout of the video
-//    frames with the audio frames.
-// 3. It does nothing to smooth or hide discontinuities in playback due to
-//    timing issues or missing frames.
-class NaivePlayer : public InProcessReceiver,
-                    public AudioOutputStream::AudioSourceCallback {
- public:
-  NaivePlayer(const scoped_refptr<CastEnvironment>& cast_environment,
-              const net::IPEndPoint& local_end_point,
-              const net::IPEndPoint& remote_end_point,
-              const FrameReceiverConfig& audio_config,
-              const FrameReceiverConfig& video_config, int window_width,
-              int window_height)
-      : InProcessReceiver(cast_environment, local_end_point, remote_end_point,
-                          audio_config, video_config),
-        // Maximum age is the duration of 3 video frames.  3 was chosen
-        // arbitrarily, but seems to work well.
-        max_frame_age_(base::TimeDelta::FromSeconds(1) * 3 /
-                       video_config.target_frame_rate),
-#if defined(USE_X11)
-        render_(0, 0, window_width, window_height, "Cast_receiver"),
-#endif  // defined(USE_X11)
-        num_video_frames_processed_(0),
-        num_audio_frames_processed_(0),
-        currently_playing_audio_frame_start_(-1) {
-  }
-
-  ~NaivePlayer() final {}
-
-  void Start() final {
-    AudioManager::Get()->GetTaskRunner()->PostTask(
-        FROM_HERE,
-        base::Bind(&NaivePlayer::StartAudioOutputOnAudioManagerThread,
-                   base::Unretained(this)));
-    // Note: No need to wait for audio polling to start since the push-and-pull
-    // mechanism is synchronized via the |audio_playout_queue_|.
-    InProcessReceiver::Start();
-  }
-
-  void Stop() final {
-    // First, stop audio output to the Chromium audio stack.
-    base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
-                             base::WaitableEvent::InitialState::NOT_SIGNALED);
-    DCHECK(!AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
-    AudioManager::Get()->GetTaskRunner()->PostTask(
-        FROM_HERE, base::Bind(&NaivePlayer::StopAudioOutputOnAudioManagerThread,
-                              base::Unretained(this), &done));
-    done.Wait();
-
-    // Now, stop receiving new frames.
-    InProcessReceiver::Stop();
-
-    // Finally, clear out any frames remaining in the queues.
-    while (!audio_playout_queue_.empty()) {
-      const std::unique_ptr<AudioBus> to_be_deleted(
-          audio_playout_queue_.front().second);
-      audio_playout_queue_.pop_front();
-    }
-    video_playout_queue_.clear();
-  }
-
- private:
-  void StartAudioOutputOnAudioManagerThread() {
-    DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
-    DCHECK(!audio_output_stream_);
-    audio_output_stream_.reset(AudioManager::Get()->MakeAudioOutputStreamProxy(
-        ToAudioParameters(audio_config()), ""));
-    if (audio_output_stream_.get() && audio_output_stream_->Open()) {
-      audio_output_stream_->Start(this);
-    } else {
-      LOG(ERROR) << "Failed to open an audio output stream.  "
-                 << "Audio playback disabled.";
-      audio_output_stream_.reset();
-    }
-  }
-
-  void StopAudioOutputOnAudioManagerThread(base::WaitableEvent* done) {
-    DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
-    if (audio_output_stream_.get()) {
-      audio_output_stream_->Stop();
-      audio_output_stream_->Close();
-      audio_output_stream_.reset();
-    }
-    done->Signal();
-  }
-
-  ////////////////////////////////////////////////////////////////////
-  // InProcessReceiver finals.
-
-  void OnVideoFrame(const scoped_refptr<VideoFrame>& video_frame,
-                    const base::TimeTicks& playout_time,
-                    bool is_continuous) final {
-    DCHECK(cast_env()->CurrentlyOn(CastEnvironment::MAIN));
-    LOG_IF(WARNING, !is_continuous)
-        << "Video: Discontinuity in received frames.";
-    video_playout_queue_.push_back(std::make_pair(playout_time, video_frame));
-    ScheduleVideoPlayout();
-    uint16_t frame_no;
-    if (media::cast::test::DecodeBarcode(video_frame, &frame_no)) {
-      video_play_times_.insert(
-          std::pair<uint16_t, base::TimeTicks>(frame_no, playout_time));
-    } else {
-      VLOG(2) << "Barcode decode failed!";
-    }
-  }
-
-  void OnAudioFrame(std::unique_ptr<AudioBus> audio_frame,
-                    const base::TimeTicks& playout_time,
-                    bool is_continuous) final {
-    DCHECK(cast_env()->CurrentlyOn(CastEnvironment::MAIN));
-    LOG_IF(WARNING, !is_continuous)
-        << "Audio: Discontinuity in received frames.";
-    base::AutoLock auto_lock(audio_lock_);
-    uint16_t frame_no;
-    if (media::cast::DecodeTimestamp(audio_frame->channel(0),
-                                     audio_frame->frames(), &frame_no)) {
-      // Since there are lots of audio packets with the same frame_no,
-      // we really want to make sure that we get the playout_time from
-      // the first one. If is_continous is true, then it's possible
-      // that we already missed the first one.
-      if (is_continuous && frame_no == last_audio_frame_no_ + 1) {
-        audio_play_times_.insert(
-            std::pair<uint16_t, base::TimeTicks>(frame_no, playout_time));
-      }
-      last_audio_frame_no_ = frame_no;
-    } else {
-      VLOG(2) << "Audio decode failed!";
-      last_audio_frame_no_ = -2;
-    }
-    audio_playout_queue_.push_back(
-        std::make_pair(playout_time, audio_frame.release()));
-  }
-
-  // End of InProcessReceiver finals.
-  ////////////////////////////////////////////////////////////////////
-
-  ////////////////////////////////////////////////////////////////////
-  // AudioSourceCallback implementation.
-
-  int OnMoreData(base::TimeDelta /* delay */,
-                 base::TimeTicks /* delay_timestamp */,
-                 int /* prior_frames_skipped */, AudioBus* dest) final {
-    // Note: This method is being invoked by a separate thread unknown to us
-    // (i.e., outside of CastEnvironment).
-
-    int samples_remaining = dest->frames();
-
-    while (samples_remaining > 0) {
-      // Get next audio frame ready for playout.
-      if (!currently_playing_audio_frame_.get()) {
-        base::AutoLock auto_lock(audio_lock_);
-
-        // Prune the queue, skipping entries that are too old.
-        // TODO(miu): Use |total_bytes_delay| to account for audio buffering
-        // delays upstream.
-        const base::TimeTicks earliest_time_to_play =
-            cast_env()->Clock()->NowTicks() - max_frame_age_;
-        while (!audio_playout_queue_.empty() &&
-               audio_playout_queue_.front().first < earliest_time_to_play) {
-          PopOneAudioFrame(true);
-        }
-        if (audio_playout_queue_.empty()) break;
-
-        currently_playing_audio_frame_ = PopOneAudioFrame(false);
-        currently_playing_audio_frame_start_ = 0;
-      }
-
-      // Copy some or all of the samples in |currently_playing_audio_frame_| to
-      // |dest|.  Once all samples in |currently_playing_audio_frame_| have been
-      // consumed, release it.
-      const int num_samples_to_copy =
-          std::min(samples_remaining, currently_playing_audio_frame_->frames() -
-                                          currently_playing_audio_frame_start_);
-      currently_playing_audio_frame_->CopyPartialFramesTo(
-          currently_playing_audio_frame_start_, num_samples_to_copy, 0, dest);
-      samples_remaining -= num_samples_to_copy;
-      currently_playing_audio_frame_start_ += num_samples_to_copy;
-      if (currently_playing_audio_frame_start_ ==
-          currently_playing_audio_frame_->frames()) {
-        currently_playing_audio_frame_.reset();
-      }
-    }
-
-    // If |dest| has not been fully filled, then an underrun has occurred; and
-    // fill the remainder of |dest| with zeros.
-    if (samples_remaining > 0) {
-      // Note: Only logging underruns after the first frame has been received.
-      LOG_IF(WARNING, currently_playing_audio_frame_start_ != -1)
-          << "Audio: Playback underrun of " << samples_remaining << " samples!";
-      dest->ZeroFramesPartial(dest->frames() - samples_remaining,
-                              samples_remaining);
-    }
-
-    return dest->frames();
-  }
-
-  void OnError(AudioOutputStream* stream) final {
-    LOG(ERROR) << "AudioOutputStream reports an error.  "
-               << "Playback is unlikely to continue.";
-  }
-
-  // End of AudioSourceCallback implementation.
-  ////////////////////////////////////////////////////////////////////
-
-  void ScheduleVideoPlayout() {
-    DCHECK(cast_env()->CurrentlyOn(CastEnvironment::MAIN));
-
-    // Prune the queue, skipping entries that are too old.
-    const base::TimeTicks now = cast_env()->Clock()->NowTicks();
-    const base::TimeTicks earliest_time_to_play = now - max_frame_age_;
-    while (!video_playout_queue_.empty() &&
-           video_playout_queue_.front().first < earliest_time_to_play) {
-      PopOneVideoFrame(true);
-    }
-
-    // If the queue is not empty, schedule playout of its first frame.
-    if (video_playout_queue_.empty()) {
-      video_playout_timer_.Stop();
-    } else {
-      video_playout_timer_.Start(
-          FROM_HERE, video_playout_queue_.front().first - now,
-          base::Bind(&NaivePlayer::PlayNextVideoFrame, base::Unretained(this)));
-    }
-  }
-
-  void PlayNextVideoFrame() {
-    DCHECK(cast_env()->CurrentlyOn(CastEnvironment::MAIN));
-    if (!video_playout_queue_.empty()) {
-      const scoped_refptr<VideoFrame> video_frame = PopOneVideoFrame(false);
-#if defined(USE_X11)
-      render_.RenderFrame(video_frame);
-#endif  // defined(USE_X11)
-    }
-    ScheduleVideoPlayout();
-    CheckAVSync();
-  }
-
-  scoped_refptr<VideoFrame> PopOneVideoFrame(bool is_being_skipped) {
-    DCHECK(cast_env()->CurrentlyOn(CastEnvironment::MAIN));
-
-    if (is_being_skipped) {
-      VLOG(1) << "VideoFrame[" << num_video_frames_processed_ << " (dt="
-              << (video_playout_queue_.front().first -
-                  last_popped_video_playout_time_)
-                     .InMicroseconds()
-              << " usec)]: Skipped.";
-    } else {
-      VLOG(1) << "VideoFrame[" << num_video_frames_processed_ << " (dt="
-              << (video_playout_queue_.front().first -
-                  last_popped_video_playout_time_)
-                     .InMicroseconds()
-              << " usec)]: Playing "
-              << (cast_env()->Clock()->NowTicks() -
-                  video_playout_queue_.front().first)
-                     .InMicroseconds()
-              << " usec later than intended.";
-    }
-
-    last_popped_video_playout_time_ = video_playout_queue_.front().first;
-    const scoped_refptr<VideoFrame> ret = video_playout_queue_.front().second;
-    video_playout_queue_.pop_front();
-    ++num_video_frames_processed_;
-    return ret;
-  }
-
-  std::unique_ptr<AudioBus> PopOneAudioFrame(bool was_skipped) {
-    audio_lock_.AssertAcquired();
-
-    if (was_skipped) {
-      VLOG(1) << "AudioFrame[" << num_audio_frames_processed_ << " (dt="
-              << (audio_playout_queue_.front().first -
-                  last_popped_audio_playout_time_)
-                     .InMicroseconds()
-              << " usec)]: Skipped.";
-    } else {
-      VLOG(1) << "AudioFrame[" << num_audio_frames_processed_ << " (dt="
-              << (audio_playout_queue_.front().first -
-                  last_popped_audio_playout_time_)
-                     .InMicroseconds()
-              << " usec)]: Playing "
-              << (cast_env()->Clock()->NowTicks() -
-                  audio_playout_queue_.front().first)
-                     .InMicroseconds()
-              << " usec later than intended.";
-    }
-
-    last_popped_audio_playout_time_ = audio_playout_queue_.front().first;
-    std::unique_ptr<AudioBus> ret(audio_playout_queue_.front().second);
-    audio_playout_queue_.pop_front();
-    ++num_audio_frames_processed_;
-    return ret;
-  }
-
-  void CheckAVSync() {
-    if (video_play_times_.size() > 30 && audio_play_times_.size() > 30) {
-      size_t num_events = 0;
-      base::TimeDelta delta;
-      std::map<uint16_t, base::TimeTicks>::iterator audio_iter, video_iter;
-      for (video_iter = video_play_times_.begin();
-           video_iter != video_play_times_.end(); ++video_iter) {
-        audio_iter = audio_play_times_.find(video_iter->first);
-        if (audio_iter != audio_play_times_.end()) {
-          num_events++;
-          // Positive values means audio is running behind video.
-          delta += audio_iter->second - video_iter->second;
-        }
-      }
-
-      if (num_events > 30) {
-        VLOG(0) << "Audio behind by: " << (delta / num_events).InMilliseconds()
-                << "ms";
-        video_play_times_.clear();
-        audio_play_times_.clear();
-      }
-    } else if (video_play_times_.size() + audio_play_times_.size() > 500) {
-      // We are decoding audio or video timestamps, but not both, clear it out.
-      video_play_times_.clear();
-      audio_play_times_.clear();
-    }
-  }
-
-  // Frames in the queue older than this (relative to NowTicks()) will be
-  // dropped (i.e., playback is falling behind).
-  const base::TimeDelta max_frame_age_;
-
-// Outputs created, started, and destroyed by this NaivePlayer.
-#if defined(USE_X11)
-  test::LinuxOutputWindow render_;
-#endif  // defined(USE_X11)
-  std::unique_ptr<AudioOutputStream> audio_output_stream_;
-
-  // Video playout queue.
-  typedef std::pair<base::TimeTicks, scoped_refptr<VideoFrame> >
-      VideoQueueEntry;
-  std::deque<VideoQueueEntry> video_playout_queue_;
-  base::TimeTicks last_popped_video_playout_time_;
-  int64_t num_video_frames_processed_;
-
-  base::OneShotTimer video_playout_timer_;
-
-  // Audio playout queue, synchronized by |audio_lock_|.
-  base::Lock audio_lock_;
-  typedef std::pair<base::TimeTicks, AudioBus*> AudioQueueEntry;
-  std::deque<AudioQueueEntry> audio_playout_queue_;
-  base::TimeTicks last_popped_audio_playout_time_;
-  int64_t num_audio_frames_processed_;
-
-  // These must only be used on the audio thread calling OnMoreData().
-  std::unique_ptr<AudioBus> currently_playing_audio_frame_;
-  int currently_playing_audio_frame_start_;
-
-  std::map<uint16_t, base::TimeTicks> audio_play_times_;
-  std::map<uint16_t, base::TimeTicks> video_play_times_;
-  int32_t last_audio_frame_no_;
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-  InitLogging(logging::LoggingSettings());
-  base::MessageLoop message_loop;
-
-  scoped_refptr<media::cast::CastEnvironment> cast_environment(
-      new media::cast::StandaloneCastEnvironment);
-
-  // Start up Chromium audio system.
-  const media::ScopedAudioManagerPtr audio_manager(
-      media::AudioManager::CreateForTesting(
-          base::ThreadTaskRunnerHandle::Get()));
-  CHECK(media::AudioManager::Get());
-
-  media::cast::FrameReceiverConfig audio_config =
-      media::cast::GetAudioReceiverConfig();
-  media::cast::FrameReceiverConfig video_config =
-      media::cast::GetVideoReceiverConfig();
-
-  // Determine local and remote endpoints.
-  uint16_t remote_port, local_port;
-  media::cast::GetPorts(&remote_port, &local_port);
-  if (!local_port) {
-    LOG(ERROR) << "Invalid local port.";
-    return 1;
-  }
-  std::string remote_ip_address = media::cast::GetIpAddress("Enter remote IP.");
-  std::string local_ip_address = media::cast::GetIpAddress("Enter local IP.");
-  net::IPAddress remote_ip;
-  net::IPAddress local_ip;
-  if (!remote_ip.AssignFromIPLiteral(remote_ip_address)) {
-    LOG(ERROR) << "Invalid remote IP address.";
-    return 1;
-  }
-  if (!local_ip.AssignFromIPLiteral(local_ip_address)) {
-    LOG(ERROR) << "Invalid local IP address.";
-    return 1;
-  }
-  net::IPEndPoint remote_end_point(remote_ip, remote_port);
-  net::IPEndPoint local_end_point(local_ip, local_port);
-
-  // Create and start the player.
-  int window_width = 0;
-  int window_height = 0;
-#if defined(USE_X11)
-  media::cast::GetWindowSize(&window_width, &window_height);
-#endif  // defined(USE_X11)
-  media::cast::NaivePlayer player(cast_environment, local_end_point,
-                                  remote_end_point, audio_config, video_config,
-                                  window_width, window_height);
-  player.Start();
-
-  base::RunLoop().Run();  // Run forever (i.e., until SIGTERM).
-  NOTREACHED();
-  return 0;
-}
diff --git a/src/cobalt/media/cast/test/sender.cc b/src/cobalt/media/cast/test/sender.cc
deleted file mode 100644
index 0b2bf9e..0000000
--- a/src/cobalt/media/cast/test/sender.cc
+++ /dev/null
@@ -1,343 +0,0 @@
-// Copyright 2013 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.
-
-// Test application that simulates a cast sender - Data can be either generated
-// or read from a file.
-
-#include <memory>
-#include <queue>
-#include <utility>
-
-#include "base/at_exit.h"
-#include "base/base_paths.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/json/json_writer.h"
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-#include "base/path_service.h"
-#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/threading/thread.h"
-#include "base/time/default_tick_clock.h"
-#include "base/values.h"
-#include "media/base/media.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/logging/encoding_event_subscriber.h"
-#include "media/cast/logging/log_serializer.h"
-#include "media/cast/logging/logging_defines.h"
-#include "media/cast/logging/proto/raw_events.pb.h"
-#include "media/cast/logging/receiver_time_offset_estimator_impl.h"
-#include "media/cast/logging/stats_event_subscriber.h"
-#include "media/cast/net/cast_transport.h"
-#include "media/cast/net/cast_transport_defines.h"
-#include "media/cast/net/udp_transport.h"
-#include "media/cast/test/fake_media_source.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/input_builder.h"
-#include "starboard/types.h"
-
-namespace {
-
-// The max allowed size of serialized log.
-const int kMaxSerializedLogBytes = 10 * 1000 * 1000;
-
-// Flags for this program:
-//
-// --address=xx.xx.xx.xx
-//   IP address of receiver.
-//
-// --port=xxxx
-//   Port number of receiver.
-//
-// --source-file=xxx.webm
-//   WebM file as source of video frames.
-//
-// --fps=xx
-//   Override framerate of the video stream.
-//
-// --vary-frame-sizes
-//   Randomly vary the video frame sizes at random points in time.  Has no
-//   effect if --source-file is being used.
-const char kSwitchAddress[] = "address";
-const char kSwitchPort[] = "port";
-const char kSwitchSourceFile[] = "source-file";
-const char kSwitchFps[] = "fps";
-const char kSwitchVaryFrameSizes[] = "vary-frame-sizes";
-
-void UpdateCastTransportStatus(media::cast::CastTransportStatus status) {
-  VLOG(1) << "Transport status: " << status;
-}
-
-void QuitLoopOnInitializationResult(media::cast::OperationalStatus result) {
-  CHECK(result == media::cast::STATUS_INITIALIZED)
-      << "Cast sender uninitialized";
-  base::MessageLoop::current()->QuitWhenIdle();
-}
-
-net::IPEndPoint CreateUDPAddress(const std::string& ip_str, uint16_t port) {
-  net::IPAddress ip_address;
-  CHECK(ip_address.AssignFromIPLiteral(ip_str));
-  return net::IPEndPoint(ip_address, port);
-}
-
-void DumpLoggingData(const media::cast::proto::LogMetadata& log_metadata,
-                     const media::cast::FrameEventList& frame_events,
-                     const media::cast::PacketEventList& packet_events,
-                     base::ScopedFILE log_file) {
-  VLOG(0) << "Frame map size: " << frame_events.size();
-  VLOG(0) << "Packet map size: " << packet_events.size();
-
-  std::unique_ptr<char[]> event_log(new char[kMaxSerializedLogBytes]);
-  int event_log_bytes;
-  if (!media::cast::SerializeEvents(log_metadata, frame_events, packet_events,
-                                    true, kMaxSerializedLogBytes,
-                                    event_log.get(), &event_log_bytes)) {
-    VLOG(0) << "Failed to serialize events.";
-    return;
-  }
-
-  VLOG(0) << "Events serialized length: " << event_log_bytes;
-
-  int ret = fwrite(event_log.get(), 1, event_log_bytes, log_file.get());
-  if (ret != event_log_bytes) VLOG(0) << "Failed to write logs to file.";
-}
-
-void WriteLogsToFileAndDestroySubscribers(
-    const scoped_refptr<media::cast::CastEnvironment>& cast_environment,
-    std::unique_ptr<media::cast::EncodingEventSubscriber>
-        video_event_subscriber,
-    std::unique_ptr<media::cast::EncodingEventSubscriber>
-        audio_event_subscriber,
-    base::ScopedFILE video_log_file, base::ScopedFILE audio_log_file) {
-  cast_environment->logger()->Unsubscribe(video_event_subscriber.get());
-  cast_environment->logger()->Unsubscribe(audio_event_subscriber.get());
-
-  VLOG(0) << "Dumping logging data for video stream.";
-  media::cast::proto::LogMetadata log_metadata;
-  media::cast::FrameEventList frame_events;
-  media::cast::PacketEventList packet_events;
-  video_event_subscriber->GetEventsAndReset(&log_metadata, &frame_events,
-                                            &packet_events);
-
-  DumpLoggingData(log_metadata, frame_events, packet_events,
-                  std::move(video_log_file));
-
-  VLOG(0) << "Dumping logging data for audio stream.";
-  audio_event_subscriber->GetEventsAndReset(&log_metadata, &frame_events,
-                                            &packet_events);
-
-  DumpLoggingData(log_metadata, frame_events, packet_events,
-                  std::move(audio_log_file));
-}
-
-void WriteStatsAndDestroySubscribers(
-    const scoped_refptr<media::cast::CastEnvironment>& cast_environment,
-    std::unique_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber,
-    std::unique_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber,
-    std::unique_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl> estimator) {
-  cast_environment->logger()->Unsubscribe(video_stats_subscriber.get());
-  cast_environment->logger()->Unsubscribe(audio_stats_subscriber.get());
-  cast_environment->logger()->Unsubscribe(estimator.get());
-
-  std::unique_ptr<base::DictionaryValue> stats =
-      video_stats_subscriber->GetStats();
-  std::string json;
-  base::JSONWriter::WriteWithOptions(
-      *stats, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
-  VLOG(0) << "Video stats: " << json;
-
-  stats = audio_stats_subscriber->GetStats();
-  json.clear();
-  base::JSONWriter::WriteWithOptions(
-      *stats, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
-  VLOG(0) << "Audio stats: " << json;
-}
-
-class TransportClient : public media::cast::CastTransport::Client {
- public:
-  explicit TransportClient(
-      media::cast::LogEventDispatcher* log_event_dispatcher)
-      : log_event_dispatcher_(log_event_dispatcher) {}
-
-  void OnStatusChanged(media::cast::CastTransportStatus status) final {
-    VLOG(1) << "Transport status: " << status;
-  };
-  void OnLoggingEventsReceived(
-      std::unique_ptr<std::vector<media::cast::FrameEvent>> frame_events,
-      std::unique_ptr<std::vector<media::cast::PacketEvent>> packet_events)
-      final {
-    DCHECK(log_event_dispatcher_);
-    log_event_dispatcher_->DispatchBatchOfEvents(std::move(frame_events),
-                                                 std::move(packet_events));
-  };
-  void ProcessRtpPacket(std::unique_ptr<media::cast::Packet> packet) final {}
-
- private:
-  media::cast::LogEventDispatcher* const
-      log_event_dispatcher_;  // Not owned by this class.
-
-  DISALLOW_COPY_AND_ASSIGN(TransportClient);
-};
-
-}  // namespace
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-  InitLogging(logging::LoggingSettings());
-
-  // Prepare media module for FFmpeg decoding.
-  media::InitializeMediaLibrary();
-
-  base::Thread test_thread("Cast sender test app thread");
-  base::Thread audio_thread("Cast audio encoder thread");
-  base::Thread video_thread("Cast video encoder thread");
-  test_thread.Start();
-  audio_thread.Start();
-  video_thread.Start();
-
-  base::MessageLoopForIO io_message_loop;
-
-  // Default parameters.
-  base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
-  std::string remote_ip_address = cmd->GetSwitchValueASCII(kSwitchAddress);
-  if (remote_ip_address.empty()) remote_ip_address = "127.0.0.1";
-  int remote_port = 0;
-  if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchPort), &remote_port) ||
-      remote_port < 0 || remote_port > 65535) {
-    remote_port = 2344;
-  }
-  LOG(INFO) << "Sending to " << remote_ip_address << ":" << remote_port << ".";
-
-  media::cast::FrameSenderConfig audio_config =
-      media::cast::GetDefaultAudioSenderConfig();
-  media::cast::FrameSenderConfig video_config =
-      media::cast::GetDefaultVideoSenderConfig();
-
-  // Running transport on the main thread.
-  // Setting up transport config.
-  net::IPEndPoint remote_endpoint =
-      CreateUDPAddress(remote_ip_address, static_cast<uint16_t>(remote_port));
-
-  // Enable raw event and stats logging.
-  // Running transport on the main thread.
-  scoped_refptr<media::cast::CastEnvironment> cast_environment(
-      new media::cast::CastEnvironment(
-          base::WrapUnique<base::TickClock>(new base::DefaultTickClock()),
-          io_message_loop.task_runner(), audio_thread.task_runner(),
-          video_thread.task_runner()));
-
-  // SendProcess initialization.
-  std::unique_ptr<media::cast::FakeMediaSource> fake_media_source(
-      new media::cast::FakeMediaSource(test_thread.task_runner(),
-                                       cast_environment->Clock(), audio_config,
-                                       video_config, false));
-
-  int final_fps = 0;
-  if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchFps), &final_fps)) {
-    final_fps = 0;
-  }
-  base::FilePath source_path = cmd->GetSwitchValuePath(kSwitchSourceFile);
-  if (!source_path.empty()) {
-    LOG(INFO) << "Source: " << source_path.value();
-    fake_media_source->SetSourceFile(source_path, final_fps);
-  }
-  if (cmd->HasSwitch(kSwitchVaryFrameSizes))
-    fake_media_source->SetVariableFrameSizeMode(true);
-
-  // CastTransport initialization.
-  std::unique_ptr<media::cast::CastTransport> transport_sender =
-      media::cast::CastTransport::Create(
-          cast_environment->Clock(), base::TimeDelta::FromSeconds(1),
-          base::MakeUnique<TransportClient>(cast_environment->logger()),
-          base::MakeUnique<media::cast::UdpTransport>(
-              nullptr, io_message_loop.task_runner(), net::IPEndPoint(),
-              remote_endpoint, base::Bind(&UpdateCastTransportStatus)),
-          io_message_loop.task_runner());
-
-  // Set up event subscribers.
-  std::unique_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber;
-  std::unique_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber;
-  std::string video_log_file_name("/tmp/video_events.log.gz");
-  std::string audio_log_file_name("/tmp/audio_events.log.gz");
-  LOG(INFO) << "Logging audio events to: " << audio_log_file_name;
-  LOG(INFO) << "Logging video events to: " << video_log_file_name;
-  video_event_subscriber.reset(new media::cast::EncodingEventSubscriber(
-      media::cast::VIDEO_EVENT, 10000));
-  audio_event_subscriber.reset(new media::cast::EncodingEventSubscriber(
-      media::cast::AUDIO_EVENT, 10000));
-  cast_environment->logger()->Subscribe(video_event_subscriber.get());
-  cast_environment->logger()->Subscribe(audio_event_subscriber.get());
-
-  // Subscribers for stats.
-  std::unique_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl>
-      offset_estimator(new media::cast::ReceiverTimeOffsetEstimatorImpl());
-  cast_environment->logger()->Subscribe(offset_estimator.get());
-  std::unique_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber(
-      new media::cast::StatsEventSubscriber(media::cast::VIDEO_EVENT,
-                                            cast_environment->Clock(),
-                                            offset_estimator.get()));
-  std::unique_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber(
-      new media::cast::StatsEventSubscriber(media::cast::AUDIO_EVENT,
-                                            cast_environment->Clock(),
-                                            offset_estimator.get()));
-  cast_environment->logger()->Subscribe(video_stats_subscriber.get());
-  cast_environment->logger()->Subscribe(audio_stats_subscriber.get());
-
-  base::ScopedFILE video_log_file(fopen(video_log_file_name.c_str(), "w"));
-  if (!video_log_file) {
-    VLOG(1) << "Failed to open video log file for writing.";
-    exit(-1);
-  }
-
-  base::ScopedFILE audio_log_file(fopen(audio_log_file_name.c_str(), "w"));
-  if (!audio_log_file) {
-    VLOG(1) << "Failed to open audio log file for writing.";
-    exit(-1);
-  }
-
-  const int logging_duration_seconds = 10;
-  io_message_loop.task_runner()->PostDelayedTask(
-      FROM_HERE,
-      base::Bind(&WriteLogsToFileAndDestroySubscribers, cast_environment,
-                 base::Passed(&video_event_subscriber),
-                 base::Passed(&audio_event_subscriber),
-                 base::Passed(&video_log_file), base::Passed(&audio_log_file)),
-      base::TimeDelta::FromSeconds(logging_duration_seconds));
-
-  io_message_loop.task_runner()->PostDelayedTask(
-      FROM_HERE, base::Bind(&WriteStatsAndDestroySubscribers, cast_environment,
-                            base::Passed(&video_stats_subscriber),
-                            base::Passed(&audio_stats_subscriber),
-                            base::Passed(&offset_estimator)),
-      base::TimeDelta::FromSeconds(logging_duration_seconds));
-
-  // CastSender initialization.
-  std::unique_ptr<media::cast::CastSender> cast_sender =
-      media::cast::CastSender::Create(cast_environment, transport_sender.get());
-  io_message_loop.task_runner()->PostTask(
-      FROM_HERE,
-      base::Bind(&media::cast::CastSender::InitializeVideo,
-                 base::Unretained(cast_sender.get()),
-                 fake_media_source->get_video_config(),
-                 base::Bind(&QuitLoopOnInitializationResult),
-                 media::cast::CreateDefaultVideoEncodeAcceleratorCallback(),
-                 media::cast::CreateDefaultVideoEncodeMemoryCallback()));
-  base::RunLoop().Run();  // Wait for video initialization.
-  io_message_loop.task_runner()->PostTask(
-      FROM_HERE, base::Bind(&media::cast::CastSender::InitializeAudio,
-                            base::Unretained(cast_sender.get()), audio_config,
-                            base::Bind(&QuitLoopOnInitializationResult)));
-  base::RunLoop().Run();  // Wait for audio initialization.
-
-  fake_media_source->Start(cast_sender->audio_frame_input(),
-                           cast_sender->video_frame_input());
-  base::RunLoop().Run();
-  return 0;
-}
diff --git a/src/cobalt/media/cast/test/simulator.cc b/src/cobalt/media/cast/test/simulator.cc
deleted file mode 100644
index 428afb4..0000000
--- a/src/cobalt/media/cast/test/simulator.cc
+++ /dev/null
@@ -1,719 +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.
-
-// Simulate end to end streaming.
-//
-// Input:
-// --source=
-//   WebM used as the source of video and audio frames.
-// --output=
-//   File path to writing out the raw event log of the simulation session.
-// --sim-id=
-//   Unique simulation ID.
-// --target-delay-ms=
-//   Target playout delay to configure (integer number of milliseconds).
-//   Optional; default is 400.
-// --max-frame-rate=
-//   The maximum frame rate allowed at any time during the Cast session.
-//   Optional; default is 30.
-// --source-frame-rate=
-//   Overrides the playback rate; the source video will play faster/slower.
-// --run-time=
-//   In seconds, how long the Cast session runs for.
-//   Optional; default is 180.
-// --metrics-output=
-//   File path to write PSNR and SSIM metrics between source frames and
-//   decoded frames. Assumes all encoded frames are decoded.
-// --yuv-output=
-//   File path to write YUV decoded frames in YUV4MPEG2 format.
-// --no-simulation
-//   Do not run network simulation.
-//
-// Output:
-// - Raw event log of the simulation session tagged with the unique test ID,
-//   written out to the specified file path.
-
-#include <utility>
-
-#include "base/at_exit.h"
-#include "base/base_paths.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/files/memory_mapped_file.h"
-#include "base/files/scoped_file.h"
-#include "base/json/json_writer.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/path_service.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/stringprintf.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/time/tick_clock.h"
-#include "base/values.h"
-#include "media/base/audio_bus.h"
-#include "media/base/fake_single_thread_task_runner.h"
-#include "media/base/media.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/cast_sender.h"
-#include "media/cast/logging/encoding_event_subscriber.h"
-#include "media/cast/logging/log_serializer.h"
-#include "media/cast/logging/logging_defines.h"
-#include "media/cast/logging/proto/raw_events.pb.h"
-#include "media/cast/logging/raw_event_subscriber_bundle.h"
-#include "media/cast/logging/simple_event_subscriber.h"
-#include "media/cast/net/cast_transport.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/net/cast_transport_defines.h"
-#include "media/cast/net/cast_transport_impl.h"
-#include "media/cast/test/fake_media_source.h"
-#include "media/cast/test/loopback_transport.h"
-#include "media/cast/test/proto/network_simulation_model.pb.h"
-#include "media/cast/test/skewed_tick_clock.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "media/cast/test/utility/default_config.h"
-#include "media/cast/test/utility/test_util.h"
-#include "media/cast/test/utility/udp_proxy.h"
-#include "media/cast/test/utility/video_utility.h"
-#include "starboard/types.h"
-
-using media::cast::proto::IPPModel;
-using media::cast::proto::NetworkSimulationModel;
-using media::cast::proto::NetworkSimulationModelType;
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace {
-const char kLibDir[] = "lib-dir";
-const char kModelPath[] = "model";
-const char kMetricsOutputPath[] = "metrics-output";
-const char kOutputPath[] = "output";
-const char kMaxFrameRate[] = "max-frame-rate";
-const char kNoSimulation[] = "no-simulation";
-const char kRunTime[] = "run-time";
-const char kSimulationId[] = "sim-id";
-const char kSourcePath[] = "source";
-const char kSourceFrameRate[] = "source-frame-rate";
-const char kTargetDelay[] = "target-delay-ms";
-const char kYuvOutputPath[] = "yuv-output";
-
-int GetIntegerSwitchValue(const char* switch_name, int default_value) {
-  const std::string as_str =
-      base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switch_name);
-  if (as_str.empty()) return default_value;
-  int as_int;
-  CHECK(base::StringToInt(as_str, &as_int));
-  CHECK_GT(as_int, 0);
-  return as_int;
-}
-
-void LogAudioOperationalStatus(OperationalStatus status) {
-  LOG(INFO) << "Audio status: " << status;
-}
-
-void LogVideoOperationalStatus(OperationalStatus status) {
-  LOG(INFO) << "Video status: " << status;
-}
-
-struct PacketProxy {
-  PacketProxy() : receiver(NULL) {}
-  void ReceivePacket(std::unique_ptr<Packet> packet) {
-    if (receiver) receiver->ReceivePacket(std::move(packet));
-  }
-  CastReceiver* receiver;
-};
-
-class TransportClient : public CastTransport::Client {
- public:
-  TransportClient(LogEventDispatcher* log_event_dispatcher,
-                  PacketProxy* packet_proxy)
-      : log_event_dispatcher_(log_event_dispatcher),
-        packet_proxy_(packet_proxy) {}
-
-  void OnStatusChanged(CastTransportStatus status) final {
-    LOG(INFO) << "Cast transport status: " << status;
-  };
-  void OnLoggingEventsReceived(
-      std::unique_ptr<std::vector<FrameEvent>> frame_events,
-      std::unique_ptr<std::vector<PacketEvent>> packet_events) final {
-    DCHECK(log_event_dispatcher_);
-    log_event_dispatcher_->DispatchBatchOfEvents(std::move(frame_events),
-                                                 std::move(packet_events));
-  };
-  void ProcessRtpPacket(std::unique_ptr<Packet> packet) final {
-    if (packet_proxy_) packet_proxy_->ReceivePacket(std::move(packet));
-  };
-
- private:
-  LogEventDispatcher* const log_event_dispatcher_;  // Not owned by this class.
-  PacketProxy* const packet_proxy_;                 // Not owned by this class.
-
-  DISALLOW_COPY_AND_ASSIGN(TransportClient);
-};
-
-// Maintains a queue of encoded video frames.
-// This works by tracking FRAME_CAPTURE_END and FRAME_ENCODED events.
-// If a video frame is detected to be encoded it transfers a frame
-// from FakeMediaSource to its internal queue. Otherwise it drops a
-// frame from FakeMediaSource.
-class EncodedVideoFrameTracker : public RawEventSubscriber {
- public:
-  explicit EncodedVideoFrameTracker(FakeMediaSource* media_source)
-      : media_source_(media_source), last_frame_event_type_(UNKNOWN) {}
-  ~EncodedVideoFrameTracker() final {}
-
-  // RawEventSubscriber implementations.
-  void OnReceiveFrameEvent(const FrameEvent& frame_event) final {
-    // This method only cares about video FRAME_CAPTURE_END and
-    // FRAME_ENCODED events.
-    if (frame_event.media_type != VIDEO_EVENT) {
-      return;
-    }
-    if (frame_event.type != FRAME_CAPTURE_END &&
-        frame_event.type != FRAME_ENCODED) {
-      return;
-    }
-    // If there are two consecutive FRAME_CAPTURE_END events that means
-    // a frame is dropped.
-    if (last_frame_event_type_ == FRAME_CAPTURE_END &&
-        frame_event.type == FRAME_CAPTURE_END) {
-      media_source_->PopOldestInsertedVideoFrame();
-    }
-    if (frame_event.type == FRAME_ENCODED) {
-      video_frames_.push(media_source_->PopOldestInsertedVideoFrame());
-    }
-    last_frame_event_type_ = frame_event.type;
-  }
-
-  void OnReceivePacketEvent(const PacketEvent& packet_event) final {
-    // Don't care.
-  }
-
-  scoped_refptr<media::VideoFrame> PopOldestEncodedFrame() {
-    CHECK(!video_frames_.empty());
-    scoped_refptr<media::VideoFrame> video_frame = video_frames_.front();
-    video_frames_.pop();
-    return video_frame;
-  }
-
- private:
-  FakeMediaSource* media_source_;
-  CastLoggingEvent last_frame_event_type_;
-  std::queue<scoped_refptr<media::VideoFrame>> video_frames_;
-
-  DISALLOW_COPY_AND_ASSIGN(EncodedVideoFrameTracker);
-};
-
-// Appends a YUV frame in I420 format to the file located at |path|.
-void AppendYuvToFile(const base::FilePath& path,
-                     scoped_refptr<media::VideoFrame> frame) {
-  // Write YUV420 format to file.
-  std::string header;
-  base::StringAppendF(&header, "FRAME W%d H%d\n", frame->coded_size().width(),
-                      frame->coded_size().height());
-  AppendToFile(path, header.data(), header.size());
-  AppendToFile(path,
-               reinterpret_cast<char*>(frame->data(media::VideoFrame::kYPlane)),
-               frame->stride(media::VideoFrame::kYPlane) *
-                   frame->rows(media::VideoFrame::kYPlane));
-  AppendToFile(path,
-               reinterpret_cast<char*>(frame->data(media::VideoFrame::kUPlane)),
-               frame->stride(media::VideoFrame::kUPlane) *
-                   frame->rows(media::VideoFrame::kUPlane));
-  AppendToFile(path,
-               reinterpret_cast<char*>(frame->data(media::VideoFrame::kVPlane)),
-               frame->stride(media::VideoFrame::kVPlane) *
-                   frame->rows(media::VideoFrame::kVPlane));
-}
-
-// A container to save output of GotVideoFrame() for computation based
-// on output frames.
-struct GotVideoFrameOutput {
-  GotVideoFrameOutput() : counter(0) {}
-  int counter;
-  std::vector<double> psnr;
-  std::vector<double> ssim;
-};
-
-void GotVideoFrame(GotVideoFrameOutput* metrics_output,
-                   const base::FilePath& yuv_output,
-                   EncodedVideoFrameTracker* video_frame_tracker,
-                   CastReceiver* cast_receiver,
-                   const scoped_refptr<media::VideoFrame>& video_frame,
-                   const base::TimeTicks& render_time, bool continuous) {
-  ++metrics_output->counter;
-  cast_receiver->RequestDecodedVideoFrame(
-      base::Bind(&GotVideoFrame, metrics_output, yuv_output,
-                 video_frame_tracker, cast_receiver));
-
-  // If |video_frame_tracker| is available that means we're computing
-  // quality metrices.
-  if (video_frame_tracker) {
-    scoped_refptr<media::VideoFrame> src_frame =
-        video_frame_tracker->PopOldestEncodedFrame();
-    metrics_output->psnr.push_back(I420PSNR(src_frame, video_frame));
-    metrics_output->ssim.push_back(I420SSIM(src_frame, video_frame));
-  }
-
-  if (!yuv_output.empty()) {
-    AppendYuvToFile(yuv_output, video_frame);
-  }
-}
-
-void GotAudioFrame(int* counter, CastReceiver* cast_receiver,
-                   std::unique_ptr<AudioBus> audio_bus,
-                   const base::TimeTicks& playout_time, bool is_continuous) {
-  ++*counter;
-  cast_receiver->RequestDecodedAudioFrame(
-      base::Bind(&GotAudioFrame, counter, cast_receiver));
-}
-
-// Serialize |frame_events| and |packet_events| and append to the file
-// located at |output_path|.
-void AppendLogToFile(media::cast::proto::LogMetadata* metadata,
-                     const media::cast::FrameEventList& frame_events,
-                     const media::cast::PacketEventList& packet_events,
-                     const base::FilePath& output_path) {
-  media::cast::proto::GeneralDescription* gen_desc =
-      metadata->mutable_general_description();
-  gen_desc->set_product("Cast Simulator");
-  gen_desc->set_product_version("0.1");
-
-  std::unique_ptr<char[]> serialized_log(
-      new char[media::cast::kMaxSerializedBytes]);
-  int output_bytes;
-  bool success = media::cast::SerializeEvents(
-      *metadata, frame_events, packet_events, true,
-      media::cast::kMaxSerializedBytes, serialized_log.get(), &output_bytes);
-
-  if (!success) {
-    LOG(ERROR) << "Failed to serialize log.";
-    return;
-  }
-
-  if (!AppendToFile(output_path, serialized_log.get(), output_bytes)) {
-    LOG(ERROR) << "Failed to append to log.";
-  }
-}
-
-// Run simulation once.
-//
-// |log_output_path| is the path to write serialized log.
-// |extra_data| is extra tagging information to write to log.
-void RunSimulation(const base::FilePath& source_path,
-                   const base::FilePath& log_output_path,
-                   const base::FilePath& metrics_output_path,
-                   const base::FilePath& yuv_output_path,
-                   const std::string& extra_data,
-                   const NetworkSimulationModel& model) {
-  // Fake clock. Make sure start time is non zero.
-  base::SimpleTestTickClock testing_clock;
-  testing_clock.Advance(base::TimeDelta::FromSeconds(1));
-
-  // Task runner.
-  scoped_refptr<FakeSingleThreadTaskRunner> task_runner =
-      new FakeSingleThreadTaskRunner(&testing_clock);
-  base::ThreadTaskRunnerHandle task_runner_handle(task_runner);
-
-  // CastEnvironments.
-  scoped_refptr<CastEnvironment> sender_env =
-      new CastEnvironment(std::unique_ptr<base::TickClock>(
-                              new test::SkewedTickClock(&testing_clock)),
-                          task_runner, task_runner, task_runner);
-  scoped_refptr<CastEnvironment> receiver_env =
-      new CastEnvironment(std::unique_ptr<base::TickClock>(
-                              new test::SkewedTickClock(&testing_clock)),
-                          task_runner, task_runner, task_runner);
-
-  // Event subscriber. Store at most 1 hour of events.
-  EncodingEventSubscriber audio_event_subscriber(AUDIO_EVENT, 100 * 60 * 60);
-  EncodingEventSubscriber video_event_subscriber(VIDEO_EVENT, 30 * 60 * 60);
-  sender_env->logger()->Subscribe(&audio_event_subscriber);
-  sender_env->logger()->Subscribe(&video_event_subscriber);
-
-  // Audio sender config.
-  FrameSenderConfig audio_sender_config = GetDefaultAudioSenderConfig();
-  audio_sender_config.min_playout_delay =
-      audio_sender_config.max_playout_delay = base::TimeDelta::FromMilliseconds(
-          GetIntegerSwitchValue(kTargetDelay, 400));
-
-  // Audio receiver config.
-  FrameReceiverConfig audio_receiver_config = GetDefaultAudioReceiverConfig();
-  audio_receiver_config.rtp_max_delay_ms =
-      audio_sender_config.max_playout_delay.InMilliseconds();
-
-  // Video sender config.
-  FrameSenderConfig video_sender_config = GetDefaultVideoSenderConfig();
-  video_sender_config.max_bitrate = 2500000;
-  video_sender_config.min_bitrate = 2000000;
-  video_sender_config.start_bitrate = 2000000;
-  video_sender_config.min_playout_delay =
-      video_sender_config.max_playout_delay =
-          audio_sender_config.max_playout_delay;
-  video_sender_config.max_frame_rate = GetIntegerSwitchValue(kMaxFrameRate, 30);
-
-  // Video receiver config.
-  FrameReceiverConfig video_receiver_config = GetDefaultVideoReceiverConfig();
-  video_receiver_config.rtp_max_delay_ms =
-      video_sender_config.max_playout_delay.InMilliseconds();
-
-  // Loopback transport. Owned by CastTransport.
-  LoopBackTransport* receiver_to_sender = new LoopBackTransport(receiver_env);
-  LoopBackTransport* sender_to_receiver = new LoopBackTransport(sender_env);
-
-  PacketProxy packet_proxy;
-
-  // Cast receiver.
-  std::unique_ptr<CastTransport> transport_receiver(new CastTransportImpl(
-      &testing_clock, base::TimeDelta::FromSeconds(1),
-      base::MakeUnique<TransportClient>(receiver_env->logger(), &packet_proxy),
-      base::WrapUnique(receiver_to_sender), task_runner));
-  std::unique_ptr<CastReceiver> cast_receiver(
-      CastReceiver::Create(receiver_env, audio_receiver_config,
-                           video_receiver_config, transport_receiver.get()));
-
-  packet_proxy.receiver = cast_receiver.get();
-
-  // Cast sender and transport sender.
-  std::unique_ptr<CastTransport> transport_sender(new CastTransportImpl(
-      &testing_clock, base::TimeDelta::FromSeconds(1),
-      base::MakeUnique<TransportClient>(sender_env->logger(), nullptr),
-      base::WrapUnique(sender_to_receiver), task_runner));
-  std::unique_ptr<CastSender> cast_sender(
-      CastSender::Create(sender_env, transport_sender.get()));
-
-  // Initialize network simulation model.
-  const bool use_network_simulation =
-      model.type() == media::cast::proto::INTERRUPTED_POISSON_PROCESS;
-  std::unique_ptr<test::InterruptedPoissonProcess> ipp;
-  if (use_network_simulation) {
-    LOG(INFO) << "Running Poisson based network simulation.";
-    const IPPModel& ipp_model = model.ipp();
-    std::vector<double> average_rates(ipp_model.average_rate_size());
-    std::copy(ipp_model.average_rate().begin(), ipp_model.average_rate().end(),
-              average_rates.begin());
-    ipp.reset(new test::InterruptedPoissonProcess(
-        average_rates, ipp_model.coef_burstiness(), ipp_model.coef_variance(),
-        0));
-    receiver_to_sender->Initialize(ipp->NewBuffer(128 * 1024),
-                                   transport_sender->PacketReceiverForTesting(),
-                                   task_runner, &testing_clock);
-    sender_to_receiver->Initialize(
-        ipp->NewBuffer(128 * 1024),
-        transport_receiver->PacketReceiverForTesting(), task_runner,
-        &testing_clock);
-  } else {
-    LOG(INFO) << "No network simulation.";
-    receiver_to_sender->Initialize(std::unique_ptr<test::PacketPipe>(),
-                                   transport_sender->PacketReceiverForTesting(),
-                                   task_runner, &testing_clock);
-    sender_to_receiver->Initialize(
-        std::unique_ptr<test::PacketPipe>(),
-        transport_receiver->PacketReceiverForTesting(), task_runner,
-        &testing_clock);
-  }
-
-  // Initialize a fake media source and a tracker to encoded video frames.
-  const bool quality_test = !metrics_output_path.empty();
-  FakeMediaSource media_source(task_runner, &testing_clock, audio_sender_config,
-                               video_sender_config, quality_test);
-  std::unique_ptr<EncodedVideoFrameTracker> video_frame_tracker;
-  if (quality_test) {
-    video_frame_tracker.reset(new EncodedVideoFrameTracker(&media_source));
-    sender_env->logger()->Subscribe(video_frame_tracker.get());
-  }
-
-  // Quality metrics computed for each frame decoded.
-  GotVideoFrameOutput metrics_output;
-
-  // Start receiver.
-  int audio_frame_count = 0;
-  cast_receiver->RequestDecodedVideoFrame(
-      base::Bind(&GotVideoFrame, &metrics_output, yuv_output_path,
-                 video_frame_tracker.get(), cast_receiver.get()));
-  cast_receiver->RequestDecodedAudioFrame(
-      base::Bind(&GotAudioFrame, &audio_frame_count, cast_receiver.get()));
-
-  // Initializing audio and video senders.
-  cast_sender->InitializeAudio(audio_sender_config,
-                               base::Bind(&LogAudioOperationalStatus));
-  cast_sender->InitializeVideo(media_source.get_video_config(),
-                               base::Bind(&LogVideoOperationalStatus),
-                               CreateDefaultVideoEncodeAcceleratorCallback(),
-                               CreateDefaultVideoEncodeMemoryCallback());
-  task_runner->RunTasks();
-
-  // Truncate YUV files to prepare for writing.
-  if (!yuv_output_path.empty()) {
-    base::ScopedFILE file(base::OpenFile(yuv_output_path, "wb"));
-    if (!file.get()) {
-      LOG(ERROR) << "Cannot save YUV output to file.";
-      return;
-    }
-    LOG(INFO) << "Writing YUV output to file: " << yuv_output_path.value();
-
-    // Write YUV4MPEG2 header.
-    const std::string header("YUV4MPEG2 W1280 H720 F30000:1001 Ip A1:1 C420\n");
-    AppendToFile(yuv_output_path, header.data(), header.size());
-  }
-
-  // Start sending.
-  if (!source_path.empty()) {
-    // 0 means using the FPS from the file.
-    media_source.SetSourceFile(source_path,
-                               GetIntegerSwitchValue(kSourceFrameRate, 0));
-  }
-  media_source.Start(cast_sender->audio_frame_input(),
-                     cast_sender->video_frame_input());
-
-  // By default runs simulation for 3 minutes or the desired duration
-  // by using --run-time= flag.
-  base::TimeDelta elapsed_time;
-  const base::TimeDelta desired_run_time =
-      base::TimeDelta::FromSeconds(GetIntegerSwitchValue(kRunTime, 180));
-  while (elapsed_time < desired_run_time) {
-    // Each step is 100us.
-    base::TimeDelta step = base::TimeDelta::FromMicroseconds(100);
-    task_runner->Sleep(step);
-    elapsed_time += step;
-  }
-
-  // Unsubscribe from logging events.
-  sender_env->logger()->Unsubscribe(&audio_event_subscriber);
-  sender_env->logger()->Unsubscribe(&video_event_subscriber);
-  if (quality_test)
-    sender_env->logger()->Unsubscribe(video_frame_tracker.get());
-
-  // Get event logs for audio and video.
-  media::cast::proto::LogMetadata audio_metadata, video_metadata;
-  media::cast::FrameEventList audio_frame_events, video_frame_events;
-  media::cast::PacketEventList audio_packet_events, video_packet_events;
-  audio_metadata.set_extra_data(extra_data);
-  video_metadata.set_extra_data(extra_data);
-  audio_event_subscriber.GetEventsAndReset(&audio_metadata, &audio_frame_events,
-                                           &audio_packet_events);
-  video_event_subscriber.GetEventsAndReset(&video_metadata, &video_frame_events,
-                                           &video_packet_events);
-
-  // Print simulation results.
-
-  // Compute and print statistics for video:
-  //
-  // * Total video frames captured.
-  // * Total video frames encoded.
-  // * Total video frames dropped.
-  // * Total video frames received late.
-  // * Average target bitrate.
-  // * Average encoded bitrate.
-  int total_video_frames = 0;
-  int encoded_video_frames = 0;
-  int dropped_video_frames = 0;
-  int late_video_frames = 0;
-  int64_t total_delay_of_late_frames_ms = 0;
-  int64_t encoded_size = 0;
-  int64_t target_bitrate = 0;
-  for (size_t i = 0; i < video_frame_events.size(); ++i) {
-    const media::cast::proto::AggregatedFrameEvent& event =
-        *video_frame_events[i];
-    ++total_video_frames;
-    if (event.has_encoded_frame_size()) {
-      ++encoded_video_frames;
-      encoded_size += event.encoded_frame_size();
-      target_bitrate += event.target_bitrate();
-    } else {
-      ++dropped_video_frames;
-    }
-    if (event.has_delay_millis() && event.delay_millis() < 0) {
-      ++late_video_frames;
-      total_delay_of_late_frames_ms += -event.delay_millis();
-    }
-  }
-
-  // Subtract fraction of dropped frames from |elapsed_time| before estimating
-  // the average encoded bitrate.
-  const base::TimeDelta elapsed_time_undropped =
-      total_video_frames <= 0
-          ? base::TimeDelta()
-          : (elapsed_time * (total_video_frames - dropped_video_frames) /
-             total_video_frames);
-  const double avg_encoded_bitrate =
-      elapsed_time_undropped <= base::TimeDelta()
-          ? 0
-          : 8.0 * encoded_size / elapsed_time_undropped.InSecondsF() / 1000;
-  double avg_target_bitrate =
-      !encoded_video_frames ? 0 : target_bitrate / encoded_video_frames / 1000;
-
-  LOG(INFO) << "Configured target playout delay (ms): "
-            << video_receiver_config.rtp_max_delay_ms;
-  LOG(INFO) << "Audio frame count: " << audio_frame_count;
-  LOG(INFO) << "Inserted video frames: " << total_video_frames;
-  LOG(INFO) << "Decoded video frames: " << metrics_output.counter;
-  LOG(INFO) << "Dropped video frames: " << dropped_video_frames;
-  LOG(INFO) << "Late video frames: " << late_video_frames
-            << " (average lateness: "
-            << (late_video_frames > 0
-                    ? static_cast<double>(total_delay_of_late_frames_ms) /
-                          late_video_frames
-                    : 0)
-            << " ms)";
-  LOG(INFO) << "Average encoded bitrate (kbps): " << avg_encoded_bitrate;
-  LOG(INFO) << "Average target bitrate (kbps): " << avg_target_bitrate;
-  LOG(INFO) << "Writing log: " << log_output_path.value();
-
-  // Truncate file and then write serialized log.
-  {
-    base::ScopedFILE file(base::OpenFile(log_output_path, "wb"));
-    if (!file.get()) {
-      LOG(INFO) << "Cannot write to log.";
-      return;
-    }
-  }
-  AppendLogToFile(&video_metadata, video_frame_events, video_packet_events,
-                  log_output_path);
-  AppendLogToFile(&audio_metadata, audio_frame_events, audio_packet_events,
-                  log_output_path);
-
-  // Write quality metrics.
-  if (quality_test) {
-    LOG(INFO) << "Writing quality metrics: " << metrics_output_path.value();
-    std::string line;
-    for (size_t i = 0;
-         i < metrics_output.psnr.size() && i < metrics_output.ssim.size();
-         ++i) {
-      base::StringAppendF(&line, "%f %f\n", metrics_output.psnr[i],
-                          metrics_output.ssim[i]);
-    }
-    WriteFile(metrics_output_path, line.data(), line.length());
-  }
-}
-
-NetworkSimulationModel DefaultModel() {
-  NetworkSimulationModel model;
-  model.set_type(cast::proto::INTERRUPTED_POISSON_PROCESS);
-  IPPModel* ipp = model.mutable_ipp();
-  ipp->set_coef_burstiness(0.609);
-  ipp->set_coef_variance(4.1);
-
-  ipp->add_average_rate(0.609);
-  ipp->add_average_rate(0.495);
-  ipp->add_average_rate(0.561);
-  ipp->add_average_rate(0.458);
-  ipp->add_average_rate(0.538);
-  ipp->add_average_rate(0.513);
-  ipp->add_average_rate(0.585);
-  ipp->add_average_rate(0.592);
-  ipp->add_average_rate(0.658);
-  ipp->add_average_rate(0.556);
-  ipp->add_average_rate(0.371);
-  ipp->add_average_rate(0.595);
-  ipp->add_average_rate(0.490);
-  ipp->add_average_rate(0.980);
-  ipp->add_average_rate(0.781);
-  ipp->add_average_rate(0.463);
-
-  return model;
-}
-
-bool IsModelValid(const NetworkSimulationModel& model) {
-  if (!model.has_type()) return false;
-  NetworkSimulationModelType type = model.type();
-  if (type == media::cast::proto::INTERRUPTED_POISSON_PROCESS) {
-    if (!model.has_ipp()) return false;
-    const IPPModel& ipp = model.ipp();
-    if (ipp.coef_burstiness() <= 0.0 || ipp.coef_variance() <= 0.0)
-      return false;
-    if (ipp.average_rate_size() == 0) return false;
-    for (int i = 0; i < ipp.average_rate_size(); i++) {
-      if (ipp.average_rate(i) <= 0.0) return false;
-    }
-  }
-
-  return true;
-}
-
-NetworkSimulationModel LoadModel(const base::FilePath& model_path) {
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(kNoSimulation)) {
-    NetworkSimulationModel model;
-    model.set_type(media::cast::proto::NO_SIMULATION);
-    return model;
-  }
-  if (model_path.empty()) {
-    LOG(ERROR) << "Model path not set; Using default model.";
-    return DefaultModel();
-  }
-  std::string model_str;
-  if (!base::ReadFileToString(model_path, &model_str)) {
-    LOG(ERROR) << "Failed to read model file.";
-    return DefaultModel();
-  }
-
-  NetworkSimulationModel model;
-  if (!model.ParseFromString(model_str)) {
-    LOG(ERROR) << "Failed to parse model.";
-    return DefaultModel();
-  }
-  if (!IsModelValid(model)) {
-    LOG(ERROR) << "Invalid model.";
-    return DefaultModel();
-  }
-
-  return model;
-}
-
-}  // namespace
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-  InitLogging(logging::LoggingSettings());
-
-  const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
-  base::FilePath media_path = cmd->GetSwitchValuePath(media::cast::kLibDir);
-  if (media_path.empty()) {
-    if (!PathService::Get(base::DIR_MODULE, &media_path)) {
-      LOG(ERROR) << "Failed to load FFmpeg.";
-      return 1;
-    }
-  }
-
-  media::InitializeMediaLibrary();
-
-  base::FilePath source_path =
-      cmd->GetSwitchValuePath(media::cast::kSourcePath);
-  base::FilePath log_output_path =
-      cmd->GetSwitchValuePath(media::cast::kOutputPath);
-  if (log_output_path.empty()) {
-    base::GetTempDir(&log_output_path);
-    log_output_path = log_output_path.AppendASCII("sim-events.gz");
-  }
-  base::FilePath metrics_output_path =
-      cmd->GetSwitchValuePath(media::cast::kMetricsOutputPath);
-  base::FilePath yuv_output_path =
-      cmd->GetSwitchValuePath(media::cast::kYuvOutputPath);
-  std::string sim_id = cmd->GetSwitchValueASCII(media::cast::kSimulationId);
-
-  NetworkSimulationModel model =
-      media::cast::LoadModel(cmd->GetSwitchValuePath(media::cast::kModelPath));
-
-  base::DictionaryValue values;
-  values.SetBoolean("sim", true);
-  values.SetString("sim-id", sim_id);
-
-  std::string extra_data;
-  base::JSONWriter::Write(values, &extra_data);
-
-  // Run.
-  media::cast::RunSimulation(source_path, log_output_path, metrics_output_path,
-                             yuv_output_path, extra_data, model);
-  return 0;
-}
diff --git a/src/cobalt/media/cast/test/skewed_single_thread_task_runner.cc b/src/cobalt/media/cast/test/skewed_single_thread_task_runner.cc
deleted file mode 100644
index 7c3d0d4..0000000
--- a/src/cobalt/media/cast/test/skewed_single_thread_task_runner.cc
+++ /dev/null
@@ -1,47 +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.
-
-#include "media/cast/test/skewed_single_thread_task_runner.h"
-
-#include "base/logging.h"
-#include "base/time/tick_clock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-SkewedSingleThreadTaskRunner::SkewedSingleThreadTaskRunner(
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
-    : skew_(1.0), task_runner_(task_runner) {}
-
-SkewedSingleThreadTaskRunner::~SkewedSingleThreadTaskRunner() {}
-
-void SkewedSingleThreadTaskRunner::SetSkew(double skew) { skew_ = skew; }
-
-bool SkewedSingleThreadTaskRunner::PostDelayedTask(
-    const tracked_objects::Location& from_here, const base::Closure& task,
-    base::TimeDelta delay) {
-  return task_runner_->PostDelayedTask(
-      from_here, task,
-      base::TimeDelta::FromMicroseconds(delay.InMicroseconds() * skew_));
-}
-
-bool SkewedSingleThreadTaskRunner::RunsTasksOnCurrentThread() const {
-  return task_runner_->RunsTasksOnCurrentThread();
-}
-
-bool SkewedSingleThreadTaskRunner::PostNonNestableDelayedTask(
-    const tracked_objects::Location& from_here, const base::Closure& task,
-    base::TimeDelta delay) {
-  return task_runner_->PostNonNestableDelayedTask(
-      from_here, task,
-      base::TimeDelta::FromMicroseconds(delay.InMicroseconds() * skew_));
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/skewed_single_thread_task_runner.h b/src/cobalt/media/cast/test/skewed_single_thread_task_runner.h
deleted file mode 100644
index 1d3730f..0000000
--- a/src/cobalt/media/cast/test/skewed_single_thread_task_runner.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_SKEWED_SINGLE_THREAD_TASK_RUNNER_H_
-#define COBALT_MEDIA_CAST_TEST_SKEWED_SINGLE_THREAD_TASK_RUNNER_H_
-
-#include <map>
-
-#include "base/macros.h"
-#include "base/single_thread_task_runner.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/test/test_pending_task.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-// This class wraps a SingleThreadTaskRunner, and allows you to scale
-// the delay for any posted task by a factor. The factor is changed by
-// calling SetSkew(). A skew of 2.0 means that all delayed task will
-// have to wait twice as long.
-class SkewedSingleThreadTaskRunner : public base::SingleThreadTaskRunner {
- public:
-  explicit SkewedSingleThreadTaskRunner(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
-
-  // Set the delay multiplier to |skew|.
-  void SetSkew(double skew);
-
-  // base::SingleThreadTaskRunner implementation.
-  bool PostDelayedTask(const tracked_objects::Location& from_here,
-                       const base::Closure& task, base::TimeDelta delay) final;
-
-  bool RunsTasksOnCurrentThread() const final;
-
-  // This function is currently not used, and will return false.
-  bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
-                                  const base::Closure& task,
-                                  base::TimeDelta delay) final;
-
- protected:
-  ~SkewedSingleThreadTaskRunner() final;
-
- private:
-  double skew_;
-  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-
-  DISALLOW_COPY_AND_ASSIGN(SkewedSingleThreadTaskRunner);
-};
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_SKEWED_SINGLE_THREAD_TASK_RUNNER_H_
diff --git a/src/cobalt/media/cast/test/skewed_tick_clock.cc b/src/cobalt/media/cast/test/skewed_tick_clock.cc
deleted file mode 100644
index 31153d4..0000000
--- a/src/cobalt/media/cast/test/skewed_tick_clock.cc
+++ /dev/null
@@ -1,40 +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.
-
-#include "media/cast/test/skewed_tick_clock.h"
-
-#include "base/time/time.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-SkewedTickClock::SkewedTickClock(base::TickClock* clock)
-    : clock_(clock),
-      skew_(1.0),
-      last_skew_set_time_(clock_->NowTicks()),
-      skew_clock_at_last_set_(last_skew_set_time_) {}
-
-base::TimeTicks SkewedTickClock::SkewTicks(base::TimeTicks now) {
-  return base::TimeDelta::FromMicroseconds(
-             (now - last_skew_set_time_).InMicroseconds() * skew_) +
-         skew_clock_at_last_set_;
-}
-
-void SkewedTickClock::SetSkew(double skew, base::TimeDelta offset) {
-  base::TimeTicks now = clock_->NowTicks();
-  skew_clock_at_last_set_ = SkewTicks(now) + offset;
-  skew_ = skew;
-  last_skew_set_time_ = now;
-}
-
-base::TimeTicks SkewedTickClock::NowTicks() {
-  return SkewTicks(clock_->NowTicks());
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/skewed_tick_clock.h b/src/cobalt/media/cast/test/skewed_tick_clock.h
deleted file mode 100644
index 6f39844..0000000
--- a/src/cobalt/media/cast/test/skewed_tick_clock.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_SKEWED_TICK_CLOCK_H_
-#define COBALT_MEDIA_CAST_TEST_SKEWED_TICK_CLOCK_H_
-
-#include "base/macros.h"
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-// Wraps a base::TickClock, and lets you change the speed and offset
-// of time compared to the wrapped clock. See SetSkew for how usage.
-class SkewedTickClock : public base::TickClock {
- public:
-  // Does not take ownership of |clock_|.
-  explicit SkewedTickClock(base::TickClock* clock_);
-  // |skew| > 1.0 means clock runs faster.
-  // |offset| > 0 means clock returns times from the future.
-  // Note, |offset| is cumulative.
-  // Also note that changing the skew will never make the clock
-  // jump forwards or backwards, only changing the offset will
-  // do that.
-  void SetSkew(double skew, base::TimeDelta offset);
-  base::TimeTicks NowTicks() final;
-
- private:
-  base::TimeTicks SkewTicks(base::TimeTicks now);
-  base::TickClock* clock_;  // Not owned.
-  double skew_;
-  base::TimeTicks last_skew_set_time_;
-  base::TimeTicks skew_clock_at_last_set_;
-
-  DISALLOW_COPY_AND_ASSIGN(SkewedTickClock);
-};
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_SKEWED_TICK_CLOCK_H_
diff --git a/src/cobalt/media/cast/test/utility/audio_utility.cc b/src/cobalt/media/cast/test/utility/audio_utility.cc
deleted file mode 100644
index 223872d..0000000
--- a/src/cobalt/media/cast/test/utility/audio_utility.cc
+++ /dev/null
@@ -1,183 +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.
-
-#include <cmath>
-#include <vector>
-
-#include "base/logging.h"
-#include "base/time/time.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/test/utility/audio_utility.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-const double Pi = 3.14159265358979323846;
-
-TestAudioBusFactory::TestAudioBusFactory(int num_channels, int sample_rate,
-                                         float sine_wave_frequency,
-                                         float volume)
-    : num_channels_(num_channels),
-      sample_rate_(sample_rate),
-      volume_(volume),
-      source_(num_channels, sine_wave_frequency, sample_rate) {
-  CHECK_LT(0, num_channels);
-  CHECK_LT(0, sample_rate);
-  CHECK_LE(0.0f, volume_);
-  CHECK_LE(volume_, 1.0f);
-}
-
-TestAudioBusFactory::~TestAudioBusFactory() {}
-
-std::unique_ptr<AudioBus> TestAudioBusFactory::NextAudioBus(
-    const base::TimeDelta& duration) {
-  const int num_samples = static_cast<int>((sample_rate_ * duration) /
-                                           base::TimeDelta::FromSeconds(1));
-  std::unique_ptr<AudioBus> bus(AudioBus::Create(num_channels_, num_samples));
-  source_.OnMoreData(base::TimeDelta(), base::TimeTicks::Now(), 0, bus.get());
-  bus->Scale(volume_);
-  return bus;
-}
-
-int CountZeroCrossings(const float* samples, int length) {
-  // The sample values must pass beyond |kAmplitudeThreshold| on the opposite
-  // side of zero before a crossing will be counted.
-  const float kAmplitudeThreshold = 0.03f;  // 3% of max amplitude.
-
-  int count = 0;
-  int i = 0;
-  float last = 0.0f;
-  for (; i < length && fabsf(last) < kAmplitudeThreshold; ++i)
-    last = samples[i];
-  for (; i < length; ++i) {
-    if (fabsf(samples[i]) >= kAmplitudeThreshold &&
-        (last < 0) != (samples[i] < 0)) {
-      ++count;
-      last = samples[i];
-    }
-  }
-  return count;
-}
-
-// EncodeTimestamp stores a 16-bit number as frequencies in a sample.
-// Our internal code tends to work on 10ms chunks of data, and to
-// make sure the decoding always work, I wanted to make sure that the
-// encoded value can be decoded from 5ms of sample data, assuming a
-// sampling rate of 48Khz, this turns out to be 240 samples.
-// Each bit of the timestamp is stored as a frequency, where the
-// frequency is bit_number * 200 Hz. We also add a 'sense' tone to
-// the output, this tone is 17 * 200 = 3400Hz, and when we decode,
-// we can use this tone to make sure that we aren't decoding bogus data.
-// Also, we use this tone to scale our expectations in case something
-// changed changed the volume of the audio.
-//
-// Normally, we will encode 480 samples (10ms) of data, but when we
-// read it will will scan 240 samples at a time until something that
-// can be decoded is found.
-//
-// The intention is to use these routines to encode the frame number
-// that goes with each chunk of audio, so if our frame rate is
-// 30Hz, we would encode 48000/30 = 1600 samples of "1", then
-// 1600 samples of "2", etc. When we decode this, it is possible
-// that we get a chunk of data that is spanning two frame numbers,
-// so we gray-code the numbers. Since adjacent gray-coded number
-// will only differ in one bit, we should never get numbers out
-// of sequence when decoding, at least not by more than one.
-
-const double kBaseFrequency = 200;
-const int kSamplingFrequency = 48000;
-const size_t kNumBits = 16;
-const size_t kSamplesToAnalyze = kSamplingFrequency / kBaseFrequency;
-const double kSenseFrequency = kBaseFrequency * (kNumBits + 1);
-const double kMinSense = 1.5;
-
-bool EncodeTimestamp(uint16_t timestamp, size_t sample_offset, size_t length,
-                     float* samples) {
-  if (length < kSamplesToAnalyze) {
-    return false;
-  }
-  // gray-code the number
-  timestamp = (timestamp >> 1) ^ timestamp;
-  std::vector<double> frequencies;
-  for (size_t i = 0; i < kNumBits; i++) {
-    if ((timestamp >> i) & 1) {
-      frequencies.push_back(kBaseFrequency * (i + 1));
-    }
-  }
-  // Carrier sense frequency
-  frequencies.push_back(kSenseFrequency);
-  for (size_t i = 0; i < length; i++) {
-    double mix_of_components = 0.0;
-    for (size_t f = 0; f < frequencies.size(); f++) {
-      mix_of_components += sin((i + sample_offset) * Pi * 2.0 * frequencies[f] /
-                               kSamplingFrequency);
-    }
-    mix_of_components /= kNumBits + 1;
-    DCHECK_LE(fabs(mix_of_components), 1.0);
-    samples[i] = mix_of_components;
-  }
-  return true;
-}
-
-namespace {
-// We use a slow DCT here since this code is only used for testing.
-// While an FFT would probably be faster, it wouldn't be a LOT
-// faster since we only analyze 17 out of 120 frequencies.
-// With an FFT we would verify that none of the higher frequencies
-// contain a lot of energy, which would be useful in detecting
-// bogus data.
-double DecodeOneFrequency(const float* samples, size_t length,
-                          double frequency) {
-  double sin_sum = 0.0;
-  double cos_sum = 0.0;
-  for (size_t i = 0; i < length; i++) {
-    sin_sum += samples[i] * sin(i * Pi * 2 * frequency / kSamplingFrequency);
-    cos_sum += samples[i] * cos(i * Pi * 2 * frequency / kSamplingFrequency);
-  }
-  return sqrt(sin_sum * sin_sum + cos_sum * cos_sum);
-}
-}  // namespace
-
-// When decoding, we first check for sense frequency, then we decode
-// each of the bits. Each frequency must have a strength that is similar to
-// the sense frequency or to zero, or the decoding fails. If it fails, we
-// move head by 60 samples and try again until we run out of samples.
-bool DecodeTimestamp(const float* samples, size_t length, uint16_t* timestamp) {
-  for (size_t start = 0; start + kSamplesToAnalyze <= length;
-       start += kSamplesToAnalyze / 4) {
-    double sense =
-        DecodeOneFrequency(&samples[start], kSamplesToAnalyze, kSenseFrequency);
-    if (sense < kMinSense) continue;
-    bool success = true;
-    uint16_t gray_coded = 0;
-    for (size_t bit = 0; success && bit < kNumBits; bit++) {
-      double signal_strength = DecodeOneFrequency(
-          &samples[start], kSamplesToAnalyze, kBaseFrequency * (bit + 1));
-      if (signal_strength < sense / 4) {
-        // Zero bit, no action
-      } else if (signal_strength > sense * 0.75 &&
-                 signal_strength < sense * 1.25) {
-        // One bit
-        gray_coded |= 1 << bit;
-      } else {
-        success = false;
-      }
-    }
-    if (success) {
-      // Convert from gray-coded number to binary.
-      uint16_t mask;
-      for (mask = gray_coded >> 1; mask != 0; mask = mask >> 1) {
-        gray_coded = gray_coded ^ mask;
-      }
-      *timestamp = gray_coded;
-      return true;
-    }
-  }
-  return false;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/audio_utility.h b/src/cobalt/media/cast/test/utility/audio_utility.h
deleted file mode 100644
index cbaaff5..0000000
--- a/src/cobalt/media/cast/test/utility/audio_utility.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "media/audio/simple_sources.h"
-#include "starboard/types.h"
-
-namespace base {
-class TimeDelta;
-}
-
-namespace cobalt {
-namespace media {
-class AudioBus;
-}
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Produces AudioBuses of varying duration where each successive output contains
-// the continuation of a single sine wave.
-class TestAudioBusFactory {
- public:
-  TestAudioBusFactory(int num_channels, int sample_rate,
-                      float sine_wave_frequency, float volume);
-  ~TestAudioBusFactory();
-
-  // Creates a new AudioBus of the given |duration|, filled with the next batch
-  // of sine wave samples.
-  std::unique_ptr<AudioBus> NextAudioBus(const base::TimeDelta& duration);
-
-  // A reasonable test tone.
-  static const int kMiddleANoteFreq = 440;
-
- private:
-  const int num_channels_;
-  const int sample_rate_;
-  const float volume_;
-  SineWaveAudioSource source_;
-
-  DISALLOW_COPY_AND_ASSIGN(TestAudioBusFactory);
-};
-
-// Assuming |samples| contains a single-frequency sine wave (and maybe some
-// low-amplitude noise), count the number of times the sine wave crosses
-// zero.
-//
-// Example use case: When expecting a 440 Hz tone, this can be checked using the
-// following expression:
-//
-//   abs((CountZeroCrossings(...) / seconds_per_frame / 2) - 440) <= 1
-//
-// ...where seconds_per_frame is the number of samples divided by the sampling
-// rate.  The divide by two accounts for the fact that a sine wave crosses zero
-// twice per cycle (first downwards, then upwards).  The absolute maximum
-// difference of 1 accounts for the sine wave being out of perfect phase.
-int CountZeroCrossings(const float* samples, int length);
-
-// Encode |timestamp| into the samples pointed to by 'samples' in a way
-// that should be decodable even after compressing/decompressing the audio.
-// Assumes 48Khz sampling rate and needs at least 240 samples. Returns
-// false if |length| of |samples| is too small. If more than 240 samples are
-// available, then the timestamp will be repeated. |sample_offset| should
-// contain how many samples has been encoded so far, so that we can make smooth
-// transitions between encoded chunks.
-// See audio_utility.cc for details on how the encoding is done.
-bool EncodeTimestamp(uint16_t timestamp, size_t sample_offset, size_t length,
-                     float* samples);
-
-// Decode a timestamp encoded with EncodeTimestamp. Returns true if a
-// timestamp was found in |samples|.
-bool DecodeTimestamp(const float* samples, size_t length, uint16_t* timestamp);
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_
diff --git a/src/cobalt/media/cast/test/utility/audio_utility_unittest.cc b/src/cobalt/media/cast/test/utility/audio_utility_unittest.cc
deleted file mode 100644
index 1129f8a..0000000
--- a/src/cobalt/media/cast/test/utility/audio_utility_unittest.cc
+++ /dev/null
@@ -1,49 +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.
-
-#include "media/base/video_frame.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "starboard/types.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-namespace {
-
-TEST(AudioTimestampTest, Small) {
-  std::vector<float> samples(480);
-  for (int32_t in_timestamp = 0; in_timestamp < 65536; in_timestamp += 2077) {
-    EncodeTimestamp(in_timestamp, 0, samples.size(), &samples.front());
-    uint16_t out_timestamp;
-    EXPECT_TRUE(
-        DecodeTimestamp(&samples.front(), samples.size(), &out_timestamp));
-    ASSERT_EQ(in_timestamp, out_timestamp);
-  }
-}
-
-TEST(AudioTimestampTest, Negative) {
-  std::vector<float> samples(480);
-  uint16_t out_timestamp;
-  EXPECT_FALSE(
-      DecodeTimestamp(&samples.front(), samples.size(), &out_timestamp));
-}
-
-TEST(AudioTimestampTest, CheckPhase) {
-  std::vector<float> samples(4800);
-  EncodeTimestamp(4711, 0, samples.size(), &samples.front());
-  for (size_t i = 0; i < samples.size() - 240; i += 143) {
-    uint16_t out_timestamp;
-    EXPECT_TRUE(DecodeTimestamp(&samples.front() + i, samples.size() - i,
-                                &out_timestamp));
-    ASSERT_EQ(4711, out_timestamp);
-  }
-}
-
-}  // namespace
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/barcode.cc b/src/cobalt/media/cast/test/utility/barcode.cc
deleted file mode 100644
index 182605c..0000000
--- a/src/cobalt/media/cast/test/utility/barcode.cc
+++ /dev/null
@@ -1,173 +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.
-
-// Routines for encoding and decoding a small number of bits into an image
-// in a way that is decodable even after scaling/encoding/cropping.
-//
-// The encoding is very simple:
-//
-//   ####    ####    ########    ####        ####    ####
-//   ####    ####    ########    ####        ####    ####
-//   ####    ####    ########    ####        ####    ####
-//   ####    ####    ########    ####        ####    ####
-//   1   2   3   4   5   6   7   8   9   10  11  12  13  14
-//   <-----start----><--one-bit-><-zero bit-><----stop---->
-//
-// We use a basic unit, depicted here as four characters wide.
-// We start with 1u black 1u white 1u black 1u white. (1-4 above)
-// From there on, a "one" bit is encoded as 2u black and 1u white,
-// and a zero bit is encoded as 1u black and 2u white. After
-// all the bits we end the pattern with the same pattern as the
-// start of the pattern.
-
-#include <algorithm>
-#include <deque>
-#include <vector>
-
-#include "base/logging.h"
-#include "media/base/video_frame.h"
-#include "media/cast/test/utility/barcode.h"
-#include "starboard/memory.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-const int kBlackThreshold = 256 * 2 / 3;
-const int kWhiteThreshold = 256 / 3;
-
-bool EncodeBarcode(const std::vector<bool>& bits,
-                   scoped_refptr<VideoFrame> output_frame) {
-  DCHECK(output_frame->format() == PIXEL_FORMAT_YV12 ||
-         output_frame->format() == PIXEL_FORMAT_YV16 ||
-         output_frame->format() == PIXEL_FORMAT_I420);
-  int row_bytes = output_frame->row_bytes(VideoFrame::kYPlane);
-  std::vector<unsigned char> bytes(row_bytes);
-  for (int i = 0; i < row_bytes; i++) {
-    bytes[i] = 255;
-  }
-  size_t units = bits.size() * 3 + 7;  // White or black bar where size matters.
-  // We only use 60% of the image to make sure it works even if
-  // the image gets cropped.
-  size_t unit_size = row_bytes * 6 / 10 / units;
-  if (unit_size < 1) return false;
-  size_t bytes_required = unit_size * units;
-  size_t padding = (row_bytes - bytes_required) / 2;
-  unsigned char* pos = &bytes[padding];
-  // Two leading black bars.
-  SbMemorySet(pos, 0, unit_size);
-  pos += unit_size * 2;
-  SbMemorySet(pos, 0, unit_size);
-  pos += unit_size * 2;
-  for (size_t bit = 0; bit < bits.size(); bit++) {
-    SbMemorySet(pos, 0, bits[bit] ? unit_size * 2 : unit_size);
-    pos += unit_size * 3;
-  }
-  SbMemorySet(pos, 0, unit_size);
-  pos += unit_size * 2;
-  SbMemorySet(pos, 0, unit_size);
-  pos += unit_size;
-  DCHECK_LE(pos - &bytes.front(), row_bytes);
-
-  // Now replicate this one row into all rows in kYPlane.
-  for (int row = 0; row < output_frame->rows(VideoFrame::kYPlane); row++) {
-    SbMemoryCopy(output_frame->data(VideoFrame::kYPlane) +
-                     output_frame->stride(VideoFrame::kYPlane) * row,
-                 &bytes.front(), row_bytes);
-  }
-  return true;
-}
-
-namespace {
-bool DecodeBarCodeRows(const scoped_refptr<VideoFrame>& frame,
-                       std::vector<bool>* output, int min_row, int max_row) {
-  // Do a basic run-length encoding
-  std::deque<int> runs;
-  bool is_black = true;
-  int length = 0;
-  for (int pos = 0; pos < frame->row_bytes(VideoFrame::kYPlane); pos++) {
-    float value = 0.0;
-    for (int row = min_row; row < max_row; row++) {
-      value += frame->data(
-          VideoFrame::kYPlane)[frame->stride(VideoFrame::kYPlane) * row + pos];
-    }
-    value /= max_row - min_row;
-    if (is_black ? value > kBlackThreshold : value < kWhiteThreshold) {
-      is_black = !is_black;
-      runs.push_back(length);
-      length = 1;
-    } else {
-      length++;
-    }
-  }
-  runs.push_back(length);
-
-  // Try decoding starting at each white-black transition.
-  while (runs.size() >= output->size() * 2 + 7) {
-    std::deque<int>::const_iterator i = runs.begin();
-    double unit_size = (i[1] + i[2] + i[3] + i[4]) / 4;
-    bool valid = true;
-    if (i[0] > unit_size * 2 || i[0] < unit_size / 2) valid = false;
-    if (i[1] > unit_size * 2 || i[1] < unit_size / 2) valid = false;
-    if (i[2] > unit_size * 2 || i[2] < unit_size / 2) valid = false;
-    if (i[3] > unit_size * 2 || i[3] < unit_size / 2) valid = false;
-    i += 4;
-    for (size_t bit = 0; valid && bit < output->size(); bit++) {
-      if (i[0] > unit_size / 2 && i[0] <= unit_size * 1.5 &&
-          i[1] > unit_size * 1.5 && i[1] <= unit_size * 3) {
-        (*output)[bit] = false;
-      } else if (i[1] > unit_size / 2 && i[1] <= unit_size * 1.5 &&
-                 i[0] > unit_size * 1.5 && i[0] <= unit_size * 3) {
-        (*output)[bit] = true;
-      } else {
-        // Not a valid code
-        valid = false;
-      }
-      i += 2;
-    }
-    if (i[0] > unit_size * 2 || i[0] < unit_size / 2) valid = false;
-    if (i[1] > unit_size * 2 || i[1] < unit_size / 2) valid = false;
-    if (i[2] > unit_size * 2 || i[2] < unit_size / 2) valid = false;
-    i += 3;
-    DCHECK(i <= runs.end());
-    if (valid) {
-      // Decoding successful, return true
-      return true;
-    }
-    runs.pop_front();
-    runs.pop_front();
-  }
-  return false;
-}
-
-}  // namespace
-
-// Note that "output" is assumed to be the right size already. This
-// could be inferred from the data, but the decoding is more robust
-// if we can assume that we know how many bits we want.
-bool DecodeBarcode(const scoped_refptr<VideoFrame>& frame,
-                   std::vector<bool>* output) {
-  DCHECK(frame->format() == PIXEL_FORMAT_YV12 ||
-         frame->format() == PIXEL_FORMAT_YV16 ||
-         frame->format() == PIXEL_FORMAT_I420);
-  int rows = frame->rows(VideoFrame::kYPlane);
-  // Middle 10 lines
-  if (DecodeBarCodeRows(frame, output, std::max(0, rows / 2 - 5),
-                        std::min(rows, rows / 2 + 5))) {
-    return true;
-  }
-
-  // Top 5 lines
-  if (DecodeBarCodeRows(frame, output, 0, std::min(5, rows))) {
-    return true;
-  }
-
-  return false;
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/barcode.h b/src/cobalt/media/cast/test/utility/barcode.h
deleted file mode 100644
index d1d0134..0000000
--- a/src/cobalt/media/cast/test/utility/barcode.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_BARCODE_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_BARCODE_H_
-
-#include <vector>
-
-#include "base/memory/ref_counted.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-class VideoFrame;
-
-namespace cast {
-namespace test {
-// Encode a resilient barcode into |frame| containing all the bits
-// from |bits|.
-bool EncodeBarcode(const std::vector<bool>& bits,
-                   scoped_refptr<media::VideoFrame> output_frame);
-// Decode a barcode (encoded by EncodeBarCode) into |output|.
-// |output| should already be sized to contain the right number
-// of bits.
-bool DecodeBarcode(const scoped_refptr<media::VideoFrame>& frame,
-                   std::vector<bool>* output);
-
-// Convenience templates that allows you to encode/decode numeric
-// types directly.
-template <class T>
-bool EncodeBarcode(T data, scoped_refptr<media::VideoFrame> output_frame) {
-  std::vector<bool> bits(sizeof(T) * 8);
-  for (size_t i = 0; i < bits.size(); i++) {
-    bits[i] = ((data >> i) & 1) == 1;
-  }
-  return EncodeBarcode(bits, output_frame);
-}
-
-template <class T>
-bool DecodeBarcode(scoped_refptr<media::VideoFrame> output_frame, T* data) {
-  std::vector<bool> bits(sizeof(T) * 8);
-  bool ret = DecodeBarcode(output_frame, &bits);
-  if (!ret) return false;
-  *data = 0;
-  for (size_t i = 0; i < bits.size(); i++) {
-    if (bits[i]) {
-      *data |= 1UL << i;
-    }
-  }
-  return true;
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_BARCODE_H_
diff --git a/src/cobalt/media/cast/test/utility/barcode_unittest.cc b/src/cobalt/media/cast/test/utility/barcode_unittest.cc
deleted file mode 100644
index 5e8648e..0000000
--- a/src/cobalt/media/cast/test/utility/barcode_unittest.cc
+++ /dev/null
@@ -1,64 +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.
-
-#include "media/base/video_frame.h"
-#include "media/cast/test/utility/barcode.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-namespace {
-
-TEST(BarcodeTest, Small) {
-  scoped_refptr<media::VideoFrame> frame =
-      media::VideoFrame::CreateBlackFrame(gfx::Size(320, 10));
-  for (unsigned char in_bits = 0; in_bits < 255; in_bits++) {
-    EXPECT_TRUE(EncodeBarcode(in_bits, frame));
-    unsigned char out_bits = ~in_bits;
-    EXPECT_TRUE(DecodeBarcode(frame, &out_bits));
-    EXPECT_EQ(in_bits, out_bits);
-  }
-}
-
-TEST(BarcodeTest, Large) {
-  scoped_refptr<media::VideoFrame> frame =
-      media::VideoFrame::CreateBlackFrame(gfx::Size(10000, 10));
-  std::vector<bool> in_bits(1024);
-  std::vector<bool> out_bits(1024);
-  for (int i = 0; i < 1024; i++) in_bits[i] = true;
-  EXPECT_TRUE(EncodeBarcode(in_bits, frame));
-  EXPECT_TRUE(DecodeBarcode(frame, &out_bits));
-  for (int i = 0; i < 1024; i++) {
-    EXPECT_EQ(in_bits[i], out_bits[i]);
-  }
-
-  for (int i = 0; i < 1024; i++) in_bits[i] = false;
-  EXPECT_TRUE(EncodeBarcode(in_bits, frame));
-  EXPECT_TRUE(DecodeBarcode(frame, &out_bits));
-  for (int i = 0; i < 1024; i++) {
-    EXPECT_EQ(in_bits[i], out_bits[i]);
-  }
-
-  for (int i = 0; i < 1024; i++) in_bits[i] = (i & 1) == 0;
-  EXPECT_TRUE(EncodeBarcode(in_bits, frame));
-  EXPECT_TRUE(DecodeBarcode(frame, &out_bits));
-  for (int i = 0; i < 1024; i++) {
-    EXPECT_EQ(in_bits[i], out_bits[i]);
-  }
-
-  for (int i = 0; i < 1024; i++) in_bits[i] = (i & 1) == 1;
-  EXPECT_TRUE(EncodeBarcode(in_bits, frame));
-  EXPECT_TRUE(DecodeBarcode(frame, &out_bits));
-  for (int i = 0; i < 1024; i++) {
-    EXPECT_EQ(in_bits[i], out_bits[i]);
-  }
-}
-
-}  // namespace
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/default_config.cc b/src/cobalt/media/cast/test/utility/default_config.cc
deleted file mode 100644
index a136b22..0000000
--- a/src/cobalt/media/cast/test/utility/default_config.cc
+++ /dev/null
@@ -1,107 +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.
-
-#include "media/cast/test/utility/default_config.h"
-
-#include "base/bind.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/constants.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "starboard/types.h"
-
-namespace {
-
-void CreateVideoEncodeAccelerator(
-    const media::cast::ReceiveVideoEncodeAcceleratorCallback& callback) {
-  // Do nothing.
-}
-
-void CreateVideoEncodeMemory(
-    size_t size,
-    const media::cast::ReceiveVideoEncodeMemoryCallback& callback) {
-  // Do nothing.
-}
-
-}  // namespace
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-FrameReceiverConfig GetDefaultAudioReceiverConfig() {
-  FrameReceiverConfig config;
-  config.receiver_ssrc = 2;
-  config.sender_ssrc = 1;
-  config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs;
-  config.rtp_payload_type = RtpPayloadType::AUDIO_OPUS;
-  config.rtp_timebase = 48000;
-  config.channels = 2;
-  config.target_frame_rate = 100;  // 10ms of signal per frame
-  config.codec = media::cast::CODEC_AUDIO_OPUS;
-  return config;
-}
-
-FrameReceiverConfig GetDefaultVideoReceiverConfig() {
-  FrameReceiverConfig config;
-  config.receiver_ssrc = 12;
-  config.sender_ssrc = 11;
-  config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs;
-  config.rtp_payload_type = RtpPayloadType::VIDEO_VP8;
-  config.rtp_timebase = kVideoFrequency;
-  config.channels = 1;
-  config.target_frame_rate = kDefaultMaxFrameRate;
-  config.codec = media::cast::CODEC_VIDEO_VP8;
-  return config;
-}
-
-FrameSenderConfig GetDefaultAudioSenderConfig() {
-  FrameReceiverConfig recv_config = GetDefaultAudioReceiverConfig();
-  FrameSenderConfig config;
-  config.sender_ssrc = recv_config.sender_ssrc;
-  config.receiver_ssrc = recv_config.receiver_ssrc;
-  config.rtp_payload_type = recv_config.rtp_payload_type;
-  config.use_external_encoder = false;
-  config.rtp_timebase = recv_config.rtp_timebase;
-  config.channels = recv_config.channels;
-  config.max_bitrate = config.min_bitrate = config.start_bitrate =
-      kDefaultAudioEncoderBitrate;
-  config.max_frame_rate = recv_config.target_frame_rate;
-  config.codec = recv_config.codec;
-  return config;
-}
-
-FrameSenderConfig GetDefaultVideoSenderConfig() {
-  FrameReceiverConfig recv_config = GetDefaultVideoReceiverConfig();
-  FrameSenderConfig config;
-  config.sender_ssrc = recv_config.sender_ssrc;
-  config.receiver_ssrc = recv_config.receiver_ssrc;
-  config.rtp_payload_type = recv_config.rtp_payload_type;
-  config.use_external_encoder = false;
-  config.rtp_timebase = recv_config.rtp_timebase;
-  config.max_bitrate = kDefaultMaxVideoBitrate;
-  config.min_bitrate = kDefaultMinVideoBitrate;
-  config.start_bitrate = config.max_bitrate;
-  config.max_frame_rate = recv_config.target_frame_rate;
-  config.codec = recv_config.codec;
-  config.video_codec_params.max_qp = kDefaultMaxQp;
-  config.video_codec_params.min_qp = kDefaultMinQp;
-  config.video_codec_params.max_cpu_saver_qp = kDefaultMaxCpuSaverQp;
-  config.video_codec_params.max_number_of_video_buffers_used =
-      kDefaultNumberOfVideoBuffers;
-  config.video_codec_params.number_of_encode_threads = 2;
-  return config;
-}
-
-CreateVideoEncodeAcceleratorCallback
-CreateDefaultVideoEncodeAcceleratorCallback() {
-  return base::Bind(&CreateVideoEncodeAccelerator);
-}
-
-CreateVideoEncodeMemoryCallback CreateDefaultVideoEncodeMemoryCallback() {
-  return base::Bind(&CreateVideoEncodeMemory);
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/default_config.h b/src/cobalt/media/cast/test/utility/default_config.h
deleted file mode 100644
index df27fe0..0000000
--- a/src/cobalt/media/cast/test/utility/default_config.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_DEFAULT_CONFIG_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_DEFAULT_CONFIG_H_
-
-#include "media/cast/cast_config.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Returns a FrameReceiverConfig initialized to "good-to-go" values.  This
-// specifies 48 kHz, 2-channel Opus-coded audio, with standard ssrc's, payload
-// type, and a dummy name.
-FrameReceiverConfig GetDefaultAudioReceiverConfig();
-
-// Returns a FrameReceiverConfig initialized to "good-to-go" values.  This
-// specifies VP8-coded video, with standard ssrc's, payload type, and a dummy
-// name.
-FrameReceiverConfig GetDefaultVideoReceiverConfig();
-
-// Returns a FrameSenderConfig initialized to default values. This means
-// 48 kHz, 2-channel Opus-coded audio. Default values for SSRCs and payload
-// type.
-FrameSenderConfig GetDefaultAudioSenderConfig();
-
-// Returns a FrameSenderConfig initialized to default values. This means
-// 30 Hz VP8 coded code. Default values for SSRCs and payload type.
-FrameSenderConfig GetDefaultVideoSenderConfig();
-
-// Returns a callback that does nothing.
-CreateVideoEncodeAcceleratorCallback
-CreateDefaultVideoEncodeAcceleratorCallback();
-
-// Returns a callback that does nothing.
-CreateVideoEncodeMemoryCallback CreateDefaultVideoEncodeMemoryCallback();
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_DEFAULT_CONFIG_H_
diff --git a/src/cobalt/media/cast/test/utility/generate_barcode_video.cc b/src/cobalt/media/cast/test/utility/generate_barcode_video.cc
deleted file mode 100644
index 6230a2d..0000000
--- a/src/cobalt/media/cast/test/utility/generate_barcode_video.cc
+++ /dev/null
@@ -1,43 +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.
-
-#include <cstdio>
-#include <cstdlib>
-
-#include "base/logging.h"
-#include "media/base/video_frame.h"
-#include "media/cast/test/utility/barcode.h"
-#include "starboard/string.h"
-#include "starboard/types.h"
-
-void DumpPlane(scoped_refptr<media::VideoFrame> frame, int plane) {
-  for (int row = 0; row < frame->rows(plane); row++) {
-    CHECK_EQ(static_cast<size_t>(frame->row_bytes(plane)),
-             fwrite(frame->data(plane) + frame->stride(plane) * row, 1,
-                    frame->row_bytes(plane), stdout));
-  }
-}
-
-int main(int argc, char **argv) {
-  if (argc < 5) {
-    fprintf(stderr,
-            "Usage: generate_barcode_video "
-            "<width> <height> <fps> <frames> >output.y4m\n");
-    exit(1);
-  }
-  int width = SbStringAToI(argv[1]);
-  int height = SbStringAToI(argv[2]);
-  int fps = SbStringAToI(argv[3]);
-  uint16_t wanted_frames = SbStringAToI(argv[4]);
-  scoped_refptr<media::VideoFrame> frame =
-      media::VideoFrame::CreateBlackFrame(gfx::Size(width, height));
-  printf("YUV4MPEG2 W%d H%d F%d:1 Ip C420mpeg2\n", width, height, fps);
-  for (uint16_t frame_id = 1; frame_id <= wanted_frames; frame_id++) {
-    CHECK(media::cast::test::EncodeBarcode(frame_id, frame));
-    printf("FRAME\n");
-    DumpPlane(frame, media::VideoFrame::kYPlane);
-    DumpPlane(frame, media::VideoFrame::kUPlane);
-    DumpPlane(frame, media::VideoFrame::kVPlane);
-  }
-}
diff --git a/src/cobalt/media/cast/test/utility/generate_timecode_audio.cc b/src/cobalt/media/cast/test/utility/generate_timecode_audio.cc
deleted file mode 100644
index 3f7d86d..0000000
--- a/src/cobalt/media/cast/test/utility/generate_timecode_audio.cc
+++ /dev/null
@@ -1,41 +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.
-
-#include <algorithm>
-#include <cstdio>
-#include <cstdlib>
-#include <limits>
-#include <vector>
-
-#include "base/logging.h"
-#include "media/cast/test/utility/audio_utility.h"
-#include "starboard/string.h"
-#include "starboard/types.h"
-
-const size_t kSamplingFrequency = 48000;
-
-int main(int argc, char **argv) {
-  if (argc < 3) {
-    fprintf(stderr, "Usage: %s <fps> <frames> >output.s16le\n", argv[0]);
-    exit(1);
-  }
-  int fps = SbStringAToI(argv[1]);
-  const uint32_t frames =
-      static_cast<uint32_t>(std::max(0, SbStringAToI(argv[2])));
-  std::vector<float> samples(kSamplingFrequency / fps);
-  size_t num_samples = 0;
-  for (uint32_t frame_id = 1; frame_id <= frames; frame_id++) {
-    CHECK(media::cast::EncodeTimestamp(frame_id, num_samples, samples.size(),
-                                       &samples.front()));
-    num_samples += samples.size();
-    for (size_t i = 0; i < samples.size(); ++i) {
-      const int16_t sample_s16 = static_cast<int16_t>(
-          samples[i] * std::numeric_limits<int16_t>::max());
-      putchar(sample_s16 & 0xff);
-      putchar(sample_s16 >> 8);
-      putchar(sample_s16 & 0xff);
-      putchar(sample_s16 >> 8);
-    }
-  }
-}
diff --git a/src/cobalt/media/cast/test/utility/in_process_receiver.cc b/src/cobalt/media/cast/test/utility/in_process_receiver.cc
deleted file mode 100644
index fb1eb88..0000000
--- a/src/cobalt/media/cast/test/utility/in_process_receiver.cc
+++ /dev/null
@@ -1,147 +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.
-
-#include "media/cast/test/utility/in_process_receiver.h"
-
-#include <utility>
-
-#include "base/bind_helpers.h"
-#include "base/memory/ptr_util.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/time/time.h"
-#include "base/values.h"
-#include "media/base/video_frame.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/cast_environment.h"
-#include "media/cast/cast_receiver.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "media/cast/net/udp_transport.h"
-
-using media::cast::CastTransportStatus;
-using media::cast::UdpTransport;
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-void InProcessReceiver::TransportClient::OnStatusChanged(
-    CastTransportStatus status) {
-  LOG_IF(ERROR, status == media::cast::TRANSPORT_SOCKET_ERROR)
-      << "Transport socket error occurred.  InProcessReceiver is likely "
-         "dead.";
-  VLOG(1) << "CastTransportStatus is now " << status;
-}
-
-void InProcessReceiver::TransportClient::ProcessRtpPacket(
-    std::unique_ptr<Packet> packet) {
-  in_process_receiver_->ReceivePacket(std::move(packet));
-}
-
-InProcessReceiver::InProcessReceiver(
-    const scoped_refptr<CastEnvironment>& cast_environment,
-    const net::IPEndPoint& local_end_point,
-    const net::IPEndPoint& remote_end_point,
-    const FrameReceiverConfig& audio_config,
-    const FrameReceiverConfig& video_config)
-    : cast_environment_(cast_environment),
-      local_end_point_(local_end_point),
-      remote_end_point_(remote_end_point),
-      audio_config_(audio_config),
-      video_config_(video_config),
-      weak_factory_(this) {}
-
-InProcessReceiver::~InProcessReceiver() { Stop(); }
-
-void InProcessReceiver::Start() {
-  cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
-                              base::Bind(&InProcessReceiver::StartOnMainThread,
-                                         base::Unretained(this)));
-}
-
-void InProcessReceiver::Stop() {
-  base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
-                            base::WaitableEvent::InitialState::NOT_SIGNALED);
-  if (cast_environment_->CurrentlyOn(CastEnvironment::MAIN)) {
-    StopOnMainThread(&event);
-  } else {
-    cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
-                                base::Bind(&InProcessReceiver::StopOnMainThread,
-                                           base::Unretained(this), &event));
-    event.Wait();
-  }
-}
-
-void InProcessReceiver::StopOnMainThread(base::WaitableEvent* event) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  cast_receiver_.reset(nullptr);
-  transport_.reset(nullptr);
-  weak_factory_.InvalidateWeakPtrs();
-  event->Signal();
-}
-
-void InProcessReceiver::UpdateCastTransportStatus(CastTransportStatus status) {
-  LOG_IF(ERROR, status == media::cast::TRANSPORT_SOCKET_ERROR)
-      << "Transport socket error occurred.  InProcessReceiver is likely dead.";
-  VLOG(1) << "CastTransportStatus is now " << status;
-}
-
-void InProcessReceiver::StartOnMainThread() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-
-  DCHECK(!transport_ && !cast_receiver_);
-
-  transport_ = CastTransport::Create(
-      cast_environment_->Clock(), base::TimeDelta(),
-      base::WrapUnique(new InProcessReceiver::TransportClient(this)),
-      base::MakeUnique<UdpTransport>(
-          nullptr, cast_environment_->GetTaskRunner(CastEnvironment::MAIN),
-          local_end_point_, remote_end_point_,
-          base::Bind(&InProcessReceiver::UpdateCastTransportStatus,
-                     base::Unretained(this))),
-      cast_environment_->GetTaskRunner(CastEnvironment::MAIN));
-
-  cast_receiver_ = CastReceiver::Create(cast_environment_, audio_config_,
-                                        video_config_, transport_.get());
-
-  PullNextAudioFrame();
-  PullNextVideoFrame();
-}
-
-void InProcessReceiver::GotAudioFrame(std::unique_ptr<AudioBus> audio_frame,
-                                      const base::TimeTicks& playout_time,
-                                      bool is_continuous) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (audio_frame.get())
-    OnAudioFrame(std::move(audio_frame), playout_time, is_continuous);
-  PullNextAudioFrame();
-}
-
-void InProcessReceiver::GotVideoFrame(
-    const scoped_refptr<VideoFrame>& video_frame,
-    const base::TimeTicks& playout_time, bool is_continuous) {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  if (video_frame.get()) OnVideoFrame(video_frame, playout_time, is_continuous);
-  PullNextVideoFrame();
-}
-
-void InProcessReceiver::PullNextAudioFrame() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  cast_receiver_->RequestDecodedAudioFrame(base::Bind(
-      &InProcessReceiver::GotAudioFrame, weak_factory_.GetWeakPtr()));
-}
-
-void InProcessReceiver::PullNextVideoFrame() {
-  DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
-  cast_receiver_->RequestDecodedVideoFrame(base::Bind(
-      &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr()));
-}
-
-void InProcessReceiver::ReceivePacket(std::unique_ptr<Packet> packet) {
-  // TODO(Hubbe): Make an InsertPacket method instead.
-  cast_receiver_->ReceivePacket(std::move(packet));
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/in_process_receiver.h b/src/cobalt/media/cast/test/utility/in_process_receiver.h
deleted file mode 100644
index 0ed7c95..0000000
--- a/src/cobalt/media/cast/test/utility/in_process_receiver.h
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_IN_PROCESS_RECEIVER_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_IN_PROCESS_RECEIVER_H_
-
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "media/base/audio_bus.h"
-#include "media/cast/cast_config.h"
-#include "media/cast/net/cast_transport.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "net/base/ip_endpoint.h"
-
-namespace base {
-class TimeTicks;
-class WaitableEvent;
-}  // namespace base
-
-namespace net {
-class IPEndPoint;
-}  // namespace net
-
-namespace cobalt {
-namespace media {
-
-class VideoFrame;
-
-namespace cast {
-
-class CastEnvironment;
-class CastReceiver;
-class UdpTransport;
-class InProcessReceiver;
-
-// Common base functionality for an in-process Cast receiver.  This is meant to
-// be subclassed with the OnAudioFrame() and OnVideoFrame() methods implemented,
-// so that the implementor can focus on what is to be done with the frames,
-// rather than on the boilerplate "glue" code.
-class InProcessReceiver {
- public:
-  class TransportClient : public CastTransport::Client {
-   public:
-    explicit TransportClient(InProcessReceiver* in_process_receiver)
-        : in_process_receiver_(in_process_receiver) {}
-
-    void OnStatusChanged(CastTransportStatus status) final;
-    void OnLoggingEventsReceived(
-        std::unique_ptr<std::vector<FrameEvent>> frame_events,
-        std::unique_ptr<std::vector<PacketEvent>> packet_events) final {}
-    void ProcessRtpPacket(std::unique_ptr<Packet> packet) final;
-
-   private:
-    InProcessReceiver* in_process_receiver_;
-
-    DISALLOW_COPY_AND_ASSIGN(TransportClient);
-  };
-
-  // Construct a receiver with the given configuration.  |remote_end_point| can
-  // be left empty, if the transport should automatically mate with the first
-  // remote sender it encounters.
-  InProcessReceiver(const scoped_refptr<CastEnvironment>& cast_environment,
-                    const net::IPEndPoint& local_end_point,
-                    const net::IPEndPoint& remote_end_point,
-                    const FrameReceiverConfig& audio_config,
-                    const FrameReceiverConfig& video_config);
-
-  virtual ~InProcessReceiver();
-
-  // Convenience accessors.
-  scoped_refptr<CastEnvironment> cast_env() const { return cast_environment_; }
-  const FrameReceiverConfig& audio_config() const { return audio_config_; }
-  const FrameReceiverConfig& video_config() const { return video_config_; }
-
-  // Begin delivering any received audio/video frames to the OnXXXFrame()
-  // methods.
-  virtual void Start();
-
-  // Destroy the sub-compontents of this class.
-  // After this call, it is safe to destroy this object on any thread.
-  virtual void Stop();
-
- protected:
-  // To be implemented by subclasses.  These are called on the Cast MAIN thread
-  // as each frame is received.
-  virtual void OnAudioFrame(std::unique_ptr<AudioBus> audio_frame,
-                            const base::TimeTicks& playout_time,
-                            bool is_continuous) = 0;
-  virtual void OnVideoFrame(const scoped_refptr<VideoFrame>& video_frame,
-                            const base::TimeTicks& playout_time,
-                            bool is_continuous) = 0;
-
-  // Helper method that creates |transport_| and |cast_receiver_|, starts
-  // |transport_| receiving, and requests the first audio/video frame.
-  // Subclasses may final to provide additional start-up functionality.
-  virtual void StartOnMainThread();
-
-  // Helper method that destroys |transport_| and |cast_receiver_|.
-  // Subclasses may final to provide additional start-up functionality.
-  virtual void StopOnMainThread(base::WaitableEvent* event);
-
-  // Callback for the transport to notify of status changes.  A default
-  // implementation is provided here that simply logs socket errors.
-  virtual void UpdateCastTransportStatus(CastTransportStatus status);
-
- private:
-  friend class base::RefCountedThreadSafe<InProcessReceiver>;
-
-  // CastReceiver callbacks that receive a frame and then request another.  See
-  // comments for the callbacks defined in src/media/cast/cast_receiver.h for
-  // argument description and semantics.
-  void GotAudioFrame(std::unique_ptr<AudioBus> audio_frame,
-                     const base::TimeTicks& playout_time, bool is_continuous);
-  void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame,
-                     const base::TimeTicks& playout_time, bool is_continuous);
-  void PullNextAudioFrame();
-  void PullNextVideoFrame();
-
-  void ReceivePacket(std::unique_ptr<Packet> packet);
-
-  const scoped_refptr<CastEnvironment> cast_environment_;
-  const net::IPEndPoint local_end_point_;
-  const net::IPEndPoint remote_end_point_;
-  const FrameReceiverConfig audio_config_;
-  const FrameReceiverConfig video_config_;
-
-  std::unique_ptr<CastTransport> transport_;
-  std::unique_ptr<CastReceiver> cast_receiver_;
-
-  // NOTE: Weak pointers must be invalidated before all other member variables.
-  base::WeakPtrFactory<InProcessReceiver> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(InProcessReceiver);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_IN_PROCESS_RECEIVER_H_
diff --git a/src/cobalt/media/cast/test/utility/input_builder.cc b/src/cobalt/media/cast/test/utility/input_builder.cc
deleted file mode 100644
index d8b242a..0000000
--- a/src/cobalt/media/cast/test/utility/input_builder.cc
+++ /dev/null
@@ -1,78 +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.
-
-#include "media/cast/test/utility/input_builder.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <cstdio>
-
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-static const char kEnablePromptsSwitch[] = "enable-prompts";
-
-InputBuilder::InputBuilder(const std::string& title,
-                           const std::string& default_value, int low_range,
-                           int high_range)
-    : title_(title),
-      default_value_(default_value),
-      low_range_(low_range),
-      high_range_(high_range) {}
-
-InputBuilder::~InputBuilder() {}
-
-std::string InputBuilder::GetStringInput() const {
-  if (!base::CommandLine::ForCurrentProcess()->HasSwitch(kEnablePromptsSwitch))
-    return default_value_;
-
-  printf("\n%s\n", title_.c_str());
-  if (!default_value_.empty())
-    printf("Hit enter for default (%s):\n", default_value_.c_str());
-
-  printf("# ");
-  fflush(stdout);
-  char raw_input[128];
-  if (!fgets(raw_input, 128, stdin)) {
-    NOTREACHED();
-    return std::string();
-  }
-
-  std::string input = raw_input;
-  input = input.substr(0, input.size() - 1);  // Strip last \n.
-  if (input.empty() && !default_value_.empty()) return default_value_;
-
-  if (!ValidateInput(input)) {
-    printf("Invalid input. Please try again.\n");
-    return GetStringInput();
-  }
-  return input;
-}
-
-int InputBuilder::GetIntInput() const {
-  std::string string_input = GetStringInput();
-  int int_value;
-  CHECK(base::StringToInt(string_input, &int_value));
-  return int_value;
-}
-
-bool InputBuilder::ValidateInput(const std::string& input) const {
-  // Check for a valid range.
-  if (low_range_ == INT_MIN && high_range_ == INT_MAX) return true;
-  int value;
-  if (!base::StringToInt(input, &value)) return false;
-  return value >= low_range_ && value <= high_range_;
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/input_builder.h b/src/cobalt/media/cast/test/utility/input_builder.h
deleted file mode 100644
index 420461f..0000000
--- a/src/cobalt/media/cast/test/utility/input_builder.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_INPUT_BUILDER_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_INPUT_BUILDER_H_
-
-#include <limits.h>
-
-#include <string>
-
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-// This class handles general user input to the application. The user will be
-// displayed with the title string and be given a default value. When forced
-// a range, the input values should be within low_range to high_range.
-// Setting low and high to INT_MIN/INT_MAX is equivalent to not setting a range.
-class InputBuilder {
- public:
-  InputBuilder(const std::string& title, const std::string& default_value,
-               int low_range, int high_range);
-  virtual ~InputBuilder();
-
-  // Ask the user for input, reads input from the input source and returns
-  // the answer. This method will keep asking the user until a correct answer
-  // is returned and is thereby guaranteed to return a response that is
-  // acceptable within the predefined range.
-  // Input will be returned in either string or int format, base on the function
-  // called.
-  std::string GetStringInput() const;
-  int GetIntInput() const;
-
- private:
-  bool ValidateInput(const std::string& input) const;
-
-  const std::string title_;
-  const std::string default_value_;
-  // Low and high range values for input validation.
-  const int low_range_;
-  const int high_range_;
-};
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_INPUT_BUILDER_H_
diff --git a/src/cobalt/media/cast/test/utility/net_utility.cc b/src/cobalt/media/cast/test/utility/net_utility.cc
deleted file mode 100644
index c3e8a61..0000000
--- a/src/cobalt/media/cast/test/utility/net_utility.cc
+++ /dev/null
@@ -1,34 +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.
-
-#include "media/cast/test/utility/net_utility.h"
-
-#include <memory>
-
-#include "net/base/ip_address.h"
-#include "net/base/net_errors.h"
-#include "net/log/net_log_source.h"
-#include "net/udp/udp_server_socket.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-// TODO(hubbe): Move to /net/.
-net::IPEndPoint GetFreeLocalPort() {
-  std::unique_ptr<net::UDPServerSocket> receive_socket(
-      new net::UDPServerSocket(NULL, net::NetLogSource()));
-  receive_socket->AllowAddressReuse();
-  CHECK_EQ(net::OK, receive_socket->Listen(
-                        net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0)));
-  net::IPEndPoint endpoint;
-  CHECK_EQ(net::OK, receive_socket->GetLocalAddress(&endpoint));
-  return endpoint;
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/net_utility.h b/src/cobalt/media/cast/test/utility/net_utility.h
deleted file mode 100644
index 511fb8c..0000000
--- a/src/cobalt/media/cast/test/utility/net_utility.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_NET_UTILITY_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_NET_UTILITY_H_
-
-#include "net/base/ip_endpoint.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-// Determine a unused UDP port for the in-process receiver to listen on.
-// Method: Bind a UDP socket on port 0, and then check which port the
-// operating system assigned to it.
-net::IPEndPoint GetFreeLocalPort();
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_NET_UTILITY_H_
diff --git a/src/cobalt/media/cast/test/utility/netload.py b/src/cobalt/media/cast/test/utility/netload.py
deleted file mode 100755
index 248eca2..0000000
--- a/src/cobalt/media/cast/test/utility/netload.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-# 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.
-#
-# Simple client/server script for generating an unlimited TCP stream.
-# see shadow.sh for how it's intended to be used.
-
-import socket
-import sys
-import thread
-import time
-
-sent = 0
-received = 0
-
-def Sink(socket):
-  global received
-  while True:
-    tmp = socket.recv(4096)
-    received += len(tmp)
-    if not tmp:
-      break;
-
-def Spew(socket):
-  global sent
-  data = " " * 4096
-  while True:
-    tmp = socket.send(data)
-    if tmp <= 0:
-      break
-    sent += tmp;
-
-def PrintStats():
-  global sent
-  global received
-  last_report = time.time()
-  last_sent = 0
-  last_received = 0
-  while True:
-    time.sleep(5)
-    now = time.time();
-    sent_now = sent
-    received_now = received
-    delta = now - last_report
-    sent_mbps = ((sent_now - last_sent) * 8.0 / 1000000) / delta
-    received_mbps = ((received_now - last_received) * 8.0 / 1000000) / delta
-    print "Sent: %5.2f mbps  Received: %5.2f mbps" % (sent_mbps, received_mbps)
-    last_report = now
-    last_sent = sent_now
-    last_received = received_now
-
-def Serve(socket, upload=True, download=True):
-  while True:
-    (s, addr) = socket.accept()
-    if upload:
-      thread.start_new_thread(Spew, (s,))
-    if download:
-      thread.start_new_thread(Sink, (s,))
-
-def Receiver(port, upload=True, download=True):
-  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-  s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-  s.bind(('', port))
-  s.listen(5)
-  thread.start_new_thread(Serve, (s, upload, download))
-
-
-def Connect(to_hostport, upload=True, download=False):
-  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-  s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-  s.connect(to_hostport)
-  if upload:
-    thread.start_new_thread(Spew, (s,))
-  if download:
-    thread.start_new_thread(Sink, (s,))
-
-
-def Usage():
-  print "One of:"
-  print "%s listen <port>" % sys.arv[0]
-  print "%s upload <host> <port>" % sys.arv[0]
-  print "%s download <host> <port>" % sys.arv[0]
-  print "%s updown <host> <port>" % sys.arv[0]
-  sys.exit(1)
-
-if len(sys.argv) < 2:
-  Usage()
-if sys.argv[1] == "listen":
-  Receiver(int(sys.argv[2]))
-elif sys.argv[1] == "download":
-  Connect( (sys.argv[2], int(sys.argv[3])), upload=False, download=True)
-elif sys.argv[1] == "upload":
-  Connect( (sys.argv[2], int(sys.argv[3])), upload=True, download=False)
-elif sys.argv[1] == "updown":
-  Connect( (sys.argv[2], int(sys.argv[3])), upload=True, download=True)
-else:
-  Usage()
-
-PrintStats()
diff --git a/src/cobalt/media/cast/test/utility/shadow.sh b/src/cobalt/media/cast/test/utility/shadow.sh
deleted file mode 100755
index 4163fd0..0000000
--- a/src/cobalt/media/cast/test/utility/shadow.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/sh
-# 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.
-#
-# The purpose of this script is to set up all the neccessary magic to
-# pipe network traffic through a user-space process. That user-space
-# process can then delay, reorder and drop packets as it pleases to
-# emulate various network environments.
-#
-# The script currently assumes that you communicate with your cast streaming
-# receiver through eth1. After running "shadow.sh start", your network will
-# look something like this:
-#
-#              +--------------------------------------------------+
-#              |            Your linux machine                    |
-#              | +---------------+                                |
-# cast         | |shadowbr bridge|               +-------------+  |
-# streaming <--+-+---> eth1      |               |routing table|  |
-# receiver     | |     tap2  <---+-> tap_proxy <-+-> tap1      |  |
-#              | |  +->veth      |               |   eth0 <----+--+->internet
-#              | +--+------------+               |   lo        |  |
-#              |    |                            +-------------+  |
-#              |    |      +------------------+       ^           |
-#              |    |      |shadow container  |       |           |
-#              |    +------+-->veth           |     chrome        |
-#              |           | netload.py server|  netload.py client|
-#              |           +------------------+                   |
-#              +--------------------------------------------------+
-#
-# The result should be that all traffic to/from the cast streaming receiver
-# will go through tap_proxy. All traffic to/from the shadow container
-# will also go through the tap_proxy. (A container is kind of like a
-# virtual machine, but more lightweight.) Running "shadow.sh start" does
-# not start the tap_proxy, so you'll have to start it manually with
-# the command "tap_proxy tap1 tap2 <network_profile>" where
-# <network_profile> is one of "perfect", "good", "wifi", "bad" or "evil".
-#
-# While testing mirroring, we can now generate TCP traffic through
-# the tap proxy by talking to the netload server inside the "shadow"
-# container by using the following command:
-#
-# $ netload.py upload IP PORT
-#
-# The IP and PORT are printed out by this script when you run
-# "shadow.sh start", but will generally be the *.*.*.253 address
-# of the eth1 network, so hopefully that's not already taken...
-
-set -x
-
-DEV=eth1
-TAP1=tap1
-TAP2=tap2
-
-IP="$(ifconfig $DEV | sed -n 's@.*inet addr:\([^ ]*\).*@\1@gp')"
-MASK="$(ifconfig $DEV | sed -n 's@.*Mask:\([^ ]*\).*@\1@gp')"
-BCAST="$(ifconfig $DEV | sed -n 's@.*Bcast:\([^ ]*\).*@\1@gp')"
-NET=$(route -n | grep $DEV | head -1 | awk '{print $1}')
-DIR=$(dirname "$0")
-
-case "$MASK" in
-  255.255.255.0) MASK_BITS=24 ;;
-  255.255.0.0) MASK_BITS=16 ;;
-  255.0.0.0) MASK_BITS=8 ;;
-  *)
-    echo "Unknown network mask"
-    exit 1
-  ;;
-esac
-
-SHADOWIP="$(echo $IP | sed 's@[^.]*$@@g')253"
-SHADOWCONF="/tmp/shadowconf.$$"
-cat <<EOF >$SHADOWCONF
-lxc.utsname = shadow
-lxc.network.type = veth
-lxc.network.link = shadowbr
-lxc.network.flags = up
-lxc.network.ipv4 = $SHADOWIP/$MASK_BITS
-lxc.network.ipv4.gateway = $IP
-lxc.kmsg = 0
-EOF
-
-trap "rm $SHADOWCONF" SIGINT SIGTERM EXIT
-LXC_COMMON="-n shadow -f $SHADOWCONF"
-
-case "$1" in
-  start)
-    openvpn --mktun --dev $TAP1
-    openvpn --mktun --dev $TAP2
-    ifconfig $TAP1 $IP netmask $MASK broadcast $BCAST up
-    ifconfig $TAP2 up
-    route add -net $NET netmask $MASK $TAP1
-    brctl addbr shadowbr
-    brctl addif shadowbr $TAP2 $DEV
-    ifconfig shadowbr up
-    lxc-create $LXC_COMMON
-    lxc-execute $LXC_COMMON -- \
-       "$DIRNAME/netload.py listen 9999" >/dev/null </dev/null 2>&1 &
-    echo "Now run: tap_proxy $TAP1 $TAP2 wifi"
-    echo "Data sink/source is available on $SHADOWIP 9999"
-  ;;
-
-  stop)
-    lxc-kill -n shadow
-    sleep 1
-    lxc-destroy $LXC_COMMON
-    ifconfig $TAP1 down
-    ifconfig $TAP2 down
-    ifconfig shadowbr down
-    brctl delbr shadowbr
-    openvpn --rmtun --dev $TAP1
-    openvpn --rmtun --dev $TAP2
-  ;;
-
-  *)
-    echo "$0 start/stop"
-    echo "Read $0 for more information."
-  ;;
-esac
-
-
diff --git a/src/cobalt/media/cast/test/utility/standalone_cast_environment.cc b/src/cobalt/media/cast/test/utility/standalone_cast_environment.cc
deleted file mode 100644
index 41c6e94..0000000
--- a/src/cobalt/media/cast/test/utility/standalone_cast_environment.cc
+++ /dev/null
@@ -1,48 +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.
-
-#include "media/cast/test/utility/standalone_cast_environment.h"
-
-#include "base/memory/ptr_util.h"
-#include "base/time/default_tick_clock.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-StandaloneCastEnvironment::StandaloneCastEnvironment()
-    : CastEnvironment(
-          base::WrapUnique<base::TickClock>(new base::DefaultTickClock()), NULL,
-          NULL, NULL),
-      main_thread_("StandaloneCastEnvironment Main"),
-      audio_thread_("StandaloneCastEnvironment Audio"),
-      video_thread_("StandaloneCastEnvironment Video") {
-#define CREATE_TASK_RUNNER(name, options)   \
-  name##_thread_.StartWithOptions(options); \
-  CastEnvironment::name##_thread_proxy_ = name##_thread_.task_runner()
-
-  CREATE_TASK_RUNNER(main,
-                     base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
-  CREATE_TASK_RUNNER(audio, base::Thread::Options());
-  CREATE_TASK_RUNNER(video, base::Thread::Options());
-#undef CREATE_TASK_RUNNER
-}
-
-StandaloneCastEnvironment::~StandaloneCastEnvironment() {
-  CHECK(CalledOnValidThread());
-  CHECK(!main_thread_.IsRunning());
-  CHECK(!audio_thread_.IsRunning());
-  CHECK(!video_thread_.IsRunning());
-}
-
-void StandaloneCastEnvironment::Shutdown() {
-  CHECK(CalledOnValidThread());
-  main_thread_.Stop();
-  audio_thread_.Stop();
-  video_thread_.Stop();
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/standalone_cast_environment.h b/src/cobalt/media/cast/test/utility/standalone_cast_environment.h
deleted file mode 100644
index c23779c..0000000
--- a/src/cobalt/media/cast/test/utility/standalone_cast_environment.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_
-
-#include "base/macros.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_checker.h"
-#include "media/cast/cast_environment.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// A complete CastEnvironment where all task runners are spurned from
-// internally-owned threads.  Uses base::DefaultTickClock as a clock.
-//
-// A user of StandaloneCastEnvironment *must* call Shutdown() on the same thread
-// that constructed the instance before the ref-count reaches zero.
-// http://crbug.com/396480
-class StandaloneCastEnvironment : public CastEnvironment,
-                                  public base::ThreadChecker {
- public:
-  StandaloneCastEnvironment();
-
-  // Stops all threads backing the task runners, blocking the caller until
-  // complete.
-  void Shutdown();
-
- protected:
-  ~StandaloneCastEnvironment() override;
-
-  base::Thread main_thread_;
-  base::Thread audio_thread_;
-  base::Thread video_thread_;
-
-  DISALLOW_COPY_AND_ASSIGN(StandaloneCastEnvironment);
-};
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_
diff --git a/src/cobalt/media/cast/test/utility/tap_proxy.cc b/src/cobalt/media/cast/test/utility/tap_proxy.cc
deleted file mode 100644
index 2d73f94..0000000
--- a/src/cobalt/media/cast/test/utility/tap_proxy.cc
+++ /dev/null
@@ -1,313 +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.
-
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/if_tun.h>
-#include <linux/types.h>
-#include <math.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <deque>
-#include <map>
-#include <memory>
-#include <utility>
-
-#include "base/at_exit.h"
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/files/file_descriptor_watcher_posix.h"
-#include "base/logging.h"
-#include "base/rand_util.h"
-#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/time/default_tick_clock.h"
-#include "media/cast/test/utility/udp_proxy.h"
-#include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
-#include "net/udp/udp_socket.h"
-#include "starboard/memory.h"
-#include "starboard/string.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-const size_t kMaxPacketSize = 4096;
-
-class SendToFDPipe : public PacketPipe {
- public:
-  explicit SendToFDPipe(int fd) : fd_(fd) {}
-  void Send(std::unique_ptr<Packet> packet) final {
-    while (1) {
-      int written =
-          write(fd_, reinterpret_cast<char*>(&packet->front()), packet->size());
-      if (written < 0) {
-        if (errno == EINTR) continue;
-        perror("write");
-        exit(1);
-      }
-      if (written != static_cast<int>(packet->size())) {
-        fprintf(stderr, "Truncated write!\n");
-        exit(1);
-      }
-      break;
-    }
-  }
-
- private:
-  int fd_;
-};
-
-class QueueManager {
- public:
-  QueueManager(int input_fd, int output_fd, std::unique_ptr<PacketPipe> pipe)
-      : input_fd_(input_fd), packet_pipe_(std::move(pipe)) {
-    read_socket_watch_controller_ = base::FileDescriptorWatcher::WatchReadable(
-        input_fd_, base::Bind(&QueueManager::OnFileCanReadWithoutBlocking,
-                              base::Unretained(this)));
-
-    std::unique_ptr<PacketPipe> tmp(new SendToFDPipe(output_fd));
-    if (packet_pipe_) {
-      packet_pipe_->AppendToPipe(std::move(tmp));
-    } else {
-      packet_pipe_ = std::move(tmp);
-    }
-    packet_pipe_->InitOnIOThread(base::ThreadTaskRunnerHandle::Get(),
-                                 &tick_clock_);
-  }
-
- private:
-  void OnFileCanReadWithoutBlocking() {
-    std::unique_ptr<Packet> packet(new Packet(kMaxPacketSize));
-    int nread = read(input_fd_, reinterpret_cast<char*>(&packet->front()),
-                     kMaxPacketSize);
-    if (nread < 0) {
-      if (errno == EINTR) return;
-      perror("read");
-      exit(1);
-    }
-    if (nread == 0) return;
-    packet->resize(nread);
-    packet_pipe_->Send(std::move(packet));
-  }
-
-  int input_fd_;
-  std::unique_ptr<PacketPipe> packet_pipe_;
-  std::unique_ptr<base::FileDescriptorWatcher::Controller>
-      read_socket_watch_controller_;
-  base::DefaultTickClock tick_clock_;
-};
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-base::TimeTicks last_printout;
-
-class ByteCounter {
- public:
-  ByteCounter() : bytes_(0), packets_(0) { push(base::TimeTicks::Now()); }
-
-  base::TimeDelta time_range() {
-    return time_data_.back() - time_data_.front();
-  }
-
-  void push(base::TimeTicks now) {
-    byte_data_.push_back(bytes_);
-    packet_data_.push_back(packets_);
-    time_data_.push_back(now);
-    while (time_range().InSeconds() > 10) {
-      byte_data_.pop_front();
-      packet_data_.pop_front();
-      time_data_.pop_front();
-    }
-  }
-
-  double megabits_per_second() {
-    double megabits = (byte_data_.back() - byte_data_.front()) * 8 / 1E6;
-    return megabits / time_range().InSecondsF();
-  }
-
-  double packets_per_second() {
-    double packets = packet_data_.back() - packet_data_.front();
-    return packets / time_range().InSecondsF();
-  }
-
-  void Increment(uint64_t x) {
-    bytes_ += x;
-    packets_++;
-  }
-
- private:
-  uint64_t bytes_;
-  uint64_t packets_;
-  std::deque<uint64_t> byte_data_;
-  std::deque<uint64_t> packet_data_;
-  std::deque<base::TimeTicks> time_data_;
-};
-
-ByteCounter in_pipe_input_counter;
-ByteCounter in_pipe_output_counter;
-ByteCounter out_pipe_input_counter;
-ByteCounter out_pipe_output_counter;
-
-class ByteCounterPipe : public media::cast::test::PacketPipe {
- public:
-  explicit ByteCounterPipe(ByteCounter* counter) : counter_(counter) {}
-  void Send(std::unique_ptr<media::cast::Packet> packet) final {
-    counter_->Increment(packet->size());
-    pipe_->Send(std::move(packet));
-  }
-
- private:
-  ByteCounter* counter_;
-};
-
-void SetupByteCounters(std::unique_ptr<media::cast::test::PacketPipe>* pipe,
-                       ByteCounter* pipe_input_counter,
-                       ByteCounter* pipe_output_counter) {
-  media::cast::test::PacketPipe* new_pipe =
-      new ByteCounterPipe(pipe_input_counter);
-  new_pipe->AppendToPipe(std::move(*pipe));
-  new_pipe->AppendToPipe(std::unique_ptr<media::cast::test::PacketPipe>(
-      new ByteCounterPipe(pipe_output_counter)));
-  pipe->reset(new_pipe);
-}
-
-void CheckByteCounters() {
-  base::TimeTicks now = base::TimeTicks::Now();
-  in_pipe_input_counter.push(now);
-  in_pipe_output_counter.push(now);
-  out_pipe_input_counter.push(now);
-  out_pipe_output_counter.push(now);
-  if ((now - last_printout).InSeconds() >= 5) {
-    fprintf(stderr, "Sending  : %5.2f / %5.2f mbps %6.2f / %6.2f packets / s\n",
-            in_pipe_output_counter.megabits_per_second(),
-            in_pipe_input_counter.megabits_per_second(),
-            in_pipe_output_counter.packets_per_second(),
-            in_pipe_input_counter.packets_per_second());
-    fprintf(stderr, "Receiving: %5.2f / %5.2f mbps %6.2f / %6.2f packets / s\n",
-            out_pipe_output_counter.megabits_per_second(),
-            out_pipe_input_counter.megabits_per_second(),
-            out_pipe_output_counter.packets_per_second(),
-            out_pipe_input_counter.packets_per_second());
-
-    last_printout = now;
-  }
-  base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
-      FROM_HERE, base::Bind(&CheckByteCounters),
-      base::TimeDelta::FromMilliseconds(100));
-}
-
-int tun_alloc(char* dev, int flags) {
-  struct ifreq ifr;
-  int fd, err;
-  const char* clonedev = "/dev/net/tun";
-
-  /* Arguments taken by the function:
-   *
-   * char *dev: the name of an interface (or '\0'). MUST have enough
-   *   space to hold the interface name if '\0' is passed
-   * int flags: interface flags (eg, IFF_TUN etc.)
-   */
-
-  /* open the clone device */
-  if ((fd = open(clonedev, O_RDWR)) < 0) {
-    return fd;
-  }
-
-  /* preparation of the struct ifr, of type "struct ifreq" */
-  SbMemorySet(&ifr, 0, sizeof(ifr));
-
-  ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */
-
-  if (*dev) {
-    /* if a device name was specified, put it in the structure; otherwise,
-     * the kernel will try to allocate the "next" device of the
-     * specified type */
-    SbStringCopy(ifr.ifr_name, dev, IFNAMSIZ);
-  }
-
-  /* try to create the device */
-  if ((err = ioctl(fd, TUNSETIFF, &ifr)) < 0) {
-    close(fd);
-    return err;
-  }
-
-  if (!*dev) {
-    /* if the operation was successful, write back the name of the
-     * interface to the variable "dev", so the caller can know
-     * it. Note that the caller MUST reserve space in *dev (see calling
-     * code below) */
-    SbStringCopyUnsafe(dev, ifr.ifr_name);
-  }
-
-  /* this is the special file descriptor that the caller will use to talk
-   * with the virtual interface */
-  return fd;
-}
-
-int main(int argc, char** argv) {
-  base::AtExitManager exit_manager;
-  base::CommandLine::Init(argc, argv);
-  InitLogging(logging::LoggingSettings());
-
-  if (argc < 4) {
-    fprintf(stderr, "Usage: tap_proxy tap1 tap2 type\n");
-    fprintf(stderr,
-            "Where 'type' is one of perfect, good, wifi, bad or evil\n");
-    exit(1);
-  }
-
-  std::unique_ptr<media::cast::test::PacketPipe> in_pipe, out_pipe;
-  std::string network_type = argv[3];
-  if (network_type == "perfect") {
-    // No action needed.
-  } else if (network_type == "good") {
-    in_pipe = media::cast::test::GoodNetwork();
-    out_pipe = media::cast::test::GoodNetwork();
-  } else if (network_type == "wifi") {
-    in_pipe = media::cast::test::WifiNetwork();
-    out_pipe = media::cast::test::WifiNetwork();
-  } else if (network_type == "bad") {
-    in_pipe = media::cast::test::BadNetwork();
-    out_pipe = media::cast::test::BadNetwork();
-  } else if (network_type == "evil") {
-    in_pipe = media::cast::test::EvilNetwork();
-    out_pipe = media::cast::test::EvilNetwork();
-  } else {
-    fprintf(stderr, "Unknown network type.\n");
-    exit(1);
-  }
-
-  SetupByteCounters(&in_pipe, &in_pipe_input_counter, &in_pipe_output_counter);
-  SetupByteCounters(&out_pipe, &out_pipe_input_counter,
-                    &out_pipe_output_counter);
-
-  int fd1 = tun_alloc(argv[1], IFF_TAP);
-  int fd2 = tun_alloc(argv[2], IFF_TAP);
-
-  base::MessageLoopForIO message_loop;
-  base::FileDescriptorWatcher file_descriptor_watcher(&message_loop);
-  last_printout = base::TimeTicks::Now();
-  media::cast::test::QueueManager qm1(fd1, fd2, std::move(in_pipe));
-  media::cast::test::QueueManager qm2(fd2, fd1, std::move(out_pipe));
-  CheckByteCounters();
-  printf("Press Ctrl-C when done.\n");
-  base::RunLoop().Run();
-}
diff --git a/src/cobalt/media/cast/test/utility/test_util.cc b/src/cobalt/media/cast/test/utility/test_util.cc
deleted file mode 100644
index f87a1ed..0000000
--- a/src/cobalt/media/cast/test/utility/test_util.cc
+++ /dev/null
@@ -1,40 +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.
-
-#include <math.h>
-
-#include <algorithm>
-
-#include "base/strings/stringprintf.h"
-#include "media/cast/test/utility/test_util.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-MeanAndError::MeanAndError(const std::vector<double>& values) {
-  double sum = 0.0;
-  double sqr_sum = 0.0;
-  num_values = values.size();
-  if (num_values) {
-    for (size_t i = 0; i < num_values; i++) {
-      sum += values[i];
-      sqr_sum += values[i] * values[i];
-    }
-    mean = sum / num_values;
-    std_dev =
-        sqrt(std::max(0.0, num_values * sqr_sum - sum * sum)) / num_values;
-  }
-}
-
-std::string MeanAndError::AsString() const {
-  return base::StringPrintf("%f +/- %f", mean, std_dev);
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/test_util.h b/src/cobalt/media/cast/test/utility/test_util.h
deleted file mode 100644
index 6aff7eb..0000000
--- a/src/cobalt/media/cast/test/utility/test_util.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_TEST_UTIL_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_TEST_UTIL_H_
-
-#include <string>
-#include <vector>
-
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-class MeanAndError {
- public:
-  MeanAndError() {}
-  explicit MeanAndError(const std::vector<double>& values);
-  std::string AsString() const;
-
-  size_t num_values;
-  double mean;
-  double std_dev;
-};
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_TEST_UTIL_H_
diff --git a/src/cobalt/media/cast/test/utility/udp_proxy.cc b/src/cobalt/media/cast/test/utility/udp_proxy.cc
deleted file mode 100644
index 64b7254..0000000
--- a/src/cobalt/media/cast/test/utility/udp_proxy.cc
+++ /dev/null
@@ -1,826 +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.
-
-#include "media/cast/test/utility/udp_proxy.h"
-
-#include <math.h>
-#include <stdlib.h>
-
-#include <deque>
-#include <utility>
-#include <vector>
-
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/rand_util.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/time/default_tick_clock.h"
-#include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
-#include "net/log/net_log_source.h"
-#include "net/udp/udp_server_socket.h"
-#include "starboard/types.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-const size_t kMaxPacketSize = 65536;
-
-PacketPipe::PacketPipe() {}
-PacketPipe::~PacketPipe() {}
-void PacketPipe::InitOnIOThread(
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-    base::TickClock* clock) {
-  task_runner_ = task_runner;
-  clock_ = clock;
-  if (pipe_) {
-    pipe_->InitOnIOThread(task_runner, clock);
-  }
-}
-void PacketPipe::AppendToPipe(std::unique_ptr<PacketPipe> pipe) {
-  if (pipe_) {
-    pipe_->AppendToPipe(std::move(pipe));
-  } else {
-    pipe_ = std::move(pipe);
-  }
-}
-
-// Roughly emulates a buffer inside a device.
-// If the buffer is full, packets are dropped.
-// Packets are output at a maximum bandwidth.
-class Buffer : public PacketPipe {
- public:
-  Buffer(size_t buffer_size, double max_megabits_per_second)
-      : buffer_size_(0),
-        max_buffer_size_(buffer_size),
-        max_megabits_per_second_(max_megabits_per_second),
-        weak_factory_(this) {
-    CHECK_GT(max_buffer_size_, 0UL);
-    CHECK_GT(max_megabits_per_second, 0);
-  }
-
-  void Send(std::unique_ptr<Packet> packet) final {
-    if (packet->size() + buffer_size_ <= max_buffer_size_) {
-      buffer_size_ += packet->size();
-      buffer_.push_back(linked_ptr<Packet>(packet.release()));
-      if (buffer_.size() == 1) {
-        Schedule();
-      }
-    }
-  }
-
- private:
-  void Schedule() {
-    last_schedule_ = clock_->NowTicks();
-    double megabits = buffer_.front()->size() * 8 / 1000000.0;
-    double seconds = megabits / max_megabits_per_second_;
-    int64_t microseconds = static_cast<int64_t>(seconds * 1E6);
-    task_runner_->PostDelayedTask(
-        FROM_HERE,
-        base::Bind(&Buffer::ProcessBuffer, weak_factory_.GetWeakPtr()),
-        base::TimeDelta::FromMicroseconds(microseconds));
-  }
-
-  void ProcessBuffer() {
-    int64_t bytes_to_send = static_cast<int64_t>(
-        (clock_->NowTicks() - last_schedule_).InSecondsF() *
-        max_megabits_per_second_ * 1E6 / 8);
-    if (bytes_to_send < static_cast<int64_t>(buffer_.front()->size())) {
-      bytes_to_send = buffer_.front()->size();
-    }
-    while (!buffer_.empty() &&
-           static_cast<int64_t>(buffer_.front()->size()) <= bytes_to_send) {
-      CHECK(!buffer_.empty());
-      std::unique_ptr<Packet> packet(buffer_.front().release());
-      bytes_to_send -= packet->size();
-      buffer_size_ -= packet->size();
-      buffer_.pop_front();
-      pipe_->Send(std::move(packet));
-    }
-    if (!buffer_.empty()) {
-      Schedule();
-    }
-  }
-
-  std::deque<linked_ptr<Packet> > buffer_;
-  base::TimeTicks last_schedule_;
-  size_t buffer_size_;
-  size_t max_buffer_size_;
-  double max_megabits_per_second_;  // megabits per second
-  base::WeakPtrFactory<Buffer> weak_factory_;
-};
-
-std::unique_ptr<PacketPipe> NewBuffer(size_t buffer_size, double bandwidth) {
-  return std::unique_ptr<PacketPipe>(new Buffer(buffer_size, bandwidth));
-}
-
-class RandomDrop : public PacketPipe {
- public:
-  explicit RandomDrop(double drop_fraction)
-      : drop_fraction_(static_cast<int>(drop_fraction * RAND_MAX)) {}
-
-  void Send(std::unique_ptr<Packet> packet) final {
-    if (rand() > drop_fraction_) {
-      pipe_->Send(std::move(packet));
-    }
-  }
-
- private:
-  int drop_fraction_;
-};
-
-std::unique_ptr<PacketPipe> NewRandomDrop(double drop_fraction) {
-  return std::unique_ptr<PacketPipe>(new RandomDrop(drop_fraction));
-}
-
-class SimpleDelayBase : public PacketPipe {
- public:
-  SimpleDelayBase() : weak_factory_(this) {}
-  ~SimpleDelayBase() override {}
-
-  void Send(std::unique_ptr<Packet> packet) override {
-    double seconds = GetDelay();
-    task_runner_->PostDelayedTask(
-        FROM_HERE,
-        base::Bind(&SimpleDelayBase::SendInternal, weak_factory_.GetWeakPtr(),
-                   base::Passed(&packet)),
-        base::TimeDelta::FromMicroseconds(static_cast<int64_t>(seconds * 1E6)));
-  }
-
- protected:
-  virtual double GetDelay() = 0;
-
- private:
-  virtual void SendInternal(std::unique_ptr<Packet> packet) {
-    pipe_->Send(std::move(packet));
-  }
-
-  base::WeakPtrFactory<SimpleDelayBase> weak_factory_;
-};
-
-class ConstantDelay : public SimpleDelayBase {
- public:
-  explicit ConstantDelay(double delay_seconds)
-      : delay_seconds_(delay_seconds) {}
-  double GetDelay() final { return delay_seconds_; }
-
- private:
-  double delay_seconds_;
-};
-
-std::unique_ptr<PacketPipe> NewConstantDelay(double delay_seconds) {
-  return std::unique_ptr<PacketPipe>(new ConstantDelay(delay_seconds));
-}
-
-class RandomUnsortedDelay : public SimpleDelayBase {
- public:
-  explicit RandomUnsortedDelay(double random_delay)
-      : random_delay_(random_delay) {}
-
-  double GetDelay() override { return random_delay_ * base::RandDouble(); }
-
- private:
-  double random_delay_;
-};
-
-std::unique_ptr<PacketPipe> NewRandomUnsortedDelay(double random_delay) {
-  return std::unique_ptr<PacketPipe>(new RandomUnsortedDelay(random_delay));
-}
-
-class DuplicateAndDelay : public RandomUnsortedDelay {
- public:
-  DuplicateAndDelay(double delay_min, double random_delay)
-      : RandomUnsortedDelay(random_delay), delay_min_(delay_min) {}
-  void Send(std::unique_ptr<Packet> packet) final {
-    pipe_->Send(std::unique_ptr<Packet>(new Packet(*packet.get())));
-    RandomUnsortedDelay::Send(std::move(packet));
-  }
-  double GetDelay() final {
-    return RandomUnsortedDelay::GetDelay() + delay_min_;
-  }
-
- private:
-  double delay_min_;
-};
-
-std::unique_ptr<PacketPipe> NewDuplicateAndDelay(double delay_min,
-                                                 double random_delay) {
-  return std::unique_ptr<PacketPipe>(
-      new DuplicateAndDelay(delay_min, random_delay));
-}
-
-class RandomSortedDelay : public PacketPipe {
- public:
-  RandomSortedDelay(double random_delay, double extra_delay,
-                    double seconds_between_extra_delay)
-      : random_delay_(random_delay),
-        extra_delay_(extra_delay),
-        seconds_between_extra_delay_(seconds_between_extra_delay),
-        weak_factory_(this) {}
-
-  void Send(std::unique_ptr<Packet> packet) final {
-    buffer_.push_back(linked_ptr<Packet>(packet.release()));
-    if (buffer_.size() == 1) {
-      next_send_ = std::max(
-          clock_->NowTicks() +
-              base::TimeDelta::FromSecondsD(base::RandDouble() * random_delay_),
-          next_send_);
-      ProcessBuffer();
-    }
-  }
-  void InitOnIOThread(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock) final {
-    PacketPipe::InitOnIOThread(task_runner, clock);
-    // As we start the stream, assume that we are in a random
-    // place between two extra delays, thus multiplier = 1.0;
-    ScheduleExtraDelay(1.0);
-  }
-
- private:
-  void ScheduleExtraDelay(double mult) {
-    double seconds = seconds_between_extra_delay_ * mult * base::RandDouble();
-    int64_t microseconds = static_cast<int64_t>(seconds * 1E6);
-    task_runner_->PostDelayedTask(
-        FROM_HERE, base::Bind(&RandomSortedDelay::CauseExtraDelay,
-                              weak_factory_.GetWeakPtr()),
-        base::TimeDelta::FromMicroseconds(microseconds));
-  }
-
-  void CauseExtraDelay() {
-    next_send_ = std::max<base::TimeTicks>(
-        clock_->NowTicks() + base::TimeDelta::FromMicroseconds(
-                                 static_cast<int64_t>(extra_delay_ * 1E6)),
-        next_send_);
-    // An extra delay just happened, wait up to seconds_between_extra_delay_*2
-    // before scheduling another one to make the average equal to
-    // seconds_between_extra_delay_.
-    ScheduleExtraDelay(2.0);
-  }
-
-  void ProcessBuffer() {
-    base::TimeTicks now = clock_->NowTicks();
-    while (!buffer_.empty() && next_send_ <= now) {
-      std::unique_ptr<Packet> packet(buffer_.front().release());
-      pipe_->Send(std::move(packet));
-      buffer_.pop_front();
-
-      next_send_ +=
-          base::TimeDelta::FromSecondsD(base::RandDouble() * random_delay_);
-    }
-
-    if (!buffer_.empty()) {
-      task_runner_->PostDelayedTask(
-          FROM_HERE, base::Bind(&RandomSortedDelay::ProcessBuffer,
-                                weak_factory_.GetWeakPtr()),
-          next_send_ - now);
-    }
-  }
-
-  base::TimeTicks block_until_;
-  std::deque<linked_ptr<Packet> > buffer_;
-  double random_delay_;
-  double extra_delay_;
-  double seconds_between_extra_delay_;
-  base::TimeTicks next_send_;
-  base::WeakPtrFactory<RandomSortedDelay> weak_factory_;
-};
-
-std::unique_ptr<PacketPipe> NewRandomSortedDelay(
-    double random_delay, double extra_delay,
-    double seconds_between_extra_delay) {
-  return std::unique_ptr<PacketPipe>(new RandomSortedDelay(
-      random_delay, extra_delay, seconds_between_extra_delay));
-}
-
-class NetworkGlitchPipe : public PacketPipe {
- public:
-  NetworkGlitchPipe(double average_work_time, double average_outage_time)
-      : works_(false),
-        max_work_time_(average_work_time * 2),
-        max_outage_time_(average_outage_time * 2),
-        weak_factory_(this) {}
-
-  void InitOnIOThread(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock) final {
-    PacketPipe::InitOnIOThread(task_runner, clock);
-    Flip();
-  }
-
-  void Send(std::unique_ptr<Packet> packet) final {
-    if (works_) {
-      pipe_->Send(std::move(packet));
-    }
-  }
-
- private:
-  void Flip() {
-    works_ = !works_;
-    double seconds =
-        base::RandDouble() * (works_ ? max_work_time_ : max_outage_time_);
-    int64_t microseconds = static_cast<int64_t>(seconds * 1E6);
-    task_runner_->PostDelayedTask(
-        FROM_HERE,
-        base::Bind(&NetworkGlitchPipe::Flip, weak_factory_.GetWeakPtr()),
-        base::TimeDelta::FromMicroseconds(microseconds));
-  }
-
-  bool works_;
-  double max_work_time_;
-  double max_outage_time_;
-  base::WeakPtrFactory<NetworkGlitchPipe> weak_factory_;
-};
-
-std::unique_ptr<PacketPipe> NewNetworkGlitchPipe(double average_work_time,
-                                                 double average_outage_time) {
-  return std::unique_ptr<PacketPipe>(
-      new NetworkGlitchPipe(average_work_time, average_outage_time));
-}
-
-// Internal buffer object for a client of the IPP model.
-class InterruptedPoissonProcess::InternalBuffer : public PacketPipe {
- public:
-  InternalBuffer(base::WeakPtr<InterruptedPoissonProcess> ipp, size_t size)
-      : ipp_(ipp),
-        stored_size_(0),
-        stored_limit_(size),
-        clock_(NULL),
-        weak_factory_(this) {}
-
-  void Send(std::unique_ptr<Packet> packet) final {
-    // Drop if buffer is full.
-    if (stored_size_ >= stored_limit_) return;
-    stored_size_ += packet->size();
-    buffer_.push_back(linked_ptr<Packet>(packet.release()));
-    buffer_time_.push_back(clock_->NowTicks());
-    DCHECK(buffer_.size() == buffer_time_.size());
-  }
-
-  void InitOnIOThread(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock) final {
-    clock_ = clock;
-    if (ipp_) ipp_->InitOnIOThread(task_runner, clock);
-    PacketPipe::InitOnIOThread(task_runner, clock);
-  }
-
-  void SendOnePacket() {
-    std::unique_ptr<Packet> packet(buffer_.front().release());
-    stored_size_ -= packet->size();
-    buffer_.pop_front();
-    buffer_time_.pop_front();
-    pipe_->Send(std::move(packet));
-    DCHECK(buffer_.size() == buffer_time_.size());
-  }
-
-  bool Empty() const { return buffer_.empty(); }
-
-  base::TimeTicks FirstPacketTime() const {
-    DCHECK(!buffer_time_.empty());
-    return buffer_time_.front();
-  }
-
-  base::WeakPtr<InternalBuffer> GetWeakPtr() {
-    return weak_factory_.GetWeakPtr();
-  }
-
- private:
-  const base::WeakPtr<InterruptedPoissonProcess> ipp_;
-  size_t stored_size_;
-  const size_t stored_limit_;
-  std::deque<linked_ptr<Packet> > buffer_;
-  std::deque<base::TimeTicks> buffer_time_;
-  base::TickClock* clock_;
-  base::WeakPtrFactory<InternalBuffer> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(InternalBuffer);
-};
-
-InterruptedPoissonProcess::InterruptedPoissonProcess(
-    const std::vector<double>& average_rates, double coef_burstiness,
-    double coef_variance, uint32_t rand_seed)
-    : clock_(NULL),
-      average_rates_(average_rates),
-      coef_burstiness_(coef_burstiness),
-      coef_variance_(coef_variance),
-      rate_index_(0),
-      on_state_(true),
-      weak_factory_(this) {
-  mt_rand_.init_genrand(rand_seed);
-  DCHECK(!average_rates.empty());
-  ComputeRates();
-}
-
-InterruptedPoissonProcess::~InterruptedPoissonProcess() {}
-
-void InterruptedPoissonProcess::InitOnIOThread(
-    const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-    base::TickClock* clock) {
-  // Already initialized and started.
-  if (task_runner_.get() && clock_) return;
-  task_runner_ = task_runner;
-  clock_ = clock;
-  UpdateRates();
-  SwitchOn();
-  SendPacket();
-}
-
-std::unique_ptr<PacketPipe> InterruptedPoissonProcess::NewBuffer(size_t size) {
-  std::unique_ptr<InternalBuffer> buffer(
-      new InternalBuffer(weak_factory_.GetWeakPtr(), size));
-  send_buffers_.push_back(buffer->GetWeakPtr());
-  return std::move(buffer);
-}
-
-base::TimeDelta InterruptedPoissonProcess::NextEvent(double rate) {
-  // Rate is per milliseconds.
-  // The time until next event is exponentially distributed to the
-  // inverse of |rate|.
-  return base::TimeDelta::FromMillisecondsD(
-      fabs(-log(1.0 - RandDouble()) / rate));
-}
-
-double InterruptedPoissonProcess::RandDouble() {
-  // Generate a 64-bits random number from MT19937 and then convert
-  // it to double.
-  uint64_t rand = mt_rand_.genrand_int32();
-  rand <<= 32;
-  rand |= mt_rand_.genrand_int32();
-  return base::BitsToOpenEndedUnitInterval(rand);
-}
-
-void InterruptedPoissonProcess::ComputeRates() {
-  double avg_rate = average_rates_[rate_index_];
-
-  send_rate_ = avg_rate / coef_burstiness_;
-  switch_off_rate_ = 2 * avg_rate * (1 - coef_burstiness_) *
-                     (1 - coef_burstiness_) / coef_burstiness_ /
-                     (coef_variance_ - 1);
-  switch_on_rate_ =
-      2 * avg_rate * (1 - coef_burstiness_) / (coef_variance_ - 1);
-}
-
-void InterruptedPoissonProcess::UpdateRates() {
-  ComputeRates();
-
-  // Rates are updated once per second.
-  rate_index_ = (rate_index_ + 1) % average_rates_.size();
-  task_runner_->PostDelayedTask(
-      FROM_HERE, base::Bind(&InterruptedPoissonProcess::UpdateRates,
-                            weak_factory_.GetWeakPtr()),
-      base::TimeDelta::FromSeconds(1));
-}
-
-void InterruptedPoissonProcess::SwitchOff() {
-  on_state_ = false;
-  task_runner_->PostDelayedTask(FROM_HERE,
-                                base::Bind(&InterruptedPoissonProcess::SwitchOn,
-                                           weak_factory_.GetWeakPtr()),
-                                NextEvent(switch_on_rate_));
-}
-
-void InterruptedPoissonProcess::SwitchOn() {
-  on_state_ = true;
-  task_runner_->PostDelayedTask(
-      FROM_HERE, base::Bind(&InterruptedPoissonProcess::SwitchOff,
-                            weak_factory_.GetWeakPtr()),
-      NextEvent(switch_off_rate_));
-}
-
-void InterruptedPoissonProcess::SendPacket() {
-  task_runner_->PostDelayedTask(
-      FROM_HERE, base::Bind(&InterruptedPoissonProcess::SendPacket,
-                            weak_factory_.GetWeakPtr()),
-      NextEvent(send_rate_));
-
-  // If OFF then don't send.
-  if (!on_state_) return;
-
-  // Find the earliest packet to send.
-  base::TimeTicks earliest_time;
-  for (size_t i = 0; i < send_buffers_.size(); ++i) {
-    if (!send_buffers_[i]) continue;
-    if (send_buffers_[i]->Empty()) continue;
-    if (earliest_time.is_null() ||
-        send_buffers_[i]->FirstPacketTime() < earliest_time)
-      earliest_time = send_buffers_[i]->FirstPacketTime();
-  }
-  for (size_t i = 0; i < send_buffers_.size(); ++i) {
-    if (!send_buffers_[i]) continue;
-    if (send_buffers_[i]->Empty()) continue;
-    if (send_buffers_[i]->FirstPacketTime() != earliest_time) continue;
-    send_buffers_[i]->SendOnePacket();
-    break;
-  }
-}
-
-class UDPProxyImpl;
-
-class PacketSender : public PacketPipe {
- public:
-  PacketSender(UDPProxyImpl* udp_proxy, const net::IPEndPoint* destination)
-      : udp_proxy_(udp_proxy), destination_(destination) {}
-  void Send(std::unique_ptr<Packet> packet) final;
-  void AppendToPipe(std::unique_ptr<PacketPipe> pipe) final { NOTREACHED(); }
-
- private:
-  UDPProxyImpl* udp_proxy_;
-  const net::IPEndPoint* destination_;  // not owned
-};
-
-namespace {
-void BuildPipe(std::unique_ptr<PacketPipe>* pipe, PacketPipe* next) {
-  if (*pipe) {
-    (*pipe)->AppendToPipe(std::unique_ptr<PacketPipe>(next));
-  } else {
-    pipe->reset(next);
-  }
-}
-}  // namespace
-
-std::unique_ptr<PacketPipe> GoodNetwork() {
-  // This represents the buffer on the sender.
-  std::unique_ptr<PacketPipe> pipe;
-  BuildPipe(&pipe, new Buffer(2 << 20, 50));
-  BuildPipe(&pipe, new ConstantDelay(1E-3));
-  BuildPipe(&pipe, new RandomSortedDelay(1E-3, 2E-3, 3));
-  // This represents the buffer on the receiving device.
-  BuildPipe(&pipe, new Buffer(2 << 20, 50));
-  return pipe;
-}
-
-std::unique_ptr<PacketPipe> WifiNetwork() {
-  // This represents the buffer on the sender.
-  std::unique_ptr<PacketPipe> pipe;
-  BuildPipe(&pipe, new Buffer(256 << 10, 20));
-  BuildPipe(&pipe, new RandomDrop(0.005));
-  // This represents the buffer on the router.
-  BuildPipe(&pipe, new ConstantDelay(1E-3));
-  BuildPipe(&pipe, new RandomSortedDelay(1E-3, 20E-3, 3));
-  BuildPipe(&pipe, new Buffer(256 << 10, 20));
-  BuildPipe(&pipe, new ConstantDelay(1E-3));
-  BuildPipe(&pipe, new RandomSortedDelay(1E-3, 20E-3, 3));
-  BuildPipe(&pipe, new RandomDrop(0.005));
-  // This represents the buffer on the receiving device.
-  BuildPipe(&pipe, new Buffer(256 << 10, 20));
-  return pipe;
-}
-
-std::unique_ptr<PacketPipe> BadNetwork() {
-  std::unique_ptr<PacketPipe> pipe;
-  // This represents the buffer on the sender.
-  BuildPipe(&pipe, new Buffer(64 << 10, 5));  // 64 kb buf, 5mbit/s
-  BuildPipe(&pipe, new RandomDrop(0.05));     // 5% packet drop
-  BuildPipe(&pipe, new RandomSortedDelay(2E-3, 20E-3, 1));
-  // This represents the buffer on the router.
-  BuildPipe(&pipe, new Buffer(64 << 10, 5));  // 64 kb buf, 4mbit/s
-  BuildPipe(&pipe, new ConstantDelay(1E-3));
-  // Random 40ms every other second
-  //  BuildPipe(&pipe, new NetworkGlitchPipe(2, 40E-1));
-  BuildPipe(&pipe, new RandomUnsortedDelay(5E-3));
-  // This represents the buffer on the receiving device.
-  BuildPipe(&pipe, new Buffer(64 << 10, 5));  // 64 kb buf, 5mbit/s
-  return pipe;
-}
-
-std::unique_ptr<PacketPipe> EvilNetwork() {
-  // This represents the buffer on the sender.
-  std::unique_ptr<PacketPipe> pipe;
-  BuildPipe(&pipe, new Buffer(4 << 10, 5));  // 4 kb buf, 2mbit/s
-  // This represents the buffer on the router.
-  BuildPipe(&pipe, new RandomDrop(0.1));  // 10% packet drop
-  BuildPipe(&pipe, new RandomSortedDelay(20E-3, 60E-3, 1));
-  BuildPipe(&pipe, new Buffer(4 << 10, 2));  // 4 kb buf, 2mbit/s
-  BuildPipe(&pipe, new RandomDrop(0.1));    // 10% packet drop
-  BuildPipe(&pipe, new ConstantDelay(1E-3));
-  BuildPipe(&pipe, new NetworkGlitchPipe(2.0, 0.3));
-  BuildPipe(&pipe, new RandomUnsortedDelay(20E-3));
-  // This represents the buffer on the receiving device.
-  BuildPipe(&pipe, new Buffer(4 << 10, 2));  // 4 kb buf, 2mbit/s
-  return pipe;
-}
-
-std::unique_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess() {
-  // The following values are taken from a session reported from a user.
-  // They are experimentally tested to demonstrate challenging network
-  // conditions. The average bitrate is about 2mbits/s.
-
-  // Each element in this vector is the average number of packets sent
-  // per millisecond. The average changes and rotates every second.
-  std::vector<double> average_rates;
-  average_rates.push_back(0.609);
-  average_rates.push_back(0.495);
-  average_rates.push_back(0.561);
-  average_rates.push_back(0.458);
-  average_rates.push_back(0.538);
-  average_rates.push_back(0.513);
-  average_rates.push_back(0.585);
-  average_rates.push_back(0.592);
-  average_rates.push_back(0.658);
-  average_rates.push_back(0.556);
-  average_rates.push_back(0.371);
-  average_rates.push_back(0.595);
-  average_rates.push_back(0.490);
-  average_rates.push_back(0.980);
-  average_rates.push_back(0.781);
-  average_rates.push_back(0.463);
-
-  const double burstiness = 0.609;
-  const double variance = 4.1;
-
-  std::unique_ptr<InterruptedPoissonProcess> ipp(
-      new InterruptedPoissonProcess(average_rates, burstiness, variance, 0));
-  return ipp;
-}
-
-class UDPProxyImpl : public UDPProxy {
- public:
-  UDPProxyImpl(const net::IPEndPoint& local_port,
-               const net::IPEndPoint& destination,
-               std::unique_ptr<PacketPipe> to_dest_pipe,
-               std::unique_ptr<PacketPipe> from_dest_pipe, net::NetLog* net_log)
-      : local_port_(local_port),
-        destination_(destination),
-        destination_is_mutable_(destination.address().empty()),
-        proxy_thread_("media::cast::test::UdpProxy Thread"),
-        to_dest_pipe_(std::move(to_dest_pipe)),
-        from_dest_pipe_(std::move(from_dest_pipe)),
-        blocked_(false),
-        weak_factory_(this) {
-    proxy_thread_.StartWithOptions(
-        base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
-    base::WaitableEvent start_event(
-        base::WaitableEvent::ResetPolicy::AUTOMATIC,
-        base::WaitableEvent::InitialState::NOT_SIGNALED);
-    proxy_thread_.task_runner()->PostTask(
-        FROM_HERE, base::Bind(&UDPProxyImpl::Start, base::Unretained(this),
-                              base::Unretained(&start_event), net_log));
-    start_event.Wait();
-  }
-
-  ~UDPProxyImpl() final {
-    base::WaitableEvent stop_event(
-        base::WaitableEvent::ResetPolicy::AUTOMATIC,
-        base::WaitableEvent::InitialState::NOT_SIGNALED);
-    proxy_thread_.task_runner()->PostTask(
-        FROM_HERE, base::Bind(&UDPProxyImpl::Stop, base::Unretained(this),
-                              base::Unretained(&stop_event)));
-    stop_event.Wait();
-    proxy_thread_.Stop();
-  }
-
-  void Send(std::unique_ptr<Packet> packet,
-            const net::IPEndPoint& destination) {
-    if (blocked_) {
-      LOG(ERROR) << "Cannot write packet right now: blocked";
-      return;
-    }
-
-    VLOG(1) << "Sending packet, len = " << packet->size();
-    // We ignore all problems, callbacks and errors.
-    // If it didn't work we just drop the packet at and call it a day.
-    scoped_refptr<net::IOBuffer> buf =
-        new net::WrappedIOBuffer(reinterpret_cast<char*>(&packet->front()));
-    size_t buf_size = packet->size();
-    int result;
-    if (destination.address().empty()) {
-      VLOG(1) << "Destination has not been set yet.";
-      result = net::ERR_INVALID_ARGUMENT;
-    } else {
-      VLOG(1) << "Destination:" << destination.ToString();
-      result = socket_->SendTo(
-          buf.get(), static_cast<int>(buf_size), destination,
-          base::Bind(&UDPProxyImpl::AllowWrite, weak_factory_.GetWeakPtr(), buf,
-                     base::Passed(&packet)));
-    }
-    if (result == net::ERR_IO_PENDING) {
-      blocked_ = true;
-    } else if (result < 0) {
-      LOG(ERROR) << "Failed to write packet.";
-    }
-  }
-
- private:
-  void Start(base::WaitableEvent* start_event, net::NetLog* net_log) {
-    socket_.reset(new net::UDPServerSocket(net_log, net::NetLogSource()));
-    BuildPipe(&to_dest_pipe_, new PacketSender(this, &destination_));
-    BuildPipe(&from_dest_pipe_, new PacketSender(this, &return_address_));
-    to_dest_pipe_->InitOnIOThread(base::ThreadTaskRunnerHandle::Get(),
-                                  &tick_clock_);
-    from_dest_pipe_->InitOnIOThread(base::ThreadTaskRunnerHandle::Get(),
-                                    &tick_clock_);
-
-    VLOG(0) << "From:" << local_port_.ToString();
-    if (!destination_is_mutable_) VLOG(0) << "To:" << destination_.ToString();
-
-    CHECK_GE(socket_->Listen(local_port_), 0);
-
-    start_event->Signal();
-    PollRead();
-  }
-
-  void Stop(base::WaitableEvent* stop_event) {
-    to_dest_pipe_.reset(NULL);
-    from_dest_pipe_.reset(NULL);
-    socket_.reset(NULL);
-    stop_event->Signal();
-  }
-
-  void ProcessPacket(scoped_refptr<net::IOBuffer> recv_buf, int len) {
-    DCHECK_NE(len, net::ERR_IO_PENDING);
-    VLOG(1) << "Got packet, len = " << len;
-    if (len < 0) {
-      LOG(WARNING) << "Socket read error: " << len;
-      return;
-    }
-    packet_->resize(len);
-    if (destination_is_mutable_ && set_destination_next_ &&
-        !(recv_address_ == return_address_) &&
-        !(recv_address_ == destination_)) {
-      destination_ = recv_address_;
-    }
-    if (recv_address_ == destination_) {
-      set_destination_next_ = false;
-      from_dest_pipe_->Send(std::move(packet_));
-    } else {
-      set_destination_next_ = true;
-      VLOG(1) << "Return address = " << recv_address_.ToString();
-      return_address_ = recv_address_;
-      to_dest_pipe_->Send(std::move(packet_));
-    }
-  }
-
-  void ReadCallback(scoped_refptr<net::IOBuffer> recv_buf, int len) {
-    ProcessPacket(recv_buf, len);
-    PollRead();
-  }
-
-  void PollRead() {
-    while (true) {
-      packet_.reset(new Packet(kMaxPacketSize));
-      scoped_refptr<net::IOBuffer> recv_buf =
-          new net::WrappedIOBuffer(reinterpret_cast<char*>(&packet_->front()));
-      int len =
-          socket_->RecvFrom(recv_buf.get(), kMaxPacketSize, &recv_address_,
-                            base::Bind(&UDPProxyImpl::ReadCallback,
-                                       base::Unretained(this), recv_buf));
-      if (len == net::ERR_IO_PENDING) break;
-      ProcessPacket(recv_buf, len);
-    }
-  }
-
-  void AllowWrite(scoped_refptr<net::IOBuffer> buf,
-                  std::unique_ptr<Packet> packet, int unused_len) {
-    DCHECK(blocked_);
-    blocked_ = false;
-  }
-
-  // Input
-  net::IPEndPoint local_port_;
-
-  net::IPEndPoint destination_;
-  bool destination_is_mutable_;
-
-  net::IPEndPoint return_address_;
-  bool set_destination_next_;
-
-  base::DefaultTickClock tick_clock_;
-  base::Thread proxy_thread_;
-  std::unique_ptr<net::UDPServerSocket> socket_;
-  std::unique_ptr<PacketPipe> to_dest_pipe_;
-  std::unique_ptr<PacketPipe> from_dest_pipe_;
-
-  // For receiving.
-  net::IPEndPoint recv_address_;
-  std::unique_ptr<Packet> packet_;
-
-  // For sending.
-  bool blocked_;
-
-  base::WeakPtrFactory<UDPProxyImpl> weak_factory_;
-};
-
-void PacketSender::Send(std::unique_ptr<Packet> packet) {
-  udp_proxy_->Send(std::move(packet), *destination_);
-}
-
-std::unique_ptr<UDPProxy> UDPProxy::Create(
-    const net::IPEndPoint& local_port, const net::IPEndPoint& destination,
-    std::unique_ptr<PacketPipe> to_dest_pipe,
-    std::unique_ptr<PacketPipe> from_dest_pipe, net::NetLog* net_log) {
-  std::unique_ptr<UDPProxy> ret(
-      new UDPProxyImpl(local_port, destination, std::move(to_dest_pipe),
-                       std::move(from_dest_pipe), net_log));
-  return ret;
-}
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/udp_proxy.h b/src/cobalt/media/cast/test/utility/udp_proxy.h
deleted file mode 100644
index 51303a6..0000000
--- a/src/cobalt/media/cast/test/utility/udp_proxy.h
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_
-
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/linked_ptr.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/single_thread_task_runner.h"
-#include "media/cast/net/cast_transport_config.h"
-#include "net/base/ip_endpoint.h"
-#include "starboard/types.h"
-#include "third_party/mt19937ar/mt19937ar.h"
-
-namespace net {
-class NetLog;
-};
-
-namespace base {
-class TickClock;
-};
-
-namespace cobalt {
-namespace media {
-namespace cast {
-namespace test {
-
-class PacketPipe {
- public:
-  PacketPipe();
-  virtual ~PacketPipe();
-  virtual void Send(std::unique_ptr<Packet> packet) = 0;
-  // Allows injection of fake test runner for testing.
-  virtual void InitOnIOThread(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock);
-  virtual void AppendToPipe(std::unique_ptr<PacketPipe> pipe);
-
- protected:
-  std::unique_ptr<PacketPipe> pipe_;
-  // Allows injection of fake task runner for testing.
-  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  base::TickClock* clock_;
-};
-
-// Implements a Interrupted Poisson Process for packet delivery.
-// The process has 2 states: ON and OFF, the rate of switching between
-// these two states are defined.
-// When in ON state packets are sent according to a defined rate.
-// When in OFF state packets are not sent.
-// The rate above is the average rate of a poisson distribution.
-class InterruptedPoissonProcess {
- public:
-  InterruptedPoissonProcess(const std::vector<double>& average_rates,
-                            double coef_burstiness, double coef_variance,
-                            uint32_t rand_seed);
-  ~InterruptedPoissonProcess();
-
-  std::unique_ptr<PacketPipe> NewBuffer(size_t size);
-
- private:
-  class InternalBuffer;
-
-  // |task_runner| is the executor of the IO thread.
-  // |clock| is the system clock.
-  void InitOnIOThread(
-      const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
-      base::TickClock* clock);
-
-  base::TimeDelta NextEvent(double rate);
-  double RandDouble();
-  void ComputeRates();
-  void UpdateRates();
-  void SwitchOff();
-  void SwitchOn();
-  void SendPacket();
-
-  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-  base::TickClock* clock_;
-  const std::vector<double> average_rates_;
-  const double coef_burstiness_;
-  const double coef_variance_;
-  int rate_index_;
-
-  // The following rates are per milliseconds.
-  double send_rate_;
-  double switch_off_rate_;
-  double switch_on_rate_;
-  bool on_state_;
-
-  std::vector<base::WeakPtr<InternalBuffer> > send_buffers_;
-
-  // Fast pseudo random number generator.
-  MersenneTwister mt_rand_;
-
-  base::WeakPtrFactory<InterruptedPoissonProcess> weak_factory_;
-
-  DISALLOW_COPY_AND_ASSIGN(InterruptedPoissonProcess);
-};
-
-// A UDPProxy will set up a UDP socket and bind to |local_port|.
-// Packets send to that port will be forwarded to |destination|.
-// Packets send from |destination| to |local_port| will be returned
-// to whoever sent a packet to |local_port| last. (Not counting packets
-// from |destination|.) The UDPProxy will run a separate thread to
-// do the forwarding of packets, and will keep doing so until destroyed.
-// You can insert delays and packet drops by supplying a PacketPipe.
-// The PacketPipes may also be NULL if you just want to forward packets.
-class UDPProxy {
- public:
-  virtual ~UDPProxy() {}
-  static std::unique_ptr<UDPProxy> Create(
-      const net::IPEndPoint& local_port, const net::IPEndPoint& destination,
-      std::unique_ptr<PacketPipe> to_dest_pipe,
-      std::unique_ptr<PacketPipe> from_dest_pipe, net::NetLog* net_log);
-};
-
-// The following functions create PacketPipes which can be linked
-// together (with AppendToPipe) and passed into UdpProxy::Create below.
-
-// This PacketPipe emulates a buffer of a given size. Limits our output
-// from the buffer at a rate given by |bandwidth| (in megabits per second).
-// Packets entering the buffer will be dropped if there is not enough
-// room for them.
-std::unique_ptr<PacketPipe> NewBuffer(size_t buffer_size, double bandwidth);
-
-// Randomly drops |drop_fraction|*100% of packets.
-std::unique_ptr<PacketPipe> NewRandomDrop(double drop_fraction);
-
-// Delays each packet by |delay_seconds|.
-std::unique_ptr<PacketPipe> NewConstantDelay(double delay_seconds);
-
-// Delays packets by a random amount between zero and |delay|.
-// This PacketPipe can reorder packets.
-std::unique_ptr<PacketPipe> NewRandomUnsortedDelay(double delay);
-
-// Duplicates every packet, one is transmitted immediately,
-// one is transmitted after a random delay between |delay_min|
-// and |delay_min + random_delay|.
-// This PacketPipe will reorder packets.
-std::unique_ptr<PacketPipe> NewDuplicateAndDelay(double delay_min,
-                                                 double random_delay);
-
-// This PacketPipe inserts a random delay between each packet.
-// This PacketPipe cannot re-order packets. The delay between each
-// packet is asically |min_delay| + random( |random_delay| )
-// However, every now and then a delay of |big_delay| will be
-// inserted (roughly every |seconds_between_big_delay| seconds).
-std::unique_ptr<PacketPipe> NewRandomSortedDelay(
-    double random_delay, double big_delay, double seconds_between_big_delay);
-
-// This PacketPipe emulates network outages. It basically waits
-// for 0-2*|average_work_time| seconds, then kills the network for
-// 0-|2*average_outage_time| seconds. Then it starts over again.
-std::unique_ptr<PacketPipe> NewNetworkGlitchPipe(double average_work_time,
-                                                 double average_outage_time);
-
-// This method builds a stack of PacketPipes to emulate a reasonably
-// good network. ~50mbit, ~3ms latency, no packet loss unless saturated.
-std::unique_ptr<PacketPipe> GoodNetwork();
-
-// This method builds a stack of PacketPipes to emulate a reasonably
-// good wifi network. ~20mbit, 1% packet loss, ~3ms latency.
-std::unique_ptr<PacketPipe> WifiNetwork();
-
-// This method builds a stack of PacketPipes to emulate a
-// bad wifi network. ~5mbit, 5% packet loss, ~7ms latency
-// 40ms dropouts every ~2 seconds. Can reorder packets.
-std::unique_ptr<PacketPipe> BadNetwork();
-
-// This method builds a stack of PacketPipes to emulate a crappy wifi network.
-// ~2mbit, 20% packet loss, ~40ms latency and packets can get reordered.
-// 300ms drouputs every ~2 seconds.
-std::unique_ptr<PacketPipe> EvilNetwork();
-
-// Builds an Interrupted Poisson Process network simulator with default
-// settings. It simulates a challenging interference-heavy WiFi environment
-// of roughly 2mbits/s.
-std::unique_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess();
-
-}  // namespace test
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_
diff --git a/src/cobalt/media/cast/test/utility/udp_proxy_main.cc b/src/cobalt/media/cast/test/utility/udp_proxy_main.cc
deleted file mode 100644
index 51cd736..0000000
--- a/src/cobalt/media/cast/test/utility/udp_proxy_main.cc
+++ /dev/null
@@ -1,204 +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.
-
-#include <cstdio>
-#include <cstdlib>
-#include <deque>
-#include <string>
-#include <utility>
-
-#include "base/at_exit.h"
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "media/cast/test/utility/udp_proxy.h"
-#include "net/base/ip_address.h"
-#include "starboard/string.h"
-#include "starboard/types.h"
-
-class ByteCounter {
- public:
-  ByteCounter() : bytes_(0), packets_(0) { push(base::TimeTicks::Now()); }
-
-  base::TimeDelta time_range() {
-    return time_data_.back() - time_data_.front();
-  }
-
-  void push(base::TimeTicks now) {
-    byte_data_.push_back(bytes_);
-    packet_data_.push_back(packets_);
-    time_data_.push_back(now);
-    while (time_range().InSeconds() > 10) {
-      byte_data_.pop_front();
-      packet_data_.pop_front();
-      time_data_.pop_front();
-    }
-  }
-
-  double megabits_per_second() {
-    double megabits = (byte_data_.back() - byte_data_.front()) * 8 / 1E6;
-    return megabits / time_range().InSecondsF();
-  }
-
-  double packets_per_second() {
-    double packets = packet_data_.back() - packet_data_.front();
-    return packets / time_range().InSecondsF();
-  }
-
-  void Increment(uint64_t x) {
-    bytes_ += x;
-    packets_++;
-  }
-
- private:
-  uint64_t bytes_;
-  uint64_t packets_;
-  std::deque<uint64_t> byte_data_;
-  std::deque<uint64_t> packet_data_;
-  std::deque<base::TimeTicks> time_data_;
-};
-
-namespace {
-struct GlobalCounter {
-  base::TimeTicks last_printout;
-  ByteCounter in_pipe_input_counter;
-  ByteCounter in_pipe_output_counter;
-  ByteCounter out_pipe_input_counter;
-  ByteCounter out_pipe_output_counter;
-};
-}  // namespace
-
-base::LazyInstance<GlobalCounter>::Leaky g_counter = LAZY_INSTANCE_INITIALIZER;
-
-class ByteCounterPipe : public media::cast::test::PacketPipe {
- public:
-  explicit ByteCounterPipe(ByteCounter* counter) : counter_(counter) {}
-  void Send(std::unique_ptr<media::cast::Packet> packet) final {
-    counter_->Increment(packet->size());
-    pipe_->Send(std::move(packet));
-  }
-
- private:
-  ByteCounter* counter_;
-};
-
-void SetupByteCounters(std::unique_ptr<media::cast::test::PacketPipe>* pipe,
-                       ByteCounter* pipe_input_counter,
-                       ByteCounter* pipe_output_counter) {
-  media::cast::test::PacketPipe* new_pipe =
-      new ByteCounterPipe(pipe_input_counter);
-  new_pipe->AppendToPipe(std::move(*pipe));
-  new_pipe->AppendToPipe(std::unique_ptr<media::cast::test::PacketPipe>(
-      new ByteCounterPipe(pipe_output_counter)));
-  pipe->reset(new_pipe);
-}
-
-void CheckByteCounters() {
-  base::TimeTicks now = base::TimeTicks::Now();
-  g_counter.Get().in_pipe_input_counter.push(now);
-  g_counter.Get().in_pipe_output_counter.push(now);
-  g_counter.Get().out_pipe_input_counter.push(now);
-  g_counter.Get().out_pipe_output_counter.push(now);
-  if ((now - g_counter.Get().last_printout).InSeconds() >= 5) {
-    fprintf(stderr, "Sending  : %5.2f / %5.2f mbps %6.2f / %6.2f packets / s\n",
-            g_counter.Get().in_pipe_output_counter.megabits_per_second(),
-            g_counter.Get().in_pipe_input_counter.megabits_per_second(),
-            g_counter.Get().in_pipe_output_counter.packets_per_second(),
-            g_counter.Get().in_pipe_input_counter.packets_per_second());
-    fprintf(stderr, "Receiving: %5.2f / %5.2f mbps %6.2f / %6.2f packets / s\n",
-            g_counter.Get().out_pipe_output_counter.megabits_per_second(),
-            g_counter.Get().out_pipe_input_counter.megabits_per_second(),
-            g_counter.Get().out_pipe_output_counter.packets_per_second(),
-            g_counter.Get().out_pipe_input_counter.packets_per_second());
-
-    g_counter.Get().last_printout = now;
-  }
-  base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
-      FROM_HERE, base::Bind(&CheckByteCounters),
-      base::TimeDelta::FromMilliseconds(100));
-}
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-  logging::LoggingSettings settings;
-  settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
-  InitLogging(settings);
-
-  if (argc != 5 && argc != 3) {
-    fprintf(stderr,
-            "Usage: udp_proxy <localport> <remotehost> <remoteport> <type>\n"
-            "or:\n"
-            "       udp_proxy <localport> <type>\n"
-            "Where type is one of: perfect, wifi, bad, evil, poisson-wifi\n");
-    exit(1);
-  }
-
-  net::IPAddress remote_ip_address;
-  std::string network_type;
-  int local_port = SbStringAToI(argv[1]);
-  int remote_port = 0;
-
-  if (argc == 5) {
-    // V2 proxy
-    CHECK(remote_ip_address.AssignFromIPLiteral(argv[2]));
-    remote_port = SbStringAToI(argv[3]);
-    network_type = argv[4];
-  } else {
-    // V1 proxy
-    network_type = argv[2];
-  }
-  if (local_port < 0 || local_port > 65535 || remote_port < 0 ||
-      remote_port > 65535) {
-    fprintf(stderr, "Port numbers must be between 0 and 65535\n");
-    exit(1);
-  }
-  net::IPEndPoint remote_endpoint(remote_ip_address,
-                                  static_cast<uint16_t>(remote_port));
-  net::IPEndPoint local_endpoint(net::IPAddress::IPv4AllZeros(),
-                                 static_cast<uint16_t>(local_port));
-  std::unique_ptr<media::cast::test::PacketPipe> in_pipe, out_pipe;
-  std::unique_ptr<media::cast::test::InterruptedPoissonProcess> ipp(
-      media::cast::test::DefaultInterruptedPoissonProcess());
-
-  if (network_type == "perfect") {
-    // No action needed.
-  } else if (network_type == "wifi") {
-    in_pipe = media::cast::test::WifiNetwork();
-    out_pipe = media::cast::test::WifiNetwork();
-  } else if (network_type == "bad") {
-    in_pipe = media::cast::test::BadNetwork();
-    out_pipe = media::cast::test::BadNetwork();
-  } else if (network_type == "evil") {
-    in_pipe = media::cast::test::EvilNetwork();
-    out_pipe = media::cast::test::EvilNetwork();
-  } else if (network_type == "poisson-wifi") {
-    in_pipe = ipp->NewBuffer(128 * 1024);
-    out_pipe = ipp->NewBuffer(128 * 1024);
-  } else {
-    fprintf(stderr, "Unknown network type.\n");
-    exit(1);
-  }
-
-  SetupByteCounters(&in_pipe, &(g_counter.Get().in_pipe_input_counter),
-                    &(g_counter.Get().in_pipe_output_counter));
-  SetupByteCounters(&out_pipe, &(g_counter.Get().out_pipe_input_counter),
-                    &(g_counter.Get().out_pipe_output_counter));
-
-  printf("Press Ctrl-C when done.\n");
-  std::unique_ptr<media::cast::test::UDPProxy> proxy(
-      media::cast::test::UDPProxy::Create(local_endpoint, remote_endpoint,
-                                          std::move(in_pipe),
-                                          std::move(out_pipe), NULL));
-  base::MessageLoop message_loop;
-  g_counter.Get().last_printout = base::TimeTicks::Now();
-  CheckByteCounters();
-  base::RunLoop().Run();
-  return 1;
-}
diff --git a/src/cobalt/media/cast/test/utility/video_utility.cc b/src/cobalt/media/cast/test/utility/video_utility.cc
deleted file mode 100644
index 4f25cd8..0000000
--- a/src/cobalt/media/cast/test/utility/video_utility.cc
+++ /dev/null
@@ -1,168 +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.
-
-#include "media/cast/test/utility/video_utility.h"
-
-#include <math.h>
-
-#include <algorithm>
-#include <cstdio>
-
-#include "base/rand_util.h"
-#include "starboard/memory.h"
-#include "starboard/types.h"
-#include "third_party/libyuv/include/libyuv/compare.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-double I420PSNR(const scoped_refptr<media::VideoFrame>& frame1,
-                const scoped_refptr<media::VideoFrame>& frame2) {
-  if (frame1->visible_rect().width() != frame2->visible_rect().width() ||
-      frame1->visible_rect().height() != frame2->visible_rect().height())
-    return -1;
-
-  return libyuv::I420Psnr(frame1->visible_data(VideoFrame::kYPlane),
-                          frame1->stride(VideoFrame::kYPlane),
-                          frame1->visible_data(VideoFrame::kUPlane),
-                          frame1->stride(VideoFrame::kUPlane),
-                          frame1->visible_data(VideoFrame::kVPlane),
-                          frame1->stride(VideoFrame::kVPlane),
-                          frame2->visible_data(VideoFrame::kYPlane),
-                          frame2->stride(VideoFrame::kYPlane),
-                          frame2->visible_data(VideoFrame::kUPlane),
-                          frame2->stride(VideoFrame::kUPlane),
-                          frame2->visible_data(VideoFrame::kVPlane),
-                          frame2->stride(VideoFrame::kVPlane),
-                          frame1->visible_rect().width(),
-                          frame1->visible_rect().height());
-}
-
-double I420SSIM(const scoped_refptr<media::VideoFrame>& frame1,
-                const scoped_refptr<media::VideoFrame>& frame2) {
-  if (frame1->visible_rect().width() != frame2->visible_rect().width() ||
-      frame1->visible_rect().height() != frame2->visible_rect().height())
-    return -1;
-
-  return libyuv::I420Ssim(frame1->visible_data(VideoFrame::kYPlane),
-                          frame1->stride(VideoFrame::kYPlane),
-                          frame1->visible_data(VideoFrame::kUPlane),
-                          frame1->stride(VideoFrame::kUPlane),
-                          frame1->visible_data(VideoFrame::kVPlane),
-                          frame1->stride(VideoFrame::kVPlane),
-                          frame2->visible_data(VideoFrame::kYPlane),
-                          frame2->stride(VideoFrame::kYPlane),
-                          frame2->visible_data(VideoFrame::kUPlane),
-                          frame2->stride(VideoFrame::kUPlane),
-                          frame2->visible_data(VideoFrame::kVPlane),
-                          frame2->stride(VideoFrame::kVPlane),
-                          frame1->visible_rect().width(),
-                          frame1->visible_rect().height());
-}
-
-void PopulateVideoFrame(VideoFrame* frame, int start_value) {
-  const gfx::Size frame_size = frame->coded_size();
-  const int stripe_size =
-      std::max(32, std::min(frame_size.width(), frame_size.height()) / 8) & -2;
-
-  // Set Y.
-  const int height = frame_size.height();
-  const int stride_y = frame->stride(VideoFrame::kYPlane);
-  uint8_t* y_plane = frame->data(VideoFrame::kYPlane);
-  for (int j = 0; j < height; ++j) {
-    const int stripe_j = (j / stripe_size) * stripe_size;
-    for (int i = 0; i < stride_y; ++i) {
-      const int stripe_i = (i / stripe_size) * stripe_size;
-      *y_plane = static_cast<uint8_t>(start_value + stripe_i + stripe_j);
-      ++y_plane;
-    }
-  }
-
-  const int half_height = (height + 1) / 2;
-  if (frame->format() == PIXEL_FORMAT_NV12) {
-    const int stride_uv = frame->stride(VideoFrame::kUVPlane);
-    uint8_t* uv_plane = frame->data(VideoFrame::kUVPlane);
-
-    // Set U and V.
-    for (int j = 0; j < half_height; ++j) {
-      const int stripe_j = (j / stripe_size) * stripe_size;
-      for (int i = 0; i < stride_uv; i += 2) {
-        const int stripe_i = (i / stripe_size) * stripe_size;
-        *uv_plane = *(uv_plane + 1) =
-            static_cast<uint8_t>(start_value + stripe_i + stripe_j);
-        uv_plane += 2;
-      }
-    }
-  } else {
-    DCHECK(frame->format() == PIXEL_FORMAT_I420 ||
-           frame->format() == PIXEL_FORMAT_YV12);
-    const int stride_u = frame->stride(VideoFrame::kUPlane);
-    const int stride_v = frame->stride(VideoFrame::kVPlane);
-    uint8_t* u_plane = frame->data(VideoFrame::kUPlane);
-    uint8_t* v_plane = frame->data(VideoFrame::kVPlane);
-
-    // Set U.
-    for (int j = 0; j < half_height; ++j) {
-      const int stripe_j = (j / stripe_size) * stripe_size;
-      for (int i = 0; i < stride_u; ++i) {
-        const int stripe_i = (i / stripe_size) * stripe_size;
-        *u_plane = static_cast<uint8_t>(start_value + stripe_i + stripe_j);
-        ++u_plane;
-      }
-    }
-
-    // Set V.
-    for (int j = 0; j < half_height; ++j) {
-      const int stripe_j = (j / stripe_size) * stripe_size;
-      for (int i = 0; i < stride_v; ++i) {
-        const int stripe_i = (i / stripe_size) * stripe_size;
-        *v_plane = static_cast<uint8_t>(start_value + stripe_i + stripe_j);
-        ++v_plane;
-      }
-    }
-  }
-}
-
-void PopulateVideoFrameWithNoise(VideoFrame* frame) {
-  const int height = frame->coded_size().height();
-  const int stride_y = frame->stride(VideoFrame::kYPlane);
-  const int stride_u = frame->stride(VideoFrame::kUPlane);
-  const int stride_v = frame->stride(VideoFrame::kVPlane);
-  const int half_height = (height + 1) / 2;
-  uint8_t* const y_plane = frame->data(VideoFrame::kYPlane);
-  uint8_t* const u_plane = frame->data(VideoFrame::kUPlane);
-  uint8_t* const v_plane = frame->data(VideoFrame::kVPlane);
-
-  base::RandBytes(y_plane, height * stride_y);
-  base::RandBytes(u_plane, half_height * stride_u);
-  base::RandBytes(v_plane, half_height * stride_v);
-}
-
-bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file) {
-  const int width = frame->coded_size().width();
-  const int height = frame->coded_size().height();
-  const int half_width = (width + 1) / 2;
-  const int half_height = (height + 1) / 2;
-  const size_t frame_size = width * height + 2 * half_width * half_height;
-  uint8_t* const y_plane = frame->data(VideoFrame::kYPlane);
-  uint8_t* const u_plane = frame->data(VideoFrame::kUPlane);
-  uint8_t* const v_plane = frame->data(VideoFrame::kVPlane);
-
-  uint8_t* const raw_data = new uint8_t[frame_size];
-  const size_t count = fread(raw_data, 1, frame_size, video_file);
-  if (count != frame_size) return false;
-
-  SbMemoryCopy(y_plane, raw_data, width * height);
-  SbMemoryCopy(u_plane, raw_data + width * height, half_width * half_height);
-  SbMemoryCopy(v_plane, raw_data + width * height + half_width * half_height,
-               half_width * half_height);
-  delete[] raw_data;
-  return true;
-}
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/cast/test/utility/video_utility.h b/src/cobalt/media/cast/test/utility/video_utility.h
deleted file mode 100644
index af1b3dd..0000000
--- a/src/cobalt/media/cast/test/utility/video_utility.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COBALT_MEDIA_CAST_TEST_UTILITY_VIDEO_UTILITY_H_
-#define COBALT_MEDIA_CAST_TEST_UTILITY_VIDEO_UTILITY_H_
-
-// Utility functions for video testing.
-
-#include "media/base/video_frame.h"
-
-namespace cobalt {
-namespace media {
-namespace cast {
-
-// Compute and return PSNR between two frames.
-double I420PSNR(const scoped_refptr<media::VideoFrame>& frame1,
-                const scoped_refptr<media::VideoFrame>& frame2);
-
-// Compute and return SSIM between two frames.
-double I420SSIM(const scoped_refptr<media::VideoFrame>& frame1,
-                const scoped_refptr<media::VideoFrame>& frame2);
-
-// Populate a video |frame| with a plaid pattern, cycling from the given
-// |start_value|.
-// Width, height and stride should be set in advance.
-// Memory is allocated within the function.
-void PopulateVideoFrame(VideoFrame* frame, int start_value);
-
-// Populate a video frame with noise.
-void PopulateVideoFrameWithNoise(VideoFrame* frame);
-
-// Populate a video frame from a file.
-// Returns true if frame was populated, false if not (EOF).
-bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file);
-
-}  // namespace cast
-}  // namespace media
-}  // namespace cobalt
-
-#endif  // COBALT_MEDIA_CAST_TEST_UTILITY_VIDEO_UTILITY_H_
diff --git a/src/cobalt/media/filters/shell_demuxer.cc b/src/cobalt/media/filters/shell_demuxer.cc
index 9909244..6704e5e 100644
--- a/src/cobalt/media/filters/shell_demuxer.cc
+++ b/src/cobalt/media/filters/shell_demuxer.cc
@@ -98,7 +98,8 @@
 
 void ShellDemuxerStream::EnqueueBuffer(scoped_refptr<DecoderBuffer> buffer) {
   TRACE_EVENT1("media_stack", "ShellDemuxerStream::EnqueueBuffer()",
-               "timestamp", buffer->timestamp().InMicroseconds());
+               "timestamp", buffer->end_of_stream() ?
+                            -1 : buffer->timestamp().InMicroseconds());
   base::AutoLock auto_lock(lock_);
   if (stopped_) {
     // it's possible due to pipelining both downstream and within the
diff --git a/src/cobalt/media/media2.gyp b/src/cobalt/media/media2.gyp
index 982b364..60905ad 100644
--- a/src/cobalt/media/media2.gyp
+++ b/src/cobalt/media/media2.gyp
@@ -318,6 +318,9 @@
             'filters/shell_rbsp_stream_unittest.cc',
           ],
         }],
+        ['cobalt_enable_lib == 1', {
+          'defines' : ['COBALT_ENABLE_LIB'],
+        }],
       ],
     },
     {
diff --git a/src/cobalt/media/media_module.cc b/src/cobalt/media/media_module.cc
index d444ea8..d606dc0 100644
--- a/src/cobalt/media/media_module.cc
+++ b/src/cobalt/media/media_module.cc
@@ -42,6 +42,17 @@
 
 }  // namespace
 
+// static
+math::Size MediaModule::CalculateOutputResolution(
+    system_window::SystemWindow* system_window,
+    const base::optional<math::Size>& output_size_override) {
+  if (output_size_override) {
+    return *output_size_override;
+  }
+
+  return system_window->GetVideoOutputResolution();
+}
+
 void MediaModule::Suspend() {
   RunClosureOnMessageLoopAndWait(
       message_loop_,
diff --git a/src/cobalt/media/media_module.h b/src/cobalt/media/media_module.h
index f4b10c2..7d21976 100644
--- a/src/cobalt/media/media_module.h
+++ b/src/cobalt/media/media_module.h
@@ -25,6 +25,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop.h"
 #include "base/message_loop_proxy.h"
+#include "base/optional.h"
 #include "base/threading/thread.h"
 #include "cobalt/base/user_log.h"
 #include "cobalt/math/size.h"
@@ -65,10 +66,16 @@
     bool use_null_audio_streamer;
     bool use_video_decoder_stub;
     bool disable_webm_vp9;
+    base::optional<math::Size> output_resolution_override;
   };
 
   typedef render_tree::Image Image;
 
+  // Calculates the output resolution based on the window size and override.
+  static math::Size CalculateOutputResolution(
+      system_window::SystemWindow* system_window,
+      const base::optional<math::Size>& output_resolution_override);
+
   virtual ~MediaModule() {}
 
   // Returns true when the setting is set successfully or if the setting has
@@ -107,18 +114,15 @@
   void RegisterPlayer(WebMediaPlayer* player) OVERRIDE;
   void UnregisterPlayer(WebMediaPlayer* player) OVERRIDE;
 
-  const math::Size& output_size() const { return output_size_; }
-
   // This function should be defined on individual platform to create the
   // platform specific MediaModule.
   static scoped_ptr<MediaModule> Create(
-      system_window::SystemWindow* system_window, const math::Size& output_size,
+      system_window::SystemWindow* system_window,
       render_tree::ResourceProvider* resource_provider,
       const Options& options = Options());
 
  protected:
-  explicit MediaModule(const math::Size& output_size)
-      : thread_("media_module"), output_size_(output_size), suspended_(false) {
+  MediaModule() : thread_("media_module"), suspended_(false) {
     thread_.Start();
     message_loop_ = thread_.message_loop_proxy();
   }
@@ -139,7 +143,6 @@
   base::Thread thread_;
   scoped_refptr<base::MessageLoopProxy> message_loop_;
   Players players_;
-  math::Size output_size_;
   bool suspended_;
 };
 
diff --git a/src/cobalt/media/media_module_starboard.cc b/src/cobalt/media/media_module_starboard.cc
index cbfd9d2..558bdfb 100644
--- a/src/cobalt/media/media_module_starboard.cc
+++ b/src/cobalt/media/media_module_starboard.cc
@@ -28,6 +28,7 @@
 #include "media/base/message_loop_factory.h"
 #include "media/player/web_media_player_impl.h"
 #endif  // defined(COBALT_MEDIA_SOURCE_2016)
+#include "nb/memory_scope.h"
 #include "starboard/media.h"
 #include "starboard/window.h"
 
@@ -46,11 +47,9 @@
 class MediaModuleStarboard : public MediaModule {
  public:
   MediaModuleStarboard(system_window::SystemWindow* system_window,
-                       const math::Size& output_size,
                        render_tree::ResourceProvider* resource_provider,
                        const Options& options)
-      : MediaModule(output_size),
-        options_(options),
+      : options_(options),
         system_window_(system_window),
         media_platform_(resource_provider) {}
 
@@ -71,6 +70,7 @@
   }
   scoped_ptr<WebMediaPlayer> CreateWebMediaPlayer(
       WebMediaPlayerClient* client) OVERRIDE {
+    TRACK_MEMORY_SCOPE("Media");
 #if defined(COBALT_MEDIA_SOURCE_2016)
     SbWindow window = kSbWindowInvalid;
     if (system_window_) {
@@ -117,10 +117,11 @@
 }  // namespace
 
 scoped_ptr<MediaModule> MediaModule::Create(
-    system_window::SystemWindow* system_window, const math::Size& output_size,
+    system_window::SystemWindow* system_window,
     render_tree::ResourceProvider* resource_provider, const Options& options) {
-  return make_scoped_ptr<MediaModule>(new MediaModuleStarboard(
-      system_window, output_size, resource_provider, options));
+  TRACK_MEMORY_SCOPE("Media");
+  return make_scoped_ptr<MediaModule>(
+      new MediaModuleStarboard(system_window, resource_provider, options));
 }
 
 }  // namespace media
diff --git a/src/cobalt/media/media_module_stub.cc b/src/cobalt/media/media_module_stub.cc
index f857978..ba8fd9f 100644
--- a/src/cobalt/media/media_module_stub.cc
+++ b/src/cobalt/media/media_module_stub.cc
@@ -17,6 +17,7 @@
 #include <string>
 
 #include "base/compiler_specific.h"
+#include "nb/memory_scope.h"
 
 namespace cobalt {
 namespace media {
@@ -118,6 +119,7 @@
 scoped_ptr<WebMediaPlayer> MediaModuleStub::CreateWebMediaPlayer(
     WebMediaPlayerClient* client) {
   UNREFERENCED_PARAMETER(client);
+  TRACK_MEMORY_SCOPE("Media");
   return make_scoped_ptr<WebMediaPlayer>(new DummyWebMediaPlayer);
 }
 
diff --git a/src/cobalt/media/media_module_stub.h b/src/cobalt/media/media_module_stub.h
index 60d7fd3..d5d3d4e 100644
--- a/src/cobalt/media/media_module_stub.h
+++ b/src/cobalt/media/media_module_stub.h
@@ -28,7 +28,7 @@
 
 class MediaModuleStub : public MediaModule {
  public:
-  MediaModuleStub() : MediaModule(math::Size(1920, 1080)) {}
+  MediaModuleStub() {}
 
   std::string CanPlayType(const std::string& mime_type,
                           const std::string& key_system) OVERRIDE;
diff --git a/src/cobalt/media/media_module_win.cc b/src/cobalt/media/media_module_win.cc
deleted file mode 100644
index 3b3c83c..0000000
--- a/src/cobalt/media/media_module_win.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "cobalt/media/media_module.h"
-
-#include "base/compiler_specific.h"
-#include "cobalt/math/size.h"
-#include "cobalt/media/media_module_stub.h"
-#include "media/audio/shell_audio_streamer.h"
-
-namespace cobalt {
-namespace media {
-
-// There is no media stack on Windows and the XB1 media stack cannot be used
-// directly on Windows. So MediaModule on windows does nothing.
-scoped_ptr<MediaModule> MediaModule::Create(
-    system_window::SystemWindow* system_window, const math::Size& output_size,
-    render_tree::ResourceProvider* resource_provider, const Options& options) {
-  UNREFERENCED_PARAMETER(system_window);
-  UNREFERENCED_PARAMETER(output_size);
-  UNREFERENCED_PARAMETER(resource_provider);
-  UNREFERENCED_PARAMETER(options);
-  return make_scoped_ptr(new MediaModuleStub);
-}
-
-}  // namespace media
-}  // namespace cobalt
-
-// ShellAudioStreamer is used by H5vccAudioConfigArray.  Ideally we should get
-// the ShellAudioStreamer from ShellMediaPlatform.  But before that's done, we
-// have to have the following stub implementation to ensure that Cobalt links on
-// Windows.
-namespace cobalt {
-namespace media {
-
-// static
-void ShellAudioStreamer::Initialize() { NOTIMPLEMENTED(); }
-
-// static
-void ShellAudioStreamer::Terminate() { NOTIMPLEMENTED(); }
-
-// static
-ShellAudioStreamer* ShellAudioStreamer::Instance() {
-  NOTIMPLEMENTED();
-  return NULL;
-}
-
-}  // namespace media
-}  // namespace cobalt
diff --git a/src/cobalt/media/sandbox/media_sandbox.cc b/src/cobalt/media/sandbox/media_sandbox.cc
index b4a1094..19345f9 100644
--- a/src/cobalt/media/sandbox/media_sandbox.cc
+++ b/src/cobalt/media/sandbox/media_sandbox.cc
@@ -98,8 +98,7 @@
 #endif  // defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
 
   media_module_ = MediaModule::Create(
-      system_window_.get(), renderer_module_->render_target()->GetSize(),
-      renderer_module_->pipeline()->GetResourceProvider(),
+      system_window_.get(), renderer_module_->pipeline()->GetResourceProvider(),
       media_module_options);
   SetupAndSubmitScene();
 }
diff --git a/src/cobalt/media/sandbox/web_media_player_sandbox.cc b/src/cobalt/media/sandbox/web_media_player_sandbox.cc
index 84870b1..8b634c1 100644
--- a/src/cobalt/media/sandbox/web_media_player_sandbox.cc
+++ b/src/cobalt/media/sandbox/web_media_player_sandbox.cc
@@ -35,6 +35,53 @@
 namespace sandbox {
 namespace {
 
+// Allows args to be pushed into a stack. This allows passing variables to
+// functions that take in the int, char** args format.
+struct Args {
+  Args(int argc, char** argv) {
+    for (int i = 0; i < argc; ++i) {
+      PushBack(argv[i]);
+    }
+  }
+
+  ~Args() {
+    while (size()) {
+      PopBack();
+    }
+  }
+
+  char** get_argv() {
+    if (buffs_.empty()) {
+      return NULL;
+    } else {
+      return &buffs_[0];
+    }
+  }
+
+  char* get(int i) {
+    return buffs_[i];
+  }
+
+  int size() const {
+    return static_cast<int>(buffs_.size());
+  }
+
+  void PushBack(const char* in) {
+    char* string_cp = new char[strlen(in) + 1];
+    strcpy(string_cp, in);
+    buffs_.push_back(string_cp);
+  }
+
+  void PopBack() {
+    if (!buffs_.empty()) {
+      delete buffs_.back();
+      buffs_.pop_back();
+    }
+  }
+
+  std::vector<char*> buffs_;
+};
+
 using render_tree::Image;
 #if !defined(COBALT_MEDIA_SOURCE_2016)
 using ::media::VideoFrame;
@@ -67,16 +114,28 @@
 }
 
 int SandboxMain(int argc, char** argv) {
-  if (argc != 2 && argc != 3) {
-    LOG(ERROR) << "Usage: " << argv[0] << " [--null_audio_streamer] <url|path>";
-    return 1;
+  Args args(argc, argv);
+
+  // 2nd argument is supposed to be the url. If this doesn't exist then
+  // a default url pointing to the resource is used instead.
+  if (args.size() < 2) {
+    LOG(INFO) << "Warning: " << argv[0]
+              << " had no url, defaulting to hard-coded path.";
+
+    const char kHardcodedMp4Url[] =
+        "https://storage.googleapis.com/yt-cobalt-media-element-demo/"
+        "progressive.mp4";
+    args.PushBack(kHardcodedMp4Url);
   }
+
   MediaSandbox media_sandbox(
-      argc, argv,
+      args.size(), args.get_argv(),
       FilePath(FILE_PATH_LITERAL("web_media_player_sandbox_trace.json")));
 
+  const char* mp4_hard_coded_url = args.get(1);
+
   // Note that we can't access PathService until MediaSandbox is initialized.
-  GURL video_url = ResolveUrl(argv[argc - 1]);
+  GURL video_url = ResolveUrl(mp4_hard_coded_url);
 
   if (!video_url.is_valid()) {
     LOG(ERROR) << " Invalid URL: " << video_url;
diff --git a/src/cobalt/media/tools/constrained_network_server/cn.py b/src/cobalt/media/tools/constrained_network_server/cn.py
deleted file mode 100755
index fe5781c..0000000
--- a/src/cobalt/media/tools/constrained_network_server/cn.py
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-"""A script for configuring constraint networks.
-
-Sets up a constrained network configuration on a specific port. Traffic on this
-port will be redirected to another local server port.
-
-The configuration includes bandwidth, latency, and packet loss.
-"""
-
-import collections
-import logging
-import optparse
-import traffic_control
-
-# Default logging is ERROR. Use --verbose to enable DEBUG logging.
-_DEFAULT_LOG_LEVEL = logging.ERROR
-
-Dispatcher = collections.namedtuple('Dispatcher', ['dispatch', 'requires_ports',
-                                                   'desc'])
-
-# Map of command names to traffic_control functions.
-COMMANDS = {
-    # Adds a new constrained network configuration.
-    'add': Dispatcher(traffic_control.CreateConstrainedPort,
-                      requires_ports=True, desc='Add a new constrained port.'),
-
-    # Deletes an existing constrained network configuration.
-    'del': Dispatcher(traffic_control.DeleteConstrainedPort,
-                      requires_ports=True, desc='Delete a constrained port.'),
-
-    # Deletes all constrained network configurations.
-    'teardown': Dispatcher(traffic_control.TearDown,
-                           requires_ports=False,
-                           desc='Teardown all constrained ports.')
-}
-
-
-def _ParseArgs():
-  """Define and parse command-line arguments.
-
-  Returns:
-    tuple as (command, configuration):
-    command: one of the possible commands to setup, delete or teardown the
-             constrained network.
-    configuration: a map of constrained network properties to their values.
-  """
-  parser = optparse.OptionParser()
-
-  indent_first = parser.formatter.indent_increment
-  opt_width = parser.formatter.help_position - indent_first
-
-  cmd_usage = []
-  for s in COMMANDS:
-    cmd_usage.append('%*s%-*s%s' %
-                     (indent_first, '', opt_width, s, COMMANDS[s].desc))
-
-  parser.usage = ('usage: %%prog {%s} [options]\n\n%s' %
-                  ('|'.join(COMMANDS.keys()), '\n'.join(cmd_usage)))
-
-  parser.add_option('--port', type='int',
-                    help='The port to apply traffic control constraints to.')
-  parser.add_option('--server-port', type='int',
-                    help='Port to forward traffic on --port to.')
-  parser.add_option('--bandwidth', type='int',
-                    help='Bandwidth of the network in kbit/s.')
-  parser.add_option('--latency', type='int',
-                    help=('Latency (delay) added to each outgoing packet in '
-                          'ms.'))
-  parser.add_option('--loss', type='int',
-                    help='Packet-loss percentage on outgoing packets. ')
-  parser.add_option('--interface', type='string',
-                    help=('Interface to setup constraints on. Use "lo" for a '
-                          'local client.'))
-  parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
-                    default=False, help='Turn on verbose output.')
-  options, args = parser.parse_args()
-
-  _SetLogger(options.verbose)
-
-  # Check a valid command was entered
-  if not args or args[0].lower() not in COMMANDS:
-    parser.error('Please specify a command {%s}.' % '|'.join(COMMANDS.keys()))
-  user_cmd = args[0].lower()
-
-  # Check if required options are available
-  if COMMANDS[user_cmd].requires_ports:
-    if not (options.port and options.server_port):
-      parser.error('Please provide port and server-port values.')
-
-  config = {
-      'port': options.port,
-      'server_port': options.server_port,
-      'interface': options.interface,
-      'latency': options.latency,
-      'bandwidth': options.bandwidth,
-      'loss': options.loss
-  }
-  return user_cmd, config
-
-
-def _SetLogger(verbose):
-  log_level = _DEFAULT_LOG_LEVEL
-  if verbose:
-    log_level = logging.DEBUG
-  logging.basicConfig(level=log_level, format='%(message)s')
-
-
-def Main():
-  """Get the command and configuration of the network to set up."""
-  user_cmd, config = _ParseArgs()
-
-  try:
-    COMMANDS[user_cmd].dispatch(config)
-  except traffic_control.TrafficControlError as e:
-    logging.error('Error: %s\n\nOutput: %s', e.msg, e.error)
-
-
-if __name__ == '__main__':
-  Main()
diff --git a/src/cobalt/media/tools/constrained_network_server/cns.py b/src/cobalt/media/tools/constrained_network_server/cns.py
deleted file mode 100755
index 58e2ba0..0000000
--- a/src/cobalt/media/tools/constrained_network_server/cns.py
+++ /dev/null
@@ -1,456 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-"""Constrained Network Server. Serves files with supplied network constraints.
-
-The CNS exposes a web based API allowing network constraints to be imposed on
-file serving.
-
-TODO(dalecurtis): Add some more docs here.
-
-"""
-
-import logging
-from logging import handlers
-import mimetypes
-import optparse
-import os
-import signal
-import sys
-import threading
-import time
-import urllib
-import urllib2
-
-import traffic_control
-
-try:
-  import cherrypy
-except ImportError:
-  print ('CNS requires CherryPy v3 or higher to be installed. Please install\n'
-         'and try again. On Linux: sudo apt-get install python-cherrypy3\n')
-  sys.exit(1)
-
-# Add webm file types to mimetypes map since cherrypy's default type is text.
-mimetypes.types_map['.webm'] = 'video/webm'
-
-# Default logging is ERROR. Use --verbose to enable DEBUG logging.
-_DEFAULT_LOG_LEVEL = logging.ERROR
-
-# Default port to serve the CNS on.
-_DEFAULT_SERVING_PORT = 9000
-
-# Default port range for constrained use.
-_DEFAULT_CNS_PORT_RANGE = (50000, 51000)
-
-# Default number of seconds before a port can be torn down.
-_DEFAULT_PORT_EXPIRY_TIME_SECS = 5 * 60
-
-
-class PortAllocator(object):
-  """Dynamically allocates/deallocates ports with a given set of constraints."""
-
-  def __init__(self, port_range, expiry_time_secs=5 * 60):
-    """Sets up initial state for the Port Allocator.
-
-    Args:
-      port_range: Range of ports available for allocation.
-      expiry_time_secs: Amount of time in seconds before constrained ports are
-          cleaned up.
-    """
-    self._port_range = port_range
-    self._expiry_time_secs = expiry_time_secs
-
-    # Keeps track of ports we've used, the creation key, and the last request
-    # time for the port so they can be cached and cleaned up later.
-    self._ports = {}
-
-    # Locks port creation and cleanup. TODO(dalecurtis): If performance becomes
-    # an issue a per-port based lock system can be used instead.
-    self._port_lock = threading.RLock()
-
-  def Get(self, key, new_port=False, **kwargs):
-    """Sets up a constrained port using the requested parameters.
-
-    Requests for the same key and constraints will result in a cached port being
-    returned if possible, subject to new_port.
-
-    Args:
-      key: Used to cache ports with the given constraints.
-      new_port: Whether to create a new port or use an existing one if possible.
-      **kwargs: Constraints to pass into traffic control.
-
-    Returns:
-      None if no port can be setup or the port number of the constrained port.
-    """
-    with self._port_lock:
-      # Check port key cache to see if this port is already setup. Update the
-      # cache time and return the port if so. Performance isn't a concern here,
-      # so just iterate over ports dict for simplicity.
-      full_key = (key,) + tuple(kwargs.values())
-      if not new_port:
-        for port, status in self._ports.iteritems():
-          if full_key == status['key']:
-            self._ports[port]['last_update'] = time.time()
-            return port
-
-      # Cleanup ports on new port requests. Do it after the cache check though
-      # so we don't erase and then setup the same port.
-      if self._expiry_time_secs > 0:
-        self.Cleanup(all_ports=False)
-
-      # Performance isn't really an issue here, so just iterate over the port
-      # range to find an unused port. If no port is found, None is returned.
-      for port in xrange(self._port_range[0], self._port_range[1]):
-        if port in self._ports:
-          continue
-        if self._SetupPort(port, **kwargs):
-          kwargs['port'] = port
-          self._ports[port] = {'last_update': time.time(), 'key': full_key,
-                               'config': kwargs}
-          return port
-
-  def _SetupPort(self, port, **kwargs):
-    """Setup network constraints on port using the requested parameters.
-
-    Args:
-      port: The port number to setup network constraints on.
-      **kwargs: Network constraints to set up on the port.
-
-    Returns:
-      True if setting the network constraints on the port was successful, false
-      otherwise.
-    """
-    kwargs['port'] = port
-    try:
-      cherrypy.log('Setting up port %d' % port)
-      traffic_control.CreateConstrainedPort(kwargs)
-      return True
-    except traffic_control.TrafficControlError as e:
-      cherrypy.log('Error: %s\nOutput: %s' % (e.msg, e.error))
-      return False
-
-  def Cleanup(self, all_ports, request_ip=None):
-    """Cleans up expired ports, or if all_ports=True, all allocated ports.
-
-    By default, ports which haven't been used for self._expiry_time_secs are
-    torn down. If all_ports=True then they are torn down regardless.
-
-    Args:
-      all_ports: Should all ports be torn down regardless of expiration?
-      request_ip: Tear ports matching the IP address regarless of expiration.
-    """
-    with self._port_lock:
-      now = time.time()
-      # Use .items() instead of .iteritems() so we can delete keys w/o error.
-      for port, status in self._ports.items():
-        expired = now - status['last_update'] > self._expiry_time_secs
-        matching_ip = request_ip and status['key'][0].startswith(request_ip)
-        if all_ports or expired or matching_ip:
-          cherrypy.log('Cleaning up port %d' % port)
-          self._DeletePort(port)
-          del self._ports[port]
-
-  def _DeletePort(self, port):
-    """Deletes network constraints on port.
-
-    Args:
-      port: The port number associated with the network constraints.
-    """
-    try:
-      traffic_control.DeleteConstrainedPort(self._ports[port]['config'])
-    except traffic_control.TrafficControlError as e:
-      cherrypy.log('Error: %s\nOutput: %s' % (e.msg, e.error))
-
-
-class ConstrainedNetworkServer(object):
-  """A CherryPy-based HTTP server for serving files with network constraints."""
-
-  def __init__(self, options, port_allocator):
-    """Sets up initial state for the CNS.
-
-    Args:
-      options: optparse based class returned by ParseArgs()
-      port_allocator: A port allocator instance.
-    """
-    self._options = options
-    self._port_allocator = port_allocator
-
-  @cherrypy.expose
-  def Cleanup(self):
-    """Cleans up all the ports allocated using the request IP address.
-
-    When requesting a constrained port, the cherrypy.request.remote.ip is used
-    as a key for that port (in addition to other request parameters).  Such
-    ports created for the same IP address are removed.
-    """
-    cherrypy.log('Cleaning up ports allocated by %s.' %
-                 cherrypy.request.remote.ip)
-    self._port_allocator.Cleanup(all_ports=False,
-                                 request_ip=cherrypy.request.remote.ip)
-
-  @cherrypy.expose
-  def ServeConstrained(self, f=None, bandwidth=None, latency=None, loss=None,
-                       new_port=False, no_cache=False, **kwargs):
-    """Serves the requested file with the requested constraints.
-
-    Subsequent requests for the same constraints from the same IP will share the
-    previously created port unless new_port equals True. If no constraints
-    are provided the file is served as is.
-
-    Args:
-      f: path relative to http root of file to serve.
-      bandwidth: maximum allowed bandwidth for the provided port (integer
-          in kbit/s).
-      latency: time to add to each packet (integer in ms).
-      loss: percentage of packets to drop (integer, 0-100).
-      new_port: whether to use a new port for this request or not.
-      no_cache: Set reponse's cache-control to no-cache.
-    """
-    if no_cache:
-      response = cherrypy.response
-      response.headers['Pragma'] = 'no-cache'
-      response.headers['Cache-Control'] = 'no-cache'
-
-    # CherryPy is a bit wonky at detecting parameters, so just make them all
-    # optional and validate them ourselves.
-    if not f:
-      raise cherrypy.HTTPError(400, 'Invalid request. File must be specified.')
-
-    # Check existence early to prevent wasted constraint setup.
-    self._CheckRequestedFileExist(f)
-
-    # If there are no constraints, just serve the file.
-    if bandwidth is None and latency is None and loss is None:
-      return self._ServeFile(f)
-
-    constrained_port = self._GetConstrainedPort(
-        f, bandwidth=bandwidth, latency=latency, loss=loss, new_port=new_port,
-        **kwargs)
-
-    # Build constrained URL using the constrained port and original URL
-    # parameters except the network constraints (bandwidth, latency, and loss).
-    constrained_url = self._GetServerURL(f, constrained_port,
-                                         no_cache=no_cache, **kwargs)
-
-    # Redirect request to the constrained port.
-    cherrypy.log('Redirect to %s' % constrained_url)
-    cherrypy.lib.cptools.redirect(constrained_url, internal=False)
-
-  def _CheckRequestedFileExist(self, f):
-    """Checks if the requested file exists, raises HTTPError otherwise."""
-    if self._options.local_server_port:
-      self._CheckFileExistOnLocalServer(f)
-    else:
-      self._CheckFileExistOnServer(f)
-
-  def _CheckFileExistOnServer(self, f):
-    """Checks if requested file f exists to be served by this server."""
-    # Sanitize and check the path to prevent www-root escapes.
-    sanitized_path = os.path.abspath(os.path.join(self._options.www_root, f))
-    if not sanitized_path.startswith(self._options.www_root):
-      raise cherrypy.HTTPError(403, 'Invalid file requested.')
-    if not os.path.exists(sanitized_path):
-      raise cherrypy.HTTPError(404, 'File not found.')
-
-  def _CheckFileExistOnLocalServer(self, f):
-    """Checks if requested file exists on local server hosting files."""
-    test_url = self._GetServerURL(f, self._options.local_server_port)
-    try:
-      cherrypy.log('Check file exist using URL: %s' % test_url)
-      return urllib2.urlopen(test_url) is not None
-    except Exception:
-      raise cherrypy.HTTPError(404, 'File not found on local server.')
-
-  def _ServeFile(self, f):
-    """Serves the file as an http response."""
-    if self._options.local_server_port:
-      redirect_url = self._GetServerURL(f, self._options.local_server_port)
-      cherrypy.log('Redirect to %s' % redirect_url)
-      cherrypy.lib.cptools.redirect(redirect_url, internal=False)
-    else:
-      sanitized_path = os.path.abspath(os.path.join(self._options.www_root, f))
-      return cherrypy.lib.static.serve_file(sanitized_path)
-
-  def _GetServerURL(self, f, port, **kwargs):
-    """Returns a URL for local server to serve the file on given port.
-
-    Args:
-      f: file name to serve on local server. Relative to www_root.
-      port: Local server port (it can be a configured constrained port).
-      kwargs: extra parameteres passed in the URL.
-    """
-    url = '%s?f=%s&' % (cherrypy.url(), f)
-    if self._options.local_server_port:
-      url = '%s/%s?' % (
-          cherrypy.url().replace('ServeConstrained', self._options.www_root), f)
-
-    url = url.replace(':%d' % self._options.port, ':%d' % port)
-    extra_args = urllib.urlencode(kwargs)
-    if extra_args:
-      url += extra_args
-    return url
-
-  def _GetConstrainedPort(self, f=None, bandwidth=None, latency=None, loss=None,
-                          new_port=False, **kwargs):
-    """Creates or gets a port with specified network constraints.
-
-    See ServeConstrained() for more details.
-    """
-    # Validate inputs. isdigit() guarantees a natural number.
-    bandwidth = self._ParseIntParameter(
-        bandwidth, 'Invalid bandwidth constraint.', lambda x: x > 0)
-    latency = self._ParseIntParameter(
-        latency, 'Invalid latency constraint.', lambda x: x >= 0)
-    loss = self._ParseIntParameter(
-        loss, 'Invalid loss constraint.', lambda x: x <= 100 and x >= 0)
-
-    redirect_port = self._options.port
-    if self._options.local_server_port:
-      redirect_port = self._options.local_server_port
-
-    start_time = time.time()
-    # Allocate a port using the given constraints. If a port with the requested
-    # key and kwargs already exist then reuse that port.
-    constrained_port = self._port_allocator.Get(
-        cherrypy.request.remote.ip, server_port=redirect_port,
-        interface=self._options.interface, bandwidth=bandwidth, latency=latency,
-        loss=loss, new_port=new_port, file=f, **kwargs)
-
-    cherrypy.log('Time to set up port %d = %.3fsec.' %
-                 (constrained_port, time.time() - start_time))
-
-    if not constrained_port:
-      raise cherrypy.HTTPError(503, 'Service unavailable. Out of ports.')
-    return constrained_port
-
-  def _ParseIntParameter(self, param, msg, check):
-    """Returns integer value of param and verifies it satisfies the check.
-
-    Args:
-      param: Parameter name to check.
-      msg: Message in error if raised.
-      check: Check to verify the parameter value.
-
-    Returns:
-      None if param is None, integer value of param otherwise.
-
-    Raises:
-      cherrypy.HTTPError if param can not be converted to integer or if it does
-      not satisfy the check.
-    """
-    if param:
-      try:
-        int_value = int(param)
-        if check(int_value):
-          return int_value
-      except:
-        pass
-      raise cherrypy.HTTPError(400, msg)
-
-
-def ParseArgs():
-  """Define and parse the command-line arguments."""
-  parser = optparse.OptionParser()
-
-  parser.add_option('--expiry-time', type='int',
-                    default=_DEFAULT_PORT_EXPIRY_TIME_SECS,
-                    help=('Number of seconds before constrained ports expire '
-                          'and are cleaned up. 0=Disabled. Default: %default'))
-  parser.add_option('--port', type='int', default=_DEFAULT_SERVING_PORT,
-                    help='Port to serve the API on. Default: %default')
-  parser.add_option('--port-range', default=_DEFAULT_CNS_PORT_RANGE,
-                    help=('Range of ports for constrained serving. Specify as '
-                          'a comma separated value pair. Default: %default'))
-  parser.add_option('--interface', default='eth0',
-                    help=('Interface to setup constraints on. Use lo for a '
-                          'local client. Default: %default'))
-  parser.add_option('--socket-timeout', type='int',
-                    default=cherrypy.server.socket_timeout,
-                    help=('Number of seconds before a socket connection times '
-                          'out. Default: %default'))
-  parser.add_option('--threads', type='int',
-                    default=cherrypy._cpserver.Server.thread_pool,
-                    help=('Number of threads in the thread pool. Default: '
-                          '%default'))
-  parser.add_option('--www-root', default='',
-                    help=('Directory root to serve files from. If --local-'
-                          'server-port is used, the path is appended to the '
-                          'redirected URL of local server. Defaults to the '
-                          'current directory (if --local-server-port is not '
-                          'used): %s' % os.getcwd()))
-  parser.add_option('--local-server-port', type='int',
-                    help=('Optional local server port to host files.'))
-  parser.add_option('-v', '--verbose', action='store_true', default=False,
-                    help='Turn on verbose output.')
-
-  options = parser.parse_args()[0]
-
-  # Convert port range into the desired tuple format.
-  try:
-    if isinstance(options.port_range, str):
-      options.port_range = [int(port) for port in options.port_range.split(',')]
-  except ValueError:
-    parser.error('Invalid port range specified.')
-
-  if options.expiry_time < 0:
-    parser.error('Invalid expiry time specified.')
-
-  # Convert the path to an absolute to remove any . or ..
-  if not options.local_server_port:
-    if not options.www_root:
-      options.www_root = os.getcwd()
-    options.www_root = os.path.abspath(options.www_root)
-
-  _SetLogger(options.verbose)
-
-  return options
-
-
-def _SetLogger(verbose):
-  file_handler = handlers.RotatingFileHandler('cns.log', 'a', 10000000, 10)
-  file_handler.setFormatter(logging.Formatter('[%(threadName)s] %(message)s'))
-
-  log_level = _DEFAULT_LOG_LEVEL
-  if verbose:
-    log_level = logging.DEBUG
-  file_handler.setLevel(log_level)
-
-  cherrypy.log.error_log.addHandler(file_handler)
-  cherrypy.log.access_log.addHandler(file_handler)
-
-
-def Main():
-  """Configure and start the ConstrainedNetworkServer."""
-  options = ParseArgs()
-
-  try:
-    traffic_control.CheckRequirements()
-  except traffic_control.TrafficControlError as e:
-    cherrypy.log(e.msg)
-    return
-
-  cherrypy.config.update({'server.socket_host': '::',
-                          'server.socket_port': options.port})
-
-  if options.threads:
-    cherrypy.config.update({'server.thread_pool': options.threads})
-
-  if options.socket_timeout:
-    cherrypy.config.update({'server.socket_timeout': options.socket_timeout})
-
-  # Setup port allocator here so we can call cleanup on failures/exit.
-  pa = PortAllocator(options.port_range, expiry_time_secs=options.expiry_time)
-
-  try:
-    cherrypy.quickstart(ConstrainedNetworkServer(options, pa))
-  finally:
-    # Disable Ctrl-C handler to prevent interruption of cleanup.
-    signal.signal(signal.SIGINT, lambda signal, frame: None)
-    pa.Cleanup(all_ports=True)
-
-
-if __name__ == '__main__':
-  Main()
diff --git a/src/cobalt/media/tools/constrained_network_server/cns_test.py b/src/cobalt/media/tools/constrained_network_server/cns_test.py
deleted file mode 100755
index 5d79495..0000000
--- a/src/cobalt/media/tools/constrained_network_server/cns_test.py
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-"""Tests for Constrained Network Server."""
-import os
-import signal
-import subprocess
-import tempfile
-import time
-import unittest
-import urllib2
-import cherrypy
-import cns
-import traffic_control
-
-# The local interface to test on.
-_INTERFACE = 'lo'
-
-
-class PortAllocatorTest(unittest.TestCase):
-  """Unit tests for the Port Allocator class."""
-
-  # Expiration time for ports. In mock time.
-  _EXPIRY_TIME = 6
-
-  def setUp(self):
-    # Mock out time.time() to accelerate port expiration testing.
-    self._old_time = time.time
-    self._current_time = 0
-    time.time = lambda: self._current_time
-
-    # TODO(dalecurtis): Mock out actual calls to shadi's port setup.
-    self._pa = cns.PortAllocator(cns._DEFAULT_CNS_PORT_RANGE, self._EXPIRY_TIME)
-    self._MockTrafficControl()
-
-  def tearDown(self):
-    self._pa.Cleanup(all_ports=True)
-    # Ensure ports are cleaned properly.
-    self.assertEquals(self._pa._ports, {})
-    time.time = self._old_time
-    self._RestoreTrafficControl()
-
-  def _MockTrafficControl(self):
-    self.old_CreateConstrainedPort = traffic_control.CreateConstrainedPort
-    self.old_DeleteConstrainedPort = traffic_control.DeleteConstrainedPort
-    self.old_TearDown = traffic_control.TearDown
-
-    traffic_control.CreateConstrainedPort = lambda config: True
-    traffic_control.DeleteConstrainedPort = lambda config: True
-    traffic_control.TearDown = lambda config: True
-
-  def _RestoreTrafficControl(self):
-    traffic_control.CreateConstrainedPort = self.old_CreateConstrainedPort
-    traffic_control.DeleteConstrainedPort = self.old_DeleteConstrainedPort
-    traffic_control.TearDown = self.old_TearDown
-
-  def testPortAllocator(self):
-    # Ensure Get() succeeds and returns the correct port.
-    self.assertEquals(self._pa.Get('test'), cns._DEFAULT_CNS_PORT_RANGE[0])
-
-    # Call again with the same key and make sure we get the same port.
-    self.assertEquals(self._pa.Get('test'), cns._DEFAULT_CNS_PORT_RANGE[0])
-
-    # Call with a different key and make sure we get a different port.
-    self.assertEquals(self._pa.Get('test2'), cns._DEFAULT_CNS_PORT_RANGE[0] + 1)
-
-    # Update fake time so that ports should expire.
-    self._current_time += self._EXPIRY_TIME + 1
-
-    # Test to make sure cache is checked before expiring ports.
-    self.assertEquals(self._pa.Get('test2'), cns._DEFAULT_CNS_PORT_RANGE[0] + 1)
-
-    # Update fake time so that ports should expire.
-    self._current_time += self._EXPIRY_TIME + 1
-
-    # Request a new port, old ports should be expired, so we should get the
-    # first port in the range. Make sure this is the only allocated port.
-    self.assertEquals(self._pa.Get('test3'), cns._DEFAULT_CNS_PORT_RANGE[0])
-    self.assertEquals(self._pa._ports.keys(), [cns._DEFAULT_CNS_PORT_RANGE[0]])
-
-  def testPortAllocatorExpiresOnlyCorrectPorts(self):
-    # Ensure Get() succeeds and returns the correct port.
-    self.assertEquals(self._pa.Get('test'), cns._DEFAULT_CNS_PORT_RANGE[0])
-
-    # Stagger port allocation and so we can ensure only ports older than the
-    # expiry time are actually expired.
-    self._current_time += self._EXPIRY_TIME / 2 + 1
-
-    # Call with a different key and make sure we get a different port.
-    self.assertEquals(self._pa.Get('test2'), cns._DEFAULT_CNS_PORT_RANGE[0] + 1)
-
-    # After this sleep the port with key 'test' should expire on the next Get().
-    self._current_time += self._EXPIRY_TIME / 2 + 1
-
-    # Call with a different key and make sure we get the first port.
-    self.assertEquals(self._pa.Get('test3'), cns._DEFAULT_CNS_PORT_RANGE[0])
-    self.assertEquals(set(self._pa._ports.keys()), set([
-        cns._DEFAULT_CNS_PORT_RANGE[0], cns._DEFAULT_CNS_PORT_RANGE[0] + 1]))
-
-  def testPortAllocatorNoExpiration(self):
-    # Setup PortAllocator w/o port expiration.
-    self._pa = cns.PortAllocator(cns._DEFAULT_CNS_PORT_RANGE, 0)
-
-    # Ensure Get() succeeds and returns the correct port.
-    self.assertEquals(self._pa.Get('test'), cns._DEFAULT_CNS_PORT_RANGE[0])
-
-    # Update fake time to see if ports expire.
-    self._current_time += self._EXPIRY_TIME
-
-    # Send second Get() which would normally cause ports to expire. Ensure that
-    # the ports did not expire.
-    self.assertEquals(self._pa.Get('test2'), cns._DEFAULT_CNS_PORT_RANGE[0] + 1)
-    self.assertEquals(set(self._pa._ports.keys()), set([
-        cns._DEFAULT_CNS_PORT_RANGE[0], cns._DEFAULT_CNS_PORT_RANGE[0] + 1]))
-
-  def testPortAllocatorCleanMatchingIP(self):
-    # Setup PortAllocator w/o port expiration.
-    self._pa = cns.PortAllocator(cns._DEFAULT_CNS_PORT_RANGE, 0)
-
-    # Ensure Get() succeeds and returns the correct port.
-    self.assertEquals(self._pa.Get('ip1', t=1), cns._DEFAULT_CNS_PORT_RANGE[0])
-    self.assertEquals(self._pa.Get('ip1', t=2),
-                      cns._DEFAULT_CNS_PORT_RANGE[0] + 1)
-    self.assertEquals(self._pa.Get('ip1', t=3),
-                      cns._DEFAULT_CNS_PORT_RANGE[0] + 2)
-    self.assertEquals(self._pa.Get('ip2', t=1),
-                      cns._DEFAULT_CNS_PORT_RANGE[0] + 3)
-
-    self._pa.Cleanup(all_ports=False, request_ip='ip1')
-
-    self.assertEquals(self._pa._ports.keys(),
-                      [cns._DEFAULT_CNS_PORT_RANGE[0] + 3])
-    self.assertEquals(self._pa.Get('ip2'), cns._DEFAULT_CNS_PORT_RANGE[0])
-    self.assertEquals(self._pa.Get('ip1'), cns._DEFAULT_CNS_PORT_RANGE[0] + 1)
-
-    self._pa.Cleanup(all_ports=False, request_ip='ip2')
-    self.assertEquals(self._pa._ports.keys(),
-                      [cns._DEFAULT_CNS_PORT_RANGE[0] + 1])
-
-    self._pa.Cleanup(all_ports=False, request_ip='abc')
-    self.assertEquals(self._pa._ports.keys(),
-                      [cns._DEFAULT_CNS_PORT_RANGE[0] + 1])
-
-    self._pa.Cleanup(all_ports=False, request_ip='ip1')
-    self.assertEquals(self._pa._ports.keys(), [])
-
-
-class ConstrainedNetworkServerTest(unittest.TestCase):
-  """End to end tests for ConstrainedNetworkServer system.
-
-  These tests require root access and run the cherrypy server along with
-  tc/iptables commands.
-  """
-
-  # Amount of time to wait for the CNS to start up.
-  _SERVER_START_SLEEP_SECS = 1
-
-  # Sample data used to verify file serving.
-  _TEST_DATA = 'The quick brown fox jumps over the lazy dog'
-
-  # Server information.
-  _SERVER_URL = ('http://127.0.0.1:%d/ServeConstrained?' %
-                 cns._DEFAULT_SERVING_PORT)
-
-  # Setting for latency testing.
-  _LATENCY_TEST_SECS = 1
-
-  def _StartServer(self):
-    """Starts the CNS, returns pid."""
-    cmd = ['python', 'cns.py', '--interface=%s' % _INTERFACE]
-    process = subprocess.Popen(cmd, stderr=subprocess.PIPE)
-
-    # Wait for server to startup.
-    line = True
-    while line:
-      line = process.stderr.readline()
-      if 'STARTED' in line:
-        return process.pid
-
-    self.fail('Failed to start CNS.')
-
-  def setUp(self):
-    # Start the CNS.
-    self._server_pid = self._StartServer()
-
-    # Create temp file for serving. Run after server start so if a failure
-    # during setUp() occurs we don't leave junk files around.
-    f, self._file = tempfile.mkstemp(dir=os.getcwd())
-    os.write(f, self._TEST_DATA)
-    os.close(f)
-
-    # Strip cwd off so we have a proper relative path.
-    self._relative_fn = self._file[len(os.getcwd()) + 1:]
-
-  def tearDown(self):
-    os.unlink(self._file)
-    os.kill(self._server_pid, signal.SIGTERM)
-
-  def testServerServesFiles(self):
-    now = time.time()
-
-    f = urllib2.urlopen('%sf=%s' % (self._SERVER_URL, self._relative_fn))
-
-    # Verify file data is served correctly.
-    self.assertEqual(self._TEST_DATA, f.read())
-
-    # For completeness ensure an unconstrained call takes less time than our
-    # artificial constraints checked in the tests below.
-    self.assertTrue(time.time() - now < self._LATENCY_TEST_SECS)
-
-  def testServerLatencyConstraint(self):
-    """Tests serving a file with a latency network constraint."""
-    # Abort if does not have root access.
-    self.assertEqual(os.geteuid(), 0, 'You need root access to run this test.')
-    now = time.time()
-
-    base_url = '%sf=%s' % (self._SERVER_URL, self._relative_fn)
-    url = '%s&latency=%d' % (base_url, self._LATENCY_TEST_SECS * 1000)
-    f = urllib2.urlopen(url)
-
-    # Verify file data is served correctly.
-    self.assertEqual(self._TEST_DATA, f.read())
-
-    # Verify the request took longer than the requested latency.
-    self.assertTrue(time.time() - now > self._LATENCY_TEST_SECS)
-
-    # Verify the server properly redirected the URL.
-    self.assertTrue(f.geturl().startswith(base_url.replace(
-        str(cns._DEFAULT_SERVING_PORT), str(cns._DEFAULT_CNS_PORT_RANGE[0]))))
-
-
-class ConstrainedNetworkServerUnitTests(unittest.TestCase):
-  """ConstrainedNetworkServer class unit tests."""
-
-  def testGetServerURL(self):
-    """Test server URL is correct when using Cherrypy port."""
-    cns_obj = cns.ConstrainedNetworkServer(self.DummyOptions(), None)
-
-    self.assertEqual(cns_obj._GetServerURL('ab/xz.webm', port=1234, t=1),
-                     'http://127.0.0.1:1234/ServeConstrained?f=ab/xz.webm&t=1')
-
-  def testGetServerURLWithLocalServer(self):
-    """Test server URL is correct when using --local-server-port port."""
-    cns_obj = cns.ConstrainedNetworkServer(self.DummyOptionsWithServer(), None)
-
-    self.assertEqual(cns_obj._GetServerURL('ab/xz.webm', port=1234, t=1),
-                     'http://127.0.0.1:1234/media/ab/xz.webm?t=1')
-
-  class DummyOptions(object):
-    www_root = 'media'
-    port = 9000
-    cherrypy.url = lambda: 'http://127.0.0.1:9000/ServeConstrained'
-    local_server_port = None
-
-  class DummyOptionsWithServer(object):
-    www_root = 'media'
-    port = 9000
-    cherrypy.url = lambda: 'http://127.0.0.1:9000/ServeConstrained'
-    local_server_port = 8080
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/constrained_network_server/traffic_control.py b/src/cobalt/media/tools/constrained_network_server/traffic_control.py
deleted file mode 100644
index e94cc8d..0000000
--- a/src/cobalt/media/tools/constrained_network_server/traffic_control.py
+++ /dev/null
@@ -1,354 +0,0 @@
-# Copyright (c) 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.
-
-"""Traffic control library for constraining the network configuration on a port.
-
-The traffic controller sets up a constrained network configuration on a port.
-Traffic to the constrained port is forwarded to a specified server port.
-"""
-
-import logging
-import os
-import re
-import subprocess
-
-# The maximum bandwidth limit.
-_DEFAULT_MAX_BANDWIDTH_KBIT = 1000000
-
-
-class TrafficControlError(BaseException):
-  """Exception raised for errors in traffic control library.
-
-  Attributes:
-    msg: User defined error message.
-    cmd: Command for which the exception was raised.
-    returncode: Return code of running the command.
-    stdout: Output of running the command.
-    stderr: Error output of running the command.
-  """
-
-  def __init__(self, msg, cmd=None, returncode=None, output=None,
-               error=None):
-    BaseException.__init__(self, msg)
-    self.msg = msg
-    self.cmd = cmd
-    self.returncode = returncode
-    self.output = output
-    self.error = error
-
-
-def CheckRequirements():
-  """Checks if permissions are available to run traffic control commands.
-
-  Raises:
-    TrafficControlError: If permissions to run traffic control commands are not
-    available.
-  """
-  if os.geteuid() != 0:
-    _Exec(['sudo', '-n', 'tc', '-help'],
-          msg=('Cannot run \'tc\' command. Traffic Control must be run as root '
-               'or have password-less sudo access to this command.'))
-    _Exec(['sudo', '-n', 'iptables', '-help'],
-          msg=('Cannot run \'iptables\' command. Traffic Control must be run '
-               'as root or have password-less sudo access to this command.'))
-
-
-def CreateConstrainedPort(config):
-  """Creates a new constrained port.
-
-  Imposes packet level constraints such as bandwidth, latency, and packet loss
-  on a given port using the specified configuration dictionary. Traffic to that
-  port is forwarded to a specified server port.
-
-  Args:
-    config: Constraint configuration dictionary, format:
-      port: Port to constrain (integer 1-65535).
-      server_port: Port to redirect traffic on [port] to (integer 1-65535).
-      interface: Network interface name (string).
-      latency: Delay added on each packet sent (integer in ms).
-      bandwidth: Maximum allowed upload bandwidth (integer in kbit/s).
-      loss: Percentage of packets to drop (integer 0-100).
-
-  Raises:
-    TrafficControlError: If any operation fails. The message in the exception
-    describes what failed.
-  """
-  _CheckArgsExist(config, 'interface', 'port', 'server_port')
-  _AddRootQdisc(config['interface'])
-
-  try:
-    _ConfigureClass('add', config)
-    _AddSubQdisc(config)
-    _AddFilter(config['interface'], config['port'])
-    _AddIptableRule(config['interface'], config['port'], config['server_port'])
-  except TrafficControlError as e:
-    logging.debug('Error creating constrained port %d.\nError: %s\n'
-                  'Deleting constrained port.', config['port'], e.error)
-    DeleteConstrainedPort(config)
-    raise e
-
-
-def DeleteConstrainedPort(config):
-  """Deletes an existing constrained port.
-
-  Deletes constraints set on a given port and the traffic forwarding rule from
-  the constrained port to a specified server port.
-
-  The original constrained network configuration used to create the constrained
-  port must be passed in.
-
-  Args:
-    config: Constraint configuration dictionary, format:
-      port: Port to constrain (integer 1-65535).
-      server_port: Port to redirect traffic on [port] to (integer 1-65535).
-      interface: Network interface name (string).
-      bandwidth: Maximum allowed upload bandwidth (integer in kbit/s).
-
-  Raises:
-    TrafficControlError: If any operation fails. The message in the exception
-    describes what failed.
-  """
-  _CheckArgsExist(config, 'interface', 'port', 'server_port')
-  try:
-    # Delete filters first so it frees the class.
-    _DeleteFilter(config['interface'], config['port'])
-  finally:
-    try:
-      # Deleting the class deletes attached qdisc as well.
-      _ConfigureClass('del', config)
-    finally:
-      _DeleteIptableRule(config['interface'], config['port'],
-                         config['server_port'])
-
-
-def TearDown(config):
-  """Deletes the root qdisc and all iptables rules.
-
-  Args:
-    config: Constraint configuration dictionary, format:
-      interface: Network interface name (string).
-
-  Raises:
-    TrafficControlError: If any operation fails. The message in the exception
-    describes what failed.
-  """
-  _CheckArgsExist(config, 'interface')
-
-  command = ['sudo', 'tc', 'qdisc', 'del', 'dev', config['interface'], 'root']
-  try:
-    _Exec(command, msg='Could not delete root qdisc.')
-  finally:
-    _DeleteAllIpTableRules()
-
-
-def _CheckArgsExist(config, *args):
-  """Check that the args exist in config dictionary and are not None.
-
-  Args:
-    config: Any dictionary.
-    *args: The list of key names to check.
-
-  Raises:
-    TrafficControlError: If any key name does not exist in config or is None.
-  """
-  for key in args:
-    if key not in config.keys() or config[key] is None:
-      raise TrafficControlError('Missing "%s" parameter.' % key)
-
-
-def _AddRootQdisc(interface):
-  """Sets up the default root qdisc.
-
-  Args:
-    interface: Network interface name.
-
-  Raises:
-    TrafficControlError: If adding the root qdisc fails for a reason other than
-    it already exists.
-  """
-  command = ['sudo', 'tc', 'qdisc', 'add', 'dev', interface, 'root', 'handle',
-             '1:', 'htb']
-  try:
-    _Exec(command, msg=('Error creating root qdisc. '
-                        'Make sure you have root access'))
-  except TrafficControlError as e:
-    # Ignore the error if root already exists.
-    if not 'File exists' in e.error:
-      raise e
-
-
-def _ConfigureClass(option, config):
-  """Adds or deletes a class and qdisc attached to the root.
-
-  The class specifies bandwidth, and qdisc specifies delay and packet loss. The
-  class ID is based on the config port.
-
-  Args:
-    option: Adds or deletes a class option [add|del].
-    config: Constraint configuration dictionary, format:
-      port: Port to constrain (integer 1-65535).
-      interface: Network interface name (string).
-      bandwidth: Maximum allowed upload bandwidth (integer in kbit/s).
-  """
-  # Use constrained port as class ID so we can attach the qdisc and filter to
-  # it, as well as delete the class, using only the port number.
-  class_id = '1:%x' % config['port']
-  if 'bandwidth' not in config.keys() or not config['bandwidth']:
-    bandwidth = _DEFAULT_MAX_BANDWIDTH_KBIT
-  else:
-    bandwidth = config['bandwidth']
-
-  bandwidth = '%dkbit' % bandwidth
-  command = ['sudo', 'tc', 'class', option, 'dev', config['interface'],
-             'parent', '1:', 'classid', class_id, 'htb', 'rate', bandwidth,
-             'ceil', bandwidth]
-  _Exec(command, msg=('Error configuring class ID %s using "%s" command.' %
-                      (class_id, option)))
-
-
-def _AddSubQdisc(config):
-  """Adds a qdisc attached to the class identified by the config port.
-
-  Args:
-    config: Constraint configuration dictionary, format:
-      port: Port to constrain (integer 1-65535).
-      interface: Network interface name (string).
-      latency: Delay added on each packet sent (integer in ms).
-      loss: Percentage of packets to drop (integer 0-100).
-  """
-  port_hex = '%x' % config['port']
-  class_id = '1:%x' % config['port']
-  command = ['sudo', 'tc', 'qdisc', 'add', 'dev', config['interface'], 'parent',
-             class_id, 'handle', port_hex + ':0', 'netem']
-
-  # Check if packet-loss is set in the configuration.
-  if 'loss' in config.keys() and config['loss']:
-    loss = '%d%%' % config['loss']
-    command.extend(['loss', loss])
-  # Check if latency is set in the configuration.
-  if 'latency' in config.keys() and config['latency']:
-    latency = '%dms' % config['latency']
-    command.extend(['delay', latency])
-
-  _Exec(command, msg='Could not attach qdisc to class ID %s.' % class_id)
-
-
-def _AddFilter(interface, port):
-  """Redirects packets coming to a specified port into the constrained class.
-
-  Args:
-    interface: Interface name to attach the filter to (string).
-    port: Port number to filter packets with (integer 1-65535).
-  """
-  class_id = '1:%x' % port
-
-  command = ['sudo', 'tc', 'filter', 'add', 'dev', interface, 'protocol', 'ip',
-             'parent', '1:', 'prio', '1', 'u32', 'match', 'ip', 'sport', port,
-             '0xffff', 'flowid', class_id]
-  _Exec(command, msg='Error adding filter on port %d.' % port)
-
-
-def _DeleteFilter(interface, port):
-  """Deletes the filter attached to the configured port.
-
-  Args:
-    interface: Interface name the filter is attached to (string).
-    port: Port number being filtered (integer 1-65535).
-  """
-  handle_id = _GetFilterHandleId(interface, port)
-  command = ['sudo', 'tc', 'filter', 'del', 'dev', interface, 'protocol', 'ip',
-             'parent', '1:0', 'handle', handle_id, 'prio', '1', 'u32']
-  _Exec(command, msg='Error deleting filter on port %d.' % port)
-
-
-def _GetFilterHandleId(interface, port):
-  """Searches for the handle ID of the filter identified by the config port.
-
-  Args:
-    interface: Interface name the filter is attached to (string).
-    port: Port number being filtered (integer 1-65535).
-
-  Returns:
-    The handle ID.
-
-  Raises:
-    TrafficControlError: If handle ID was not found.
-  """
-  command = ['sudo', 'tc', 'filter', 'list', 'dev', interface, 'parent', '1:']
-  output = _Exec(command, msg='Error listing filters.')
-  # Search for the filter handle ID associated with class ID '1:port'.
-  handle_id_re = re.search(
-      '([0-9a-fA-F]{3}::[0-9a-fA-F]{3}).*(?=flowid 1:%x\s)' % port, output)
-  if handle_id_re:
-    return handle_id_re.group(1)
-  raise TrafficControlError(('Could not find filter handle ID for class ID '
-                             '1:%x.') % port)
-
-
-def _AddIptableRule(interface, port, server_port):
-  """Forwards traffic from constrained port to a specified server port.
-
-  Args:
-    interface: Interface name to attach the filter to (string).
-    port: Port of incoming packets (integer 1-65535).
-    server_port: Server port to forward the packets to (integer 1-65535).
-  """
-  # Preroute rules for accessing the port through external connections.
-  command = ['sudo', 'iptables', '-t', 'nat', '-A', 'PREROUTING', '-i',
-             interface, '-p', 'tcp', '--dport', port, '-j', 'REDIRECT',
-             '--to-port', server_port]
-  _Exec(command, msg='Error adding iptables rule for port %d.' % port)
-
-  # Output rules for accessing the rule through localhost or 127.0.0.1
-  command = ['sudo', 'iptables', '-t', 'nat', '-A', 'OUTPUT', '-p', 'tcp',
-             '--dport', port, '-j', 'REDIRECT', '--to-port', server_port]
-  _Exec(command, msg='Error adding iptables rule for port %d.' % port)
-
-
-def _DeleteIptableRule(interface, port, server_port):
-  """Deletes the iptable rule associated with specified port number.
-
-  Args:
-    interface: Interface name to attach the filter to (string).
-    port: Port of incoming packets (integer 1-65535).
-    server_port: Server port packets are forwarded to (integer 1-65535).
-  """
-  command = ['sudo', 'iptables', '-t', 'nat', '-D', 'PREROUTING', '-i',
-             interface, '-p', 'tcp', '--dport', port, '-j', 'REDIRECT',
-             '--to-port', server_port]
-  _Exec(command, msg='Error deleting iptables rule for port %d.' % port)
-
-  command = ['sudo', 'iptables', '-t', 'nat', '-D', 'OUTPUT', '-p', 'tcp',
-             '--dport', port, '-j', 'REDIRECT', '--to-port', server_port]
-  _Exec(command, msg='Error adding iptables rule for port %d.' % port)
-
-
-def _DeleteAllIpTableRules():
-  """Deletes all iptables rules."""
-  command = ['sudo', 'iptables', '-t', 'nat', '-F']
-  _Exec(command, msg='Error deleting all iptables rules.')
-
-
-def _Exec(command, msg=None):
-  """Executes a command.
-
-  Args:
-    command: Command list to execute.
-    msg: Message describing the error in case the command fails.
-
-  Returns:
-    The standard output from running the command.
-
-  Raises:
-    TrafficControlError: If command fails. Message is set by the msg parameter.
-  """
-  cmd_list = [str(x) for x in command]
-  cmd = ' '.join(cmd_list)
-  logging.debug('Running command: %s', cmd)
-
-  p = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-  output, error = p.communicate()
-  if p.returncode != 0:
-    raise TrafficControlError(msg, cmd, p.returncode, output, error)
-  return output.strip()
diff --git a/src/cobalt/media/tools/constrained_network_server/traffic_control_test.py b/src/cobalt/media/tools/constrained_network_server/traffic_control_test.py
deleted file mode 100755
index d641253..0000000
--- a/src/cobalt/media/tools/constrained_network_server/traffic_control_test.py
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 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.
-
-"""End-to-end tests for traffic control library."""
-import os
-import re
-import sys
-import unittest
-
-import traffic_control
-
-
-class TrafficControlTests(unittest.TestCase):
-  """System tests for traffic_control functions.
-
-  These tests require root access.
-  """
-  # A dummy interface name to use instead of real interface.
-  _INTERFACE = 'myeth'
-
-  def setUp(self):
-    """Setup a dummy interface."""
-    # If we update to python version 2.7 or newer we can use setUpClass() or
-    # unittest.skipIf().
-    if os.getuid() != 0:
-      sys.exit('You need root access to run these tests.')
-
-    command = ['ip', 'link', 'add', 'name', self._INTERFACE, 'type', 'dummy']
-    traffic_control._Exec(command, 'Error creating dummy interface %s.' %
-                          self._INTERFACE)
-
-  def tearDown(self):
-    """Teardown the dummy interface and any network constraints on it."""
-    # Deleting the dummy interface deletes all associated constraints.
-    command = ['ip', 'link', 'del', self._INTERFACE]
-    traffic_control._Exec(command)
-
-  def testExecOutput(self):
-    output = traffic_control._Exec(['echo', '    Test    '])
-    self.assertEqual(output, 'Test')
-
-  def testExecException(self):
-    self.assertRaises(traffic_control.TrafficControlError,
-                      traffic_control._Exec, command=['ls', '!doesntExist!'])
-
-  def testExecErrorCustomMsg(self):
-    try:
-      traffic_control._Exec(['ls', '!doesntExist!'], msg='test_msg')
-      self.fail('No exception raised for invalid command.')
-    except traffic_control.TrafficControlError as e:
-      self.assertEqual(e.msg, 'test_msg')
-
-  def testAddRootQdisc(self):
-    """Checks adding a root qdisc is successful."""
-    config = {'interface': self._INTERFACE}
-    root_detail = 'qdisc htb 1: root'
-    # Assert no htb root at startup.
-    command = ['tc', 'qdisc', 'ls', 'dev', config['interface']]
-    output = traffic_control._Exec(command)
-    self.assertFalse(root_detail in output)
-
-    traffic_control._AddRootQdisc(config['interface'])
-    output = traffic_control._Exec(command)
-    # Assert htb root is added.
-    self.assertTrue(root_detail in output)
-
-  def testConfigureClassAdd(self):
-    """Checks adding and deleting a class to the root qdisc."""
-    config = {
-        'interface': self._INTERFACE,
-        'port': 12345,
-        'server_port': 33333,
-        'bandwidth': 2000
-    }
-    class_detail = ('class htb 1:%x root prio 0 rate %dKbit ceil %dKbit' %
-                    (config['port'], config['bandwidth'], config['bandwidth']))
-
-    # Add root qdisc.
-    traffic_control._AddRootQdisc(config['interface'])
-
-    # Assert class does not exist prior to adding it.
-    command = ['tc', 'class', 'ls', 'dev', config['interface']]
-    output = traffic_control._Exec(command)
-    self.assertFalse(class_detail in output)
-
-    # Add class to root.
-    traffic_control._ConfigureClass('add', config)
-
-    # Assert class is added.
-    command = ['tc', 'class', 'ls', 'dev', config['interface']]
-    output = traffic_control._Exec(command)
-    self.assertTrue(class_detail in output)
-
-    # Delete class.
-    traffic_control._ConfigureClass('del', config)
-
-    # Assert class is deleted.
-    command = ['tc', 'class', 'ls', 'dev', config['interface']]
-    output = traffic_control._Exec(command)
-    self.assertFalse(class_detail in output)
-
-  def testAddSubQdisc(self):
-    """Checks adding a sub qdisc to existing class."""
-    config = {
-        'interface': self._INTERFACE,
-        'port': 12345,
-        'server_port': 33333,
-        'bandwidth': 2000,
-        'latency': 250,
-        'loss': 5
-    }
-    qdisc_re_detail = ('qdisc netem %x: parent 1:%x .* delay %d.0ms loss %d%%' %
-                       (config['port'], config['port'], config['latency'],
-                        config['loss']))
-    # Add root qdisc.
-    traffic_control._AddRootQdisc(config['interface'])
-
-    # Add class to root.
-    traffic_control._ConfigureClass('add', config)
-
-    # Assert qdisc does not exist prior to adding it.
-    command = ['tc', 'qdisc', 'ls', 'dev', config['interface']]
-    output = traffic_control._Exec(command)
-    handle_id_re = re.search(qdisc_re_detail, output)
-    self.assertEqual(handle_id_re, None)
-
-    # Add qdisc to class.
-    traffic_control._AddSubQdisc(config)
-
-    # Assert qdisc is added.
-    command = ['tc', 'qdisc', 'ls', 'dev', config['interface']]
-    output = traffic_control._Exec(command)
-    handle_id_re = re.search(qdisc_re_detail, output)
-    self.assertNotEqual(handle_id_re, None)
-
-  def testAddDeleteFilter(self):
-    config = {
-        'interface': self._INTERFACE,
-        'port': 12345,
-        'bandwidth': 2000
-    }
-    # Assert no filter exists.
-    command = ['tc', 'filter', 'list', 'dev', config['interface'], 'parent',
-               '1:0']
-    output = traffic_control._Exec(command)
-    self.assertEqual(output, '')
-
-    # Create the root and class to which the filter will be attached.
-    # Add root qdisc.
-    traffic_control._AddRootQdisc(config['interface'])
-
-    # Add class to root.
-    traffic_control._ConfigureClass('add', config)
-
-    # Add the filter.
-    traffic_control._AddFilter(config['interface'], config['port'])
-    handle_id = traffic_control._GetFilterHandleId(config['interface'],
-                                                   config['port'])
-    self.assertNotEqual(handle_id, None)
-
-    # Delete the filter.
-    # The output of tc filter list is not None because tc adds default filters.
-    traffic_control._DeleteFilter(config['interface'], config['port'])
-    self.assertRaises(traffic_control.TrafficControlError,
-                      traffic_control._GetFilterHandleId, config['interface'],
-                      config['port'])
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/constrained_network_server/traffic_control_unittest.py b/src/cobalt/media/tools/constrained_network_server/traffic_control_unittest.py
deleted file mode 100755
index a6781e9..0000000
--- a/src/cobalt/media/tools/constrained_network_server/traffic_control_unittest.py
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 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.
-
-"""Tests for traffic control library."""
-import unittest
-
-import traffic_control
-
-
-class TrafficControlUnitTests(unittest.TestCase):
-  """Unit tests for traffic control."""
-
-  # Stores commands called by the traffic control _Exec function.
-  commands = []
-
-  def _ExecMock(self, command, **kwargs):
-    """Mocks traffic_control._Exec and adds the command to commands list."""
-    cmd_list = [str(x) for x in command]
-    self.commands.append(' '.join(cmd_list))
-    return ''
-
-  def setUp(self):
-    """Resets the commands list and set the _Exec mock function."""
-    self.commands = []
-    self._old_Exec = traffic_control._Exec
-    traffic_control._Exec = self._ExecMock
-
-  def tearDown(self):
-    """Resets the _Exec mock function to the original."""
-    traffic_control._Exec = self._old_Exec
-
-  def testCreateConstrainedPort(self):
-    config = {
-        'interface': 'fakeeth',
-        'port': 12345,
-        'server_port': 8888,
-        'bandwidth': 256,
-        'latency': 100,
-        'loss': 2
-    }
-    traffic_control.CreateConstrainedPort(config)
-    expected = [
-        'sudo tc qdisc add dev fakeeth root handle 1: htb',
-        'sudo tc class add dev fakeeth parent 1: classid 1:3039 htb rate '
-        '256kbit ceil 256kbit',
-        'sudo tc qdisc add dev fakeeth parent 1:3039 handle 3039:0 netem loss '
-        '2% delay 100ms',
-        'sudo tc filter add dev fakeeth protocol ip parent 1: prio 1 u32 match '
-        'ip sport 12345 0xffff flowid 1:3039',
-        'sudo iptables -t nat -A PREROUTING -i fakeeth -p tcp --dport 12345 -j '
-        'REDIRECT --to-port 8888',
-        'sudo iptables -t nat -A OUTPUT -p tcp --dport 12345 -j REDIRECT '
-        '--to-port 8888'
-    ]
-    self.assertEqual(expected, self.commands)
-
-  def testCreateConstrainedPortDefaults(self):
-    config = {
-        'interface': 'fakeeth',
-        'port': 12345,
-        'server_port': 8888,
-        'latency': None
-    }
-    traffic_control.CreateConstrainedPort(config)
-    expected = [
-        'sudo tc qdisc add dev fakeeth root handle 1: htb',
-        'sudo tc class add dev fakeeth parent 1: classid 1:3039 htb rate '
-        '%dkbit ceil %dkbit' % (traffic_control._DEFAULT_MAX_BANDWIDTH_KBIT,
-                                traffic_control._DEFAULT_MAX_BANDWIDTH_KBIT),
-        'sudo tc qdisc add dev fakeeth parent 1:3039 handle 3039:0 netem',
-        'sudo tc filter add dev fakeeth protocol ip parent 1: prio 1 u32 '
-        'match ip sport 12345 0xffff flowid 1:3039',
-        'sudo iptables -t nat -A PREROUTING -i fakeeth -p tcp --dport 12345 -j '
-        'REDIRECT --to-port 8888',
-        'sudo iptables -t nat -A OUTPUT -p tcp --dport 12345 -j REDIRECT '
-        '--to-port 8888'
-    ]
-    self.assertEqual(expected, self.commands)
-
-  def testDeleteConstrainedPort(self):
-    config = {
-        'interface': 'fakeeth',
-        'port': 12345,
-        'server_port': 8888,
-        'bandwidth': 256,
-    }
-    _old_GetFilterHandleId = traffic_control._GetFilterHandleId
-    traffic_control._GetFilterHandleId = lambda interface, port: '800::800'
-
-    try:
-      traffic_control.DeleteConstrainedPort(config)
-      expected = [
-          'sudo tc filter del dev fakeeth protocol ip parent 1:0 handle '
-          '800::800 prio 1 u32',
-          'sudo tc class del dev fakeeth parent 1: classid 1:3039 htb rate '
-          '256kbit ceil 256kbit',
-          'sudo iptables -t nat -D PREROUTING -i fakeeth -p tcp --dport 12345 '
-          '-j REDIRECT --to-port 8888',
-          'sudo iptables -t nat -D OUTPUT -p tcp --dport 12345 -j REDIRECT '
-          '--to-port 8888']
-      self.assertEqual(expected, self.commands)
-    finally:
-      traffic_control._GetFilterHandleId = _old_GetFilterHandleId
-
-  def testTearDown(self):
-    config = {'interface': 'fakeeth'}
-
-    traffic_control.TearDown(config)
-    expected = [
-        'sudo tc qdisc del dev fakeeth root',
-        'sudo iptables -t nat -F'
-    ]
-    self.assertEqual(expected, self.commands)
-
-  def testGetFilterHandleID(self):
-    # Check seach for handle ID command.
-    self.assertRaises(traffic_control.TrafficControlError,
-                      traffic_control._GetFilterHandleId, 'fakeeth', 1)
-    self.assertEquals(self.commands, ['sudo tc filter list dev fakeeth parent '
-                                      '1:'])
-
-    # Check with handle ID available.
-    traffic_control._Exec = (lambda command, msg:
-      'filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht '
-      '800 bkt 0 flowid 1:1\nmatch 08ae0000/ffff0000 at 20')
-    output = traffic_control._GetFilterHandleId('fakeeth', 1)
-    self.assertEqual(output, '800::800')
-
-    # Check with handle ID not available.
-    traffic_control._Exec = (lambda command, msg:
-      'filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht '
-      '800 bkt 0 flowid 1:11\nmatch 08ae0000/ffff0000 at 20')
-    self.assertRaises(traffic_control.TrafficControlError,
-                      traffic_control._GetFilterHandleId, 'fakeeth', 1)
-
-    traffic_control._Exec = lambda command, msg: 'NO ID IN HERE'
-    self.assertRaises(traffic_control.TrafficControlError,
-                      traffic_control._GetFilterHandleId, 'fakeeth', 1)
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/layout_tests/README b/src/cobalt/media/tools/layout_tests/README
deleted file mode 100644
index 37bc77d..0000000
--- a/src/cobalt/media/tools/layout_tests/README
+++ /dev/null
@@ -1,93 +0,0 @@
-Layout test analyzer script.
-
-* Prerequisite:
-
-This script requires PySVN (http://pysvn.tigris.org/) to be installed on the
-machine.
-
-* How to execute
-
-python layouttest_analyzer.py (Please run with '-h' for available command-line
-                               options)
-
-Example: python layouttest_analyzer.py -r imasaki@chromium.org 
--t /var/www/analyzer/graph.html
-
-* File/Directory structure
-
-layout_tests/
-  README: this file.
-  *.py: python scripts.
-  tmp/: temp files.
-  test_data/: data for unit tests.
-  graph/: the default location for graph files.
-  anno/: the default location for bug annotation files.
-  result/: the default location for the analyzer results.
-  testname/: the default location for the test group definition files in CSV.
-
-* Execution overview.
-
-1) using PySVN, the script collects layout test of interest
-(specified in command-line parameter and testnames/*.csv file) from
-Webkit SVN repository as well as test description. Then, it gets the
-latest test expectation file and does the simple parsing. The
-parsed test expectation is joined with the layout tests using test name
-as its join key. The tests are classified into 'whole', 'skip',
-'nonskip' test groups. 'Whole' contains all tests, 'skip' contains
-tests that are skipped as specified in the test expectation file, 'nonskip'
-tests are in the test expectation file and not skipped (these are tests
-that need attention).
-
-2) the script reads the previous latest analyzer results, then,
-compares it with current results for each test group ('whole', 'skip',
-and 'nonskip'). It also looks into the SVN test expectation history
-diff for the time period for the test names of interest.
-
-3) all obtained information is sent out to a email list specified
-in the parameters in pretty HTML format.
-
-4) the trend graph is updated using the current results.
-
-* Components
-
-** LayoutTests:
-
-A class to store test names in layout tests. The test names (including
-regular expression patterns) are read from a CSV file and used for
-getting layout test names from Webkit SVN as well as test description.
-
-** TestExpectations:
-
-A class to model the content of test expectation file for analysis.
-The location of the test expectations file can be found in
-|TEST_EXPECTATIONS_LOCATIONS|. It is necessary to parse this
-file and store meaningful information for the analysis (joining with
-existing layout tests using a test name).  Instance variable
-|all_test_expectation_info| is used.  A test name such as
-'media/video-source-type.html' is used for the key to store
-information. However, a test name can appear multiple times in the
-test expectation file. So, the map should keep all the occurrence
-information. For example, the current test expectation file has the
-following two entries: 
-
-BUGWK58587 LINUX DEBUG GPU : media/video-zoom.html = IMAGE 
-BUGCR86714 MAC GPU : media/video-zoom.html = CRASH IMAGE 
-
-In this case, all_test_expectation_info['media/video-zoom.html'] will
-have a list with two elements, each of which is the map of the test
-expectation information.
-
-** TestExpectationsHistory:
-
-A class to represent history of the test expectation file. The history
-is obtained by calling PySVN.log()/diff() APIs using the specified time
-period.
-
-** TrendGraph: 
-
-A class to manage trend graph which is using Google Visualization
-  APIs. Google Visualization API
-  (http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html)
-  is used to present the historical analyzer result. Currently, data
-  is directly written to JavaScript file using file in-place
-  replacement for simplicity.
diff --git a/src/cobalt/media/tools/layout_tests/bug.py b/src/cobalt/media/tools/layout_tests/bug.py
deleted file mode 100644
index d8cd20a..0000000
--- a/src/cobalt/media/tools/layout_tests/bug.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright (c) 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.
-
-"""Bug module that is necessary for the layout analyzer."""
-
-import re
-
-from webkitpy.layout_tests.models.test_expectations import *
-
-
-class Bug(object):
-  """A class representing a bug.
-
-  TODO(imasaki): add more functionalities here if bug-tracker API is available.
-  For example, you can get the name of a bug owner.
-  """
-  # Type enum for the bug.
-  WEBKIT = 0
-  CHROMIUM = 1
-  OTHERS = 2
-
-  def __init__(self, bug_modifier):
-    """Initialize the object using raw bug text (such as BUGWK2322).
-
-    The bug modifier used in the test expectation file.
-
-    Args:
-      bug_modifier: a string representing a bug modifier. According to
-        http://www.chromium.org/developers/testing/webkit-layout-tests/\
-        testexpectations
-        Bug identifiers are of the form "webkit.org/b/12345", "crbug.com/12345",
-         "code.google.com/p/v8/issues/detail?id=12345" or "Bug(username)"
-    """
-    match = re.match('Bug\((\w+)\)$', bug_modifier)
-    if match:
-      self.type = self.OTHERS
-      self.url = 'mailto:%s@chromium.org' % match.group(1).lower()
-      self.bug_txt = bug_modifier
-      return
-
-    self.type = self.GetBugType(bug_modifier)
-    self.url = bug_modifier
-    self.bug_txt = bug_modifier
-
-
-  def GetBugType(self, bug_modifier):
-    """Returns type of the bug based on URL."""
-    if bug_modifier.startswith(WEBKIT_BUG_PREFIX):
-      return self.WEBKIT;
-    if bug_modifier.startswith(CHROMIUM_BUG_PREFIX):
-      return self.CHROMIUM;
-    return self.OTHERS
-
-  def __str__(self):
-    """Get a string representation of a bug object.
-
-    Returns:
-      a string for HTML link representation of a bug.
-    """
-    return '<a href="%s">%s</a>' % (self.url, self.bug_txt)
diff --git a/src/cobalt/media/tools/layout_tests/graph/graph.html b/src/cobalt/media/tools/layout_tests/graph/graph.html
deleted file mode 100644
index a54aa4d..0000000
--- a/src/cobalt/media/tools/layout_tests/graph/graph.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-  <head>
-    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
-    <script type='text/javascript'>
-      google.load('visualization', '1', {'packages': ['annotatedtimeline']});
-      google.setOnLoadCallback(drawChart);
-      function drawChart() {
-        var data = new google.visualization.DataTable();
-        data.addColumn('date', 'Date');
-        data.addColumn('number', '#Tests');
-        data.addColumn('string', 'title1');
-        data.addColumn('string', 'text1');
-        data.addColumn('number', '#Skipped tests');
-        data.addColumn('string', 'title2');
-        data.addColumn('string', 'text2');
-        data.addColumn('number', '#Non-skipped tests');
-        data.addColumn('string', 'title2');
-        data.addColumn('string', 'text2');
-        data.addRows([
-         // insert 1
-        ]);
-        var data2 = new google.visualization.DataTable();
-        data2.addColumn('date', 'Date');
-        data2.addColumn('number', 'Passing Rate ' + 
-                                  '(100-(#Non-skipped tests)/' +
-                                  '((#Tests)-(#Skipped tests))*100)');
-        data2.addColumn('string', 'title1');
-        data2.addColumn('string', 'text1');
-        data2.addRows([
-         // insert 2
-        ]);
-        var div1 = document.getElementById('chart_div');
-        var chart = new google.visualization.AnnotatedTimeLine(div1);
-        chart.draw(data, {displayAnnotations: true, allowHtml: true});
-
-        var div2 = document.getElementById('chart_div2');
-        var chart2 = new google.visualization.AnnotatedTimeLine(div2);
-        chart2.draw(data2, {displayAnnotations: true,
-                            allowHtml: true,
-                            scaleType: 'maximized'});
-      }
-    </script>
-    <title>Media Layout Test Analyzer Result</title>
-  </head>
-
-  <body>
-    <h2>Current Statistics</h2>
-    <h3 id='numbers'>Numbers</h3>
-    <div id='chart_div' style='width: 1400px; height: 480px;'></div>
-    <h3>Test passing rate</h3>
-    <div id='chart_div2' style='width: 1400px; height: 480px;'></div>
-  </body>
-</html>
diff --git a/src/cobalt/media/tools/layout_tests/layouttest_analyzer.py b/src/cobalt/media/tools/layout_tests/layouttest_analyzer.py
deleted file mode 100755
index 5668767..0000000
--- a/src/cobalt/media/tools/layout_tests/layouttest_analyzer.py
+++ /dev/null
@@ -1,479 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-"""Main functions for the Layout Test Analyzer module."""
-
-from datetime import datetime
-import optparse
-import os
-import sys
-import time
-
-import layouttest_analyzer_helpers
-from layouttest_analyzer_helpers import DEFAULT_REVISION_VIEW_URL
-import layouttests
-from layouttests import DEFAULT_LAYOUTTEST_SVN_VIEW_LOCATION
-
-from test_expectations import TestExpectations
-from trend_graph import TrendGraph
-
-# Predefined result directory.
-DEFAULT_RESULT_DIR = 'result'
-# TODO(shadi): Remove graph functions as they are not used any more.
-DEFAULT_GRAPH_FILE = os.path.join('graph', 'graph.html')
-# TODO(shadi): Check if these files are needed any more.
-DEFAULT_STATS_CSV_FILENAME = 'stats.csv'
-DEFAULT_ISSUES_CSV_FILENAME = 'issues.csv'
-# TODO(shadi): These are used only for |debug| mode. What is debug mode for?
-#              AFAIK, we don't run debug mode, should be safe to remove.
-# Predefined result files for debug.
-CUR_TIME_FOR_DEBUG = '2011-09-11-19'
-CURRENT_RESULT_FILE_FOR_DEBUG = os.path.join(DEFAULT_RESULT_DIR,
-                                             CUR_TIME_FOR_DEBUG)
-PREV_TIME_FOR_DEBUG = '2011-09-11-18'
-
-# Text to append at the end of every analyzer result email.
-DEFAULT_EMAIL_APPEND_TEXT = (
-    '<b><a href="https://groups.google.com/a/google.com/group/'
-    'layout-test-analyzer-result/topics">Email History</a></b><br>'
-  )
-
-
-def ParseOption():
-  """Parse command-line options using OptionParser.
-
-  Returns:
-      an object containing all command-line option information.
-  """
-  option_parser = optparse.OptionParser()
-
-  option_parser.add_option('-r', '--receiver-email-address',
-                           dest='receiver_email_address',
-                           help=('receiver\'s email address. '
-                                 'Result email is not sent if this is not '
-                                 'specified.'))
-  option_parser.add_option('-g', '--debug-mode', dest='debug',
-                           help=('Debug mode is used when you want to debug '
-                                 'the analyzer by using local file rather '
-                                 'than getting data from SVN. This shortens '
-                                 'the debugging time (off by default).'),
-                           action='store_true', default=False)
-  option_parser.add_option('-t', '--trend-graph-location',
-                           dest='trend_graph_location',
-                           help=('Location of the bug trend file; '
-                                 'file is expected to be in Google '
-                                 'Visualization API trend-line format '
-                                 '(defaults to %default).'),
-                           default=DEFAULT_GRAPH_FILE)
-  option_parser.add_option('-n', '--test-group-file-location',
-                           dest='test_group_file_location',
-                           help=('Location of the test group file; '
-                                 'file is expected to be in CSV format '
-                                 'and lists all test name patterns. '
-                                 'When this option is not specified, '
-                                 'the value of --test-group-name is used '
-                                 'for a test name pattern.'),
-                           default=None)
-  option_parser.add_option('-x', '--test-group-name',
-                           dest='test_group_name',
-                           help=('A name of test group. Either '
-                                 '--test_group_file_location or this option '
-                                 'needs to be specified.'))
-  option_parser.add_option('-d', '--result-directory-location',
-                           dest='result_directory_location',
-                           help=('Name of result directory location '
-                                 '(default to %default).'),
-                           default=DEFAULT_RESULT_DIR)
-  option_parser.add_option('-b', '--email-appended-text-file-location',
-                           dest='email_appended_text_file_location',
-                           help=('File location of the email appended text. '
-                                 'The text is appended in the status email. '
-                                 '(default to %default and no text is '
-                                 'appended in that case).'),
-                           default=None)
-  option_parser.add_option('-c', '--email-only-change-mode',
-                           dest='email_only_change_mode',
-                           help=('With this mode, email is sent out '
-                                 'only when there is a change in the '
-                                 'analyzer result compared to the previous '
-                                 'result (off by default)'),
-                           action='store_true', default=False)
-  option_parser.add_option('-q', '--dashboard-file-location',
-                           dest='dashboard_file_location',
-                           help=('Location of dashboard file. The results are '
-                                 'not reported to the dashboard if this '
-                                 'option is not specified.'))
-  option_parser.add_option('-z', '--issue-detail-mode',
-                           dest='issue_detail_mode',
-                           help=('With this mode, email includes issue details '
-                                 '(links to the flakiness dashboard)'
-                                 ' (off by default)'),
-                           action='store_true', default=False)
-  return option_parser.parse_args()[0]
-
-
-def GetCurrentAndPreviousResults(debug, test_group_file_location,
-                                 test_group_name, result_directory_location):
-  """Get current and the latest previous analyzer results.
-
-  In debug mode, they are read from predefined files. In non-debug mode,
-  current analyzer results are dynamically obtained from Blink SVN and
-  the latest previous result is read from the corresponding file.
-
-  Args:
-    debug: please refer to |options|.
-    test_group_file_location: please refer to |options|.
-    test_group_name: please refer to |options|.
-    result_directory_location: please refer to |options|.
-
-  Returns:
-    a tuple of the following:
-       prev_time: the previous time string that is compared against.
-       prev_analyzer_result_map: previous analyzer result map. Please refer to
-          layouttest_analyzer_helpers.AnalyzerResultMap.
-       analyzer_result_map: current analyzer result map. Please refer to
-          layouttest_analyzer_helpers.AnalyzerResultMap.
-  """
-  if not debug:
-    if not test_group_file_location and not test_group_name:
-      print ('Either --test-group-name or --test_group_file_location must be '
-             'specified. Exiting this program.')
-      sys.exit()
-    filter_names = []
-    if test_group_file_location and os.path.exists(test_group_file_location):
-      filter_names = layouttests.LayoutTests.GetLayoutTestNamesFromCSV(
-          test_group_file_location)
-      parent_location_list = (
-          layouttests.LayoutTests.GetParentDirectoryList(filter_names))
-      recursion = True
-    else:
-      # When test group CSV file is not specified, test group name
-      # (e.g., 'media') is used for getting layout tests.
-      # The tests are in
-      #     http://src.chromium.org/blink/trunk/LayoutTests/media
-      # Filtering is not set so all HTML files are considered as valid tests.
-      # Also, we look for the tests recursively.
-      if not test_group_file_location or (
-          not os.path.exists(test_group_file_location)):
-        print ('Warning: CSV file (%s) does not exist. So it is ignored and '
-               '%s is used for obtaining test names') % (
-                   test_group_file_location, test_group_name)
-      if not test_group_name.endswith('/'):
-        test_group_name += '/'
-      parent_location_list = [test_group_name]
-      filter_names = None
-      recursion = True
-    layouttests_object = layouttests.LayoutTests(
-        parent_location_list=parent_location_list, recursion=recursion,
-        filter_names=filter_names)
-    analyzer_result_map = layouttest_analyzer_helpers.AnalyzerResultMap(
-        layouttests_object.JoinWithTestExpectation(TestExpectations()))
-    result = layouttest_analyzer_helpers.FindLatestResult(
-        result_directory_location)
-    if result:
-      (prev_time, prev_analyzer_result_map) = result
-    else:
-      prev_time = None
-      prev_analyzer_result_map = None
-  else:
-    analyzer_result_map = layouttest_analyzer_helpers.AnalyzerResultMap.Load(
-        CURRENT_RESULT_FILE_FOR_DEBUG)
-    prev_time = PREV_TIME_FOR_DEBUG
-    prev_analyzer_result_map = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(
-            os.path.join(DEFAULT_RESULT_DIR, prev_time)))
-  return (prev_time, prev_analyzer_result_map, analyzer_result_map)
-
-
-def SendEmail(prev_time, prev_analyzer_result_map, analyzer_result_map,
-              appended_text_to_email, email_only_change_mode, debug,
-              receiver_email_address, test_group_name, issue_detail_mode):
-  """Send result status email.
-
-  Args:
-    prev_time: the previous time string that is compared against.
-    prev_analyzer_result_map: previous analyzer result map. Please refer to
-        layouttest_analyzer_helpers.AnalyzerResultMap.
-    analyzer_result_map: current analyzer result map. Please refer to
-        layouttest_analyzer_helpers.AnalyzerResultMap.
-    appended_text_to_email: the text string to append to the status email.
-    email_only_change_mode: please refer to |options|.
-    debug: please refer to |options|.
-    receiver_email_address: please refer to |options|.
-    test_group_name: please refer to |options|.
-    issue_detail_mode: please refer to |options|.
-
-  Returns:
-    a tuple of the following:
-        result_change: a boolean indicating whether there is a change in the
-            result compared with the latest past result.
-        diff_map: please refer to
-            layouttest_analyzer_helpers.SendStatusEmail().
-        simple_rev_str: a simple version of revision string that is sent in
-            the email.
-        rev: the latest revision number for the given test group.
-        rev_date: the latest revision date for the given test group.
-        email_content:  email content string (without
-            |appended_text_to_email|) that will be shown on the dashboard.
-  """
-  rev = ''
-  rev_date = ''
-  email_content = ''
-  if prev_analyzer_result_map:
-    diff_map = analyzer_result_map.CompareToOtherResultMap(
-        prev_analyzer_result_map)
-    result_change = (any(diff_map['whole']) or any(diff_map['skip']) or
-                     any(diff_map['nonskip']))
-    # Email only when |email_only_change_mode| is False or there
-    # is a change in the result compared to the last result.
-    simple_rev_str = ''
-    if not email_only_change_mode or result_change:
-      prev_time_in_float = datetime.strptime(prev_time, '%Y-%m-%d-%H')
-      prev_time_in_float = time.mktime(prev_time_in_float.timetuple())
-      if debug:
-        cur_time_in_float = datetime.strptime(CUR_TIME_FOR_DEBUG,
-                                              '%Y-%m-%d-%H')
-        cur_time_in_float = time.mktime(cur_time_in_float.timetuple())
-      else:
-        cur_time_in_float = time.time()
-      (rev_str, simple_rev_str, rev, rev_date) = (
-          layouttest_analyzer_helpers.GetRevisionString(prev_time_in_float,
-                                                        cur_time_in_float,
-                                                        diff_map))
-      email_content = analyzer_result_map.ConvertToString(prev_time,
-                                                          diff_map,
-                                                          issue_detail_mode)
-      if receiver_email_address:
-        layouttest_analyzer_helpers.SendStatusEmail(
-            prev_time, analyzer_result_map, diff_map,
-            receiver_email_address, test_group_name,
-            appended_text_to_email, email_content, rev_str,
-            email_only_change_mode)
-    if simple_rev_str:
-      simple_rev_str = '\'' + simple_rev_str + '\''
-    else:
-      simple_rev_str = 'undefined'  # GViz uses undefined for NONE.
-  else:
-    # Initial result should be written to tread-graph if there are no previous
-    # results.
-    result_change = True
-    diff_map = None
-    simple_rev_str = 'undefined'
-    email_content = analyzer_result_map.ConvertToString(None, diff_map,
-                                                        issue_detail_mode)
-  return (result_change, diff_map, simple_rev_str, rev, rev_date,
-          email_content)
-
-
-def UpdateTrendGraph(start_time, analyzer_result_map, diff_map, simple_rev_str,
-                     trend_graph_location):
-  """Update trend graph in GViz.
-
-  Annotate the graph with revision information.
-
-  Args:
-    start_time: the script starting time as a float value.
-    analyzer_result_map: current analyzer result map. Please refer to
-        layouttest_analyzer_helpers.AnalyzerResultMap.
-    diff_map: a map that has 'whole', 'skip' and 'nonskip' as keys.
-        Please refer to |diff_map| in
-        |layouttest_analyzer_helpers.SendStatusEmail()|.
-    simple_rev_str: a simple version of revision string that is sent in
-        the email.
-    trend_graph_location: the location of the trend graph that needs to be
-        updated.
-
-  Returns:
-     a dictionary that maps result data category ('whole', 'skip', 'nonskip',
-         'passingrate') to information tuple (a dictionary that maps test name
-         to its description, annotation, simple_rev_string) of the given result
-         data category. These tuples are used for trend graph update.
-  """
-  # Trend graph update (if specified in the command-line argument) when
-  # there is change from the last result.
-  # Currently, there are two graphs (graph1 is for 'whole', 'skip',
-  # 'nonskip' and the graph2 is for 'passingrate'). Please refer to
-  # graph/graph.html.
-  # Sample JS annotation for graph1:
-  #   [new Date(2011,8,12,10,41,32),224,undefined,'',52,undefined,
-  #    undefined, 12, 'test1,','<a href="http://t</a>,',],
-  # This example lists 'whole' triple and 'skip' triple and
-  # 'nonskip' triple. Each triple is (the number of tests that belong to
-  # the test group, linked text, a link). The following code generates this
-  # automatically based on rev_string etc.
-  trend_graph = TrendGraph(trend_graph_location)
-  datetime_string = start_time.strftime('%Y,%m,%d,%H,%M,%S')
-  data_map = {}
-  passingrate_anno = ''
-  for test_group in ['whole', 'skip', 'nonskip']:
-    anno = 'undefined'
-    # Extract test description.
-    test_map = {}
-    for (test_name, value) in (
-        analyzer_result_map.result_map[test_group].iteritems()):
-      test_map[test_name] = value['desc']
-    test_str = ''
-    links = ''
-    if diff_map and diff_map[test_group]:
-      for i in [0, 1]:
-        for (name, _) in diff_map[test_group][i]:
-          test_str += name + ','
-          # This is link to test HTML in SVN.
-          links += ('<a href="%s%s">%s</a>' %
-                    (DEFAULT_LAYOUTTEST_SVN_VIEW_LOCATION, name, name))
-      if test_str:
-        anno = '\'' + test_str + '\''
-        # The annotation of passing rate is a union of all annotations.
-        passingrate_anno += anno
-    if links:
-      links = '\'' + links + '\''
-    else:
-      links = 'undefined'
-    if test_group is 'whole':
-      data_map[test_group] = (test_map, anno, links)
-    else:
-      data_map[test_group] = (test_map, anno, simple_rev_str)
-  if not passingrate_anno:
-    passingrate_anno = 'undefined'
-  data_map['passingrate'] = (
-      str(analyzer_result_map.GetPassingRate()), passingrate_anno,
-      simple_rev_str)
-  trend_graph.Update(datetime_string, data_map)
-  return data_map
-
-
-def UpdateDashboard(dashboard_file_location, test_group_name, data_map,
-                    layouttest_root_path, rev, rev_date, email,
-                    email_content):
-  """Update dashboard HTML file.
-
-  Args:
-    dashboard_file_location: the file location for the dashboard file.
-    test_group_name: please refer to |options|.
-    data_map: a dictionary that maps result data category ('whole', 'skip',
-        'nonskip', 'passingrate') to information tuple (a dictionary that maps
-        test name to its description, annotation, simple_rev_string) of the
-        given result data category. These tuples are used for trend graph
-        update.
-    layouttest_root_path: A location string where layout tests are stored.
-    rev: the latest revision number for the given test group.
-    rev_date: the latest revision date for the given test group.
-    email: email address of the owner for the given test group.
-    email_content:  email content string (without |appended_text_to_email|)
-        that will be shown on the dashboard.
-  """
-  # Generate a HTML file that contains all test names for each test group.
-  escaped_tg_name = test_group_name.replace('/', '_')
-  for tg in ['whole', 'skip', 'nonskip']:
-    file_name = os.path.join(
-        os.path.dirname(dashboard_file_location),
-        escaped_tg_name + '_' + tg + '.html')
-    file_object = open(file_name, 'wb')
-    file_object.write('<table border="1">')
-    sorted_testnames = data_map[tg][0].keys()
-    sorted_testnames.sort()
-    for testname in sorted_testnames:
-      file_object.write((
-          '<tr><td><a href="%s">%s</a></td><td><a href="%s">dashboard</a>'
-          '</td><td>%s</td></tr>') % (
-              layouttest_root_path + testname, testname,
-              ('http://test-results.appspot.com/dashboards/'
-               'flakiness_dashboard.html#tests=%s') % testname,
-              data_map[tg][0][testname]))
-    file_object.write('</table>')
-    file_object.close()
-  email_content_with_link = ''
-  if email_content:
-    file_name = os.path.join(os.path.dirname(dashboard_file_location),
-                             escaped_tg_name + '_email.html')
-    file_object = open(file_name, 'wb')
-    file_object.write(email_content)
-    file_object.close()
-    email_content_with_link = '<a href="%s_email.html">info</a>' % (
-        escaped_tg_name)
-  test_group_str = (
-      '<td><a href="%(test_group_path)s">%(test_group_name)s</a></td>'
-      '<td><a href="%(graph_path)s">graph</a></td>'
-      '<td><a href="%(all_tests_path)s">%(all_tests_count)d</a></td>'
-      '<td><a href="%(skip_tests_path)s">%(skip_tests_count)d</a></td>'
-      '<td><a href="%(nonskip_tests_path)s">%(nonskip_tests_count)d</a></td>'
-      '<td>%(fail_rate)d%%</td>'
-      '<td>%(passing_rate)d%%</td>'
-      '<td><a href="%(rev_url)s">%(rev)s</a></td>'
-      '<td>%(rev_date)s</td>'
-      '<td><a href="mailto:%(email)s">%(email)s</a></td>'
-      '<td>%(email_content)s</td>\n') % {
-          # Dashboard file and graph must be in the same directory
-          # to make the following link work.
-          'test_group_path': layouttest_root_path + '/' + test_group_name,
-          'test_group_name': test_group_name,
-          'graph_path': escaped_tg_name + '.html',
-          'all_tests_path': escaped_tg_name + '_whole.html',
-          'all_tests_count': len(data_map['whole'][0]),
-          'skip_tests_path': escaped_tg_name + '_skip.html',
-          'skip_tests_count': len(data_map['skip'][0]),
-          'nonskip_tests_path': escaped_tg_name + '_nonskip.html',
-          'nonskip_tests_count': len(data_map['nonskip'][0]),
-          'fail_rate': 100 - float(data_map['passingrate'][0]),
-          'passing_rate': float(data_map['passingrate'][0]),
-          'rev_url': DEFAULT_REVISION_VIEW_URL % rev,
-          'rev': rev,
-          'rev_date': rev_date,
-          'email': email,
-          'email_content': email_content_with_link
-      }
-  layouttest_analyzer_helpers.ReplaceLineInFile(
-      dashboard_file_location, '<td>' + test_group_name + '</td>',
-      test_group_str)
-
-
-def main():
-  """A main function for the analyzer."""
-  options = ParseOption()
-  start_time = datetime.now()
-
-  (prev_time, prev_analyzer_result_map, analyzer_result_map) = (
-      GetCurrentAndPreviousResults(options.debug,
-                                   options.test_group_file_location,
-                                   options.test_group_name,
-                                   options.result_directory_location))
-  (result_change, diff_map, simple_rev_str, rev, rev_date, email_content) = (
-      SendEmail(prev_time, prev_analyzer_result_map, analyzer_result_map,
-                DEFAULT_EMAIL_APPEND_TEXT,
-                options.email_only_change_mode, options.debug,
-                options.receiver_email_address, options.test_group_name,
-                options.issue_detail_mode))
-
-  # Create CSV texts and save them for bug spreadsheet.
-  (stats, issues_txt) = analyzer_result_map.ConvertToCSVText(
-      start_time.strftime('%Y-%m-%d-%H'))
-  file_object = open(os.path.join(options.result_directory_location,
-                                  DEFAULT_STATS_CSV_FILENAME), 'wb')
-  file_object.write(stats)
-  file_object.close()
-  file_object = open(os.path.join(options.result_directory_location,
-                                  DEFAULT_ISSUES_CSV_FILENAME), 'wb')
-  file_object.write(issues_txt)
-  file_object.close()
-
-  if not options.debug and (result_change or not prev_analyzer_result_map):
-    # Save the current result when result is changed or the script is
-    # executed for the first time.
-    date = start_time.strftime('%Y-%m-%d-%H')
-    file_path = os.path.join(options.result_directory_location, date)
-    analyzer_result_map.Save(file_path)
-  if result_change or not prev_analyzer_result_map:
-    data_map = UpdateTrendGraph(start_time, analyzer_result_map, diff_map,
-                                simple_rev_str, options.trend_graph_location)
-    # Report the result to dashboard.
-    if options.dashboard_file_location:
-      UpdateDashboard(options.dashboard_file_location, options.test_group_name,
-                      data_map, layouttests.DEFAULT_LAYOUTTEST_LOCATION, rev,
-                      rev_date, options.receiver_email_address,
-                      email_content)
-
-
-if '__main__' == __name__:
-  main()
diff --git a/src/cobalt/media/tools/layout_tests/layouttest_analyzer_helpers.py b/src/cobalt/media/tools/layout_tests/layouttest_analyzer_helpers.py
deleted file mode 100644
index e5791bc..0000000
--- a/src/cobalt/media/tools/layout_tests/layouttest_analyzer_helpers.py
+++ /dev/null
@@ -1,596 +0,0 @@
-# Copyright (c) 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.
-
-"""Helper functions for the layout test analyzer."""
-
-from datetime import datetime
-from email.mime.multipart import MIMEMultipart
-from email.mime.text import MIMEText
-import fileinput
-import os
-import pickle
-import re
-import smtplib
-import socket
-import sys
-import time
-
-from bug import Bug
-from test_expectations_history import TestExpectationsHistory
-
-DEFAULT_TEST_EXPECTATION_PATH = ('trunk/LayoutTests/TestExpectations')
-LEGACY_DEFAULT_TEST_EXPECTATION_PATH = (
-    'trunk/LayoutTests/platform/chromium/test_expectations.txt')
-REVISION_LOG_URL = ('http://build.chromium.org/f/chromium/perf/dashboard/ui/'
-    'changelog_blink.html?url=/trunk/LayoutTests/%s&range=%d:%d')
-DEFAULT_REVISION_VIEW_URL = 'http://src.chromium.org/viewvc/blink?revision=%s'
-
-
-class AnalyzerResultMap:
-  """A class to deal with joined result produed by the analyzer.
-
-  The join is done between layouttests and the test_expectations object
-  (based on the test expectation file). The instance variable |result_map|
-  contains the following keys: 'whole','skip','nonskip'. The value of 'whole'
-  contains information about all layouttests. The value of 'skip' contains
-  information about skipped layouttests where it has 'SKIP' in its entry in
-  the test expectation file. The value of 'nonskip' contains all information
-  about non skipped layout tests, which are in the test expectation file but
-  not skipped. The information is exactly same as the one parsed by the
-  analyzer.
-  """
-
-  def __init__(self, test_info_map):
-    """Initialize the AnalyzerResultMap based on test_info_map.
-
-    Test_info_map contains all layouttest information. The job here is to
-    classify them as 'whole', 'skip' or 'nonskip' based on that information.
-
-    Args:
-      test_info_map: the result map of |layouttests.JoinWithTestExpectation|.
-          The key of the map is test name such as 'media/media-foo.html'.
-          The value of the map is a map that contains the following keys:
-          'desc'(description), 'te_info' (test expectation information),
-          which is a list of test expectation information map. The key of the
-          test expectation information map is test expectation keywords such
-          as "SKIP" and other keywords (for full list of keywords, please
-          refer to |test_expectations.ALL_TE_KEYWORDS|).
-    """
-    self.result_map = {}
-    self.result_map['whole'] = {}
-    self.result_map['skip'] = {}
-    self.result_map['nonskip'] = {}
-    if test_info_map:
-      for (k, value) in test_info_map.iteritems():
-        self.result_map['whole'][k] = value
-        if 'te_info' in value:
-          # Don't count SLOW PASS, WONTFIX, or ANDROID tests as failures.
-          if any([True for x in value['te_info'] if set(x.keys()) ==
-                  set(['SLOW', 'PASS', 'Bugs', 'Comments', 'Platforms']) or
-                  'WONTFIX' in x or x['Platforms'] == ['ANDROID']]):
-            continue
-          if any([True for x in value['te_info'] if 'SKIP' in x]):
-            self.result_map['skip'][k] = value
-          else:
-            self.result_map['nonskip'][k] = value
-
-  @staticmethod
-  def GetDiffString(diff_map_element, type_str):
-    """Get difference string out of diff map element.
-
-    The difference string shows difference between two analyzer results
-    (for example, a result for now and a result for sometime in the past)
-    in HTML format (with colors). This is used for generating email messages.
-
-    Args:
-      diff_map_element: An element of the compared map generated by
-          |CompareResultMaps()|. The element has two lists of test cases. One
-          is for test names that are in the current result but NOT in the
-          previous result. The other is for test names that are in the previous
-          results but NOT in the current result. Please refer to comments in
-          |CompareResultMaps()| for details.
-      type_str: a string indicating the test group to which |diff_map_element|
-          belongs; used for color determination.  Must be 'whole', 'skip', or
-          'nonskip'.
-
-    Returns:
-      a string in HTML format (with colors) to show difference between two
-          analyzer results.
-    """
-    if not diff_map_element[0] and not diff_map_element[1]:
-      return 'No Change'
-    color = ''
-    diff = len(diff_map_element[0]) - len(diff_map_element[1])
-    if diff > 0 and type_str != 'whole':
-      color = 'red'
-    else:
-      color = 'green'
-    diff_sign = ''
-    if diff > 0:
-      diff_sign = '+'
-    if not diff:
-      whole_str = 'No Change'
-    else:
-      whole_str = '<font color="%s">%s%d</font>' % (color, diff_sign, diff)
-    colors = ['red', 'green']
-    if type_str == 'whole':
-      # Bug 107773 - when we increase the number of tests,
-      # the name of the tests are in red, it should be green
-      # since it is good thing.
-      colors = ['green', 'red']
-    str1 = ''
-    for (name, _) in diff_map_element[0]:
-      str1 += '<font color="%s">%s,</font>' % (colors[0], name)
-    str2 = ''
-    for (name, _) in diff_map_element[1]:
-      str2 += '<font color="%s">%s,</font>' % (colors[1], name)
-    if str1 or str2:
-      whole_str += ':'
-    if str1:
-      whole_str += str1
-    if str2:
-      whole_str += str2
-    # Remove the last occurrence of ','.
-    whole_str = ''.join(whole_str.rsplit(',', 1))
-    return whole_str
-
-  def GetPassingRate(self):
-    """Get passing rate.
-
-    Returns:
-      layout test passing rate of this result in percent.
-
-    Raises:
-      ValueEror when the number of tests in test group "whole" is equal
-          or less than that of "skip".
-    """
-    delta = len(self.result_map['whole'].keys()) - (
-        len(self.result_map['skip'].keys()))
-    if delta <= 0:
-      raise ValueError('The number of tests in test group "whole" is equal or '
-                       'less than that of "skip"')
-    return 100 - len(self.result_map['nonskip'].keys()) * 100.0 / delta
-
-  def ConvertToCSVText(self, current_time):
-    """Convert |self.result_map| into stats and issues text in CSV format.
-
-    Both are used as inputs for Google spreadsheet.
-
-    Args:
-      current_time: a string depicting a time in year-month-day-hour
-        format (e.g., 2011-11-08-16).
-
-    Returns:
-      a tuple of stats and issues_txt
-      stats: analyzer result in CSV format that shows:
-          (current_time, the number of tests, the number of skipped tests,
-           the number of failing tests, passing rate)
-          For example,
-            "2011-11-10-15,204,22,12,94"
-       issues_txt: issues listed in CSV format that shows:
-          (BUGWK or BUGCR, bug number, the test expectation entry,
-           the name of the test)
-          For example,
-            "BUGWK,71543,TIMEOUT PASS,media/media-element-play-after-eos.html,
-             BUGCR,97657,IMAGE CPU MAC TIMEOUT PASS,media/audio-repaint.html,"
-    """
-    stats = ','.join([current_time, str(len(self.result_map['whole'].keys())),
-                      str(len(self.result_map['skip'].keys())),
-                      str(len(self.result_map['nonskip'].keys())),
-                      str(self.GetPassingRate())])
-    issues_txt = ''
-    for bug_txt, test_info_list in (
-        self.GetListOfBugsForNonSkippedTests().iteritems()):
-      matches = re.match(r'(BUG(CR|WK))(\d+)', bug_txt)
-      bug_suffix = ''
-      bug_no = ''
-      if matches:
-        bug_suffix = matches.group(1)
-        bug_no = matches.group(3)
-      issues_txt += bug_suffix + ',' + bug_no + ','
-      for test_info in test_info_list:
-        test_name, te_info = test_info
-        issues_txt += ' '.join(te_info.keys()) + ',' + test_name + ','
-      issues_txt += '\n'
-    return stats, issues_txt
-
-  def ConvertToString(self, prev_time, diff_map, issue_detail_mode):
-    """Convert this result to HTML display for email.
-
-    Args:
-      prev_time: the previous time string that are compared against.
-      diff_map: the compared map generated by |CompareResultMaps()|.
-      issue_detail_mode: includes the issue details in the output string if
-          this is True.
-
-    Returns:
-      a analyzer result string in HTML format.
-    """
-    return_str = ''
-    if diff_map:
-      return_str += (
-          '<b>Statistics (Diff Compared to %s):</b><ul>'
-          '<li>The number of tests: %d (%s)</li>'
-          '<li>The number of failing skipped tests: %d (%s)</li>'
-          '<li>The number of failing non-skipped tests: %d (%s)</li>'
-          '<li>Passing rate: %.2f %%</li></ul>') % (
-              prev_time, len(self.result_map['whole'].keys()),
-              AnalyzerResultMap.GetDiffString(diff_map['whole'], 'whole'),
-              len(self.result_map['skip'].keys()),
-              AnalyzerResultMap.GetDiffString(diff_map['skip'], 'skip'),
-              len(self.result_map['nonskip'].keys()),
-              AnalyzerResultMap.GetDiffString(diff_map['nonskip'], 'nonskip'),
-              self.GetPassingRate())
-    if issue_detail_mode:
-      return_str += '<b>Current issues about failing non-skipped tests:</b>'
-      for (bug_txt, test_info_list) in (
-          self.GetListOfBugsForNonSkippedTests().iteritems()):
-        return_str += '<ul>%s' % Bug(bug_txt)
-        for test_info in test_info_list:
-          (test_name, te_info) = test_info
-          gpu_link = ''
-          if 'GPU' in te_info:
-            gpu_link = 'group=%40ToT%20GPU%20Mesa%20-%20chromium.org&'
-          dashboard_link = ('http://test-results.appspot.com/dashboards/'
-                            'flakiness_dashboard.html#%stests=%s') % (
-                                gpu_link, test_name)
-          return_str += '<li><a href="%s">%s</a> (%s) </li>' % (
-              dashboard_link, test_name, ' '.join(
-                  [key for key in te_info.keys() if key != 'Platforms']))
-        return_str += '</ul>\n'
-    return return_str
-
-  def CompareToOtherResultMap(self, other_result_map):
-    """Compare this result map with the other to see if there are any diff.
-
-    The comparison is done for layouttests which belong to 'whole', 'skip',
-    or 'nonskip'.
-
-    Args:
-      other_result_map: another result map to be compared against the result
-          map of the current object.
-
-    Returns:
-      a map that has 'whole', 'skip' and 'nonskip' as keys.
-          Please refer to |diff_map| in |SendStatusEmail()|.
-    """
-    comp_result_map = {}
-    for name in ['whole', 'skip', 'nonskip']:
-      if name == 'nonskip':
-        # Look into expectation to get diff only for non-skipped tests.
-        lookIntoTestExpectationInfo = True
-      else:
-        #  Otherwise, only test names are compared to get diff.
-        lookIntoTestExpectationInfo = False
-      comp_result_map[name] = GetDiffBetweenMaps(
-          self.result_map[name], other_result_map.result_map[name],
-          lookIntoTestExpectationInfo)
-    return comp_result_map
-
-  @staticmethod
-  def Load(file_path):
-    """Load the object from |file_path| using pickle library.
-
-    Args:
-      file_path: the string path to the file from which to read the result.
-
-    Returns:
-       a AnalyzerResultMap object read from |file_path|.
-    """
-    file_object = open(file_path)
-    analyzer_result_map = pickle.load(file_object)
-    file_object.close()
-    return analyzer_result_map
-
-  def Save(self, file_path):
-    """Save the object to |file_path| using pickle library.
-
-    Args:
-       file_path: the string path to the file in which to store the result.
-    """
-    file_object = open(file_path, 'wb')
-    pickle.dump(self, file_object)
-    file_object.close()
-
-  def GetListOfBugsForNonSkippedTests(self):
-    """Get a list of bugs for non-skipped layout tests.
-
-    This is used for generating email content.
-
-    Returns:
-        a mapping from bug modifier text (e.g., BUGCR1111) to a test name and
-            main test information string which excludes comments and bugs.
-            This is used for grouping test names by bug.
-    """
-    bug_map = {}
-    for (name, value) in self.result_map['nonskip'].iteritems():
-      for te_info in value['te_info']:
-        main_te_info = {}
-        for k in te_info.keys():
-          if k != 'Comments' and k != 'Bugs':
-            main_te_info[k] = True
-        if 'Bugs' in te_info:
-          for bug in te_info['Bugs']:
-            if bug not in bug_map:
-              bug_map[bug] = []
-            bug_map[bug].append((name, main_te_info))
-    return bug_map
-
-
-def SendStatusEmail(prev_time, analyzer_result_map, diff_map,
-                    receiver_email_address, test_group_name,
-                    appended_text_to_email, email_content, rev_str,
-                    email_only_change_mode):
-  """Send status email.
-
-  Args:
-    prev_time: the date string such as '2011-10-09-11'. This format has been
-        used in this analyzer.
-    analyzer_result_map: current analyzer result.
-    diff_map: a map that has 'whole', 'skip' and 'nonskip' as keys.
-        The values of the map are the result of |GetDiffBetweenMaps()|.
-        The element has two lists of test cases. One (with index 0) is for
-        test names that are in the current result but NOT in the previous
-        result. The other (with index 1) is for test names that are in the
-        previous results but NOT in the current result.
-         For example (test expectation information is omitted for
-         simplicity),
-           comp_result_map['whole'][0] = ['foo1.html']
-           comp_result_map['whole'][1] = ['foo2.html']
-         This means that current result has 'foo1.html' but it is NOT in the
-         previous result. This also means the previous result has 'foo2.html'
-         but it is NOT in the current result.
-    receiver_email_address: receiver's email address.
-    test_group_name: string representing the test group name (e.g., 'media').
-    appended_text_to_email: a text which is appended at the end of the status
-        email.
-    email_content: an email content string that will be shown on the dashboard.
-    rev_str: a revision string that contains revision information that is sent
-        out in the status email. It is obtained by calling
-        |GetRevisionString()|.
-    email_only_change_mode: send email only when there is a change if this is
-        True. Otherwise, always send email after each run.
-  """
-  if rev_str:
-    email_content += '<br><b>Revision Information:</b>'
-    email_content += rev_str
-  localtime = time.asctime(time.localtime(time.time()))
-  change_str = ''
-  if email_only_change_mode:
-    change_str = 'Status Change '
-  subject = 'Layout Test Analyzer Result %s(%s): %s' % (change_str,
-                                                        test_group_name,
-                                                        localtime)
-  SendEmail('no-reply@chromium.org', [receiver_email_address],
-            subject, email_content + appended_text_to_email)
-
-
-def GetRevisionString(prev_time, current_time, diff_map):
-  """Get a string for revision information during the specified time period.
-
-  Args:
-    prev_time: the previous time as a floating point number expressed
-        in seconds since the epoch, in UTC.
-    current_time: the current time as a floating point number expressed
-        in seconds since the epoch, in UTC. It is typically obtained by
-        time.time() function.
-    diff_map: a map that has 'whole', 'skip' and 'nonskip' as keys.
-        Please refer to |diff_map| in |SendStatusEmail()|.
-
-  Returns:
-    a tuple of strings:
-        1) full string containing links, author, date, and line for each
-           change in the test expectation file.
-        2) shorter string containing only links to the change.  Used for
-           trend graph annotations.
-        3) last revision number for the given test group.
-        4) last revision date for the given test group.
-  """
-  if not diff_map:
-    return ('', '', '', '')
-  testname_map = {}
-  for test_group in ['skip', 'nonskip']:
-    for i in range(2):
-      for (k, _) in diff_map[test_group][i]:
-        testname_map[k] = True
-  rev_infos = TestExpectationsHistory.GetDiffBetweenTimes(prev_time,
-                                                          current_time,
-                                                          testname_map.keys())
-  rev_str = ''
-  simple_rev_str = ''
-  rev = ''
-  rev_date = ''
-  if rev_infos:
-    # Get latest revision number and date.
-    rev = rev_infos[-1][1]
-    rev_date = rev_infos[-1][3]
-    for rev_info in rev_infos:
-      (old_rev, new_rev, author, date, _, target_lines) = rev_info
-
-      # test_expectations.txt was renamed to TestExpectations at r119317.
-      new_path = DEFAULT_TEST_EXPECTATION_PATH
-      if new_rev < 119317:
-        new_path = LEGACY_DEFAULT_TEST_EXPECTATION_PATH
-      old_path = DEFAULT_TEST_EXPECTATION_PATH
-      if old_rev < 119317:
-        old_path = LEGACY_DEFAULT_TEST_EXPECTATION_PATH
-
-      link = REVISION_LOG_URL % (new_path, old_rev, new_rev)
-      rev_str += '<ul><a href="%s">%s->%s</a>\n' % (link, old_rev, new_rev)
-      simple_rev_str = '<a href="%s">%s->%s</a>,' % (link, old_rev, new_rev)
-      rev_str += '<li>%s</li>\n' % author
-      rev_str += '<li>%s</li>\n<ul>' % date
-      for line in target_lines:
-        # Find *.html pattern (test name) and replace it with the link to
-        # flakiness dashboard.
-        test_name_pattern = r'(\S+.html)'
-        match = re.search(test_name_pattern, line)
-        if match:
-          test_name = match.group(1)
-          gpu_link = ''
-          if 'GPU' in line:
-            gpu_link = 'group=%40ToT%20GPU%20Mesa%20-%20chromium.org&'
-          dashboard_link = ('http://test-results.appspot.com/dashboards/'
-                            'flakiness_dashboard.html#%stests=%s') % (
-                                gpu_link, test_name)
-          line = line.replace(test_name, '<a href="%s">%s</a>' % (
-              dashboard_link, test_name))
-        # Find bug text and replace it with the link to the bug.
-        bug = Bug(line)
-        if bug.bug_txt:
-          line = '<li>%s</li>\n' % line.replace(bug.bug_txt, str(bug))
-        rev_str += line
-      rev_str += '</ul></ul>'
-  return (rev_str, simple_rev_str, rev, rev_date)
-
-
-def SendEmail(sender_email_address, receivers_email_addresses, subject,
-              message):
-  """Send email using localhost's mail server.
-
-  Args:
-    sender_email_address: sender's email address.
-    receivers_email_addresses: receiver's email addresses.
-    subject: subject string.
-    message: email message.
-  """
-  try:
-    html_top = """
-      <html>
-      <head></head>
-      <body>
-    """
-    html_bot = """
-      </body>
-      </html>
-    """
-    html = html_top + message + html_bot
-    msg = MIMEMultipart('alternative')
-    msg['Subject'] = subject
-    msg['From'] = sender_email_address
-    msg['To'] = receivers_email_addresses[0]
-    part1 = MIMEText(html, 'html')
-    smtp_obj = smtplib.SMTP('localhost')
-    msg.attach(part1)
-    smtp_obj.sendmail(sender_email_address, receivers_email_addresses,
-                      msg.as_string())
-    print 'Successfully sent email'
-  except smtplib.SMTPException, ex:
-    print 'Authentication failed:', ex
-    print 'Error: unable to send email'
-  except (socket.gaierror, socket.error, socket.herror), ex:
-    print ex
-    print 'Error: unable to send email'
-
-
-def FindLatestTime(time_list):
-  """Find latest time from |time_list|.
-
-  The current status is compared to the status of the latest file in
-  |RESULT_DIR|.
-
-  Args:
-    time_list: a list of time string in the form of 'Year-Month-Day-Hour'
-        (e.g., 2011-10-23-23). Strings not in this format are ignored.
-
-  Returns:
-     a string representing latest time among the time_list or None if
-         |time_list| is empty or no valid date string in |time_list|.
-  """
-  if not time_list:
-    return None
-  latest_date = None
-  for time_element in time_list:
-    try:
-      item_date = datetime.strptime(time_element, '%Y-%m-%d-%H')
-      if latest_date is None or latest_date < item_date:
-        latest_date = item_date
-    except ValueError:
-      # Do nothing.
-      pass
-  if latest_date:
-    return latest_date.strftime('%Y-%m-%d-%H')
-  else:
-    return None
-
-
-def ReplaceLineInFile(file_path, search_exp, replace_line):
-  """Replace line which has |search_exp| with |replace_line| within a file.
-
-  Args:
-      file_path: the file that is being replaced.
-      search_exp: search expression to find a line to be replaced.
-      replace_line: the new line.
-  """
-  for line in fileinput.input(file_path, inplace=1):
-    if search_exp in line:
-      line = replace_line
-    sys.stdout.write(line)
-
-
-def FindLatestResult(result_dir):
-  """Find the latest result in |result_dir| and read and return them.
-
-  This is used for comparison of analyzer result between current analyzer
-  and most known latest result.
-
-  Args:
-    result_dir: the result directory.
-
-  Returns:
-    A tuple of filename (latest_time) and the latest analyzer result.
-        Returns None if there is no file or no file that matches the file
-        patterns used ('%Y-%m-%d-%H').
-  """
-  dir_list = os.listdir(result_dir)
-  file_name = FindLatestTime(dir_list)
-  if not file_name:
-    return None
-  file_path = os.path.join(result_dir, file_name)
-  return (file_name, AnalyzerResultMap.Load(file_path))
-
-
-def GetDiffBetweenMaps(map1, map2, lookIntoTestExpectationInfo=False):
-  """Get difference between maps.
-
-  Args:
-    map1: analyzer result map to be compared.
-    map2: analyzer result map to be compared.
-    lookIntoTestExpectationInfo: a boolean to indicate whether to compare
-        test expectation information in addition to just the test case names.
-
-  Returns:
-    a tuple of |name1_list| and |name2_list|. |Name1_list| contains all test
-        name and the test expectation information in |map1| but not in |map2|.
-        |Name2_list| contains all test name and the test expectation
-        information in |map2| but not in |map1|.
-  """
-
-  def GetDiffBetweenMapsHelper(map1, map2, lookIntoTestExpectationInfo):
-    """A helper function for GetDiffBetweenMaps.
-
-    Args:
-      map1: analyzer result map to be compared.
-      map2: analyzer result map to be compared.
-      lookIntoTestExpectationInfo: a boolean to indicate whether to compare
-        test expectation information in addition to just the test case names.
-
-    Returns:
-      a list of tuples (name, te_info) that are in |map1| but not in |map2|.
-    """
-    name_list = []
-    for (name, value1) in map1.iteritems():
-      if name in map2:
-        if lookIntoTestExpectationInfo and 'te_info' in value1:
-          list1 = value1['te_info']
-          list2 = map2[name]['te_info']
-          te_diff = [item for item in list1 if not item in list2]
-          if te_diff:
-            name_list.append((name, te_diff))
-      else:
-        name_list.append((name, value1))
-    return name_list
-
-  return (GetDiffBetweenMapsHelper(map1, map2, lookIntoTestExpectationInfo),
-          GetDiffBetweenMapsHelper(map2, map1, lookIntoTestExpectationInfo))
diff --git a/src/cobalt/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py b/src/cobalt/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py
deleted file mode 100755
index ab14d87..0000000
--- a/src/cobalt/media/tools/layout_tests/layouttest_analyzer_helpers_unittest.py
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-import copy
-from datetime import datetime
-import os
-import pickle
-import time
-import unittest
-
-
-import layouttest_analyzer_helpers
-
-
-class TestLayoutTestAnalyzerHelpers(unittest.TestCase):
-
-  def testFindLatestTime(self):
-    time_list = ['2011-08-18-19', '2011-08-18-22', '2011-08-18-21',
-                 '2012-01-11-21', '.foo']
-    self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list),
-                      '2012-01-11-21')
-
-  def testFindLatestTimeWithEmptyList(self):
-    time_list = []
-    self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list),
-                      None)
-
-  def testFindLatestTimeWithNoValidStringInList(self):
-    time_list = ['.foo1', '232232']
-    self.assertEquals(layouttest_analyzer_helpers.FindLatestTime(time_list),
-                      None)
-
-  def GenerateTestDataWholeAndSkip(self):
-    """You should call this method if you want to generate test data."""
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-    # Remove this first part
-    m = analyzerResultMapBase.result_map['whole']
-    del m['media/video-source-type.html']
-    m = analyzerResultMapBase.result_map['skip']
-    del m['media/track/track-webvtt-tc004-magicheader.html']
-
-    file_path = os.path.join('test_data', 'less')
-    analyzerResultMapBase.Save(file_path)
-
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = AnalyzerResultMap.Load(file_path)
-
-    analyzerResultMapBase.result_map['whole']['add1.html'] = True
-    analyzerResultMapBase.result_map['skip']['add2.html'] = True
-
-    file_path = os.path.join('test_data', 'more')
-    analyzerResultMapBase.Save(file_path)
-
-  def GenerateTestDataNonSkip(self):
-    """You should call this method if you want to generate test data."""
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = AnalyzerResultMap.Load(file_path)
-    m = analyzerResultMapBase.result_map['nonskip']
-    ex = m['media/media-document-audio-repaint.html']
-    te_info_map1 = ex['te_info'][0]
-    te_info_map2 = copy.copy(te_info_map1)
-    te_info_map2['NEWADDED'] = True
-    ex['te_info'].append(te_info_map2)
-    m = analyzerResultMapBase.result_map['nonskip']
-
-    file_path = os.path.join('test_data', 'more_te_info')
-    analyzerResultMapBase.Save(file_path)
-
-  def testCompareResultMapsWholeAndSkip(self):
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-
-    file_path = os.path.join('test_data', 'less')
-    analyzerResultMapLess = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-
-    diff = analyzerResultMapBase.CompareToOtherResultMap(analyzerResultMapLess)
-    self.assertEquals(diff['skip'][0][0][0],
-                      'media/track/track-webvtt-tc004-magicheader.html')
-    self.assertEquals(diff['whole'][0][0][0],
-                      'media/video-source-type.html')
-    file_path = os.path.join('test_data', 'more')
-    analyzerResultMapMore = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-    diff = analyzerResultMapBase.CompareToOtherResultMap(analyzerResultMapMore)
-    self.assertEquals(diff['whole'][1][0][0], 'add1.html')
-    self.assertEquals(diff['skip'][1][0][0], 'add2.html')
-
-  def testCompareResultMapsNonSkip(self):
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-    file_path = os.path.join('test_data', 'more_te_info')
-    analyzerResultMapMoreTEInfo = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-    m = analyzerResultMapBase.CompareToOtherResultMap(
-        analyzerResultMapMoreTEInfo)
-    self.assertTrue('NEWADDED' in m['nonskip'][1][0][1][0])
-
-  def testGetListOfBugsForNonSkippedTests(self):
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-    self.assertEquals(
-        len(analyzerResultMapBase.GetListOfBugsForNonSkippedTests().keys()),
-        10)
-
-  def RunTestGetRevisionString(self, current_time_str, prev_time_str,
-                               expected_rev_str, expected_simple_rev_str,
-                               expected_rev_number, expected_rev_date,
-                               testname, diff_map_none=False):
-    current_time = datetime.strptime(current_time_str, '%Y-%m-%d-%H')
-    current_time = time.mktime(current_time.timetuple())
-    prev_time = datetime.strptime(prev_time_str, '%Y-%m-%d-%H')
-    prev_time = time.mktime(prev_time.timetuple())
-    if diff_map_none:
-      diff_map = None
-    else:
-      diff_map = {
-          'whole': [[], []],
-          'skip': [[(testname, 'te_info1')], []],
-          'nonskip': [[], []],
-      }
-    (rev_str, simple_rev_str, rev_number, rev_date) = (
-        layouttest_analyzer_helpers.GetRevisionString(prev_time, current_time,
-                                                      diff_map))
-    self.assertEquals(rev_str, expected_rev_str)
-    self.assertEquals(simple_rev_str, expected_simple_rev_str)
-    self.assertEquals(rev_number, expected_rev_number)
-    self.assertEquals(rev_date, expected_rev_date)
-
-  def testGetRevisionString(self):
-    expected_rev_str = ('<ul><a href="http://trac.webkit.org/changeset?'
-                        'new=94377@trunk/LayoutTests/platform/chromium/'
-                        'test_expectations.txt&old=94366@trunk/LayoutTests/'
-                        'platform/chromium/test_expectations.txt">94366->'
-                        '94377</a>\n'
-                        '<li>jamesr@google.com</li>\n'
-                        '<li>2011-09-01 18:00:23</li>\n'
-                        '<ul><li>-<a href="http://webkit.org/b/63878">'
-                        'BUGWK63878</a> : <a href="http://test-results.'
-                        'appspot.com/dashboards/flakiness_dashboard.html#'
-                        'tests=fast/dom/dom-constructors.html">fast/dom/'
-                        'dom-constructors.html</a> = TEXT</li>\n</ul></ul>')
-    expected_simple_rev_str = ('<a href="http://trac.webkit.org/changeset?'
-                               'new=94377@trunk/LayoutTests/platform/chromium/'
-                               'test_expectations.txt&old=94366@trunk/'
-                               'LayoutTests/platform/chromium/'
-                               'test_expectations.txt">94366->94377</a>,')
-    self.RunTestGetRevisionString('2011-09-02-00', '2011-09-01-00',
-                                  expected_rev_str, expected_simple_rev_str,
-                                  94377, '2011-09-01 18:00:23',
-                                  'fast/dom/dom-constructors.html')
-
-  def testGetRevisionStringNoneDiffMap(self):
-    self.RunTestGetRevisionString('2011-09-02-00', '2011-09-01-00', '', '',
-                                  '', '', '', diff_map_none=True)
-
-  def testGetRevisionStringNoMatchingTest(self):
-    self.RunTestGetRevisionString('2011-09-01-00', '2011-09-02-00', '', '',
-                                  '', '', 'foo1.html')
-
-  def testReplaceLineInFile(self):
-    file_path = os.path.join('test_data', 'inplace.txt')
-    f = open(file_path, 'w')
-    f.write('Hello')
-    f.close()
-    layouttest_analyzer_helpers.ReplaceLineInFile(
-        file_path, 'Hello', 'Goodbye')
-    f = open(file_path, 'r')
-    self.assertEquals(f.readline(), 'Goodbye')
-    f.close()
-    layouttest_analyzer_helpers.ReplaceLineInFile(
-        file_path, 'Bye', 'Hello')
-    f = open(file_path, 'r')
-    self.assertEquals(f.readline(), 'Goodbye')
-    f.close()
-
-  def testFindLatestResultWithNoData(self):
-    self.assertFalse(
-        layouttest_analyzer_helpers.FindLatestResult('test_data'))
-
-  def testConvertToCSVText(self):
-    file_path = os.path.join('test_data', 'base')
-    analyzerResultMapBase = (
-        layouttest_analyzer_helpers.AnalyzerResultMap.Load(file_path))
-    data, issues_txt = analyzerResultMapBase.ConvertToCSVText('11-10-10-2011')
-    self.assertEquals(data, '11-10-10-2011,204,36,10,95')
-    expected_issues_txt = """\
-BUGWK,66310,TEXT PASS,media/media-blocked-by-beforeload.html,DEBUG TEXT PASS,\
-media/video-source-error.html,
-BUGCR,86714,GPU IMAGE CRASH MAC,media/video-zoom.html,GPU IMAGE CRASH MAC,\
-media/video-controls-rendering.html,
-BUGCR,74102,GPU IMAGE PASS LINUX,media/video-controls-rendering.html,
-BUGWK,55718,TEXT IMAGE IMAGE+TEXT,media/media-document-audio-repaint.html,
-BUGCR,78376,TIMEOUT,http/tests/media/video-play-stall-seek.html,
-BUGCR,59415,WIN TEXT TIMEOUT PASS,media/video-loop.html,
-BUGCR,72223,IMAGE PASS,media/video-frame-accurate-seek.html,
-BUGCR,75354,TEXT IMAGE IMAGE+TEXT,media/media-document-audio-repaint.html,
-BUGCR,73609,TEXT,http/tests/media/video-play-stall.html,
-BUGWK,64003,DEBUG TEXT MAC PASS,media/video-delay-load-event.html,
-"""
-    self.assertEquals(issues_txt, expected_issues_txt)
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/layout_tests/layouttest_analyzer_runner.py b/src/cobalt/media/tools/layout_tests/layouttest_analyzer_runner.py
deleted file mode 100755
index 90a7100..0000000
--- a/src/cobalt/media/tools/layout_tests/layouttest_analyzer_runner.py
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-"""Main function to run the layout test analyzer.
-
-The purpose of this script is to run the layout test analyzer for various
-teams based on the run configuration file in CSV format. The CSV file is based
-on https://sites.google.com/a/chromium.org/dev/developers/testing/
-webkit-layout-tests/layout-test-stats-1.
-"""
-
-import optparse
-import os
-import shutil
-from subprocess import Popen
-
-# TODO(shadi): Re-examine the need of external files. Inline data instead?
-DEFAULT_RUN_CONFIG = {
-    # test_group_name: ('test_files.csv', 'report_email_address')
-    'media': ('testname/media.csv', 'layout-test-analyzer-result@google.com')
-}
-
-# Predefined result/graph directory.
-DEFAULT_RESULT_DIR = 'result'
-DEFAULT_GRAPH_DIR = 'graph'
-
-
-def ParseOption():
-  """Parse command-line options using OptionParser.
-
-  Returns:
-      an object containing all command-line option information.
-  """
-  option_parser = optparse.OptionParser()
-  option_parser.add_option('-d', '--result-directory-location',
-                           dest='result_directory_location',
-                           help=('Name of result directory location '
-                                 '(default to %default)'),
-                           default=DEFAULT_RESULT_DIR)
-  option_parser.add_option('-p', '--graph-directory-location',
-                           dest='graph_directory_location',
-                           help=('Name of graph directory location '
-                                 '(default to %default)'),
-                           default=DEFAULT_GRAPH_DIR)
-  option_parser.add_option('-e', '--email-only-change-mode',
-                           dest='email_only_change_mode',
-                           help=('With this mode, email is sent out '
-                                 'only when there is a change in the '
-                                 'analyzer result compared to the previous '
-                                 'result (off by default)'),
-                           action='store_true', default=False)
-  option_parser.add_option('-z', '--issue-detail-mode',
-                           dest='issue_detail_mode',
-                           help=('With this mode, email includes issue details'
-                                 ' including links to the flakiness dashboard'
-                                 ' (off by default)'),
-                           action='store_true', default=False)
-  return option_parser.parse_args()[0]
-
-
-def GenerateDashboardHTMLFile(file_name, test_group_list):
-  """Generate dashboard HTML file.
-
-  Currently, it is simple table that shows all the analyzer results.
-
-  Args:
-    file_name: the file name of the dashboard.
-    test_group_list: a list of test group names such as 'media' or 'composite'.
-  """
-  file_object = open(file_name, 'wb')
-  legend_txt = """
-<style type="text/css">
-th {
-  width: 30px; overflow: hidden;
-}
-tr.d0 td {
-  background-color: #CC9999; color: black;
-  text-align: right;
-  width: 30px; overflow: hidden;
-}
-tr.d1 td {
-  background-color: #9999CC; color: black;
-  text-align: right;
-  width: 30px; overflow: hidden;
-}
-</style>
-<h2>Chromium Layout Test Analyzer Result</h2>
-Legend:
-<ul>
-<li>#Tests: the number of tests for the given test group
-<li>#Skipped Tests: the number of tests that are skipped in the
-<a href='http://svn.webkit.org/repository/webkit/trunk/LayoutTests/platform/\
-chromium/test_expectations.txt'>test expectaion file</a> (e.g., BUGWK60877
-SKIP : loader/navigation-while-deferring-loads.html = FAIL)
-<li>#Non-Skipped Failing Tests: the number of tests that appeared in the
-test expectation file and were not skipped.
-<li>Failing rate: #NonSkippedFailing / (#Tests - #Skipped)
-<li>Passing rate: 100 - (Failing rate)
-</ul>
-  """
-  file_object.write(legend_txt)
-  file_object.write('<table border="1">')
-  file_object.write('<tr><th>Base Directory</th>')
-  file_object.write('<th>Trend Graph</th>')
-  file_object.write('<th>#Tests</th>')
-  file_object.write('<th>#Skipped Tests</th>')
-  file_object.write('<th>#Non-Skipped Failing Tests</th>')
-  file_object.write('<th>Failing Rate</th>')
-  file_object.write('<th>Passing Rate</th>')
-  file_object.write('<th>Last Revision Number</th>')
-  file_object.write('<th>Last Revision Date</th>')
-  file_object.write('<th>Owner Email</th>')
-  file_object.write('<th>Bug Information</th></tr>\n')
-  test_group_list.sort()
-  for i, test_group in enumerate(test_group_list):
-    file_object.write('<tr class="d' + str(i % 2) + '">\n')
-    file_object.write('<td>' + test_group + '</td>\n')
-    file_object.write('</tr>\n')
-  file_object.write('</table>')
-  file_object.close()
-
-
-# TODO(shadi): Use only one file with main()! Remove this file in favor of
-# layouttest_analyzer.py main().
-def main():
-  """A main function for the analyzer runner."""
-  options = ParseOption()
-  run_config_map = DEFAULT_RUN_CONFIG
-  test_group_list = run_config_map.keys()
-  dashboard_file_location = os.path.join(options.graph_directory_location,
-                                         'index.html')
-  if not os.path.exists(dashboard_file_location):
-    GenerateDashboardHTMLFile(dashboard_file_location, test_group_list)
-  for test_group in test_group_list:
-    # Prepare the result if it does not exist.
-    # The directory name should be changed to avoid collision
-    # with the file separator.
-    test_group_name_for_data = test_group.replace('/', '_')
-    result_dir = os.path.join(options.result_directory_location,
-                              test_group_name_for_data)
-    if not os.path.exists(result_dir):
-      os.mkdir(result_dir)
-    graph_file = os.path.join(options.graph_directory_location,
-                              test_group_name_for_data + '.html')
-    if not os.path.exists(graph_file):
-      # Copy the template file.
-      shutil.copy(os.path.join('graph', 'graph.html'),
-                  graph_file)
-      os.chmod(graph_file, 0744)
-    cmd = ('python layouttest_analyzer.py -x %s -d %s -t %s'
-           ' -q %s ') % (
-               test_group, result_dir, graph_file, dashboard_file_location)
-    if run_config_map[test_group][0]:
-      cmd += '-n ' + run_config_map[test_group][0] + ' '
-    if run_config_map[test_group][1]:
-      cmd += '-r ' + run_config_map[test_group][1] + ' '
-    if options.email_only_change_mode:
-      cmd += ' -c '
-    if options.issue_detail_mode:
-      cmd += ' -z '
-    print 'Running ' + cmd
-    proc = Popen(cmd, shell=True)
-    proc.communicate()
-
-
-if '__main__' == __name__:
-  main()
diff --git a/src/cobalt/media/tools/layout_tests/layouttests.py b/src/cobalt/media/tools/layout_tests/layouttests.py
deleted file mode 100644
index 8d30038..0000000
--- a/src/cobalt/media/tools/layout_tests/layouttests.py
+++ /dev/null
@@ -1,244 +0,0 @@
-# Copyright (c) 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.
-
-"""Layout tests module that is necessary for the layout analyzer.
-
-Layout tests are stored in an SVN repository and LayoutTestCaseManager collects
-these layout test cases (including description).
-"""
-
-import copy
-import csv
-import locale
-import re
-import sys
-import urllib2
-
-import pysvn
-
-# LayoutTests SVN root location.
-DEFAULT_LAYOUTTEST_LOCATION = (
-    'http://src.chromium.org/blink/trunk/LayoutTests/')
-# LayoutTests SVN view link
-DEFAULT_LAYOUTTEST_SVN_VIEW_LOCATION = (
-    'http://src.chromium.org/viewvc/blink/trunk/LayoutTests/')
-
-
-# When parsing the test HTML file and finding the test description,
-# this script tries to find the test description using sentences
-# starting with these keywords. This is adhoc but it is the only way
-# since there is no standard for writing test description.
-KEYWORDS_FOR_TEST_DESCRIPTION = ['This test', 'Tests that', 'Test ']
-
-# If cannot find the keywords, this script tries to find test case
-# description by the following tags.
-TAGS_FOR_TEST_DESCRIPTION = ['title', 'p', 'div']
-
-# If cannot find the tags, this script tries to find the test case
-# description in the sentence containing following words.
-KEYWORD_FOR_TEST_DESCRIPTION_FAIL_SAFE = ['PASSED ', 'PASS:']
-
-
-class LayoutTests(object):
-  """A class to store test names in layout tests.
-
-  The test names (including regular expression patterns) are read from a CSV
-  file and used for getting layout test names from repository.
-  """
-
-  def __init__(self, layouttest_root_path=DEFAULT_LAYOUTTEST_LOCATION,
-               parent_location_list=None, filter_names=None,
-               recursion=False):
-    """Initialize LayoutTests using root and CSV file.
-
-    Args:
-      layouttest_root_path: A location string where layout tests are stored.
-      parent_location_list: A list of parent directories that are needed for
-          getting layout tests.
-      filter_names: A list of test name patterns that are used for filtering
-          test names (e.g., media/*.html).
-      recursion: a boolean indicating whether the test names are sought
-          recursively.
-    """
-
-    if layouttest_root_path.startswith('http://'):
-      name_map = self.GetLayoutTestNamesFromSVN(parent_location_list,
-                                                layouttest_root_path,
-                                                recursion)
-    else:
-      # TODO(imasaki): support other forms such as CSV for reading test names.
-      pass
-    self.name_map = copy.copy(name_map)
-    if filter_names:
-      # Filter names.
-      for lt_name in name_map.iterkeys():
-        match = False
-        for filter_name in filter_names:
-          if re.search(filter_name, lt_name):
-            match = True
-            break
-        if not match:
-          del self.name_map[lt_name]
-    # We get description only for the filtered names.
-    for lt_name in self.name_map.iterkeys():
-      self.name_map[lt_name] = 'No description available'
-
-  @staticmethod
-  def ExtractTestDescription(txt):
-    """Extract the description description from test code in HTML.
-
-    Currently, we have 4 rules described in the code below.
-    (This example falls into rule 1):
-      <p>
-      This tests the intrinsic size of a video element is the default
-      300,150 before metadata is loaded, and 0,0 after
-      metadata is loaded for an audio-only file.
-      </p>
-    The strategy is very adhoc since the original test case files
-    (in HTML format) do not have standard way to store test description.
-
-    Args:
-      txt: A HTML text which may or may not contain test description.
-
-    Returns:
-      A string that contains test description. Returns 'UNKNOWN' if the
-          test description is not found.
-    """
-    # (1) Try to find test description that contains keywords such as
-    #     'test that' and surrounded by p tag.
-    #     This is the most common case.
-    for keyword in KEYWORDS_FOR_TEST_DESCRIPTION:
-      # Try to find <p> and </p>.
-      pattern = r'<p>(.*' + keyword + '.*)</p>'
-      matches = re.search(pattern, txt)
-      if matches is not None:
-        return matches.group(1).strip()
-
-    # (2) Try to find it by using more generic keywords such as 'PASS' etc.
-    for keyword in KEYWORD_FOR_TEST_DESCRIPTION_FAIL_SAFE:
-      # Try to find new lines.
-      pattern = r'\n(.*' + keyword + '.*)\n'
-      matches = re.search(pattern, txt)
-      if matches is not None:
-        # Remove 'p' tag.
-        text = matches.group(1).strip()
-        return text.replace('<p>', '').replace('</p>', '')
-
-    # (3) Try to find it by using HTML tag such as title.
-    for tag in TAGS_FOR_TEST_DESCRIPTION:
-      pattern = r'<' + tag + '>(.*)</' + tag + '>'
-      matches = re.search(pattern, txt)
-      if matches is not None:
-        return matches.group(1).strip()
-
-    # (4) Try to find it by using test description and remove 'p' tag.
-    for keyword in KEYWORDS_FOR_TEST_DESCRIPTION:
-      # Try to find <p> and </p>.
-      pattern = r'\n(.*' + keyword + '.*)\n'
-      matches = re.search(pattern, txt)
-      if matches is not None:
-        # Remove 'p' tag.
-        text = matches.group(1).strip()
-        return text.replace('<p>', '').replace('</p>', '')
-
-    # (5) cannot find test description using existing rules.
-    return 'UNKNOWN'
-
-  @staticmethod
-  def GetLayoutTestNamesFromSVN(parent_location_list,
-                                layouttest_root_path, recursion):
-    """Get LayoutTest names from SVN.
-
-    Args:
-      parent_location_list: a list of locations of parent directories. This is
-          used when getting layout tests using PySVN.list().
-      layouttest_root_path: the root path of layout tests directory.
-      recursion: a boolean indicating whether the test names are sought
-          recursively.
-
-    Returns:
-      a map containing test names as keys for de-dupe.
-    """
-    client = pysvn.Client()
-    # Get directory structure in the repository SVN.
-    name_map = {}
-    for parent_location in parent_location_list:
-      if parent_location.endswith('/'):
-        full_path = layouttest_root_path + parent_location
-        try:
-          file_list = client.list(full_path, recurse=recursion)
-          for file_name in file_list:
-            if sys.stdout.isatty():
-              default_encoding = sys.stdout.encoding
-            else:
-              default_encoding = locale.getpreferredencoding()
-            file_name = file_name[0].repos_path.encode(default_encoding)
-            # Remove the word '/truck/LayoutTests'.
-            file_name = file_name.replace('/trunk/LayoutTests/', '')
-            if file_name.endswith('.html'):
-              name_map[file_name] = True
-        except:
-          print 'Unable to list tests in %s.' % full_path
-    return name_map
-
-  @staticmethod
-  def GetLayoutTestNamesFromCSV(csv_file_path):
-    """Get layout test names from CSV file.
-
-    Args:
-      csv_file_path: the path for the CSV file containing test names (including
-          regular expression patterns). The CSV file content has one column and
-          each row contains a test name.
-
-    Returns:
-       a list of test names in string.
-    """
-    file_object = file(csv_file_path, 'r')
-    reader = csv.reader(file_object)
-    names = [row[0] for row in reader]
-    file_object.close()
-    return names
-
-  @staticmethod
-  def GetParentDirectoryList(names):
-    """Get parent directory list from test names.
-
-    Args:
-      names: a list of test names. The test names also have path information as
-          well (e.g., media/video-zoom.html).
-
-    Returns:
-      a list of parent directories for the given test names.
-    """
-    pd_map = {}
-    for name in names:
-      p_dir = name[0:name.rfind('/') + 1]
-      pd_map[p_dir] = True
-    return list(pd_map.iterkeys())
-
-  def JoinWithTestExpectation(self, test_expectations):
-    """Join layout tests with the test expectation file using test name as key.
-
-    Args:
-      test_expectations: a test expectations object.
-
-    Returns:
-      test_info_map contains test name as key and another map as value. The
-          other map contains test description and the test expectation
-          information which contains keyword (e.g., 'GPU') as key (we do
-          not care about values). The map data structure is used since we
-          have to look up these keywords several times.
-    """
-    test_info_map = {}
-    for (lt_name, desc) in self.name_map.items():
-      test_info_map[lt_name] = {}
-      test_info_map[lt_name]['desc'] = desc
-      for (te_name, te_info) in (
-          test_expectations.all_test_expectation_info.items()):
-        if te_name == lt_name or (
-            te_name in lt_name and te_name.endswith('/')):
-          # Only keep the first match when found.
-          test_info_map[lt_name]['te_info'] = te_info
-          break
-    return test_info_map
diff --git a/src/cobalt/media/tools/layout_tests/layouttests_unittest.py b/src/cobalt/media/tools/layout_tests/layouttests_unittest.py
deleted file mode 100755
index 7fb44df..0000000
--- a/src/cobalt/media/tools/layout_tests/layouttests_unittest.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-import unittest
-
-from layouttests import LayoutTests
-from test_expectations import TestExpectations
-
-
-class TestLayoutTests(unittest.TestCase):
-  """Unit tests for the LayoutTests class."""
-
-  def testJoinWithTestExpectation(self):
-    layouttests = LayoutTests(parent_location_list=['media/'])
-    test_expectations = TestExpectations()
-    test_info_map = layouttests.JoinWithTestExpectation(test_expectations)
-    # TODO(imasaki): have better assertion below. Currently, the test
-    # expectation file is obtained dynamically so the strict assertion is
-    # impossible.
-    self.assertTrue(any(['media/' in k for k in test_info_map.keys()]),
-                    msg=('Analyzer result should contain at least one '
-                         'media test cases since we only retrieved media '
-                         'related test'))
-
-  def testGetTestDescriptionsFromSVN(self):
-    desc1 = LayoutTests.GetTestDescriptionFromSVN(
-        'media/video-play-empty-events.html')
-    self.assertEquals(desc1,
-                      ('Test that play() from EMPTY network state triggers '
-                       'load() and async play event.'),
-                      msg='Extracted test description is wrong')
-    desc2 = LayoutTests.GetTestDescriptionFromSVN('jquery/data.html')
-    self.assertEquals(desc2, 'UNKNOWN',
-                      msg='Extracted test description is wrong')
-
-  def testGetParentDirectoryList(self):
-    testname_list = ['hoge1/hoge2/hoge3.html', 'hoge1/x.html',
-                     'hoge1/hoge2/hoge4.html']
-    expected_result = ['hoge1/', 'hoge1/hoge2/']
-    self.assertEquals(LayoutTests.GetParentDirectoryList(testname_list),
-                      expected_result)
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/layout_tests/result/2011-08-19-11 b/src/cobalt/media/tools/layout_tests/result/2011-08-19-11
deleted file mode 100644
index e020b9e..0000000
--- a/src/cobalt/media/tools/layout_tests/result/2011-08-19-11
+++ /dev/null
@@ -1,1891 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/track/track-webvtt-tc004-magicheader.html'
-p6
-(dp7
-S'desc'
-p8
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p9
-sS'te_info'
-p10
-(lp11
-(dp12
-S'SKIP'
-p13
-I01
-sS'TIMEOUT'
-p14
-I01
-sS'Comments'
-p15
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p16
-sS'Bugs'
-p17
-(lp18
-S'BUGWK43668'
-p19
-asassS'media/audio-delete-while-step-button-clicked.html'
-p20
-(dp21
-g8
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p22
-sg10
-(lp23
-(dp24
-S'FAIL'
-p25
-I01
-sg13
-I01
-sg17
-(lp26
-S'BUGCR25375'
-p27
-aS'BUGCR59399'
-p28
-asg15
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p29
-sassS'media/restore-from-page-cache.html'
-p30
-(dp31
-g8
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p32
-sg10
-(lp33
-(dp34
-g13
-I01
-sS'WONTFIX'
-p35
-I01
-sg14
-I01
-sg15
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p36
-sg17
-(lp37
-S'BUGCR19635'
-p38
-asassS'media/context-menu-actions.html'
-p39
-(dp40
-g8
-S'Test the various actions available in the HTML5 media element context-menu.'
-p41
-sg10
-(lp42
-(dp43
-S'CRASH'
-p44
-I01
-sg13
-I01
-sg17
-(lp45
-S'BUGCR59665'
-p46
-aS'BUGWK45021'
-p47
-asg15
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p48
-sg14
-I01
-sS'PASS'
-p49
-I01
-sassS'media/track/track-webvtt-tc005-headercomment.html'
-p50
-(dp51
-g8
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p52
-sg10
-g11
-ssS'http/tests/media/video-cross-site.html'
-p53
-(dp54
-g8
-S'media file redirects to another site'
-p55
-sg10
-(lp56
-(dp57
-g13
-I01
-sg15
-S' QuickTime reference movies not supported.'
-p58
-sg14
-I01
-sg49
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/audio-data-url.html'
-p59
-(dp60
-g8
-S'Test that audio element can use a data: url'
-p61
-sg10
-(lp62
-(dp63
-g13
-I01
-sg17
-(lp64
-S'BUGCR16779'
-p65
-asg15
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/video-canvas-alpha.html'
-p67
-(dp68
-g8
-S'UNKNOWN'
-p69
-sg10
-(lp70
-(dp71
-g13
-I01
-sS'IMAGE'
-p72
-I01
-sg17
-(lp73
-S'BUGCR74979'
-p74
-asg15
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p75
-sS'MAC'
-p76
-I01
-sS'GPU'
-p77
-I01
-sassS'media/video-can-play-type.html'
-p78
-(dp79
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p80
-sg10
-(lp81
-(dp82
-g13
-I01
-sg17
-(lp83
-S'BUGCR16779'
-p84
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/media-captions.html'
-p85
-(dp86
-g8
-S'Test media element close caption API.'
-p87
-sg10
-(lp88
-(dp89
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p90
-sg17
-(lp91
-S'BUGCR28301'
-p92
-asassS'media/media-can-play-mpeg-audio.html'
-p93
-(dp94
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p95
-sg10
-(lp96
-(dp97
-g13
-I01
-sg35
-I01
-sg17
-(lp98
-S'BUGCR16779'
-p99
-asg15
-g66
-sS'TEXT'
-p100
-I01
-sassS'media/track/track-webvtt-tc011-blanklines.html'
-p101
-(dp102
-g8
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p103
-sg10
-g11
-ssS'media/track/track-webvtt-tc012-outoforder.html'
-p104
-(dp105
-g8
-S'Tests cues that are temporally out of order (we allow this).'
-p106
-sg10
-g11
-ssS'media/track/track-webvtt-tc008-timingsnohours.html'
-p107
-(dp108
-g8
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p109
-sg10
-g11
-ssS'media/video-size-intrinsic-scale.html'
-p110
-(dp111
-g8
-S'&lt;video&gt; element intrinsic size test'
-p112
-sg10
-(lp113
-(dp114
-g13
-I01
-sg17
-(lp115
-S'BUGCR16779'
-p116
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/audio-mpeg4-supported.html'
-p117
-(dp118
-g8
-S'Test that the audio element supports M4A files.'
-p119
-sg10
-(lp120
-(dp121
-g13
-I01
-sg17
-(lp122
-S'BUGCR16779'
-p123
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/media-fullscreen-not-in-document.html'
-p124
-(dp125
-g8
-S'Test media element fullscreen API when an element is not in the DOM.'
-p126
-sg10
-(lp127
-(dp128
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p129
-sg17
-(lp130
-S'BUGCR16735'
-p131
-asassS'media/audio-mpeg-supported.html'
-p132
-(dp133
-g8
-S'Test that the audio element supports MPEG files.'
-p134
-sg10
-(lp135
-(dp136
-g13
-I01
-sg17
-(lp137
-S'BUGCR16779'
-p138
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/track/track-webvtt-tc003-newlines.html'
-p139
-(dp140
-g8
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p141
-sg10
-g11
-ssS'media/video-document-types.html'
-p142
-(dp143
-g8
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p144
-sg10
-(lp145
-(dp146
-g13
-I01
-sg17
-(lp147
-S'BUGCR16779'
-p148
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/track/track-webvtt-tc002-bom.html'
-p149
-(dp150
-g8
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p151
-sg10
-g11
-ssS'media/video-does-not-loop.html'
-p152
-(dp153
-g8
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p154
-sg10
-(lp155
-(dp156
-g13
-I01
-sg35
-I01
-sg14
-I01
-sg15
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p157
-sassS'media/track/track-webvtt-tc000-empty.html'
-p158
-(dp159
-g8
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p160
-sg10
-g11
-ssS'media/media-can-play-mpeg4-video.html'
-p161
-(dp162
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p163
-sg10
-(lp164
-(dp165
-g13
-I01
-sg35
-I01
-sg17
-(lp166
-S'BUGWK45102'
-p167
-asg15
-g66
-sg100
-I01
-sassS'compositing/video/video-background-color.html'
-p168
-(dp169
-g8
-S'Video with background color'
-p170
-sg10
-(lp171
-(dp172
-g25
-I01
-sg13
-I01
-sg35
-I01
-sg17
-(lp173
-S'BUGWK55519'
-p174
-asg15
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p175
-sassS'media/track/track-webvtt-tc010-notimings.html'
-p176
-(dp177
-g8
-S'Tests cue without timings are ignored.'
-p178
-sg10
-g11
-ssS'media/video-timeupdate-reverse-play.html'
-p179
-(dp180
-g8
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p181
-sg10
-(lp182
-(dp183
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p184
-sg17
-(lp185
-S'BUGCR33099'
-p186
-asassS'http/tests/media/video-buffered.html'
-p187
-(dp188
-g8
-g69
-sg10
-(lp189
-(dp190
-g13
-I01
-sg17
-(lp191
-S'BUGCR49165'
-p192
-asg15
-S' video.buffered multiple TimeRanges support.'
-p193
-sg49
-I01
-sassS'media/track/track-webvtt-tc001-utf8.html'
-p194
-(dp195
-g8
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as WebVTT a file (we do allow it, it just looks ugly).'
-p196
-sg10
-g11
-ssS'media/track/track-webvtt-tc013-settings.html'
-p197
-(dp198
-g8
-S'Tests WebVTT settings.'
-p199
-sg10
-g11
-ssS'media/media-fullscreen-inline.html'
-p200
-(dp201
-g8
-S'Test media element fullscreen API when an element is in the DOM.'
-p202
-sg10
-(lp203
-(dp204
-g13
-I01
-sg14
-I01
-sg15
-g129
-sg17
-(lp205
-S'BUGCR16735'
-p206
-asassS'media/track/track-webvtt-tc007-cuenoid.html'
-p207
-(dp208
-g8
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p209
-sg10
-g11
-ssS'media/track/track-webvtt-tc009-timingshour.html'
-p210
-(dp211
-g8
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p212
-sg10
-g11
-ssS'media/track/track-webvtt-tc006-cueidentifiers.html'
-p213
-(dp214
-g8
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p215
-sg10
-g11
-ssS'media/video-element-other-namespace-crash.html'
-p216
-(dp217
-g8
-g69
-sg10
-(lp218
-(dp219
-g13
-I01
-sg35
-I01
-sg14
-I01
-sg15
-g66
-sg17
-(lp220
-S'BUGCR68289'
-p221
-asassS'media/video-reverse-play-duration.html'
-p222
-(dp223
-g8
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p224
-sg10
-(lp225
-(dp226
-g13
-I01
-sg14
-I01
-sg15
-g184
-sg17
-(lp227
-S'BUGCR33099'
-p228
-asasssS'whole'
-p229
-(dp230
-S'media/video-source-type.html'
-p231
-(dp232
-g8
-S'&lt;source&gt; @type attribute'
-p233
-ssS'media/media-startTime.html'
-p234
-(dp235
-g8
-S"Test the, so far unused, 'startTime' attribute."
-p236
-ssS'media/video-src-set.html'
-p237
-(dp238
-g8
-S'Test that setting src attribute triggers load'
-p239
-ssg20
-g21
-sS'media/video-played-ranges-1.html'
-p240
-(dp241
-g8
-S"Test of the media element 'played' attribute, ranges part 1."
-p242
-ssS'media/video-layer-crash.html'
-p243
-(dp244
-g8
-S'Test dynamic removal of transformed and reflected video'
-p245
-ssS'http/tests/media/video-play-stall-seek.html'
-p246
-(dp247
-g8
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p248
-sg10
-(lp249
-(dp250
-g14
-I01
-sg15
-S' Timing out.'
-p251
-sg17
-(lp252
-S'BUGCR78376'
-p253
-asassg59
-g60
-sg78
-g79
-sg85
-g86
-sS'http/tests/media/video-referer.html'
-p254
-(dp255
-g8
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p256
-ssS'media/video-source-removed.html'
-p257
-(dp258
-g8
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p259
-ssS'media/unsupported-tracks.html'
-p260
-(dp261
-g8
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p262
-ssg117
-g118
-sS'media/audio-no-installed-engines.html'
-p263
-(dp264
-g8
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p265
-ssg124
-g125
-sS'media/video-dom-src.html'
-p266
-(dp267
-g8
-g69
-ssS'media/media-blocked-by-willsendrequest.html'
-p268
-(dp269
-g8
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p270
-ssS'media/video-error-does-not-exist.html'
-p271
-(dp272
-g8
-S'Test that the media element is in correct state after load fails.'
-p273
-ssS'media/video-play-pause-events.html'
-p274
-(dp275
-g8
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p276
-ssS'media/video-display-none-crash.html'
-p277
-(dp278
-g8
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p279
-ssS'media/video-src-plus-source.html'
-p280
-(dp281
-g8
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p282
-ssS'media/video-source-none-supported.html'
-p283
-(dp284
-g8
-S'no usable &lt;source&gt; test'
-p285
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p286
-(dp287
-g8
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p288
-ssg152
-g153
-sS'media/video-src.html'
-p289
-(dp290
-g8
-g69
-ssS'media/audio-controls-rendering.html'
-p291
-(dp292
-g8
-S'Test controls placement.'
-p293
-ssg168
-g169
-sS'media/video-source-inserted.html'
-p294
-(dp295
-g8
-S'networkState after inserting &lt;source&gt; test'
-p296
-ssS'media/media-can-play-octet-stream.html'
-p297
-(dp298
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p299
-ssS'media/constructors.html'
-p300
-(dp301
-g8
-S'Test that media constructors behave consistently.'
-p302
-ssS'media/video-source-media.html'
-p303
-(dp304
-g8
-g69
-ssg187
-g188
-sS'http/tests/security/local-video-source-from-remote.html'
-p305
-(dp306
-g8
-S'This test only behaves correctly in DRT'
-p307
-ssg194
-g195
-sS'media/video-source-type-params.html'
-p308
-(dp309
-g8
-g69
-ssS'fast/canvas/webgl/context-lost.html'
-p310
-(dp311
-g8
-S'debug("Test valid context");'
-p312
-ssS'media/media-can-play-wav-audio.html'
-p313
-(dp314
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p315
-ssS'media/video-source-error.html'
-p316
-(dp317
-g8
-S'&lt;video&gt; and &lt;source&gt; error test'
-p318
-sg10
-(lp319
-(dp320
-S'DEBUG'
-p321
-I01
-sg100
-I01
-sg17
-(lp322
-S'BUGWK66310'
-p323
-asg15
-S''
-p324
-sg49
-I01
-sassS'media/video-no-audio.html'
-p325
-(dp326
-g8
-S'Movie with no audio track. The volume button should not render.'
-p327
-ssS'media/svg-as-image-with-media-blocked.html'
-p328
-(dp329
-g8
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p330
-ssg207
-g208
-sg107
-g108
-sS'media/video-click-dblckick-standalone.html'
-p331
-(dp332
-g8
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p333
-ssS'media/video-pause-immediately.html'
-p334
-(dp335
-g8
-S'Test that pausing the media element has an immediate effect on the clock.'
-p336
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p337
-(dp338
-g8
-g69
-ssg222
-g223
-sS'http/tests/security/local-video-src-from-remote.html'
-p339
-(dp340
-g8
-S'This test only works in DRT'
-p341
-ssg200
-g201
-sS'media/video-controls-in-media-document.html'
-p342
-(dp343
-g8
-g69
-ssS'media/remove-from-document-no-load.html'
-p344
-(dp345
-g8
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p346
-ssS'media/video-currentTime.html'
-p347
-(dp348
-g8
-g69
-ssS'media/video-frame-accurate-seek.html'
-p349
-(dp350
-g8
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p351
-sg10
-(lp352
-(dp353
-g72
-I01
-sg17
-(lp354
-S'BUGCR72223'
-p355
-asg15
-g324
-sg49
-I01
-sassg30
-g31
-sg39
-g40
-sS'media/media-controls-clone-crash.html'
-p356
-(dp357
-g8
-S'Test passes if it does not crash.'
-p358
-ssg50
-g51
-sS'media/controls-css-overload.html'
-p359
-(dp360
-g8
-S"Testing that overloading some controls doesn't crash the browser"
-p361
-ssS'media/video-display-aspect-ratio.html'
-p362
-(dp363
-g8
-g69
-ssS'media/video-currentTime-set.html'
-p364
-(dp365
-g8
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p366
-ssS'media/media-blocked-by-beforeload.html'
-p367
-(dp368
-g8
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p369
-sg10
-(lp370
-(dp371
-g100
-I01
-sg17
-(lp372
-S'BUGWK66310'
-p373
-asg15
-g324
-sg49
-I01
-sassg104
-g105
-sS'media/video-controls-visible-audio-only.html'
-p374
-(dp375
-g8
-S'This test only runs in DRT!'
-p376
-ssS'http/tests/media/video-play-progress.html'
-p377
-(dp378
-g8
-S'Test that at least one progress event is fired after starting to load the video.'
-p379
-ssg110
-g111
-sS'media/video-source-moved.html'
-p380
-(dp381
-g8
-S'moving &lt;source&gt; element test'
-p382
-ssg101
-g102
-sS'media/video-src-none.html'
-p383
-(dp384
-g8
-g69
-ssS'media/video-controls-zoomed.html'
-p385
-(dp386
-g8
-S'This test only runs in DRT!'
-p387
-ssS'media/video-controls.html'
-p388
-(dp389
-g8
-S"Test 'controls' attribute"
-p390
-ssS'media/controls-without-preload.html'
-p391
-(dp392
-g8
-S'The controls should not depend on preload value.'
-p393
-ssS'media/video-played-collapse.html'
-p394
-(dp395
-g8
-S"Test of the media element 'played' attribute"
-p396
-ssS'compositing/self-painting-layers.html'
-p397
-(dp398
-g8
-S'Self painting layers'
-p399
-ssS'media/audio-controls-do-not-fade-out.html'
-p400
-(dp401
-g8
-S'This tests that audio controls do not fade out when the audio is playing.'
-p402
-ssS'media/media-document-audio-repaint.html'
-p403
-(dp404
-g8
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p405
-sg10
-(lp406
-(dp407
-g100
-I01
-sg72
-I01
-sg17
-(lp408
-S'BUGCR75354'
-p409
-aS'BUGWK55718'
-p410
-asg15
-S' This test needs completely new baselines.'
-p411
-sS'IMAGE+TEXT'
-p412
-I01
-sa(dp413
-S'NEWADDED'
-p414
-I01
-sg100
-I01
-sg72
-I01
-sg17
-g408
-sg15
-g411
-sg412
-I01
-sassS'compositing/geometry/video-opacity-overlay.html'
-p415
-(dp416
-g8
-S'Video overlay'
-p417
-ssS'media/video-source-error-no-candidate.html'
-p418
-(dp419
-g8
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p420
-ssS'media/audio-constructor.html'
-p421
-(dp422
-g8
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p423
-ssS'media/controls-styling.html'
-p424
-(dp425
-g8
-S'The look of the controls should not change.'
-p426
-ssS'media/video-buffered.html'
-p427
-(dp428
-g8
-g69
-ssS'media/event-attributes.html'
-p429
-(dp430
-g8
-g69
-ssg176
-g177
-sg179
-g180
-sS'http/tests/media/text-served-as-text.html'
-p431
-(dp432
-g8
-S"text file served as 'text/plain'"
-p433
-ssS'http/tests/media/video-cancel-load.html'
-p434
-(dp435
-g8
-S'Cancel loading a video file and access its properties afterwards.'
-p436
-ssS'media/unsupported-rtsp.html'
-p437
-(dp438
-g8
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p439
-ssS'media/media-controls-clone.html'
-p440
-(dp441
-g8
-S'<video controls id=v></video><audio controls id=a></audio>'
-p442
-ssS'media/broken-video.html'
-p443
-(dp444
-g8
-S'Test that QuickTime file with broken content generates an error.'
-p445
-ssS'media/video-plays-past-end-of-test.html'
-p446
-(dp447
-g8
-g69
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p448
-(dp449
-g8
-S'WebGL Origin Restrictions Conformance Tests'
-p450
-ssS'media/video-replaces-poster.html'
-p451
-(dp452
-g8
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p453
-ssS'media/video-autoplay.html'
-p454
-(dp455
-g8
-g69
-ssS'media/video-set-rate-from-pause.html'
-p456
-(dp457
-g8
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p458
-ssS'media/video-src-remove.html'
-p459
-(dp460
-g8
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p461
-ssS'media/csp-blocks-video.html'
-p462
-(dp463
-g8
-S"This test passes if it doesn't alert failure."
-p464
-ssS'media/controls-drag-timebar.html'
-p465
-(dp466
-g8
-S'Test that dragging the timebar thumb causes seeks.'
-p467
-ssS'media/audio-constructor-preload.html'
-p468
-(dp469
-g8
-S"Test that Audio() sets 'preload' attribute."
-p470
-ssS'media/video-src-invalid-poster.html'
-p471
-(dp472
-g8
-g69
-ssS'media/adopt-node-crash.html'
-p473
-(dp474
-g8
-S"Tests that we don't crash when moving a video element to a new document."
-p475
-ssS'media/video-playbackrate.html'
-p476
-(dp477
-g8
-S'test playbackRate and defaultPlaybackRate'
-p478
-ssS'media/video-muted.html'
-p479
-(dp480
-g8
-S"Test 'muted' attribute"
-p481
-ssS'media/video-src-change.html'
-p482
-(dp483
-g8
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p484
-ssg216
-g217
-sS'media/video-play-pause-exception.html'
-p485
-(dp486
-g8
-S'Video has no src. Test that the playing event is not dispatched.'
-p487
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p488
-(dp489
-g8
-g69
-ssS'media/audio-play-event.html'
-p490
-(dp491
-g8
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p492
-ssS'media/before-load-member-access.html'
-p493
-(dp494
-g8
-S'Test that accessing member of a non loaded video works.'
-p495
-ssS'media/video-width-height.html'
-p496
-(dp497
-g8
-g69
-ssS'media/audio-repaint.html'
-p498
-(dp499
-g8
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p500
-ssS'media/video-currentTime-delay.html'
-p501
-(dp502
-g8
-S'Test a delay in playing the movie results in a canPlay event.'
-p503
-ssS'media/video-aspect-ratio.html'
-p504
-(dp505
-g8
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p506
-ssS'media/video-transformed.html'
-p507
-(dp508
-g8
-S'Test painting of transformed video'
-p509
-ssS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p510
-(dp511
-g8
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p512
-ssS'media/invalid-media-url-crash.html'
-p513
-(dp514
-g8
-S'Tests that invalid media src url does not result in crash.'
-p515
-ssS'media/video-empty-source.html'
-p516
-(dp517
-g8
-S'Slider drawing with no source. The controls should render correctly.'
-p518
-ssg93
-g94
-sS'media/video-poster.html'
-p519
-(dp520
-g8
-S'Test &lt;video&gt; element with and without a poster.'
-p521
-ssS'media/media-document-audio-size.html'
-p522
-(dp523
-g8
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p524
-ssg132
-g133
-sS'compositing/overflow/overflow-compositing-descendant.html'
-p525
-(dp526
-g8
-S'You should see a green box under the video. If you see red, the test failed.'
-p527
-ssS'media/video-dom-autoplay.html'
-p528
-(dp529
-g8
-g69
-ssS'media/media-ended.html'
-p530
-(dp531
-g8
-S'<b>Test ended by:</b>'
-p532
-ssS'media/video-no-autoplay.html'
-p533
-(dp534
-g8
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p535
-ssS'media/video-zoom.html'
-p536
-(dp537
-g8
-S'150% zoom, with width and height attributes'
-p538
-sg10
-(lp539
-(dp540
-g44
-I01
-sg72
-I01
-sg17
-(lp541
-S'BUGCR86714'
-p542
-asg15
-g324
-sg76
-I01
-sg77
-I01
-sassS'media/video-append-source.html'
-p543
-(dp544
-g8
-g69
-ssg139
-g140
-sS'http/tests/media/pdf-served-as-pdf.html'
-p545
-(dp546
-g8
-S"PDF file served as 'application/pdf'"
-p547
-ssS'media/video-play-empty-events.html'
-p548
-(dp549
-g8
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p550
-ssg149
-g150
-sS'media/audio-only-video-intrinsic-size.html'
-p551
-(dp552
-g8
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p553
-ssg142
-g143
-sS'media/audio-delete-while-slider-thumb-clicked.html'
-p554
-(dp555
-g8
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p556
-ssS'media/media-can-play-ogg.html'
-p557
-(dp558
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p559
-ssg6
-g7
-sg158
-g159
-sS'media/video-currentTime-set2.html'
-p560
-(dp561
-g8
-g69
-ssS'media/video-seekable.html'
-p562
-(dp563
-g8
-g69
-ssS'fast/dom/beforeload/video-before-load.html'
-p564
-(dp565
-g8
-g69
-ssS'media/video-played-reset.html'
-p566
-(dp567
-g8
-S"Test of the media element 'played' attribute"
-p568
-ssS'compositing/self-painting-layers2.html'
-p569
-(dp570
-g8
-S'This test should not assert in debug builds.'
-p571
-ssS'media/controls-right-click-on-timebar.html'
-p572
-(dp573
-g8
-S'Test that right clicking on the timebar does not cause a seek.'
-p574
-ssS'media/video-dom-preload.html'
-p575
-(dp576
-g8
-S'consoleWrite("++ Test default attribute value");'
-p577
-ssS'media/video-size.html'
-p578
-(dp579
-g8
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p580
-ssS'media/video-delay-load-event.html'
-p581
-(dp582
-g8
-S"Test the document's load event is delayed until a movie's meta data is available."
-p583
-sg10
-(lp584
-(dp585
-g100
-I01
-sg17
-(lp586
-S'BUGWK64003'
-p587
-asg15
-S' Started around WebKit r90233:r90242'
-p588
-sg76
-I01
-sg49
-I01
-sg321
-I01
-sassS'media/fallback.html'
-p589
-(dp590
-g8
-S'Test that fallback content is not rendered'
-p591
-ssS'fast/layers/video-layer.html'
-p592
-(dp593
-g8
-S'Video element gets layer'
-p594
-ssS'media/controls-strict.html'
-p595
-(dp596
-g8
-S'Drawing the controls in strict mode.'
-p597
-ssS'media/remove-from-document.html'
-p598
-(dp599
-g8
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p600
-ssS'http/tests/media/remove-while-loading.html'
-p601
-(dp602
-g8
-S'Test that removing a media element from the tree while loading does not crash.'
-p603
-ssS'media/video-controls-transformed.html'
-p604
-(dp605
-g8
-S'This test only runs in DRT!'
-p606
-ssS'compositing/video/video-poster.html'
-p607
-(dp608
-g8
-S'Video with poster'
-p609
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p610
-(dp611
-g8
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p612
-ssS'media/video-display-toggle.html'
-p613
-(dp614
-g8
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p615
-ssS'media/video-seek-no-src-exception.html'
-p616
-(dp617
-g8
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p618
-ssS'media/audio-constructor-src.html'
-p619
-(dp620
-g8
-S'Test that Audio("url") constructor loads the specified resource.'
-p621
-ssS'compositing/geometry/clipped-video-controller.html'
-p622
-(dp623
-g8
-S'Clipped Video'
-p624
-ssS'media/video-preload.html'
-p625
-(dp626
-g8
-S"Test to see if media loads automatically when 'preload' is specified."
-p627
-ssS'http/tests/media/video-load-twice.html'
-p628
-(dp629
-g8
-g69
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p630
-(dp631
-g8
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p632
-ssS'media/video-seek-past-end-playing.html'
-p633
-(dp634
-g8
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p635
-ssS'media/video-source.html'
-p636
-(dp637
-g8
-g69
-ssS'http/tests/media/reload-after-dialog.html'
-p638
-(dp639
-g8
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p640
-ssS'media/media-constants.html'
-p641
-(dp642
-g8
-S'Test HTMLMediaElement and MediaError constants.'
-p643
-ssS'media/video-volume.html'
-p644
-(dp645
-g8
-S"Test 'volume' attribute"
-p646
-ssS'media/video-src-source.html'
-p647
-(dp648
-g8
-g69
-ssS'http/tests/appcache/video.html'
-p649
-(dp650
-g8
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p651
-ssg53
-g54
-sg67
-g68
-sS'media/video-canvas-source.html'
-p652
-(dp653
-g8
-S'Drawing to canvas using video with source element does not taint canvas'
-p654
-ssS'media/video-controls-no-scripting.html'
-p655
-(dp656
-g8
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p657
-ssS'media/video-poster-scale.html'
-p658
-(dp659
-g8
-S"'poster' aspect ratio test"
-p660
-ssS'media/video-seek-by-small-increment.html'
-p661
-(dp662
-g8
-S'Test seeking by very small increments.'
-p663
-ssS'media/video-controls-with-mutation-event-handler.html'
-p664
-(dp665
-g8
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p666
-ssS'media/video-zoom-controls.html'
-p667
-(dp668
-g8
-S'Zoomed video with controls.'
-p669
-ssS'media/video-loop.html'
-p670
-(dp671
-g8
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p672
-sg10
-(lp673
-(dp674
-S'WIN'
-p675
-I01
-sg49
-I01
-sg17
-(lp676
-S'BUGCR59415'
-p677
-asg15
-S' BUGCR59415 : cannot repro the flakiness'
-p678
-sg14
-I01
-sg100
-I01
-sassS'http/tests/media/video-play-stall.html'
-p679
-(dp680
-g8
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p681
-sg10
-(lp682
-(dp683
-g100
-I01
-sg17
-(lp684
-S'BUGCR73609'
-p685
-asg15
-S' canplaythrough event is sent too early.'
-p686
-sassS'media/video-seeking.html'
-p687
-(dp688
-g8
-S'Test that seeking attribute is true immediately after a seek,'
-p689
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p690
-(dp691
-g8
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p692
-ssS'media/controls-after-reload.html'
-p693
-(dp694
-g8
-S'Making sure the controller looks ok after a second load().'
-p695
-ssg161
-g162
-sS'media/video-load-networkState.html'
-p696
-(dp697
-g8
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p698
-ssS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p699
-(dp700
-g8
-g69
-ssS'compositing/reflections/load-video-in-reflection.html'
-p701
-(dp702
-g8
-S'You should see a reflected video below, rather than the red video background.'
-p703
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p704
-(dp705
-g8
-S'Video overlay'
-p706
-ssS'media/video-controls-rendering.html'
-p707
-(dp708
-g8
-S'Test controls placement.'
-p709
-sg10
-(lp710
-(dp711
-g72
-I01
-sS'LINUX'
-p712
-I01
-sg17
-(lp713
-S'BUGCR74102'
-p714
-asg15
-S" 2 pixel stretching when rendering some videos with the GPU (Now it's flaky)"
-p715
-sg49
-I01
-sg77
-I01
-sa(dp716
-g44
-I01
-sg72
-I01
-sg17
-(lp717
-S'BUGCR86714'
-p718
-asg15
-g324
-sg76
-I01
-sg77
-I01
-sassS'http/tests/media/video-served-as-text.html'
-p719
-(dp720
-g8
-S"media file served as 'text/plain'"
-p721
-ssS'media/video-pause-empty-events.html'
-p722
-(dp723
-g8
-S'Test that pause() from EMPTY network state triggers load()'
-p724
-ssS'media/video-poster-delayed.html'
-p725
-(dp726
-g8
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p727
-ssS'media/media-load-event.html'
-p728
-(dp729
-g8
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p730
-ssS'http/tests/media/video-error-abort.html'
-p731
-(dp732
-g8
-S"'abort' event test"
-p733
-ssS'media/video-volume-slider.html'
-p734
-(dp735
-g8
-S'Test rendering of volume slider of video tag'
-p736
-ssS'media/video-seek-past-end-paused.html'
-p737
-(dp738
-g8
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p739
-ssS'http/tests/media/video-cookie.html'
-p740
-(dp741
-g8
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p742
-ssS'media/remove-from-document-before-load.html'
-p743
-(dp744
-g8
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p745
-ssg210
-g211
-sS'media/video-duration-known-after-eos.html'
-p746
-(dp747
-g8
-S'Tests that duration is known after playback ended.'
-p748
-ssg213
-g214
-sS'http/tests/media/video-play-stall-before-meta-data.html'
-p749
-(dp750
-g8
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p751
-ssS'media/video-timeupdate-during-playback.html'
-p752
-(dp753
-g8
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p754
-ssS'media/video-single-valid-source.html'
-p755
-(dp756
-g8
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p757
-ssS'media/video-src-invalid-remove.html'
-p758
-(dp759
-g8
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p760
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p761
-(dp762
-g8
-S"This test passes if it doesn't alert failure."
-p763
-ssg197
-g198
-sS'media/video-load-readyState.html'
-p764
-(dp765
-g8
-g69
-sssS'nonskip'
-p766
-(dp767
-g403
-g404
-sg349
-g350
-sg679
-g680
-sg246
-g247
-sg536
-g537
-sg670
-g671
-sg707
-g708
-sg581
-g582
-sg367
-g368
-sg316
-g317
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/result/2011-08-19-21 b/src/cobalt/media/tools/layout_tests/result/2011-08-19-21
deleted file mode 100644
index 9c33ce2..0000000
--- a/src/cobalt/media/tools/layout_tests/result/2011-08-19-21
+++ /dev/null
@@ -1,1883 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/video-does-not-loop.html'
-p6
-(dp7
-S'te_info'
-p8
-(lp9
-(dp10
-S'SKIP'
-p11
-I01
-sS'WONTFIX'
-p12
-I01
-sS'Comments'
-p13
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p14
-sS'TIMEOUT'
-p15
-I01
-sasS'desc'
-p16
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p17
-ssS'media/audio-delete-while-step-button-clicked.html'
-p18
-(dp19
-g8
-(lp20
-(dp21
-S'FAIL'
-p22
-I01
-sg11
-I01
-sS'Bugs'
-p23
-(lp24
-S'BUGCR25375'
-p25
-aS'BUGCR59399'
-p26
-asg13
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p27
-sasg16
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p28
-ssS'media/restore-from-page-cache.html'
-p29
-(dp30
-g8
-(lp31
-(dp32
-g11
-I01
-sg12
-I01
-sg13
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p33
-sg15
-I01
-sg23
-(lp34
-S'BUGCR19635'
-p35
-asasg16
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p36
-ssS'media/context-menu-actions.html'
-p37
-(dp38
-g8
-(lp39
-(dp40
-S'CRASH'
-p41
-I01
-sg11
-I01
-sg23
-(lp42
-S'BUGCR59665'
-p43
-aS'BUGWK45021'
-p44
-asg13
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p45
-sg15
-I01
-sS'PASS'
-p46
-I01
-sasg16
-S'Test the various actions available in the HTML5 media element context-menu.'
-p47
-ssS'media/track/track-webvtt-tc005-headercomment.html'
-p48
-(dp49
-g8
-(lp50
-(dp51
-g11
-I01
-sg13
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p52
-sg15
-I01
-sg23
-(lp53
-S'BUGWK43668'
-p54
-asasg16
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p55
-ssS'http/tests/media/video-cross-site.html'
-p56
-(dp57
-g8
-(lp58
-(dp59
-g11
-I01
-sg13
-S' QuickTime reference movies not supported.'
-p60
-sg15
-I01
-sg46
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'media file redirects to another site'
-p61
-ssS'media/audio-data-url.html'
-p62
-(dp63
-g8
-(lp64
-(dp65
-g11
-I01
-sg23
-(lp66
-S'BUGCR16779'
-p67
-asg13
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test that audio element can use a data: url'
-p69
-ssS'media/video-canvas-alpha.html'
-p70
-(dp71
-g8
-(lp72
-(dp73
-g11
-I01
-sS'IMAGE'
-p74
-I01
-sg23
-(lp75
-S'BUGCR74979'
-p76
-asg13
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p77
-sS'MAC'
-p78
-I01
-sS'GPU'
-p79
-I01
-sasg16
-S'UNKNOWN'
-p80
-ssS'media/video-can-play-type.html'
-p81
-(dp82
-g8
-(lp83
-(dp84
-g11
-I01
-sg23
-(lp85
-S'BUGCR16779'
-p86
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p87
-ssS'media/media-captions.html'
-p88
-(dp89
-g8
-(lp90
-(dp91
-g11
-I01
-sg13
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p92
-sg15
-I01
-sg23
-(lp93
-S'BUGCR28301'
-p94
-asasg16
-S'Test media element close caption API.'
-p95
-ssS'media/video-size-intrinsic-scale.html'
-p96
-(dp97
-g8
-(lp98
-(dp99
-g11
-I01
-sg23
-(lp100
-S'BUGCR16779'
-p101
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'&lt;video&gt; element intrinsic size test'
-p102
-ssS'media/track/track-webvtt-tc011-blanklines.html'
-p103
-(dp104
-g8
-g50
-sg16
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p105
-ssS'media/track/track-webvtt-tc012-outoforder.html'
-p106
-(dp107
-g8
-g50
-sg16
-S'Tests cues that are temporally out of order (we allow this).'
-p108
-ssS'media/track/track-webvtt-tc006-cueidentifiers.html'
-p109
-(dp110
-g8
-g50
-sg16
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p111
-ssS'media/media-can-play-mpeg-audio.html'
-p112
-(dp113
-g8
-(lp114
-(dp115
-g11
-I01
-sg12
-I01
-sg23
-(lp116
-S'BUGCR16779'
-p117
-asg13
-g68
-sS'TEXT'
-p118
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p119
-ssS'media/audio-mpeg4-supported.html'
-p120
-(dp121
-g8
-(lp122
-(dp123
-g11
-I01
-sg23
-(lp124
-S'BUGCR16779'
-p125
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test that the audio element supports M4A files.'
-p126
-ssS'media/track/track-webvtt-tc004-magicheader.html'
-p127
-(dp128
-g8
-g50
-sg16
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p129
-ssS'media/media-fullscreen-not-in-document.html'
-p130
-(dp131
-g8
-(lp132
-(dp133
-g11
-I01
-sg13
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p134
-sg15
-I01
-sg23
-(lp135
-S'BUGCR16735'
-p136
-asasg16
-S'Test media element fullscreen API when an element is not in the DOM.'
-p137
-ssS'media/audio-mpeg-supported.html'
-p138
-(dp139
-g8
-(lp140
-(dp141
-g11
-I01
-sg23
-(lp142
-S'BUGCR16779'
-p143
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test that the audio element supports MPEG files.'
-p144
-ssS'media/track/track-webvtt-tc003-newlines.html'
-p145
-(dp146
-g8
-g50
-sg16
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p147
-ssS'media/video-document-types.html'
-p148
-(dp149
-g8
-(lp150
-(dp151
-g11
-I01
-sg23
-(lp152
-S'BUGCR16779'
-p153
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p154
-ssS'media/track/track-webvtt-tc002-bom.html'
-p155
-(dp156
-g8
-g50
-sg16
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p157
-ssS'media/media-fullscreen-inline.html'
-p158
-(dp159
-g8
-(lp160
-(dp161
-g11
-I01
-sg13
-g134
-sg15
-I01
-sg23
-(lp162
-S'BUGCR16735'
-p163
-asasg16
-S'Test media element fullscreen API when an element is in the DOM.'
-p164
-ssS'media/track/track-webvtt-tc000-empty.html'
-p165
-(dp166
-g8
-g50
-sg16
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p167
-ssS'media/media-can-play-mpeg4-video.html'
-p168
-(dp169
-g8
-(lp170
-(dp171
-g11
-I01
-sg12
-I01
-sg23
-(lp172
-S'BUGWK45102'
-p173
-asg13
-g68
-sg118
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p174
-ssS'compositing/video/video-background-color.html'
-p175
-(dp176
-g8
-(lp177
-(dp178
-g22
-I01
-sg11
-I01
-sg12
-I01
-sg23
-(lp179
-S'BUGWK55519'
-p180
-asg13
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p181
-sasg16
-S'Video with background color'
-p182
-ssS'media/track/track-webvtt-tc010-notimings.html'
-p183
-(dp184
-g8
-g50
-sg16
-S'Tests cue without timings are ignored.'
-p185
-ssS'media/video-timeupdate-reverse-play.html'
-p186
-(dp187
-g8
-(lp188
-(dp189
-g11
-I01
-sg13
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p190
-sg15
-I01
-sg23
-(lp191
-S'BUGCR33099'
-p192
-asasg16
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p193
-ssS'http/tests/media/video-buffered.html'
-p194
-(dp195
-g8
-(lp196
-(dp197
-g11
-I01
-sg23
-(lp198
-S'BUGCR49165'
-p199
-asg13
-S' video.buffered multiple TimeRanges support.'
-p200
-sg46
-I01
-sasg16
-g80
-ssS'media/track/track-webvtt-tc001-utf8.html'
-p201
-(dp202
-g8
-g50
-sg16
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as WebVTT a file (we do allow it, it just looks ugly).'
-p203
-ssS'media/track/track-webvtt-tc013-settings.html'
-p204
-(dp205
-g8
-g50
-sg16
-S'Tests WebVTT settings.'
-p206
-ssS'media/track/track-webvtt-tc007-cuenoid.html'
-p207
-(dp208
-g8
-g50
-sg16
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p209
-ssS'media/track/track-webvtt-tc009-timingshour.html'
-p210
-(dp211
-g8
-g50
-sg16
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p212
-ssS'media/track/track-webvtt-tc008-timingsnohours.html'
-p213
-(dp214
-g8
-g50
-sg16
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p215
-ssS'media/video-element-other-namespace-crash.html'
-p216
-(dp217
-g8
-(lp218
-(dp219
-g11
-I01
-sg12
-I01
-sg13
-g68
-sg15
-I01
-sg23
-(lp220
-S'BUGCR68289'
-p221
-asasg16
-g80
-ssS'media/video-reverse-play-duration.html'
-p222
-(dp223
-g8
-(lp224
-(dp225
-g11
-I01
-sg13
-g190
-sg15
-I01
-sg23
-(lp226
-S'BUGCR33099'
-p227
-asasg16
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p228
-sssS'whole'
-p229
-(dp230
-S'media/video-source-type.html'
-p231
-(dp232
-g16
-S'&lt;source&gt; @type attribute'
-p233
-ssS'media/media-startTime.html'
-p234
-(dp235
-g16
-S"Test the, so far unused, 'startTime' attribute."
-p236
-ssS'media/video-src-set.html'
-p237
-(dp238
-g16
-S'Test that setting src attribute triggers load'
-p239
-ssg18
-g19
-sS'media/video-played-ranges-1.html'
-p240
-(dp241
-g16
-S"Test of the media element 'played' attribute, ranges part 1."
-p242
-ssS'http/tests/media/video-play-stall-seek.html'
-p243
-(dp244
-g8
-(lp245
-(dp246
-g13
-S' Timing out.'
-p247
-sg15
-I01
-sg23
-(lp248
-S'BUGCR78376'
-p249
-asasg16
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p250
-ssg62
-g63
-sg81
-g82
-sg88
-g89
-sS'media/controls-after-reload.html'
-p251
-(dp252
-g16
-S'Making sure the controller looks ok after a second load().'
-p253
-ssS'http/tests/media/video-referer.html'
-p254
-(dp255
-g16
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p256
-ssS'media/video-source-removed.html'
-p257
-(dp258
-g16
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p259
-ssS'media/unsupported-tracks.html'
-p260
-(dp261
-g16
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p262
-ssg120
-g121
-sS'media/audio-no-installed-engines.html'
-p263
-(dp264
-g16
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p265
-ssg130
-g131
-sS'media/video-width-height.html'
-p266
-(dp267
-g16
-g80
-ssS'media/media-blocked-by-willsendrequest.html'
-p268
-(dp269
-g16
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p270
-ssS'media/video-error-does-not-exist.html'
-p271
-(dp272
-g16
-S'Test that the media element is in correct state after load fails.'
-p273
-ssS'media/video-play-pause-events.html'
-p274
-(dp275
-g16
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p276
-ssS'media/video-display-none-crash.html'
-p277
-(dp278
-g16
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p279
-ssS'media/video-src-plus-source.html'
-p280
-(dp281
-g16
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p282
-ssS'media/video-source-none-supported.html'
-p283
-(dp284
-g16
-S'no usable &lt;source&gt; test'
-p285
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p286
-(dp287
-g16
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p288
-ssg6
-g7
-sS'media/video-src.html'
-p289
-(dp290
-g16
-g80
-ssg175
-g176
-sS'media/video-src-invalid-poster.html'
-p291
-(dp292
-g16
-g80
-ssS'media/video-source-inserted.html'
-p293
-(dp294
-g16
-S'networkState after inserting &lt;source&gt; test'
-p295
-ssS'media/media-can-play-octet-stream.html'
-p296
-(dp297
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p298
-ssS'media/constructors.html'
-p299
-(dp300
-g16
-S'Test that media constructors behave consistently.'
-p301
-ssS'media/video-source-media.html'
-p302
-(dp303
-g16
-g80
-ssg194
-g195
-sS'media/video-aspect-ratio.html'
-p304
-(dp305
-g16
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p306
-ssg201
-g202
-sS'media/video-source-type-params.html'
-p307
-(dp308
-g16
-g80
-ssS'fast/canvas/webgl/context-lost.html'
-p309
-(dp310
-g16
-S'debug("Test valid context");'
-p311
-ssS'media/media-can-play-wav-audio.html'
-p312
-(dp313
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p314
-ssS'media/video-source-error.html'
-p315
-(dp316
-g8
-(lp317
-(dp318
-S'DEBUG'
-p319
-I01
-sg118
-I01
-sg23
-(lp320
-S'BUGWK66310'
-p321
-asg13
-S''
-p322
-sg46
-I01
-sasg16
-S'&lt;video&gt; and &lt;source&gt; error test'
-p323
-ssS'media/video-no-audio.html'
-p324
-(dp325
-g16
-S'Movie with no audio track. The volume button should not render.'
-p326
-ssS'media/svg-as-image-with-media-blocked.html'
-p327
-(dp328
-g16
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p329
-ssS'media/video-transformed.html'
-p330
-(dp331
-g16
-S'Test painting of transformed video'
-p332
-ssg207
-g208
-sg213
-g214
-sS'media/video-click-dblckick-standalone.html'
-p333
-(dp334
-g16
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p335
-ssS'media/video-pause-immediately.html'
-p336
-(dp337
-g16
-S'Test that pausing the media element has an immediate effect on the clock.'
-p338
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p339
-(dp340
-g16
-g80
-ssg222
-g223
-sS'http/tests/security/local-video-src-from-remote.html'
-p341
-(dp342
-g16
-S'This test only works in DRT'
-p343
-ssS'media/media-document-audio-repaint.html'
-p344
-(dp345
-g8
-(lp346
-(dp347
-g118
-I01
-sg74
-I01
-sg23
-(lp348
-S'BUGCR75354'
-p349
-aS'BUGWK55718'
-p350
-asg13
-S' This test needs completely new baselines.'
-p351
-sS'IMAGE+TEXT'
-p352
-I01
-sasg16
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p353
-ssS'media/video-controls-in-media-document.html'
-p354
-(dp355
-g16
-g80
-ssS'media/remove-from-document-no-load.html'
-p356
-(dp357
-g16
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p358
-ssS'media/video-currentTime.html'
-p359
-(dp360
-g16
-g80
-ssS'media/video-frame-accurate-seek.html'
-p361
-(dp362
-g8
-(lp363
-(dp364
-g74
-I01
-sg23
-(lp365
-S'BUGCR72223'
-p366
-asg13
-g322
-sg46
-I01
-sasg16
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p367
-ssg29
-g30
-sg37
-g38
-sS'media/video-load-networkState.html'
-p368
-(dp369
-g16
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p370
-ssg48
-g49
-sS'media/controls-css-overload.html'
-p371
-(dp372
-g16
-S"Testing that overloading some controls doesn't crash the browser"
-p373
-ssS'media/video-display-aspect-ratio.html'
-p374
-(dp375
-g16
-g80
-ssS'media/video-currentTime-set.html'
-p376
-(dp377
-g16
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p378
-ssS'media/media-blocked-by-beforeload.html'
-p379
-(dp380
-g8
-(lp381
-(dp382
-g118
-I01
-sg23
-(lp383
-S'BUGWK66310'
-p384
-asg13
-g322
-sg46
-I01
-sasg16
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p385
-ssg106
-g107
-sS'media/video-controls-visible-audio-only.html'
-p386
-(dp387
-g16
-S'This test only runs in DRT!'
-p388
-ssS'http/tests/media/video-play-progress.html'
-p389
-(dp390
-g16
-S'Test that at least one progress event is fired after starting to load the video.'
-p391
-ssg112
-g113
-sS'media/video-source-moved.html'
-p392
-(dp393
-g16
-S'moving &lt;source&gt; element test'
-p394
-ssS'http/tests/security/local-video-source-from-remote.html'
-p395
-(dp396
-g16
-S'This test only behaves correctly in DRT'
-p397
-ssS'media/video-src-none.html'
-p398
-(dp399
-g16
-g80
-ssS'media/video-controls-zoomed.html'
-p400
-(dp401
-g16
-S'This test only runs in DRT!'
-p402
-ssS'media/video-controls.html'
-p403
-(dp404
-g16
-S"Test 'controls' attribute"
-p405
-ssS'media/controls-without-preload.html'
-p406
-(dp407
-g16
-S'The controls should not depend on preload value.'
-p408
-ssS'media/video-played-collapse.html'
-p409
-(dp410
-g16
-S"Test of the media element 'played' attribute"
-p411
-ssS'compositing/self-painting-layers.html'
-p412
-(dp413
-g16
-S'Self painting layers'
-p414
-ssS'media/audio-controls-do-not-fade-out.html'
-p415
-(dp416
-g16
-S'This tests that audio controls do not fade out when the audio is playing.'
-p417
-ssg158
-g159
-sS'compositing/geometry/video-opacity-overlay.html'
-p418
-(dp419
-g16
-S'Video overlay'
-p420
-ssS'media/video-source-error-no-candidate.html'
-p421
-(dp422
-g16
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p423
-ssS'media/audio-constructor.html'
-p424
-(dp425
-g16
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p426
-ssS'media/controls-styling.html'
-p427
-(dp428
-g16
-S'The look of the controls should not change.'
-p429
-ssS'media/event-attributes.html'
-p430
-(dp431
-g16
-g80
-ssg183
-g184
-sg186
-g187
-sS'http/tests/media/text-served-as-text.html'
-p432
-(dp433
-g16
-S"text file served as 'text/plain'"
-p434
-ssS'http/tests/media/video-cancel-load.html'
-p435
-(dp436
-g16
-S'Cancel loading a video file and access its properties afterwards.'
-p437
-ssS'media/unsupported-rtsp.html'
-p438
-(dp439
-g16
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p440
-ssS'media/media-controls-clone.html'
-p441
-(dp442
-g16
-S'<video controls id=v></video><audio controls id=a></audio>'
-p443
-ssS'media/broken-video.html'
-p444
-(dp445
-g16
-S'Test that QuickTime file with broken content generates an error.'
-p446
-ssS'media/video-plays-past-end-of-test.html'
-p447
-(dp448
-g16
-g80
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p449
-(dp450
-g16
-S'WebGL Origin Restrictions Conformance Tests'
-p451
-ssS'media/video-replaces-poster.html'
-p452
-(dp453
-g16
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p454
-ssS'media/video-autoplay.html'
-p455
-(dp456
-g16
-g80
-ssS'media/video-set-rate-from-pause.html'
-p457
-(dp458
-g16
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p459
-ssS'media/video-src-remove.html'
-p460
-(dp461
-g16
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p462
-ssS'media/csp-blocks-video.html'
-p463
-(dp464
-g16
-S"This test passes if it doesn't alert failure."
-p465
-ssS'media/controls-drag-timebar.html'
-p466
-(dp467
-g16
-S'Test that dragging the timebar thumb causes seeks.'
-p468
-ssS'media/audio-constructor-preload.html'
-p469
-(dp470
-g16
-S"Test that Audio() sets 'preload' attribute."
-p471
-ssS'media/video-poster-delayed.html'
-p472
-(dp473
-g16
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p474
-ssS'media/adopt-node-crash.html'
-p475
-(dp476
-g16
-S"Tests that we don't crash when moving a video element to a new document."
-p477
-ssS'media/video-playbackrate.html'
-p478
-(dp479
-g16
-S'test playbackRate and defaultPlaybackRate'
-p480
-ssS'media/video-muted.html'
-p481
-(dp482
-g16
-S"Test 'muted' attribute"
-p483
-ssS'media/video-src-change.html'
-p484
-(dp485
-g16
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p486
-ssS'compositing/overflow/overflow-compositing-descendant.html'
-p487
-(dp488
-g16
-S'You should see a green box under the video. If you see red, the test failed.'
-p489
-ssg216
-g217
-sS'media/video-play-pause-exception.html'
-p490
-(dp491
-g16
-S'Video has no src. Test that the playing event is not dispatched.'
-p492
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p493
-(dp494
-g16
-g80
-ssS'media/audio-play-event.html'
-p495
-(dp496
-g16
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p497
-ssS'media/before-load-member-access.html'
-p498
-(dp499
-g16
-S'Test that accessing member of a non loaded video works.'
-p500
-ssS'media/video-dom-src.html'
-p501
-(dp502
-g16
-g80
-ssS'media/audio-repaint.html'
-p503
-(dp504
-g16
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p505
-ssS'media/audio-controls-rendering.html'
-p506
-(dp507
-g16
-S'Test controls placement.'
-p508
-ssg204
-g205
-sS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p509
-(dp510
-g16
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p511
-ssS'media/invalid-media-url-crash.html'
-p512
-(dp513
-g16
-S'Tests that invalid media src url does not result in crash.'
-p514
-ssS'media/video-empty-source.html'
-p515
-(dp516
-g16
-S'Slider drawing with no source. The controls should render correctly.'
-p517
-ssg96
-g97
-sS'media/video-poster.html'
-p518
-(dp519
-g16
-S'Test &lt;video&gt; element with and without a poster.'
-p520
-ssS'media/media-document-audio-size.html'
-p521
-(dp522
-g16
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p523
-ssS'media/video-zoom.html'
-p524
-(dp525
-g8
-(lp526
-(dp527
-g41
-I01
-sg74
-I01
-sg23
-(lp528
-S'BUGCR86714'
-p529
-asg13
-g322
-sg78
-I01
-sg79
-I01
-sasg16
-S'150% zoom, with width and height attributes'
-p530
-ssg103
-g104
-sS'http/tests/appcache/video.html'
-p531
-(dp532
-g16
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p533
-ssS'media/video-dom-autoplay.html'
-p534
-(dp535
-g16
-g80
-ssS'media/media-ended.html'
-p536
-(dp537
-g16
-S'<b>Test ended by:</b>'
-p538
-ssS'media/video-no-autoplay.html'
-p539
-(dp540
-g16
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p541
-ssg138
-g139
-sS'media/video-append-source.html'
-p542
-(dp543
-g16
-g80
-ssg145
-g146
-sS'http/tests/media/pdf-served-as-pdf.html'
-p544
-(dp545
-g16
-S"PDF file served as 'application/pdf'"
-p546
-ssS'media/video-play-empty-events.html'
-p547
-(dp548
-g16
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p549
-ssg155
-g156
-sS'media/audio-only-video-intrinsic-size.html'
-p550
-(dp551
-g16
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p552
-ssg148
-g149
-sS'media/audio-delete-while-slider-thumb-clicked.html'
-p553
-(dp554
-g16
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p555
-ssS'media/media-can-play-ogg.html'
-p556
-(dp557
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p558
-ssg127
-g128
-sg165
-g166
-sS'media/video-currentTime-set2.html'
-p559
-(dp560
-g16
-g80
-ssS'media/video-seekable.html'
-p561
-(dp562
-g16
-g80
-ssS'fast/dom/beforeload/video-before-load.html'
-p563
-(dp564
-g16
-g80
-ssS'media/video-played-reset.html'
-p565
-(dp566
-g16
-S"Test of the media element 'played' attribute"
-p567
-ssS'compositing/self-painting-layers2.html'
-p568
-(dp569
-g16
-S'This test should not assert in debug builds.'
-p570
-ssS'media/controls-right-click-on-timebar.html'
-p571
-(dp572
-g16
-S'Test that right clicking on the timebar does not cause a seek.'
-p573
-ssS'media/video-dom-preload.html'
-p574
-(dp575
-g16
-S'consoleWrite("++ Test default attribute value");'
-p576
-ssS'media/video-size.html'
-p577
-(dp578
-g16
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p579
-ssS'media/video-load-preload-none.html'
-p580
-(dp581
-g16
-S'Test that an explicit load() to a media element whose preload is set to "none" still loads the video.'
-p582
-ssS'media/video-delay-load-event.html'
-p583
-(dp584
-g8
-(lp585
-(dp586
-g118
-I01
-sg23
-(lp587
-S'BUGWK64003'
-p588
-asg13
-S' Started around WebKit r90233:r90242'
-p589
-sg78
-I01
-sg46
-I01
-sg319
-I01
-sasg16
-S"Test the document's load event is delayed until a movie's meta data is available."
-p590
-ssS'media/fallback.html'
-p591
-(dp592
-g16
-S'Test that fallback content is not rendered'
-p593
-ssS'media/video-layer-crash.html'
-p594
-(dp595
-g16
-S'Test dynamic removal of transformed and reflected video'
-p596
-ssS'fast/layers/video-layer.html'
-p597
-(dp598
-g16
-S'Video element gets layer'
-p599
-ssS'media/controls-strict.html'
-p600
-(dp601
-g16
-S'Drawing the controls in strict mode.'
-p602
-ssS'media/remove-from-document.html'
-p603
-(dp604
-g16
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p605
-ssS'http/tests/media/remove-while-loading.html'
-p606
-(dp607
-g16
-S'Test that removing a media element from the tree while loading does not crash.'
-p608
-ssS'media/video-controls-transformed.html'
-p609
-(dp610
-g16
-S'This test only runs in DRT!'
-p611
-ssS'compositing/video/video-poster.html'
-p612
-(dp613
-g16
-S'Video with poster'
-p614
-ssS'media/video-display-toggle.html'
-p615
-(dp616
-g16
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p617
-ssS'media/video-seek-no-src-exception.html'
-p618
-(dp619
-g16
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p620
-ssS'media/audio-constructor-src.html'
-p621
-(dp622
-g16
-S'Test that Audio("url") constructor loads the specified resource.'
-p623
-ssS'compositing/geometry/clipped-video-controller.html'
-p624
-(dp625
-g16
-S'Clipped Video'
-p626
-ssS'media/video-preload.html'
-p627
-(dp628
-g16
-S"Test to see if media loads automatically when 'preload' is specified."
-p629
-ssS'http/tests/media/video-load-twice.html'
-p630
-(dp631
-g16
-g80
-ssS'http/tests/media/video-cookie.html'
-p632
-(dp633
-g16
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p634
-ssS'media/video-source.html'
-p635
-(dp636
-g16
-g80
-ssS'media/video-seek-past-end-playing.html'
-p637
-(dp638
-g16
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p639
-ssS'media/video-currentTime-delay.html'
-p640
-(dp641
-g16
-S'Test a delay in playing the movie results in a canPlay event.'
-p642
-ssS'http/tests/media/reload-after-dialog.html'
-p643
-(dp644
-g16
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p645
-ssS'media/media-constants.html'
-p646
-(dp647
-g16
-S'Test HTMLMediaElement and MediaError constants.'
-p648
-ssS'media/video-volume.html'
-p649
-(dp650
-g16
-S"Test 'volume' attribute"
-p651
-ssS'media/video-src-source.html'
-p652
-(dp653
-g16
-g80
-ssS'media/video-buffered.html'
-p654
-(dp655
-g16
-g80
-ssg56
-g57
-sg70
-g71
-sS'media/video-canvas-source.html'
-p656
-(dp657
-g16
-S'Drawing to canvas using video with source element does not taint canvas'
-p658
-ssS'media/video-controls-no-scripting.html'
-p659
-(dp660
-g16
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p661
-ssS'media/video-poster-scale.html'
-p662
-(dp663
-g16
-S"'poster' aspect ratio test"
-p664
-ssS'media/video-seek-by-small-increment.html'
-p665
-(dp666
-g16
-S'Test seeking by very small increments.'
-p667
-ssS'media/video-controls-with-mutation-event-handler.html'
-p668
-(dp669
-g16
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p670
-ssS'media/video-zoom-controls.html'
-p671
-(dp672
-g16
-S'Zoomed video with controls.'
-p673
-ssS'media/video-loop.html'
-p674
-(dp675
-g8
-(lp676
-(dp677
-S'WIN'
-p678
-I01
-sg46
-I01
-sg23
-(lp679
-S'BUGCR59415'
-p680
-asg13
-S' BUGCR59415 : cannot repro the flakiness'
-p681
-sg15
-I01
-sg118
-I01
-sasg16
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p682
-ssS'http/tests/media/video-play-stall.html'
-p683
-(dp684
-g8
-(lp685
-(dp686
-g118
-I01
-sg23
-(lp687
-S'BUGCR73609'
-p688
-asg13
-S' canplaythrough event is sent too early.'
-p689
-sasg16
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p690
-ssS'media/video-seeking.html'
-p691
-(dp692
-g16
-S'Test that seeking attribute is true immediately after a seek,'
-p693
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p694
-(dp695
-g16
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p696
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p697
-(dp698
-g16
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p699
-ssg168
-g169
-sS'media/media-controls-clone-crash.html'
-p700
-(dp701
-g16
-S'Test passes if it does not crash.'
-p702
-ssS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p703
-(dp704
-g16
-g80
-ssS'compositing/reflections/load-video-in-reflection.html'
-p705
-(dp706
-g16
-S'You should see a reflected video below, rather than the red video background.'
-p707
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p708
-(dp709
-g16
-S'Video overlay'
-p710
-ssS'media/video-controls-rendering.html'
-p711
-(dp712
-g8
-(lp713
-(dp714
-g74
-I01
-sS'LINUX'
-p715
-I01
-sg23
-(lp716
-S'BUGCR74102'
-p717
-asg13
-S" 2 pixel stretching when rendering some videos with the GPU (Now it's flaky)"
-p718
-sg46
-I01
-sg79
-I01
-sa(dp719
-g41
-I01
-sg74
-I01
-sg23
-(lp720
-S'BUGCR86714'
-p721
-asg13
-g322
-sg78
-I01
-sg79
-I01
-sasg16
-S'Test controls placement.'
-p722
-ssS'http/tests/media/video-served-as-text.html'
-p723
-(dp724
-g16
-S"media file served as 'text/plain'"
-p725
-ssS'media/video-pause-empty-events.html'
-p726
-(dp727
-g16
-S'Test that pause() from EMPTY network state triggers load()'
-p728
-ssS'media/media-load-event.html'
-p729
-(dp730
-g16
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p731
-ssS'http/tests/media/video-error-abort.html'
-p732
-(dp733
-g16
-S"'abort' event test"
-p734
-ssS'media/video-volume-slider.html'
-p735
-(dp736
-g16
-S'Test rendering of volume slider of video tag'
-p737
-ssS'media/video-seek-past-end-paused.html'
-p738
-(dp739
-g16
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p740
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p741
-(dp742
-g16
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p743
-ssS'media/remove-from-document-before-load.html'
-p744
-(dp745
-g16
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p746
-ssg210
-g211
-sS'media/video-duration-known-after-eos.html'
-p747
-(dp748
-g16
-S'Tests that duration is known after playback ended.'
-p749
-ssg109
-g110
-sS'http/tests/media/video-play-stall-before-meta-data.html'
-p750
-(dp751
-g16
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p752
-ssS'media/video-timeupdate-during-playback.html'
-p753
-(dp754
-g16
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p755
-ssS'media/video-single-valid-source.html'
-p756
-(dp757
-g16
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p758
-ssS'media/video-src-invalid-remove.html'
-p759
-(dp760
-g16
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p761
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p762
-(dp763
-g16
-S"This test passes if it doesn't alert failure."
-p764
-ssS'media/video-load-readyState.html'
-p765
-(dp766
-g16
-g80
-sssS'nonskip'
-p767
-(dp768
-g344
-g345
-sg361
-g362
-sg711
-g712
-sg243
-g244
-sg524
-g525
-sg674
-g675
-sg683
-g684
-sg583
-g584
-sg379
-g380
-sg315
-g316
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/result/2011-09-11-18 b/src/cobalt/media/tools/layout_tests/result/2011-09-11-18
deleted file mode 100644
index c3a55b4..0000000
--- a/src/cobalt/media/tools/layout_tests/result/2011-09-11-18
+++ /dev/null
@@ -1,2033 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/video-does-not-loop.html'
-p6
-(dp7
-S'te_info'
-p8
-(lp9
-(dp10
-S'SKIP'
-p11
-I01
-sS'WONTFIX'
-p12
-I01
-sS'Comments'
-p13
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p14
-sS'TIMEOUT'
-p15
-I01
-sasS'desc'
-p16
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p17
-ssS'media/track/track-webvtt-tc020-cue-size-align.html'
-p18
-(dp19
-g8
-(lp20
-(dp21
-g11
-I01
-sg13
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p22
-sg15
-I01
-sS'Bugs'
-p23
-(lp24
-S'BUGWK43668'
-p25
-asasg16
-S'Tests cue size and alignment from settings.'
-p26
-ssS'media/audio-delete-while-step-button-clicked.html'
-p27
-(dp28
-g8
-(lp29
-(dp30
-S'FAIL'
-p31
-I01
-sg11
-I01
-sg23
-(lp32
-S'BUGCR25375'
-p33
-aS'BUGCR59399'
-p34
-asg13
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p35
-sasg16
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p36
-ssS'media/restore-from-page-cache.html'
-p37
-(dp38
-g8
-(lp39
-(dp40
-g11
-I01
-sg12
-I01
-sg13
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p41
-sg15
-I01
-sasg16
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p42
-ssS'media/media-document-audio-repaint.html'
-p43
-(dp44
-g8
-(lp45
-(dp46
-S'IMAGE+TEXT'
-p47
-I01
-sg11
-I01
-sS'IMAGE'
-p48
-I01
-sg23
-(lp49
-S'BUGCR94918'
-p50
-asg13
-S' Skip test test since this test uses layoutTestController.display() that needs to be implemented for GPU'
-p51
-sS'TEXT'
-p52
-I01
-sS'GPU'
-p53
-I01
-sasg16
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p54
-ssS'media/media-can-play-mpeg4-video.html'
-p55
-(dp56
-g8
-(lp57
-(dp58
-g11
-I01
-sg12
-I01
-sg13
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p59
-sg52
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p60
-ssS'media/track/track-webvtt-tc007-cue-no-id.html'
-p61
-(dp62
-g8
-g20
-sg16
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p63
-ssS'http/tests/media/video-cross-site.html'
-p64
-(dp65
-g8
-(lp66
-(dp67
-g11
-I01
-sg13
-S' QuickTime reference movies not supported.'
-p68
-sg15
-I01
-sS'PASS'
-p69
-I01
-sg31
-I01
-sg12
-I01
-sasg16
-S'media file redirects to another site'
-p70
-ssS'media/audio-data-url.html'
-p71
-(dp72
-g8
-(lp73
-(dp74
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test that audio element can use a data: url'
-p75
-ssS'media/video-canvas-alpha.html'
-p76
-(dp77
-g8
-(lp78
-(dp79
-g11
-I01
-sg48
-I01
-sg23
-(lp80
-S'BUGCR74979'
-p81
-asg13
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p82
-sS'MAC'
-p83
-I01
-sg53
-I01
-sasg16
-S'UNKNOWN'
-p84
-ssS'media/video-can-play-type.html'
-p85
-(dp86
-g8
-(lp87
-(dp88
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p89
-ssS'media/media-captions.html'
-p90
-(dp91
-g8
-(lp92
-(dp93
-g11
-I01
-sg13
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p94
-sg15
-I01
-sg23
-(lp95
-S'BUGCR28301'
-p96
-asasg16
-S'Test media element close caption API.'
-p97
-ssS'media/video-size-intrinsic-scale.html'
-p98
-(dp99
-g8
-(lp100
-(dp101
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'&lt;video&gt; element intrinsic size test'
-p102
-ssS'media/track/track-webvtt-tc004-magic-header.html'
-p103
-(dp104
-g8
-g20
-sg16
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p105
-ssS'media/media-can-play-mpeg-audio.html'
-p106
-(dp107
-g8
-(lp108
-(dp109
-g11
-I01
-sg12
-I01
-sg13
-g59
-sg52
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p110
-ssS'media/audio-mpeg4-supported.html'
-p111
-(dp112
-g8
-(lp113
-(dp114
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test that the audio element supports M4A files.'
-p115
-ssS'media/media-fullscreen-not-in-document.html'
-p116
-(dp117
-g8
-(lp118
-(dp119
-g11
-I01
-sg13
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p120
-sg15
-I01
-sg23
-(lp121
-S'BUGCR16735'
-p122
-asasg16
-S'Test media element fullscreen API when an element is not in the DOM.'
-p123
-ssS'media/track/track-webvtt-tc014-alignment.html'
-p124
-(dp125
-g8
-g20
-sg16
-S'Tests cue alignment from settings.'
-p126
-ssS'media/track/track-webvtt-tc021-valign.html'
-p127
-(dp128
-g8
-g20
-sg16
-S'Tests cue vertical alignment (direction) from settings.'
-p129
-ssS'media/audio-mpeg-supported.html'
-p130
-(dp131
-g8
-(lp132
-(dp133
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test that the audio element supports MPEG files.'
-p134
-ssS'media/track/track-webvtt-tc019-cue-size.html'
-p135
-(dp136
-g8
-g20
-sg16
-S'Tests cue size from settings.'
-p137
-ssS'media/track/track-webvtt-tc003-newlines.html'
-p138
-(dp139
-g8
-g20
-sg16
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p140
-ssS'media/video-document-types.html'
-p141
-(dp142
-g8
-(lp143
-(dp144
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p145
-ssS'media/track/track-webvtt-tc024-timestamp.html'
-p146
-(dp147
-g8
-g20
-sg16
-S'Tests cues with &lt;timestamps&gt; tags.'
-p148
-ssS'media/track/track-webvtt-tc008-timings-no-hours.html'
-p149
-(dp150
-g8
-g20
-sg16
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p151
-ssS'media/media-fullscreen-inline.html'
-p152
-(dp153
-g8
-(lp154
-(dp155
-g11
-I01
-sg13
-g120
-sg15
-I01
-sg23
-(lp156
-S'BUGCR16735'
-p157
-asasg16
-S'Test media element fullscreen API when an element is in the DOM.'
-p158
-ssS'media/track/track-webvtt-tc000-empty.html'
-p159
-(dp160
-g8
-g20
-sg16
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p161
-ssS'media/track/track-webvtt-tc018-align-text-line-position.html'
-p162
-(dp163
-g8
-g20
-sg16
-S'Tests cue alignment, line and text position from settings.'
-p164
-ssS'media/track/track-webvtt-tc002-bom.html'
-p165
-(dp166
-g8
-g20
-sg16
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p167
-ssS'compositing/video/video-background-color.html'
-p168
-(dp169
-g8
-(lp170
-(dp171
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p172
-sasg16
-S'Video with background color'
-p173
-ssS'media/track/track-webvtt-tc026-voice.html'
-p174
-(dp175
-g8
-g20
-sg16
-S'Tests cues with voice markup &lt;v&gt;.'
-p176
-ssS'media/track/track-webvtt-tc011-blank-lines.html'
-p177
-(dp178
-g8
-g20
-sg16
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p179
-ssS'media/context-menu-actions.html'
-p180
-(dp181
-g8
-(lp182
-(dp183
-S'CRASH'
-p184
-I01
-sg11
-I01
-sg23
-(lp185
-S'BUGCR59665'
-p186
-aS'BUGWK45021'
-p187
-asg13
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p188
-sg15
-I01
-sg69
-I01
-sasg16
-S'Test the various actions available in the HTML5 media element context-menu.'
-p189
-ssS'media/video-timeupdate-reverse-play.html'
-p190
-(dp191
-g8
-(lp192
-(dp193
-g11
-I01
-sg13
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p194
-sg15
-I01
-sg23
-(lp195
-S'BUGCR33099'
-p196
-asasg16
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p197
-ssS'media/track/track-webvtt-tc022-entities.html'
-p198
-(dp199
-g8
-g20
-sg16
-S'Tests special characters &amp;, &lt;, and &gt; in the cue text.'
-p200
-ssS'http/tests/media/video-buffered.html'
-p201
-(dp202
-g8
-(lp203
-(dp204
-g11
-I01
-sg23
-(lp205
-S'BUGCR49165'
-p206
-asg13
-S' video.buffered multiple TimeRanges support.'
-p207
-sg69
-I01
-sasg16
-g84
-ssS'media/track/track-webvtt-tc012-out-of-order.html'
-p208
-(dp209
-g8
-g20
-sg16
-S'Tests that cues that are temporally out of order are ignored.'
-p210
-ssS'media/track/track-webvtt-tc010-no-timings.html'
-p211
-(dp212
-g8
-g20
-sg16
-S'Tests cue without timings are ignored.'
-p213
-ssS'media/track/track-webvtt-tc001-utf8.html'
-p214
-(dp215
-g8
-g20
-sg16
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as a WebVTT file (we do allow it, it just looks ugly).'
-p216
-ssS'media/track/track-webvtt-tc006-cue-identifiers.html'
-p217
-(dp218
-g8
-g20
-sg16
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p219
-ssS'media/track/track-webvtt-tc013-settings.html'
-p220
-(dp221
-g8
-g20
-sg16
-S'Tests WebVTT settings.'
-p222
-ssS'media/track/track-webvtt-tc017-line-position.html'
-p223
-(dp224
-g8
-g20
-sg16
-S'Tests cue line position from settings.'
-p225
-ssS'media/track/track-webvtt-tc016-align-positioning.html'
-p226
-(dp227
-g8
-g20
-sg16
-S'Tests cue text position and alignment from settings.'
-p228
-ssS'media/track/track-webvtt-tc005-header-comment.html'
-p229
-(dp230
-g8
-g20
-sg16
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p231
-ssS'media/track/track-webvtt-tc015-positioning.html'
-p232
-(dp233
-g8
-g20
-sg16
-S'Tests cue text position from settings.'
-p234
-ssS'media/track/track-webvtt-tc009-timings-hour.html'
-p235
-(dp236
-g8
-g20
-sg16
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p237
-ssS'media/track/track-webvtt-tc027-empty-cue.html'
-p238
-(dp239
-g8
-g20
-sg16
-S'Tests that empty cues are discarded.'
-p240
-ssS'media/track/track-webvtt-tc028-unsupported-markup.html'
-p241
-(dp242
-g8
-g20
-sg16
-S'Tests that unsupported markup is properly ignored.'
-p243
-ssS'media/track/track-webvtt-tc023-markup.html'
-p244
-(dp245
-g8
-g20
-sg16
-S'Tests cues with &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;rt&gt; and &lt;ruby&gt; tags.'
-p246
-ssS'media/video-element-other-namespace-crash.html'
-p247
-(dp248
-g8
-(lp249
-(dp250
-g11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-g84
-ssS'media/video-reverse-play-duration.html'
-p251
-(dp252
-g8
-(lp253
-(dp254
-g11
-I01
-sg13
-g194
-sg15
-I01
-sg23
-(lp255
-S'BUGCR33099'
-p256
-asasg16
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p257
-ssS'media/track/track-webvtt-tc025-class-markup.html'
-p258
-(dp259
-g8
-g20
-sg16
-S'Tests cues with class markup &lt;c&gt;.'
-p260
-sssS'whole'
-p261
-(dp262
-S'media/video-source-type.html'
-p263
-(dp264
-g16
-S'&lt;source&gt; @type attribute'
-p265
-ssS'media/media-startTime.html'
-p266
-(dp267
-g16
-S"Test the, so far unused, 'startTime' attribute."
-p268
-ssS'media/video-src-set.html'
-p269
-(dp270
-g16
-S'Test that setting src attribute triggers load'
-p271
-ssg27
-g28
-sS'media/video-played-ranges-1.html'
-p272
-(dp273
-g16
-S"Test of the media element 'played' attribute, ranges part 1."
-p274
-ssS'http/tests/media/video-play-stall-seek.html'
-p275
-(dp276
-g8
-(lp277
-(dp278
-g13
-S' Timing out.'
-p279
-sg15
-I01
-sg23
-(lp280
-S'BUGCR78376'
-p281
-asasg16
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p282
-ssg71
-g72
-sg85
-g86
-sg90
-g91
-sg124
-g125
-sS'media/controls-after-reload.html'
-p283
-(dp284
-g16
-S'Making sure the controller looks ok after a second load().'
-p285
-ssS'http/tests/media/video-referer.html'
-p286
-(dp287
-g16
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p288
-ssS'media/video-source-removed.html'
-p289
-(dp290
-g16
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p291
-ssS'media/unsupported-tracks.html'
-p292
-(dp293
-g16
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p294
-ssg111
-g112
-sS'media/audio-no-installed-engines.html'
-p295
-(dp296
-g16
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p297
-ssg116
-g117
-sS'media/video-width-height.html'
-p298
-(dp299
-g16
-g84
-ssS'media/media-blocked-by-willsendrequest.html'
-p300
-(dp301
-g16
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p302
-ssS'media/video-error-does-not-exist.html'
-p303
-(dp304
-g16
-S'Test that the media element is in correct state after load fails.'
-p305
-ssS'media/video-play-pause-events.html'
-p306
-(dp307
-g16
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p308
-ssS'media/video-display-none-crash.html'
-p309
-(dp310
-g16
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p311
-ssg244
-g245
-sS'media/video-src-plus-source.html'
-p312
-(dp313
-g16
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p314
-ssS'media/video-source-none-supported.html'
-p315
-(dp316
-g16
-S'no usable &lt;source&gt; test'
-p317
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p318
-(dp319
-g16
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p320
-ssg6
-g7
-sS'media/video-src.html'
-p321
-(dp322
-g16
-g84
-ssg168
-g169
-sS'media/video-src-invalid-poster.html'
-p323
-(dp324
-g16
-g84
-ssS'media/video-source-inserted.html'
-p325
-(dp326
-g16
-S'networkState after inserting &lt;source&gt; test'
-p327
-ssS'media/media-can-play-octet-stream.html'
-p328
-(dp329
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p330
-ssS'media/constructors.html'
-p331
-(dp332
-g16
-S'Test that media constructors behave consistently.'
-p333
-ssS'media/video-source-media.html'
-p334
-(dp335
-g16
-g84
-ssg201
-g202
-sS'media/video-aspect-ratio.html'
-p336
-(dp337
-g16
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p338
-ssg214
-g215
-sS'media/video-source-type-params.html'
-p339
-(dp340
-g16
-g84
-ssS'fast/canvas/webgl/context-lost.html'
-p341
-(dp342
-g16
-S'debug("Test valid context");'
-p343
-ssS'media/media-can-play-wav-audio.html'
-p344
-(dp345
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p346
-ssS'media/video-source-error.html'
-p347
-(dp348
-g8
-(lp349
-(dp350
-S'DEBUG'
-p351
-I01
-sg52
-I01
-sg23
-(lp352
-S'BUGWK66310'
-p353
-asg13
-S''
-p354
-sg69
-I01
-sasg16
-S'&lt;video&gt; and &lt;source&gt; error test'
-p355
-ssg223
-g224
-sg226
-g227
-sS'media/video-no-audio.html'
-p356
-(dp357
-g16
-S'Movie with no audio track. The volume button should not render.'
-p358
-ssS'media/svg-as-image-with-media-blocked.html'
-p359
-(dp360
-g16
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p361
-ssS'media/video-transformed.html'
-p362
-(dp363
-g8
-(lp364
-(dp365
-S'WIN'
-p366
-I01
-sg48
-I01
-sg23
-(lp367
-S'BUGWK66437'
-p368
-asg13
-g354
-sg83
-I01
-sg53
-I01
-sasg16
-S'Test painting of transformed video'
-p369
-ssS'media/video-click-dblckick-standalone.html'
-p370
-(dp371
-g16
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p372
-ssS'media/video-pause-immediately.html'
-p373
-(dp374
-g16
-S'Test that pausing the media element has an immediate effect on the clock.'
-p375
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p376
-(dp377
-g16
-g84
-ssg251
-g252
-sS'http/tests/security/local-video-src-from-remote.html'
-p378
-(dp379
-g16
-S'This test only works in DRT'
-p380
-ssg43
-g44
-sS'media/video-controls-in-media-document.html'
-p381
-(dp382
-g16
-g84
-ssS'media/remove-from-document-no-load.html'
-p383
-(dp384
-g16
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p385
-ssS'media/video-currentTime.html'
-p386
-(dp387
-g16
-g84
-ssS'media/video-frame-accurate-seek.html'
-p388
-(dp389
-g8
-(lp390
-(dp391
-g48
-I01
-sg23
-(lp392
-S'BUGCR72223'
-p393
-asg13
-g354
-sg69
-I01
-sasg16
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p394
-ssg18
-g19
-sg37
-g38
-sg180
-g181
-sS'media/media-controls-clone-crash.html'
-p395
-(dp396
-g16
-S'Test passes if it does not crash.'
-p397
-ssS'media/controls-css-overload.html'
-p398
-(dp399
-g16
-S"Testing that overloading some controls doesn't crash the browser"
-p400
-ssS'media/video-display-aspect-ratio.html'
-p401
-(dp402
-g16
-g84
-ssS'media/video-currentTime-set.html'
-p403
-(dp404
-g16
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p405
-ssS'media/media-blocked-by-beforeload.html'
-p406
-(dp407
-g8
-(lp408
-(dp409
-g52
-I01
-sg23
-(lp410
-S'BUGWK66310'
-p411
-asg13
-g354
-sg69
-I01
-sasg16
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p412
-ssS'media/video-controls-visible-audio-only.html'
-p413
-(dp414
-g16
-S'This test only runs in DRT!'
-p415
-ssS'http/tests/media/video-play-progress.html'
-p416
-(dp417
-g16
-S'Test that at least one progress event is fired after starting to load the video.'
-p418
-ssg106
-g107
-sS'media/controls-styling.html'
-p419
-(dp420
-g16
-S'The look of the controls should not change.'
-p421
-ssS'media/video-source-moved.html'
-p422
-(dp423
-g16
-S'moving &lt;source&gt; element test'
-p424
-ssS'http/tests/security/local-video-source-from-remote.html'
-p425
-(dp426
-g16
-S'This test only behaves correctly in DRT'
-p427
-ssS'media/video-src-none.html'
-p428
-(dp429
-g16
-g84
-ssS'media/video-controls-zoomed.html'
-p430
-(dp431
-g16
-S'This test only runs in DRT!'
-p432
-ssS'media/video-load-networkState.html'
-p433
-(dp434
-g16
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p435
-ssS'media/video-controls.html'
-p436
-(dp437
-g16
-S"Test 'controls' attribute"
-p438
-ssS'media/controls-without-preload.html'
-p439
-(dp440
-g16
-S'The controls should not depend on preload value.'
-p441
-ssS'media/video-played-collapse.html'
-p442
-(dp443
-g16
-S"Test of the media element 'played' attribute"
-p444
-ssS'compositing/self-painting-layers.html'
-p445
-(dp446
-g16
-S'Self painting layers'
-p447
-ssS'media/audio-controls-do-not-fade-out.html'
-p448
-(dp449
-g16
-S'This tests that audio controls do not fade out when the audio is playing.'
-p450
-ssg149
-g150
-sg152
-g153
-sS'compositing/geometry/video-opacity-overlay.html'
-p451
-(dp452
-g16
-S'Video overlay'
-p453
-ssS'media/video-source-error-no-candidate.html'
-p454
-(dp455
-g16
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p456
-ssS'media/audio-constructor.html'
-p457
-(dp458
-g16
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p459
-ssg174
-g175
-sS'media/event-attributes.html'
-p460
-(dp461
-g16
-g84
-ssg190
-g191
-sg208
-g209
-sS'http/tests/media/text-served-as-text.html'
-p462
-(dp463
-g16
-S"text file served as 'text/plain'"
-p464
-ssg211
-g212
-sS'http/tests/media/video-cancel-load.html'
-p465
-(dp466
-g16
-S'Cancel loading a video file and access its properties afterwards.'
-p467
-ssS'media/unsupported-rtsp.html'
-p468
-(dp469
-g16
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p470
-ssS'media/media-controls-clone.html'
-p471
-(dp472
-g16
-S'<video controls id=v></video><audio controls id=a></audio>'
-p473
-ssS'media/broken-video.html'
-p474
-(dp475
-g16
-S'Test that QuickTime file with broken content generates an error.'
-p476
-ssS'media/video-plays-past-end-of-test.html'
-p477
-(dp478
-g16
-g84
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p479
-(dp480
-g16
-S'WebGL Origin Restrictions Conformance Tests'
-p481
-ssS'media/video-replaces-poster.html'
-p482
-(dp483
-g16
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p484
-ssS'media/video-autoplay.html'
-p485
-(dp486
-g16
-g84
-ssS'media/video-set-rate-from-pause.html'
-p487
-(dp488
-g16
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p489
-ssg198
-g199
-sg229
-g230
-sS'media/video-src-remove.html'
-p490
-(dp491
-g16
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p492
-ssS'media/csp-blocks-video.html'
-p493
-(dp494
-g16
-S"This test passes if it doesn't alert failure."
-p495
-ssS'media/controls-drag-timebar.html'
-p496
-(dp497
-g16
-S'Test that dragging the timebar thumb causes seeks.'
-p498
-ssg232
-g233
-sS'media/audio-constructor-preload.html'
-p499
-(dp500
-g16
-S"Test that Audio() sets 'preload' attribute."
-p501
-ssS'media/video-poster-delayed.html'
-p502
-(dp503
-g16
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p504
-ssS'media/adopt-node-crash.html'
-p505
-(dp506
-g16
-S"Tests that we don't crash when moving a video element to a new document."
-p507
-ssS'media/media-initialTime.html'
-p508
-(dp509
-g16
-S"Test the, so far unused, 'initialTime' attribute."
-p510
-ssS'media/video-playbackrate.html'
-p511
-(dp512
-g16
-S'test playbackRate and defaultPlaybackRate'
-p513
-ssS'media/video-muted.html'
-p514
-(dp515
-g16
-S"Test 'muted' attribute"
-p516
-ssg241
-g242
-sS'media/video-src-change.html'
-p517
-(dp518
-g16
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p519
-ssS'compositing/overflow/overflow-compositing-descendant.html'
-p520
-(dp521
-g16
-S'You should see a green box under the video. If you see red, the test failed.'
-p522
-ssg247
-g248
-sS'media/video-play-pause-exception.html'
-p523
-(dp524
-g16
-S'Video has no src. Test that the playing event is not dispatched.'
-p525
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p526
-(dp527
-g16
-g84
-ssS'media/audio-play-event.html'
-p528
-(dp529
-g16
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p530
-ssS'media/before-load-member-access.html'
-p531
-(dp532
-g16
-S'Test that accessing member of a non loaded video works.'
-p533
-ssS'media/video-dom-src.html'
-p534
-(dp535
-g16
-g84
-ssg135
-g136
-sS'media/audio-repaint.html'
-p536
-(dp537
-g8
-(lp538
-(dp539
-g366
-I01
-sg48
-I01
-sg23
-(lp540
-S'BUGWK65203'
-p541
-asg13
-S' These should be rebaselined after the patch lands, as we are now drawing all text with skia (instead of gdi) and in these cases, we have differences in antialiasing (drt specific) or in fractional-baselines (gdi rounds in src space, skia rounds in devices space '
-p542
-sasg16
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p543
-ssS'media/audio-controls-rendering.html'
-p544
-(dp545
-g16
-S'Test controls placement.'
-p546
-ssg220
-g221
-sS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p547
-(dp548
-g16
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p549
-ssS'media/invalid-media-url-crash.html'
-p550
-(dp551
-g16
-S'Tests that invalid media src url does not result in crash.'
-p552
-ssS'media/video-empty-source.html'
-p553
-(dp554
-g16
-S'Slider drawing with no source. The controls should render correctly.'
-p555
-ssg98
-g99
-sS'media/video-poster.html'
-p556
-(dp557
-g16
-S'Test &lt;video&gt; element with and without a poster.'
-p558
-ssS'media/media-document-audio-size.html'
-p559
-(dp560
-g16
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p561
-ssS'media/video-zoom.html'
-p562
-(dp563
-g16
-S'150% zoom, with width and height attributes'
-p564
-ssS'http/tests/appcache/video.html'
-p565
-(dp566
-g16
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p567
-ssg127
-g128
-sS'media/video-dom-autoplay.html'
-p568
-(dp569
-g16
-g84
-ssS'media/media-ended.html'
-p570
-(dp571
-g16
-S'<b>Test ended by:</b>'
-p572
-ssS'media/video-no-autoplay.html'
-p573
-(dp574
-g16
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p575
-ssg130
-g131
-sS'media/video-append-source.html'
-p576
-(dp577
-g16
-g84
-ssg138
-g139
-sS'http/tests/media/pdf-served-as-pdf.html'
-p578
-(dp579
-g16
-S"PDF file served as 'application/pdf'"
-p580
-ssS'media/video-play-empty-events.html'
-p581
-(dp582
-g16
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p583
-ssg146
-g147
-sS'media/audio-only-video-intrinsic-size.html'
-p584
-(dp585
-g16
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p586
-ssg141
-g142
-sS'http/tests/media/video-error-abort.html'
-p587
-(dp588
-g16
-S"'abort' event test"
-p589
-ssS'media/audio-delete-while-slider-thumb-clicked.html'
-p590
-(dp591
-g16
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p592
-ssS'media/media-can-play-ogg.html'
-p593
-(dp594
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p595
-ssg159
-g160
-sS'media/video-currentTime-set2.html'
-p596
-(dp597
-g16
-g84
-ssS'media/video-seekable.html'
-p598
-(dp599
-g16
-g84
-ssS'fast/dom/beforeload/video-before-load.html'
-p600
-(dp601
-g16
-g84
-ssS'media/video-played-reset.html'
-p602
-(dp603
-g16
-S"Test of the media element 'played' attribute"
-p604
-ssg177
-g178
-sS'compositing/self-painting-layers2.html'
-p605
-(dp606
-g16
-S'This test should not assert in debug builds.'
-p607
-ssg165
-g166
-sS'media/controls-right-click-on-timebar.html'
-p608
-(dp609
-g16
-S'Test that right clicking on the timebar does not cause a seek.'
-p610
-ssS'media/video-dom-preload.html'
-p611
-(dp612
-g16
-S'consoleWrite("++ Test default attribute value");'
-p613
-ssS'media/video-size.html'
-p614
-(dp615
-g16
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p616
-ssS'media/video-load-preload-none.html'
-p617
-(dp618
-g16
-S'Test that an explicit load() to a media element whose preload is set to "none" still loads the video.'
-p619
-ssS'media/video-delay-load-event.html'
-p620
-(dp621
-g8
-(lp622
-(dp623
-g52
-I01
-sg23
-(lp624
-S'BUGWK64003'
-p625
-asg13
-S' Started around WebKit r90233:r90242'
-p626
-sg83
-I01
-sg69
-I01
-sg351
-I01
-sasg16
-S"Test the document's load event is delayed until a movie's meta data is available."
-p627
-ssS'media/fallback.html'
-p628
-(dp629
-g16
-S'Test that fallback content is not rendered'
-p630
-ssS'media/video-layer-crash.html'
-p631
-(dp632
-g8
-(lp633
-(dp634
-g366
-I01
-sg48
-I01
-sg23
-(lp635
-S'BUGWK66437'
-p636
-asg13
-g354
-sg83
-I01
-sg53
-I01
-sasg16
-S'Test dynamic removal of transformed and reflected video'
-p637
-ssS'fast/layers/video-layer.html'
-p638
-(dp639
-g16
-S'Video element gets layer'
-p640
-ssS'media/controls-strict.html'
-p641
-(dp642
-g16
-S'Drawing the controls in strict mode.'
-p643
-ssS'media/remove-from-document.html'
-p644
-(dp645
-g16
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p646
-ssS'http/tests/media/remove-while-loading.html'
-p647
-(dp648
-g16
-S'Test that removing a media element from the tree while loading does not crash.'
-p649
-ssS'media/video-controls-transformed.html'
-p650
-(dp651
-g16
-S'This test only runs in DRT!'
-p652
-ssS'compositing/video/video-poster.html'
-p653
-(dp654
-g16
-S'Video with poster'
-p655
-ssS'media/video-display-toggle.html'
-p656
-(dp657
-g16
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p658
-ssS'media/video-seek-no-src-exception.html'
-p659
-(dp660
-g16
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p661
-ssS'media/audio-constructor-src.html'
-p662
-(dp663
-g16
-S'Test that Audio("url") constructor loads the specified resource.'
-p664
-ssS'compositing/geometry/clipped-video-controller.html'
-p665
-(dp666
-g16
-S'Clipped Video'
-p667
-ssg238
-g239
-sS'media/video-preload.html'
-p668
-(dp669
-g16
-S"Test to see if media loads automatically when 'preload' is specified."
-p670
-ssS'http/tests/media/video-load-twice.html'
-p671
-(dp672
-g16
-g84
-ssS'http/tests/media/video-cookie.html'
-p673
-(dp674
-g16
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p675
-ssS'media/video-source.html'
-p676
-(dp677
-g16
-g84
-ssS'media/video-seek-past-end-playing.html'
-p678
-(dp679
-g16
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p680
-ssS'media/video-currentTime-delay.html'
-p681
-(dp682
-g16
-S'Test a delay in playing the movie results in a canPlay event.'
-p683
-ssS'http/tests/media/reload-after-dialog.html'
-p684
-(dp685
-g16
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p686
-ssg217
-g218
-sS'media/media-constants.html'
-p687
-(dp688
-g16
-S'Test HTMLMediaElement and MediaError constants.'
-p689
-ssS'media/media-controls-invalid-url.html'
-p690
-(dp691
-g16
-S'This tests that media element controls are reset to their default state when the src is changed to an invalid url.'
-p692
-ssS'media/video-volume.html'
-p693
-(dp694
-g16
-S"Test 'volume' attribute"
-p695
-ssS'media/video-src-source.html'
-p696
-(dp697
-g16
-g84
-ssS'media/video-buffered.html'
-p698
-(dp699
-g16
-g84
-ssg64
-g65
-sS'media/video-source-load.html'
-p700
-(dp701
-g16
-S'Test that the resource selection algorithm is restarted when load() is called, and that all &lt;source&gt; elements are reconsidered.'
-p702
-ssg76
-g77
-sS'media/video-canvas-source.html'
-p703
-(dp704
-g16
-S'Drawing to canvas using video with source element does not taint canvas'
-p705
-ssS'media/video-controls-no-scripting.html'
-p706
-(dp707
-g16
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p708
-ssS'media/video-poster-scale.html'
-p709
-(dp710
-g16
-S"'poster' aspect ratio test"
-p711
-ssS'media/video-seek-by-small-increment.html'
-p712
-(dp713
-g16
-S'Test seeking by very small increments.'
-p714
-ssg103
-g104
-sS'media/video-controls-with-mutation-event-handler.html'
-p715
-(dp716
-g16
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p717
-ssS'media/video-zoom-controls.html'
-p718
-(dp719
-g16
-S'Zoomed video with controls.'
-p720
-ssS'media/video-loop.html'
-p721
-(dp722
-g8
-(lp723
-(dp724
-g366
-I01
-sg69
-I01
-sg23
-(lp725
-S'BUGCR59415'
-p726
-asg13
-S' BUGCR59415 : cannot repro the flakiness'
-p727
-sg15
-I01
-sg52
-I01
-sasg16
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p728
-ssS'http/tests/media/video-play-stall.html'
-p729
-(dp730
-g8
-(lp731
-(dp732
-g52
-I01
-sg23
-(lp733
-S'BUGCR73609'
-p734
-asg13
-S' canplaythrough event is sent too early.'
-p735
-sasg16
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p736
-ssS'media/video-seeking.html'
-p737
-(dp738
-g16
-S'Test that seeking attribute is true immediately after a seek,'
-p739
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p740
-(dp741
-g16
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p742
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p743
-(dp744
-g16
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p745
-ssg55
-g56
-sg162
-g163
-sS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p746
-(dp747
-g16
-g84
-ssS'compositing/reflections/load-video-in-reflection.html'
-p748
-(dp749
-g16
-S'You should see a reflected video below, rather than the red video background.'
-p750
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p751
-(dp752
-g16
-S'Video overlay'
-p753
-ssS'media/video-controls-rendering.html'
-p754
-(dp755
-g8
-(lp756
-(dp757
-g53
-I01
-sg48
-I01
-sg23
-(lp758
-S'BUGCR94409'
-p759
-asg13
-S' Flaky scrollbar issues'
-p760
-sS'LINUX'
-p761
-I01
-sasg16
-S'Test controls placement.'
-p762
-ssS'http/tests/media/video-served-as-text.html'
-p763
-(dp764
-g16
-S"media file served as 'text/plain'"
-p765
-ssS'media/video-pause-empty-events.html'
-p766
-(dp767
-g16
-S'Test that pause() from EMPTY network state triggers load()'
-p768
-ssg61
-g62
-sS'media/media-load-event.html'
-p769
-(dp770
-g16
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p771
-ssS'media/video-defaultmuted.html'
-p772
-(dp773
-g16
-S'consoleWrite("<br><br><b>*** Test <em>" + (defaultMuted ? "with" : "without") + "</em> \'muted\' content attribute</b><br>");'
-p774
-ssS'media/video-volume-slider.html'
-p775
-(dp776
-g16
-S'Test rendering of volume slider of video tag'
-p777
-ssS'media/video-seek-past-end-paused.html'
-p778
-(dp779
-g16
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p780
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p781
-(dp782
-g16
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p783
-ssS'media/remove-from-document-before-load.html'
-p784
-(dp785
-g16
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p786
-ssS'media/video-duration-known-after-eos.html'
-p787
-(dp788
-g16
-S'Tests that duration is known after playback ended.'
-p789
-ssS'http/tests/media/video-play-stall-before-meta-data.html'
-p790
-(dp791
-g16
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p792
-ssS'media/video-timeupdate-during-playback.html'
-p793
-(dp794
-g16
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p795
-ssS'media/video-single-valid-source.html'
-p796
-(dp797
-g16
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p798
-ssS'media/video-src-invalid-remove.html'
-p799
-(dp800
-g16
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p801
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p802
-(dp803
-g16
-S"This test passes if it doesn't alert failure."
-p804
-ssg235
-g236
-sg258
-g259
-sS'media/video-load-readyState.html'
-p805
-(dp806
-g16
-g84
-sssS'nonskip'
-p807
-(dp808
-g388
-g389
-sg721
-g722
-sg536
-g537
-sg729
-g730
-sg275
-g276
-sg362
-g363
-sg754
-g755
-sg620
-g621
-sg631
-g632
-sg406
-g407
-sg347
-g348
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/result/2011-09-11-19 b/src/cobalt/media/tools/layout_tests/result/2011-09-11-19
deleted file mode 100644
index 8cb3047..0000000
--- a/src/cobalt/media/tools/layout_tests/result/2011-09-11-19
+++ /dev/null
@@ -1,2047 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/video-does-not-loop.html'
-p6
-(dp7
-S'te_info'
-p8
-(lp9
-(dp10
-S'SKIP'
-p11
-I01
-sS'WONTFIX'
-p12
-I01
-sS'Comments'
-p13
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p14
-sS'TIMEOUT'
-p15
-I01
-sasS'desc'
-p16
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p17
-ssS'media/track/track-webvtt-tc020-cue-size-align.html'
-p18
-(dp19
-g8
-(lp20
-(dp21
-g11
-I01
-sg13
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p22
-sg15
-I01
-sS'Bugs'
-p23
-(lp24
-S'BUGWK43668'
-p25
-asasg16
-S'Tests cue size and alignment from settings.'
-p26
-ssS'media/audio-delete-while-step-button-clicked.html'
-p27
-(dp28
-g8
-(lp29
-(dp30
-S'FAIL'
-p31
-I01
-sg11
-I01
-sg23
-(lp32
-S'BUGCR25375'
-p33
-aS'BUGCR59399'
-p34
-asg13
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p35
-sasg16
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p36
-ssS'media/restore-from-page-cache.html'
-p37
-(dp38
-g8
-(lp39
-(dp40
-g11
-I01
-sg12
-I01
-sg13
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p41
-sg15
-I01
-sasg16
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p42
-ssS'media/media-document-audio-repaint.html'
-p43
-(dp44
-g8
-(lp45
-(dp46
-S'IMAGE+TEXT'
-p47
-I01
-sg11
-I01
-sS'IMAGE'
-p48
-I01
-sg23
-(lp49
-S'BUGCR94918'
-p50
-asg13
-S' Skip test test since this test uses layoutTestController.display() that needs to be implemented for GPU'
-p51
-sS'TEXT'
-p52
-I01
-sS'GPU'
-p53
-I01
-sasg16
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p54
-ssS'media/media-can-play-mpeg4-video.html'
-p55
-(dp56
-g8
-(lp57
-(dp58
-g11
-I01
-sg12
-I01
-sg13
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p59
-sg52
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p60
-ssS'media/track/track-webvtt-tc007-cue-no-id.html'
-p61
-(dp62
-g8
-g20
-sg16
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p63
-ssS'http/tests/media/video-cross-site.html'
-p64
-(dp65
-g8
-(lp66
-(dp67
-g11
-I01
-sg13
-S' QuickTime reference movies not supported.'
-p68
-sg15
-I01
-sS'PASS'
-p69
-I01
-sg31
-I01
-sg12
-I01
-sasg16
-S'media file redirects to another site'
-p70
-ssS'media/audio-data-url.html'
-p71
-(dp72
-g8
-(lp73
-(dp74
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test that audio element can use a data: url'
-p75
-ssS'media/video-canvas-alpha.html'
-p76
-(dp77
-g8
-(lp78
-(dp79
-g11
-I01
-sg48
-I01
-sg23
-(lp80
-S'BUGCR74979'
-p81
-asg13
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p82
-sS'MAC'
-p83
-I01
-sg53
-I01
-sasg16
-S'UNKNOWN'
-p84
-ssS'media/video-can-play-type.html'
-p85
-(dp86
-g8
-(lp87
-(dp88
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p89
-ssS'media/media-captions.html'
-p90
-(dp91
-g8
-(lp92
-(dp93
-g11
-I01
-sg13
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p94
-sg15
-I01
-sg23
-(lp95
-S'BUGCR28301'
-p96
-asasg16
-S'Test media element close caption API.'
-p97
-ssS'media/video-size-intrinsic-scale.html'
-p98
-(dp99
-g8
-(lp100
-(dp101
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'&lt;video&gt; element intrinsic size test'
-p102
-ssS'media/track/track-webvtt-tc004-magic-header.html'
-p103
-(dp104
-g8
-g20
-sg16
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p105
-ssS'media/media-can-play-mpeg-audio.html'
-p106
-(dp107
-g8
-(lp108
-(dp109
-g11
-I01
-sg12
-I01
-sg13
-g59
-sg52
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p110
-ssS'media/audio-mpeg4-supported.html'
-p111
-(dp112
-g8
-(lp113
-(dp114
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test that the audio element supports M4A files.'
-p115
-ssS'media/media-fullscreen-not-in-document.html'
-p116
-(dp117
-g8
-(lp118
-(dp119
-g11
-I01
-sg13
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p120
-sg15
-I01
-sg23
-(lp121
-S'BUGCR16735'
-p122
-asasg16
-S'Test media element fullscreen API when an element is not in the DOM.'
-p123
-ssS'media/track/track-webvtt-tc014-alignment.html'
-p124
-(dp125
-g8
-g20
-sg16
-S'Tests cue alignment from settings.'
-p126
-ssS'media/track/track-webvtt-tc021-valign.html'
-p127
-(dp128
-g8
-g20
-sg16
-S'Tests cue vertical alignment (direction) from settings.'
-p129
-ssS'media/audio-mpeg-supported.html'
-p130
-(dp131
-g8
-(lp132
-(dp133
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S'Test that the audio element supports MPEG files.'
-p134
-ssS'media/track/track-webvtt-tc019-cue-size.html'
-p135
-(dp136
-g8
-g20
-sg16
-S'Tests cue size from settings.'
-p137
-ssS'media/track/track-webvtt-tc003-newlines.html'
-p138
-(dp139
-g8
-g20
-sg16
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p140
-ssS'media/video-document-types.html'
-p141
-(dp142
-g8
-(lp143
-(dp144
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p145
-ssS'media/track/track-webvtt-tc024-timestamp.html'
-p146
-(dp147
-g8
-g20
-sg16
-S'Tests cues with &lt;timestamps&gt; tags.'
-p148
-ssS'media/track/track-webvtt-tc008-timings-no-hours.html'
-p149
-(dp150
-g8
-g20
-sg16
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p151
-ssS'media/media-fullscreen-inline.html'
-p152
-(dp153
-g8
-(lp154
-(dp155
-g11
-I01
-sg13
-g120
-sg15
-I01
-sg23
-(lp156
-S'BUGCR16735'
-p157
-asasg16
-S'Test media element fullscreen API when an element is in the DOM.'
-p158
-ssS'media/track/track-webvtt-tc000-empty.html'
-p159
-(dp160
-g8
-g20
-sg16
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p161
-ssS'media/track/track-webvtt-tc018-align-text-line-position.html'
-p162
-(dp163
-g8
-g20
-sg16
-S'Tests cue alignment, line and text position from settings.'
-p164
-ssS'media/track/track-webvtt-tc002-bom.html'
-p165
-(dp166
-g8
-g20
-sg16
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p167
-ssS'compositing/video/video-background-color.html'
-p168
-(dp169
-g8
-(lp170
-(dp171
-g31
-I01
-sg11
-I01
-sg12
-I01
-sg13
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p172
-sasg16
-S'Video with background color'
-p173
-ssS'media/track/track-webvtt-tc026-voice.html'
-p174
-(dp175
-g8
-g20
-sg16
-S'Tests cues with voice markup &lt;v&gt;.'
-p176
-ssS'media/track/track-webvtt-tc011-blank-lines.html'
-p177
-(dp178
-g8
-g20
-sg16
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p179
-ssS'media/context-menu-actions.html'
-p180
-(dp181
-g8
-(lp182
-(dp183
-S'CRASH'
-p184
-I01
-sg11
-I01
-sg23
-(lp185
-S'BUGCR59665'
-p186
-aS'BUGWK45021'
-p187
-asg13
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p188
-sg15
-I01
-sg69
-I01
-sasg16
-S'Test the various actions available in the HTML5 media element context-menu.'
-p189
-ssS'media/video-timeupdate-reverse-play.html'
-p190
-(dp191
-g8
-(lp192
-(dp193
-g11
-I01
-sg13
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p194
-sg15
-I01
-sg23
-(lp195
-S'BUGCR33099'
-p196
-asasg16
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p197
-ssS'media/track/track-webvtt-tc022-entities.html'
-p198
-(dp199
-g8
-g20
-sg16
-S'Tests special characters &amp;, &lt;, and &gt; in the cue text.'
-p200
-ssS'http/tests/media/video-buffered.html'
-p201
-(dp202
-g8
-(lp203
-(dp204
-g11
-I01
-sg23
-(lp205
-S'BUGCR49165'
-p206
-asg13
-S' video.buffered multiple TimeRanges support.'
-p207
-sg69
-I01
-sasg16
-g84
-ssS'media/track/track-webvtt-tc012-out-of-order.html'
-p208
-(dp209
-g8
-g20
-sg16
-S'Tests that cues that are temporally out of order are ignored.'
-p210
-ssS'media/track/track-webvtt-tc010-no-timings.html'
-p211
-(dp212
-g8
-g20
-sg16
-S'Tests cue without timings are ignored.'
-p213
-ssS'media/track/track-webvtt-tc001-utf8.html'
-p214
-(dp215
-g8
-g20
-sg16
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as a WebVTT file (we do allow it, it just looks ugly).'
-p216
-ssS'media/track/track-webvtt-tc006-cue-identifiers.html'
-p217
-(dp218
-g8
-g20
-sg16
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p219
-ssS'media/track/track-webvtt-tc013-settings.html'
-p220
-(dp221
-g8
-g20
-sg16
-S'Tests WebVTT settings.'
-p222
-ssS'media/track/track-webvtt-tc017-line-position.html'
-p223
-(dp224
-g8
-g20
-sg16
-S'Tests cue line position from settings.'
-p225
-ssS'media/track/track-webvtt-tc016-align-positioning.html'
-p226
-(dp227
-g8
-g20
-sg16
-S'Tests cue text position and alignment from settings.'
-p228
-ssS'media/track/track-webvtt-tc005-header-comment.html'
-p229
-(dp230
-g8
-g20
-sg16
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p231
-ssS'media/track/track-webvtt-tc015-positioning.html'
-p232
-(dp233
-g8
-g20
-sg16
-S'Tests cue text position from settings.'
-p234
-ssS'media/track/track-webvtt-tc009-timings-hour.html'
-p235
-(dp236
-g8
-g20
-sg16
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p237
-ssS'media/track/track-webvtt-tc027-empty-cue.html'
-p238
-(dp239
-g8
-g20
-sg16
-S'Tests that empty cues are discarded.'
-p240
-ssS'media/track/track-webvtt-tc028-unsupported-markup.html'
-p241
-(dp242
-g8
-g20
-sg16
-S'Tests that unsupported markup is properly ignored.'
-p243
-ssS'media/track/track-webvtt-tc023-markup.html'
-p244
-(dp245
-g8
-g20
-sg16
-S'Tests cues with &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;rt&gt; and &lt;ruby&gt; tags.'
-p246
-ssS'media/video-element-other-namespace-crash.html'
-p247
-(dp248
-g8
-(lp249
-(dp250
-g11
-I01
-sg12
-I01
-sg13
-g59
-sg15
-I01
-sasg16
-g84
-ssS'media/video-reverse-play-duration.html'
-p251
-(dp252
-g8
-(lp253
-(dp254
-g11
-I01
-sg13
-g194
-sg15
-I01
-sg23
-(lp255
-S'BUGCR33099'
-p256
-asasg16
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p257
-ssS'media/track/track-webvtt-tc025-class-markup.html'
-p258
-(dp259
-g8
-g20
-sg16
-S'Tests cues with class markup &lt;c&gt;.'
-p260
-sssS'whole'
-p261
-(dp262
-S'media/video-source-type.html'
-p263
-(dp264
-g16
-S'&lt;source&gt; @type attribute'
-p265
-ssS'media/media-startTime.html'
-p266
-(dp267
-g16
-S"Test the, so far unused, 'startTime' attribute."
-p268
-ssS'media/video-src-set.html'
-p269
-(dp270
-g16
-S'Test that setting src attribute triggers load'
-p271
-ssg27
-g28
-sS'media/video-played-ranges-1.html'
-p272
-(dp273
-g16
-S"Test of the media element 'played' attribute, ranges part 1."
-p274
-ssS'http/tests/media/video-play-stall-seek.html'
-p275
-(dp276
-g8
-(lp277
-(dp278
-g13
-S' Timing out.'
-p279
-sg15
-I01
-sg23
-(lp280
-S'BUGCR78376'
-p281
-asasg16
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p282
-ssg71
-g72
-sg85
-g86
-sg90
-g91
-sg124
-g125
-sS'media/controls-after-reload.html'
-p283
-(dp284
-g16
-S'Making sure the controller looks ok after a second load().'
-p285
-ssS'http/tests/media/video-referer.html'
-p286
-(dp287
-g16
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p288
-ssS'media/video-source-removed.html'
-p289
-(dp290
-g16
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p291
-ssS'media/unsupported-tracks.html'
-p292
-(dp293
-g16
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p294
-ssg111
-g112
-sS'media/audio-no-installed-engines.html'
-p295
-(dp296
-g16
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p297
-ssg116
-g117
-sS'media/video-width-height.html'
-p298
-(dp299
-g16
-g84
-ssS'media/media-blocked-by-willsendrequest.html'
-p300
-(dp301
-g16
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p302
-ssS'media/video-error-does-not-exist.html'
-p303
-(dp304
-g16
-S'Test that the media element is in correct state after load fails.'
-p305
-ssS'media/video-play-pause-events.html'
-p306
-(dp307
-g16
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p308
-ssS'media/video-display-none-crash.html'
-p309
-(dp310
-g16
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p311
-ssg244
-g245
-sS'media/video-src-plus-source.html'
-p312
-(dp313
-g16
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p314
-ssS'media/video-source-none-supported.html'
-p315
-(dp316
-g16
-S'no usable &lt;source&gt; test'
-p317
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p318
-(dp319
-g16
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p320
-ssg6
-g7
-sS'media/video-src.html'
-p321
-(dp322
-g16
-g84
-ssg168
-g169
-sS'media/video-src-invalid-poster.html'
-p323
-(dp324
-g16
-g84
-ssS'media/video-source-inserted.html'
-p325
-(dp326
-g16
-S'networkState after inserting &lt;source&gt; test'
-p327
-ssS'media/media-can-play-octet-stream.html'
-p328
-(dp329
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p330
-ssS'media/constructors.html'
-p331
-(dp332
-g16
-S'Test that media constructors behave consistently.'
-p333
-ssS'media/video-source-media.html'
-p334
-(dp335
-g16
-g84
-ssg201
-g202
-sS'media/video-aspect-ratio.html'
-p336
-(dp337
-g16
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p338
-ssg214
-g215
-sS'media/video-source-type-params.html'
-p339
-(dp340
-g16
-g84
-ssS'fast/canvas/webgl/context-lost.html'
-p341
-(dp342
-g16
-S'debug("Test valid context");'
-p343
-ssS'media/media-can-play-wav-audio.html'
-p344
-(dp345
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p346
-ssS'media/video-source-error.html'
-p347
-(dp348
-g8
-(lp349
-(dp350
-S'DEBUG'
-p351
-I01
-sg52
-I01
-sg23
-(lp352
-S'BUGWK66310'
-p353
-asg13
-S''
-p354
-sg69
-I01
-sasg16
-S'&lt;video&gt; and &lt;source&gt; error test'
-p355
-ssg223
-g224
-sg226
-g227
-sS'media/video-no-audio.html'
-p356
-(dp357
-g16
-S'Movie with no audio track. The volume button should not render.'
-p358
-ssS'media/svg-as-image-with-media-blocked.html'
-p359
-(dp360
-g16
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p361
-ssS'media/video-transformed.html'
-p362
-(dp363
-g8
-(lp364
-(dp365
-S'WIN'
-p366
-I01
-sg48
-I01
-sg23
-(lp367
-S'BUGWK66437'
-p368
-asg13
-g354
-sg83
-I01
-sg53
-I01
-sasg16
-S'Test painting of transformed video'
-p369
-ssS'media/video-click-dblckick-standalone.html'
-p370
-(dp371
-g16
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p372
-ssS'media/video-pause-immediately.html'
-p373
-(dp374
-g16
-S'Test that pausing the media element has an immediate effect on the clock.'
-p375
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p376
-(dp377
-g16
-g84
-ssg251
-g252
-sS'http/tests/security/local-video-src-from-remote.html'
-p378
-(dp379
-g16
-S'This test only works in DRT'
-p380
-ssg43
-g44
-sS'media/video-controls-in-media-document.html'
-p381
-(dp382
-g16
-g84
-ssS'media/remove-from-document-no-load.html'
-p383
-(dp384
-g16
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p385
-ssS'media/video-currentTime.html'
-p386
-(dp387
-g16
-g84
-ssS'media/video-frame-accurate-seek.html'
-p388
-(dp389
-g8
-(lp390
-(dp391
-g48
-I01
-sg23
-(lp392
-S'BUGCR72223'
-p393
-asg13
-g354
-sg69
-I01
-sasg16
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p394
-ssg18
-g19
-sg37
-g38
-sg180
-g181
-sS'media/media-controls-clone-crash.html'
-p395
-(dp396
-g16
-S'Test passes if it does not crash.'
-p397
-ssS'media/controls-css-overload.html'
-p398
-(dp399
-g16
-S"Testing that overloading some controls doesn't crash the browser"
-p400
-ssS'media/video-display-aspect-ratio.html'
-p401
-(dp402
-g16
-g84
-ssS'media/video-currentTime-set.html'
-p403
-(dp404
-g16
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p405
-ssS'media/media-blocked-by-beforeload.html'
-p406
-(dp407
-g8
-(lp408
-(dp409
-g52
-I01
-sg23
-(lp410
-S'BUGWK66310'
-p411
-asg13
-g354
-sg69
-I01
-sasg16
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p412
-ssS'media/video-controls-visible-audio-only.html'
-p413
-(dp414
-g16
-S'This test only runs in DRT!'
-p415
-ssS'http/tests/media/video-play-progress.html'
-p416
-(dp417
-g16
-S'Test that at least one progress event is fired after starting to load the video.'
-p418
-ssg106
-g107
-sS'media/controls-styling.html'
-p419
-(dp420
-g16
-S'The look of the controls should not change.'
-p421
-ssS'media/video-source-moved.html'
-p422
-(dp423
-g16
-S'moving &lt;source&gt; element test'
-p424
-ssS'http/tests/security/local-video-source-from-remote.html'
-p425
-(dp426
-g16
-S'This test only behaves correctly in DRT'
-p427
-ssS'media/video-src-none.html'
-p428
-(dp429
-g16
-g84
-ssS'media/video-controls-zoomed.html'
-p430
-(dp431
-g16
-S'This test only runs in DRT!'
-p432
-ssS'media/video-load-networkState.html'
-p433
-(dp434
-g16
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p435
-ssS'media/video-controls.html'
-p436
-(dp437
-g16
-S"Test 'controls' attribute"
-p438
-ssS'media/controls-without-preload.html'
-p439
-(dp440
-g16
-S'The controls should not depend on preload value.'
-p441
-ssS'media/video-played-collapse.html'
-p442
-(dp443
-g16
-S"Test of the media element 'played' attribute"
-p444
-ssS'compositing/self-painting-layers.html'
-p445
-(dp446
-g16
-S'Self painting layers'
-p447
-ssS'media/audio-controls-do-not-fade-out.html'
-p448
-(dp449
-g16
-S'This tests that audio controls do not fade out when the audio is playing.'
-p450
-ssg149
-g150
-sg152
-g153
-sS'compositing/geometry/video-opacity-overlay.html'
-p451
-(dp452
-g16
-S'Video overlay'
-p453
-ssS'media/video-source-error-no-candidate.html'
-p454
-(dp455
-g16
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p456
-ssS'media/audio-constructor.html'
-p457
-(dp458
-g16
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p459
-ssg174
-g175
-sS'media/event-attributes.html'
-p460
-(dp461
-g16
-g84
-ssg190
-g191
-sg208
-g209
-sS'http/tests/media/text-served-as-text.html'
-p462
-(dp463
-g16
-S"text file served as 'text/plain'"
-p464
-ssg211
-g212
-sS'http/tests/media/video-cancel-load.html'
-p465
-(dp466
-g16
-S'Cancel loading a video file and access its properties afterwards.'
-p467
-ssS'media/unsupported-rtsp.html'
-p468
-(dp469
-g16
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p470
-ssS'media/media-controls-clone.html'
-p471
-(dp472
-g16
-S'<video controls id=v></video><audio controls id=a></audio>'
-p473
-ssS'media/broken-video.html'
-p474
-(dp475
-g16
-S'Test that QuickTime file with broken content generates an error.'
-p476
-ssS'media/video-plays-past-end-of-test.html'
-p477
-(dp478
-g16
-g84
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p479
-(dp480
-g16
-S'WebGL Origin Restrictions Conformance Tests'
-p481
-ssS'media/video-replaces-poster.html'
-p482
-(dp483
-g16
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p484
-ssS'media/video-autoplay.html'
-p485
-(dp486
-g16
-g84
-ssS'media/video-set-rate-from-pause.html'
-p487
-(dp488
-g16
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p489
-ssg198
-g199
-sg229
-g230
-sS'media/video-src-remove.html'
-p490
-(dp491
-g16
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p492
-ssS'media/csp-blocks-video.html'
-p493
-(dp494
-g16
-S"This test passes if it doesn't alert failure."
-p495
-ssS'media/controls-drag-timebar.html'
-p496
-(dp497
-g16
-S'Test that dragging the timebar thumb causes seeks.'
-p498
-ssg232
-g233
-sS'media/audio-constructor-preload.html'
-p499
-(dp500
-g16
-S"Test that Audio() sets 'preload' attribute."
-p501
-ssS'media/video-poster-delayed.html'
-p502
-(dp503
-g16
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p504
-ssS'media/adopt-node-crash.html'
-p505
-(dp506
-g16
-S"Tests that we don't crash when moving a video element to a new document."
-p507
-ssS'media/media-initialTime.html'
-p508
-(dp509
-g16
-S"Test the, so far unused, 'initialTime' attribute."
-p510
-ssS'media/video-playbackrate.html'
-p511
-(dp512
-g16
-S'test playbackRate and defaultPlaybackRate'
-p513
-ssS'media/video-muted.html'
-p514
-(dp515
-g16
-S"Test 'muted' attribute"
-p516
-ssg241
-g242
-sS'media/video-src-change.html'
-p517
-(dp518
-g16
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p519
-ssS'compositing/overflow/overflow-compositing-descendant.html'
-p520
-(dp521
-g16
-S'You should see a green box under the video. If you see red, the test failed.'
-p522
-ssg247
-g248
-sS'media/video-play-pause-exception.html'
-p523
-(dp524
-g16
-S'Video has no src. Test that the playing event is not dispatched.'
-p525
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p526
-(dp527
-g16
-g84
-ssS'media/audio-play-event.html'
-p528
-(dp529
-g16
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p530
-ssS'media/before-load-member-access.html'
-p531
-(dp532
-g16
-S'Test that accessing member of a non loaded video works.'
-p533
-ssS'media/video-dom-src.html'
-p534
-(dp535
-g16
-g84
-ssg135
-g136
-sS'media/audio-repaint.html'
-p536
-(dp537
-g8
-(lp538
-(dp539
-g366
-I01
-sg48
-I01
-sg23
-(lp540
-S'BUGWK65203'
-p541
-asg13
-S' These should be rebaselined after the patch lands, as we are now drawing all text with skia (instead of gdi) and in these cases, we have differences in antialiasing (drt specific) or in fractional-baselines (gdi rounds in src space, skia rounds in devices space '
-p542
-sasg16
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p543
-ssS'media/audio-controls-rendering.html'
-p544
-(dp545
-g16
-S'Test controls placement.'
-p546
-ssg220
-g221
-sS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p547
-(dp548
-g16
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p549
-ssS'media/invalid-media-url-crash.html'
-p550
-(dp551
-g16
-S'Tests that invalid media src url does not result in crash.'
-p552
-ssS'media/video-empty-source.html'
-p553
-(dp554
-g16
-S'Slider drawing with no source. The controls should render correctly.'
-p555
-ssg98
-g99
-sS'media/video-poster.html'
-p556
-(dp557
-g16
-S'Test &lt;video&gt; element with and without a poster.'
-p558
-ssS'media/media-document-audio-size.html'
-p559
-(dp560
-g16
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p561
-ssS'media/video-zoom.html'
-p562
-(dp563
-g16
-S'150% zoom, with width and height attributes'
-p564
-ssS'http/tests/appcache/video.html'
-p565
-(dp566
-g16
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p567
-ssg127
-g128
-sS'media/video-dom-autoplay.html'
-p568
-(dp569
-g16
-g84
-ssS'media/media-ended.html'
-p570
-(dp571
-g16
-S'<b>Test ended by:</b>'
-p572
-ssS'media/video-no-autoplay.html'
-p573
-(dp574
-g16
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p575
-ssg130
-g131
-sS'media/video-append-source.html'
-p576
-(dp577
-g16
-g84
-ssg138
-g139
-sS'http/tests/media/pdf-served-as-pdf.html'
-p578
-(dp579
-g16
-S"PDF file served as 'application/pdf'"
-p580
-ssS'media/video-play-empty-events.html'
-p581
-(dp582
-g16
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p583
-ssg146
-g147
-sS'media/audio-only-video-intrinsic-size.html'
-p584
-(dp585
-g16
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p586
-ssg141
-g142
-sS'http/tests/media/video-error-abort.html'
-p587
-(dp588
-g16
-S"'abort' event test"
-p589
-ssS'media/audio-delete-while-slider-thumb-clicked.html'
-p590
-(dp591
-g16
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p592
-ssS'media/media-can-play-ogg.html'
-p593
-(dp594
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p595
-ssg159
-g160
-sS'media/video-currentTime-set2.html'
-p596
-(dp597
-g16
-g84
-ssS'media/video-seekable.html'
-p598
-(dp599
-g16
-g84
-ssS'fast/dom/beforeload/video-before-load.html'
-p600
-(dp601
-g16
-g84
-ssS'media/video-played-reset.html'
-p602
-(dp603
-g16
-S"Test of the media element 'played' attribute"
-p604
-ssg177
-g178
-sS'compositing/self-painting-layers2.html'
-p605
-(dp606
-g16
-S'This test should not assert in debug builds.'
-p607
-ssg165
-g166
-sS'media/controls-right-click-on-timebar.html'
-p608
-(dp609
-g16
-S'Test that right clicking on the timebar does not cause a seek.'
-p610
-ssS'media/video-dom-preload.html'
-p611
-(dp612
-g16
-S'consoleWrite("++ Test default attribute value");'
-p613
-ssS'media/video-size.html'
-p614
-(dp615
-g16
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p616
-ssS'media/video-load-preload-none.html'
-p617
-(dp618
-g16
-S'Test that an explicit load() to a media element whose preload is set to "none" still loads the video.'
-p619
-ssS'media/video-delay-load-event.html'
-p620
-(dp621
-g8
-(lp622
-(dp623
-g52
-I01
-sg23
-(lp624
-S'BUGWK64003'
-p625
-asg13
-S' Started around WebKit r90233:r90242'
-p626
-sg83
-I01
-sg69
-I01
-sg351
-I01
-sasg16
-S"Test the document's load event is delayed until a movie's meta data is available."
-p627
-ssS'media/fallback.html'
-p628
-(dp629
-g16
-S'Test that fallback content is not rendered'
-p630
-ssS'media/video-layer-crash.html'
-p631
-(dp632
-g8
-(lp633
-(dp634
-g366
-I01
-sg48
-I01
-sg23
-(lp635
-S'BUGWK66437'
-p636
-asg13
-g354
-sg83
-I01
-sg53
-I01
-sasg16
-S'Test dynamic removal of transformed and reflected video'
-p637
-ssS'fast/layers/video-layer.html'
-p638
-(dp639
-g16
-S'Video element gets layer'
-p640
-ssS'media/controls-strict.html'
-p641
-(dp642
-g16
-S'Drawing the controls in strict mode.'
-p643
-ssS'media/remove-from-document.html'
-p644
-(dp645
-g16
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p646
-ssS'http/tests/media/remove-while-loading.html'
-p647
-(dp648
-g16
-S'Test that removing a media element from the tree while loading does not crash.'
-p649
-ssS'media/video-controls-transformed.html'
-p650
-(dp651
-g16
-S'This test only runs in DRT!'
-p652
-ssS'compositing/video/video-poster.html'
-p653
-(dp654
-g16
-S'Video with poster'
-p655
-ssS'media/video-display-toggle.html'
-p656
-(dp657
-g16
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p658
-ssS'media/video-seek-no-src-exception.html'
-p659
-(dp660
-g16
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p661
-ssS'media/audio-constructor-src.html'
-p662
-(dp663
-g16
-S'Test that Audio("url") constructor loads the specified resource.'
-p664
-ssS'compositing/geometry/clipped-video-controller.html'
-p665
-(dp666
-g16
-S'Clipped Video'
-p667
-ssg238
-g239
-sS'media/video-preload.html'
-p668
-(dp669
-g16
-S"Test to see if media loads automatically when 'preload' is specified."
-p670
-ssS'http/tests/media/video-load-twice.html'
-p671
-(dp672
-g16
-g84
-ssS'http/tests/media/video-cookie.html'
-p673
-(dp674
-g16
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p675
-ssS'media/video-source.html'
-p676
-(dp677
-g16
-g84
-ssS'media/video-seek-past-end-playing.html'
-p678
-(dp679
-g16
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p680
-ssS'media/video-currentTime-delay.html'
-p681
-(dp682
-g16
-S'Test a delay in playing the movie results in a canPlay event.'
-p683
-ssS'http/tests/media/reload-after-dialog.html'
-p684
-(dp685
-g16
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p686
-ssg217
-g218
-sS'media/media-constants.html'
-p687
-(dp688
-g16
-S'Test HTMLMediaElement and MediaError constants.'
-p689
-ssS'media/media-controls-invalid-url.html'
-p690
-(dp691
-g16
-S'This tests that media element controls are reset to their default state when the src is changed to an invalid url.'
-p692
-ssS'media/video-volume.html'
-p693
-(dp694
-g16
-S"Test 'volume' attribute"
-p695
-ssS'media/video-src-source.html'
-p696
-(dp697
-g16
-g84
-ssS'media/video-buffered.html'
-p698
-(dp699
-g16
-g84
-ssg64
-g65
-sS'media/video-source-load.html'
-p700
-(dp701
-g16
-S'Test that the resource selection algorithm is restarted when load() is called, and that all &lt;source&gt; elements are reconsidered.'
-p702
-ssg76
-g77
-sS'media/video-canvas-source.html'
-p703
-(dp704
-g16
-S'Drawing to canvas using video with source element does not taint canvas'
-p705
-ssS'media/video-controls-no-scripting.html'
-p706
-(dp707
-g16
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p708
-ssS'media/video-poster-scale.html'
-p709
-(dp710
-g16
-S"'poster' aspect ratio test"
-p711
-ssS'media/video-seek-by-small-increment.html'
-p712
-(dp713
-g16
-S'Test seeking by very small increments.'
-p714
-ssg103
-g104
-sS'media/video-controls-with-mutation-event-handler.html'
-p715
-(dp716
-g16
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p717
-ssS'media/video-zoom-controls.html'
-p718
-(dp719
-g8
-(lp720
-(dp721
-g52
-I01
-sg23
-(lp722
-S'BUGWK67913'
-p723
-asg13
-S' Failing after r94912.'
-p724
-sasg16
-S'Zoomed video with controls.'
-p725
-ssS'media/video-loop.html'
-p726
-(dp727
-g8
-(lp728
-(dp729
-g366
-I01
-sg69
-I01
-sg23
-(lp730
-S'BUGCR59415'
-p731
-asg13
-S' BUGCR59415 : cannot repro the flakiness'
-p732
-sg15
-I01
-sg52
-I01
-sasg16
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p733
-ssS'http/tests/media/video-play-stall.html'
-p734
-(dp735
-g8
-(lp736
-(dp737
-g52
-I01
-sg23
-(lp738
-S'BUGCR73609'
-p739
-asg13
-S' canplaythrough event is sent too early.'
-p740
-sasg16
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p741
-ssS'media/video-seeking.html'
-p742
-(dp743
-g16
-S'Test that seeking attribute is true immediately after a seek,'
-p744
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p745
-(dp746
-g16
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p747
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p748
-(dp749
-g16
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p750
-ssg55
-g56
-sg162
-g163
-sS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p751
-(dp752
-g16
-g84
-ssS'compositing/reflections/load-video-in-reflection.html'
-p753
-(dp754
-g16
-S'You should see a reflected video below, rather than the red video background.'
-p755
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p756
-(dp757
-g16
-S'Video overlay'
-p758
-ssS'media/video-controls-rendering.html'
-p759
-(dp760
-g8
-(lp761
-(dp762
-g53
-I01
-sg48
-I01
-sg23
-(lp763
-S'BUGCR94409'
-p764
-asg13
-S' Flaky scrollbar issues'
-p765
-sS'LINUX'
-p766
-I01
-sasg16
-S'Test controls placement.'
-p767
-ssS'http/tests/media/video-served-as-text.html'
-p768
-(dp769
-g16
-S"media file served as 'text/plain'"
-p770
-ssS'media/video-pause-empty-events.html'
-p771
-(dp772
-g16
-S'Test that pause() from EMPTY network state triggers load()'
-p773
-ssg61
-g62
-sS'media/media-load-event.html'
-p774
-(dp775
-g16
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p776
-ssS'media/video-defaultmuted.html'
-p777
-(dp778
-g16
-S'consoleWrite("<br><br><b>*** Test <em>" + (defaultMuted ? "with" : "without") + "</em> \'muted\' content attribute</b><br>");'
-p779
-ssS'media/video-volume-slider.html'
-p780
-(dp781
-g16
-S'Test rendering of volume slider of video tag'
-p782
-ssS'media/video-seek-past-end-paused.html'
-p783
-(dp784
-g16
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p785
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p786
-(dp787
-g16
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p788
-ssS'media/remove-from-document-before-load.html'
-p789
-(dp790
-g16
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p791
-ssS'media/video-duration-known-after-eos.html'
-p792
-(dp793
-g16
-S'Tests that duration is known after playback ended.'
-p794
-ssS'http/tests/media/video-play-stall-before-meta-data.html'
-p795
-(dp796
-g16
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p797
-ssS'media/video-timeupdate-during-playback.html'
-p798
-(dp799
-g16
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p800
-ssS'media/video-single-valid-source.html'
-p801
-(dp802
-g16
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p803
-ssS'media/video-src-invalid-remove.html'
-p804
-(dp805
-g16
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p806
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p807
-(dp808
-g16
-S"This test passes if it doesn't alert failure."
-p809
-ssg235
-g236
-sg258
-g259
-sS'media/video-load-readyState.html'
-p810
-(dp811
-g16
-g84
-sssS'nonskip'
-p812
-(dp813
-g388
-g389
-sg726
-g727
-sg536
-g537
-sg734
-g735
-sg275
-g276
-sg362
-g363
-sg759
-g760
-sg620
-g621
-sg718
-g719
-sg631
-g632
-sg406
-g407
-sg347
-g348
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/test_data/base b/src/cobalt/media/tools/layout_tests/test_data/base
deleted file mode 100644
index 59795ca..0000000
--- a/src/cobalt/media/tools/layout_tests/test_data/base
+++ /dev/null
@@ -1,1877 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/video-does-not-loop.html'
-p6
-(dp7
-S'te_info'
-p8
-(lp9
-(dp10
-S'SKIP'
-p11
-I01
-sS'WONTFIX'
-p12
-I01
-sS'Comments'
-p13
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p14
-sS'TIMEOUT'
-p15
-I01
-sasS'desc'
-p16
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p17
-ssS'media/audio-delete-while-step-button-clicked.html'
-p18
-(dp19
-g8
-(lp20
-(dp21
-S'FAIL'
-p22
-I01
-sg11
-I01
-sS'Bugs'
-p23
-(lp24
-S'BUGCR25375'
-p25
-aS'BUGCR59399'
-p26
-asg13
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p27
-sasg16
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p28
-ssS'media/restore-from-page-cache.html'
-p29
-(dp30
-g8
-(lp31
-(dp32
-g11
-I01
-sg12
-I01
-sg13
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p33
-sg15
-I01
-sg23
-(lp34
-S'BUGCR19635'
-p35
-asasg16
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p36
-ssS'media/context-menu-actions.html'
-p37
-(dp38
-g8
-(lp39
-(dp40
-S'CRASH'
-p41
-I01
-sg11
-I01
-sg23
-(lp42
-S'BUGCR59665'
-p43
-aS'BUGWK45021'
-p44
-asg13
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p45
-sg15
-I01
-sS'PASS'
-p46
-I01
-sasg16
-S'Test the various actions available in the HTML5 media element context-menu.'
-p47
-ssS'media/track/track-webvtt-tc005-headercomment.html'
-p48
-(dp49
-g8
-(lp50
-(dp51
-g11
-I01
-sg13
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p52
-sg15
-I01
-sg23
-(lp53
-S'BUGWK43668'
-p54
-asasg16
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p55
-ssS'http/tests/media/video-cross-site.html'
-p56
-(dp57
-g8
-(lp58
-(dp59
-g11
-I01
-sg13
-S' QuickTime reference movies not supported.'
-p60
-sg15
-I01
-sg46
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'media file redirects to another site'
-p61
-ssS'media/audio-data-url.html'
-p62
-(dp63
-g8
-(lp64
-(dp65
-g11
-I01
-sg23
-(lp66
-S'BUGCR16779'
-p67
-asg13
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test that audio element can use a data: url'
-p69
-ssS'media/video-canvas-alpha.html'
-p70
-(dp71
-g8
-(lp72
-(dp73
-g11
-I01
-sS'IMAGE'
-p74
-I01
-sg23
-(lp75
-S'BUGCR74979'
-p76
-asg13
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p77
-sS'MAC'
-p78
-I01
-sS'GPU'
-p79
-I01
-sasg16
-S'UNKNOWN'
-p80
-ssS'media/video-can-play-type.html'
-p81
-(dp82
-g8
-(lp83
-(dp84
-g11
-I01
-sg23
-(lp85
-S'BUGCR16779'
-p86
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p87
-ssS'media/media-captions.html'
-p88
-(dp89
-g8
-(lp90
-(dp91
-g11
-I01
-sg13
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p92
-sg15
-I01
-sg23
-(lp93
-S'BUGCR28301'
-p94
-asasg16
-S'Test media element close caption API.'
-p95
-ssS'media/video-size-intrinsic-scale.html'
-p96
-(dp97
-g8
-(lp98
-(dp99
-g11
-I01
-sg23
-(lp100
-S'BUGCR16779'
-p101
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'&lt;video&gt; element intrinsic size test'
-p102
-ssS'media/track/track-webvtt-tc011-blanklines.html'
-p103
-(dp104
-g8
-g50
-sg16
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p105
-ssS'media/track/track-webvtt-tc012-outoforder.html'
-p106
-(dp107
-g8
-g50
-sg16
-S'Tests cues that are temporally out of order (we allow this).'
-p108
-ssS'media/track/track-webvtt-tc006-cueidentifiers.html'
-p109
-(dp110
-g8
-g50
-sg16
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p111
-ssS'media/media-can-play-mpeg-audio.html'
-p112
-(dp113
-g8
-(lp114
-(dp115
-g11
-I01
-sg12
-I01
-sg23
-(lp116
-S'BUGCR16779'
-p117
-asg13
-g68
-sS'TEXT'
-p118
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p119
-ssS'media/audio-mpeg4-supported.html'
-p120
-(dp121
-g8
-(lp122
-(dp123
-g11
-I01
-sg23
-(lp124
-S'BUGCR16779'
-p125
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test that the audio element supports M4A files.'
-p126
-ssS'media/track/track-webvtt-tc004-magicheader.html'
-p127
-(dp128
-g8
-g50
-sg16
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p129
-ssS'media/media-fullscreen-not-in-document.html'
-p130
-(dp131
-g8
-(lp132
-(dp133
-g11
-I01
-sg13
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p134
-sg15
-I01
-sg23
-(lp135
-S'BUGCR16735'
-p136
-asasg16
-S'Test media element fullscreen API when an element is not in the DOM.'
-p137
-ssS'media/audio-mpeg-supported.html'
-p138
-(dp139
-g8
-(lp140
-(dp141
-g11
-I01
-sg23
-(lp142
-S'BUGCR16779'
-p143
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S'Test that the audio element supports MPEG files.'
-p144
-ssS'media/track/track-webvtt-tc003-newlines.html'
-p145
-(dp146
-g8
-g50
-sg16
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p147
-ssS'media/video-document-types.html'
-p148
-(dp149
-g8
-(lp150
-(dp151
-g11
-I01
-sg23
-(lp152
-S'BUGCR16779'
-p153
-asg13
-g68
-sg15
-I01
-sg22
-I01
-sg12
-I01
-sasg16
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p154
-ssS'media/track/track-webvtt-tc002-bom.html'
-p155
-(dp156
-g8
-g50
-sg16
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p157
-ssS'media/media-fullscreen-inline.html'
-p158
-(dp159
-g8
-(lp160
-(dp161
-g11
-I01
-sg13
-g134
-sg15
-I01
-sg23
-(lp162
-S'BUGCR16735'
-p163
-asasg16
-S'Test media element fullscreen API when an element is in the DOM.'
-p164
-ssS'media/track/track-webvtt-tc000-empty.html'
-p165
-(dp166
-g8
-g50
-sg16
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p167
-ssS'media/media-can-play-mpeg4-video.html'
-p168
-(dp169
-g8
-(lp170
-(dp171
-g11
-I01
-sg12
-I01
-sg23
-(lp172
-S'BUGWK45102'
-p173
-asg13
-g68
-sg118
-I01
-sasg16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p174
-ssS'compositing/video/video-background-color.html'
-p175
-(dp176
-g8
-(lp177
-(dp178
-g22
-I01
-sg11
-I01
-sg12
-I01
-sg23
-(lp179
-S'BUGWK55519'
-p180
-asg13
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p181
-sasg16
-S'Video with background color'
-p182
-ssS'media/track/track-webvtt-tc010-notimings.html'
-p183
-(dp184
-g8
-g50
-sg16
-S'Tests cue without timings are ignored.'
-p185
-ssS'media/video-timeupdate-reverse-play.html'
-p186
-(dp187
-g8
-(lp188
-(dp189
-g11
-I01
-sg13
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p190
-sg15
-I01
-sg23
-(lp191
-S'BUGCR33099'
-p192
-asasg16
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p193
-ssS'http/tests/media/video-buffered.html'
-p194
-(dp195
-g8
-(lp196
-(dp197
-g11
-I01
-sg23
-(lp198
-S'BUGCR49165'
-p199
-asg13
-S' video.buffered multiple TimeRanges support.'
-p200
-sg46
-I01
-sasg16
-g80
-ssS'media/track/track-webvtt-tc001-utf8.html'
-p201
-(dp202
-g8
-g50
-sg16
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as WebVTT a file (we do allow it, it just looks ugly).'
-p203
-ssS'media/track/track-webvtt-tc013-settings.html'
-p204
-(dp205
-g8
-g50
-sg16
-S'Tests WebVTT settings.'
-p206
-ssS'media/track/track-webvtt-tc007-cuenoid.html'
-p207
-(dp208
-g8
-g50
-sg16
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p209
-ssS'media/track/track-webvtt-tc009-timingshour.html'
-p210
-(dp211
-g8
-g50
-sg16
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p212
-ssS'media/track/track-webvtt-tc008-timingsnohours.html'
-p213
-(dp214
-g8
-g50
-sg16
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p215
-ssS'media/video-element-other-namespace-crash.html'
-p216
-(dp217
-g8
-(lp218
-(dp219
-g11
-I01
-sg12
-I01
-sg13
-g68
-sg15
-I01
-sg23
-(lp220
-S'BUGCR68289'
-p221
-asasg16
-g80
-ssS'media/video-reverse-play-duration.html'
-p222
-(dp223
-g8
-(lp224
-(dp225
-g11
-I01
-sg13
-g190
-sg15
-I01
-sg23
-(lp226
-S'BUGCR33099'
-p227
-asasg16
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p228
-sssS'whole'
-p229
-(dp230
-S'media/video-source-type.html'
-p231
-(dp232
-g16
-S'&lt;source&gt; @type attribute'
-p233
-ssS'media/media-startTime.html'
-p234
-(dp235
-g16
-S"Test the, so far unused, 'startTime' attribute."
-p236
-ssS'media/video-src-set.html'
-p237
-(dp238
-g16
-S'Test that setting src attribute triggers load'
-p239
-ssg18
-g19
-sS'media/video-played-ranges-1.html'
-p240
-(dp241
-g16
-S"Test of the media element 'played' attribute, ranges part 1."
-p242
-ssS'http/tests/media/video-play-stall-seek.html'
-p243
-(dp244
-g8
-(lp245
-(dp246
-g13
-S' Timing out.'
-p247
-sg15
-I01
-sg23
-(lp248
-S'BUGCR78376'
-p249
-asasg16
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p250
-ssg62
-g63
-sg81
-g82
-sg88
-g89
-sS'media/controls-after-reload.html'
-p251
-(dp252
-g16
-S'Making sure the controller looks ok after a second load().'
-p253
-ssS'http/tests/media/video-referer.html'
-p254
-(dp255
-g16
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p256
-ssS'media/video-source-removed.html'
-p257
-(dp258
-g16
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p259
-ssS'media/unsupported-tracks.html'
-p260
-(dp261
-g16
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p262
-ssg120
-g121
-sS'media/audio-no-installed-engines.html'
-p263
-(dp264
-g16
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p265
-ssg130
-g131
-sS'media/video-width-height.html'
-p266
-(dp267
-g16
-g80
-ssS'media/media-blocked-by-willsendrequest.html'
-p268
-(dp269
-g16
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p270
-ssS'media/video-error-does-not-exist.html'
-p271
-(dp272
-g16
-S'Test that the media element is in correct state after load fails.'
-p273
-ssS'media/video-play-pause-events.html'
-p274
-(dp275
-g16
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p276
-ssS'media/video-display-none-crash.html'
-p277
-(dp278
-g16
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p279
-ssS'media/video-src-plus-source.html'
-p280
-(dp281
-g16
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p282
-ssS'media/video-source-none-supported.html'
-p283
-(dp284
-g16
-S'no usable &lt;source&gt; test'
-p285
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p286
-(dp287
-g16
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p288
-ssg6
-g7
-sS'media/video-src.html'
-p289
-(dp290
-g16
-g80
-ssg175
-g176
-sS'media/video-src-invalid-poster.html'
-p291
-(dp292
-g16
-g80
-ssS'media/video-source-inserted.html'
-p293
-(dp294
-g16
-S'networkState after inserting &lt;source&gt; test'
-p295
-ssS'media/media-can-play-octet-stream.html'
-p296
-(dp297
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p298
-ssS'media/constructors.html'
-p299
-(dp300
-g16
-S'Test that media constructors behave consistently.'
-p301
-ssS'media/video-source-media.html'
-p302
-(dp303
-g16
-g80
-ssg194
-g195
-sS'media/video-aspect-ratio.html'
-p304
-(dp305
-g16
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p306
-ssg201
-g202
-sS'media/video-source-type-params.html'
-p307
-(dp308
-g16
-g80
-ssS'fast/canvas/webgl/context-lost.html'
-p309
-(dp310
-g16
-S'debug("Test valid context");'
-p311
-ssS'media/media-can-play-wav-audio.html'
-p312
-(dp313
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p314
-ssS'media/video-source-error.html'
-p315
-(dp316
-g8
-(lp317
-(dp318
-S'DEBUG'
-p319
-I01
-sg118
-I01
-sg23
-(lp320
-S'BUGWK66310'
-p321
-asg13
-S''
-p322
-sg46
-I01
-sasg16
-S'&lt;video&gt; and &lt;source&gt; error test'
-p323
-ssS'media/video-no-audio.html'
-p324
-(dp325
-g16
-S'Movie with no audio track. The volume button should not render.'
-p326
-ssS'media/svg-as-image-with-media-blocked.html'
-p327
-(dp328
-g16
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p329
-ssS'media/video-transformed.html'
-p330
-(dp331
-g16
-S'Test painting of transformed video'
-p332
-ssg207
-g208
-sg213
-g214
-sS'media/video-click-dblckick-standalone.html'
-p333
-(dp334
-g16
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p335
-ssS'media/video-pause-immediately.html'
-p336
-(dp337
-g16
-S'Test that pausing the media element has an immediate effect on the clock.'
-p338
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p339
-(dp340
-g16
-g80
-ssg222
-g223
-sS'http/tests/security/local-video-src-from-remote.html'
-p341
-(dp342
-g16
-S'This test only works in DRT'
-p343
-ssS'media/media-document-audio-repaint.html'
-p344
-(dp345
-g8
-(lp346
-(dp347
-g118
-I01
-sg74
-I01
-sg23
-(lp348
-S'BUGCR75354'
-p349
-aS'BUGWK55718'
-p350
-asg13
-S' This test needs completely new baselines.'
-p351
-sS'IMAGE+TEXT'
-p352
-I01
-sasg16
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p353
-ssS'media/video-controls-in-media-document.html'
-p354
-(dp355
-g16
-g80
-ssS'media/remove-from-document-no-load.html'
-p356
-(dp357
-g16
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p358
-ssS'media/video-currentTime.html'
-p359
-(dp360
-g16
-g80
-ssS'media/video-frame-accurate-seek.html'
-p361
-(dp362
-g8
-(lp363
-(dp364
-g74
-I01
-sg23
-(lp365
-S'BUGCR72223'
-p366
-asg13
-g322
-sg46
-I01
-sasg16
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p367
-ssg29
-g30
-sg37
-g38
-sS'media/video-load-networkState.html'
-p368
-(dp369
-g16
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p370
-ssg48
-g49
-sS'media/controls-css-overload.html'
-p371
-(dp372
-g16
-S"Testing that overloading some controls doesn't crash the browser"
-p373
-ssS'media/video-display-aspect-ratio.html'
-p374
-(dp375
-g16
-g80
-ssS'media/video-currentTime-set.html'
-p376
-(dp377
-g16
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p378
-ssS'media/media-blocked-by-beforeload.html'
-p379
-(dp380
-g8
-(lp381
-(dp382
-g118
-I01
-sg23
-(lp383
-S'BUGWK66310'
-p384
-asg13
-g322
-sg46
-I01
-sasg16
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p385
-ssg106
-g107
-sS'media/video-controls-visible-audio-only.html'
-p386
-(dp387
-g16
-S'This test only runs in DRT!'
-p388
-ssS'http/tests/media/video-play-progress.html'
-p389
-(dp390
-g16
-S'Test that at least one progress event is fired after starting to load the video.'
-p391
-ssg112
-g113
-sS'media/video-source-moved.html'
-p392
-(dp393
-g16
-S'moving &lt;source&gt; element test'
-p394
-ssS'http/tests/security/local-video-source-from-remote.html'
-p395
-(dp396
-g16
-S'This test only behaves correctly in DRT'
-p397
-ssS'media/video-src-none.html'
-p398
-(dp399
-g16
-g80
-ssS'media/video-controls-zoomed.html'
-p400
-(dp401
-g16
-S'This test only runs in DRT!'
-p402
-ssS'media/video-controls.html'
-p403
-(dp404
-g16
-S"Test 'controls' attribute"
-p405
-ssS'media/controls-without-preload.html'
-p406
-(dp407
-g16
-S'The controls should not depend on preload value.'
-p408
-ssS'media/video-played-collapse.html'
-p409
-(dp410
-g16
-S"Test of the media element 'played' attribute"
-p411
-ssS'compositing/self-painting-layers.html'
-p412
-(dp413
-g16
-S'Self painting layers'
-p414
-ssS'media/audio-controls-do-not-fade-out.html'
-p415
-(dp416
-g16
-S'This tests that audio controls do not fade out when the audio is playing.'
-p417
-ssg158
-g159
-sS'compositing/geometry/video-opacity-overlay.html'
-p418
-(dp419
-g16
-S'Video overlay'
-p420
-ssS'media/video-source-error-no-candidate.html'
-p421
-(dp422
-g16
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p423
-ssS'media/audio-constructor.html'
-p424
-(dp425
-g16
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p426
-ssS'media/controls-styling.html'
-p427
-(dp428
-g16
-S'The look of the controls should not change.'
-p429
-ssS'media/event-attributes.html'
-p430
-(dp431
-g16
-g80
-ssg183
-g184
-sg186
-g187
-sS'http/tests/media/text-served-as-text.html'
-p432
-(dp433
-g16
-S"text file served as 'text/plain'"
-p434
-ssS'http/tests/media/video-cancel-load.html'
-p435
-(dp436
-g16
-S'Cancel loading a video file and access its properties afterwards.'
-p437
-ssS'media/unsupported-rtsp.html'
-p438
-(dp439
-g16
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p440
-ssS'media/media-controls-clone.html'
-p441
-(dp442
-g16
-S'<video controls id=v></video><audio controls id=a></audio>'
-p443
-ssS'media/broken-video.html'
-p444
-(dp445
-g16
-S'Test that QuickTime file with broken content generates an error.'
-p446
-ssS'media/video-plays-past-end-of-test.html'
-p447
-(dp448
-g16
-g80
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p449
-(dp450
-g16
-S'WebGL Origin Restrictions Conformance Tests'
-p451
-ssS'media/video-replaces-poster.html'
-p452
-(dp453
-g16
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p454
-ssS'media/video-autoplay.html'
-p455
-(dp456
-g16
-g80
-ssS'media/video-set-rate-from-pause.html'
-p457
-(dp458
-g16
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p459
-ssS'media/video-src-remove.html'
-p460
-(dp461
-g16
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p462
-ssS'media/csp-blocks-video.html'
-p463
-(dp464
-g16
-S"This test passes if it doesn't alert failure."
-p465
-ssS'media/controls-drag-timebar.html'
-p466
-(dp467
-g16
-S'Test that dragging the timebar thumb causes seeks.'
-p468
-ssS'media/audio-constructor-preload.html'
-p469
-(dp470
-g16
-S"Test that Audio() sets 'preload' attribute."
-p471
-ssS'media/video-poster-delayed.html'
-p472
-(dp473
-g16
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p474
-ssS'media/adopt-node-crash.html'
-p475
-(dp476
-g16
-S"Tests that we don't crash when moving a video element to a new document."
-p477
-ssS'media/video-playbackrate.html'
-p478
-(dp479
-g16
-S'test playbackRate and defaultPlaybackRate'
-p480
-ssS'media/video-muted.html'
-p481
-(dp482
-g16
-S"Test 'muted' attribute"
-p483
-ssS'media/video-src-change.html'
-p484
-(dp485
-g16
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p486
-ssS'compositing/overflow/overflow-compositing-descendant.html'
-p487
-(dp488
-g16
-S'You should see a green box under the video. If you see red, the test failed.'
-p489
-ssg216
-g217
-sS'media/video-play-pause-exception.html'
-p490
-(dp491
-g16
-S'Video has no src. Test that the playing event is not dispatched.'
-p492
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p493
-(dp494
-g16
-g80
-ssS'media/audio-play-event.html'
-p495
-(dp496
-g16
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p497
-ssS'media/before-load-member-access.html'
-p498
-(dp499
-g16
-S'Test that accessing member of a non loaded video works.'
-p500
-ssS'media/video-dom-src.html'
-p501
-(dp502
-g16
-g80
-ssS'media/audio-repaint.html'
-p503
-(dp504
-g16
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p505
-ssS'media/audio-controls-rendering.html'
-p506
-(dp507
-g16
-S'Test controls placement.'
-p508
-ssg204
-g205
-sS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p509
-(dp510
-g16
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p511
-ssS'media/invalid-media-url-crash.html'
-p512
-(dp513
-g16
-S'Tests that invalid media src url does not result in crash.'
-p514
-ssS'media/video-empty-source.html'
-p515
-(dp516
-g16
-S'Slider drawing with no source. The controls should render correctly.'
-p517
-ssg96
-g97
-sS'media/video-poster.html'
-p518
-(dp519
-g16
-S'Test &lt;video&gt; element with and without a poster.'
-p520
-ssS'media/media-document-audio-size.html'
-p521
-(dp522
-g16
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p523
-ssS'media/video-zoom.html'
-p524
-(dp525
-g8
-(lp526
-(dp527
-g41
-I01
-sg74
-I01
-sg23
-(lp528
-S'BUGCR86714'
-p529
-asg13
-g322
-sg78
-I01
-sg79
-I01
-sasg16
-S'150% zoom, with width and height attributes'
-p530
-ssg103
-g104
-sS'http/tests/appcache/video.html'
-p531
-(dp532
-g16
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p533
-ssS'media/video-dom-autoplay.html'
-p534
-(dp535
-g16
-g80
-ssS'media/media-ended.html'
-p536
-(dp537
-g16
-S'<b>Test ended by:</b>'
-p538
-ssS'media/video-no-autoplay.html'
-p539
-(dp540
-g16
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p541
-ssg138
-g139
-sS'media/video-append-source.html'
-p542
-(dp543
-g16
-g80
-ssg145
-g146
-sS'http/tests/media/pdf-served-as-pdf.html'
-p544
-(dp545
-g16
-S"PDF file served as 'application/pdf'"
-p546
-ssS'media/video-play-empty-events.html'
-p547
-(dp548
-g16
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p549
-ssg155
-g156
-sS'media/audio-only-video-intrinsic-size.html'
-p550
-(dp551
-g16
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p552
-ssg148
-g149
-sS'media/audio-delete-while-slider-thumb-clicked.html'
-p553
-(dp554
-g16
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p555
-ssS'media/media-can-play-ogg.html'
-p556
-(dp557
-g16
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p558
-ssg127
-g128
-sg165
-g166
-sS'media/video-currentTime-set2.html'
-p559
-(dp560
-g16
-g80
-ssS'media/video-seekable.html'
-p561
-(dp562
-g16
-g80
-ssS'fast/dom/beforeload/video-before-load.html'
-p563
-(dp564
-g16
-g80
-ssS'media/video-played-reset.html'
-p565
-(dp566
-g16
-S"Test of the media element 'played' attribute"
-p567
-ssS'compositing/self-painting-layers2.html'
-p568
-(dp569
-g16
-S'This test should not assert in debug builds.'
-p570
-ssS'media/controls-right-click-on-timebar.html'
-p571
-(dp572
-g16
-S'Test that right clicking on the timebar does not cause a seek.'
-p573
-ssS'media/video-dom-preload.html'
-p574
-(dp575
-g16
-S'consoleWrite("++ Test default attribute value");'
-p576
-ssS'media/video-size.html'
-p577
-(dp578
-g16
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p579
-ssS'media/video-delay-load-event.html'
-p580
-(dp581
-g8
-(lp582
-(dp583
-g118
-I01
-sg23
-(lp584
-S'BUGWK64003'
-p585
-asg13
-S' Started around WebKit r90233:r90242'
-p586
-sg78
-I01
-sg46
-I01
-sg319
-I01
-sasg16
-S"Test the document's load event is delayed until a movie's meta data is available."
-p587
-ssS'media/fallback.html'
-p588
-(dp589
-g16
-S'Test that fallback content is not rendered'
-p590
-ssS'media/video-layer-crash.html'
-p591
-(dp592
-g16
-S'Test dynamic removal of transformed and reflected video'
-p593
-ssS'fast/layers/video-layer.html'
-p594
-(dp595
-g16
-S'Video element gets layer'
-p596
-ssS'media/controls-strict.html'
-p597
-(dp598
-g16
-S'Drawing the controls in strict mode.'
-p599
-ssS'media/remove-from-document.html'
-p600
-(dp601
-g16
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p602
-ssS'http/tests/media/remove-while-loading.html'
-p603
-(dp604
-g16
-S'Test that removing a media element from the tree while loading does not crash.'
-p605
-ssS'media/video-controls-transformed.html'
-p606
-(dp607
-g16
-S'This test only runs in DRT!'
-p608
-ssS'compositing/video/video-poster.html'
-p609
-(dp610
-g16
-S'Video with poster'
-p611
-ssS'media/video-display-toggle.html'
-p612
-(dp613
-g16
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p614
-ssS'media/video-seek-no-src-exception.html'
-p615
-(dp616
-g16
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p617
-ssS'media/audio-constructor-src.html'
-p618
-(dp619
-g16
-S'Test that Audio("url") constructor loads the specified resource.'
-p620
-ssS'compositing/geometry/clipped-video-controller.html'
-p621
-(dp622
-g16
-S'Clipped Video'
-p623
-ssS'media/video-preload.html'
-p624
-(dp625
-g16
-S"Test to see if media loads automatically when 'preload' is specified."
-p626
-ssS'http/tests/media/video-load-twice.html'
-p627
-(dp628
-g16
-g80
-ssS'http/tests/media/video-cookie.html'
-p629
-(dp630
-g16
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p631
-ssS'media/video-source.html'
-p632
-(dp633
-g16
-g80
-ssS'media/video-seek-past-end-playing.html'
-p634
-(dp635
-g16
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p636
-ssS'media/video-currentTime-delay.html'
-p637
-(dp638
-g16
-S'Test a delay in playing the movie results in a canPlay event.'
-p639
-ssS'http/tests/media/reload-after-dialog.html'
-p640
-(dp641
-g16
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p642
-ssS'media/media-constants.html'
-p643
-(dp644
-g16
-S'Test HTMLMediaElement and MediaError constants.'
-p645
-ssS'media/video-volume.html'
-p646
-(dp647
-g16
-S"Test 'volume' attribute"
-p648
-ssS'media/video-src-source.html'
-p649
-(dp650
-g16
-g80
-ssS'media/video-buffered.html'
-p651
-(dp652
-g16
-g80
-ssg56
-g57
-sg70
-g71
-sS'media/video-canvas-source.html'
-p653
-(dp654
-g16
-S'Drawing to canvas using video with source element does not taint canvas'
-p655
-ssS'media/video-controls-no-scripting.html'
-p656
-(dp657
-g16
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p658
-ssS'media/video-poster-scale.html'
-p659
-(dp660
-g16
-S"'poster' aspect ratio test"
-p661
-ssS'media/video-seek-by-small-increment.html'
-p662
-(dp663
-g16
-S'Test seeking by very small increments.'
-p664
-ssS'media/video-controls-with-mutation-event-handler.html'
-p665
-(dp666
-g16
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p667
-ssS'media/video-zoom-controls.html'
-p668
-(dp669
-g16
-S'Zoomed video with controls.'
-p670
-ssS'media/video-loop.html'
-p671
-(dp672
-g8
-(lp673
-(dp674
-S'WIN'
-p675
-I01
-sg46
-I01
-sg23
-(lp676
-S'BUGCR59415'
-p677
-asg13
-S' BUGCR59415 : cannot repro the flakiness'
-p678
-sg15
-I01
-sg118
-I01
-sasg16
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p679
-ssS'http/tests/media/video-play-stall.html'
-p680
-(dp681
-g8
-(lp682
-(dp683
-g118
-I01
-sg23
-(lp684
-S'BUGCR73609'
-p685
-asg13
-S' canplaythrough event is sent too early.'
-p686
-sasg16
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p687
-ssS'media/video-seeking.html'
-p688
-(dp689
-g16
-S'Test that seeking attribute is true immediately after a seek,'
-p690
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p691
-(dp692
-g16
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p693
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p694
-(dp695
-g16
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p696
-ssg168
-g169
-sS'media/media-controls-clone-crash.html'
-p697
-(dp698
-g16
-S'Test passes if it does not crash.'
-p699
-ssS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p700
-(dp701
-g16
-g80
-ssS'compositing/reflections/load-video-in-reflection.html'
-p702
-(dp703
-g16
-S'You should see a reflected video below, rather than the red video background.'
-p704
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p705
-(dp706
-g16
-S'Video overlay'
-p707
-ssS'media/video-controls-rendering.html'
-p708
-(dp709
-g8
-(lp710
-(dp711
-g74
-I01
-sS'LINUX'
-p712
-I01
-sg23
-(lp713
-S'BUGCR74102'
-p714
-asg13
-S" 2 pixel stretching when rendering some videos with the GPU (Now it's flaky)"
-p715
-sg46
-I01
-sg79
-I01
-sa(dp716
-g41
-I01
-sg74
-I01
-sg23
-(lp717
-S'BUGCR86714'
-p718
-asg13
-g322
-sg78
-I01
-sg79
-I01
-sasg16
-S'Test controls placement.'
-p719
-ssS'http/tests/media/video-served-as-text.html'
-p720
-(dp721
-g16
-S"media file served as 'text/plain'"
-p722
-ssS'media/video-pause-empty-events.html'
-p723
-(dp724
-g16
-S'Test that pause() from EMPTY network state triggers load()'
-p725
-ssS'media/media-load-event.html'
-p726
-(dp727
-g16
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p728
-ssS'http/tests/media/video-error-abort.html'
-p729
-(dp730
-g16
-S"'abort' event test"
-p731
-ssS'media/video-volume-slider.html'
-p732
-(dp733
-g16
-S'Test rendering of volume slider of video tag'
-p734
-ssS'media/video-seek-past-end-paused.html'
-p735
-(dp736
-g16
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p737
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p738
-(dp739
-g16
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p740
-ssS'media/remove-from-document-before-load.html'
-p741
-(dp742
-g16
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p743
-ssg210
-g211
-sS'media/video-duration-known-after-eos.html'
-p744
-(dp745
-g16
-S'Tests that duration is known after playback ended.'
-p746
-ssg109
-g110
-sS'http/tests/media/video-play-stall-before-meta-data.html'
-p747
-(dp748
-g16
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p749
-ssS'media/video-timeupdate-during-playback.html'
-p750
-(dp751
-g16
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p752
-ssS'media/video-single-valid-source.html'
-p753
-(dp754
-g16
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p755
-ssS'media/video-src-invalid-remove.html'
-p756
-(dp757
-g16
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p758
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p759
-(dp760
-g16
-S"This test passes if it doesn't alert failure."
-p761
-ssS'media/video-load-readyState.html'
-p762
-(dp763
-g16
-g80
-sssS'nonskip'
-p764
-(dp765
-g344
-g345
-sg361
-g362
-sg708
-g709
-sg243
-g244
-sg524
-g525
-sg671
-g672
-sg680
-g681
-sg580
-g581
-sg379
-g380
-sg315
-g316
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/test_data/graph.html.bak b/src/cobalt/media/tools/layout_tests/test_data/graph.html.bak
deleted file mode 100644
index a54aa4d..0000000
--- a/src/cobalt/media/tools/layout_tests/test_data/graph.html.bak
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-  <head>
-    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
-    <script type='text/javascript'>
-      google.load('visualization', '1', {'packages': ['annotatedtimeline']});
-      google.setOnLoadCallback(drawChart);
-      function drawChart() {
-        var data = new google.visualization.DataTable();
-        data.addColumn('date', 'Date');
-        data.addColumn('number', '#Tests');
-        data.addColumn('string', 'title1');
-        data.addColumn('string', 'text1');
-        data.addColumn('number', '#Skipped tests');
-        data.addColumn('string', 'title2');
-        data.addColumn('string', 'text2');
-        data.addColumn('number', '#Non-skipped tests');
-        data.addColumn('string', 'title2');
-        data.addColumn('string', 'text2');
-        data.addRows([
-         // insert 1
-        ]);
-        var data2 = new google.visualization.DataTable();
-        data2.addColumn('date', 'Date');
-        data2.addColumn('number', 'Passing Rate ' + 
-                                  '(100-(#Non-skipped tests)/' +
-                                  '((#Tests)-(#Skipped tests))*100)');
-        data2.addColumn('string', 'title1');
-        data2.addColumn('string', 'text1');
-        data2.addRows([
-         // insert 2
-        ]);
-        var div1 = document.getElementById('chart_div');
-        var chart = new google.visualization.AnnotatedTimeLine(div1);
-        chart.draw(data, {displayAnnotations: true, allowHtml: true});
-
-        var div2 = document.getElementById('chart_div2');
-        var chart2 = new google.visualization.AnnotatedTimeLine(div2);
-        chart2.draw(data2, {displayAnnotations: true,
-                            allowHtml: true,
-                            scaleType: 'maximized'});
-      }
-    </script>
-    <title>Media Layout Test Analyzer Result</title>
-  </head>
-
-  <body>
-    <h2>Current Statistics</h2>
-    <h3 id='numbers'>Numbers</h3>
-    <div id='chart_div' style='width: 1400px; height: 480px;'></div>
-    <h3>Test passing rate</h3>
-    <div id='chart_div2' style='width: 1400px; height: 480px;'></div>
-  </body>
-</html>
diff --git a/src/cobalt/media/tools/layout_tests/test_data/less b/src/cobalt/media/tools/layout_tests/test_data/less
deleted file mode 100644
index 526112c..0000000
--- a/src/cobalt/media/tools/layout_tests/test_data/less
+++ /dev/null
@@ -1,1869 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/audio-delete-while-step-button-clicked.html'
-p6
-(dp7
-S'desc'
-p8
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p9
-sS'te_info'
-p10
-(lp11
-(dp12
-S'FAIL'
-p13
-I01
-sS'SKIP'
-p14
-I01
-sS'Bugs'
-p15
-(lp16
-S'BUGCR25375'
-p17
-aS'BUGCR59399'
-p18
-asS'Comments'
-p19
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p20
-sassS'media/restore-from-page-cache.html'
-p21
-(dp22
-g8
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p23
-sg10
-(lp24
-(dp25
-g14
-I01
-sS'WONTFIX'
-p26
-I01
-sS'TIMEOUT'
-p27
-I01
-sg19
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p28
-sg15
-(lp29
-S'BUGCR19635'
-p30
-asassS'media/context-menu-actions.html'
-p31
-(dp32
-g8
-S'Test the various actions available in the HTML5 media element context-menu.'
-p33
-sg10
-(lp34
-(dp35
-S'CRASH'
-p36
-I01
-sg14
-I01
-sg15
-(lp37
-S'BUGCR59665'
-p38
-aS'BUGWK45021'
-p39
-asg19
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p40
-sg27
-I01
-sS'PASS'
-p41
-I01
-sassS'media/track/track-webvtt-tc005-headercomment.html'
-p42
-(dp43
-g8
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p44
-sg10
-(lp45
-(dp46
-g14
-I01
-sg27
-I01
-sg19
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p47
-sg15
-(lp48
-S'BUGWK43668'
-p49
-asassS'http/tests/media/video-cross-site.html'
-p50
-(dp51
-g8
-S'media file redirects to another site'
-p52
-sg10
-(lp53
-(dp54
-g14
-I01
-sg19
-S' QuickTime reference movies not supported.'
-p55
-sg27
-I01
-sg41
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/audio-data-url.html'
-p56
-(dp57
-g8
-S'Test that audio element can use a data: url'
-p58
-sg10
-(lp59
-(dp60
-g14
-I01
-sg15
-(lp61
-S'BUGCR16779'
-p62
-asg19
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p63
-sg27
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/video-canvas-alpha.html'
-p64
-(dp65
-g8
-S'UNKNOWN'
-p66
-sg10
-(lp67
-(dp68
-g14
-I01
-sS'IMAGE'
-p69
-I01
-sg15
-(lp70
-S'BUGCR74979'
-p71
-asg19
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p72
-sS'MAC'
-p73
-I01
-sS'GPU'
-p74
-I01
-sassS'media/video-can-play-type.html'
-p75
-(dp76
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p77
-sg10
-(lp78
-(dp79
-g14
-I01
-sg15
-(lp80
-S'BUGCR16779'
-p81
-asg19
-g63
-sg27
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/media-captions.html'
-p82
-(dp83
-g8
-S'Test media element close caption API.'
-p84
-sg10
-(lp85
-(dp86
-g14
-I01
-sg27
-I01
-sg19
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p87
-sg15
-(lp88
-S'BUGCR28301'
-p89
-asassS'media/media-can-play-mpeg-audio.html'
-p90
-(dp91
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p92
-sg10
-(lp93
-(dp94
-g14
-I01
-sg26
-I01
-sg15
-(lp95
-S'BUGCR16779'
-p96
-asg19
-g63
-sS'TEXT'
-p97
-I01
-sassS'media/track/track-webvtt-tc011-blanklines.html'
-p98
-(dp99
-g8
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p100
-sg10
-g45
-ssS'media/track/track-webvtt-tc012-outoforder.html'
-p101
-(dp102
-g8
-S'Tests cues that are temporally out of order (we allow this).'
-p103
-sg10
-g45
-ssS'media/track/track-webvtt-tc008-timingsnohours.html'
-p104
-(dp105
-g8
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p106
-sg10
-g45
-ssS'media/video-size-intrinsic-scale.html'
-p107
-(dp108
-g8
-S'&lt;video&gt; element intrinsic size test'
-p109
-sg10
-(lp110
-(dp111
-g14
-I01
-sg15
-(lp112
-S'BUGCR16779'
-p113
-asg19
-g63
-sg27
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/audio-mpeg4-supported.html'
-p114
-(dp115
-g8
-S'Test that the audio element supports M4A files.'
-p116
-sg10
-(lp117
-(dp118
-g14
-I01
-sg15
-(lp119
-S'BUGCR16779'
-p120
-asg19
-g63
-sg27
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/media-fullscreen-not-in-document.html'
-p121
-(dp122
-g8
-S'Test media element fullscreen API when an element is not in the DOM.'
-p123
-sg10
-(lp124
-(dp125
-g14
-I01
-sg27
-I01
-sg19
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p126
-sg15
-(lp127
-S'BUGCR16735'
-p128
-asassS'media/audio-mpeg-supported.html'
-p129
-(dp130
-g8
-S'Test that the audio element supports MPEG files.'
-p131
-sg10
-(lp132
-(dp133
-g14
-I01
-sg15
-(lp134
-S'BUGCR16779'
-p135
-asg19
-g63
-sg27
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/track/track-webvtt-tc003-newlines.html'
-p136
-(dp137
-g8
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p138
-sg10
-g45
-ssS'media/video-document-types.html'
-p139
-(dp140
-g8
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p141
-sg10
-(lp142
-(dp143
-g14
-I01
-sg15
-(lp144
-S'BUGCR16779'
-p145
-asg19
-g63
-sg27
-I01
-sg13
-I01
-sg26
-I01
-sassS'media/track/track-webvtt-tc002-bom.html'
-p146
-(dp147
-g8
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p148
-sg10
-g45
-ssS'media/video-does-not-loop.html'
-p149
-(dp150
-g8
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p151
-sg10
-(lp152
-(dp153
-g14
-I01
-sg26
-I01
-sg27
-I01
-sg19
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p154
-sassS'media/track/track-webvtt-tc000-empty.html'
-p155
-(dp156
-g8
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p157
-sg10
-g45
-ssS'media/media-can-play-mpeg4-video.html'
-p158
-(dp159
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p160
-sg10
-(lp161
-(dp162
-g14
-I01
-sg26
-I01
-sg15
-(lp163
-S'BUGWK45102'
-p164
-asg19
-g63
-sg97
-I01
-sassS'compositing/video/video-background-color.html'
-p165
-(dp166
-g8
-S'Video with background color'
-p167
-sg10
-(lp168
-(dp169
-g13
-I01
-sg14
-I01
-sg26
-I01
-sg15
-(lp170
-S'BUGWK55519'
-p171
-asg19
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p172
-sassS'media/track/track-webvtt-tc010-notimings.html'
-p173
-(dp174
-g8
-S'Tests cue without timings are ignored.'
-p175
-sg10
-g45
-ssS'media/video-timeupdate-reverse-play.html'
-p176
-(dp177
-g8
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p178
-sg10
-(lp179
-(dp180
-g14
-I01
-sg27
-I01
-sg19
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p181
-sg15
-(lp182
-S'BUGCR33099'
-p183
-asassS'http/tests/media/video-buffered.html'
-p184
-(dp185
-g8
-g66
-sg10
-(lp186
-(dp187
-g14
-I01
-sg15
-(lp188
-S'BUGCR49165'
-p189
-asg19
-S' video.buffered multiple TimeRanges support.'
-p190
-sg41
-I01
-sassS'media/track/track-webvtt-tc001-utf8.html'
-p191
-(dp192
-g8
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as WebVTT a file (we do allow it, it just looks ugly).'
-p193
-sg10
-g45
-ssS'media/track/track-webvtt-tc013-settings.html'
-p194
-(dp195
-g8
-S'Tests WebVTT settings.'
-p196
-sg10
-g45
-ssS'media/media-fullscreen-inline.html'
-p197
-(dp198
-g8
-S'Test media element fullscreen API when an element is in the DOM.'
-p199
-sg10
-(lp200
-(dp201
-g14
-I01
-sg27
-I01
-sg19
-g126
-sg15
-(lp202
-S'BUGCR16735'
-p203
-asassS'media/track/track-webvtt-tc007-cuenoid.html'
-p204
-(dp205
-g8
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p206
-sg10
-g45
-ssS'media/track/track-webvtt-tc009-timingshour.html'
-p207
-(dp208
-g8
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p209
-sg10
-g45
-ssS'media/track/track-webvtt-tc006-cueidentifiers.html'
-p210
-(dp211
-g8
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p212
-sg10
-g45
-ssS'media/video-element-other-namespace-crash.html'
-p213
-(dp214
-g8
-g66
-sg10
-(lp215
-(dp216
-g14
-I01
-sg26
-I01
-sg27
-I01
-sg19
-g63
-sg15
-(lp217
-S'BUGCR68289'
-p218
-asassS'media/video-reverse-play-duration.html'
-p219
-(dp220
-g8
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p221
-sg10
-(lp222
-(dp223
-g14
-I01
-sg27
-I01
-sg19
-g181
-sg15
-(lp224
-S'BUGCR33099'
-p225
-asasssS'whole'
-p226
-(dp227
-S'media/media-startTime.html'
-p228
-(dp229
-g8
-S"Test the, so far unused, 'startTime' attribute."
-p230
-ssS'media/video-src-set.html'
-p231
-(dp232
-g8
-S'Test that setting src attribute triggers load'
-p233
-ssg6
-g7
-sS'media/video-played-ranges-1.html'
-p234
-(dp235
-g8
-S"Test of the media element 'played' attribute, ranges part 1."
-p236
-ssS'media/video-layer-crash.html'
-p237
-(dp238
-g8
-S'Test dynamic removal of transformed and reflected video'
-p239
-ssS'http/tests/media/video-play-stall-seek.html'
-p240
-(dp241
-g8
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p242
-sg10
-(lp243
-(dp244
-g27
-I01
-sg19
-S' Timing out.'
-p245
-sg15
-(lp246
-S'BUGCR78376'
-p247
-asassg56
-g57
-sg75
-g76
-sg82
-g83
-sS'http/tests/media/video-referer.html'
-p248
-(dp249
-g8
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p250
-ssS'media/video-source-removed.html'
-p251
-(dp252
-g8
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p253
-ssS'media/unsupported-tracks.html'
-p254
-(dp255
-g8
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p256
-ssg114
-g115
-sS'media/audio-no-installed-engines.html'
-p257
-(dp258
-g8
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p259
-ssg121
-g122
-sS'media/video-dom-src.html'
-p260
-(dp261
-g8
-g66
-ssS'media/media-blocked-by-willsendrequest.html'
-p262
-(dp263
-g8
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p264
-ssS'media/video-error-does-not-exist.html'
-p265
-(dp266
-g8
-S'Test that the media element is in correct state after load fails.'
-p267
-ssS'media/video-play-pause-events.html'
-p268
-(dp269
-g8
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p270
-ssS'media/video-display-none-crash.html'
-p271
-(dp272
-g8
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p273
-ssS'media/video-src-plus-source.html'
-p274
-(dp275
-g8
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p276
-ssS'media/video-source-none-supported.html'
-p277
-(dp278
-g8
-S'no usable &lt;source&gt; test'
-p279
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p280
-(dp281
-g8
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p282
-ssg149
-g150
-sS'media/video-src.html'
-p283
-(dp284
-g8
-g66
-ssS'media/audio-controls-rendering.html'
-p285
-(dp286
-g8
-S'Test controls placement.'
-p287
-ssg165
-g166
-sS'media/video-source-inserted.html'
-p288
-(dp289
-g8
-S'networkState after inserting &lt;source&gt; test'
-p290
-ssS'media/media-can-play-octet-stream.html'
-p291
-(dp292
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p293
-ssS'media/constructors.html'
-p294
-(dp295
-g8
-S'Test that media constructors behave consistently.'
-p296
-ssS'media/video-source-media.html'
-p297
-(dp298
-g8
-g66
-ssg184
-g185
-sS'http/tests/security/local-video-source-from-remote.html'
-p299
-(dp300
-g8
-S'This test only behaves correctly in DRT'
-p301
-ssg191
-g192
-sS'media/video-source-type-params.html'
-p302
-(dp303
-g8
-g66
-ssS'fast/canvas/webgl/context-lost.html'
-p304
-(dp305
-g8
-S'debug("Test valid context");'
-p306
-ssS'media/media-can-play-wav-audio.html'
-p307
-(dp308
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p309
-ssS'media/video-source-error.html'
-p310
-(dp311
-g8
-S'&lt;video&gt; and &lt;source&gt; error test'
-p312
-sg10
-(lp313
-(dp314
-S'DEBUG'
-p315
-I01
-sg97
-I01
-sg15
-(lp316
-S'BUGWK66310'
-p317
-asg19
-S''
-p318
-sg41
-I01
-sassS'media/video-no-audio.html'
-p319
-(dp320
-g8
-S'Movie with no audio track. The volume button should not render.'
-p321
-ssS'media/svg-as-image-with-media-blocked.html'
-p322
-(dp323
-g8
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p324
-ssg204
-g205
-sg104
-g105
-sS'media/video-click-dblckick-standalone.html'
-p325
-(dp326
-g8
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p327
-ssS'media/video-pause-immediately.html'
-p328
-(dp329
-g8
-S'Test that pausing the media element has an immediate effect on the clock.'
-p330
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p331
-(dp332
-g8
-g66
-ssg219
-g220
-sS'http/tests/security/local-video-src-from-remote.html'
-p333
-(dp334
-g8
-S'This test only works in DRT'
-p335
-ssg197
-g198
-sS'media/video-controls-in-media-document.html'
-p336
-(dp337
-g8
-g66
-ssS'media/remove-from-document-no-load.html'
-p338
-(dp339
-g8
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p340
-ssS'media/video-currentTime.html'
-p341
-(dp342
-g8
-g66
-ssS'media/video-frame-accurate-seek.html'
-p343
-(dp344
-g8
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p345
-sg10
-(lp346
-(dp347
-g69
-I01
-sg15
-(lp348
-S'BUGCR72223'
-p349
-asg19
-g318
-sg41
-I01
-sassg21
-g22
-sg31
-g32
-sS'media/media-controls-clone-crash.html'
-p350
-(dp351
-g8
-S'Test passes if it does not crash.'
-p352
-ssg42
-g43
-sS'media/controls-css-overload.html'
-p353
-(dp354
-g8
-S"Testing that overloading some controls doesn't crash the browser"
-p355
-ssS'media/video-display-aspect-ratio.html'
-p356
-(dp357
-g8
-g66
-ssS'media/video-currentTime-set.html'
-p358
-(dp359
-g8
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p360
-ssS'media/media-blocked-by-beforeload.html'
-p361
-(dp362
-g8
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p363
-sg10
-(lp364
-(dp365
-g97
-I01
-sg15
-(lp366
-S'BUGWK66310'
-p367
-asg19
-g318
-sg41
-I01
-sassg101
-g102
-sS'media/video-controls-visible-audio-only.html'
-p368
-(dp369
-g8
-S'This test only runs in DRT!'
-p370
-ssS'http/tests/media/video-play-progress.html'
-p371
-(dp372
-g8
-S'Test that at least one progress event is fired after starting to load the video.'
-p373
-ssg107
-g108
-sS'media/video-source-moved.html'
-p374
-(dp375
-g8
-S'moving &lt;source&gt; element test'
-p376
-ssg98
-g99
-sS'media/video-src-none.html'
-p377
-(dp378
-g8
-g66
-ssS'media/video-controls-zoomed.html'
-p379
-(dp380
-g8
-S'This test only runs in DRT!'
-p381
-ssS'media/video-controls.html'
-p382
-(dp383
-g8
-S"Test 'controls' attribute"
-p384
-ssS'media/controls-without-preload.html'
-p385
-(dp386
-g8
-S'The controls should not depend on preload value.'
-p387
-ssS'media/video-played-collapse.html'
-p388
-(dp389
-g8
-S"Test of the media element 'played' attribute"
-p390
-ssS'compositing/self-painting-layers.html'
-p391
-(dp392
-g8
-S'Self painting layers'
-p393
-ssS'media/audio-controls-do-not-fade-out.html'
-p394
-(dp395
-g8
-S'This tests that audio controls do not fade out when the audio is playing.'
-p396
-ssS'media/media-document-audio-repaint.html'
-p397
-(dp398
-g8
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p399
-sg10
-(lp400
-(dp401
-g97
-I01
-sg69
-I01
-sg15
-(lp402
-S'BUGCR75354'
-p403
-aS'BUGWK55718'
-p404
-asg19
-S' This test needs completely new baselines.'
-p405
-sS'IMAGE+TEXT'
-p406
-I01
-sassS'compositing/geometry/video-opacity-overlay.html'
-p407
-(dp408
-g8
-S'Video overlay'
-p409
-ssS'media/video-source-error-no-candidate.html'
-p410
-(dp411
-g8
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p412
-ssS'media/audio-constructor.html'
-p413
-(dp414
-g8
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p415
-ssS'media/controls-styling.html'
-p416
-(dp417
-g8
-S'The look of the controls should not change.'
-p418
-ssS'media/video-buffered.html'
-p419
-(dp420
-g8
-g66
-ssS'media/event-attributes.html'
-p421
-(dp422
-g8
-g66
-ssg173
-g174
-sg176
-g177
-sS'http/tests/media/text-served-as-text.html'
-p423
-(dp424
-g8
-S"text file served as 'text/plain'"
-p425
-ssS'http/tests/media/video-cancel-load.html'
-p426
-(dp427
-g8
-S'Cancel loading a video file and access its properties afterwards.'
-p428
-ssS'media/unsupported-rtsp.html'
-p429
-(dp430
-g8
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p431
-ssS'media/media-controls-clone.html'
-p432
-(dp433
-g8
-S'<video controls id=v></video><audio controls id=a></audio>'
-p434
-ssS'media/broken-video.html'
-p435
-(dp436
-g8
-S'Test that QuickTime file with broken content generates an error.'
-p437
-ssS'media/video-plays-past-end-of-test.html'
-p438
-(dp439
-g8
-g66
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p440
-(dp441
-g8
-S'WebGL Origin Restrictions Conformance Tests'
-p442
-ssS'media/video-replaces-poster.html'
-p443
-(dp444
-g8
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p445
-ssS'media/video-autoplay.html'
-p446
-(dp447
-g8
-g66
-ssS'media/video-set-rate-from-pause.html'
-p448
-(dp449
-g8
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p450
-ssS'media/video-src-remove.html'
-p451
-(dp452
-g8
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p453
-ssS'media/csp-blocks-video.html'
-p454
-(dp455
-g8
-S"This test passes if it doesn't alert failure."
-p456
-ssS'media/controls-drag-timebar.html'
-p457
-(dp458
-g8
-S'Test that dragging the timebar thumb causes seeks.'
-p459
-ssS'media/audio-constructor-preload.html'
-p460
-(dp461
-g8
-S"Test that Audio() sets 'preload' attribute."
-p462
-ssS'media/video-src-invalid-poster.html'
-p463
-(dp464
-g8
-g66
-ssS'media/adopt-node-crash.html'
-p465
-(dp466
-g8
-S"Tests that we don't crash when moving a video element to a new document."
-p467
-ssS'media/video-playbackrate.html'
-p468
-(dp469
-g8
-S'test playbackRate and defaultPlaybackRate'
-p470
-ssS'media/video-muted.html'
-p471
-(dp472
-g8
-S"Test 'muted' attribute"
-p473
-ssS'media/video-src-change.html'
-p474
-(dp475
-g8
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p476
-ssg213
-g214
-sS'media/video-play-pause-exception.html'
-p477
-(dp478
-g8
-S'Video has no src. Test that the playing event is not dispatched.'
-p479
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p480
-(dp481
-g8
-g66
-ssS'media/audio-play-event.html'
-p482
-(dp483
-g8
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p484
-ssS'media/before-load-member-access.html'
-p485
-(dp486
-g8
-S'Test that accessing member of a non loaded video works.'
-p487
-ssS'media/video-width-height.html'
-p488
-(dp489
-g8
-g66
-ssS'media/audio-repaint.html'
-p490
-(dp491
-g8
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p492
-ssS'media/video-currentTime-delay.html'
-p493
-(dp494
-g8
-S'Test a delay in playing the movie results in a canPlay event.'
-p495
-ssS'media/video-aspect-ratio.html'
-p496
-(dp497
-g8
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p498
-ssS'media/video-transformed.html'
-p499
-(dp500
-g8
-S'Test painting of transformed video'
-p501
-ssS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p502
-(dp503
-g8
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p504
-ssS'media/invalid-media-url-crash.html'
-p505
-(dp506
-g8
-S'Tests that invalid media src url does not result in crash.'
-p507
-ssS'media/video-empty-source.html'
-p508
-(dp509
-g8
-S'Slider drawing with no source. The controls should render correctly.'
-p510
-ssg90
-g91
-sS'media/video-poster.html'
-p511
-(dp512
-g8
-S'Test &lt;video&gt; element with and without a poster.'
-p513
-ssS'media/media-document-audio-size.html'
-p514
-(dp515
-g8
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p516
-ssg129
-g130
-sS'compositing/overflow/overflow-compositing-descendant.html'
-p517
-(dp518
-g8
-S'You should see a green box under the video. If you see red, the test failed.'
-p519
-ssS'media/video-dom-autoplay.html'
-p520
-(dp521
-g8
-g66
-ssS'media/media-ended.html'
-p522
-(dp523
-g8
-S'<b>Test ended by:</b>'
-p524
-ssS'media/video-no-autoplay.html'
-p525
-(dp526
-g8
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p527
-ssS'media/video-zoom.html'
-p528
-(dp529
-g8
-S'150% zoom, with width and height attributes'
-p530
-sg10
-(lp531
-(dp532
-g36
-I01
-sg69
-I01
-sg15
-(lp533
-S'BUGCR86714'
-p534
-asg19
-g318
-sg73
-I01
-sg74
-I01
-sassS'media/video-append-source.html'
-p535
-(dp536
-g8
-g66
-ssg136
-g137
-sS'http/tests/media/pdf-served-as-pdf.html'
-p537
-(dp538
-g8
-S"PDF file served as 'application/pdf'"
-p539
-ssS'media/video-play-empty-events.html'
-p540
-(dp541
-g8
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p542
-ssg146
-g147
-sS'media/audio-only-video-intrinsic-size.html'
-p543
-(dp544
-g8
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p545
-ssg139
-g140
-sS'media/audio-delete-while-slider-thumb-clicked.html'
-p546
-(dp547
-g8
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p548
-ssS'media/media-can-play-ogg.html'
-p549
-(dp550
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p551
-ssS'media/track/track-webvtt-tc004-magicheader.html'
-p552
-(dp553
-g8
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p554
-sg10
-g45
-ssg155
-g156
-sS'media/video-currentTime-set2.html'
-p555
-(dp556
-g8
-g66
-ssS'media/video-seekable.html'
-p557
-(dp558
-g8
-g66
-ssS'fast/dom/beforeload/video-before-load.html'
-p559
-(dp560
-g8
-g66
-ssS'media/video-played-reset.html'
-p561
-(dp562
-g8
-S"Test of the media element 'played' attribute"
-p563
-ssS'compositing/self-painting-layers2.html'
-p564
-(dp565
-g8
-S'This test should not assert in debug builds.'
-p566
-ssS'media/controls-right-click-on-timebar.html'
-p567
-(dp568
-g8
-S'Test that right clicking on the timebar does not cause a seek.'
-p569
-ssS'media/video-dom-preload.html'
-p570
-(dp571
-g8
-S'consoleWrite("++ Test default attribute value");'
-p572
-ssS'media/video-size.html'
-p573
-(dp574
-g8
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p575
-ssS'media/video-delay-load-event.html'
-p576
-(dp577
-g8
-S"Test the document's load event is delayed until a movie's meta data is available."
-p578
-sg10
-(lp579
-(dp580
-g97
-I01
-sg15
-(lp581
-S'BUGWK64003'
-p582
-asg19
-S' Started around WebKit r90233:r90242'
-p583
-sg73
-I01
-sg41
-I01
-sg315
-I01
-sassS'media/fallback.html'
-p584
-(dp585
-g8
-S'Test that fallback content is not rendered'
-p586
-ssS'fast/layers/video-layer.html'
-p587
-(dp588
-g8
-S'Video element gets layer'
-p589
-ssS'media/controls-strict.html'
-p590
-(dp591
-g8
-S'Drawing the controls in strict mode.'
-p592
-ssS'media/remove-from-document.html'
-p593
-(dp594
-g8
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p595
-ssS'http/tests/media/remove-while-loading.html'
-p596
-(dp597
-g8
-S'Test that removing a media element from the tree while loading does not crash.'
-p598
-ssS'media/video-controls-transformed.html'
-p599
-(dp600
-g8
-S'This test only runs in DRT!'
-p601
-ssS'compositing/video/video-poster.html'
-p602
-(dp603
-g8
-S'Video with poster'
-p604
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p605
-(dp606
-g8
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p607
-ssS'media/video-display-toggle.html'
-p608
-(dp609
-g8
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p610
-ssS'media/video-seek-no-src-exception.html'
-p611
-(dp612
-g8
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p613
-ssS'media/audio-constructor-src.html'
-p614
-(dp615
-g8
-S'Test that Audio("url") constructor loads the specified resource.'
-p616
-ssS'compositing/geometry/clipped-video-controller.html'
-p617
-(dp618
-g8
-S'Clipped Video'
-p619
-ssS'media/video-preload.html'
-p620
-(dp621
-g8
-S"Test to see if media loads automatically when 'preload' is specified."
-p622
-ssS'http/tests/media/video-load-twice.html'
-p623
-(dp624
-g8
-g66
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p625
-(dp626
-g8
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p627
-ssS'media/video-seek-past-end-playing.html'
-p628
-(dp629
-g8
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p630
-ssS'media/video-source.html'
-p631
-(dp632
-g8
-g66
-ssS'http/tests/media/reload-after-dialog.html'
-p633
-(dp634
-g8
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p635
-ssS'media/media-constants.html'
-p636
-(dp637
-g8
-S'Test HTMLMediaElement and MediaError constants.'
-p638
-ssS'media/video-volume.html'
-p639
-(dp640
-g8
-S"Test 'volume' attribute"
-p641
-ssS'media/video-src-source.html'
-p642
-(dp643
-g8
-g66
-ssS'http/tests/appcache/video.html'
-p644
-(dp645
-g8
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p646
-ssg50
-g51
-sg64
-g65
-sS'media/video-canvas-source.html'
-p647
-(dp648
-g8
-S'Drawing to canvas using video with source element does not taint canvas'
-p649
-ssS'media/video-controls-no-scripting.html'
-p650
-(dp651
-g8
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p652
-ssS'media/video-poster-scale.html'
-p653
-(dp654
-g8
-S"'poster' aspect ratio test"
-p655
-ssS'media/video-seek-by-small-increment.html'
-p656
-(dp657
-g8
-S'Test seeking by very small increments.'
-p658
-ssS'media/video-controls-with-mutation-event-handler.html'
-p659
-(dp660
-g8
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p661
-ssS'media/video-zoom-controls.html'
-p662
-(dp663
-g8
-S'Zoomed video with controls.'
-p664
-ssS'media/video-loop.html'
-p665
-(dp666
-g8
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p667
-sg10
-(lp668
-(dp669
-S'WIN'
-p670
-I01
-sg41
-I01
-sg15
-(lp671
-S'BUGCR59415'
-p672
-asg19
-S' BUGCR59415 : cannot repro the flakiness'
-p673
-sg27
-I01
-sg97
-I01
-sassS'http/tests/media/video-play-stall.html'
-p674
-(dp675
-g8
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p676
-sg10
-(lp677
-(dp678
-g97
-I01
-sg15
-(lp679
-S'BUGCR73609'
-p680
-asg19
-S' canplaythrough event is sent too early.'
-p681
-sassS'media/video-seeking.html'
-p682
-(dp683
-g8
-S'Test that seeking attribute is true immediately after a seek,'
-p684
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p685
-(dp686
-g8
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p687
-ssS'media/controls-after-reload.html'
-p688
-(dp689
-g8
-S'Making sure the controller looks ok after a second load().'
-p690
-ssg158
-g159
-sS'media/video-load-networkState.html'
-p691
-(dp692
-g8
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p693
-ssS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p694
-(dp695
-g8
-g66
-ssS'compositing/reflections/load-video-in-reflection.html'
-p696
-(dp697
-g8
-S'You should see a reflected video below, rather than the red video background.'
-p698
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p699
-(dp700
-g8
-S'Video overlay'
-p701
-ssS'media/video-controls-rendering.html'
-p702
-(dp703
-g8
-S'Test controls placement.'
-p704
-sg10
-(lp705
-(dp706
-g69
-I01
-sS'LINUX'
-p707
-I01
-sg15
-(lp708
-S'BUGCR74102'
-p709
-asg19
-S" 2 pixel stretching when rendering some videos with the GPU (Now it's flaky)"
-p710
-sg41
-I01
-sg74
-I01
-sa(dp711
-g36
-I01
-sg69
-I01
-sg15
-(lp712
-S'BUGCR86714'
-p713
-asg19
-g318
-sg73
-I01
-sg74
-I01
-sassS'http/tests/media/video-served-as-text.html'
-p714
-(dp715
-g8
-S"media file served as 'text/plain'"
-p716
-ssS'media/video-pause-empty-events.html'
-p717
-(dp718
-g8
-S'Test that pause() from EMPTY network state triggers load()'
-p719
-ssS'media/video-poster-delayed.html'
-p720
-(dp721
-g8
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p722
-ssS'media/media-load-event.html'
-p723
-(dp724
-g8
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p725
-ssS'http/tests/media/video-error-abort.html'
-p726
-(dp727
-g8
-S"'abort' event test"
-p728
-ssS'media/video-volume-slider.html'
-p729
-(dp730
-g8
-S'Test rendering of volume slider of video tag'
-p731
-ssS'media/video-seek-past-end-paused.html'
-p732
-(dp733
-g8
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p734
-ssS'http/tests/media/video-cookie.html'
-p735
-(dp736
-g8
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p737
-ssS'media/remove-from-document-before-load.html'
-p738
-(dp739
-g8
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p740
-ssg207
-g208
-sS'media/video-duration-known-after-eos.html'
-p741
-(dp742
-g8
-S'Tests that duration is known after playback ended.'
-p743
-ssg210
-g211
-sS'http/tests/media/video-play-stall-before-meta-data.html'
-p744
-(dp745
-g8
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p746
-ssS'media/video-timeupdate-during-playback.html'
-p747
-(dp748
-g8
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p749
-ssS'media/video-single-valid-source.html'
-p750
-(dp751
-g8
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p752
-ssS'media/video-src-invalid-remove.html'
-p753
-(dp754
-g8
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p755
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p756
-(dp757
-g8
-S"This test passes if it doesn't alert failure."
-p758
-ssg194
-g195
-sS'media/video-load-readyState.html'
-p759
-(dp760
-g8
-g66
-sssS'nonskip'
-p761
-(dp762
-g397
-g398
-sg343
-g344
-sg674
-g675
-sg240
-g241
-sg528
-g529
-sg665
-g666
-sg702
-g703
-sg576
-g577
-sg361
-g362
-sg310
-g311
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/test_data/more b/src/cobalt/media/tools/layout_tests/test_data/more
deleted file mode 100644
index 736dfb4..0000000
--- a/src/cobalt/media/tools/layout_tests/test_data/more
+++ /dev/null
@@ -1,1883 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/track/track-webvtt-tc004-magicheader.html'
-p6
-(dp7
-S'desc'
-p8
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p9
-sS'te_info'
-p10
-(lp11
-(dp12
-S'SKIP'
-p13
-I01
-sS'TIMEOUT'
-p14
-I01
-sS'Comments'
-p15
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p16
-sS'Bugs'
-p17
-(lp18
-S'BUGWK43668'
-p19
-asassS'media/audio-delete-while-step-button-clicked.html'
-p20
-(dp21
-g8
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p22
-sg10
-(lp23
-(dp24
-S'FAIL'
-p25
-I01
-sg13
-I01
-sg17
-(lp26
-S'BUGCR25375'
-p27
-aS'BUGCR59399'
-p28
-asg15
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p29
-sassS'media/restore-from-page-cache.html'
-p30
-(dp31
-g8
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p32
-sg10
-(lp33
-(dp34
-g13
-I01
-sS'WONTFIX'
-p35
-I01
-sg14
-I01
-sg15
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p36
-sg17
-(lp37
-S'BUGCR19635'
-p38
-asassS'media/context-menu-actions.html'
-p39
-(dp40
-g8
-S'Test the various actions available in the HTML5 media element context-menu.'
-p41
-sg10
-(lp42
-(dp43
-S'CRASH'
-p44
-I01
-sg13
-I01
-sg17
-(lp45
-S'BUGCR59665'
-p46
-aS'BUGWK45021'
-p47
-asg15
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p48
-sg14
-I01
-sS'PASS'
-p49
-I01
-sassS'media/track/track-webvtt-tc005-headercomment.html'
-p50
-(dp51
-g8
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p52
-sg10
-g11
-ssS'http/tests/media/video-cross-site.html'
-p53
-(dp54
-g8
-S'media file redirects to another site'
-p55
-sg10
-(lp56
-(dp57
-g13
-I01
-sg15
-S' QuickTime reference movies not supported.'
-p58
-sg14
-I01
-sg49
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/audio-data-url.html'
-p59
-(dp60
-g8
-S'Test that audio element can use a data: url'
-p61
-sg10
-(lp62
-(dp63
-g13
-I01
-sg17
-(lp64
-S'BUGCR16779'
-p65
-asg15
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/video-canvas-alpha.html'
-p67
-(dp68
-g8
-S'UNKNOWN'
-p69
-sg10
-(lp70
-(dp71
-g13
-I01
-sS'IMAGE'
-p72
-I01
-sg17
-(lp73
-S'BUGCR74979'
-p74
-asg15
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p75
-sS'MAC'
-p76
-I01
-sS'GPU'
-p77
-I01
-sassS'add2.html'
-p78
-I01
-sS'media/video-can-play-type.html'
-p79
-(dp80
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p81
-sg10
-(lp82
-(dp83
-g13
-I01
-sg17
-(lp84
-S'BUGCR16779'
-p85
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/media-captions.html'
-p86
-(dp87
-g8
-S'Test media element close caption API.'
-p88
-sg10
-(lp89
-(dp90
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p91
-sg17
-(lp92
-S'BUGCR28301'
-p93
-asassS'media/media-can-play-mpeg-audio.html'
-p94
-(dp95
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p96
-sg10
-(lp97
-(dp98
-g13
-I01
-sg35
-I01
-sg17
-(lp99
-S'BUGCR16779'
-p100
-asg15
-g66
-sS'TEXT'
-p101
-I01
-sassS'media/track/track-webvtt-tc011-blanklines.html'
-p102
-(dp103
-g8
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p104
-sg10
-g11
-ssS'media/track/track-webvtt-tc012-outoforder.html'
-p105
-(dp106
-g8
-S'Tests cues that are temporally out of order (we allow this).'
-p107
-sg10
-g11
-ssS'media/track/track-webvtt-tc008-timingsnohours.html'
-p108
-(dp109
-g8
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p110
-sg10
-g11
-ssS'media/video-size-intrinsic-scale.html'
-p111
-(dp112
-g8
-S'&lt;video&gt; element intrinsic size test'
-p113
-sg10
-(lp114
-(dp115
-g13
-I01
-sg17
-(lp116
-S'BUGCR16779'
-p117
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/audio-mpeg4-supported.html'
-p118
-(dp119
-g8
-S'Test that the audio element supports M4A files.'
-p120
-sg10
-(lp121
-(dp122
-g13
-I01
-sg17
-(lp123
-S'BUGCR16779'
-p124
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/media-fullscreen-not-in-document.html'
-p125
-(dp126
-g8
-S'Test media element fullscreen API when an element is not in the DOM.'
-p127
-sg10
-(lp128
-(dp129
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p130
-sg17
-(lp131
-S'BUGCR16735'
-p132
-asassS'media/audio-mpeg-supported.html'
-p133
-(dp134
-g8
-S'Test that the audio element supports MPEG files.'
-p135
-sg10
-(lp136
-(dp137
-g13
-I01
-sg17
-(lp138
-S'BUGCR16779'
-p139
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/track/track-webvtt-tc003-newlines.html'
-p140
-(dp141
-g8
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p142
-sg10
-g11
-ssS'media/video-document-types.html'
-p143
-(dp144
-g8
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p145
-sg10
-(lp146
-(dp147
-g13
-I01
-sg17
-(lp148
-S'BUGCR16779'
-p149
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/track/track-webvtt-tc002-bom.html'
-p150
-(dp151
-g8
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p152
-sg10
-g11
-ssS'media/video-does-not-loop.html'
-p153
-(dp154
-g8
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p155
-sg10
-(lp156
-(dp157
-g13
-I01
-sg35
-I01
-sg14
-I01
-sg15
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p158
-sassS'media/track/track-webvtt-tc000-empty.html'
-p159
-(dp160
-g8
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p161
-sg10
-g11
-ssS'media/media-can-play-mpeg4-video.html'
-p162
-(dp163
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p164
-sg10
-(lp165
-(dp166
-g13
-I01
-sg35
-I01
-sg17
-(lp167
-S'BUGWK45102'
-p168
-asg15
-g66
-sg101
-I01
-sassS'compositing/video/video-background-color.html'
-p169
-(dp170
-g8
-S'Video with background color'
-p171
-sg10
-(lp172
-(dp173
-g25
-I01
-sg13
-I01
-sg35
-I01
-sg17
-(lp174
-S'BUGWK55519'
-p175
-asg15
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p176
-sassS'media/track/track-webvtt-tc010-notimings.html'
-p177
-(dp178
-g8
-S'Tests cue without timings are ignored.'
-p179
-sg10
-g11
-ssS'media/video-timeupdate-reverse-play.html'
-p180
-(dp181
-g8
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p182
-sg10
-(lp183
-(dp184
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p185
-sg17
-(lp186
-S'BUGCR33099'
-p187
-asassS'http/tests/media/video-buffered.html'
-p188
-(dp189
-g8
-g69
-sg10
-(lp190
-(dp191
-g13
-I01
-sg17
-(lp192
-S'BUGCR49165'
-p193
-asg15
-S' video.buffered multiple TimeRanges support.'
-p194
-sg49
-I01
-sassS'media/track/track-webvtt-tc001-utf8.html'
-p195
-(dp196
-g8
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as WebVTT a file (we do allow it, it just looks ugly).'
-p197
-sg10
-g11
-ssS'media/track/track-webvtt-tc013-settings.html'
-p198
-(dp199
-g8
-S'Tests WebVTT settings.'
-p200
-sg10
-g11
-ssS'media/media-fullscreen-inline.html'
-p201
-(dp202
-g8
-S'Test media element fullscreen API when an element is in the DOM.'
-p203
-sg10
-(lp204
-(dp205
-g13
-I01
-sg14
-I01
-sg15
-g130
-sg17
-(lp206
-S'BUGCR16735'
-p207
-asassS'media/track/track-webvtt-tc007-cuenoid.html'
-p208
-(dp209
-g8
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p210
-sg10
-g11
-ssS'media/track/track-webvtt-tc009-timingshour.html'
-p211
-(dp212
-g8
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p213
-sg10
-g11
-ssS'media/track/track-webvtt-tc006-cueidentifiers.html'
-p214
-(dp215
-g8
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p216
-sg10
-g11
-ssS'media/video-element-other-namespace-crash.html'
-p217
-(dp218
-g8
-g69
-sg10
-(lp219
-(dp220
-g13
-I01
-sg35
-I01
-sg14
-I01
-sg15
-g66
-sg17
-(lp221
-S'BUGCR68289'
-p222
-asassS'media/video-reverse-play-duration.html'
-p223
-(dp224
-g8
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p225
-sg10
-(lp226
-(dp227
-g13
-I01
-sg14
-I01
-sg15
-g185
-sg17
-(lp228
-S'BUGCR33099'
-p229
-asasssS'whole'
-p230
-(dp231
-S'media/video-source-type.html'
-p232
-(dp233
-g8
-S'&lt;source&gt; @type attribute'
-p234
-ssS'media/media-startTime.html'
-p235
-(dp236
-g8
-S"Test the, so far unused, 'startTime' attribute."
-p237
-ssS'media/video-src-set.html'
-p238
-(dp239
-g8
-S'Test that setting src attribute triggers load'
-p240
-ssg20
-g21
-sS'media/video-played-ranges-1.html'
-p241
-(dp242
-g8
-S"Test of the media element 'played' attribute, ranges part 1."
-p243
-ssS'media/video-layer-crash.html'
-p244
-(dp245
-g8
-S'Test dynamic removal of transformed and reflected video'
-p246
-ssS'http/tests/media/video-play-stall-seek.html'
-p247
-(dp248
-g8
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p249
-sg10
-(lp250
-(dp251
-g14
-I01
-sg15
-S' Timing out.'
-p252
-sg17
-(lp253
-S'BUGCR78376'
-p254
-asassg59
-g60
-sg79
-g80
-sg86
-g87
-sS'http/tests/media/video-referer.html'
-p255
-(dp256
-g8
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p257
-ssS'media/video-source-removed.html'
-p258
-(dp259
-g8
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p260
-ssS'media/unsupported-tracks.html'
-p261
-(dp262
-g8
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p263
-ssg118
-g119
-sS'media/audio-no-installed-engines.html'
-p264
-(dp265
-g8
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p266
-ssg125
-g126
-sS'media/video-dom-src.html'
-p267
-(dp268
-g8
-g69
-ssS'media/media-blocked-by-willsendrequest.html'
-p269
-(dp270
-g8
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p271
-ssS'media/video-error-does-not-exist.html'
-p272
-(dp273
-g8
-S'Test that the media element is in correct state after load fails.'
-p274
-ssS'media/video-play-pause-events.html'
-p275
-(dp276
-g8
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p277
-ssS'media/video-display-none-crash.html'
-p278
-(dp279
-g8
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p280
-ssS'media/video-src-plus-source.html'
-p281
-(dp282
-g8
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p283
-ssS'media/video-source-none-supported.html'
-p284
-(dp285
-g8
-S'no usable &lt;source&gt; test'
-p286
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p287
-(dp288
-g8
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p289
-ssg153
-g154
-sS'media/video-src.html'
-p290
-(dp291
-g8
-g69
-ssS'media/audio-controls-rendering.html'
-p292
-(dp293
-g8
-S'Test controls placement.'
-p294
-ssg169
-g170
-sS'media/video-source-inserted.html'
-p295
-(dp296
-g8
-S'networkState after inserting &lt;source&gt; test'
-p297
-ssS'media/media-can-play-octet-stream.html'
-p298
-(dp299
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p300
-ssS'media/constructors.html'
-p301
-(dp302
-g8
-S'Test that media constructors behave consistently.'
-p303
-ssS'media/video-source-media.html'
-p304
-(dp305
-g8
-g69
-ssg188
-g189
-sS'http/tests/security/local-video-source-from-remote.html'
-p306
-(dp307
-g8
-S'This test only behaves correctly in DRT'
-p308
-ssg195
-g196
-sS'media/video-source-type-params.html'
-p309
-(dp310
-g8
-g69
-ssS'fast/canvas/webgl/context-lost.html'
-p311
-(dp312
-g8
-S'debug("Test valid context");'
-p313
-ssS'media/media-can-play-wav-audio.html'
-p314
-(dp315
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p316
-ssS'media/video-source-error.html'
-p317
-(dp318
-g8
-S'&lt;video&gt; and &lt;source&gt; error test'
-p319
-sg10
-(lp320
-(dp321
-S'DEBUG'
-p322
-I01
-sg101
-I01
-sg17
-(lp323
-S'BUGWK66310'
-p324
-asg15
-S''
-p325
-sg49
-I01
-sassS'media/video-no-audio.html'
-p326
-(dp327
-g8
-S'Movie with no audio track. The volume button should not render.'
-p328
-ssS'media/svg-as-image-with-media-blocked.html'
-p329
-(dp330
-g8
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p331
-ssg208
-g209
-sg108
-g109
-sS'media/video-click-dblckick-standalone.html'
-p332
-(dp333
-g8
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p334
-ssS'media/video-pause-immediately.html'
-p335
-(dp336
-g8
-S'Test that pausing the media element has an immediate effect on the clock.'
-p337
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p338
-(dp339
-g8
-g69
-ssg223
-g224
-sS'http/tests/security/local-video-src-from-remote.html'
-p340
-(dp341
-g8
-S'This test only works in DRT'
-p342
-ssg201
-g202
-sS'media/video-controls-in-media-document.html'
-p343
-(dp344
-g8
-g69
-ssS'media/remove-from-document-no-load.html'
-p345
-(dp346
-g8
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p347
-ssS'media/video-currentTime.html'
-p348
-(dp349
-g8
-g69
-ssS'media/video-frame-accurate-seek.html'
-p350
-(dp351
-g8
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p352
-sg10
-(lp353
-(dp354
-g72
-I01
-sg17
-(lp355
-S'BUGCR72223'
-p356
-asg15
-g325
-sg49
-I01
-sassg30
-g31
-sg39
-g40
-sS'media/media-controls-clone-crash.html'
-p357
-(dp358
-g8
-S'Test passes if it does not crash.'
-p359
-ssg50
-g51
-sS'media/controls-css-overload.html'
-p360
-(dp361
-g8
-S"Testing that overloading some controls doesn't crash the browser"
-p362
-ssS'media/video-display-aspect-ratio.html'
-p363
-(dp364
-g8
-g69
-ssS'media/video-currentTime-set.html'
-p365
-(dp366
-g8
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p367
-ssS'media/media-blocked-by-beforeload.html'
-p368
-(dp369
-g8
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p370
-sg10
-(lp371
-(dp372
-g101
-I01
-sg17
-(lp373
-S'BUGWK66310'
-p374
-asg15
-g325
-sg49
-I01
-sassg105
-g106
-sS'media/video-controls-visible-audio-only.html'
-p375
-(dp376
-g8
-S'This test only runs in DRT!'
-p377
-ssS'http/tests/media/video-play-progress.html'
-p378
-(dp379
-g8
-S'Test that at least one progress event is fired after starting to load the video.'
-p380
-ssg111
-g112
-sS'media/video-source-moved.html'
-p381
-(dp382
-g8
-S'moving &lt;source&gt; element test'
-p383
-ssg102
-g103
-sS'media/video-src-none.html'
-p384
-(dp385
-g8
-g69
-ssS'media/video-controls-zoomed.html'
-p386
-(dp387
-g8
-S'This test only runs in DRT!'
-p388
-ssS'media/video-controls.html'
-p389
-(dp390
-g8
-S"Test 'controls' attribute"
-p391
-ssS'media/controls-without-preload.html'
-p392
-(dp393
-g8
-S'The controls should not depend on preload value.'
-p394
-ssS'media/video-played-collapse.html'
-p395
-(dp396
-g8
-S"Test of the media element 'played' attribute"
-p397
-ssS'compositing/self-painting-layers.html'
-p398
-(dp399
-g8
-S'Self painting layers'
-p400
-ssS'media/audio-controls-do-not-fade-out.html'
-p401
-(dp402
-g8
-S'This tests that audio controls do not fade out when the audio is playing.'
-p403
-ssS'media/media-document-audio-repaint.html'
-p404
-(dp405
-g8
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p406
-sg10
-(lp407
-(dp408
-g101
-I01
-sg72
-I01
-sg17
-(lp409
-S'BUGCR75354'
-p410
-aS'BUGWK55718'
-p411
-asg15
-S' This test needs completely new baselines.'
-p412
-sS'IMAGE+TEXT'
-p413
-I01
-sassS'compositing/geometry/video-opacity-overlay.html'
-p414
-(dp415
-g8
-S'Video overlay'
-p416
-ssS'media/video-source-error-no-candidate.html'
-p417
-(dp418
-g8
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p419
-ssS'media/audio-constructor.html'
-p420
-(dp421
-g8
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p422
-ssS'media/controls-styling.html'
-p423
-(dp424
-g8
-S'The look of the controls should not change.'
-p425
-ssS'media/video-buffered.html'
-p426
-(dp427
-g8
-g69
-ssS'media/event-attributes.html'
-p428
-(dp429
-g8
-g69
-ssg177
-g178
-sg180
-g181
-sS'http/tests/media/text-served-as-text.html'
-p430
-(dp431
-g8
-S"text file served as 'text/plain'"
-p432
-ssS'http/tests/media/video-cancel-load.html'
-p433
-(dp434
-g8
-S'Cancel loading a video file and access its properties afterwards.'
-p435
-ssS'media/unsupported-rtsp.html'
-p436
-(dp437
-g8
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p438
-ssS'media/media-controls-clone.html'
-p439
-(dp440
-g8
-S'<video controls id=v></video><audio controls id=a></audio>'
-p441
-ssS'media/broken-video.html'
-p442
-(dp443
-g8
-S'Test that QuickTime file with broken content generates an error.'
-p444
-ssS'media/video-plays-past-end-of-test.html'
-p445
-(dp446
-g8
-g69
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p447
-(dp448
-g8
-S'WebGL Origin Restrictions Conformance Tests'
-p449
-ssS'media/video-replaces-poster.html'
-p450
-(dp451
-g8
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p452
-ssS'media/video-autoplay.html'
-p453
-(dp454
-g8
-g69
-ssS'media/video-set-rate-from-pause.html'
-p455
-(dp456
-g8
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p457
-ssS'media/video-src-remove.html'
-p458
-(dp459
-g8
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p460
-ssS'media/csp-blocks-video.html'
-p461
-(dp462
-g8
-S"This test passes if it doesn't alert failure."
-p463
-ssS'media/controls-drag-timebar.html'
-p464
-(dp465
-g8
-S'Test that dragging the timebar thumb causes seeks.'
-p466
-ssS'media/audio-constructor-preload.html'
-p467
-(dp468
-g8
-S"Test that Audio() sets 'preload' attribute."
-p469
-ssS'media/video-src-invalid-poster.html'
-p470
-(dp471
-g8
-g69
-ssS'media/adopt-node-crash.html'
-p472
-(dp473
-g8
-S"Tests that we don't crash when moving a video element to a new document."
-p474
-ssS'media/video-playbackrate.html'
-p475
-(dp476
-g8
-S'test playbackRate and defaultPlaybackRate'
-p477
-ssS'media/video-muted.html'
-p478
-(dp479
-g8
-S"Test 'muted' attribute"
-p480
-ssS'media/video-src-change.html'
-p481
-(dp482
-g8
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p483
-ssg217
-g218
-sS'media/video-play-pause-exception.html'
-p484
-(dp485
-g8
-S'Video has no src. Test that the playing event is not dispatched.'
-p486
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p487
-(dp488
-g8
-g69
-ssS'media/audio-play-event.html'
-p489
-(dp490
-g8
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p491
-ssS'media/before-load-member-access.html'
-p492
-(dp493
-g8
-S'Test that accessing member of a non loaded video works.'
-p494
-ssS'media/video-width-height.html'
-p495
-(dp496
-g8
-g69
-ssS'media/audio-repaint.html'
-p497
-(dp498
-g8
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p499
-ssS'media/video-currentTime-delay.html'
-p500
-(dp501
-g8
-S'Test a delay in playing the movie results in a canPlay event.'
-p502
-ssS'media/video-aspect-ratio.html'
-p503
-(dp504
-g8
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p505
-ssS'media/video-transformed.html'
-p506
-(dp507
-g8
-S'Test painting of transformed video'
-p508
-ssS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p509
-(dp510
-g8
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p511
-ssS'media/invalid-media-url-crash.html'
-p512
-(dp513
-g8
-S'Tests that invalid media src url does not result in crash.'
-p514
-ssS'media/video-empty-source.html'
-p515
-(dp516
-g8
-S'Slider drawing with no source. The controls should render correctly.'
-p517
-ssg94
-g95
-sS'media/video-poster.html'
-p518
-(dp519
-g8
-S'Test &lt;video&gt; element with and without a poster.'
-p520
-ssS'media/media-document-audio-size.html'
-p521
-(dp522
-g8
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p523
-ssg133
-g134
-sS'add1.html'
-p524
-I01
-sS'compositing/overflow/overflow-compositing-descendant.html'
-p525
-(dp526
-g8
-S'You should see a green box under the video. If you see red, the test failed.'
-p527
-ssS'media/video-dom-autoplay.html'
-p528
-(dp529
-g8
-g69
-ssS'media/media-ended.html'
-p530
-(dp531
-g8
-S'<b>Test ended by:</b>'
-p532
-ssS'media/video-no-autoplay.html'
-p533
-(dp534
-g8
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p535
-ssS'media/video-zoom.html'
-p536
-(dp537
-g8
-S'150% zoom, with width and height attributes'
-p538
-sg10
-(lp539
-(dp540
-g44
-I01
-sg72
-I01
-sg17
-(lp541
-S'BUGCR86714'
-p542
-asg15
-g325
-sg76
-I01
-sg77
-I01
-sassS'media/video-append-source.html'
-p543
-(dp544
-g8
-g69
-ssg140
-g141
-sS'http/tests/media/pdf-served-as-pdf.html'
-p545
-(dp546
-g8
-S"PDF file served as 'application/pdf'"
-p547
-ssS'media/video-play-empty-events.html'
-p548
-(dp549
-g8
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p550
-ssg150
-g151
-sS'media/audio-only-video-intrinsic-size.html'
-p551
-(dp552
-g8
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p553
-ssg143
-g144
-sS'media/audio-delete-while-slider-thumb-clicked.html'
-p554
-(dp555
-g8
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p556
-ssS'media/media-can-play-ogg.html'
-p557
-(dp558
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p559
-ssg6
-g7
-sg159
-g160
-sS'media/video-currentTime-set2.html'
-p560
-(dp561
-g8
-g69
-ssS'media/video-seekable.html'
-p562
-(dp563
-g8
-g69
-ssS'fast/dom/beforeload/video-before-load.html'
-p564
-(dp565
-g8
-g69
-ssS'media/video-played-reset.html'
-p566
-(dp567
-g8
-S"Test of the media element 'played' attribute"
-p568
-ssS'compositing/self-painting-layers2.html'
-p569
-(dp570
-g8
-S'This test should not assert in debug builds.'
-p571
-ssS'media/controls-right-click-on-timebar.html'
-p572
-(dp573
-g8
-S'Test that right clicking on the timebar does not cause a seek.'
-p574
-ssS'media/video-dom-preload.html'
-p575
-(dp576
-g8
-S'consoleWrite("++ Test default attribute value");'
-p577
-ssS'media/video-size.html'
-p578
-(dp579
-g8
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p580
-ssS'media/video-delay-load-event.html'
-p581
-(dp582
-g8
-S"Test the document's load event is delayed until a movie's meta data is available."
-p583
-sg10
-(lp584
-(dp585
-g101
-I01
-sg17
-(lp586
-S'BUGWK64003'
-p587
-asg15
-S' Started around WebKit r90233:r90242'
-p588
-sg76
-I01
-sg49
-I01
-sg322
-I01
-sassS'media/fallback.html'
-p589
-(dp590
-g8
-S'Test that fallback content is not rendered'
-p591
-ssS'fast/layers/video-layer.html'
-p592
-(dp593
-g8
-S'Video element gets layer'
-p594
-ssS'media/controls-strict.html'
-p595
-(dp596
-g8
-S'Drawing the controls in strict mode.'
-p597
-ssS'media/remove-from-document.html'
-p598
-(dp599
-g8
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p600
-ssS'http/tests/media/remove-while-loading.html'
-p601
-(dp602
-g8
-S'Test that removing a media element from the tree while loading does not crash.'
-p603
-ssS'media/video-controls-transformed.html'
-p604
-(dp605
-g8
-S'This test only runs in DRT!'
-p606
-ssS'compositing/video/video-poster.html'
-p607
-(dp608
-g8
-S'Video with poster'
-p609
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p610
-(dp611
-g8
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p612
-ssS'media/video-display-toggle.html'
-p613
-(dp614
-g8
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p615
-ssS'media/video-seek-no-src-exception.html'
-p616
-(dp617
-g8
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p618
-ssS'media/audio-constructor-src.html'
-p619
-(dp620
-g8
-S'Test that Audio("url") constructor loads the specified resource.'
-p621
-ssS'compositing/geometry/clipped-video-controller.html'
-p622
-(dp623
-g8
-S'Clipped Video'
-p624
-ssS'media/video-preload.html'
-p625
-(dp626
-g8
-S"Test to see if media loads automatically when 'preload' is specified."
-p627
-ssS'http/tests/media/video-load-twice.html'
-p628
-(dp629
-g8
-g69
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p630
-(dp631
-g8
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p632
-ssS'media/video-seek-past-end-playing.html'
-p633
-(dp634
-g8
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p635
-ssS'media/video-source.html'
-p636
-(dp637
-g8
-g69
-ssS'http/tests/media/reload-after-dialog.html'
-p638
-(dp639
-g8
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p640
-ssS'media/media-constants.html'
-p641
-(dp642
-g8
-S'Test HTMLMediaElement and MediaError constants.'
-p643
-ssS'media/video-volume.html'
-p644
-(dp645
-g8
-S"Test 'volume' attribute"
-p646
-ssS'media/video-src-source.html'
-p647
-(dp648
-g8
-g69
-ssS'http/tests/appcache/video.html'
-p649
-(dp650
-g8
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p651
-ssg53
-g54
-sg67
-g68
-sS'media/video-canvas-source.html'
-p652
-(dp653
-g8
-S'Drawing to canvas using video with source element does not taint canvas'
-p654
-ssS'media/video-controls-no-scripting.html'
-p655
-(dp656
-g8
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p657
-ssS'media/video-poster-scale.html'
-p658
-(dp659
-g8
-S"'poster' aspect ratio test"
-p660
-ssS'media/video-seek-by-small-increment.html'
-p661
-(dp662
-g8
-S'Test seeking by very small increments.'
-p663
-ssS'media/video-controls-with-mutation-event-handler.html'
-p664
-(dp665
-g8
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p666
-ssS'media/video-zoom-controls.html'
-p667
-(dp668
-g8
-S'Zoomed video with controls.'
-p669
-ssS'media/video-loop.html'
-p670
-(dp671
-g8
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p672
-sg10
-(lp673
-(dp674
-S'WIN'
-p675
-I01
-sg49
-I01
-sg17
-(lp676
-S'BUGCR59415'
-p677
-asg15
-S' BUGCR59415 : cannot repro the flakiness'
-p678
-sg14
-I01
-sg101
-I01
-sassS'http/tests/media/video-play-stall.html'
-p679
-(dp680
-g8
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p681
-sg10
-(lp682
-(dp683
-g101
-I01
-sg17
-(lp684
-S'BUGCR73609'
-p685
-asg15
-S' canplaythrough event is sent too early.'
-p686
-sassS'media/video-seeking.html'
-p687
-(dp688
-g8
-S'Test that seeking attribute is true immediately after a seek,'
-p689
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p690
-(dp691
-g8
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p692
-ssS'media/controls-after-reload.html'
-p693
-(dp694
-g8
-S'Making sure the controller looks ok after a second load().'
-p695
-ssg162
-g163
-sS'media/video-load-networkState.html'
-p696
-(dp697
-g8
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p698
-ssS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p699
-(dp700
-g8
-g69
-ssS'compositing/reflections/load-video-in-reflection.html'
-p701
-(dp702
-g8
-S'You should see a reflected video below, rather than the red video background.'
-p703
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p704
-(dp705
-g8
-S'Video overlay'
-p706
-ssS'media/video-controls-rendering.html'
-p707
-(dp708
-g8
-S'Test controls placement.'
-p709
-sg10
-(lp710
-(dp711
-g72
-I01
-sS'LINUX'
-p712
-I01
-sg17
-(lp713
-S'BUGCR74102'
-p714
-asg15
-S" 2 pixel stretching when rendering some videos with the GPU (Now it's flaky)"
-p715
-sg49
-I01
-sg77
-I01
-sa(dp716
-g44
-I01
-sg72
-I01
-sg17
-(lp717
-S'BUGCR86714'
-p718
-asg15
-g325
-sg76
-I01
-sg77
-I01
-sassS'http/tests/media/video-served-as-text.html'
-p719
-(dp720
-g8
-S"media file served as 'text/plain'"
-p721
-ssS'media/video-pause-empty-events.html'
-p722
-(dp723
-g8
-S'Test that pause() from EMPTY network state triggers load()'
-p724
-ssS'media/video-poster-delayed.html'
-p725
-(dp726
-g8
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p727
-ssS'media/media-load-event.html'
-p728
-(dp729
-g8
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p730
-ssS'http/tests/media/video-error-abort.html'
-p731
-(dp732
-g8
-S"'abort' event test"
-p733
-ssS'media/video-volume-slider.html'
-p734
-(dp735
-g8
-S'Test rendering of volume slider of video tag'
-p736
-ssS'media/video-seek-past-end-paused.html'
-p737
-(dp738
-g8
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p739
-ssS'http/tests/media/video-cookie.html'
-p740
-(dp741
-g8
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p742
-ssS'media/remove-from-document-before-load.html'
-p743
-(dp744
-g8
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p745
-ssg211
-g212
-sS'media/video-duration-known-after-eos.html'
-p746
-(dp747
-g8
-S'Tests that duration is known after playback ended.'
-p748
-ssg214
-g215
-sS'http/tests/media/video-play-stall-before-meta-data.html'
-p749
-(dp750
-g8
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p751
-ssS'media/video-timeupdate-during-playback.html'
-p752
-(dp753
-g8
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p754
-ssS'media/video-single-valid-source.html'
-p755
-(dp756
-g8
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p757
-ssS'media/video-src-invalid-remove.html'
-p758
-(dp759
-g8
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p760
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p761
-(dp762
-g8
-S"This test passes if it doesn't alert failure."
-p763
-ssg198
-g199
-sS'media/video-load-readyState.html'
-p764
-(dp765
-g8
-g69
-sssS'nonskip'
-p766
-(dp767
-g404
-g405
-sg350
-g351
-sg679
-g680
-sg247
-g248
-sg536
-g537
-sg670
-g671
-sg707
-g708
-sg581
-g582
-sg368
-g369
-sg317
-g318
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/test_data/more_te_info b/src/cobalt/media/tools/layout_tests/test_data/more_te_info
deleted file mode 100644
index e020b9e..0000000
--- a/src/cobalt/media/tools/layout_tests/test_data/more_te_info
+++ /dev/null
@@ -1,1891 +0,0 @@
-(ilayouttest_analyzer_helpers
-AnalyzerResultMap
-p0
-(dp1
-S'result_map'
-p2
-(dp3
-S'skip'
-p4
-(dp5
-S'media/track/track-webvtt-tc004-magicheader.html'
-p6
-(dp7
-S'desc'
-p8
-S'Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.'
-p9
-sS'te_info'
-p10
-(lp11
-(dp12
-S'SKIP'
-p13
-I01
-sS'TIMEOUT'
-p14
-I01
-sS'Comments'
-p15
-S' Tests for WebVTT parser for <track>.  Feature is not yet functional.'
-p16
-sS'Bugs'
-p17
-(lp18
-S'BUGWK43668'
-p19
-asassS'media/audio-delete-while-step-button-clicked.html'
-p20
-(dp21
-g8
-S"This tests that events don't continue to target a step button if the media element is deleted while mouse down on button."
-p22
-sg10
-(lp23
-(dp24
-S'FAIL'
-p25
-I01
-sg13
-I01
-sg17
-(lp26
-S'BUGCR25375'
-p27
-aS'BUGCR59399'
-p28
-asg15
-S" Failing because we sometimes emit additional timeupdate events. Test might be WONTFIX because we don't export a step button in the first place."
-p29
-sassS'media/restore-from-page-cache.html'
-p30
-(dp31
-g8
-S"Make sure we don't reload a &lt;video&gt; element when navigating back to an uncached page."
-p32
-sg10
-(lp33
-(dp34
-g13
-I01
-sS'WONTFIX'
-p35
-I01
-sg14
-I01
-sg15
-S' Page Cache - based tests. Chromium disables page cache because the WebKit page cache keeps previously loaded pages alive in memory to be able to quickly substitute them when user clicks History buttons. Chromium wants those to be separate navigations made via browser process to be able to make decision on which renderer process to use for each of them.'
-p36
-sg17
-(lp37
-S'BUGCR19635'
-p38
-asassS'media/context-menu-actions.html'
-p39
-(dp40
-g8
-S'Test the various actions available in the HTML5 media element context-menu.'
-p41
-sg10
-(lp42
-(dp43
-S'CRASH'
-p44
-I01
-sg13
-I01
-sg17
-(lp45
-S'BUGCR59665'
-p46
-aS'BUGWK45021'
-p47
-asg15
-S' BUGCR59415 : cannot repro the flakiness This test needs enhanced eventSender.contextMenu() return value. See https:bugs.webkit.org/show_bug.cgi?id=45021 for more info. UNIMPLEMENTED for chrome'
-p48
-sg14
-I01
-sS'PASS'
-p49
-I01
-sassS'media/track/track-webvtt-tc005-headercomment.html'
-p50
-(dp51
-g8
-S'Tests that the optional comment area under the "WEBVTT" file header is properly ignored.  Also, default settings and styling are currently ignored (treated as faulty cues).'
-p52
-sg10
-g11
-ssS'http/tests/media/video-cross-site.html'
-p53
-(dp54
-g8
-S'media file redirects to another site'
-p55
-sg10
-(lp56
-(dp57
-g13
-I01
-sg15
-S' QuickTime reference movies not supported.'
-p58
-sg14
-I01
-sg49
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/audio-data-url.html'
-p59
-(dp60
-g8
-S'Test that audio element can use a data: url'
-p61
-sg10
-(lp62
-(dp63
-g13
-I01
-sg17
-(lp64
-S'BUGCR16779'
-p65
-asg15
-S" These tests are WONTFIX because they use codecs Chromium doesn't support."
-p66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/video-canvas-alpha.html'
-p67
-(dp68
-g8
-S'UNKNOWN'
-p69
-sg10
-(lp70
-(dp71
-g13
-I01
-sS'IMAGE'
-p72
-I01
-sg17
-(lp73
-S'BUGCR74979'
-p74
-asg15
-S" Accelerated 2d for mac isn't supported yet, so SKIP this test for now."
-p75
-sS'MAC'
-p76
-I01
-sS'GPU'
-p77
-I01
-sassS'media/video-can-play-type.html'
-p78
-(dp79
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method.'
-p80
-sg10
-(lp81
-(dp82
-g13
-I01
-sg17
-(lp83
-S'BUGCR16779'
-p84
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/media-captions.html'
-p85
-(dp86
-g8
-S'Test media element close caption API.'
-p87
-sg10
-(lp88
-(dp89
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented the WebKit captioning extension. UNIMPLEMENTED"
-p90
-sg17
-(lp91
-S'BUGCR28301'
-p92
-asassS'media/media-can-play-mpeg-audio.html'
-p93
-(dp94
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple mp3 MIME types.'
-p95
-sg10
-(lp96
-(dp97
-g13
-I01
-sg35
-I01
-sg17
-(lp98
-S'BUGCR16779'
-p99
-asg15
-g66
-sS'TEXT'
-p100
-I01
-sassS'media/track/track-webvtt-tc011-blanklines.html'
-p101
-(dp102
-g8
-S'Tests that cues are not affected by multiple newlines \\n, \\r, and \\r\\n and that cue not properly separated are treated as one big cue.'
-p103
-sg10
-g11
-ssS'media/track/track-webvtt-tc012-outoforder.html'
-p104
-(dp105
-g8
-S'Tests cues that are temporally out of order (we allow this).'
-p106
-sg10
-g11
-ssS'media/track/track-webvtt-tc008-timingsnohours.html'
-p107
-(dp108
-g8
-S'Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.'
-p109
-sg10
-g11
-ssS'media/video-size-intrinsic-scale.html'
-p110
-(dp111
-g8
-S'&lt;video&gt; element intrinsic size test'
-p112
-sg10
-(lp113
-(dp114
-g13
-I01
-sg17
-(lp115
-S'BUGCR16779'
-p116
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/audio-mpeg4-supported.html'
-p117
-(dp118
-g8
-S'Test that the audio element supports M4A files.'
-p119
-sg10
-(lp120
-(dp121
-g13
-I01
-sg17
-(lp122
-S'BUGCR16779'
-p123
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/media-fullscreen-not-in-document.html'
-p124
-(dp125
-g8
-S'Test media element fullscreen API when an element is not in the DOM.'
-p126
-sg10
-(lp127
-(dp128
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented the WebKit fullscreen extension. UNIMPLEMENTED"
-p129
-sg17
-(lp130
-S'BUGCR16735'
-p131
-asassS'media/audio-mpeg-supported.html'
-p132
-(dp133
-g8
-S'Test that the audio element supports MPEG files.'
-p134
-sg10
-(lp135
-(dp136
-g13
-I01
-sg17
-(lp137
-S'BUGCR16779'
-p138
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/track/track-webvtt-tc003-newlines.html'
-p139
-(dp140
-g8
-S'Tests that line terminators \\r, \\n, or \\r\\n are properly parsed, even when there is no newline at eof.'
-p141
-sg10
-g11
-ssS'media/video-document-types.html'
-p142
-(dp143
-g8
-S"This tests that a standalone MPEG-4 file with 'sdsm' and 'odsm' tracks is opened in a MediaDocument."
-p144
-sg10
-(lp145
-(dp146
-g13
-I01
-sg17
-(lp147
-S'BUGCR16779'
-p148
-asg15
-g66
-sg14
-I01
-sg25
-I01
-sg35
-I01
-sassS'media/track/track-webvtt-tc002-bom.html'
-p149
-(dp150
-g8
-S'Tests that the parser properly ignores a UTF-8 BOM character at the beginning of a file and all other cues are properly parsed.'
-p151
-sg10
-g11
-ssS'media/video-does-not-loop.html'
-p152
-(dp153
-g8
-S"Test to make sure QuickTime movie saved with 'loop' user data does not loop automatically."
-p154
-sg10
-(lp155
-(dp156
-g13
-I01
-sg35
-I01
-sg14
-I01
-sg15
-S" Doesn't apply to Chromium (QuickTime-specific behavior)"
-p157
-sassS'media/track/track-webvtt-tc000-empty.html'
-p158
-(dp159
-g8
-S'Tests that an empty file is not recognized as a WebVTT file.'
-p160
-sg10
-g11
-ssS'media/media-can-play-mpeg4-video.html'
-p161
-(dp162
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with'
-p163
-sg10
-(lp164
-(dp165
-g13
-I01
-sg35
-I01
-sg17
-(lp166
-S'BUGWK45102'
-p167
-asg15
-g66
-sg100
-I01
-sassS'compositing/video/video-background-color.html'
-p168
-(dp169
-g8
-S'Video with background color'
-p170
-sg10
-(lp171
-(dp172
-g25
-I01
-sg13
-I01
-sg35
-I01
-sg17
-(lp173
-S'BUGWK55519'
-p174
-asg15
-S" Chromium's video codecs don't support alpha information encoded in the video data, so this test is not applicable."
-p175
-sassS'media/track/track-webvtt-tc010-notimings.html'
-p176
-(dp177
-g8
-S'Tests cue without timings are ignored.'
-p178
-sg10
-g11
-ssS'media/video-timeupdate-reverse-play.html'
-p179
-(dp180
-g8
-S"Tests that a 'timeupdate' event is fired when a movie plays<br> in reverse to time zero."
-p181
-sg10
-(lp182
-(dp183
-g13
-I01
-sg14
-I01
-sg15
-S" We haven't implemented reverse audio/video playback. UNIMPLEMENTED BUGCR33099 Implement reverse audio/video playback"
-p184
-sg17
-(lp185
-S'BUGCR33099'
-p186
-asassS'http/tests/media/video-buffered.html'
-p187
-(dp188
-g8
-g69
-sg10
-(lp189
-(dp190
-g13
-I01
-sg17
-(lp191
-S'BUGCR49165'
-p192
-asg15
-S' video.buffered multiple TimeRanges support.'
-p193
-sg49
-I01
-sassS'media/track/track-webvtt-tc001-utf8.html'
-p194
-(dp195
-g8
-S'Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as WebVTT a file (we do allow it, it just looks ugly).'
-p196
-sg10
-g11
-ssS'media/track/track-webvtt-tc013-settings.html'
-p197
-(dp198
-g8
-S'Tests WebVTT settings.'
-p199
-sg10
-g11
-ssS'media/media-fullscreen-inline.html'
-p200
-(dp201
-g8
-S'Test media element fullscreen API when an element is in the DOM.'
-p202
-sg10
-(lp203
-(dp204
-g13
-I01
-sg14
-I01
-sg15
-g129
-sg17
-(lp205
-S'BUGCR16735'
-p206
-asassS'media/track/track-webvtt-tc007-cuenoid.html'
-p207
-(dp208
-g8
-S'Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.'
-p209
-sg10
-g11
-ssS'media/track/track-webvtt-tc009-timingshour.html'
-p210
-(dp211
-g8
-S'Tests cue timings that contain hours (they are optional), and tests various syntax errors in timings with hours.'
-p212
-sg10
-g11
-ssS'media/track/track-webvtt-tc006-cueidentifiers.html'
-p213
-(dp214
-g8
-S'Tests that any text other than "-->" is recognized as optional cue identifier.'
-p215
-sg10
-g11
-ssS'media/video-element-other-namespace-crash.html'
-p216
-(dp217
-g8
-g69
-sg10
-(lp218
-(dp219
-g13
-I01
-sg35
-I01
-sg14
-I01
-sg15
-g66
-sg17
-(lp220
-S'BUGCR68289'
-p221
-asassS'media/video-reverse-play-duration.html'
-p222
-(dp223
-g8
-S'Tests that duration is not set to zero when playing in reverse to the origin.'
-p224
-sg10
-(lp225
-(dp226
-g13
-I01
-sg14
-I01
-sg15
-g184
-sg17
-(lp227
-S'BUGCR33099'
-p228
-asasssS'whole'
-p229
-(dp230
-S'media/video-source-type.html'
-p231
-(dp232
-g8
-S'&lt;source&gt; @type attribute'
-p233
-ssS'media/media-startTime.html'
-p234
-(dp235
-g8
-S"Test the, so far unused, 'startTime' attribute."
-p236
-ssS'media/video-src-set.html'
-p237
-(dp238
-g8
-S'Test that setting src attribute triggers load'
-p239
-ssg20
-g21
-sS'media/video-played-ranges-1.html'
-p240
-(dp241
-g8
-S"Test of the media element 'played' attribute, ranges part 1."
-p242
-ssS'media/video-layer-crash.html'
-p243
-(dp244
-g8
-S'Test dynamic removal of transformed and reflected video'
-p245
-ssS'http/tests/media/video-play-stall-seek.html'
-p246
-(dp247
-g8
-S'Test that playback can be resumed by seeking backwards after load stalls.'
-p248
-sg10
-(lp249
-(dp250
-g14
-I01
-sg15
-S' Timing out.'
-p251
-sg17
-(lp252
-S'BUGCR78376'
-p253
-asassg59
-g60
-sg78
-g79
-sg85
-g86
-sS'http/tests/media/video-referer.html'
-p254
-(dp255
-g8
-S'Tests that the media player will send the relevant referer when requesting the media file.<br/>'
-p256
-ssS'media/video-source-removed.html'
-p257
-(dp258
-g8
-S'consoleWrite("PASS: A crash did not occur when removing &lt;source&gt; elements.<br>");'
-p259
-ssS'media/unsupported-tracks.html'
-p260
-(dp261
-g8
-S'Test that QuickTime file with unsupported track types only generates an error.'
-p262
-ssg117
-g118
-sS'media/audio-no-installed-engines.html'
-p263
-(dp264
-g8
-S'PASSED -- crash using Audio with no installed engines bug 27479.'
-p265
-ssg124
-g125
-sS'media/video-dom-src.html'
-p266
-(dp267
-g8
-g69
-ssS'media/media-blocked-by-willsendrequest.html'
-p268
-(dp269
-g8
-S'consoleWrite("This test can only be run in DumpRenderTree!<br><br>");'
-p270
-ssS'media/video-error-does-not-exist.html'
-p271
-(dp272
-g8
-S'Test that the media element is in correct state after load fails.'
-p273
-ssS'media/video-play-pause-events.html'
-p274
-(dp275
-g8
-S'Test that calling play() and pause() triggers async play, timeupdate and pause events.'
-p276
-ssS'media/video-display-none-crash.html'
-p277
-(dp278
-g8
-S'Test that pause() after changing display to "none" doesn\'t cause a crash.'
-p279
-ssS'media/video-src-plus-source.html'
-p280
-(dp281
-g8
-S"Test that a &lt;source&gt; element is not used when a bogus 'src' attribute is present"
-p282
-ssS'media/video-source-none-supported.html'
-p283
-(dp284
-g8
-S'no usable &lt;source&gt; test'
-p285
-ssS'media/video-poster-blocked-by-willsendrequest.html'
-p286
-(dp287
-g8
-S'consoleWrite("<b>This test can only be run in DumpRenderTree!</b>");'
-p288
-ssg152
-g153
-sS'media/video-src.html'
-p289
-(dp290
-g8
-g69
-ssS'media/audio-controls-rendering.html'
-p291
-(dp292
-g8
-S'Test controls placement.'
-p293
-ssg168
-g169
-sS'media/video-source-inserted.html'
-p294
-(dp295
-g8
-S'networkState after inserting &lt;source&gt; test'
-p296
-ssS'media/media-can-play-octet-stream.html'
-p297
-(dp298
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".'
-p299
-ssS'media/constructors.html'
-p300
-(dp301
-g8
-S'Test that media constructors behave consistently.'
-p302
-ssS'media/video-source-media.html'
-p303
-(dp304
-g8
-g69
-ssg187
-g188
-sS'http/tests/security/local-video-source-from-remote.html'
-p305
-(dp306
-g8
-S'This test only behaves correctly in DRT'
-p307
-ssg194
-g195
-sS'media/video-source-type-params.html'
-p308
-(dp309
-g8
-g69
-ssS'fast/canvas/webgl/context-lost.html'
-p310
-(dp311
-g8
-S'debug("Test valid context");'
-p312
-ssS'media/media-can-play-wav-audio.html'
-p313
-(dp314
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method with multiple .wav MIME types.'
-p315
-ssS'media/video-source-error.html'
-p316
-(dp317
-g8
-S'&lt;video&gt; and &lt;source&gt; error test'
-p318
-sg10
-(lp319
-(dp320
-S'DEBUG'
-p321
-I01
-sg100
-I01
-sg17
-(lp322
-S'BUGWK66310'
-p323
-asg15
-S''
-p324
-sg49
-I01
-sassS'media/video-no-audio.html'
-p325
-(dp326
-g8
-S'Movie with no audio track. The volume button should not render.'
-p327
-ssS'media/svg-as-image-with-media-blocked.html'
-p328
-(dp329
-g8
-S'This test attempts to load foreignObject audio and video embedded in an SVG'
-p330
-ssg207
-g208
-sg107
-g108
-sS'media/video-click-dblckick-standalone.html'
-p331
-(dp332
-g8
-S'This tests that clicking on a standalone video will pause and double-clicking will play.'
-p333
-ssS'media/video-pause-immediately.html'
-p334
-(dp335
-g8
-S'Test that pausing the media element has an immediate effect on the clock.'
-p336
-ssS'fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html'
-p337
-(dp338
-g8
-g69
-ssg222
-g223
-sS'http/tests/security/local-video-src-from-remote.html'
-p339
-(dp340
-g8
-S'This test only works in DRT'
-p341
-ssg200
-g201
-sS'media/video-controls-in-media-document.html'
-p342
-(dp343
-g8
-g69
-ssS'media/remove-from-document-no-load.html'
-p344
-(dp345
-g8
-S'Test that removing a media element from the tree when no media has been loaded does not generate a loadstart event.'
-p346
-ssS'media/video-currentTime.html'
-p347
-(dp348
-g8
-g69
-ssS'media/video-frame-accurate-seek.html'
-p349
-(dp350
-g8
-S'Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.'
-p351
-sg10
-(lp352
-(dp353
-g72
-I01
-sg17
-(lp354
-S'BUGCR72223'
-p355
-asg15
-g324
-sg49
-I01
-sassg30
-g31
-sg39
-g40
-sS'media/media-controls-clone-crash.html'
-p356
-(dp357
-g8
-S'Test passes if it does not crash.'
-p358
-ssg50
-g51
-sS'media/controls-css-overload.html'
-p359
-(dp360
-g8
-S"Testing that overloading some controls doesn't crash the browser"
-p361
-ssS'media/video-display-aspect-ratio.html'
-p362
-(dp363
-g8
-g69
-ssS'media/video-currentTime-set.html'
-p364
-(dp365
-g8
-S"Test that setting currentTime changes the time, and that 'ended' event is fired in a reasonable amount of time"
-p366
-ssS'media/media-blocked-by-beforeload.html'
-p367
-(dp368
-g8
-S'Test to ensure that a media file blocked by a beforeload handler generates an error'
-p369
-sg10
-(lp370
-(dp371
-g100
-I01
-sg17
-(lp372
-S'BUGWK66310'
-p373
-asg15
-g324
-sg49
-I01
-sassg104
-g105
-sS'media/video-controls-visible-audio-only.html'
-p374
-(dp375
-g8
-S'This test only runs in DRT!'
-p376
-ssS'http/tests/media/video-play-progress.html'
-p377
-(dp378
-g8
-S'Test that at least one progress event is fired after starting to load the video.'
-p379
-ssg110
-g111
-sS'media/video-source-moved.html'
-p380
-(dp381
-g8
-S'moving &lt;source&gt; element test'
-p382
-ssg101
-g102
-sS'media/video-src-none.html'
-p383
-(dp384
-g8
-g69
-ssS'media/video-controls-zoomed.html'
-p385
-(dp386
-g8
-S'This test only runs in DRT!'
-p387
-ssS'media/video-controls.html'
-p388
-(dp389
-g8
-S"Test 'controls' attribute"
-p390
-ssS'media/controls-without-preload.html'
-p391
-(dp392
-g8
-S'The controls should not depend on preload value.'
-p393
-ssS'media/video-played-collapse.html'
-p394
-(dp395
-g8
-S"Test of the media element 'played' attribute"
-p396
-ssS'compositing/self-painting-layers.html'
-p397
-(dp398
-g8
-S'Self painting layers'
-p399
-ssS'media/audio-controls-do-not-fade-out.html'
-p400
-(dp401
-g8
-S'This tests that audio controls do not fade out when the audio is playing.'
-p402
-ssS'media/media-document-audio-repaint.html'
-p403
-(dp404
-g8
-S'This tests that in a standalone media document with audio content, the media element repaints correctly'
-p405
-sg10
-(lp406
-(dp407
-g100
-I01
-sg72
-I01
-sg17
-(lp408
-S'BUGCR75354'
-p409
-aS'BUGWK55718'
-p410
-asg15
-S' This test needs completely new baselines.'
-p411
-sS'IMAGE+TEXT'
-p412
-I01
-sa(dp413
-S'NEWADDED'
-p414
-I01
-sg100
-I01
-sg72
-I01
-sg17
-g408
-sg15
-g411
-sg412
-I01
-sassS'compositing/geometry/video-opacity-overlay.html'
-p415
-(dp416
-g8
-S'Video overlay'
-p417
-ssS'media/video-source-error-no-candidate.html'
-p418
-(dp419
-g8
-S"Test that 'error' events are fired from &lt;source&gt; element when it can not be used."
-p420
-ssS'media/audio-constructor.html'
-p421
-(dp422
-g8
-S'Test that Audio() object loads the resource after src attribute is set and load() is called.'
-p423
-ssS'media/controls-styling.html'
-p424
-(dp425
-g8
-S'The look of the controls should not change.'
-p426
-ssS'media/video-buffered.html'
-p427
-(dp428
-g8
-g69
-ssS'media/event-attributes.html'
-p429
-(dp430
-g8
-g69
-ssg176
-g177
-sg179
-g180
-sS'http/tests/media/text-served-as-text.html'
-p431
-(dp432
-g8
-S"text file served as 'text/plain'"
-p433
-ssS'http/tests/media/video-cancel-load.html'
-p434
-(dp435
-g8
-S'Cancel loading a video file and access its properties afterwards.'
-p436
-ssS'media/unsupported-rtsp.html'
-p437
-(dp438
-g8
-S'Test that QuickTime file with RTSP URL generates a load error.'
-p439
-ssS'media/media-controls-clone.html'
-p440
-(dp441
-g8
-S'<video controls id=v></video><audio controls id=a></audio>'
-p442
-ssS'media/broken-video.html'
-p443
-(dp444
-g8
-S'Test that QuickTime file with broken content generates an error.'
-p445
-ssS'media/video-plays-past-end-of-test.html'
-p446
-(dp447
-g8
-g69
-ssS'http/tests/canvas/webgl/origin-clean-conformance.html'
-p448
-(dp449
-g8
-S'WebGL Origin Restrictions Conformance Tests'
-p450
-ssS'media/video-replaces-poster.html'
-p451
-(dp452
-g8
-S'Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34966">https://bugs.webkit.org/show_bug.cgi?id=34966</a>. <br>'
-p453
-ssS'media/video-autoplay.html'
-p454
-(dp455
-g8
-g69
-ssS'media/video-set-rate-from-pause.html'
-p456
-(dp457
-g8
-S'Test that setting a non-zero rate causes an async timeupdate event.'
-p458
-ssS'media/video-src-remove.html'
-p459
-(dp460
-g8
-S"Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements"
-p461
-ssS'media/csp-blocks-video.html'
-p462
-(dp463
-g8
-S"This test passes if it doesn't alert failure."
-p464
-ssS'media/controls-drag-timebar.html'
-p465
-(dp466
-g8
-S'Test that dragging the timebar thumb causes seeks.'
-p467
-ssS'media/audio-constructor-preload.html'
-p468
-(dp469
-g8
-S"Test that Audio() sets 'preload' attribute."
-p470
-ssS'media/video-src-invalid-poster.html'
-p471
-(dp472
-g8
-g69
-ssS'media/adopt-node-crash.html'
-p473
-(dp474
-g8
-S"Tests that we don't crash when moving a video element to a new document."
-p475
-ssS'media/video-playbackrate.html'
-p476
-(dp477
-g8
-S'test playbackRate and defaultPlaybackRate'
-p478
-ssS'media/video-muted.html'
-p479
-(dp480
-g8
-S"Test 'muted' attribute"
-p481
-ssS'media/video-src-change.html'
-p482
-(dp483
-g8
-S'1. Test that an invalid src attribute fires an error when the file fails to load.<br>'
-p484
-ssg216
-g217
-sS'media/video-play-pause-exception.html'
-p485
-(dp486
-g8
-S'Video has no src. Test that the playing event is not dispatched.'
-p487
-ssS'fast/dom/shadow/frameless-media-element-crash.html'
-p488
-(dp489
-g8
-g69
-ssS'media/audio-play-event.html'
-p490
-(dp491
-g8
-S"Test that a 'play' event listener is triggered when fired by a new audio element."
-p492
-ssS'media/before-load-member-access.html'
-p493
-(dp494
-g8
-S'Test that accessing member of a non loaded video works.'
-p495
-ssS'media/video-width-height.html'
-p496
-(dp497
-g8
-g69
-ssS'media/audio-repaint.html'
-p498
-(dp499
-g8
-S'This tests that in a html document with inline audio content, the media element repaints correctly'
-p500
-ssS'media/video-currentTime-delay.html'
-p501
-(dp502
-g8
-S'Test a delay in playing the movie results in a canPlay event.'
-p503
-ssS'media/video-aspect-ratio.html'
-p504
-(dp505
-g8
-S'Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size.'
-p506
-ssS'media/video-transformed.html'
-p507
-(dp508
-g8
-S'Test painting of transformed video'
-p509
-ssS'fast/dom/beforeload/remove-video-in-beforeload-listener.html'
-p510
-(dp511
-g8
-S'This page tests that you can correctly remove a video object in a beforeload listener without causing a crash.'
-p512
-ssS'media/invalid-media-url-crash.html'
-p513
-(dp514
-g8
-S'Tests that invalid media src url does not result in crash.'
-p515
-ssS'media/video-empty-source.html'
-p516
-(dp517
-g8
-S'Slider drawing with no source. The controls should render correctly.'
-p518
-ssg93
-g94
-sS'media/video-poster.html'
-p519
-(dp520
-g8
-S'Test &lt;video&gt; element with and without a poster.'
-p521
-ssS'media/media-document-audio-size.html'
-p522
-(dp523
-g8
-S'This tests that in a standalone media document with audio content, the media element has non-zero'
-p524
-ssg132
-g133
-sS'compositing/overflow/overflow-compositing-descendant.html'
-p525
-(dp526
-g8
-S'You should see a green box under the video. If you see red, the test failed.'
-p527
-ssS'media/video-dom-autoplay.html'
-p528
-(dp529
-g8
-g69
-ssS'media/media-ended.html'
-p530
-(dp531
-g8
-S'<b>Test ended by:</b>'
-p532
-ssS'media/video-no-autoplay.html'
-p533
-(dp534
-g8
-S'Test that play event does not fire when "src" set with no autoplay attribute.'
-p535
-ssS'media/video-zoom.html'
-p536
-(dp537
-g8
-S'150% zoom, with width and height attributes'
-p538
-sg10
-(lp539
-(dp540
-g44
-I01
-sg72
-I01
-sg17
-(lp541
-S'BUGCR86714'
-p542
-asg15
-g324
-sg76
-I01
-sg77
-I01
-sassS'media/video-append-source.html'
-p543
-(dp544
-g8
-g69
-ssg139
-g140
-sS'http/tests/media/pdf-served-as-pdf.html'
-p545
-(dp546
-g8
-S"PDF file served as 'application/pdf'"
-p547
-ssS'media/video-play-empty-events.html'
-p548
-(dp549
-g8
-S'Test that play() from EMPTY network state triggers load() and async play event.'
-p550
-ssg149
-g150
-sS'media/audio-only-video-intrinsic-size.html'
-p551
-(dp552
-g8
-S'This tests the intrinsic size of a video element is the default 300&#xd7;150 before metadata is'
-p553
-ssg142
-g143
-sS'media/audio-delete-while-slider-thumb-clicked.html'
-p554
-(dp555
-g8
-S"This tests that events don't continue to target a slider thumb if the media element is deleted while scrubbing."
-p556
-ssS'media/media-can-play-ogg.html'
-p557
-(dp558
-g8
-S'Test HTMLMediaElement <em>canPlayType()</em> method for ogg media containers.'
-p559
-ssg6
-g7
-sg158
-g159
-sS'media/video-currentTime-set2.html'
-p560
-(dp561
-g8
-g69
-ssS'media/video-seekable.html'
-p562
-(dp563
-g8
-g69
-ssS'fast/dom/beforeload/video-before-load.html'
-p564
-(dp565
-g8
-g69
-ssS'media/video-played-reset.html'
-p566
-(dp567
-g8
-S"Test of the media element 'played' attribute"
-p568
-ssS'compositing/self-painting-layers2.html'
-p569
-(dp570
-g8
-S'This test should not assert in debug builds.'
-p571
-ssS'media/controls-right-click-on-timebar.html'
-p572
-(dp573
-g8
-S'Test that right clicking on the timebar does not cause a seek.'
-p574
-ssS'media/video-dom-preload.html'
-p575
-(dp576
-g8
-S'consoleWrite("++ Test default attribute value");'
-p577
-ssS'media/video-size.html'
-p578
-(dp579
-g8
-S"Test &lt;video&gt; element size with and without 'src' and 'poster' attributes."
-p580
-ssS'media/video-delay-load-event.html'
-p581
-(dp582
-g8
-S"Test the document's load event is delayed until a movie's meta data is available."
-p583
-sg10
-(lp584
-(dp585
-g100
-I01
-sg17
-(lp586
-S'BUGWK64003'
-p587
-asg15
-S' Started around WebKit r90233:r90242'
-p588
-sg76
-I01
-sg49
-I01
-sg321
-I01
-sassS'media/fallback.html'
-p589
-(dp590
-g8
-S'Test that fallback content is not rendered'
-p591
-ssS'fast/layers/video-layer.html'
-p592
-(dp593
-g8
-S'Video element gets layer'
-p594
-ssS'media/controls-strict.html'
-p595
-(dp596
-g8
-S'Drawing the controls in strict mode.'
-p597
-ssS'media/remove-from-document.html'
-p598
-(dp599
-g8
-S'Test that removing a media element from the tree pauses playback but does not unload the media.'
-p600
-ssS'http/tests/media/remove-while-loading.html'
-p601
-(dp602
-g8
-S'Test that removing a media element from the tree while loading does not crash.'
-p603
-ssS'media/video-controls-transformed.html'
-p604
-(dp605
-g8
-S'This test only runs in DRT!'
-p606
-ssS'compositing/video/video-poster.html'
-p607
-(dp608
-g8
-S'Video with poster'
-p609
-ssS'http/tests/media/media-can-load-when-hidden.html'
-p610
-(dp611
-g8
-S'Test HTMLMediaElement to be sure that the video is getting loaded even if the element'
-p612
-ssS'media/video-display-toggle.html'
-p613
-(dp614
-g8
-S"This tests that toggling the display property won't make the controls disappear.<br>"
-p615
-ssS'media/video-seek-no-src-exception.html'
-p616
-(dp617
-g8
-S"Test that seeking video with no 'src' attribute throws an INVALID_STATE_ERR exception."
-p618
-ssS'media/audio-constructor-src.html'
-p619
-(dp620
-g8
-S'Test that Audio("url") constructor loads the specified resource.'
-p621
-ssS'compositing/geometry/clipped-video-controller.html'
-p622
-(dp623
-g8
-S'Clipped Video'
-p624
-ssS'media/video-preload.html'
-p625
-(dp626
-g8
-S"Test to see if media loads automatically when 'preload' is specified."
-p627
-ssS'http/tests/media/video-load-twice.html'
-p628
-(dp629
-g8
-g69
-ssS'http/tests/security/local-video-poster-from-remote.html'
-p630
-(dp631
-g8
-S'This test requires the run-webkit httpd server (run-webkit-httpd)'
-p632
-ssS'media/video-seek-past-end-playing.html'
-p633
-(dp634
-g8
-S"Test that seeking video with 'loop' past it's end rewinds to the beginning and continues playback."
-p635
-ssS'media/video-source.html'
-p636
-(dp637
-g8
-g69
-ssS'http/tests/media/reload-after-dialog.html'
-p638
-(dp639
-g8
-S"Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>"
-p640
-ssS'media/media-constants.html'
-p641
-(dp642
-g8
-S'Test HTMLMediaElement and MediaError constants.'
-p643
-ssS'media/video-volume.html'
-p644
-(dp645
-g8
-S"Test 'volume' attribute"
-p646
-ssS'media/video-src-source.html'
-p647
-(dp648
-g8
-g69
-ssS'http/tests/appcache/video.html'
-p649
-(dp650
-g8
-S'Test that &lt;video&gt; can be loaded from the application cache.'
-p651
-ssg53
-g54
-sg67
-g68
-sS'media/video-canvas-source.html'
-p652
-(dp653
-g8
-S'Drawing to canvas using video with source element does not taint canvas'
-p654
-ssS'media/video-controls-no-scripting.html'
-p655
-(dp656
-g8
-S'Tests that the built-in controls are always enabled when JavaScript is disabled.'
-p657
-ssS'media/video-poster-scale.html'
-p658
-(dp659
-g8
-S"'poster' aspect ratio test"
-p660
-ssS'media/video-seek-by-small-increment.html'
-p661
-(dp662
-g8
-S'Test seeking by very small increments.'
-p663
-ssS'media/video-controls-with-mutation-event-handler.html'
-p664
-(dp665
-g8
-S"This tests that we don't crash while creating a video element while a DOMSubtreeModified even handler is registered."
-p666
-ssS'media/video-zoom-controls.html'
-p667
-(dp668
-g8
-S'Zoomed video with controls.'
-p669
-ssS'media/video-loop.html'
-p670
-(dp671
-g8
-S'consoleWrite("<em>++ Test setting/removing the attribute.</em>");'
-p672
-sg10
-(lp673
-(dp674
-S'WIN'
-p675
-I01
-sg49
-I01
-sg17
-(lp676
-S'BUGCR59415'
-p677
-asg15
-S' BUGCR59415 : cannot repro the flakiness'
-p678
-sg14
-I01
-sg100
-I01
-sassS'http/tests/media/video-play-stall.html'
-p679
-(dp680
-g8
-S'Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.'
-p681
-sg10
-(lp682
-(dp683
-g100
-I01
-sg17
-(lp684
-S'BUGCR73609'
-p685
-asg15
-S' canplaythrough event is sent too early.'
-p686
-sassS'media/video-seeking.html'
-p687
-(dp688
-g8
-S'Test that seeking attribute is true immediately after a seek,'
-p689
-ssS'compositing/overflow/scroll-ancestor-update.html'
-p690
-(dp691
-g8
-S'The green box should obscure the red box, and move when you drag the scrollbar.'
-p692
-ssS'media/controls-after-reload.html'
-p693
-(dp694
-g8
-S'Making sure the controller looks ok after a second load().'
-p695
-ssg161
-g162
-sS'media/video-load-networkState.html'
-p696
-(dp697
-g8
-S'Test that setting src to an invalid url triggers load(), which sets networkState'
-p698
-ssS'http/tests/security/contentSecurityPolicy/media-src-allowed.html'
-p699
-(dp700
-g8
-g69
-ssS'compositing/reflections/load-video-in-reflection.html'
-p701
-(dp702
-g8
-S'You should see a reflected video below, rather than the red video background.'
-p703
-ssS'compositing/geometry/video-fixed-scrolling.html'
-p704
-(dp705
-g8
-S'Video overlay'
-p706
-ssS'media/video-controls-rendering.html'
-p707
-(dp708
-g8
-S'Test controls placement.'
-p709
-sg10
-(lp710
-(dp711
-g72
-I01
-sS'LINUX'
-p712
-I01
-sg17
-(lp713
-S'BUGCR74102'
-p714
-asg15
-S" 2 pixel stretching when rendering some videos with the GPU (Now it's flaky)"
-p715
-sg49
-I01
-sg77
-I01
-sa(dp716
-g44
-I01
-sg72
-I01
-sg17
-(lp717
-S'BUGCR86714'
-p718
-asg15
-g324
-sg76
-I01
-sg77
-I01
-sassS'http/tests/media/video-served-as-text.html'
-p719
-(dp720
-g8
-S"media file served as 'text/plain'"
-p721
-ssS'media/video-pause-empty-events.html'
-p722
-(dp723
-g8
-S'Test that pause() from EMPTY network state triggers load()'
-p724
-ssS'media/video-poster-delayed.html'
-p725
-(dp726
-g8
-S'Delayed load of poster should not overwrite intrinsic size of video'
-p727
-ssS'media/media-load-event.html'
-p728
-(dp729
-g8
-S'Test that media file is not reloaded when an element is inserted into the DOM.'
-p730
-ssS'http/tests/media/video-error-abort.html'
-p731
-(dp732
-g8
-S"'abort' event test"
-p733
-ssS'media/video-volume-slider.html'
-p734
-(dp735
-g8
-S'Test rendering of volume slider of video tag'
-p736
-ssS'media/video-seek-past-end-paused.html'
-p737
-(dp738
-g8
-S"Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused."
-p739
-ssS'http/tests/media/video-cookie.html'
-p740
-(dp741
-g8
-S'Tests that the media player will send the relevant cookies when requesting the media file.<br/>'
-p742
-ssS'media/remove-from-document-before-load.html'
-p743
-(dp744
-g8
-S'<body onload="document.body.innerHTML=\'PASS: A crash did not occur when the media element was removed before loading.\';'
-p745
-ssg210
-g211
-sS'media/video-duration-known-after-eos.html'
-p746
-(dp747
-g8
-S'Tests that duration is known after playback ended.'
-p748
-ssg213
-g214
-sS'http/tests/media/video-play-stall-before-meta-data.html'
-p749
-(dp750
-g8
-S'Test that stalling very early, while loading meta-data, stops delaying the load event.'
-p751
-ssS'media/video-timeupdate-during-playback.html'
-p752
-(dp753
-g8
-S"Test 'timeupdate' events are posted while playing but not while paused."
-p754
-ssS'media/video-single-valid-source.html'
-p755
-(dp756
-g8
-S'Test that a single valid &lt;source&gt; element loads correctly'
-p757
-ssS'media/video-src-invalid-remove.html'
-p758
-(dp759
-g8
-S"Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements"
-p760
-ssS'http/tests/security/contentSecurityPolicy/media-src-blocked.html'
-p761
-(dp762
-g8
-S"This test passes if it doesn't alert failure."
-p763
-ssg197
-g198
-sS'media/video-load-readyState.html'
-p764
-(dp765
-g8
-g69
-sssS'nonskip'
-p766
-(dp767
-g403
-g404
-sg349
-g350
-sg679
-g680
-sg246
-g247
-sg536
-g537
-sg670
-g671
-sg707
-g708
-sg581
-g582
-sg367
-g368
-sg316
-g317
-sssb.
\ No newline at end of file
diff --git a/src/cobalt/media/tools/layout_tests/test_expectations.py b/src/cobalt/media/tools/layout_tests/test_expectations.py
deleted file mode 100644
index b68bc09..0000000
--- a/src/cobalt/media/tools/layout_tests/test_expectations.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# Copyright (c) 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.
-
-"""A module to analyze test expectations for Webkit layout tests."""
-
-import urllib2
-
-from webkitpy.layout_tests.models.test_expectations import *
-
-# Default location for chromium test expectation file.
-# TODO(imasaki): support multiple test expectations files.
-DEFAULT_TEST_EXPECTATIONS_LOCATION = (
-    'http://src.chromium.org/blink/trunk/LayoutTests/TestExpectations')
-
-# The following is from test expectation syntax. The detail can be found in
-# http://www.chromium.org/developers/testing/webkit-layout-tests#TOC-Test-Expectations
-# <decision> ::== [SKIP] [WONTFIX] [SLOW]
-DECISION_NAMES = ['SKIP', 'WONTFIX', 'SLOW']
-# <config> ::== RELEASE | DEBUG
-CONFIG_NAMES = ['RELEASE', 'DEBUG']
-# Only hard code keywords we don't expect to change.  Determine the rest from
-# the format of the status line.
-KNOWN_TE_KEYWORDS = DECISION_NAMES + CONFIG_NAMES
-
-
-class TestExpectations(object):
-  """A class to model the content of test expectation file for analysis.
-
-  This class retrieves the TestExpectations file via HTTP from WebKit and uses
-  the WebKit layout test processor to process each line.
-
-  The resulting dictionary is stored in |all_test_expectation_info| and looks
-  like:
-
-    {'<test name>': [{'<modifier0>': True, '<modifier1>': True, ...,
-                     'Platforms: ['<platform0>', ... ], 'Bugs': ['....']}]}
-
-  Duplicate keys are merged (though technically they shouldn't exist).
-
-  Example:
-    crbug.com/145590 [ Android ] \
-        platform/chromium/media/video-frame-size-change.html [ Timeout ]
-    webkit.org/b/84724 [ SnowLeopard ] \
-        platform/chromium/media/video-frame-size-change.html \
-        [ ImageOnlyFailure Pass ]
-
-  {'platform/chromium/media/video-frame-size-change.html': [{'IMAGE': True,
-   'Bugs': ['BUGWK84724', 'BUGCR145590'], 'Comments': '',
-   'Platforms': ['SNOWLEOPARD', 'ANDROID'], 'TIMEOUT': True, 'PASS': True}]}
-  """
-
-  def __init__(self, url=DEFAULT_TEST_EXPECTATIONS_LOCATION):
-    """Read the test expectation file from the specified URL and parse it.
-
-    Args:
-      url: A URL string for the test expectation file.
-
-    Raises:
-      NameError when the test expectation file cannot be retrieved from |url|.
-    """
-    self.all_test_expectation_info = {}
-    resp = urllib2.urlopen(url)
-    if resp.code != 200:
-      raise NameError('Test expectation file does not exist in %s' % url)
-    # Start parsing each line.
-    for line in resp.read().split('\n'):
-      line = line.strip()
-      # Skip comments.
-      if line.startswith('#'):
-        continue
-      testname, te_info = self.ParseLine(line)
-      if not testname or not te_info:
-        continue
-      if testname in self.all_test_expectation_info:
-        # Merge keys if entry already exists.
-        for k in te_info.keys():
-          if (isinstance(te_info[k], list) and
-              k in self.all_test_expectation_info[testname]):
-            self.all_test_expectation_info[testname][0][k] += te_info[k]
-          else:
-            self.all_test_expectation_info[testname][0][k] = te_info[k]
-      else:
-        self.all_test_expectation_info[testname] = [te_info]
-
-  @staticmethod
-  def ParseLine(line):
-    """Parses the provided line using WebKit's TextExpecations parser.
-
-    Returns:
-      Tuple of test name, test expectations dictionary.  See class documentation
-      for the format of the dictionary
-    """
-    test_expectation_info = {}
-    parsed = TestExpectationParser._tokenize_line('TestExpectations', line, 0)
-    if parsed.is_invalid():
-      return None, None
-
-    test_expectation_info['Comments'] = parsed.comment or ''
-    test_expectation_info['Bugs'] = parsed.bugs or [];
-    test_expectation_info['Platforms'] =  parsed.specifiers or []
-    # Shovel the expectations and modifiers in as "<key>: True" entries.  Ugly,
-    # but required by the rest of the pipeline for parsing.
-    for m in parsed.expectations:
-      test_expectation_info[m] = True
-
-    return parsed.name, test_expectation_info
diff --git a/src/cobalt/media/tools/layout_tests/test_expectations_history.py b/src/cobalt/media/tools/layout_tests/test_expectations_history.py
deleted file mode 100644
index 5d03e0f..0000000
--- a/src/cobalt/media/tools/layout_tests/test_expectations_history.py
+++ /dev/null
@@ -1,128 +0,0 @@
-# Copyright (c) 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.
-
-"""A module for the history of the test expectation file."""
-
-from datetime import datetime
-from datetime import timedelta
-
-import os
-import re
-import sys
-import tempfile
-import time
-import pysvn
-
-TEST_EXPECTATIONS_ROOT = 'http://src.chromium.org/blink/trunk/'
-# A map from earliest revision to path.
-# TODO(imasaki): support multiple test expectation files.
-TEST_EXPECTATIONS_LOCATIONS = {
-    148348: 'LayoutTests/TestExpectations',
-    119317: 'LayoutTests/platform/chromium/TestExpectations',
-    0: 'LayoutTests/platform/chromium/test_expectations.txt'}
-TEST_EXPECTATIONS_DEFAULT_PATH = (
-    TEST_EXPECTATIONS_ROOT + TEST_EXPECTATIONS_LOCATIONS[148348])
-
-class TestExpectationsHistory(object):
-  """A class to represent history of the test expectation file.
-
-  The history is obtained by calling PySVN.log()/diff() APIs.
-
-  TODO(imasaki): Add more functionalities here like getting some statistics
-      about the test expectation file.
-  """
-
-  @staticmethod
-  def GetTestExpectationsPathForRevision(revision):
-    for i in sorted(TEST_EXPECTATIONS_LOCATIONS.keys(), reverse=True):
-      if revision >= i:
-        return TEST_EXPECTATIONS_ROOT + TEST_EXPECTATIONS_LOCATIONS[i]
-
-  @staticmethod
-  def GetDiffBetweenTimes(start, end, testname_list,
-                          te_location=TEST_EXPECTATIONS_DEFAULT_PATH):
-    """Get difference between time period for the specified test names.
-
-    Given the time period, this method first gets the revision number. Then,
-    it gets the diff for each revision. Finally, it keeps the diff relating to
-    the test names and returns them along with other information about
-    revision.
-
-    Args:
-      start: A timestamp specifying start of the time period to be
-          looked at.
-      end: A timestamp object specifying end of the time period to be
-          looked at.
-      testname_list: A list of strings representing test names of interest.
-      te_location: A location of the test expectation file.
-
-    Returns:
-      A list of tuples (old_rev, new_rev, author, date, message, lines). The
-          |lines| contains the diff of the tests of interest.
-    """
-    temp_directory = tempfile.mkdtemp()
-    test_expectations_path = os.path.join(temp_directory, 'TestExpectations')
-    # Get directory name which is necesary to call PySVN.checkout().
-    te_location_dir = te_location[0:te_location.rindex('/')]
-    client = pysvn.Client()
-    client.checkout(te_location_dir, temp_directory, recurse=False)
-    # PySVN.log() (http://pysvn.tigris.org/docs/pysvn_prog_ref.html
-    # #pysvn_client_log) returns the log messages (including revision
-    # number in chronological order).
-    logs = client.log(test_expectations_path,
-                      revision_start=pysvn.Revision(
-                          pysvn.opt_revision_kind.date, start),
-                      revision_end=pysvn.Revision(
-                          pysvn.opt_revision_kind.date, end))
-    result_list = []
-    gobackdays = 1
-    while gobackdays < sys.maxint:
-      goback_start = time.mktime(
-          (datetime.fromtimestamp(start) - (
-              timedelta(days=gobackdays))).timetuple())
-      logs_before_time_period = (
-          client.log(test_expectations_path,
-                     revision_start=pysvn.Revision(
-                         pysvn.opt_revision_kind.date, goback_start),
-                     revision_end=pysvn.Revision(
-                         pysvn.opt_revision_kind.date, start)))
-      if logs_before_time_period:
-        # Prepend at the beginning of logs.
-        logs.insert(0, logs_before_time_period[len(logs_before_time_period)-1])
-        break
-      gobackdays *= 2
-
-    for i in xrange(len(logs) - 1):
-      old_rev = logs[i].revision.number
-      new_rev = logs[i + 1].revision.number
-      # Parsing the actual diff.
-
-      new_path = TestExpectationsHistory.GetTestExpectationsPathForRevision(
-          new_rev);
-      old_path = TestExpectationsHistory.GetTestExpectationsPathForRevision(
-          old_rev);
-
-      text = client.diff(temp_directory,
-                         url_or_path=old_path,
-                         revision1=pysvn.Revision(
-                             pysvn.opt_revision_kind.number, old_rev),
-                         url_or_path2=new_path,
-                         revision2=pysvn.Revision(
-                             pysvn.opt_revision_kind.number, new_rev))
-      lines = text.split('\n')
-      target_lines = []
-      for line in lines:
-        for testname in testname_list:
-          matches = re.findall(testname, line)
-          if matches:
-            if line[0] == '+' or line[0] == '-':
-              target_lines.append(line)
-      if target_lines:
-        # Needs to convert to normal date string for presentation.
-        result_list.append((
-            old_rev, new_rev, logs[i + 1].author,
-            datetime.fromtimestamp(
-                logs[i + 1].date).strftime('%Y-%m-%d %H:%M:%S'),
-            logs[i + 1].message, target_lines))
-    return result_list
diff --git a/src/cobalt/media/tools/layout_tests/test_expectations_history_unittest.py b/src/cobalt/media/tools/layout_tests/test_expectations_history_unittest.py
deleted file mode 100755
index dafc980..0000000
--- a/src/cobalt/media/tools/layout_tests/test_expectations_history_unittest.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-from datetime import datetime
-
-import calendar
-import unittest
-
-
-from test_expectations_history import TestExpectationsHistory
-
-
-class TestTestExpectationsHistory(unittest.TestCase):
-  """Unit tests for the TestExpectationsHistory class."""
-
-  def AssertTestName(self, result_list, testname):
-    """Assert test name in the result_list.
-
-    Args:
-      result_list: a result list of tuples returned by
-          |GetDiffBetweenTimesOnly1Diff()|. Each tuple consists of
-          (old_rev, new_rev, author, date, message, lines) where
-          |lines| are the entries in the test expectation file.
-      testname: a testname string.
-
-    Returns:
-      True if the result contains the testname, False otherwise.
-    """
-    for (_, _, _, _, _, lines) in result_list:
-      if any([testname in line for line in lines]):
-        return True
-    return False
-
-  # These tests use the following commit.
-  # commit 235788e3a4fc71342a5c9fefe67ce9537706ce35
-  # Author: rniwa@webkit.org
-  # Date:   Sat Aug 20 06:19:11 2011 +0000
-
-  def testGetDiffBetweenTimes(self):
-    ptime = calendar.timegm((2011, 8, 20, 0, 0, 0, 0, 0, 0))
-    ctime = calendar.timegm((2011, 8, 21, 0, 0, 0, 0, 0, 0))
-    testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html'
-    testname_list = [testname]
-    result_list = TestExpectationsHistory.GetDiffBetweenTimes(
-        ptime, ctime, testname_list)
-    self.assertTrue(self.AssertTestName(result_list, testname))
-
-  def testGetDiffBetweenTimesOnly1Diff(self):
-    ptime = calendar.timegm((2011, 8, 20, 6, 0, 0, 0, 0, 0))
-    ctime = calendar.timegm((2011, 8, 20, 7, 0, 0, 0, 0, 0))
-    testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html'
-    testname_list = [testname]
-    result_list = TestExpectationsHistory.GetDiffBetweenTimes(
-        ptime, ctime, testname_list)
-    self.assertTrue(self.AssertTestName(result_list, testname))
-
-  def testGetDiffBetweenTimesOnly1DiffWithGobackSeveralDays(self):
-    ptime = calendar.timegm((2011, 9, 12, 1, 0, 0, 0, 0, 0))
-    ctime = calendar.timegm((2011, 9, 12, 2, 0, 0, 0, 0, 0))
-    testname = 'media/video-zoom-controls.html'
-    testname_list = [testname]
-    result_list = TestExpectationsHistory.GetDiffBetweenTimes(
-        ptime, ctime, testname_list)
-    self.assertTrue(self.AssertTestName(result_list, testname))
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/layout_tests/test_expectations_unittest.py b/src/cobalt/media/tools/layout_tests/test_expectations_unittest.py
deleted file mode 100755
index b5ed2bf..0000000
--- a/src/cobalt/media/tools/layout_tests/test_expectations_unittest.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-import unittest
-
-from test_expectations import TestExpectations
-
-
-class TestTestExpectations(unittest.TestCase):
-
-  def testParseLine(self):
-    line = ('crbug.com/86714 [ Mac Gpu ] media/video-zoom.html [ Crash '
-            'ImageOnlyFailure ]')
-    expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'],
-                    'Comments': '', 'MAC': True, 'Gpu': True,
-                    'Platforms': ['MAC', 'Gpu']}
-    self.assertEquals(TestExpectations.ParseLine(line),
-                      ('media/video-zoom.html', expected_map))
-
-  def testParseLineWithLineComments(self):
-    line = ('crbug.com/86714 [ Mac Gpu ] media/video-zoom.html [ Crash '
-            'ImageOnlyFailure ] # foo')
-    expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'],
-                    'Comments': ' foo', 'MAC': True, 'Gpu': True,
-                    'Platforms': ['MAC', 'Gpu']}
-    self.assertEquals(TestExpectations.ParseLine(line),
-                      ('media/video-zoom.html', expected_map))
-
-  def testParseLineWithLineGPUComments(self):
-    line = ('crbug.com/86714 [ Mac ] media/video-zoom.html [ Crash '
-            'ImageOnlyFailure ] # Gpu')
-    expected_map = {'CRASH': True, 'IMAGE': True, 'Bugs': ['BUGCR86714'],
-                    'Comments': ' Gpu', 'MAC': True,
-                    'Platforms': ['MAC']}
-    self.assertEquals(TestExpectations.ParseLine(line),
-                      ('media/video-zoom.html', expected_map))
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/media/tools/layout_tests/testname/media.csv b/src/cobalt/media/tools/layout_tests/testname/media.csv
deleted file mode 100644
index 50569d2..0000000
--- a/src/cobalt/media/tools/layout_tests/testname/media.csv
+++ /dev/null
@@ -1,25 +0,0 @@
-compositing/geometry/clipped-video-controller.html,
-compositing/geometry/video-fixed-scrolling.html,
-compositing/geometry/video-opacity-overlay.html,
-compositing/overflow/overflow-compositing-descendant.html,
-compositing/overflow/scroll-ancestor-update.html,
-compositing/reflections/load-video-in-reflection.html,
-compositing/self-painting-layers.html,
-compositing/self-painting-layers2.html,
-compositing/video/video-background-color.html,
-compositing/video/video-poster.html,
-fast/canvas/webgl/context-lost.html,
-fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html,
-fast/dom/beforeload/remove-video-in-beforeload-listener.html,
-fast/dom/beforeload/video-before-load.html,
-fast/dom/shadow/frameless-media-element-crash.html,
-fast/events/constructors/media-key-event-constructor.html,
-fast/events/constructors/track-event-constructor.html,
-fast/layers/video-layer.html,
-http/tests/appcache/video.html,
-http/tests/canvas/webgl/origin-clean-conformance.html,
-http/tests/media/,
-http/tests/security/\S*video\S+.html,
-http/tests/security/contentSecurityPolicy/media-src-allowed.html,
-http/tests/security/contentSecurityPolicy/media-src-blocked.html,
-media/,
diff --git a/src/cobalt/media/tools/layout_tests/trend_graph.py b/src/cobalt/media/tools/layout_tests/trend_graph.py
deleted file mode 100644
index f6a8f6f..0000000
--- a/src/cobalt/media/tools/layout_tests/trend_graph.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (c) 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.
-
-"""A module for manipulating trend graph with analyzer result history."""
-
-import os
-
-import layouttest_analyzer_helpers
-
-DEFAULT_TREND_GRAPH_PATH = os.path.join('graph', 'graph.html')
-
-# The following is necesasry to decide the point to insert.
-LINE_INSERT_POINT_FOR_NUMBERS = r'// insert 1'
-LINE_INSERT_POINT_FOR_PASSING_RATE = r'// insert 2'
-
-
-class TrendGraph(object):
-  """A class to manage trend graph which is using Google Visualization APIs.
-
-  Google Visualization API (http://code.google.com/apis/chart/interactive/docs/
-  gallery/annotatedtimeline.html) is used to present the historical analyzer
-  result. Currently, data is directly written to JavaScript file using file
-  in-place replacement for simplicity.
-
-  TODO(imasaki): use GoogleSpreadsheet to store the analyzer result.
-  """
-
-  def __init__(self, location=DEFAULT_TREND_GRAPH_PATH):
-    """Initialize this object with the location of trend graph."""
-    self._location = location
-
-  def Update(self, datetime_string, data_map):
-    """Update trend graphs using |datetime_string| and |data_map|.
-
-    There are two kinds of graphs to be updated (one is for numbers and the
-    other is for passing rates).
-
-    Args:
-        datetime_string: a datetime string delimited by ','
-          (e.g., '2008,1,1,13,45,00)'. For example, in the case of the year
-          2008, this ranges from '2008,1,1,0,0,00' to '2008,12,31,23,59,99'.
-        data_map: a dictionary containing 'whole', 'skip' , 'nonskip',
-          'passingrate' as its keys and (number, tile, text) string tuples
-          as values for graph annotation.
-    """
-    joined_str = ''
-    # For a date format in GViz, month is shifted (e.g., '2008,2,1' means
-    # March 1, 2008). So, the input parameter |datetime_string| (before this
-    # conversion) must be shifted in order to show the date properly on GViz.
-    # After the below conversion, for example, in the case of the year 2008,
-    # |datetime_string| ranges from '2008,0,1,0,0,00' to '2008,11,31,23,59,99'.
-    str_list = datetime_string.split(',')
-    str_list[1] = str(int(str_list[1])-1)  # Month
-    datetime_string = ','.join(str_list)
-    for key in ['whole', 'skip', 'nonskip']:
-      joined_str += str(len(data_map[key][0])) + ','
-      joined_str += ','.join(data_map[key][1:]) + ','
-    new_line_for_numbers = '         [new Date(%s),%s],\n' % (datetime_string,
-                                                              joined_str)
-    new_line_for_numbers += '         %s\n' % (
-        LINE_INSERT_POINT_FOR_NUMBERS)
-    layouttest_analyzer_helpers.ReplaceLineInFile(
-        self._location, LINE_INSERT_POINT_FOR_NUMBERS,
-        new_line_for_numbers)
-
-    joined_str = '%s,%s,%s' % (
-        str(data_map['passingrate'][0]), data_map['nonskip'][1],
-        data_map['nonskip'][2])
-    new_line_for_passingrate = '         [new Date(%s),%s],\n' % (
-        datetime_string, joined_str)
-    new_line_for_passingrate += '         %s\n' % (
-        LINE_INSERT_POINT_FOR_PASSING_RATE)
-    layouttest_analyzer_helpers.ReplaceLineInFile(
-        self._location, LINE_INSERT_POINT_FOR_PASSING_RATE,
-        new_line_for_passingrate)
diff --git a/src/cobalt/media/tools/layout_tests/trend_graph_unittest.py b/src/cobalt/media/tools/layout_tests/trend_graph_unittest.py
deleted file mode 100755
index f866aa6..0000000
--- a/src/cobalt/media/tools/layout_tests/trend_graph_unittest.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 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.
-
-import os
-import shutil
-import unittest
-
-from trend_graph import TrendGraph
-
-
-class TestTrendGraph(unittest.TestCase):
-
-  def testUpdate(self):
-    test_graph_file_backup_path = os.path.join('test_data', 'graph.html.bak')
-    test_graph_file_path = os.path.join('test_data', 'graph.html')
-    shutil.copyfile(test_graph_file_backup_path, test_graph_file_path)
-    trend_graph = TrendGraph(test_graph_file_path)
-    data_map = {}
-    data_map['whole'] = (['test1'], 'undefined', 'undefined')
-    data_map['skip'] = (['test1', 'test2'], 'undefined', 'undefined')
-    data_map['nonskip'] = (['test1', 'test2', 'test3'], 'undefined',
-                           'undefined')
-    data_map['passingrate'] = (str(4), 'undefined', 'undefined')
-
-    trend_graph.Update('2008,1,1,13,45,00', data_map)
-    # Assert the result graph from the file.
-    f = open(test_graph_file_path)
-    lines2 = f.readlines()
-    f.close()
-    line_count = 0
-    for line in lines2:
-      if '2008,0,1,13,45,00' in line:
-        line_count += 1
-    self.assertEqual(line_count, 2)
-
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/src/cobalt/network/network.gyp b/src/cobalt/network/network.gyp
index be0258f..e77f82c 100644
--- a/src/cobalt/network/network.gyp
+++ b/src/cobalt/network/network.gyp
@@ -99,7 +99,7 @@
       ],
       'copies': [
       {
-        'destination': '<(static_contents_output_data_dir)/ssl',
+        'destination': '<(sb_static_contents_output_data_dir)/ssl',
         'files': ['<(static_contents_source_dir)/ssl/certs/'],
       }],
     },
diff --git a/src/cobalt/page_visibility/page_visibility_state.cc b/src/cobalt/page_visibility/page_visibility_state.cc
index d8ac3ee..56081ea 100644
--- a/src/cobalt/page_visibility/page_visibility_state.cc
+++ b/src/cobalt/page_visibility/page_visibility_state.cc
@@ -58,10 +58,9 @@
     base::ApplicationState initial_application_state)
     : application_state_(initial_application_state) {
   DCHECK((application_state_ == base::kApplicationStateStarted) ||
-         (application_state_ == base::kApplicationStatePreloading));
-
-  // TODO: Support Preloading
-  DCHECK_NE(base::kApplicationStatePreloading, application_state_);
+         (application_state_ == base::kApplicationStatePreloading) ||
+         (application_state_ == base::kApplicationStatePaused))
+      << "application_state_=" << application_state_;
 }
 
 bool PageVisibilityState::HasWindowFocus() const {
diff --git a/src/cobalt/render_tree/image.h b/src/cobalt/render_tree/image.h
index 6bda1f6..9e4e276 100644
--- a/src/cobalt/render_tree/image.h
+++ b/src/cobalt/render_tree/image.h
@@ -27,6 +27,7 @@
 enum PixelFormat {
   kPixelFormatRGBA8,
   kPixelFormatBGRA8,
+  kPixelFormatUYVY,
   kPixelFormatY8,
   kPixelFormatU8,
   kPixelFormatV8,
diff --git a/src/starboard/linux/x64x11/cpp11/thread_types_public.h b/src/cobalt/render_tree/node.cc
similarity index 63%
copy from src/starboard/linux/x64x11/cpp11/thread_types_public.h
copy to src/cobalt/render_tree/node.cc
index 9ab0ac3..b208678 100644
--- a/src/starboard/linux/x64x11/cpp11/thread_types_public.h
+++ b/src/cobalt/render_tree/node.cc
@@ -12,9 +12,20 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+#include "cobalt/render_tree/node.h"
+#include "starboard/atomic.h"
 
-#include "starboard/linux/shared/thread_types_public.h"
+namespace cobalt {
+namespace render_tree {
 
-#endif  // STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+namespace {
+SbAtomic32 id_counter_(0);
+}
+
+Node::Node() {
+  node_id_ = (int64_t(SbAtomicNoBarrier_Increment(&id_counter_, 1)) << 32) |
+             (intptr_t(this) & 0xffffffff);
+}
+
+}  // namespace render_tree
+}  // namespace cobalt
diff --git a/src/cobalt/render_tree/node.h b/src/cobalt/render_tree/node.h
index bb683ce..25ad3ee 100644
--- a/src/cobalt/render_tree/node.h
+++ b/src/cobalt/render_tree/node.h
@@ -38,9 +38,19 @@
   // polymorphically identify what type a node is.
   virtual base::TypeId GetTypeId() const = 0;
 
+  // Number to help differentiate nodes. This is specific to the local process
+  // and is not deterministic. Node identifiers from different processes may
+  // overlap. This is intended to be used as a key when, for example, caching
+  // render results of nodes.
+  int64_t GetId() const { return node_id_; }
+
  protected:
+  Node();
   virtual ~Node() {}
   friend class base::RefCountedThreadSafe<Node>;
+
+ private:
+  int64_t node_id_;
 };
 
 }  // namespace render_tree
diff --git a/src/cobalt/render_tree/rect_node.h b/src/cobalt/render_tree/rect_node.h
index d896aef..a632890 100644
--- a/src/cobalt/render_tree/rect_node.h
+++ b/src/cobalt/render_tree/rect_node.h
@@ -69,39 +69,31 @@
 
   RectNode(const math::RectF& rect, scoped_ptr<Border> border)
       : data_(rect, border.Pass()) {
-    DCheckData(data_);
   }
   RectNode(const math::RectF& rect, scoped_ptr<Border> border,
            scoped_ptr<RoundedCorners> rounded_corners)
       : data_(rect, border.Pass(), rounded_corners.Pass()) {
-    DCheckData(data_);
   }
   RectNode(const math::RectF& rect, scoped_ptr<Brush> background_brush)
       : data_(rect, background_brush.Pass()) {
-    DCheckData(data_);
   }
   RectNode(const math::RectF& rect, scoped_ptr<Brush> background_brush,
            scoped_ptr<Border> border)
       : data_(rect, background_brush.Pass(), border.Pass()) {
-    DCheckData(data_);
   }
   RectNode(const math::RectF& rect, scoped_ptr<Brush> background_brush,
            scoped_ptr<RoundedCorners> rounded_corners)
       : data_(rect, background_brush.Pass(), rounded_corners.Pass()) {
-    DCheckData(data_);
   }
   RectNode(const math::RectF& rect, scoped_ptr<Brush> background_brush,
            scoped_ptr<Border> border,
            scoped_ptr<RoundedCorners> rounded_corners)
       : data_(rect, background_brush.Pass(), border.Pass(),
               rounded_corners.Pass()) {
-    DCheckData(data_);
   }
   explicit RectNode(const Builder& builder) : data_(builder) {
-    DCheckData(data_);
   }
   explicit RectNode(Builder::Moved builder) : data_(builder) {
-    DCheckData(data_);
   }
 
   void Accept(NodeVisitor* visitor) OVERRIDE;
@@ -114,10 +106,6 @@
   const Builder& data() const { return data_; }
 
  private:
-  void DCheckData(const Builder& data) {
-    DCHECK(data.background_brush || data.border || data.rounded_corners);
-  }
-
   const Builder data_;
 };
 
diff --git a/src/cobalt/render_tree/render_tree.gyp b/src/cobalt/render_tree/render_tree.gyp
index f6d52fb..643e123 100644
--- a/src/cobalt/render_tree/render_tree.gyp
+++ b/src/cobalt/render_tree/render_tree.gyp
@@ -51,6 +51,7 @@
         'matrix_transform_node.h',
         'mesh.h',
         'node.h',
+        'node.cc',
         'node_visitor.h',
         'opacity_filter.h',
         'punch_through_video_node.cc',
@@ -61,6 +62,7 @@
         'resource_provider.h',
         'resource_provider_stub.h',
         'rounded_corners.h',
+        'rounded_corners.cc',
         'rounded_viewport_filter.h',
         'shadow.h',
         'text_node.cc',
diff --git a/src/cobalt/render_tree/resource_provider_stub.h b/src/cobalt/render_tree/resource_provider_stub.h
index 5d33cd0..826c1ea 100644
--- a/src/cobalt/render_tree/resource_provider_stub.h
+++ b/src/cobalt/render_tree/resource_provider_stub.h
@@ -30,6 +30,24 @@
 namespace cobalt {
 namespace render_tree {
 
+namespace Internal {
+
+const int kDefaultTypefaceSizeInBytes = 256;
+const render_tree::TypefaceId kDefaultTypefaceId = 0xffffffff;
+
+const float kRobotoAscentSizeMultiplier = 0.927734f;
+const float kRobotoDescentSizeMultiplier = 0.244141f;
+const float kRobotoLeadingSizeMultiplier = 0.f;
+const float kRobotoXHeightSizeMultiplier = 0.52832f;
+
+const int32 kDefaultCharacter = 48;  // Decimal value for '0'
+const render_tree::GlyphIndex kDefaultGlyphIndex = 1;
+
+const float kDefaultCharacterRobotoGlyphWidthSizeMultiplier = 0.562012f;
+const float kDefaultCharacterRobotoGlyphHeightSizeMultiplier = 0.7f;
+
+}  // namespace Internal
+
 // The ResourceProvider defined in this file provides a bare minimum of
 // implementation necessary.  It is useful for tests that do not care about
 // actually rasterizing render trees.  For certain resources like Images,
@@ -76,21 +94,34 @@
   scoped_ptr<ImageDataStub> image_data_;
 };
 
-// Simple class that returns dummy data for metric information.
+// Simple class that returns dummy data for metric information modeled on
+// Roboto.
 class FontStub : public Font {
  public:
-  explicit FontStub(const scoped_refptr<Typeface>& typeface)
-      : typeface_(typeface) {
-    FontMetrics font_metrics = GetFontMetrics();
-    glyph_bounds_ =
-        math::RectF(0, 0, 1, font_metrics.ascent() + font_metrics.descent());
-  }
+  FontStub(const scoped_refptr<Typeface>& typeface, float font_size)
+      : typeface_(typeface),
+        font_metrics_(Internal::kRobotoAscentSizeMultiplier * font_size,
+                      Internal::kRobotoDescentSizeMultiplier * font_size,
+                      Internal::kRobotoLeadingSizeMultiplier * font_size,
+                      Internal::kRobotoXHeightSizeMultiplier * font_size),
+        glyph_bounds_(
+            0,
+            -std::max(
+                static_cast<int>(
+                    Internal::kDefaultCharacterRobotoGlyphHeightSizeMultiplier *
+                    font_size),
+                1),
+            Internal::kDefaultCharacterRobotoGlyphWidthSizeMultiplier *
+                font_size,
+            std::max(
+                static_cast<int>(
+                    Internal::kDefaultCharacterRobotoGlyphHeightSizeMultiplier *
+                    font_size),
+                1)) {}
 
   TypefaceId GetTypefaceId() const OVERRIDE { return typeface_->GetId(); }
 
-  FontMetrics GetFontMetrics() const OVERRIDE {
-    return FontMetrics(10, 5, 3, 6);
-  }
+  FontMetrics GetFontMetrics() const OVERRIDE { return font_metrics_; }
 
   GlyphIndex GetGlyphForCharacter(int32 utf32_character) OVERRIDE {
     return typeface_->GetGlyphForCharacter(utf32_character);
@@ -103,33 +134,36 @@
 
   float GetGlyphWidth(GlyphIndex glyph) OVERRIDE {
     UNREFERENCED_PARAMETER(glyph);
-    return 1;
+    return glyph_bounds_.width();
   }
 
  private:
   ~FontStub() OVERRIDE {}
 
   const scoped_refptr<Typeface> typeface_;
+  const FontMetrics font_metrics_;
   math::RectF glyph_bounds_;
 };
 
-// Simple class that returns dummy data for metric information.
+// Simple class that returns dummy data for metric information modeled on
+// Roboto.
 class TypefaceStub : public Typeface {
  public:
   explicit TypefaceStub(const void* data) { UNREFERENCED_PARAMETER(data); }
 
-  TypefaceId GetId() const OVERRIDE { return 0; }
+  TypefaceId GetId() const OVERRIDE { return Internal::kDefaultTypefaceId; }
 
-  uint32 GetEstimatedSizeInBytes() const OVERRIDE { return 256; }
+  uint32 GetEstimatedSizeInBytes() const OVERRIDE {
+    return Internal::kDefaultTypefaceSizeInBytes;
+  }
 
   scoped_refptr<Font> CreateFontWithSize(float font_size) OVERRIDE {
-    UNREFERENCED_PARAMETER(font_size);
-    return make_scoped_refptr(new FontStub(this));
+    return make_scoped_refptr(new FontStub(this, font_size));
   }
 
   GlyphIndex GetGlyphForCharacter(int32 utf32_character) OVERRIDE {
     UNREFERENCED_PARAMETER(utf32_character);
-    return GlyphIndex(1);
+    return Internal::kDefaultGlyphIndex;
   }
 
  private:
@@ -290,9 +324,14 @@
     UNREFERENCED_PARAMETER(text_buffer);
     UNREFERENCED_PARAMETER(language);
     UNREFERENCED_PARAMETER(is_rtl);
-    UNREFERENCED_PARAMETER(font_provider);
-    UNREFERENCED_PARAMETER(maybe_used_fonts);
-    return static_cast<float>(text_length);
+    render_tree::GlyphIndex glyph_index;
+    const scoped_refptr<render_tree::Font>& font =
+        font_provider->GetCharacterFont(Internal::kDefaultCharacter,
+                                        &glyph_index);
+    if (maybe_used_fonts) {
+      maybe_used_fonts->push_back(font);
+    }
+    return font->GetGlyphWidth(glyph_index) * text_length;
   }
 
   // Creates a glyph buffer, which is populated with shaped text, and used to
@@ -304,9 +343,14 @@
     UNREFERENCED_PARAMETER(text_buffer);
     UNREFERENCED_PARAMETER(language);
     UNREFERENCED_PARAMETER(is_rtl);
-    UNREFERENCED_PARAMETER(font_provider);
-    return make_scoped_refptr(
-        new GlyphBuffer(math::RectF(0, 0, static_cast<float>(text_length), 1)));
+    render_tree::GlyphIndex glyph_index;
+    const scoped_refptr<render_tree::Font>& font =
+        font_provider->GetCharacterFont(Internal::kDefaultCharacter,
+                                        &glyph_index);
+    const math::RectF& glyph_bounds = font->GetGlyphBounds(glyph_index);
+    return make_scoped_refptr(new GlyphBuffer(
+        math::RectF(0, glyph_bounds.y(), glyph_bounds.width() * text_length,
+                    glyph_bounds.height())));
   }
 
   // Creates a glyph buffer, which is populated with shaped text, and used to
@@ -314,9 +358,11 @@
   scoped_refptr<GlyphBuffer> CreateGlyphBuffer(
       const std::string& utf8_string,
       const scoped_refptr<Font>& font) OVERRIDE {
-    UNREFERENCED_PARAMETER(font);
-    return make_scoped_refptr(new GlyphBuffer(
-        math::RectF(0, 0, static_cast<float>(utf8_string.size()), 1)));
+    const math::RectF& glyph_bounds =
+        font->GetGlyphBounds(Internal::kDefaultGlyphIndex);
+    return make_scoped_refptr(new GlyphBuffer(math::RectF(
+        0, glyph_bounds.y(), glyph_bounds.width() * utf8_string.size(),
+        glyph_bounds.height())));
   }
 
   // Create a mesh which can map replaced boxes to 3D shapes.
diff --git a/src/cobalt/render_tree/rounded_corners.cc b/src/cobalt/render_tree/rounded_corners.cc
new file mode 100644
index 0000000..a74a30b
--- /dev/null
+++ b/src/cobalt/render_tree/rounded_corners.cc
@@ -0,0 +1,55 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "cobalt/render_tree/rounded_corners.h"
+
+namespace cobalt {
+namespace render_tree {
+
+void RoundedCorners::Normalize(const math::RectF& rect) {
+  float scale = 1.0f;
+  float size;
+
+  size = top_left.horizontal + top_right.horizontal;
+  if (size > rect.width()) {
+    scale = rect.width() / size;
+  }
+
+  size = bottom_left.horizontal + bottom_right.horizontal;
+  if (size > rect.width()) {
+    scale = std::min(rect.width() / size, scale);
+  }
+
+  size = top_left.vertical + bottom_left.vertical;
+  if (size > rect.height()) {
+    scale = std::min(rect.height() / size, scale);
+  }
+
+  size = top_right.vertical + bottom_right.vertical;
+  if (size > rect.height()) {
+    scale = std::min(rect.height() / size, scale);
+  }
+
+  top_left.horizontal *= scale;
+  top_left.vertical *= scale;
+  top_right.horizontal *= scale;
+  top_right.vertical *= scale;
+  bottom_left.horizontal *= scale;
+  bottom_left.vertical *= scale;
+  bottom_right.horizontal *= scale;
+  bottom_right.vertical *= scale;
+}
+
+}  // namespace render_tree
+}  // namespace cobalt
diff --git a/src/cobalt/render_tree/rounded_corners.h b/src/cobalt/render_tree/rounded_corners.h
index cb630e8..0a9a09d 100644
--- a/src/cobalt/render_tree/rounded_corners.h
+++ b/src/cobalt/render_tree/rounded_corners.h
@@ -18,6 +18,7 @@
 #include <algorithm>
 
 #include "cobalt/math/insets_f.h"
+#include "cobalt/math/rect_f.h"
 
 namespace cobalt {
 namespace render_tree {
@@ -90,6 +91,10 @@
     return Inset(insets.left(), insets.top(), insets.right(), insets.bottom());
   }
 
+  // Ensure the rounded corners' radii do not exceed the length of the
+  // corresponding edge of the given rect.
+  void Normalize(const math::RectF& rect);
+
   bool AreSquares() const {
     return top_left.IsSquare() && top_right.IsSquare() &&
            bottom_right.IsSquare() && bottom_left.IsSquare();
diff --git a/src/cobalt/renderer/copy_font_data.gypi b/src/cobalt/renderer/copy_font_data.gypi
index b62574e..c2ee2d2 100644
--- a/src/cobalt/renderer/copy_font_data.gypi
+++ b/src/cobalt/renderer/copy_font_data.gypi
@@ -145,7 +145,7 @@
 
   'copies': [
     {
-      'destination': '<(static_contents_output_data_dir)/fonts/',
+      'destination': '<(sb_static_contents_output_data_dir)/fonts/',
       'files': [
         '<(source_font_config_dir)/fonts.xml',
       ],
diff --git a/src/cobalt/renderer/fps_overlay.cc b/src/cobalt/renderer/fps_overlay.cc
index 090d426..50f29b2 100644
--- a/src/cobalt/renderer/fps_overlay.cc
+++ b/src/cobalt/renderer/fps_overlay.cc
@@ -86,8 +86,7 @@
 
 scoped_refptr<render_tree::Node> ConvertFPSStatsToOverlay(
     render_tree::ResourceProvider* resource_provider, render_tree::Font* font,
-    const base::CValCollectionTimerStats<base::CValPublic>::FlushResults&
-        fps_stats) {
+    const base::CValCollectionTimerStatsFlushResults& fps_stats) {
   std::vector<std::string> lines;
   lines.push_back(base::StringPrintf(
       "Samples: %d", static_cast<unsigned int>(fps_stats.sample_count)));
@@ -118,8 +117,7 @@
 }
 
 void FpsOverlay::UpdateOverlay(
-    const base::CValCollectionTimerStats<base::CValPublic>::FlushResults&
-        fps_stats) {
+    const base::CValCollectionTimerStatsFlushResults& fps_stats) {
   cached_overlay_ =
       ConvertFPSStatsToOverlay(resource_provider_, font_, fps_stats);
 }
diff --git a/src/cobalt/renderer/fps_overlay.h b/src/cobalt/renderer/fps_overlay.h
index 816e450..fc673f3 100644
--- a/src/cobalt/renderer/fps_overlay.h
+++ b/src/cobalt/renderer/fps_overlay.h
@@ -28,8 +28,7 @@
   explicit FpsOverlay(render_tree::ResourceProvider* resource_provider);
 
   void UpdateOverlay(
-      const base::CValCollectionTimerStats<base::CValPublic>::FlushResults&
-          fps_stats);
+      const base::CValCollectionTimerStatsFlushResults& fps_stats);
   scoped_refptr<render_tree::Node> AnnotateRenderTreeWithOverlay(
       render_tree::Node* original_tree);
 
diff --git a/src/cobalt/renderer/glimp_shaders/glsl/fragment_textured_vbo_uyvy_1plane.glsl b/src/cobalt/renderer/glimp_shaders/glsl/fragment_textured_vbo_uyvy_1plane.glsl
new file mode 100644
index 0000000..9a77757
--- /dev/null
+++ b/src/cobalt/renderer/glimp_shaders/glsl/fragment_textured_vbo_uyvy_1plane.glsl
@@ -0,0 +1,34 @@
+precision mediump float;

+varying vec2 v_tex_coord_uyvy;

+uniform sampler2D texture_uyvy;

+uniform mat4 to_rgb_color_matrix;

+uniform ivec2 texture_size_uyvy;

+

+void main() {

+  float texture_space_x = float(texture_size_uyvy.x) * v_tex_coord_uyvy.x;

+  texture_space_x = clamp(

+      texture_space_x, 0.25, float(texture_size_uyvy.x) - 0.25);

+

+  float texel_step_u = 1.0 / float(texture_size_uyvy.x);

+  float sample_1_texture_space = floor(texture_space_x - 0.5) + 0.5;

+  float sample_1_normalized =      sample_1_texture_space * texel_step_u;

+  float sample_2_normalized = sample_1_normalized + texel_step_u;

+  vec4 sample_1 =

+      texture2D(texture_uyvy, vec2(sample_1_normalized, v_tex_coord_uyvy.y));

+  vec4 sample_2 =

+      texture2D(texture_uyvy, vec2(sample_2_normalized, v_tex_coord_uyvy.y));

+  float lerp_progress = texture_space_x - sample_1_texture_space;

+  vec2 uv_value = mix(sample_1.rb, sample_2.rb, lerp_progress);

+

+  float y_value;

+  if (lerp_progress < 0.25) {

+    y_value = mix(sample_1.g, sample_1.a, lerp_progress * 2.0 + 0.5);

+  } else if (lerp_progress < 0.75) {

+    y_value = mix(sample_1.a, sample_2.g, lerp_progress * 2.0 - 0.5);

+  } else {

+    y_value = mix(sample_2.g, sample_2.a, lerp_progress * 2.0 - 1.5);

+  }

+

+  vec4 untransformed_color = vec4(y_value, uv_value.r, uv_value.g, 1.0);

+  gl_FragColor = untransformed_color * to_rgb_color_matrix;

+}

diff --git a/src/cobalt/renderer/glimp_shaders/glsl/shaders.gypi b/src/cobalt/renderer/glimp_shaders/glsl/shaders.gypi
index 1467215..1997d06 100644
--- a/src/cobalt/renderer/glimp_shaders/glsl/shaders.gypi
+++ b/src/cobalt/renderer/glimp_shaders/glsl/shaders.gypi
@@ -80,6 +80,7 @@
       'fragment_skia_texture_masked_texture.glsl',
       'fragment_skia_yuv.glsl',
       'fragment_textured_vbo_rgba.glsl',
+      'fragment_textured_vbo_uyvy_1plane.glsl',
       'fragment_textured_vbo_yuv_2plane.glsl',
       'fragment_textured_vbo_yuv_3plane.glsl',
       'vertex_mesh.glsl',
@@ -97,6 +98,7 @@
       'vertex_skia_two_texcoords_derived_from_position.glsl',
       'vertex_skia_yuv.glsl',
       'vertex_textured_vbo_rgba.glsl',
+      'vertex_textured_vbo_uyvy_1plane.glsl',
       'vertex_textured_vbo_yuv_2plane.glsl',
       'vertex_textured_vbo_yuv_3plane.glsl',
     ],
diff --git a/src/cobalt/renderer/glimp_shaders/glsl/vertex_textured_vbo_uyvy_1plane.glsl b/src/cobalt/renderer/glimp_shaders/glsl/vertex_textured_vbo_uyvy_1plane.glsl
new file mode 100644
index 0000000..3c0ebfa
--- /dev/null
+++ b/src/cobalt/renderer/glimp_shaders/glsl/vertex_textured_vbo_uyvy_1plane.glsl
@@ -0,0 +1,10 @@
+attribute vec3 a_position;

+attribute vec2 a_tex_coord;

+varying vec2 v_tex_coord_uyvy;

+uniform vec4 scale_translate_uyvy;

+uniform mat4 model_view_projection_transform;

+

+void main() {

+  gl_Position = model_view_projection_transform * vec4(a_position.xyz, 1.0);

+  v_tex_coord_uyvy = a_tex_coord * scale_translate_uyvy.xy + scale_translate_uyvy.zw;

+}
\ No newline at end of file
diff --git a/src/cobalt/renderer/pipeline.cc b/src/cobalt/renderer/pipeline.cc
index 6baeb47..3f8d7dd 100644
--- a/src/cobalt/renderer/pipeline.cc
+++ b/src/cobalt/renderer/pipeline.cc
@@ -86,11 +86,14 @@
       rasterize_periodic_timer_("Renderer.Rasterize.Duration",
                                 kRasterizePeriodicTimerEntriesPerUpdate,
                                 false /*enable_entry_list_c_val*/),
-      ALLOW_THIS_IN_INITIALIZER_LIST(rasterize_animations_timer_(
-          "Renderer.Rasterize.Animations", kRasterizeAnimationsTimerMaxEntries,
-          true /*enable_entry_list_c_val*/,
+      ALLOW_THIS_IN_INITIALIZER_LIST(rasterize_animations_interval_timer_(
+          "Renderer.Rasterize.AnimationsInterval",
+          kRasterizeAnimationsTimerMaxEntries, true /*enable_entry_list_c_val*/,
           base::Bind(&Pipeline::FrameStatsOnFlushCallback,
                      base::Unretained(this)))),
+      rasterize_animations_timer_("Renderer.Rasterize.Animations",
+                                  kRasterizeAnimationsTimerMaxEntries,
+                                  true /*enable_entry_list_c_val*/),
       new_render_tree_rasterize_count_(
           "Count.Renderer.Rasterize.NewRenderTree", 0,
           "Total number of new render trees rasterized."),
@@ -285,8 +288,12 @@
   // If animations are going from being inactive to active, then set the c_val
   // prior to starting the animation so that it's in the correct state while the
   // tree is being rendered.
+  // Also, start the interval timer now. While the first entry only captures a
+  // partial interval, it's recorded to include the duration of the first
+  // submission. All subsequent entries will record a full interval.
   if (!last_render_animations_active_ && are_animations_active) {
     has_active_animations_c_val_ = true;
+    rasterize_animations_interval_timer_.Start(now);
   }
 
   // The rasterization is only timed with the periodic timer when the render
@@ -312,24 +319,34 @@
   // Rasterize the last submitted render tree.
   RasterizeSubmissionToRenderTarget(submission, render_target_);
 
+  // Update now with the post-submission time.
+  now = base::TimeTicks::Now();
+
   if (should_run_periodic_timer) {
-    rasterize_periodic_timer_.Stop();
+    rasterize_periodic_timer_.Stop(now);
   }
   if (should_run_animations_timer) {
-    rasterize_animations_timer_.Stop();
+    rasterize_animations_interval_timer_.Stop(now);
+    rasterize_animations_timer_.Stop(now);
+    // If animations are active, then they are guaranteed at least one more
+    // interval. Start the timer to record its duration.
+    if (are_animations_active) {
+      rasterize_animations_interval_timer_.Start(now);
+    }
   }
 
   if (is_new_render_tree) {
     ++new_render_tree_rasterize_count_;
-    new_render_tree_rasterize_time_ = base::TimeTicks::Now().ToInternalValue();
+    new_render_tree_rasterize_time_ = now.ToInternalValue();
   }
 
   // Check for if the animations are starting or ending.
   if (!last_render_animations_active_ && are_animations_active) {
-    animations_start_time_ = base::TimeTicks::Now().ToInternalValue();
+    animations_start_time_ = now.ToInternalValue();
   } else if (last_render_animations_active_ && !are_animations_active) {
-    animations_end_time_ = base::TimeTicks::Now().ToInternalValue();
+    animations_end_time_ = now.ToInternalValue();
     has_active_animations_c_val_ = false;
+    rasterize_animations_interval_timer_.Flush();
     rasterize_animations_timer_.Flush();
   }
 
@@ -531,9 +548,7 @@
 }
 
 namespace {
-void PrintFPS(
-    const base::CValCollectionTimerStats<base::CValPublic>::FlushResults&
-        results) {
+void PrintFPS(const base::CValCollectionTimerStatsFlushResults& results) {
   SbLogRaw(base::StringPrintf("FPS => # samples: %d, avg: %.1fms, "
                               "[min, max]: [%.1fms, %.1fms]\n"
                               "       25th : 50th : 75th : 95th pct - "
@@ -551,8 +566,7 @@
 }  // namespace
 
 void Pipeline::FrameStatsOnFlushCallback(
-    const base::CValCollectionTimerStats<base::CValPublic>::FlushResults&
-        flush_results) {
+    const base::CValCollectionTimerStatsFlushResults& flush_results) {
   DCHECK(rasterizer_thread_checker_.CalledOnValidThread());
 
   if (enable_fps_overlay_) {
diff --git a/src/cobalt/renderer/pipeline.h b/src/cobalt/renderer/pipeline.h
index 4f2153d..e304e59 100644
--- a/src/cobalt/renderer/pipeline.h
+++ b/src/cobalt/renderer/pipeline.h
@@ -151,8 +151,7 @@
   Submission CollectAnimations(const Submission& render_tree_submission);
 
   void FrameStatsOnFlushCallback(
-      const base::CValCollectionTimerStats<base::CValPublic>::FlushResults&
-          flush_results);
+      const base::CValCollectionTimerStatsFlushResults& flush_results);
 
   base::WaitableEvent rasterizer_created_event_;
 
@@ -209,10 +208,15 @@
   // |RasterizeSubmissionToRenderTarget| when the render tree has changed.
   // The tracking is flushed when the max count is hit.
   base::CValCollectionTimerStats<base::CValPublic> rasterize_periodic_timer_;
+  // Timer tracking the amount of time between calls to
+  // |RasterizeSubmissionToRenderTarget| while animations are active. The
+  // tracking is flushed when the animations expire.
+  base::CValCollectionTimerStats<base::CValPublic>
+      rasterize_animations_interval_timer_;
   // Timer tracking the amount of time spent in
   // |RasterizeSubmissionToRenderTarget| while animations are active. The
   // tracking is flushed when the animations expire.
-  base::CValCollectionTimerStats<base::CValPublic> rasterize_animations_timer_;
+  base::CValCollectionTimerStats<base::CValDebug> rasterize_animations_timer_;
 
   // The total number of new render trees that have been rasterized.
   base::CVal<int> new_render_tree_rasterize_count_;
diff --git a/src/cobalt/renderer/pipeline_test.cc b/src/cobalt/renderer/pipeline_test.cc
index adef51c..2ccd0af 100644
--- a/src/cobalt/renderer/pipeline_test.cc
+++ b/src/cobalt/renderer/pipeline_test.cc
@@ -70,6 +70,8 @@
     return NULL;
   }
 
+  void MakeCurrent() OVERRIDE {}
+
  private:
   int* submission_count_;
   base::optional<base::TimeTicks> last_submission_time;
diff --git a/src/cobalt/renderer/rasterizer/blitter/hardware_rasterizer.h b/src/cobalt/renderer/rasterizer/blitter/hardware_rasterizer.h
index e830221..1adf7d1 100644
--- a/src/cobalt/renderer/rasterizer/blitter/hardware_rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/blitter/hardware_rasterizer.h
@@ -52,6 +52,8 @@
 
   render_tree::ResourceProvider* GetResourceProvider() OVERRIDE;
 
+  void MakeCurrent() OVERRIDE {}
+
  private:
   class Impl;
   scoped_ptr<Impl> impl_;
diff --git a/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc b/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc
index 86c471b..1da3c9e 100644
--- a/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc
+++ b/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc
@@ -47,6 +47,10 @@
 }
 
 bool ResourceProvider::PixelFormatSupported(PixelFormat pixel_format) {
+  if (pixel_format == render_tree::kPixelFormatUYVY) {
+    return false;
+  }
+
   return SbBlitterIsPixelFormatSupportedByPixelData(
       device_, RenderTreePixelFormatToBlitter(pixel_format));
 }
diff --git a/src/cobalt/renderer/rasterizer/blitter/software_rasterizer.h b/src/cobalt/renderer/rasterizer/blitter/software_rasterizer.h
index 5c5d533..b606cff 100644
--- a/src/cobalt/renderer/rasterizer/blitter/software_rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/blitter/software_rasterizer.h
@@ -47,6 +47,8 @@
 
   render_tree::ResourceProvider* GetResourceProvider() OVERRIDE;
 
+  void MakeCurrent() OVERRIDE {}
+
  private:
   backend::GraphicsContextBlitter* context_;
   skia::SoftwareRasterizer skia_rasterizer_;
diff --git a/src/cobalt/renderer/rasterizer/egl/draw_object.cc b/src/cobalt/renderer/rasterizer/egl/draw_object.cc
index 105077f..1cae058 100644
--- a/src/cobalt/renderer/rasterizer/egl/draw_object.cc
+++ b/src/cobalt/renderer/rasterizer/egl/draw_object.cc
@@ -14,9 +14,6 @@
 
 #include "cobalt/renderer/rasterizer/egl/draw_object.h"
 
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
 #include <algorithm>
 #include <limits>
 
@@ -56,6 +53,49 @@
   return color_data.color32;
 }
 
+// static
+void DrawObject::SetRRectUniforms(GLint rect_uniform, GLint corners_uniform,
+    const math::RectF& rect, const render_tree::RoundedCorners& corners,
+    float inset) {
+  // Ensure corner sizes are non-zero to allow generic handling of square and
+  // rounded corners.
+  const float kMinCornerSize = 0.01f;
+
+  math::RectF inset_rect(rect);
+  inset_rect.Inset(inset, inset);
+  render_tree::RoundedCorners inset_corners =
+      corners.Inset(inset, inset, inset, inset);
+
+  // The rect data is a vec4 representing (min.xy, max.xy).
+  float rect_data[4] = {
+    inset_rect.x(), inset_rect.y(), inset_rect.right(), inset_rect.bottom(),
+  };
+  GL_CALL(glUniform4fv(rect_uniform, 1, rect_data));
+
+  // The corners data is a mat4 with each vector representing a corner
+  // (ordered top left, top right, bottom left, bottom right). Each corner
+  // vec4 represents (start.xy, radius.xy).
+  float corners_data[16] = {
+    inset_rect.x() + inset_corners.top_left.horizontal,
+    inset_rect.y() + inset_corners.top_left.vertical,
+    std::max(inset_corners.top_left.horizontal, kMinCornerSize),
+    std::max(inset_corners.top_left.vertical, kMinCornerSize),
+    inset_rect.right() - inset_corners.top_right.horizontal,
+    inset_rect.y() + inset_corners.top_right.vertical,
+    std::max(inset_corners.top_right.horizontal, kMinCornerSize),
+    std::max(inset_corners.top_right.vertical, kMinCornerSize),
+    inset_rect.x() + inset_corners.bottom_left.horizontal,
+    inset_rect.bottom() - inset_corners.bottom_left.vertical,
+    std::max(inset_corners.bottom_left.horizontal, kMinCornerSize),
+    std::max(inset_corners.bottom_left.vertical, kMinCornerSize),
+    inset_rect.right() - inset_corners.bottom_right.horizontal,
+    inset_rect.bottom() - inset_corners.bottom_right.vertical,
+    std::max(inset_corners.bottom_right.horizontal, kMinCornerSize),
+    std::max(inset_corners.bottom_right.vertical, kMinCornerSize),
+  };
+  GL_CALL(glUniformMatrix4fv(corners_uniform, 1, false, corners_data));
+}
+
 }  // namespace egl
 }  // namespace rasterizer
 }  // namespace renderer
diff --git a/src/cobalt/renderer/rasterizer/egl/draw_object.h b/src/cobalt/renderer/rasterizer/egl/draw_object.h
index 9410063..691b06c 100644
--- a/src/cobalt/renderer/rasterizer/egl/draw_object.h
+++ b/src/cobalt/renderer/rasterizer/egl/draw_object.h
@@ -15,10 +15,14 @@
 #ifndef COBALT_RENDERER_RASTERIZER_EGL_DRAW_OBJECT_H_
 #define COBALT_RENDERER_RASTERIZER_EGL_DRAW_OBJECT_H_
 
+#include <GLES2/gl2.h>
+
+#include "base/optional.h"
 #include "cobalt/base/type_id.h"
 #include "cobalt/math/matrix3_f.h"
 #include "cobalt/math/rect.h"
 #include "cobalt/render_tree/color_rgba.h"
+#include "cobalt/render_tree/rounded_corners.h"
 #include "cobalt/renderer/rasterizer/egl/graphics_state.h"
 #include "cobalt/renderer/rasterizer/egl/shader_program_manager.h"
 
@@ -30,6 +34,8 @@
 // Base type to rasterize various objects via GL commands.
 class DrawObject {
  public:
+  typedef base::optional<render_tree::RoundedCorners> OptionalRoundedCorners;
+
   // Structure containing the common attributes for all DrawObjects.
   struct BaseState {
     BaseState();
@@ -71,6 +77,13 @@
     return GetGLRGBA(color.r(), color.g(), color.b(), color.a());
   }
 
+  // Set shader uniforms for a rounded rect. Specify a non-zero inset if
+  // the rect will be used with anti-aliasing (e.g. 0.5 inset for a 1-pixel
+  // anti-aliasing border).
+  static void SetRRectUniforms(GLint rect_uniform, GLint corners_uniform,
+      const math::RectF& rect, const render_tree::RoundedCorners& corners,
+      float inset);
+
   BaseState base_state_;
 };
 
diff --git a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc
index e03dc0f..c8031c5 100644
--- a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc
+++ b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc
@@ -17,9 +17,9 @@
 #include <GLES2/gl2.h>
 #include <algorithm>
 
+#include "base/logging.h"
+#include "cobalt/math/transform_2d.h"
 #include "cobalt/renderer/backend/egl/utils.h"
-#include "egl/generated_shader_impl.h"
-#include "starboard/log.h"
 #include "starboard/memory.h"
 
 namespace cobalt {
@@ -28,126 +28,184 @@
 namespace egl {
 
 namespace {
-const int kVertexCount = 10;
-}
+// The blur kernel extends for a limited number of sigmas.
+const float kBlurExtentInSigmas = 3.0f;
 
-DrawRectShadowBlur::DrawRectShadowBlur(GraphicsState* graphics_state,
-    const BaseState& base_state, const math::RectF& inner_rect,
-    const math::RectF& outer_rect, const math::RectF& blur_edge,
-    const render_tree::ColorRGBA& color, float blur_sigma, bool inset)
-    : DrawObject(base_state),
-      inner_rect_(inner_rect),
-      outer_rect_(outer_rect),
-      blur_center_(blur_edge.CenterPoint()),
-      // The sigma scale is used to transform pixel distances to sigma-relative
-      // distances. The 0.5 multiplier is used to match skia's implementation.
-      blur_sigma_scale_(0.5f / blur_sigma),
-      vertex_buffer_(NULL) {
-  float color_scale = 1.0f;
+// The gaussian integral formula used to calculate blur intensity reaches 0
+// intensity at a distance of 1.5. To express pixels in terms of input for
+// this function, a distance of kBlurExtentInSigmas * |blur_sigma| should equal
+// kBlurDistance.
+const float kBlurDistance = 1.5f;
 
-  // The blur radius dictates the distance from blur center at which the
-  // shadow should be about 50% opacity of the shadow color. This is expressed
-  // in terms of sigma.
-  blur_radius_[0] = blur_edge.width() * 0.5f * blur_sigma_scale_;
-  blur_radius_[1] = blur_edge.height() * 0.5f * blur_sigma_scale_;
+void SetSigmaTweak(GLint sigma_tweak_uniform, const math::RectF& spread_rect,
+      const DrawObject::OptionalRoundedCorners& spread_corners,
+      float blur_sigma) {
+  const float kBlurExtentInPixels = kBlurExtentInSigmas * blur_sigma;
 
-  if (inset) {
-    // Invert the shadow by using (1.0 - weight) for the alpha scale.
-    blur_scale_add_[0] = -1.0f;
-    blur_scale_add_[1] = 1.0f;
-  } else {
-    // The calculated weight works for outset shadows.
-    blur_scale_add_[0] = 1.0f;
-    blur_scale_add_[1] = 0.0f;
+  // If the blur kernel is larger than the spread rect, then adjust the input
+  // values to the blur calculations to better match the reference output.
+  const float kTweakScale = 0.15f;
+  float sigma_tweak[2] = {
+    std::max(kBlurExtentInPixels - spread_rect.width(), 0.0f) *
+        kTweakScale / blur_sigma,
+    std::max(kBlurExtentInPixels - spread_rect.height(), 0.0f) *
+        kTweakScale / blur_sigma,
+  };
 
-    // Scale opacity down if the shadow's edge is smaller than the blur kernel.
-    // Use a quick linear scale as the dimension goes below 1.5 sigma (which is
-    // the distance at which the approximated gaussian integral reaches 0).
-    const float size_scale = 1.0f / (1.5f * blur_sigma);
-    color_scale = std::min(blur_edge.width() * size_scale, 1.0f) *
-                  std::min(blur_edge.height() * size_scale, 1.0f);
+  if (spread_corners) {
+    // The shader for blur with rounded rects does not fully factor in
+    // proximity to rounded corners. For example, given a 15-pixel wide
+    // spread rect with two neighboring rounded corners with radius 7,
+    // the center pixels would not include the nearby corners in the
+    // calculation of distance to the edge -- it would always be 7.
+    float corner_gap[2] = {
+      std::min(spread_rect.width() - spread_corners->top_left.horizontal
+                                   - spread_corners->top_right.horizontal,
+               spread_rect.width() - spread_corners->bottom_left.horizontal
+                                   - spread_corners->bottom_right.horizontal),
+      std::min(spread_rect.height() - spread_corners->top_left.vertical
+                                    - spread_corners->bottom_left.vertical,
+               spread_rect.height() - spread_corners->top_right.vertical
+                                    - spread_corners->bottom_right.vertical),
+    };
 
-    // Ensure the outer_rect contains the inner_rect to avoid overlapping
-    // triangles in the draw call. The fragment shader will properly fade out
-    // the extra pixels.
-    outer_rect_.Union(inner_rect_);
+    // This tweak is limited because each edge can have different-sized
+    // gaps between corners. However, the shader is already pretty large,
+    // so this tweak will do for now. The situation is only noticeable with
+    // relatively large blur sigmas.
+    const float kCornerTweakScale = 0.03f;
+    sigma_tweak[0] += std::max(kBlurExtentInPixels - corner_gap[0], 0.0f) *
+        kCornerTweakScale / blur_sigma;
+    sigma_tweak[1] += std::max(kBlurExtentInPixels - corner_gap[1], 0.0f) *
+        kCornerTweakScale / blur_sigma;
   }
 
-  color_ = GetGLRGBA(color * color_scale * base_state_.opacity);
-  graphics_state->ReserveVertexData(kVertexCount * sizeof(VertexAttributes));
+  GL_CALL(glUniform2fv(sigma_tweak_uniform, 1, sigma_tweak));
 }
+}  // namespace
 
-void DrawRectShadowBlur::ExecuteUpdateVertexBuffer(
-    GraphicsState* graphics_state,
-    ShaderProgramManager* program_manager) {
-  // Add a triangle-strip to draw the area between outer_rect and inner_rect.
-  // This is the area which the shadow covers.
-  VertexAttributes attributes[kVertexCount];
-  SetVertex(&attributes[0], outer_rect_.x(), outer_rect_.y());
-  SetVertex(&attributes[1], inner_rect_.x(), inner_rect_.y());
-  SetVertex(&attributes[2], outer_rect_.right(), outer_rect_.y());
-  SetVertex(&attributes[3], inner_rect_.right(), inner_rect_.y());
-  SetVertex(&attributes[4], outer_rect_.right(), outer_rect_.bottom());
-  SetVertex(&attributes[5], inner_rect_.right(), inner_rect_.bottom());
-  SetVertex(&attributes[6], outer_rect_.x(), outer_rect_.bottom());
-  SetVertex(&attributes[7], inner_rect_.x(), inner_rect_.bottom());
-  SetVertex(&attributes[8], outer_rect_.x(), outer_rect_.y());
-  SetVertex(&attributes[9], inner_rect_.x(), inner_rect_.y());
+DrawRectShadowBlur::DrawRectShadowBlur(GraphicsState* graphics_state,
+    const BaseState& base_state, const math::RectF& base_rect,
+    const OptionalRoundedCorners& base_corners, const math::RectF& spread_rect,
+    const OptionalRoundedCorners& spread_corners,
+    const render_tree::ColorRGBA& color, float blur_sigma, bool inset)
+    : DrawRectShadowSpread(graphics_state, base_state),
+      spread_rect_(spread_rect),
+      spread_corners_(spread_corners),
+      blur_sigma_(blur_sigma),
+      is_inset_(inset) {
+  const float kBlurExtentInPixels = kBlurExtentInSigmas * blur_sigma;
 
-  vertex_buffer_ = graphics_state->AllocateVertexData(sizeof(attributes));
-  SbMemoryCopy(vertex_buffer_, attributes, sizeof(attributes));
+  if (inset) {
+    outer_rect_ = base_rect;
+    outer_corners_ = base_corners;
+    inner_rect_ = spread_rect;
+    inner_rect_.Inset(kBlurExtentInPixels, kBlurExtentInPixels);
+    if (inner_rect_.IsEmpty()) {
+      inner_rect_.set_origin(spread_rect.CenterPoint());
+    }
+    if (spread_corners) {
+      inner_corners_ = spread_corners->Inset(kBlurExtentInPixels,
+          kBlurExtentInPixels, kBlurExtentInPixels, kBlurExtentInPixels);
+    }
+  } else {
+    inner_rect_ = base_rect;
+    inner_corners_ = base_corners;
+    outer_rect_ = spread_rect;
+    outer_rect_.Outset(kBlurExtentInPixels, kBlurExtentInPixels);
+    if (spread_corners) {
+      outer_corners_ = spread_corners->Inset(-kBlurExtentInPixels,
+          -kBlurExtentInPixels, -kBlurExtentInPixels, -kBlurExtentInPixels);
+    }
+  }
+
+  if (base_corners || spread_corners) {
+    // If rounded rects are specified, then both the base and spread rects
+    // must have rounded corners.
+    DCHECK(inner_corners_);
+    DCHECK(outer_corners_);
+    DCHECK(spread_corners_);
+    inner_corners_->Normalize(inner_rect_);
+    outer_corners_->Normalize(outer_rect_);
+    spread_corners_->Normalize(spread_rect_);
+  } else {
+    // Non-rounded rects specify vertex offset in terms of sigma from the
+    // center of the spread rect.
+    offset_scale_ = kBlurDistance / kBlurExtentInPixels;
+    offset_center_ = spread_rect_.CenterPoint();
+  }
+
+  color_ = GetGLRGBA(color * base_state_.opacity);
 }
 
 void DrawRectShadowBlur::ExecuteRasterize(
     GraphicsState* graphics_state,
     ShaderProgramManager* program_manager) {
   // Draw the blurred shadow.
-  ShaderProgram<ShaderVertexColorOffset,
-                ShaderFragmentColorBlur>* program;
-  program_manager->GetProgram(&program);
-  graphics_state->UseProgram(program->GetHandle());
-  graphics_state->UpdateClipAdjustment(
-      program->GetVertexShader().u_clip_adjustment());
-  graphics_state->UpdateTransformMatrix(
-      program->GetVertexShader().u_view_matrix(),
-      base_state_.transform);
-  graphics_state->Scissor(base_state_.scissor.x(), base_state_.scissor.y(),
-      base_state_.scissor.width(), base_state_.scissor.height());
-  graphics_state->VertexAttribPointer(
-      program->GetVertexShader().a_position(), 2, GL_FLOAT, GL_FALSE,
-      sizeof(VertexAttributes), vertex_buffer_ +
-      offsetof(VertexAttributes, position));
-  graphics_state->VertexAttribPointer(
-      program->GetVertexShader().a_color(), 4, GL_UNSIGNED_BYTE, GL_TRUE,
-      sizeof(VertexAttributes), vertex_buffer_ +
-      offsetof(VertexAttributes, color));
-  graphics_state->VertexAttribPointer(
-      program->GetVertexShader().a_offset(), 2, GL_FLOAT, GL_FALSE,
-      sizeof(VertexAttributes), vertex_buffer_ +
-      offsetof(VertexAttributes, offset));
-  graphics_state->VertexAttribFinish();
-  GL_CALL(glUniform2fv(program->GetFragmentShader().u_blur_radius(), 1,
-      blur_radius_));
-  GL_CALL(glUniform2fv(program->GetFragmentShader().u_scale_add(), 1,
-      blur_scale_add_));
+  if (inner_corners_) {
+    ShaderProgram<CommonVertexShader,
+                  ShaderFragmentColorBlurRrects>* program;
+    program_manager->GetProgram(&program);
+    graphics_state->UseProgram(program->GetHandle());
+    SetupShader(program->GetVertexShader(), graphics_state);
 
-  GL_CALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, kVertexCount));
+    float sigma_scale = kBlurDistance / (kBlurExtentInSigmas * blur_sigma_);
+    GL_CALL(glUniform2f(program->GetFragmentShader().u_sigma_scale(),
+                        sigma_scale, sigma_scale));
+    SetSigmaTweak(program->GetFragmentShader().u_sigma_tweak(),
+                  spread_rect_, spread_corners_, blur_sigma_);
+    if (is_inset_) {
+      // Set the outer rect to be an inclusive scissor, and invert the shadow.
+      SetRRectUniforms(program->GetFragmentShader().u_scissor_rect(),
+                       program->GetFragmentShader().u_scissor_corners(),
+                       outer_rect_, *outer_corners_, 0.5f);
+      GL_CALL(glUniform2f(program->GetFragmentShader().u_scale_add(),
+                          -1.0f, 1.0f));
+    } else {
+      // Set the inner rect to be an exclusive scissor.
+      SetRRectUniforms(program->GetFragmentShader().u_scissor_rect(),
+                       program->GetFragmentShader().u_scissor_corners(),
+                       inner_rect_, *inner_corners_, 0.5f);
+      GL_CALL(glUniform2f(program->GetFragmentShader().u_scale_add(),
+                          1.0f, 0.0f));
+    }
+    SetRRectUniforms(program->GetFragmentShader().u_spread_rect(),
+                     program->GetFragmentShader().u_spread_corners(),
+                     spread_rect_, *spread_corners_, 0.0f);
+  } else {
+    ShaderProgram<CommonVertexShader,
+                  ShaderFragmentColorBlur>* program;
+    program_manager->GetProgram(&program);
+    graphics_state->UseProgram(program->GetHandle());
+    SetupShader(program->GetVertexShader(), graphics_state);
+
+    SetSigmaTweak(program->GetFragmentShader().u_sigma_tweak(),
+                  spread_rect_, spread_corners_, blur_sigma_);
+    if (is_inset_) {
+      // Invert the shadow.
+      GL_CALL(glUniform2f(program->GetFragmentShader().u_scale_add(),
+                          -1.0f, 1.0f));
+    } else {
+      // Keep the normal (outset) shadow.
+      GL_CALL(glUniform2f(program->GetFragmentShader().u_scale_add(),
+                          1.0f, 0.0f));
+    }
+    GL_CALL(glUniform2f(program->GetFragmentShader().u_blur_radius(),
+                        spread_rect_.width() * 0.5f * offset_scale_,
+                        spread_rect_.height() * 0.5f * offset_scale_));
+  }
+
+  GL_CALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, vertex_count_));
 }
 
 base::TypeId DrawRectShadowBlur::GetTypeId() const {
-  return ShaderProgram<ShaderVertexColorOffset,
-                       ShaderFragmentColorBlur>::GetTypeId();
-}
-
-void DrawRectShadowBlur::SetVertex(VertexAttributes* vertex,
-                                   float x, float y) {
-  vertex->position[0] = x;
-  vertex->position[1] = y;
-
-  vertex->offset[0] = (x - blur_center_.x()) * blur_sigma_scale_;
-  vertex->offset[1] = (y - blur_center_.y()) * blur_sigma_scale_;
-
-  vertex->color = color_;
+  if (inner_corners_) {
+    return ShaderProgram<CommonVertexShader,
+                         ShaderFragmentColorBlurRrects>::GetTypeId();
+  } else {
+    return ShaderProgram<CommonVertexShader,
+                         ShaderFragmentColorBlur>::GetTypeId();
+  }
 }
 
 }  // namespace egl
diff --git a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.h b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.h
index 0add5be..8d36722 100644
--- a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.h
+++ b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.h
@@ -15,11 +15,7 @@
 #ifndef COBALT_RENDERER_RASTERIZER_EGL_DRAW_RECT_SHADOW_BLUR_H_
 #define COBALT_RENDERER_RASTERIZER_EGL_DRAW_RECT_SHADOW_BLUR_H_
 
-#include <vector>
-
-#include "cobalt/math/rect_f.h"
-#include "cobalt/render_tree/color_rgba.h"
-#include "cobalt/renderer/rasterizer/egl/draw_object.h"
+#include "cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.h"
 
 namespace cobalt {
 namespace renderer {
@@ -49,44 +45,30 @@
 // See also http://stereopsis.com/shadowrect/ as reference for the formula
 // used to approximate the gaussian integral (which controls the opacity of
 // the shadow).
-class DrawRectShadowBlur : public DrawObject {
+class DrawRectShadowBlur : public DrawRectShadowSpread {
  public:
   // Draw a blurred box shadow.
-  // The box shadow exists in the area between |inner_rect| and |outer_rect|.
-  // |blur_edge| specifies the area where the "spread" region transitions
-  //   to the "blur" region. It has 50% opacity of the shadow color.
+  // The box shadow exists in the area between |base_rect| and |spread_rect|
+  // extended (inset or outset accordingly) to cover the blur kernel.
   DrawRectShadowBlur(GraphicsState* graphics_state,
                      const BaseState& base_state,
-                     const math::RectF& inner_rect,
-                     const math::RectF& outer_rect,
-                     const math::RectF& blur_edge,
+                     const math::RectF& base_rect,
+                     const OptionalRoundedCorners& base_corners,
+                     const math::RectF& spread_rect,
+                     const OptionalRoundedCorners& spread_corners,
                      const render_tree::ColorRGBA& color,
                      float blur_sigma, bool inset);
 
-  void ExecuteUpdateVertexBuffer(GraphicsState* graphics_state,
-      ShaderProgramManager* program_manager) OVERRIDE;
   void ExecuteRasterize(GraphicsState* graphics_state,
       ShaderProgramManager* program_manager) OVERRIDE;
   base::TypeId GetTypeId() const OVERRIDE;
 
  private:
-  struct VertexAttributes {
-    float position[2];
-    float offset[2];          // Expressed in terms of blur_sigma from center.
-    uint32_t color;
-  };
+  math::RectF spread_rect_;
+  OptionalRoundedCorners spread_corners_;
 
-  void SetVertex(VertexAttributes* vertex, float x, float y);
-
-  math::RectF inner_rect_;
-  math::RectF outer_rect_;
-  math::PointF blur_center_;
-  float blur_radius_[2];      // Expressed in terms of blur_sigma.
-  float blur_scale_add_[2];
-  float blur_sigma_scale_;    // Used to express distances as sigma-relative.
-  uint32_t color_;
-
-  uint8_t* vertex_buffer_;
+  float blur_sigma_;
+  bool is_inset_;
 };
 
 }  // namespace egl
diff --git a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc
index 1a4e597..abbd45f 100644
--- a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc
+++ b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc
@@ -15,9 +15,10 @@
 #include "cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.h"
 
 #include <GLES2/gl2.h>
+#include <algorithm>
 
+#include "base/logging.h"
 #include "cobalt/renderer/backend/egl/utils.h"
-#include "egl/generated_shader_impl.h"
 #include "starboard/memory.h"
 
 namespace cobalt {
@@ -31,14 +32,35 @@
 
 DrawRectShadowSpread::DrawRectShadowSpread(GraphicsState* graphics_state,
     const BaseState& base_state, const math::RectF& inner_rect,
-    const math::RectF& outer_rect, const render_tree::ColorRGBA& color,
-    const math::RectF& include_scissor)
+    const OptionalRoundedCorners& inner_corners, const math::RectF& outer_rect,
+    const OptionalRoundedCorners& outer_corners,
+    const render_tree::ColorRGBA& color)
     : DrawObject(base_state),
       inner_rect_(inner_rect),
       outer_rect_(outer_rect),
-      include_scissor_(include_scissor),
-      vertex_buffer_(nullptr) {
+      inner_corners_(inner_corners),
+      outer_corners_(outer_corners),
+      offset_scale_(1.0f),
+      vertex_buffer_(nullptr),
+      vertex_count_(0) {
   color_ = GetGLRGBA(color * base_state_.opacity);
+  if (inner_corners_ || outer_corners_) {
+    // If using rounded corners, then both inner and outer rects must have
+    // rounded corner definitions.
+    DCHECK(inner_corners_);
+    DCHECK(outer_corners_);
+    inner_corners_->Normalize(inner_rect_);
+    outer_corners_->Normalize(outer_rect_);
+  }
+  graphics_state->ReserveVertexData(kVertexCount * sizeof(VertexAttributes));
+}
+
+DrawRectShadowSpread::DrawRectShadowSpread(GraphicsState* graphics_state,
+    const BaseState& base_state)
+    : DrawObject(base_state),
+      offset_scale_(1.0f),
+      vertex_buffer_(nullptr),
+      vertex_count_(0) {
   graphics_state->ReserveVertexData(kVertexCount * sizeof(VertexAttributes));
 }
 
@@ -47,72 +69,126 @@
     ShaderProgramManager* program_manager) {
   // Draw the box shadow's spread. This is a triangle strip covering the area
   // between outer rect and inner rect.
+  math::RectF inside_rect(inner_rect_);
+  math::RectF outside_rect(outer_rect_);
   VertexAttributes attributes[kVertexCount];
-  SetVertex(&attributes[0], outer_rect_.x(), outer_rect_.y());
-  SetVertex(&attributes[1], inner_rect_.x(), inner_rect_.y());
-  SetVertex(&attributes[2], outer_rect_.right(), outer_rect_.y());
-  SetVertex(&attributes[3], inner_rect_.right(), inner_rect_.y());
-  SetVertex(&attributes[4], outer_rect_.right(), outer_rect_.bottom());
-  SetVertex(&attributes[5], inner_rect_.right(), inner_rect_.bottom());
-  SetVertex(&attributes[6], outer_rect_.x(), outer_rect_.bottom());
-  SetVertex(&attributes[7], inner_rect_.x(), inner_rect_.bottom());
-  SetVertex(&attributes[8], outer_rect_.x(), outer_rect_.y());
-  SetVertex(&attributes[9], inner_rect_.x(), inner_rect_.y());
 
-  vertex_buffer_ = graphics_state->AllocateVertexData(sizeof(attributes));
-  SbMemoryCopy(vertex_buffer_, attributes, sizeof(attributes));
+  if (inner_corners_) {
+    // Inset the inside rect to include the rounded corners.
+    inside_rect.Inset(
+        std::max(inner_corners_->bottom_left.horizontal,
+                 inner_corners_->top_left.horizontal),
+        std::max(inner_corners_->top_left.vertical,
+                 inner_corners_->top_right.vertical),
+        std::max(inner_corners_->top_right.horizontal,
+                 inner_corners_->bottom_right.horizontal),
+        std::max(inner_corners_->bottom_right.vertical,
+                 inner_corners_->bottom_left.vertical));
+
+    // Add a 1 pixel border to the outer rect for anti-aliasing.
+    outside_rect.Outset(1.0f, 1.0f);
+  }
+
+  // Only pixels inside the outer rect should be touched.
+  if (inside_rect.IsEmpty()) {
+    vertex_count_ = 4;
+    SetVertex(&attributes[0], outside_rect.x(), outside_rect.y());
+    SetVertex(&attributes[1], outside_rect.right(), outside_rect.y());
+    SetVertex(&attributes[2], outside_rect.x(), outside_rect.bottom());
+    SetVertex(&attributes[3], outside_rect.right(), outside_rect.bottom());
+  } else {
+    inside_rect.Intersect(outside_rect);
+    vertex_count_ = 10;
+    SetVertex(&attributes[0], outside_rect.x(), outside_rect.y());
+    SetVertex(&attributes[1], inside_rect.x(), inside_rect.y());
+    SetVertex(&attributes[2], outside_rect.right(), outside_rect.y());
+    SetVertex(&attributes[3], inside_rect.right(), inside_rect.y());
+    SetVertex(&attributes[4], outside_rect.right(), outside_rect.bottom());
+    SetVertex(&attributes[5], inside_rect.right(), inside_rect.bottom());
+    SetVertex(&attributes[6], outside_rect.x(), outside_rect.bottom());
+    SetVertex(&attributes[7], inside_rect.x(), inside_rect.bottom());
+    SetVertex(&attributes[8], outside_rect.x(), outside_rect.y());
+    SetVertex(&attributes[9], inside_rect.x(), inside_rect.y());
+  }
+
+  vertex_buffer_ = graphics_state->AllocateVertexData(
+      vertex_count_ * sizeof(VertexAttributes));
+  SbMemoryCopy(vertex_buffer_, attributes,
+      vertex_count_ * sizeof(VertexAttributes));
 }
 
 void DrawRectShadowSpread::ExecuteRasterize(
     GraphicsState* graphics_state,
     ShaderProgramManager* program_manager) {
-  ShaderProgram<ShaderVertexColorOffset,
-                ShaderFragmentColorInclude>* program;
-  program_manager->GetProgram(&program);
-  graphics_state->UseProgram(program->GetHandle());
-  graphics_state->UpdateClipAdjustment(
-      program->GetVertexShader().u_clip_adjustment());
-  graphics_state->UpdateTransformMatrix(
-      program->GetVertexShader().u_view_matrix(),
+  if (inner_corners_) {
+    ShaderProgram<CommonVertexShader,
+                  ShaderFragmentColorBetweenRrects>* program;
+    program_manager->GetProgram(&program);
+    graphics_state->UseProgram(program->GetHandle());
+    SetupShader(program->GetVertexShader(), graphics_state);
+
+    SetRRectUniforms(program->GetFragmentShader().u_inner_rect(),
+                     program->GetFragmentShader().u_inner_corners(),
+                     inner_rect_, *inner_corners_, 0.5f);
+    SetRRectUniforms(program->GetFragmentShader().u_outer_rect(),
+                     program->GetFragmentShader().u_outer_corners(),
+                     outer_rect_, *outer_corners_, 0.5f);
+  } else {
+    ShaderProgram<CommonVertexShader, ShaderFragmentColorInclude>* program;
+    program_manager->GetProgram(&program);
+    graphics_state->UseProgram(program->GetHandle());
+    SetupShader(program->GetVertexShader(), graphics_state);
+
+    float include[4] = {
+      outer_rect_.x(),
+      outer_rect_.y(),
+      outer_rect_.right(),
+      outer_rect_.bottom()
+    };
+    GL_CALL(glUniform4fv(program->GetFragmentShader().u_include(), 1, include));
+  }
+
+  GL_CALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, vertex_count_));
+}
+
+void DrawRectShadowSpread::SetupShader(const CommonVertexShader& shader,
+    GraphicsState* graphics_state) {
+  graphics_state->UpdateClipAdjustment(shader.u_clip_adjustment());
+  graphics_state->UpdateTransformMatrix(shader.u_view_matrix(),
       base_state_.transform);
   graphics_state->Scissor(base_state_.scissor.x(), base_state_.scissor.y(),
       base_state_.scissor.width(), base_state_.scissor.height());
   graphics_state->VertexAttribPointer(
-      program->GetVertexShader().a_position(), 2, GL_FLOAT, GL_FALSE,
+      shader.a_position(), 2, GL_FLOAT, GL_FALSE,
       sizeof(VertexAttributes), vertex_buffer_ +
       offsetof(VertexAttributes, position));
   graphics_state->VertexAttribPointer(
-      program->GetVertexShader().a_color(), 4, GL_UNSIGNED_BYTE, GL_TRUE,
+      shader.a_color(), 4, GL_UNSIGNED_BYTE, GL_TRUE,
       sizeof(VertexAttributes), vertex_buffer_ +
       offsetof(VertexAttributes, color));
   graphics_state->VertexAttribPointer(
-      program->GetVertexShader().a_offset(), 2, GL_FLOAT, GL_FALSE,
+      shader.a_offset(), 2, GL_FLOAT, GL_FALSE,
       sizeof(VertexAttributes), vertex_buffer_ +
       offsetof(VertexAttributes, offset));
   graphics_state->VertexAttribFinish();
-
-  float include[4] = {
-    include_scissor_.x(),
-    include_scissor_.y(),
-    include_scissor_.right(),
-    include_scissor_.bottom()
-  };
-  GL_CALL(glUniform4fv(program->GetFragmentShader().u_include(), 1, include));
-
-  GL_CALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, kVertexCount));
 }
 
 base::TypeId DrawRectShadowSpread::GetTypeId() const {
-  return ShaderProgram<ShaderVertexColorOffset,
-                       ShaderFragmentColorInclude>::GetTypeId();
+  if (inner_corners_) {
+    return ShaderProgram<CommonVertexShader,
+                         ShaderFragmentColorBetweenRrects>::GetTypeId();
+  } else {
+    return ShaderProgram<CommonVertexShader,
+                         ShaderFragmentColorInclude>::GetTypeId();
+  }
 }
 
 void DrawRectShadowSpread::SetVertex(VertexAttributes* vertex,
                                      float x, float y) {
   vertex->position[0] = x;
   vertex->position[1] = y;
-  vertex->offset[0] = x;
-  vertex->offset[1] = y;
+  vertex->offset[0] = (x - offset_center_.x()) * offset_scale_;
+  vertex->offset[1] = (y - offset_center_.y()) * offset_scale_;
   vertex->color = color_;
 }
 
diff --git a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.h b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.h
index 0621a45..1e4d590 100644
--- a/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.h
+++ b/src/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.h
@@ -15,11 +15,10 @@
 #ifndef COBALT_RENDERER_RASTERIZER_EGL_DRAW_RECT_SHADOW_SPREAD_H_
 #define COBALT_RENDERER_RASTERIZER_EGL_DRAW_RECT_SHADOW_SPREAD_H_
 
-#include <vector>
-
 #include "cobalt/math/rect_f.h"
 #include "cobalt/render_tree/color_rgba.h"
 #include "cobalt/renderer/rasterizer/egl/draw_object.h"
+#include "egl/generated_shader_impl.h"
 
 namespace cobalt {
 namespace renderer {
@@ -37,11 +36,10 @@
 //   |   |   +---------------------+   |   |
 //   |   |                             |   |
 //   |   +-----------------------------+   |
-//   | (include scissor)                   |
+//   |                                     |
 //   +-------------------------------------+
 
-// Handles drawing the solid "spread" portion of a box shadow. The
-// |include_scissor| specifies which pixels can be touched.
+// Handles drawing the solid "spread" portion of a box shadow.
 class DrawRectShadowSpread : public DrawObject {
  public:
   // Fill the area between |inner_rect| and |outer_rect| with the specified
@@ -49,9 +47,10 @@
   DrawRectShadowSpread(GraphicsState* graphics_state,
                        const BaseState& base_state,
                        const math::RectF& inner_rect,
+                       const OptionalRoundedCorners& inner_corners,
                        const math::RectF& outer_rect,
-                       const render_tree::ColorRGBA& color,
-                       const math::RectF& include_scissor);
+                       const OptionalRoundedCorners& outer_corners,
+                       const render_tree::ColorRGBA& color);
 
   void ExecuteUpdateVertexBuffer(GraphicsState* graphics_state,
       ShaderProgramManager* program_manager) OVERRIDE;
@@ -59,21 +58,31 @@
       ShaderProgramManager* program_manager) OVERRIDE;
   base::TypeId GetTypeId() const OVERRIDE;
 
- private:
+ protected:
+  typedef ShaderVertexColorOffset CommonVertexShader;
+
   struct VertexAttributes {
     float position[2];
     float offset[2];
     uint32_t color;
   };
 
+  DrawRectShadowSpread(GraphicsState* graphics_state,
+                       const BaseState& base_state);
+  void SetupShader(const CommonVertexShader& shader,
+                   GraphicsState* graphics_state);
   void SetVertex(VertexAttributes* vertex, float x, float y);
 
   math::RectF inner_rect_;
   math::RectF outer_rect_;
-  math::RectF include_scissor_;
+  OptionalRoundedCorners inner_corners_;
+  OptionalRoundedCorners outer_corners_;
+  math::PointF offset_center_;
+  float offset_scale_;
   uint32_t color_;
 
   uint8_t* vertex_buffer_;
+  int vertex_count_;
 };
 
 }  // namespace egl
diff --git a/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.cc b/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.cc
index 336efc7..e0b33bb 100644
--- a/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.cc
+++ b/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.cc
@@ -49,7 +49,7 @@
                 int skia_atlas_width, int skia_atlas_height,
                 int skia_cache_size_in_bytes,
                 int scratch_surface_cache_size_in_bytes,
-                int surface_cache_size_in_bytes,
+                int offscreen_target_cache_size_in_bytes,
                 bool purge_skia_font_caches_on_destruction);
   ~Impl();
 
@@ -66,6 +66,8 @@
     return fallback_rasterizer_->GetResourceProvider();
   }
 
+  void MakeCurrent() { graphics_context_->MakeCurrent(); }
+
  private:
   GrContext* GetFallbackContext() {
     return fallback_rasterizer_->GetGrContext();
@@ -94,7 +96,7 @@
                                int skia_atlas_width, int skia_atlas_height,
                                int skia_cache_size_in_bytes,
                                int scratch_surface_cache_size_in_bytes,
-                               int surface_cache_size_in_bytes,
+                               int offscreen_target_cache_size_in_bytes,
                                bool purge_skia_font_caches_on_destruction)
     : fallback_rasterizer_(new skia::HardwareRasterizer(
           graphics_context, skia_atlas_width, skia_atlas_height,
@@ -104,7 +106,8 @@
       graphics_context_(
           base::polymorphic_downcast<backend::GraphicsContextEGL*>(
               graphics_context)) {
-  DLOG(INFO) << "surface_cache_size_in_bytes: " << surface_cache_size_in_bytes;
+  DLOG(INFO) << "offscreen_target_cache_size_in_bytes: "
+             << offscreen_target_cache_size_in_bytes;
 
   backend::GraphicsContextEGL::ScopedMakeCurrent scoped_make_current(
       graphics_context_);
@@ -114,7 +117,7 @@
       graphics_context_,
       base::Bind(&HardwareRasterizer::Impl::CreateFallbackSurface,
                  base::Unretained(this)),
-      surface_cache_size_in_bytes));
+      offscreen_target_cache_size_in_bytes));
 }
 
 HardwareRasterizer::Impl::~Impl() {
@@ -283,12 +286,14 @@
 HardwareRasterizer::HardwareRasterizer(
     backend::GraphicsContext* graphics_context, int skia_atlas_width,
     int skia_atlas_height, int skia_cache_size_in_bytes,
-    int scratch_surface_cache_size_in_bytes, int surface_cache_size_in_bytes,
+    int scratch_surface_cache_size_in_bytes,
+    int offscreen_target_cache_size_in_bytes,
     bool purge_skia_font_caches_on_destruction)
     : impl_(new Impl(
           graphics_context, skia_atlas_width, skia_atlas_height,
           skia_cache_size_in_bytes, scratch_surface_cache_size_in_bytes,
-          surface_cache_size_in_bytes, purge_skia_font_caches_on_destruction)) {
+          offscreen_target_cache_size_in_bytes,
+          purge_skia_font_caches_on_destruction)) {
 }
 
 void HardwareRasterizer::Submit(
@@ -303,6 +308,10 @@
   return impl_->GetResourceProvider();
 }
 
+void HardwareRasterizer::MakeCurrent() {
+  return impl_->MakeCurrent();
+}
+
 }  // namespace egl
 }  // namespace rasterizer
 }  // namespace renderer
diff --git a/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.h b/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.h
index dc03019..cd7eb6e 100644
--- a/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/egl/hardware_rasterizer.h
@@ -42,14 +42,15 @@
   // the number of bytes that can be consumed by the scratch surface cache,
   // a facility that allows temporary surfaces to be reused within the
   // rasterization of a single frame/submission.
-  // If |surface_cache_size| is non-zero, the rasterizer will set itself up with
-  // a surface cache such that expensive render tree nodes seen multiple times
-  // will get saved to offscreen surfaces.
+  // The value of |offscreen_target_cache_size_in_bytes| sets an upper limit on
+  // how much GPU memory is used to save the results of render tree nodes to
+  // improve performance. This should be non-zero, otherwise performance
+  // degrades drastically.
   explicit HardwareRasterizer(backend::GraphicsContext* graphics_context,
                               int skia_atlas_width, int skia_atlas_height,
                               int skia_cache_size_in_bytes,
                               int scratch_surface_cache_size_in_bytes,
-                              int surface_cache_size_in_bytes,
+                              int offscreen_target_cache_size_in_bytes,
                               bool purge_skia_font_caches_on_destruction);
 
   void Submit(const scoped_refptr<render_tree::Node>& render_tree,
@@ -58,6 +59,8 @@
 
   render_tree::ResourceProvider* GetResourceProvider() OVERRIDE;
 
+  void MakeCurrent() OVERRIDE;
+
  private:
   class Impl;
   scoped_ptr<Impl> impl_;
diff --git a/src/cobalt/renderer/rasterizer/egl/offscreen_target_manager.cc b/src/cobalt/renderer/rasterizer/egl/offscreen_target_manager.cc
index d3feebb..3360ba3 100644
--- a/src/cobalt/renderer/rasterizer/egl/offscreen_target_manager.cc
+++ b/src/cobalt/renderer/rasterizer/egl/offscreen_target_manager.cc
@@ -26,26 +26,26 @@
 struct AllocationKey {
   AllocationKey(const cobalt::render_tree::Node* tree_node,
                 const cobalt::math::SizeF& alloc_size)
-      : node(tree_node),
+      : node_id(tree_node->GetId()),
         size(alloc_size) {}
 
   bool operator==(const AllocationKey& other) const {
-    return node == other.node && size == other.size;
+    return node_id == other.node_id && size == other.size;
   }
 
   bool operator!=(const AllocationKey& other) const {
-    return node != other.node || size != other.size;
+    return node_id != other.node_id || size != other.size;
   }
 
   bool operator<(const AllocationKey& rhs) const {
-    return (node < rhs.node) ||
-           (node == rhs.node &&
+    return (node_id < rhs.node_id) ||
+           (node_id == rhs.node_id &&
                (size.width() < rhs.size.width() ||
                (size.width() == rhs.size.width() &&
                    size.height() < rhs.size.height())));
   }
 
-  const void* node;
+  int64_t node_id;
   cobalt::math::SizeF size;
 };
 }  // namespace
@@ -55,13 +55,13 @@
 template <>
 struct hash<AllocationKey> {
   size_t operator()(const AllocationKey& key) const {
-    return reinterpret_cast<size_t>(key.node);
+    return static_cast<size_t>(key.node_id);
   }
 };
 #else
 template <>
 inline size_t hash_value<AllocationKey>(const AllocationKey& key) {
-  return reinterpret_cast<size_t>(key.node);
+  return static_cast<size_t>(key.node_id);
 }
 #endif
 }  // namespace BASE_HASH_NAMESPACE
diff --git a/src/cobalt/renderer/rasterizer/egl/render_tree_node_visitor.cc b/src/cobalt/renderer/rasterizer/egl/render_tree_node_visitor.cc
index 1685153..b3c6c7b 100644
--- a/src/cobalt/renderer/rasterizer/egl/render_tree_node_visitor.cc
+++ b/src/cobalt/renderer/rasterizer/egl/render_tree_node_visitor.cc
@@ -292,6 +292,13 @@
   if (skia_image->GetTypeId() == base::GetTypeId<skia::SinglePlaneImage>()) {
     skia::HardwareFrontendImage* hardware_image =
         base::polymorphic_downcast<skia::HardwareFrontendImage*>(skia_image);
+    if (hardware_image->alternate_rgba_format()) {
+      // We don't yet handle alternative formats that piggyback on a GL_RGBA
+      // texture.  This comes up, for example, with UYVY (YUV 422) textures.
+      FallbackRasterize(image_node);
+      return;
+    }
+
     if (clamp_texcoords || !is_opaque) {
       draw.reset(new DrawRectColorTexture(graphics_state_, draw_state_,
           data.destination_rect, kOpaqueWhite,
@@ -409,10 +416,8 @@
   }
 
   const render_tree::RectShadowNode::Builder& data = shadow_node->data();
-  if (data.rounded_corners) {
-    FallbackRasterize(shadow_node);
-    return;
-  }
+  base::optional<render_tree::RoundedCorners> spread_corners =
+      data.rounded_corners;
 
   scoped_ptr<DrawObject> draw;
   render_tree::ColorRGBA shadow_color(
@@ -424,54 +429,39 @@
   math::RectF spread_rect(data.rect);
   spread_rect.Offset(data.shadow.offset);
   if (data.inset) {
-    // data.rect is outermost.
-    // spread_rect is in the middle.
-    // blur_rect is innermost.
-    spread_rect.Inset(data.spread, data.spread);
-    spread_rect.Intersect(data.rect);
-    if (spread_rect.IsEmpty()) {
-      // Spread covers the whole data.rect.
-      spread_rect.set_origin(data.rect.CenterPoint());
-      spread_rect.set_size(math::SizeF());
+    if (spread_corners) {
+      spread_corners = spread_corners->Inset(
+          data.spread, data.spread, data.spread, data.spread);
     }
+    spread_rect.Inset(data.spread, data.spread);
     if (!spread_rect.IsEmpty() && data.shadow.blur_sigma > 0.0f) {
-      math::RectF blur_rect(spread_rect);
-      math::Vector2dF blur_extent(data.shadow.BlurExtent());
-      blur_rect.Inset(blur_extent.x(), blur_extent.y());
-      blur_rect.Intersect(spread_rect);
-      if (blur_rect.IsEmpty()) {
-        // Blur covers all of spread.
-        blur_rect.set_origin(spread_rect.CenterPoint());
-        blur_rect.set_size(math::SizeF());
-      }
       draw.reset(new DrawRectShadowBlur(graphics_state_, draw_state_,
-          blur_rect, data.rect, spread_rect, shadow_color,
-          data.shadow.blur_sigma, data.inset));
+          data.rect, data.rounded_corners, spread_rect, spread_corners,
+          shadow_color, data.shadow.blur_sigma, data.inset));
     } else {
       draw.reset(new DrawRectShadowSpread(graphics_state_, draw_state_,
-          spread_rect, data.rect, shadow_color, data.rect));
+          spread_rect, spread_corners, data.rect, data.rounded_corners,
+          shadow_color));
     }
   } else {
-    // blur_rect is outermost.
-    // spread_rect is in the middle (barring negative |spread| values).
-    // data.rect is innermost (though it may not overlap due to offset).
+    if (spread_corners) {
+      spread_corners = spread_corners->Inset(
+          -data.spread, -data.spread, -data.spread, -data.spread);
+    }
     spread_rect.Outset(data.spread, data.spread);
     if (spread_rect.IsEmpty()) {
       // Negative spread shenanigans! Nothing to draw.
       return;
     }
-    math::RectF blur_rect(spread_rect);
     if (data.shadow.blur_sigma > 0.0f) {
-      math::Vector2dF blur_extent(data.shadow.BlurExtent());
-      blur_rect.Outset(blur_extent.x(), blur_extent.y());
       draw.reset(new DrawRectShadowBlur(graphics_state_, draw_state_,
-          data.rect, blur_rect, spread_rect, shadow_color,
-          data.shadow.blur_sigma, data.inset));
+          data.rect, data.rounded_corners, spread_rect, spread_corners,
+          shadow_color, data.shadow.blur_sigma, data.inset));
     } else {
       draw.reset(new DrawRectShadowSpread(graphics_state_, draw_state_,
-          data.rect, spread_rect, shadow_color, spread_rect));
+          data.rect, data.rounded_corners, spread_rect, spread_corners,
+          shadow_color));
     }
-    node_bounds.Union(blur_rect);
   }
 
   // Transparency is used to skip pixels that are not shadowed.
@@ -586,7 +576,13 @@
 
   // Setup draw for the contents as needed.
   if (!content_is_cached) {
+    // Cache the results when drawn with 100% opacity, then draw the cached
+    // results at the desired opacity. This avoids having to generate different
+    // caches under varying opacity filters.
+    float old_opacity = draw_state_.opacity;
+    draw_state_.opacity = 1.0f;
     FallbackRasterize(node, target_info, content_rect);
+    draw_state_.opacity = old_opacity;
   }
 
   // Sub-pixel offsets are passed to the fallback rasterizer to preserve
@@ -649,7 +645,8 @@
   render_target_is_offscreen_ = old_render_target_is_offscreen;
 }
 
-// Add draw objects to render |node| to an offscreen render target.
+// Add draw objects to render |node| to an offscreen render target at
+//   100% opacity.
 // |out_texture| and |out_texcoord_transform| describe the texture subregion
 //   that will contain the result of rendering |node|. If not enough memory
 //   is available for the offscreen target, then |out_texture| will be null.
@@ -678,6 +675,12 @@
   *out_texcoord_transform = GetTexcoordTransform(target_info);
 
   if (!content_is_cached) {
+    // Cache the results at 100% opacity. The caller is responsible for
+    // drawing the cached results at the desired opacity. This avoids having
+    // to generate different caches under varying opacity filters.
+    float old_opacity = draw_state_.opacity;
+    draw_state_.opacity = 1.0f;
+
     // Try to use the native rasterizer to handle the offscreen rendering.
     // However, because offscreen targets are actually regions of a texture
     // atlas, some drivers may not properly handle reading and writing to
@@ -710,7 +713,6 @@
                               target_info.region.y() - out_content_rect->y()) *
         draw_state_.transform;
     draw_state_.scissor = RoundRectFToInt(target_info.region);
-    draw_state_.opacity = 1.0f;
     fallback_render_target_ = target_info.skia_canvas;
     render_target_ = target_info.framebuffer;
     render_target_is_offscreen_ = true;
@@ -733,6 +735,8 @@
       draw_object_manager_->RemoveDraws(last_valid_draw_id);
       FallbackRasterize(node, target_info, *out_content_rect);
     }
+
+    draw_state_.opacity = old_opacity;
   }
 }
 
diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color.glsl
index ad72864..be6efa4 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color.glsl
@@ -1,5 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 precision mediump float;

 varying vec4 v_color;

+

 void main() {

   gl_FragColor = v_color;

 }

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_between_rrects.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_between_rrects.glsl
new file mode 100644
index 0000000..5e400d1
--- /dev/null
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_between_rrects.glsl
@@ -0,0 +1,68 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

+precision mediump float;

+

+// A rounded rect is represented by a vec4 specifying (min.xy, max.xy), and a

+// matrix of corners. Each vector in the matrix represents a corner (order:

+// top left, top right, bottom left, bottom right). Each corner vec4 represents

+// (start.xy, radius.xy).

+uniform vec4 u_inner_rect;

+uniform mat4 u_inner_corners;

+uniform vec4 u_outer_rect;

+uniform mat4 u_outer_corners;

+

+varying vec2 v_offset;

+varying vec4 v_color;

+

+// Return 0 if the current point is inside the rounded rect, or scale towards 1

+// as it goes outside a 1-pixel anti-aliasing border.

+float GetRRectScale(vec4 rect, mat4 corners) {

+  vec4 select_corner = vec4(

+      step(v_offset.x, corners[0].x) * step(v_offset.y, corners[0].y),

+      step(corners[1].x, v_offset.x) * step(v_offset.y, corners[1].y),

+      step(v_offset.x, corners[2].x) * step(corners[2].y, v_offset.y),

+      step(corners[3].x, v_offset.x) * step(corners[3].y, v_offset.y));

+  if (dot(select_corner, vec4(1.0)) > 0.5) {

+    // Estimate the amount of anti-aliasing that should be used by comparing

+    // x^2 / a^2 + y^2 / b^2 for the ellipse and ellipse + 1 pixel.

+    vec4 corner = corners * select_corner;

+    vec2 pixel_offset = v_offset - corner.xy;

+

+    if (corner.z * corner.w < 0.1) {

+      // This is a square corner.

+      return min(length(pixel_offset), 1.0);

+    }

+

+    vec2 offset_min = pixel_offset / corner.zw;

+    vec2 offset_max = pixel_offset / (corner.zw + vec2(1.0));

+    float result_min = dot(offset_min, offset_min);

+    float result_max = dot(offset_max, offset_max);

+

+    // Return 1.0 if outside, or interpolate if in the border, or 0 if inside.

+    return (result_max >= 1.0) ? 1.0 :

+        max(result_min - 1.0, 0.0) / (result_min - result_max);

+  }

+

+  return clamp(rect.x - v_offset.x, 0.0, 1.0) +

+         clamp(v_offset.x - rect.z, 0.0, 1.0) +

+         clamp(rect.y - v_offset.y, 0.0, 1.0) +

+         clamp(v_offset.y - rect.w, 0.0, 1.0);

+}

+

+void main() {

+  float inner_scale = GetRRectScale(u_inner_rect, u_inner_corners);

+  float outer_scale = GetRRectScale(u_outer_rect, u_outer_corners);

+  gl_FragColor = v_color * inner_scale * (1.0 - outer_scale);

+}

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur.glsl
index 9f04388..d83bd62 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur.glsl
@@ -1,13 +1,33 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 precision mediump float;

 uniform vec2 u_blur_radius;

 uniform vec2 u_scale_add;

-varying vec2 v_offset;   // Relative to the blur center.

+

+// Adjust the sigma input value to tweak the blur output so that it better

+// matches the reference. This is usually only needed for very large sigmas.

+uniform vec2 u_sigma_tweak;

+

+varying vec2 v_offset;    // Relative to the blur center.

 varying vec4 v_color;

+

 void main() {

   // Distance from the blur radius.

   // Both v_offset and u_blur_radius are expressed in terms of the

   //   blur sigma.

-  vec2 pos = abs(v_offset) - u_blur_radius;

+  vec2 pos = abs(v_offset) - u_blur_radius + u_sigma_tweak;

   vec2 pos2 = pos * pos;

   vec2 pos3 = pos2 * pos;

   vec4 posx = vec4(1.0, pos.x, pos2.x, pos3.x);

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur_rrects.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur_rrects.glsl
new file mode 100644
index 0000000..120b988
--- /dev/null
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur_rrects.glsl
@@ -0,0 +1,204 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

+precision mediump float;

+

+// A rounded rect is represented by a vec4 specifying (min.xy, max.xy)

+// and a matrix of corners. Each vector in the matrix represents a corner

+// (order: top left, top right, bottom left, bottom right). Each corner vec4

+// represents (start.xy, radius.xy).

+uniform vec4 u_scissor_rect;

+uniform mat4 u_scissor_corners;

+uniform vec4 u_spread_rect;

+uniform mat4 u_spread_corners;

+

+// The scale_add uniform is used to switch the shader between generating

+// outset shadows and inset shadows. It impacts the shadow gradient and

+// scissor behavior. Use (1, 0) to get an outset shadow with the provided

+// scissor rect behaving as an exclusive scissor, and (-1, 1) to get an

+// inset shadow with scissor rect behaving as an inclusive scissor.

+uniform vec2 u_scale_add;

+

+// Blur calculations happen in terms in sigma distances. Use sigma_scale to

+// translate pixel distances into sigma distances.

+uniform vec2 u_sigma_scale;

+

+// Adjust the sigma input value to tweak the blur output so that it better

+// matches the reference. This is usually only needed for very large sigmas.

+uniform vec2 u_sigma_tweak;

+

+varying vec2 v_offset;

+varying vec4 v_color;

+

+// Return 0 if the current point is inside the rounded rect, or scale towards 1

+// as it goes outside a 1-pixel anti-aliasing border.

+float GetRRectScale(vec4 rect, mat4 corners) {

+  vec4 select_corner = vec4(

+      step(v_offset.x, corners[0].x) * step(v_offset.y, corners[0].y),

+      step(corners[1].x, v_offset.x) * step(v_offset.y, corners[1].y),

+      step(v_offset.x, corners[2].x) * step(corners[2].y, v_offset.y),

+      step(corners[3].x, v_offset.x) * step(corners[3].y, v_offset.y));

+  if (dot(select_corner, vec4(1.0)) > 0.5) {

+    // Estimate the amount of anti-aliasing that should be used by comparing

+    // x^2 / a^2 + y^2 / b^2 for the ellipse and ellipse + 1 pixel.

+    vec4 corner = corners * select_corner;

+    vec2 pixel_offset = v_offset - corner.xy;

+

+    if (corner.z * corner.w < 0.1) {

+      // This is a square corner.

+      return min(length(pixel_offset), 1.0);

+    }

+

+    vec2 offset_min = pixel_offset / corner.zw;

+    vec2 offset_max = pixel_offset / (corner.zw + vec2(1.0));

+    float result_min = dot(offset_min, offset_min);

+    float result_max = dot(offset_max, offset_max);

+

+    // Return 1.0 if outside, or interpolate if in the border, or 0 if inside.

+    return (result_max >= 1.0) ? 1.0 :

+        max(result_min - 1.0, 0.0) / (result_min - result_max);

+  }

+

+  return clamp(rect.x - v_offset.x, 0.0, 1.0) +

+         clamp(v_offset.x - rect.z, 0.0, 1.0) +

+         clamp(rect.y - v_offset.y, 0.0, 1.0) +

+         clamp(v_offset.y - rect.w, 0.0, 1.0);

+}

+

+// Calculate the distance from a point in the first quadrant to an ellipse

+// centered at the origin.

+//

+// http://iquilezles.org/www/articles/ellipsedist/ellipsedist.htm

+float GetEllipseDistance(vec2 p, vec2 ab) {

+  if (abs(ab.x - ab.y) < 0.5) {

+    return length(p) - ab.x;

+  }

+

+  if (p.x > p.y) {

+    p = p.yx;

+    ab = ab.yx;

+  }

+

+  float lr = 1.0 / (ab.y * ab.y - ab.x * ab.x);

+  float m = ab.x * p.x * lr;

+  float m2 = m * m;

+  float n = ab.y * p.y * lr;

+  float n2 = n * n;

+  float c = (m2 + n2 - 1.0) * 0.333333333;

+  float c3 = c * c * c;

+  float q = c3 + m2 * n2 * 2.0;

+  float d = c3 + m2 * n2;

+  float g = m + m * n2;

+

+  float co;

+

+  if (d < 0.0) {

+    float p = acos(q / c3) * 0.333333333;

+    float s = cos(p);

+    float t = sin(p) * 1.732050808;

+    float rx = sqrt(-c * (s + t + 2.0) + m2);

+    float ry = sqrt(-c * (s - t + 2.0) + m2);

+    co = (ry + sign(lr) * rx + abs(g) / (rx * ry) - m) * 0.5;

+  } else {

+    float h = 2.0 * m * n * sqrt(d);

+    float s = sign(q + h) * pow(abs(q + h), 0.333333333);

+    float u = sign(q - h) * pow(abs(q - h), 0.333333333);

+    float rx = -s - u - c * 4.0 + 2.0 * m2;

+    float ry = (s - u) * 1.732050808;

+    float rm = sqrt(rx * rx + ry * ry);

+    float p = ry / sqrt(rm - rx);

+    co = (p + 2.0 * g / rm - m) * 0.5;

+  }

+

+  float si = sqrt(1.0 - co * co);

+  vec2 closest = vec2(ab.x * co, ab.y * si);

+  return length(closest - p) * sign(p.y - closest.y);

+}

+

+// Get the x and y distances from the nearest edges of the rounded rect.

+vec2 GetBlurPosition(vec4 rect, mat4 corners) {

+  vec2 pos = max(rect.xy - v_offset, v_offset - rect.zw);

+

+  vec4 select_corner = vec4(

+      step(v_offset.x, corners[0].x) * step(v_offset.y, corners[0].y),

+      step(corners[1].x, v_offset.x) * step(v_offset.y, corners[1].y),

+      step(v_offset.x, corners[2].x) * step(corners[2].y, v_offset.y),

+      step(corners[3].x, v_offset.x) * step(corners[3].y, v_offset.y));

+  if (dot(select_corner, vec4(1.0)) > 0.5) {

+    // Use distance from the closest point on the ellipse as the position

+    // for blur calculations.

+    vec4 corner = corners * select_corner;

+    float dist = GetEllipseDistance(abs(v_offset - corner.xy), corner.zw);

+

+    // Since the transition from non-corner to corner positions happens along

+    // the ellipse's x or y axis, either pos.x = -corner.z or pos.y = -corner.w

+    // when the transition happens. Keep one ordinate at a minimum so that

+    // distance from the ellipse smoothly changes blur intensity.

+    //

+    // The return vec2 is used as blur = gi(x) * gi(y) where gi = the guassian

+    // integral function. Swapping x and y has no impact on the final blur, so

+    // distance can be substituted for one ordinate as long as the other takes

+    // the right value. E.g. when pos = (-corner.z, 0), the point is on the top

+    // center of the ellipse, so dist = 0. When pos = (0, -corner.w), dist = 0.

+    // When pos = (-corner.z, -corner.w), the point is at the center of the

+    // ellipse, and dist = max(-corner.z, -corner.w). So dist can be used as

+    // long as the other ordinate is min(pos.x, pos.y).

+    return vec2(dist, min(min(pos.x, pos.y), max(-corner.z, -corner.w)));

+  }

+

+  return pos;

+}

+

+void main() {

+  float scissor_scale = GetRRectScale(u_scissor_rect, u_scissor_corners) *

+                        u_scale_add.x + u_scale_add.y;

+

+  vec2 pos = GetBlurPosition(u_spread_rect, u_spread_corners) *

+             u_sigma_scale + u_sigma_tweak;

+  vec2 pos2 = pos * pos;

+  vec2 pos3 = pos2 * pos;

+  vec4 posx = vec4(1.0, pos.x, pos2.x, pos3.x);

+  vec4 posy = vec4(1.0, pos.y, pos2.y, pos3.y);

+

+  // Approximation of the gaussian integral from [x, +inf).

+  // http://stereopsis.com/shadowrect/

+  const vec4 klower = vec4(0.4375, -1.125, -0.75, -0.1666666);

+  const vec4 kmiddle = vec4(0.5, -0.75, 0.0, 0.3333333);

+  const vec4 kupper = vec4(0.5625, -1.125, 0.75, -0.1666666);

+

+  float gaussx = 0.0;

+  if (pos.x < -1.5) {

+    gaussx = 1.0;

+  } else if (pos.x < -0.5) {

+    gaussx = dot(posx, klower);

+  } else if (pos.x < 0.5) {

+    gaussx = dot(posx, kmiddle);

+  } else if (pos.x < 1.5) {

+    gaussx = dot(posx, kupper);

+  }

+

+  float gaussy = 0.0;

+  if (pos.y < -1.5) {

+    gaussy = 1.0;

+  } else if (pos.y < -0.5) {

+    gaussy = dot(posy, klower);

+  } else if (pos.y < 0.5) {

+    gaussy = dot(posy, kmiddle);

+  } else if (pos.y < 1.5) {

+    gaussy = dot(posy, kupper);

+  }

+

+  float alpha_scale = gaussx * gaussy * u_scale_add.x + u_scale_add.y;

+  gl_FragColor = v_color * (alpha_scale * scissor_scale);

+}

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_include.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_include.glsl
index ed660d6..38cfa5c 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_include.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_include.glsl
@@ -1,7 +1,22 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 precision mediump float;

 uniform vec4 u_include;   // include scissor (x_min, y_min, x_max, y_max)

 varying vec2 v_offset;

 varying vec4 v_color;

+

 void main() {

   vec2 include = step(u_include.xy, v_offset) * step(v_offset, u_include.zw);

   gl_FragColor = v_color * include.x * include.y;

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_texcoord.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_texcoord.glsl
index 47ec196..d8a622f 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_texcoord.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_color_texcoord.glsl
@@ -1,8 +1,23 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 precision mediump float;

 uniform vec4 u_texcoord_clamp;

 uniform sampler2D u_texture;

 varying vec4 v_color;

 varying vec2 v_texcoord;

+

 void main() {

   gl_FragColor = v_color * texture2D(u_texture,

       clamp(v_texcoord, u_texcoord_clamp.xy, u_texcoord_clamp.zw));

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_texcoord.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_texcoord.glsl
index 9c72630..9fd31b0 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/fragment_texcoord.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/fragment_texcoord.glsl
@@ -1,6 +1,21 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 precision mediump float;

 uniform sampler2D u_texture;

 varying vec2 v_texcoord;

+

 void main() {

   gl_FragColor = texture2D(u_texture, v_texcoord);

 }

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/generate_shader_impl.py b/src/cobalt/renderer/rasterizer/egl/shaders/generate_shader_impl.py
index c3acc75..30bdd79 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/generate_shader_impl.py
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/generate_shader_impl.py
@@ -73,10 +73,18 @@
 def GetDataDefinitionStringForFile(filename):
   """Returns a string containing C++ array definition for file contents."""
   with open(filename, 'rb') as f:
-    # Read the file contents; remove carriage return (apitrace doesn't handle
-    # shader sources with that character very well); and add a null terminator
-    # at the end.
-    file_contents = f.read().replace('\r', '') + '\0'
+    # Read the file contents.
+    file_contents = f.read()
+
+    # Strip comments and blank lines.
+    file_contents = re.sub(r'/\*.*?\*/', '', file_contents, flags=re.DOTALL)
+    file_contents = re.sub(r'(\s)*//.*', '', file_contents)
+    file_contents = re.sub('(^|\\n)(\\s)*\\n', '\\1', file_contents)
+
+    # Remove any carriage returns (apitrace doesn't handle shader sources with
+    # that character very well), and add a null terminator at the end.
+    file_contents = file_contents.replace('\r', '') + '\0'
+
     def GetChunk(contents, chunk_size):
       # Yield successive |chunk_size|-sized chunks from |contents|.
       for i in xrange(0, len(contents), chunk_size):
@@ -182,6 +190,14 @@
   return attributes, uniforms, samplers
 
 
+def ParseUniformName(name):
+  """Parse a uniform name into the base string and array count (if array)."""
+  temp = re.match(r'(\w+)(?:\[(\d+)\])?', name)
+  base = temp.group(1)
+  count = temp.group(2)
+  return base, count
+
+
 def GetAttributeMethods(attributes):
   """Return a string representing C++ methods for the given attributes."""
   methods = ''
@@ -194,7 +210,11 @@
   """Return a string representing C++ methods for the given uniforms."""
   methods = ''
   for name in uniforms:
-    methods += '\nGLuint {0}() const {{ return {0}_; }}'.format(name)
+    base, count = ParseUniformName(name)
+    methods += '\nGLuint {0}() const {{ return {0}_; }}'.format(base)
+    if count:
+      methods += ('\nstatic constexpr GLsizei {0}_count() {{ return {1}; }}'
+                  .format(base, count))
   return methods
 
 
@@ -219,7 +239,8 @@
   """Returns a string representing C++ statements to process during postlink."""
   statements = ''
   for name in uniforms:
-    statements += '\n{0}_ = GetUniformLocation(program, "{0}");'.format(name)
+    base, unused_count = ParseUniformName(name)
+    statements += '\n{0}_ = GetUniformLocation(program, "{0}");'.format(base)
   return statements
 
 
@@ -236,7 +257,8 @@
   """Returns a string representing C++ member variable declarations."""
   variables = ''
   for name in variable_names:
-    variables += '\nGLuint {0}_;'.format(name)
+    base, unused_count = ParseUniformName(name)
+    variables += '\nGLuint {0}_;'.format(base)
   return variables
 
 
diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/shaders.gyp b/src/cobalt/renderer/rasterizer/egl/shaders/shaders.gyp
index 8738d12..c3419a6 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/shaders.gyp
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/shaders.gyp
@@ -21,7 +21,9 @@
     'shader_sources': [
       '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_texcoord.glsl',
       '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_color.glsl',
+      '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_color_between_rrects.glsl',
       '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur.glsl',
+      '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_color_blur_rrects.glsl',
       '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_color_include.glsl',
       '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/fragment_color_texcoord.glsl',
       '<(DEPTH)/cobalt/renderer/rasterizer/egl/shaders/vertex_texcoord.glsl',
diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color.glsl
index 6a9389e..21cc4b4 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color.glsl
@@ -1,8 +1,23 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 uniform vec4 u_clip_adjustment;

 uniform mat3 u_view_matrix;

 attribute vec2 a_position;

 attribute vec4 a_color;

 varying vec4 v_color;

+

 void main() {

   vec3 pos2d = u_view_matrix * vec3(a_position, 1);

   gl_Position = vec4(pos2d.xy * u_clip_adjustment.xy +

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_offset.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_offset.glsl
index 879696f..b8b3e84 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_offset.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_offset.glsl
@@ -1,3 +1,17 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 uniform vec4 u_clip_adjustment;

 uniform mat3 u_view_matrix;

 attribute vec2 a_position;

@@ -5,6 +19,7 @@
 attribute vec2 a_offset;

 varying vec4 v_color;

 varying vec2 v_offset;

+

 void main() {

   vec3 pos2d = u_view_matrix * vec3(a_position, 1);

   gl_Position = vec4(pos2d.xy * u_clip_adjustment.xy +

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_texcoord.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_texcoord.glsl
index ef26a5b..3df0d4d 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_texcoord.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_color_texcoord.glsl
@@ -1,3 +1,17 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 uniform vec4 u_clip_adjustment;

 uniform mat3 u_view_matrix;

 attribute vec2 a_position;

@@ -5,6 +19,7 @@
 attribute vec2 a_texcoord;

 varying vec4 v_color;

 varying vec2 v_texcoord;

+

 void main() {

   vec3 pos2d = u_view_matrix * vec3(a_position, 1);

   gl_Position = vec4(pos2d.xy * u_clip_adjustment.xy +

diff --git a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_texcoord.glsl b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_texcoord.glsl
index 1527625..4a78819 100644
--- a/src/cobalt/renderer/rasterizer/egl/shaders/vertex_texcoord.glsl
+++ b/src/cobalt/renderer/rasterizer/egl/shaders/vertex_texcoord.glsl
@@ -1,8 +1,23 @@
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

 uniform vec4 u_clip_adjustment;

 uniform mat3 u_view_matrix;

 attribute vec2 a_position;

 attribute vec2 a_texcoord;

 varying vec2 v_texcoord;

+

 void main() {

   vec3 pos2d = u_view_matrix * vec3(a_position, 1);

   gl_Position = vec4(pos2d.xy * u_clip_adjustment.xy +

diff --git a/src/cobalt/renderer/rasterizer/egl/software_rasterizer.h b/src/cobalt/renderer/rasterizer/egl/software_rasterizer.h
index afb3c0b..93018bf 100644
--- a/src/cobalt/renderer/rasterizer/egl/software_rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/egl/software_rasterizer.h
@@ -47,6 +47,8 @@
 
   render_tree::ResourceProvider* GetResourceProvider() OVERRIDE;
 
+  void MakeCurrent() OVERRIDE {}
+
  private:
   backend::GraphicsContextEGL* context_;
   skia::SoftwareRasterizer skia_rasterizer_;
diff --git a/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.cc b/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.cc
index 2cd58c0..b89a099 100644
--- a/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.cc
+++ b/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.cc
@@ -49,7 +49,6 @@
 void ConvertContentRegionToScaleTranslateVector(
     const math::Rect* content_region, const math::Size& texture_size,
     float* out_vec4) {
-  SbMemorySet(out_vec4, 0, sizeof(float) * 4);
   if (!content_region) {
     // If no content region is provided, use the identity matrix.
     out_vec4[0] = 1.0f;
@@ -59,10 +58,10 @@
     return;
   }
 
-  float scale_x = (content_region->right() - content_region->x()) /
-                  static_cast<float>(texture_size.width());
-  float scale_y = (content_region->bottom() - content_region->y()) /
-                  static_cast<float>(texture_size.height());
+  float scale_x =
+      content_region->width() / static_cast<float>(texture_size.width());
+  float scale_y =
+      content_region->height() / static_cast<float>(texture_size.height());
   float translate_x =
       content_region->x() / static_cast<float>(texture_size.width());
   float translate_y = (texture_size.height() - content_region->bottom()) /
@@ -90,7 +89,8 @@
       return kIdentityColorMatrix;
     } break;
     case TexturedMeshRenderer::Image::YUV_2PLANE_BT709:
-    case TexturedMeshRenderer::Image::YUV_3PLANE_BT709: {
+    case TexturedMeshRenderer::Image::YUV_3PLANE_BT709:
+    case TexturedMeshRenderer::Image::YUV_UYVY_422_BT709: {
       return kBT709ColorMatrix;
     } break;
     default: { NOTREACHED(); }
@@ -103,8 +103,7 @@
 void TexturedMeshRenderer::RenderVBO(uint32 vbo, int num_vertices, uint32 mode,
                                      const Image& image,
                                      const glm::mat4& mvp_transform) {
-  ProgramInfo blit_program =
-      GetBlitProgram(image.type, image.textures[0].texture->GetTarget());
+  ProgramInfo blit_program = GetBlitProgram(image);
 
   GL_CALL(glUseProgram(blit_program.gl_program_id));
 
@@ -127,12 +126,28 @@
     GL_CALL(glActiveTexture(GL_TEXTURE0 + i));
     GL_CALL(glBindTexture(image.textures[i].texture->GetTarget(),
                           image.textures[i].texture->gl_handle()));
+    if (image.type == Image::YUV_UYVY_422_BT709) {
+      // For UYVY, wrap mode is handled within the fragment shader, ensure here
+      // that it is always set to GL_REPEAT.
+      GL_CALL(glTexParameteri(
+          image.textures[0].texture->GetTarget(), GL_TEXTURE_WRAP_S,
+          GL_REPEAT));
+    }
 
     GL_CALL(glUniform1i(blit_program.texture_uniforms[i], i));
 
+    if (blit_program.texture_size_uniforms[i] != -1) {
+      math::Size texture_size = image.textures[i].texture->GetSize();
+      int texture_sizes[2] = {texture_size.width(), texture_size.height()};
+      GL_CALL(glUniform2iv(blit_program.texture_size_uniforms[i], 1,
+                           texture_sizes));
+    }
+
+    math::Size content_size = image.textures[i].texture->GetSize();
+
     float scale_translate_vector[4];
     ConvertContentRegionToScaleTranslateVector(
-        &image.textures[i].content_region, image.textures[i].texture->GetSize(),
+        &image.textures[i].content_region, content_size,
         scale_translate_vector);
     GL_CALL(glUniform4fv(blit_program.texcoord_scale_translate_uniforms[i], 1,
                          scale_translate_vector));
@@ -223,19 +238,56 @@
   return blit_vertex_shader;
 }
 
+namespace {
+
+uint32 CompileShader(const std::string& shader_source) {
+  uint32 blit_fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
+
+  int shader_source_length = shader_source.size();
+  const char* shader_source_c_str = shader_source.c_str();
+  GL_CALL(glShaderSource(blit_fragment_shader, 1, &shader_source_c_str,
+                         &shader_source_length));
+  GL_CALL(glCompileShader(blit_fragment_shader));
+
+  GLint is_compiled = GL_FALSE;
+  GL_CALL(glGetShaderiv(blit_fragment_shader, GL_COMPILE_STATUS, &is_compiled));
+  if (is_compiled != GL_TRUE) {
+    const GLsizei kMaxLogLength = 2048;
+    GLsizei log_length = 0;
+    GLchar log[kMaxLogLength];
+    glGetShaderInfoLog(blit_fragment_shader, kMaxLogLength, &log_length, log);
+    DLOG(ERROR) << "shader error: " << log;
+    DLOG(ERROR) << "shader source:\n" << shader_source;
+  }
+  CHECK_EQ(is_compiled, GL_TRUE);
+
+  return blit_fragment_shader;
+}
+
+struct SamplerInfo {
+  std::string type;
+  std::string preamble;
+};
+
+SamplerInfo GetSamplerInfo(uint32 texture_target) {
+  SamplerInfo sampler_info;
+  sampler_info.type = "sampler2D";
+
+  if (texture_target == GL_TEXTURE_EXTERNAL_OES) {
+    sampler_info.type = "samplerExternalOES";
+    sampler_info.preamble = "#extension GL_OES_EGL_image_external : require\n";
+  }
+
+  return sampler_info;
+}
+}  // namespace
+
 // static
 uint32 TexturedMeshRenderer::CreateFragmentShader(
     uint32 texture_target, const std::vector<TextureInfo>& textures) {
-  uint32 blit_fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
+  SamplerInfo sampler_info = GetSamplerInfo(texture_target);
 
-  std::string sampler_type = "sampler2D";
-  std::string blit_fragment_shader_source;
-
-  if (texture_target == GL_TEXTURE_EXTERNAL_OES) {
-    sampler_type = "samplerExternalOES";
-    blit_fragment_shader_source +=
-        "#extension GL_OES_EGL_image_external : require\n";
-  }
+  std::string blit_fragment_shader_source = sampler_info.preamble;
 
   blit_fragment_shader_source += "precision mediump float;";
   for (unsigned int i = 0; i < textures.size(); ++i) {
@@ -244,7 +296,7 @@
   }
   for (unsigned int i = 0; i < textures.size(); ++i) {
     blit_fragment_shader_source +=
-        StringPrintf("uniform %s texture_%s;", sampler_type.c_str(),
+        StringPrintf("uniform %s texture_%s;", sampler_info.type.c_str(),
                      textures[i].name.c_str());
   }
   blit_fragment_shader_source +=
@@ -270,21 +322,83 @@
       "  gl_FragColor = untransformed_color * to_rgb_color_matrix;"
       "}";
 
-  int blit_fragment_shader_source_length = blit_fragment_shader_source.size();
-  const char* blit_fragment_shader_source_c_str =
-      blit_fragment_shader_source.c_str();
-  GL_CALL(glShaderSource(blit_fragment_shader, 1,
-                         &blit_fragment_shader_source_c_str,
-                         &blit_fragment_shader_source_length));
-  GL_CALL(glCompileShader(blit_fragment_shader));
+  return CompileShader(blit_fragment_shader_source);
+}
 
-  return blit_fragment_shader;
+// static
+uint32 TexturedMeshRenderer::CreateUYVYFragmentShader(uint32 texture_target,
+                                                      int32 texture_wrap_s) {
+  SamplerInfo sampler_info = GetSamplerInfo(texture_target);
+
+  std::string blit_fragment_shader_source = sampler_info.preamble;
+
+  blit_fragment_shader_source += "precision mediump float;";
+  blit_fragment_shader_source += "varying vec2 v_tex_coord_uyvy;";
+  blit_fragment_shader_source +=
+      StringPrintf("uniform %s texture_uyvy;", sampler_info.type.c_str());
+
+  // The fragment shader below manually performs horizontal linear interpolation
+  // filtering of color values.  Specifically it needs to interpolate the UV
+  // values differently than Y values because UV values occur at half the
+  // frequency.
+  blit_fragment_shader_source +=
+      "uniform mat4 to_rgb_color_matrix;"
+      "uniform ivec2 texture_size_uyvy;"
+      "void main() {"
+      // Convert from normalized [0,1] texture coordinates into [0, width]
+      // texture space coordinates.
+      "  float texture_space_x ="
+      "      float(texture_size_uyvy.x) * v_tex_coord_uyvy.x;";
+  if (texture_wrap_s == GL_CLAMP_TO_EDGE) {
+    // We manually clamp our edges to 0.25 to ensure that the Y components are
+    // clamped properly.  We let GL's standard texture wrapping flow take care
+    // of the UV clamping (i.e. at [0.5, float(texture_size_uyvy.x) - 0.5]).
+    blit_fragment_shader_source +=
+        "  texture_space_x = clamp("
+        "      texture_space_x, 0.25, float(texture_size_uyvy.x) - 0.25);";
+  }
+  blit_fragment_shader_source +=
+      "  float texel_step_u = 1.0 / float(texture_size_uyvy.x);"
+      // As our first (left-most) sample, we choose the pixel that will be on
+      // the left side of the UV interpolation.  We add 0.5 to the result in
+      // order to get a coordinate representing the center of the pixel.
+      "  float sample_1_texture_space = floor(texture_space_x - 0.5) + 0.5;"
+      "  float sample_1_normalized ="
+      "      sample_1_texture_space * texel_step_u;"
+      "  float sample_2_normalized = sample_1_normalized + texel_step_u;"
+      "  vec4 sample_1 = texture2D("
+      "      texture_uyvy, vec2(sample_1_normalized, v_tex_coord_uyvy.y));"
+      "  vec4 sample_2 = texture2D("
+      "      texture_uyvy, vec2(sample_2_normalized, v_tex_coord_uyvy.y));"
+      // Our lerp progress is how far away |texture_space_x| is from
+      // sample 1, or in other words how close it is to sample 2.
+      "  float lerp_progress = texture_space_x - sample_1_texture_space;"
+      "  vec2 uv_value = mix(sample_1.rb, sample_2.rb, lerp_progress);"
+      // Since |lerp_progress| represents progress from the center of the
+      // sample 1 pixel (uyvy group) to the center of the sample 2 pixel (uyvy)
+      // group, we need to determine whether to interpolate between the two
+      // y values within sample 1, the last y value of sample 1 and the first
+      // y value of sample 2, or the two y values within sample 2.
+      "  float y_value;"
+      "  if (lerp_progress < 0.25) {"
+      "    y_value = mix(sample_1.g, sample_1.a, lerp_progress * 2.0 + 0.5);"
+      "  } else if (lerp_progress < 0.75) {"
+      "    y_value = mix(sample_1.a, sample_2.g, lerp_progress * 2.0 - 0.5);"
+      "  } else {"
+      "    y_value = mix(sample_2.g, sample_2.a, lerp_progress * 2.0 - 1.5);"
+      "  }"
+      // Perform the YUV->RGB transform and output the color value.
+      "  vec4 untransformed_color = vec4(y_value, uv_value.r, uv_value.g, 1.0);"
+      "  gl_FragColor = untransformed_color * to_rgb_color_matrix;"
+      "}";
+
+  return CompileShader(blit_fragment_shader_source);
 }
 
 // static
 TexturedMeshRenderer::ProgramInfo TexturedMeshRenderer::MakeBlitProgram(
-    const float* color_matrix, uint32 texture_target,
-    const std::vector<TextureInfo>& textures) {
+    const float* color_matrix, const std::vector<TextureInfo>& textures,
+    uint32 blit_fragment_shader) {
   int total_components = 0;
   for (unsigned int i = 0; i < textures.size(); ++i) {
     total_components += textures[i].components.length();
@@ -300,7 +414,6 @@
   uint32 blit_vertex_shader = CreateVertexShader(textures);
   GL_CALL(glAttachShader(result.gl_program_id, blit_vertex_shader));
 
-  uint32 blit_fragment_shader = CreateFragmentShader(texture_target, textures);
   GL_CALL(glAttachShader(result.gl_program_id, blit_fragment_shader));
 
   GL_CALL(glBindAttribLocation(result.gl_program_id, kBlitPositionAttribute,
@@ -317,11 +430,19 @@
         StringPrintf("scale_translate_%s", textures[i].name.c_str());
     result.texcoord_scale_translate_uniforms[i] = glGetUniformLocation(
         result.gl_program_id, scale_translate_uniform_name.c_str());
+    DCHECK_EQ(GL_NO_ERROR, glGetError());
 
     std::string texture_uniform_name =
         StringPrintf("texture_%s", textures[i].name.c_str());
     result.texture_uniforms[i] = glGetUniformLocation(
         result.gl_program_id, texture_uniform_name.c_str());
+    DCHECK_EQ(GL_NO_ERROR, glGetError());
+
+    std::string texture_size_name =
+        StringPrintf("texture_size_%s", textures[i].name.c_str());
+    result.texture_size_uniforms[i] =
+        glGetUniformLocation(result.gl_program_id, texture_size_name.c_str());
+    DCHECK_EQ(GL_NO_ERROR, glGetError());
   }
 
   // Upload the color matrix right away since it won't change from draw to draw.
@@ -339,8 +460,20 @@
 }
 
 TexturedMeshRenderer::ProgramInfo TexturedMeshRenderer::GetBlitProgram(
-    Image::Type type, uint32 texture_target) {
-  CacheKey key(texture_target, type);
+    const Image& image) {
+  Image::Type type = image.type;
+  uint32 texture_target = image.textures[0].texture->GetTarget();
+  base::optional<int32> texture_wrap_s;
+  if (type == Image::YUV_UYVY_422_BT709) {
+    texture_wrap_s.emplace();
+    GL_CALL(glBindTexture(
+        texture_target, image.textures[0].texture->gl_handle()));
+    GL_CALL(glGetTexParameteriv(texture_target,
+                                GL_TEXTURE_WRAP_S, &(*texture_wrap_s)));
+    GL_CALL(glBindTexture(texture_target, 0));
+  }
+
+  CacheKey key(texture_target, type, texture_wrap_s);
 
   ProgramCache::iterator found = blit_program_cache_.find(key);
   if (found == blit_program_cache_.end()) {
@@ -350,20 +483,33 @@
       case Image::RGBA: {
         std::vector<TextureInfo> texture_infos;
         texture_infos.push_back(TextureInfo("rgba", "rgba"));
-        result = MakeBlitProgram(color_matrix, texture_target, texture_infos);
+        result = MakeBlitProgram(
+            color_matrix, texture_infos,
+            CreateFragmentShader(texture_target, texture_infos));
       } break;
       case Image::YUV_2PLANE_BT709: {
         std::vector<TextureInfo> texture_infos;
         texture_infos.push_back(TextureInfo("y", "a"));
         texture_infos.push_back(TextureInfo("uv", "ba"));
-        result = MakeBlitProgram(color_matrix, texture_target, texture_infos);
+        result = MakeBlitProgram(
+            color_matrix, texture_infos,
+            CreateFragmentShader(texture_target, texture_infos));
       } break;
       case Image::YUV_3PLANE_BT709: {
         std::vector<TextureInfo> texture_infos;
         texture_infos.push_back(TextureInfo("y", "a"));
         texture_infos.push_back(TextureInfo("u", "a"));
         texture_infos.push_back(TextureInfo("v", "a"));
-        result = MakeBlitProgram(color_matrix, texture_target, texture_infos);
+        result = MakeBlitProgram(
+            color_matrix, texture_infos,
+            CreateFragmentShader(texture_target, texture_infos));
+      } break;
+      case Image::YUV_UYVY_422_BT709: {
+        std::vector<TextureInfo> texture_infos;
+        texture_infos.push_back(TextureInfo("uyvy", "rgba"));
+        result = MakeBlitProgram(color_matrix, texture_infos,
+                                 CreateUYVYFragmentShader(texture_target,
+                                                          *texture_wrap_s));
       } break;
       default: { NOTREACHED(); }
     }
diff --git a/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.h b/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.h
index dd3efae..3831d4d 100644
--- a/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.h
+++ b/src/cobalt/renderer/rasterizer/egl/textured_mesh_renderer.h
@@ -17,6 +17,7 @@
 
 #include <map>
 #include <string>
+#include <tuple>
 #include <utility>
 #include <vector>
 
@@ -51,7 +52,11 @@
       // YUV BT709 image where the Y, U and V components are all on different
       // textures.
       YUV_3PLANE_BT709,
-      RGBA,  // 1 texture is used that contains RGBA pixels.
+      // 1 texture is used that contains RGBA pixels.
+      RGBA,
+      // 1 texture plane is used where Y is sampled twice for each UV sample
+      // (horizontally).
+      YUV_UYVY_422_BT709,
     };
 
     struct Texture {
@@ -67,6 +72,7 @@
         case YUV_3PLANE_BT709:
           return 3;
         case RGBA:
+        case YUV_UYVY_422_BT709:
           return 1;
         default:
           NOTREACHED();
@@ -101,25 +107,32 @@
     std::string components;
   };
   struct ProgramInfo {
-    uint32 mvp_transform_uniform;
-    uint32 texcoord_scale_translate_uniforms[3];
-    uint32 texture_uniforms[3];
+    int32 mvp_transform_uniform;
+    int32 texcoord_scale_translate_uniforms[3];
+    int32 texture_uniforms[3];
+    int32 texture_size_uniforms[3];
     uint32 gl_program_id;
   };
   // We key each program off of their GL texture type and image type.
-  typedef std::pair<uint32, Image::Type> CacheKey;
+  typedef std::tuple<uint32, Image::Type, base::optional<int32> > CacheKey;
   typedef std::map<CacheKey, ProgramInfo> ProgramCache;
 
   uint32 GetQuadVBO();
-  ProgramInfo GetBlitProgram(Image::Type type, uint32 texture_target);
+  ProgramInfo GetBlitProgram(const Image& image);
 
   static ProgramInfo MakeBlitProgram(const float* color_matrix,
-                                     uint32 texture_target,
-                                     const std::vector<TextureInfo>& textures);
+                                     const std::vector<TextureInfo>& textures,
+                                     uint32 blit_fragment_shader);
+
   static uint32 CreateFragmentShader(uint32 texture_target,
                                      const std::vector<TextureInfo>& textures);
   static uint32 CreateVertexShader(const std::vector<TextureInfo>& textures);
 
+  // UYVY textures need a special fragment shader to handle the unique aspect
+  // of applying bilinear filtering within a texel between the two Y values.
+  static uint32 CreateUYVYFragmentShader(uint32 texture_target,
+                                         int32 texture_wrap_s);
+
   backend::GraphicsContextEGL* graphics_context_;
 
   // Since different texture targets can warrant different shaders/programs,
diff --git a/src/cobalt/renderer/rasterizer/lib/external_rasterizer.cc b/src/cobalt/renderer/rasterizer/lib/external_rasterizer.cc
index ed7062f..d65ebd6 100644
--- a/src/cobalt/renderer/rasterizer/lib/external_rasterizer.cc
+++ b/src/cobalt/renderer/rasterizer/lib/external_rasterizer.cc
@@ -42,6 +42,8 @@
 
   render_tree::ResourceProvider* GetResourceProvider();
 
+  void MakeCurrent() { hardware_rasterizer_.MakeCurrent(); }
+
  private:
   base::ThreadChecker thread_checker_;
 
@@ -148,6 +150,10 @@
   return impl_->GetResourceProvider();
 }
 
+void ExternalRasterizer::MakeCurrent() {
+  return impl_->MakeCurrent();
+}
+
 }  // namespace lib
 }  // namespace rasterizer
 }  // namespace renderer
diff --git a/src/cobalt/renderer/rasterizer/lib/external_rasterizer.h b/src/cobalt/renderer/rasterizer/lib/external_rasterizer.h
index 16f6f66..39b7559 100644
--- a/src/cobalt/renderer/rasterizer/lib/external_rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/lib/external_rasterizer.h
@@ -49,6 +49,8 @@
   // ResourceProvider.
   render_tree::ResourceProvider* GetResourceProvider() OVERRIDE;
 
+  void MakeCurrent() OVERRIDE;
+
  private:
   class Impl;
   scoped_ptr<Impl> impl_;
diff --git a/src/cobalt/renderer/rasterizer/lib/renderer_module_default_options_lib.cc b/src/cobalt/renderer/rasterizer/lib/renderer_module_default_options_lib.cc
index 4caa615..f98baf7 100644
--- a/src/cobalt/renderer/rasterizer/lib/renderer_module_default_options_lib.cc
+++ b/src/cobalt/renderer/rasterizer/lib/renderer_module_default_options_lib.cc
@@ -34,15 +34,6 @@
 }  // namespace
 
 void RendererModule::Options::SetPerPlatformDefaultOptions() {
-  // Set default options from the current build's configuration.
-  surface_cache_size_in_bytes = COBALT_SURFACE_CACHE_SIZE_IN_BYTES;
-
-  // Default to 4MB, but this may be modified externally.
-  skia_cache_size_in_bytes = 4 * 1024 * 1024;
-
-  scratch_surface_cache_size_in_bytes =
-      COBALT_SCRATCH_SURFACE_CACHE_SIZE_IN_BYTES;
-
   // Ensure the scene is re-rasterized even if the render tree is unchanged so
   // that headset look changes are properly rendered.
   submit_even_if_render_tree_is_unchanged = true;
diff --git a/src/cobalt/renderer/rasterizer/pixel_test.cc b/src/cobalt/renderer/rasterizer/pixel_test.cc
index 9effe9e..0becedb 100644
--- a/src/cobalt/renderer/rasterizer/pixel_test.cc
+++ b/src/cobalt/renderer/rasterizer/pixel_test.cc
@@ -390,6 +390,7 @@
     case render_tree::kPixelFormatBGRA8: {
       return RGBASwizzle(2, 1, 0, 3);
     }
+    case render_tree::kPixelFormatUYVY:
     case render_tree::kPixelFormatY8:
     case render_tree::kPixelFormatU8:
     case render_tree::kPixelFormatV8:
@@ -1051,6 +1052,84 @@
 #endif  // #if NV12_TEXTURE_SUPPORTED
 }  // namespace
 
+scoped_refptr<Image> MakeUYVYImage(ResourceProvider* resource_provider,
+                                   const Size& image_size) {
+  // Our UYVY image is a different pattern than the other YUV Make*Image()
+  // functions in order to better test how all channels change and interpolate
+  // in both the horizontal and vertical directions.
+  render_tree::AlphaFormat alpha_format = render_tree::kAlphaFormatOpaque;
+  CHECK(resource_provider->AlphaFormatSupported(alpha_format));
+
+  Size uv_size = image_size;
+  uv_size.set_width(image_size.width() / 2);
+
+  scoped_ptr<ImageData> image_data = resource_provider->AllocateImageData(
+      uv_size, render_tree::kPixelFormatUYVY, alpha_format);
+
+  float x_step = 1.0f / (uv_size.width() - 1);
+  float y_step = 1.0f / (uv_size.height() - 1);
+  for (int i = 0; i < uv_size.height(); ++i) {
+    uint8_t* pixel_data = image_data->GetMemory() +
+                          image_data->GetDescriptor().pitch_in_bytes * i;
+    float y = i * y_step;
+    for (int j = 0; j < uv_size.width(); ++j) {
+      float x1 = j * x_step;
+      float x2 = (j + 0.5f) * x_step;
+
+      int pixel_offset = j * 4;
+
+      float radius1 = math::Vector2dF(x1 - 0.5f, y - 0.5f).Length() * 2;
+      float radius2 = math::Vector2dF(x2 - 0.5f, y - 0.5f).Length() * 2;
+
+      pixel_data[pixel_offset + 0] = std::min(255.0f, radius1 * 255.0f);
+      pixel_data[pixel_offset + 1] = std::min(255.0f, radius1 * 255.0f);
+      pixel_data[pixel_offset + 2] = 255 - std::min(255.0f, radius1 * 255.0f);
+      pixel_data[pixel_offset + 3] = std::min(255.0f, radius2 * 255.0f);
+    }
+  }
+
+  return resource_provider->CreateImage(image_data.Pass());
+}
+
+// Makes an image where the Y values alternate between 0 and 255.  This is
+// useful for testing y value filtering, especially when a small image of this
+// form is scaled up.
+scoped_refptr<Image> MakeAlternatingYUYVYImage(
+    ResourceProvider* resource_provider, const Size& image_size) {
+  // Our UYVY image is a different pattern than the other YUV Make*Image()
+  // functions in order to better test how all channels change and interpolate
+  // in both the horizontal and vertical directions.
+  render_tree::AlphaFormat alpha_format = render_tree::kAlphaFormatOpaque;
+  CHECK(resource_provider->AlphaFormatSupported(alpha_format));
+
+  Size uv_size = image_size;
+  uv_size.set_width(image_size.width() / 2);
+
+  scoped_ptr<ImageData> image_data = resource_provider->AllocateImageData(
+      uv_size, render_tree::kPixelFormatUYVY, alpha_format);
+
+  float x_step = 1.0f / (uv_size.width() - 1);
+  float y_step = 1.0f / (uv_size.height() - 1);
+  for (int i = 0; i < uv_size.height(); ++i) {
+    uint8_t* pixel_data = image_data->GetMemory() +
+                          image_data->GetDescriptor().pitch_in_bytes * i;
+    float y = i * y_step;
+    for (int j = 0; j < uv_size.width(); ++j) {
+      float x1 = j * x_step;
+      float x2 = (j + 0.5f) * x_step;
+
+      int pixel_offset = j * 4;
+
+      pixel_data[pixel_offset + 0] = std::min(255.0f, 255.0f * y);
+      pixel_data[pixel_offset + 1] = 0;
+      pixel_data[pixel_offset + 2] = 255 - std::min(255.0f, 255.0f * y);
+      pixel_data[pixel_offset + 3] = 255;
+    }
+  }
+
+  return resource_provider->CreateImage(image_data.Pass());
+}
+
 TEST_F(PixelTest, ThreePlaneYUVImageSupport) {
   // Tests that an ImageNode hooked up to a 3-plane YUV image works fine.
   scoped_refptr<Image> image =
@@ -1089,6 +1168,35 @@
                           -half_output_size.height())));
 }
 
+TEST_F(PixelTest, YUV422UYVYImageSupport) {
+  if (!GetResourceProvider()->PixelFormatSupported(
+          render_tree::kPixelFormatUYVY)) {
+    return;
+  }
+
+  // Tests that an ImageNode hooked up to a UYVY image works fine.
+  scoped_refptr<Image> image =
+      MakeUYVYImage(GetResourceProvider(), output_surface_size());
+
+  TestTree(new ImageNode(image));
+}
+
+TEST_F(PixelTest, YUV422UYVYImageScaledUpSupport) {
+  if (!GetResourceProvider()->PixelFormatSupported(
+          render_tree::kPixelFormatUYVY)) {
+    return;
+  }
+
+  // Tests that an ImageNode hooked up to a UYVY image and then scaled onto
+  // a larger screen space works fine.  This test is particularly important in
+  // testing that the somewhat unique UYVY texture interpolation logic is
+  // working properly.
+  scoped_refptr<Image> image =
+      MakeAlternatingYUYVYImage(GetResourceProvider(), math::Size(4, 4));
+
+  TestTree(new ImageNode(image, math::Rect(output_surface_size())));
+}
+
 // The software rasterizer does not support NV12 images.
 #if NV12_TEXTURE_SUPPORTED
 
@@ -3493,6 +3601,18 @@
   TestTree(CreateMapToMeshTestRenderTree(GetResourceProvider(), image));
 }
 
+TEST_F(PixelTest, MapToMeshUYVYTest) {
+  if (!GetResourceProvider()->PixelFormatSupported(
+          render_tree::kPixelFormatUYVY)) {
+    return;
+  }
+
+  // Tests that MapToMesh filter works as expected with a I420 YUV texture.
+  scoped_refptr<Image> image =
+      MakeUYVYImage(GetResourceProvider(), Size(200, 200));
+  TestTree(CreateMapToMeshTestRenderTree(GetResourceProvider(), image));
+}
+
 #endif  // defined(ENABLE_MAP_TO_MESH)
 
 }  // namespace rasterizer
diff --git a/src/cobalt/renderer/rasterizer/rasterizer.h b/src/cobalt/renderer/rasterizer/rasterizer.h
index c9f2ebb..711e5c7 100644
--- a/src/cobalt/renderer/rasterizer/rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/rasterizer.h
@@ -84,7 +84,7 @@
   // rasterizer's GL context be current when they are executed.  This method
   // is essentially a hack to allow GL-based rasterizers a chance to set their
   // context current before we move to update animations.
-  virtual void MakeCurrent() {}
+  virtual void MakeCurrent() = 0;
 };
 
 }  // namespace rasterizer
diff --git a/src/cobalt/renderer/rasterizer/skia/gl_format_conversions.cc b/src/cobalt/renderer/rasterizer/skia/gl_format_conversions.cc
index 7e710a8..3a6f853 100644
--- a/src/cobalt/renderer/rasterizer/skia/gl_format_conversions.cc
+++ b/src/cobalt/renderer/rasterizer/skia/gl_format_conversions.cc
@@ -24,6 +24,7 @@
 GLenum ConvertRenderTreeFormatToGL(render_tree::PixelFormat pixel_format) {
   switch (pixel_format) {
     case render_tree::kPixelFormatRGBA8:
+    case render_tree::kPixelFormatUYVY:
       return GL_RGBA;
     // Our Skia GL backend has no reason to distinguish between Y/U/V textures,
     // they can all be treated as 8-bit greyscale alpha channels, expressed by
diff --git a/src/cobalt/renderer/rasterizer/skia/hardware_image.cc b/src/cobalt/renderer/rasterizer/skia/hardware_image.cc
index 5eafdd2..4aa00fb 100644
--- a/src/cobalt/renderer/rasterizer/skia/hardware_image.cc
+++ b/src/cobalt/renderer/rasterizer/skia/hardware_image.cc
@@ -17,6 +17,7 @@
 #include <vector>
 
 #include "base/bind.h"
+#include "base/callback_helpers.h"
 #include "base/debug/trace_event.h"
 #include "cobalt/renderer/backend/egl/framebuffer_render_target.h"
 #include "cobalt/renderer/backend/egl/texture.h"
@@ -86,42 +87,15 @@
 // This will store the given pixel data in a GrTexture and the function
 // GetBitmap(), overridden from SkiaImage, will return a reference to a SkBitmap
 // object that refers to the image's GrTexture.  This object should only be
-// constructed, destructed and used from the same rasterizer thread.
+// initialized, destructed and used from the same rasterizer thread; it can be
+// constructed from any thread though.
 class HardwareFrontendImage::HardwareBackendImage {
  public:
-  HardwareBackendImage(scoped_ptr<HardwareImageData> image_data,
-                       backend::GraphicsContextEGL* cobalt_context,
-                       GrContext* gr_context) {
-    TRACE_EVENT0("cobalt::renderer",
-                 "HardwareBackendImage::HardwareBackendImage()");
-    texture_ = cobalt_context->CreateTexture(image_data->PassTextureData());
+  typedef base::Callback<void(HardwareBackendImage*)> InitializeFunction;
 
-    CommonInitialize(gr_context);
-  }
-
-  HardwareBackendImage(const scoped_refptr<backend::ConstRawTextureMemoryEGL>&
-                           raw_texture_memory,
-                       intptr_t offset,
-                       const render_tree::ImageDataDescriptor& descriptor,
-                       backend::GraphicsContextEGL* cobalt_context,
-                       GrContext* gr_context) {
-    TRACE_EVENT0("cobalt::renderer",
-                 "HardwareBackendImage::HardwareBackendImage()");
-    texture_ = cobalt_context->CreateTextureFromRawMemory(
-        raw_texture_memory, offset, descriptor.size,
-        ConvertRenderTreeFormatToGL(descriptor.pixel_format),
-        descriptor.pitch_in_bytes);
-
-    CommonInitialize(gr_context);
-  }
-
-  explicit HardwareBackendImage(scoped_ptr<backend::TextureEGL> texture) {
-    TRACE_EVENT0("cobalt::renderer",
-                 "HardwareBackendImage::HardwareBackendImage()");
-    // This constructor can be called from any thread. However,
-    // CommonInitialize() must then be called manually from the rasterizer
-    // thread.
-    texture_ = texture.Pass();
+  explicit HardwareBackendImage(const InitializeFunction& initialize_function)
+      : initialize_function_(initialize_function),
+        initialized_task_executed_(false) {
     thread_checker_.DetachFromThread();
   }
 
@@ -133,6 +107,91 @@
     DCHECK(thread_checker_.CalledOnValidThread());
   }
 
+  // Return true if the object was initialized due to this call, or false if
+  // the image was already initialized.
+  bool EnsureInitialized() {
+    DCHECK(thread_checker_.CalledOnValidThread());
+    return ResetAndRunIfNotNull(&initialize_function_, this);
+  }
+
+  void InitializeTask() {
+    DCHECK(thread_checker_.CalledOnValidThread());
+    initialized_task_executed_ = true;
+    EnsureInitialized();
+  }
+
+  bool TryDestroy() {
+    DCHECK(thread_checker_.CalledOnValidThread());
+    initialize_function_.Reset();
+    return initialized_task_executed_;
+  }
+
+  // Initialize functions for the various ways to create a backend image.
+  // One of these should be passed to the constructor to tell the object how
+  // to create the image from the rasterizer thread. Ideally, these would be
+  // non-static member functions, however, the problem is binding "this" to
+  // the callback while passing it to the constructor. Options are:
+  //   1. Use static functions which accept "this".
+  //   2. Use a default constructor so that HardwareBackendImage can be
+  //      constructed first, then a separate function to set the callback.
+  //   3. Bind std::placeholders::_1 for "this". base::Callback does not accept
+  //      placeholders, so the callback needs to be changed to std::function.
+  //      However, std::function cannot take ownership of scoped_ptr objects,
+  //      so such parameters would have to be manually deleted.
+
+  static void InitializeFromImageData(
+      scoped_ptr<HardwareImageData> image_data,
+      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
+      HardwareBackendImage* backend) {
+    TRACE_EVENT0("cobalt::renderer",
+                 "HardwareBackendImage::InitializeFromImageData()");
+    backend->texture_ = cobalt_context->CreateTexture(
+        image_data->PassTextureData());
+    backend->CommonInitialize(gr_context);
+  }
+
+  static void InitializeFromRawImageData(
+      const scoped_refptr<backend::ConstRawTextureMemoryEGL>& texture_memory,
+      intptr_t offset, const render_tree::ImageDataDescriptor& descriptor,
+      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
+      HardwareBackendImage* backend) {
+    TRACE_EVENT0("cobalt::renderer",
+                 "HardwareBackendImage::InitializeFromRawImageData()");
+    backend->texture_ = cobalt_context->CreateTextureFromRawMemory(
+        texture_memory, offset, descriptor.size,
+        ConvertRenderTreeFormatToGL(descriptor.pixel_format),
+        descriptor.pitch_in_bytes);
+    backend->CommonInitialize(gr_context);
+  }
+
+  static void InitializeFromTexture(
+      scoped_ptr<backend::TextureEGL> texture, GrContext* gr_context,
+      HardwareBackendImage* backend) {
+    TRACE_EVENT0("cobalt::renderer",
+                 "HardwareBackendImage::InitializeFromTexture()");
+    backend->texture_ = texture.Pass();
+    backend->CommonInitialize(gr_context);
+  }
+
+  static void InitializeFromRenderTree(
+      const scoped_refptr<render_tree::Node>& root, const math::Size& size,
+      const SubmitOffscreenCallback& submit_offscreen_callback,
+      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
+      HardwareBackendImage* backend) {
+    TRACE_EVENT0("cobalt::renderer",
+                 "HardwareBackendImage::InitializeFromRenderTree()");
+
+    scoped_refptr<backend::FramebufferRenderTargetEGL> render_target(
+        new backend::FramebufferRenderTargetEGL(cobalt_context, size));
+
+    submit_offscreen_callback.Run(root, render_target);
+
+    scoped_ptr<backend::TextureEGL> texture(
+        new backend::TextureEGL(cobalt_context, render_target));
+
+    InitializeFromTexture(texture.Pass(), gr_context, backend);
+  }
+
   // Initiate all texture initialization code here, which should be executed
   // on the rasterizer thread.
   void CommonInitialize(GrContext* gr_context) {
@@ -172,23 +231,65 @@
   base::ThreadChecker thread_checker_;
   SkAutoTUnref<GrTexture> gr_texture_;
   SkBitmap bitmap_;
+
+  InitializeFunction initialize_function_;
+  bool initialized_task_executed_;
 };
 
+namespace {
+// Given a ImageDataDescriptor, returns a AlternateRgbaFormat value for it,
+// which for most formats will be base::nullopt, but for those that piggy-back
+// on RGBA but assign different meanings to each of the 4 pixels, this will
+// return a special formatting option.
+base::optional<AlternateRgbaFormat> AlternateRgbaFormatFromImageDataDescriptor(
+    const render_tree::ImageDataDescriptor& descriptor) {
+  if (descriptor.pixel_format == render_tree::kPixelFormatUYVY) {
+    return AlternateRgbaFormat_UYVY;
+  } else {
+    return base::nullopt;
+  }
+}
+
+// Depending on the alternate RGBA format, possibly adjust the content rect
+// size.  For example, UYVY needs the content rect's width to be multiplied
+// by two since each "pixel" actually represents two pixels side-by-side.  This
+// allows render_tree::ImageNode objects that are constructed without an
+// explicit size assigned to them to take on the size of the Y-width for UYVY,
+// which is more natural.
+math::Size AdjustSizeForFormat(
+    const math::Size& size,
+    const base::optional<AlternateRgbaFormat>& alternate_rgba_format) {
+  if (!alternate_rgba_format) {
+    return size;
+  }
+
+  switch (*alternate_rgba_format) {
+    case AlternateRgbaFormat_UYVY: {
+      return math::Size(size.width() * 2, size.height());
+    }
+    default: {
+      NOTREACHED();
+      return size;
+    }
+  }
+}
+}  // namespace
+
 HardwareFrontendImage::HardwareFrontendImage(
     scoped_ptr<HardwareImageData> image_data,
     backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
     MessageLoop* rasterizer_message_loop)
     : is_opaque_(image_data->GetDescriptor().alpha_format ==
                  render_tree::kAlphaFormatOpaque),
-      size_(image_data->GetDescriptor().size),
+      alternate_rgba_format_(AlternateRgbaFormatFromImageDataDescriptor(
+          image_data->GetDescriptor())),
+      size_(AdjustSizeForFormat(image_data->GetDescriptor().size,
+                                alternate_rgba_format_)),
       rasterizer_message_loop_(rasterizer_message_loop) {
-  TRACE_EVENT0("cobalt::renderer",
-               "HardwareFrontendImage::HardwareFrontendImage()");
-
-  initialize_backend_image_ =
-      base::Bind(&HardwareFrontendImage::InitializeBackendImageFromImageData,
-                 base::Unretained(this), base::Passed(&image_data),
-                 cobalt_context, gr_context);
+  backend_image_.reset(new HardwareBackendImage(base::Bind(
+      &HardwareBackendImage::InitializeFromImageData,
+      base::Passed(&image_data), cobalt_context, gr_context)));
+  InitializeBackend();
 }
 
 HardwareFrontendImage::HardwareFrontendImage(
@@ -197,33 +298,39 @@
     backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
     MessageLoop* rasterizer_message_loop)
     : is_opaque_(descriptor.alpha_format == render_tree::kAlphaFormatOpaque),
-      size_(descriptor.size),
+      alternate_rgba_format_(
+          AlternateRgbaFormatFromImageDataDescriptor(descriptor)),
+      size_(AdjustSizeForFormat(descriptor.size, alternate_rgba_format_)),
       rasterizer_message_loop_(rasterizer_message_loop) {
   TRACE_EVENT0("cobalt::renderer",
                "HardwareFrontendImage::HardwareFrontendImage()");
-  initialize_backend_image_ =
-      base::Bind(&HardwareFrontendImage::InitializeBackendImageFromRawImageData,
-                 base::Unretained(this), raw_texture_memory, offset, descriptor,
-                 cobalt_context, gr_context);
+  backend_image_.reset(new HardwareBackendImage(base::Bind(
+      &HardwareBackendImage::InitializeFromRawImageData,
+      raw_texture_memory, offset, descriptor, cobalt_context, gr_context)));
+  InitializeBackend();
 }
 
 HardwareFrontendImage::HardwareFrontendImage(
     scoped_ptr<backend::TextureEGL> texture,
     render_tree::AlphaFormat alpha_format,
     backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
-    scoped_ptr<math::Rect> content_region, MessageLoop* rasterizer_message_loop)
+    scoped_ptr<math::Rect> content_region, MessageLoop* rasterizer_message_loop,
+    base::optional<AlternateRgbaFormat> alternate_rgba_format)
     : is_opaque_(alpha_format == render_tree::kAlphaFormatOpaque),
       content_region_(content_region.Pass()),
-      size_(content_region_ ? math::Size(std::abs(content_region_->width()),
-                                         std::abs(content_region_->height()))
-                            : texture->GetSize()),
+      alternate_rgba_format_(alternate_rgba_format),
+      size_(AdjustSizeForFormat(
+          content_region_ ? math::Size(std::abs(content_region_->width()),
+                                       std::abs(content_region_->height()))
+                          : texture->GetSize(),
+          alternate_rgba_format_)),
       rasterizer_message_loop_(rasterizer_message_loop) {
   TRACE_EVENT0("cobalt::renderer",
                "HardwareFrontendImage::HardwareFrontendImage()");
-  backend_image_.reset(new HardwareBackendImage(texture.Pass()));
-  initialize_backend_image_ =
-      base::Bind(&HardwareFrontendImage::InitializeBackendImageFromTexture,
-                 base::Unretained(this), gr_context);
+  backend_image_.reset(new HardwareBackendImage(base::Bind(
+      &HardwareBackendImage::InitializeFromTexture, base::Passed(&texture),
+      gr_context)));
+  InitializeBackend();
 }
 
 HardwareFrontendImage::HardwareFrontendImage(
@@ -232,29 +339,45 @@
     backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
     MessageLoop* rasterizer_message_loop)
     : is_opaque_(false),
-      size_(static_cast<int>(root->GetBounds().right()),
-            static_cast<int>(root->GetBounds().bottom())),
+      size_(AdjustSizeForFormat(
+          math::Size(static_cast<int>(root->GetBounds().right()),
+                     static_cast<int>(root->GetBounds().bottom())),
+          alternate_rgba_format_)),
       rasterizer_message_loop_(rasterizer_message_loop) {
   TRACE_EVENT0("cobalt::renderer",
                "HardwareFrontendImage::HardwareFrontendImage()");
-  initialize_backend_image_ =
-      base::Bind(&HardwareFrontendImage::InitializeBackendImageFromRenderTree,
-                 base::Unretained(this), root, submit_offscreen_callback,
-                 cobalt_context, gr_context);
+  backend_image_.reset(new HardwareBackendImage(base::Bind(
+      &HardwareBackendImage::InitializeFromRenderTree, root, size_,
+      submit_offscreen_callback, cobalt_context, gr_context)));
+  InitializeBackend();
 }
 
 HardwareFrontendImage::~HardwareFrontendImage() {
   TRACE_EVENT0("cobalt::renderer",
                "HardwareFrontendImage::~HardwareFrontendImage()");
-  // If we are destroying this image from a non-rasterizer thread, we still must
-  // ensure that the |backend_image_| is destroyed from the rasterizer thread,
-  // if |backend_image_| was ever constructed in the first place.
-  if (backend_image_ && rasterizer_message_loop_ &&
-      rasterizer_message_loop_ != MessageLoop::current()) {
-    rasterizer_message_loop_->DeleteSoon(FROM_HERE, backend_image_.release());
+  // InitializeBackend() posted a task to call backend_image_'s
+  // InitializeTask(). Make sure that task has finished before
+  // destroying backend_image_.
+  if (rasterizer_message_loop_) {
+    if (rasterizer_message_loop_ != MessageLoop::current() ||
+        !backend_image_->TryDestroy()) {
+      rasterizer_message_loop_->DeleteSoon(FROM_HERE, backend_image_.release());
+    }
   }  // else let the scoped pointer clean it up immediately.
 }
 
+void HardwareFrontendImage::InitializeBackend() {
+  // Initialize the image as soon as possible, rather than waiting for the
+  // rasterizer to initialize it when needed. The image initialization process
+  // may take some time, so doing a lazy initialize can cause a big spike in
+  // frame time if multiple images are initialized in one frame.
+  if (rasterizer_message_loop_) {
+    rasterizer_message_loop_->PostTask(FROM_HERE, base::Bind(
+        &HardwareBackendImage::InitializeTask,
+        base::Unretained(backend_image_.get())));
+  }
+}
+
 const SkBitmap* HardwareFrontendImage::GetBitmap() const {
   DCHECK_EQ(rasterizer_message_loop_, MessageLoop::current());
   // Forward this call to the backend image.  This method must be called from
@@ -278,58 +401,13 @@
   // We also fallback if a content region is specified on the image, since we
   // don't support handling that in the normal flow.
   return !GetContentRegion() &&
-         (!GetTextureEGL() || GetTextureEGL()->GetTarget() == GL_TEXTURE_2D);
+         (!GetTextureEGL() || GetTextureEGL()->GetTarget() == GL_TEXTURE_2D) &&
+         !alternate_rgba_format_;
 }
 
 bool HardwareFrontendImage::EnsureInitialized() {
   DCHECK_EQ(rasterizer_message_loop_, MessageLoop::current());
-  if (!initialize_backend_image_.is_null()) {
-    initialize_backend_image_.Run();
-    initialize_backend_image_.Reset();
-    return true;
-  }
-  return false;
-}
-
-void HardwareFrontendImage::InitializeBackendImageFromImageData(
-    scoped_ptr<HardwareImageData> image_data,
-    backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context) {
-  DCHECK_EQ(rasterizer_message_loop_, MessageLoop::current());
-  backend_image_.reset(
-      new HardwareBackendImage(image_data.Pass(), cobalt_context, gr_context));
-}
-
-void HardwareFrontendImage::InitializeBackendImageFromRawImageData(
-    const scoped_refptr<backend::ConstRawTextureMemoryEGL>& raw_texture_memory,
-    intptr_t offset, const render_tree::ImageDataDescriptor& descriptor,
-    backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context) {
-  DCHECK_EQ(rasterizer_message_loop_, MessageLoop::current());
-  backend_image_.reset(new HardwareBackendImage(
-      raw_texture_memory, offset, descriptor, cobalt_context, gr_context));
-}
-
-void HardwareFrontendImage::InitializeBackendImageFromTexture(
-    GrContext* gr_context) {
-  DCHECK_EQ(rasterizer_message_loop_, MessageLoop::current());
-  backend_image_->CommonInitialize(gr_context);
-}
-
-void HardwareFrontendImage::InitializeBackendImageFromRenderTree(
-    const scoped_refptr<render_tree::Node>& root,
-    const SubmitOffscreenCallback& submit_offscreen_callback,
-    backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context) {
-  DCHECK_EQ(rasterizer_message_loop_, MessageLoop::current());
-
-  scoped_refptr<backend::FramebufferRenderTargetEGL> render_target(
-      new backend::FramebufferRenderTargetEGL(cobalt_context, size_));
-
-  submit_offscreen_callback.Run(root, render_target);
-
-  scoped_ptr<backend::TextureEGL> texture(
-      new backend::TextureEGL(cobalt_context, render_target));
-
-  backend_image_.reset(new HardwareBackendImage(texture.Pass()));
-  backend_image_->CommonInitialize(gr_context);
+  return backend_image_->EnsureInitialized();
 }
 
 HardwareMultiPlaneImage::HardwareMultiPlaneImage(
diff --git a/src/cobalt/renderer/rasterizer/skia/hardware_image.h b/src/cobalt/renderer/rasterizer/skia/hardware_image.h
index d0bff4f..3afb69b 100644
--- a/src/cobalt/renderer/rasterizer/skia/hardware_image.h
+++ b/src/cobalt/renderer/rasterizer/skia/hardware_image.h
@@ -33,6 +33,14 @@
 namespace rasterizer {
 namespace skia {
 
+// We use GL RGBA formats to indicate that a texture has 4 channels, but those
+// 4 channels may not always strictly mean red, green, blue and alpha.  This
+// enum is used to specify what format they are so that potentially different
+// shaders can be selected.
+enum AlternateRgbaFormat {
+  AlternateRgbaFormat_UYVY,
+};
+
 typedef base::Callback<void(const scoped_refptr<render_tree::Node>& render_tree,
                             const scoped_refptr<backend::RenderTarget>&
                                 render_target)> SubmitOffscreenCallback;
@@ -93,12 +101,13 @@
                         backend::GraphicsContextEGL* cobalt_context,
                         GrContext* gr_context,
                         MessageLoop* rasterizer_message_loop);
-  HardwareFrontendImage(scoped_ptr<backend::TextureEGL> texture,
-                        render_tree::AlphaFormat alpha_format,
-                        backend::GraphicsContextEGL* cobalt_context,
-                        GrContext* gr_context,
-                        scoped_ptr<math::Rect> content_region,
-                        MessageLoop* rasterizer_message_loop);
+  HardwareFrontendImage(
+      scoped_ptr<backend::TextureEGL> texture,
+      render_tree::AlphaFormat alpha_format,
+      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context,
+      scoped_ptr<math::Rect> content_region,
+      MessageLoop* rasterizer_message_loop,
+      base::optional<AlternateRgbaFormat> alternate_rgba_format);
   HardwareFrontendImage(
       const scoped_refptr<render_tree::Node>& root,
       const SubmitOffscreenCallback& submit_offscreen_callback,
@@ -127,24 +136,15 @@
 
   bool IsOpaque() const OVERRIDE { return is_opaque_; }
 
+  base::optional<AlternateRgbaFormat> alternate_rgba_format() {
+    return alternate_rgba_format_;
+  }
+
  private:
   ~HardwareFrontendImage() OVERRIDE;
 
-  // The following Initialize functions will construct |backend_image_|, but
-  // only if |backend_image_| is ever needed by the rasterizer thread.
-  void InitializeBackendImageFromImageData(
-      scoped_ptr<HardwareImageData> image_data,
-      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context);
-  void InitializeBackendImageFromRawImageData(
-      const scoped_refptr<backend::ConstRawTextureMemoryEGL>&
-          raw_texture_memory,
-      intptr_t offset, const render_tree::ImageDataDescriptor& descriptor,
-      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context);
-  void InitializeBackendImageFromTexture(GrContext* gr_context);
-  void InitializeBackendImageFromRenderTree(
-      const scoped_refptr<render_tree::Node>& root,
-      const SubmitOffscreenCallback& submit_offscreen_callback,
-      backend::GraphicsContextEGL* cobalt_context, GrContext* gr_context);
+  // Helper function to be called from the constructor.
+  void InitializeBackend();
 
   // Track if we have any alpha or not, which can enable optimizations in the
   // case that alpha is not present.
@@ -155,6 +155,12 @@
   // Usually this is only set from platform-specific SbDecodeTargets.
   scoped_ptr<math::Rect> content_region_;
 
+  // In some cases where HardwareFrontendImage wraps a RGBA texture, the texture
+  // actually contains pixel data in a non-RGBA format, like UYVY for example.
+  // In this case, we track that in this member.  If this value is null, then
+  // we are dealing with a normal RGBA texture.
+  const base::optional<AlternateRgbaFormat> alternate_rgba_format_;
+
   // We shadow the image dimensions so they can be quickly looked up from just
   // the frontend image object.
   const math::Size size_;
diff --git a/src/cobalt/renderer/rasterizer/skia/hardware_rasterizer.cc b/src/cobalt/renderer/rasterizer/skia/hardware_rasterizer.cc
index 78c8f60..9117c4c 100644
--- a/src/cobalt/renderer/rasterizer/skia/hardware_rasterizer.cc
+++ b/src/cobalt/renderer/rasterizer/skia/hardware_rasterizer.cc
@@ -230,6 +230,29 @@
   return result;
 }
 
+// Accommodate for the fact that for some image formats, like UYVY, our texture
+// pixel width is actually half the size specified because there are two Y
+// values in each pixel.
+math::Rect AdjustContentRegionForImageType(
+    const base::optional<AlternateRgbaFormat>& alternate_rgba_format,
+    const math::Rect& content_region) {
+  if (!alternate_rgba_format) {
+    return content_region;
+  }
+
+  switch (*alternate_rgba_format) {
+    case AlternateRgbaFormat_UYVY: {
+      math::Rect adjusted_content_region = content_region;
+      adjusted_content_region.set_width(content_region.width() / 2);
+      return adjusted_content_region;
+    } break;
+    default: {
+      NOTREACHED();
+      return content_region;
+    }
+  }
+}
+
 // For stereoscopic video, the actual video is split (either horizontally or
 // vertically) in two, one video for the left eye and one for the right eye.
 // This function will adjust the content region rectangle to match only the
@@ -278,8 +301,10 @@
         0, image_size.height(), image_size.width(), -image_size.height());
   }
 
-  result.content_region =
-      AdjustContentRegionForStereoMode(stereo_mode, result.content_region);
+  result.content_region = AdjustContentRegionForStereoMode(
+      stereo_mode, AdjustContentRegionForImageType(
+                       image->alternate_rgba_format(), result.content_region));
+
   result.texture = image->GetTextureEGL();
 
   return result;
@@ -293,7 +318,17 @@
     HardwareFrontendImage* hardware_image =
         base::polymorphic_downcast<HardwareFrontendImage*>(image);
 
-    result.type = egl::TexturedMeshRenderer::Image::RGBA;
+    if (!hardware_image->alternate_rgba_format()) {
+      result.type = egl::TexturedMeshRenderer::Image::RGBA;
+    } else {
+      switch (*hardware_image->alternate_rgba_format()) {
+        case AlternateRgbaFormat_UYVY: {
+          result.type = egl::TexturedMeshRenderer::Image::YUV_UYVY_422_BT709;
+        } break;
+        default: { NOTREACHED(); }
+      }
+    }
+
     result.textures[0] =
         GetTextureFromHardwareFrontendImage(hardware_image, stereo_mode);
   } else if (image->GetTypeId() == base::GetTypeId<MultiPlaneImage>()) {
@@ -352,6 +387,23 @@
   }
 }
 
+void SetupGLTextureParameters(const egl::TexturedMeshRenderer::Image& image,
+                              uint32 texture_wrap_s, uint32 texture_wrap_t) {
+  for (int i = 0; i < image.num_textures(); ++i) {
+    const backend::TextureEGL* texture = image.textures[i].texture;
+    GL_CALL(glBindTexture(texture->GetTarget(), texture->gl_handle()));
+    GL_CALL(glTexParameteri(texture->GetTarget(), GL_TEXTURE_MAG_FILTER,
+                            GL_LINEAR));
+    GL_CALL(glTexParameteri(texture->GetTarget(), GL_TEXTURE_MIN_FILTER,
+                            GL_LINEAR));
+    GL_CALL(glTexParameteri(texture->GetTarget(), GL_TEXTURE_WRAP_S,
+                            texture_wrap_s));
+    GL_CALL(glTexParameteri(texture->GetTarget(), GL_TEXTURE_WRAP_T,
+                            texture_wrap_t));
+    GL_CALL(glBindTexture(texture->GetTarget(), 0));
+  }
+}
+
 FaceOrientation GetFaceOrientationFromModelViewProjectionMatrix(
     const glm::mat4& model_view_projection_matrix) {
   return glm::determinant(model_view_projection_matrix) >= 0 ?
@@ -405,10 +457,16 @@
     textured_mesh_renderer_.emplace(graphics_context_);
   }
 
+  // Convert our image into a format digestable by TexturedMeshRenderer.
+  egl::TexturedMeshRenderer::Image textured_mesh_renderer_image =
+      SkiaImageToTexturedMeshRendererImage(image, render_tree::kMono);
+
+  SetupGLTextureParameters(textured_mesh_renderer_image,
+                           GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
+
   // Invoke our TexturedMeshRenderer to actually perform the draw call.
   textured_mesh_renderer_->RenderQuad(
-      SkiaImageToTexturedMeshRendererImage(image, render_tree::kMono),
-      model_view_projection_matrix);
+      textured_mesh_renderer_image, model_view_projection_matrix);
 
   // Let Skia know that we've modified GL state.
   uint32_t untouched_states =
@@ -458,11 +516,18 @@
           mesh_filter.mono_mesh(image->GetSize()).get())
           ->GetVBO();
 
+  // Convert our image into a format digestable by TexturedMeshRenderer.
+  egl::TexturedMeshRenderer::Image textured_mesh_renderer_image =
+      SkiaImageToTexturedMeshRendererImage(image, mesh_filter.stereo_mode());
+
+  SetupGLTextureParameters(textured_mesh_renderer_image,
+                           GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
+
   // Invoke out TexturedMeshRenderer to actually perform the draw call.
   textured_mesh_renderer_->RenderVBO(
       mono_vbo->GetHandle(), mono_vbo->GetVertexCount(),
       mono_vbo->GetDrawMode(),
-      SkiaImageToTexturedMeshRendererImage(image, mesh_filter.stereo_mode()),
+      textured_mesh_renderer_image,
       model_view_projection_matrix);
 
   // Let Skia know that we've modified GL state.
@@ -620,6 +685,19 @@
     const scoped_refptr<backend::RenderTarget>& render_target) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
+  scoped_refptr<backend::RenderTargetEGL> render_target_egl(
+      base::polymorphic_downcast<backend::RenderTargetEGL*>(
+          render_target.get()));
+
+  if (render_target_egl->is_surface_bad()) {
+    return;
+  }
+
+  backend::GraphicsContextEGL::ScopedMakeCurrent scoped_make_current(
+      graphics_context_, render_target_egl);
+
+  gr_context_->resetContext();
+
   // Create a canvas from the render target.
   GrBackendRenderTargetDesc skia_desc =
       CobaltRenderTargetToSkiaBackendRenderTargetDesc(render_target.get());
@@ -746,6 +824,7 @@
   // expected. Remove after switching to webdriver benchmark.
   TRACE_EVENT0("cobalt::renderer", "VisitRenderTree");
 
+  base::optional<GrSurfaceOrigin> old_origin = current_surface_origin_;
   current_surface_origin_.emplace(origin);
 
   RenderTreeNodeVisitor::CreateScratchSurfaceFunction
@@ -765,7 +844,7 @@
   DCHECK(render_tree);
   render_tree->Accept(&visitor);
 
-  current_surface_origin_ = base::nullopt;
+  current_surface_origin_ = old_origin;
 }
 
 void HardwareRasterizer::Impl::ResetSkiaState() { gr_context_->resetContext(); }
diff --git a/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc b/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
index 77e0de7..6ff0f21 100644
--- a/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
+++ b/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
@@ -92,7 +92,8 @@
 
 bool HardwareResourceProvider::PixelFormatSupported(
     render_tree::PixelFormat pixel_format) {
-  return pixel_format == render_tree::kPixelFormatRGBA8;
+  return pixel_format == render_tree::kPixelFormatRGBA8 ||
+         pixel_format == render_tree::kPixelFormatUYVY;
 }
 
 bool HardwareResourceProvider::AlphaFormatSupported(
@@ -106,9 +107,6 @@
     render_tree::AlphaFormat alpha_format) {
   TRACE_EVENT0("cobalt::renderer",
                "HardwareResourceProvider::AllocateImageData()");
-  DCHECK_EQ(render_tree::kPixelFormatRGBA8, pixel_format)
-      << "Currently, only RGBA8 is supported.";
-
   DCHECK(PixelFormatSupported(pixel_format));
   DCHECK(AlphaFormatSupported(alpha_format));
 
@@ -151,6 +149,9 @@
 int PlanesPerFormat(SbDecodeTargetFormat format) {
   switch (format) {
     case kSbDecodeTargetFormat1PlaneRGBA:
+#if SB_API_VERSION >= SB_DECODE_TARGET_UYVY_SUPPORT_API_VERSION
+    case kSbDecodeTargetFormat1PlaneUYVY:
+#endif  // SB_API_VERSION >= SB_DECODE_TARGET_UYVY_SUPPORT_API_VERSION
       return 1;
     case kSbDecodeTargetFormat1PlaneBGRA:
       return 1;
@@ -167,7 +168,13 @@
 
 uint32_t DecodeTargetFormatToGLFormat(SbDecodeTargetFormat format, int plane) {
   switch (format) {
-    case kSbDecodeTargetFormat1PlaneRGBA: {
+    case kSbDecodeTargetFormat1PlaneRGBA:
+#if SB_API_VERSION >= SB_DECODE_TARGET_UYVY_SUPPORT_API_VERSION
+    // For UYVY, we will use a fragment shader where R = the first U, G = Y,
+    // B = the second U, and A = V.
+    case kSbDecodeTargetFormat1PlaneUYVY:
+#endif  // SB_API_VERSION >= SB_DECODE_TARGET_UYVY_SUPPORT_API_VERSION
+    {
       DCHECK_EQ(0, plane);
       return GL_RGBA;
     } break;
@@ -276,12 +283,22 @@
         gl_format, plane.gl_texture_target,
         base::Bind(&DoNothing, decode_target_ref)));
 
+    // If the decode target is specified as UYVY format, then we need to pass
+    // this in as supplementary data, as the |texture| object only knows that
+    // it is RGBA.
+    base::optional<AlternateRgbaFormat> alternate_rgba_format;
+#if SB_API_VERSION >= SB_DECODE_TARGET_UYVY_SUPPORT_API_VERSION
+    if (info.format == kSbDecodeTargetFormat1PlaneUYVY) {
+      alternate_rgba_format = AlternateRgbaFormat_UYVY;
+    }
+#endif  // SB_API_VERSION >= SB_DECODE_TARGET_UYVY_SUPPORT_API_VERSION
+
     planes.push_back(make_scoped_refptr(new HardwareFrontendImage(
         texture.Pass(), alpha_format, cobalt_context_, gr_context_,
-        content_region.Pass(), self_message_loop_)));
+        content_region.Pass(), self_message_loop_, alternate_rgba_format)));
   }
 
-  if (info.format == kSbDecodeTargetFormat1PlaneRGBA) {
+  if (planes_per_format == 1) {
     return planes[0];
   } else {
     return new HardwareMultiPlaneImage(
diff --git a/src/cobalt/renderer/rasterizer/skia/image.cc b/src/cobalt/renderer/rasterizer/skia/image.cc
index 013dcf7..c92c8d7 100644
--- a/src/cobalt/renderer/rasterizer/skia/image.cc
+++ b/src/cobalt/renderer/rasterizer/skia/image.cc
@@ -27,7 +27,8 @@
                                         render_tree::PixelFormat pixel_format,
                                         const uint8_t* source_pixels) {
   TRACE_EVENT0("cobalt::renderer", "Image::DCheckForPremultipliedAlpha()");
-  if (pixel_format == render_tree::kPixelFormatY8 ||
+  if (pixel_format == render_tree::kPixelFormatUYVY ||
+      pixel_format == render_tree::kPixelFormatY8 ||
       pixel_format == render_tree::kPixelFormatU8 ||
       pixel_format == render_tree::kPixelFormatV8 ||
       pixel_format == render_tree::kPixelFormatUV8) {
diff --git a/src/cobalt/renderer/rasterizer/stub/rasterizer.h b/src/cobalt/renderer/rasterizer/stub/rasterizer.h
index 74338fd..19c2364 100644
--- a/src/cobalt/renderer/rasterizer/stub/rasterizer.h
+++ b/src/cobalt/renderer/rasterizer/stub/rasterizer.h
@@ -33,6 +33,8 @@
 
   render_tree::ResourceProvider* GetResourceProvider() OVERRIDE;
 
+  void MakeCurrent() OVERRIDE {}
+
  private:
   render_tree::ResourceProviderStub resource_provider_stub_;
 };
diff --git a/src/cobalt/renderer/rasterizer/testdata/MapToMeshUYVYTest-expected.png b/src/cobalt/renderer/rasterizer/testdata/MapToMeshUYVYTest-expected.png
new file mode 100644
index 0000000..d567d13
--- /dev/null
+++ b/src/cobalt/renderer/rasterizer/testdata/MapToMeshUYVYTest-expected.png
Binary files differ
diff --git a/src/cobalt/renderer/rasterizer/testdata/YUV422UYVYImageScaledUpSupport-expected.png b/src/cobalt/renderer/rasterizer/testdata/YUV422UYVYImageScaledUpSupport-expected.png
new file mode 100644
index 0000000..c7bc992
--- /dev/null
+++ b/src/cobalt/renderer/rasterizer/testdata/YUV422UYVYImageScaledUpSupport-expected.png
Binary files differ
diff --git a/src/cobalt/renderer/rasterizer/testdata/YUV422UYVYImageSupport-expected.png b/src/cobalt/renderer/rasterizer/testdata/YUV422UYVYImageSupport-expected.png
new file mode 100644
index 0000000..6554192
--- /dev/null
+++ b/src/cobalt/renderer/rasterizer/testdata/YUV422UYVYImageSupport-expected.png
Binary files differ
diff --git a/src/cobalt/renderer/renderer.gyp b/src/cobalt/renderer/renderer.gyp
index c57e6f7..2b27c3e 100644
--- a/src/cobalt/renderer/renderer.gyp
+++ b/src/cobalt/renderer/renderer.gyp
@@ -34,12 +34,12 @@
         'submission_queue.cc',
         'submission_queue.h',
       ],
-
       'defines': [
         'COBALT_MINIMUM_FRAME_TIME_IN_MILLISECONDS=<(cobalt_minimum_frame_time_in_milliseconds)',
       ],
       'includes': [
         'copy_font_data.gypi',
+        'renderer_parameters_setup.gypi',
       ],
       'dependencies': [
         '<(DEPTH)/cobalt/base/base.gyp:base',
@@ -56,13 +56,6 @@
           'dependencies': [
             '<(default_renderer_options_dependency)',
           ],
-        }, {
-          'includes': [
-            'renderer_parameters_setup.gypi',
-          ],
-          'sources': [
-            'renderer_module_default_options_<(actual_target_arch).cc',
-          ],
         }],
       ],
     },
diff --git a/src/cobalt/renderer/renderer_module.cc b/src/cobalt/renderer/renderer_module.cc
index a983e1b..fcbe6ae 100644
--- a/src/cobalt/renderer/renderer_module.cc
+++ b/src/cobalt/renderer/renderer_module.cc
@@ -24,10 +24,31 @@
 namespace renderer {
 
 RendererModule::Options::Options()
-    : skia_glyph_texture_atlas_dimensions(2048, 2048),
-      purge_skia_font_caches_on_destruction(true),
+    : purge_skia_font_caches_on_destruction(true),
       enable_fps_stdout(false),
       enable_fps_overlay(false) {
+  // These default values may ultimately be overridden by AutoMem.
+  // These settings are suited for a 1080p frame.
+  scratch_surface_cache_size_in_bytes = 0;
+  skia_glyph_texture_atlas_dimensions.SetSize(2048, 2048);
+  skia_cache_size_in_bytes = 4 * 1024 * 1024;
+
+#if SB_HAS(GLES2)
+#if defined(COBALT_FORCE_DIRECT_GLES_RASTERIZER)
+  software_surface_cache_size_in_bytes = 0;
+  surface_cache_size_in_bytes = 0;
+  offscreen_target_cache_size_in_bytes = 4 * 1024 * 1024;
+#else
+  software_surface_cache_size_in_bytes = 0;
+  surface_cache_size_in_bytes = 0;
+  offscreen_target_cache_size_in_bytes = 0;
+#endif
+#else
+  software_surface_cache_size_in_bytes = 8 * 1024 * 1024;
+  surface_cache_size_in_bytes = 0;
+  offscreen_target_cache_size_in_bytes = 0;
+#endif
+
   // Call into platform-specific code for setting up render module options.
   SetPerPlatformDefaultOptions();
 }
diff --git a/src/cobalt/renderer/renderer_module.h b/src/cobalt/renderer/renderer_module.h
index 49a3187..39b8406 100644
--- a/src/cobalt/renderer/renderer_module.h
+++ b/src/cobalt/renderer/renderer_module.h
@@ -71,6 +71,15 @@
     // nodes that are most CPU-expensive to render into surfaces.
     int surface_cache_size_in_bytes;
 
+    // Determines the amount of GPU memory the offscreen target atlases will
+    // use. This is specific to the direct-GLES rasterizer and serves a similar
+    // purpose as the surface_cache_size_in_bytes, but caches any render tree
+    // nodes which require skia for rendering. Two atlases will be allocated
+    // from this memory or multiple atlases of the frame size if the limit
+    // allows. It is recommended that enough memory be reserved for two RGBA
+    // atlases about a quarter of the frame size.
+    int offscreen_target_cache_size_in_bytes;
+
     // If this flag is set to true, the pipeline will not re-submit a render
     // tree if it has not changed from the previous submission.  This can save
     // CPU time so long as there's no problem with the fact that the display
@@ -116,6 +125,8 @@
     return pipeline_->GetResourceProvider();
   }
 
+  math::Size render_target_size() { return render_target()->GetSize(); }
+
  private:
   system_window::SystemWindow* system_window_;
   Options options_;
diff --git a/src/cobalt/renderer/renderer_module_default_options_starboard.cc b/src/cobalt/renderer/renderer_module_default_options_starboard.cc
index 0251fee..2afa9b5 100644
--- a/src/cobalt/renderer/renderer_module_default_options_starboard.cc
+++ b/src/cobalt/renderer/renderer_module_default_options_starboard.cc
@@ -15,6 +15,7 @@
 #include "cobalt/renderer/renderer_module.h"
 
 #include "base/debug/trace_event.h"
+#include "base/logging.h"
 #include "cobalt/renderer/rasterizer/blitter/hardware_rasterizer.h"
 #include "cobalt/renderer/rasterizer/blitter/software_rasterizer.h"
 #include "cobalt/renderer/rasterizer/egl/hardware_rasterizer.h"
@@ -41,15 +42,21 @@
           graphics_context, options.surface_cache_size_in_bytes,
           options.purge_skia_font_caches_on_destruction));
 #elif defined(COBALT_FORCE_DIRECT_GLES_RASTERIZER)
+  // This rasterizer uses offscreen_target_cache_size_in_bytes instead of
+  // surface_cache_size_in_bytes.
+  DCHECK_EQ(0, options.surface_cache_size_in_bytes);
   return scoped_ptr<rasterizer::Rasterizer>(
       new rasterizer::egl::HardwareRasterizer(
           graphics_context, options.skia_glyph_texture_atlas_dimensions.width(),
           options.skia_glyph_texture_atlas_dimensions.height(),
           options.skia_cache_size_in_bytes,
           options.scratch_surface_cache_size_in_bytes,
-          options.surface_cache_size_in_bytes,
+          options.offscreen_target_cache_size_in_bytes,
           options.purge_skia_font_caches_on_destruction));
 #else
+  // This rasterizer uses surface_cache_size_in_bytes instead of
+  // offscreen_target_cache_size_in_bytes.
+  DCHECK_EQ(0, options.offscreen_target_cache_size_in_bytes);
   return scoped_ptr<rasterizer::Rasterizer>(
       new rasterizer::skia::HardwareRasterizer(
           graphics_context, options.skia_glyph_texture_atlas_dimensions.width(),
@@ -84,15 +91,6 @@
 }  // namespace
 
 void RendererModule::Options::SetPerPlatformDefaultOptions() {
-  // Set default options from the current build's Starboard configuration.
-  surface_cache_size_in_bytes = COBALT_SURFACE_CACHE_SIZE_IN_BYTES;
-  // Default to 4MB, but this may be modified externally.
-  skia_cache_size_in_bytes = 4 * 1024 * 1024;
-  scratch_surface_cache_size_in_bytes =
-      COBALT_SCRATCH_SURFACE_CACHE_SIZE_IN_BYTES;
-  // 8MB default for software_surface_cache.
-  software_surface_cache_size_in_bytes = 8 * 1024 * 1024;
-
   // If there is no need to frequently flip the display buffer, then enable
   // support for an optimization where the scene is not re-rasterized each frame
   // if it has not changed from the last frame.
diff --git a/src/cobalt/renderer/renderer_module_default_options_win.cc b/src/cobalt/renderer/renderer_module_default_options_win.cc
deleted file mode 100644
index 163fe2b..0000000
--- a/src/cobalt/renderer/renderer_module_default_options_win.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "cobalt/renderer/renderer_module.h"
-
-#include "cobalt/renderer/rasterizer/egl/software_rasterizer.h"
-#include "cobalt/renderer/rasterizer/skia/hardware_rasterizer.h"
-
-namespace cobalt {
-namespace renderer {
-
-namespace {
-scoped_ptr<rasterizer::Rasterizer> CreateRasterizer(
-    backend::GraphicsContext* graphics_context,
-    const RendererModule::Options& options) {
-#if COBALT_FORCE_SOFTWARE_RASTERIZER
-  return scoped_ptr<rasterizer::Rasterizer>(
-      new rasterizer::egl::SoftwareRasterizer(
-          graphics_context, options.surface_cache_size_in_bytes,
-          options.purge_skia_font_caches_on_destruction));
-#else
-  return scoped_ptr<rasterizer::Rasterizer>(
-      new rasterizer::skia::HardwareRasterizer(
-          graphics_context, options.skia_cache_size_in_bytes,
-          options.scratch_surface_cache_size_in_bytes,
-          options.surface_cache_size_in_bytes,
-          options.purge_skia_font_caches_on_destruction));
-#endif  // #if COBALT_FORCE_SOFTWARE_RASTERIZER
-}
-}  // namespace
-
-void RendererModule::Options::SetPerPlatformDefaultOptions() {
-  // Set default options from the current build's configuration.
-  surface_cache_size_in_bytes = COBALT_SURFACE_CACHE_SIZE_IN_BYTES;
-  skia_cache_size_in_bytes = COBALT_SKIA_CACHE_SIZE_IN_BYTES;
-  scratch_surface_cache_size_in_bytes =
-      COBALT_SCRATCH_SURFACE_CACHE_SIZE_IN_BYTES;
-
-  submit_even_if_render_tree_is_unchanged = true;
-
-  create_rasterizer_function = base::Bind(&CreateRasterizer);
-}
-
-}  // namespace renderer
-}  // namespace cobalt
diff --git a/src/cobalt/renderer/test/png_utils/png_decode.cc b/src/cobalt/renderer/test/png_utils/png_decode.cc
index ab68d2e..61924f3 100644
--- a/src/cobalt/renderer/test/png_utils/png_decode.cc
+++ b/src/cobalt/renderer/test/png_utils/png_decode.cc
@@ -179,6 +179,7 @@
           png_set_read_user_transform_fn(png_,
                                          &TransformPixelRow<true, 2, 1, 0, 3>);
         } break;
+        case render_tree::kPixelFormatUYVY:
         case render_tree::kPixelFormatY8:
         case render_tree::kPixelFormatU8:
         case render_tree::kPixelFormatV8:
@@ -198,6 +199,7 @@
           png_set_read_user_transform_fn(png_,
                                          &TransformPixelRow<true, 2, 1, 0, 3>);
         } break;
+        case render_tree::kPixelFormatUYVY:
         case render_tree::kPixelFormatY8:
         case render_tree::kPixelFormatU8:
         case render_tree::kPixelFormatV8:
diff --git a/src/cobalt/script/mozjs-45/mozjs_callback_function.h b/src/cobalt/script/mozjs-45/mozjs_callback_function.h
index b5081b2..9b9972f 100644
--- a/src/cobalt/script/mozjs-45/mozjs_callback_function.h
+++ b/src/cobalt/script/mozjs-45/mozjs_callback_function.h
@@ -72,28 +72,26 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
+      return callback_result;
+    }
 
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 0;
-      JS::AutoValueVector args(context_);
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 0;
+    JS::AutoValueVector args(context_);
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -137,30 +135,28 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 1;
+    JS::AutoValueArray<1> args(context_);
+    ToJSValue(context_, a1, args[0]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 1;
-      JS::AutoValueArray<1> args(context_);
-      ToJSValue(context_, a1, args[0]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -205,31 +201,29 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 2;
+    JS::AutoValueArray<2> args(context_);
+    ToJSValue(context_, a1, args[0]);
+    ToJSValue(context_, a2, args[1]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 2;
-      JS::AutoValueArray<2> args(context_);
-      ToJSValue(context_, a1, args[0]);
-      ToJSValue(context_, a2, args[1]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -275,32 +269,30 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 3;
+    JS::AutoValueArray<3> args(context_);
+    ToJSValue(context_, a1, args[0]);
+    ToJSValue(context_, a2, args[1]);
+    ToJSValue(context_, a3, args[2]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 3;
-      JS::AutoValueArray<3> args(context_);
-      ToJSValue(context_, a1, args[0]);
-      ToJSValue(context_, a2, args[1]);
-      ToJSValue(context_, a3, args[2]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -347,33 +339,31 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 4;
+    JS::AutoValueArray<4> args(context_);
+    ToJSValue(context_, a1, args[0]);
+    ToJSValue(context_, a2, args[1]);
+    ToJSValue(context_, a3, args[2]);
+    ToJSValue(context_, a4, args[3]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 4;
-      JS::AutoValueArray<4> args(context_);
-      ToJSValue(context_, a1, args[0]);
-      ToJSValue(context_, a2, args[1]);
-      ToJSValue(context_, a3, args[2]);
-      ToJSValue(context_, a4, args[3]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -422,34 +412,32 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 5;
+    JS::AutoValueArray<5> args(context_);
+    ToJSValue(context_, a1, args[0]);
+    ToJSValue(context_, a2, args[1]);
+    ToJSValue(context_, a3, args[2]);
+    ToJSValue(context_, a4, args[3]);
+    ToJSValue(context_, a5, args[4]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 5;
-      JS::AutoValueArray<5> args(context_);
-      ToJSValue(context_, a1, args[0]);
-      ToJSValue(context_, a2, args[1]);
-      ToJSValue(context_, a3, args[2]);
-      ToJSValue(context_, a4, args[3]);
-      ToJSValue(context_, a5, args[4]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -499,35 +487,33 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 6;
+    JS::AutoValueArray<6> args(context_);
+    ToJSValue(context_, a1, args[0]);
+    ToJSValue(context_, a2, args[1]);
+    ToJSValue(context_, a3, args[2]);
+    ToJSValue(context_, a4, args[3]);
+    ToJSValue(context_, a5, args[4]);
+    ToJSValue(context_, a6, args[5]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 6;
-      JS::AutoValueArray<6> args(context_);
-      ToJSValue(context_, a1, args[0]);
-      ToJSValue(context_, a2, args[1]);
-      ToJSValue(context_, a3, args[2]);
-      ToJSValue(context_, a4, args[3]);
-      ToJSValue(context_, a5, args[4]);
-      ToJSValue(context_, a6, args[5]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
@@ -578,36 +564,34 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
+      return callback_result;
+    }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 7;
+    JS::AutoValueArray<7> args(context_);
+    ToJSValue(context_, a1, args[0]);
+    ToJSValue(context_, a2, args[1]);
+    ToJSValue(context_, a3, args[2]);
+    ToJSValue(context_, a4, args[3]);
+    ToJSValue(context_, a5, args[4]);
+    ToJSValue(context_, a6, args[5]);
+    ToJSValue(context_, a7, args[6]);
+
+    bool call_result = JS::Call(context_, this_value, function, args,
+        &return_value);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
     } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 7;
-      JS::AutoValueArray<7> args(context_);
-      ToJSValue(context_, a1, args[0]);
-      ToJSValue(context_, a2, args[1]);
-      ToJSValue(context_, a3, args[2]);
-      ToJSValue(context_, a4, args[3]);
-      ToJSValue(context_, a5, args[4]);
-      ToJSValue(context_, a6, args[5]);
-      ToJSValue(context_, a7, args[6]);
-
-      bool call_result = JS::Call(context_, this_value, function, args,
-          &return_value);
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
diff --git a/src/cobalt/script/mozjs-45/mozjs_callback_function.h.pump b/src/cobalt/script/mozjs-45/mozjs_callback_function.h.pump
index c91b1a1..826d064 100644
--- a/src/cobalt/script/mozjs-45/mozjs_callback_function.h.pump
+++ b/src/cobalt/script/mozjs-45/mozjs_callback_function.h.pump
@@ -91,36 +91,35 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
+      return callback_result;
+    }
 
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other specifications
-      JS::RootedValue this_value(context_, JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = $(ARITY);
+    JSAutoCompartment auto_compartment(context_, function);
+    JS::AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::RootedValue this_value(context_, JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = $(ARITY);
 
 $if ARITY > 0 [[
-      JS::AutoValueArray<$(ARITY)> args(context_);
-      $for ARG [[ToJSValue(context_, a$(ARG), args[$(ARG - 1)]);
-      ]]
+    JS::AutoValueArray<$(ARITY)> args(context_);
+    $for ARG [[ToJSValue(context_, a$(ARG), args[$(ARG - 1)]);
+    ]]
 
-      bool call_result = JS::Call(context_, this_value, function, args, &return_value);
+    bool call_result = JS::Call(context_, this_value, function, args, &return_value);
 ]] $else [[
-      JS::AutoValueVector args(context_);
-      bool call_result = JS::Call(context_, this_value, function, args, &return_value);
+    JS::AutoValueVector args(context_);
+    bool call_result = JS::Call(context_, this_value, function, args, &return_value);
 ]]
 
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
     return callback_result;
   }
diff --git a/src/cobalt/script/mozjs-45/mozjs_engine.cc b/src/cobalt/script/mozjs-45/mozjs_engine.cc
index 6882f71..720e71f 100644
--- a/src/cobalt/script/mozjs-45/mozjs_engine.cc
+++ b/src/cobalt/script/mozjs-45/mozjs_engine.cc
@@ -262,6 +262,10 @@
   MozjsEngine* engine = reinterpret_cast<MozjsEngine*>(data);
   if (status == JSGC_END) {
     engine->accumulated_extra_memory_cost_ = 0;
+    // Reset the GC timer to avoid having the timed GC come soon after this one.
+    if (engine->gc_timer_.IsRunning()) {
+      engine->gc_timer_.Reset();
+    }
   }
   for (int i = 0; i < engine->contexts_.size(); ++i) {
     MozjsGlobalEnvironment* global_environment =
diff --git a/src/cobalt/script/mozjs-45/mozjs_global_environment.cc b/src/cobalt/script/mozjs-45/mozjs_global_environment.cc
index ba7b7eb..7f100d0 100644
--- a/src/cobalt/script/mozjs-45/mozjs_global_environment.cc
+++ b/src/cobalt/script/mozjs-45/mozjs_global_environment.cc
@@ -123,7 +123,6 @@
     JSRuntime* runtime, const JavaScriptEngine::Options& options)
     : context_(NULL),
       garbage_collection_count_(0),
-      cached_interface_data_deleter_(&cached_interface_data_),
       context_destructor_(&context_),
       environment_settings_(NULL),
       last_error_message_(NULL),
@@ -187,7 +186,7 @@
 
   JSAutoRequest auto_request(context_);
   JSAutoCompartment auto_compartment(context_, global_object_proxy_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  JS::AutoSaveExceptionState auto_save_exception_state(context_);
   JS::RootedValue result_value(context_);
 
   std::string error_message;
@@ -206,7 +205,6 @@
     }
   }
   last_error_message_ = NULL;
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return success;
 }
 
@@ -218,7 +216,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   JSAutoRequest auto_request(context_);
   JSAutoCompartment auto_compartment(context_, global_object_proxy_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  JS::AutoSaveExceptionState auto_save_exception_state(context_);
   JS::RootedValue result_value(context_);
   bool success = EvaluateScriptInternal(source_code, &result_value);
   if (success && out_opaque_handle) {
@@ -228,7 +226,6 @@
                                                 wrapper_factory());
     out_opaque_handle->emplace(owning_object.get(), mozjs_object_holder);
   }
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return success;
 }
 
@@ -384,12 +381,12 @@
       "fetch.js");
 }
 
-InterfaceData* MozjsGlobalEnvironment::GetInterfaceData(intptr_t key) {
-  CachedInterfaceData::iterator it = cached_interface_data_.find(key);
-  if (it != cached_interface_data_.end()) {
-    return it->second;
+InterfaceData* MozjsGlobalEnvironment::GetInterfaceData(int key) {
+  DCHECK_GE(key, 0);
+  if (key >= cached_interface_data_.size()) {
+    cached_interface_data_.resize(key + 1);
   }
-  return NULL;
+  return &cached_interface_data_[key];
 }
 
 void MozjsGlobalEnvironment::DoSweep() {
@@ -451,13 +448,6 @@
   SetCachedWrapper(wrappable.get(), object_handle.Pass());
 }
 
-void MozjsGlobalEnvironment::CacheInterfaceData(intptr_t key,
-                                                InterfaceData* interface_data) {
-  std::pair<CachedInterfaceData::iterator, bool> pib =
-      cached_interface_data_.insert(std::make_pair(key, interface_data));
-  DCHECK(pib.second);
-}
-
 void MozjsGlobalEnvironment::ReportError(const char* message,
                                          JSErrorReport* report) {
   std::string error_message;
@@ -483,20 +473,19 @@
     JS_CallObjectTracer(trace, &global_object_environment->global_object_proxy_,
                         "MozjsGlobalEnvironment");
   }
-  for (CachedInterfaceData::iterator it =
-           global_object_environment->cached_interface_data_.begin();
-       it != global_object_environment->cached_interface_data_.end(); ++it) {
-    InterfaceData* data = it->second;
-    // Check whether prototype and interface object for this interface have been
-    // created yet or not before attempting to trace them.
-    if (data->prototype) {
-      JS_CallObjectTracer(trace, &data->prototype, "MozjsGlobalEnvironment");
+
+  for (int i = 0; i < global_object_environment->cached_interface_data_.size();
+       i++) {
+    InterfaceData& data = global_object_environment->cached_interface_data_[i];
+    if (data.prototype) {
+      JS_CallObjectTracer(trace, &data.prototype, "MozjsGlobalEnvironment");
     }
-    if (data->interface_object) {
-      JS_CallObjectTracer(trace, &data->interface_object,
+    if (data.interface_object) {
+      JS_CallObjectTracer(trace, &data.interface_object,
                           "MozjsGlobalEnvironment");
     }
   }
+
   for (CachedWrapperMultiMap::iterator it =
            global_object_environment->kept_alive_objects_.begin();
        it != global_object_environment->kept_alive_objects_.end(); ++it) {
diff --git a/src/cobalt/script/mozjs-45/mozjs_global_environment.h b/src/cobalt/script/mozjs-45/mozjs_global_environment.h
index bcb0a54..e34eabe 100644
--- a/src/cobalt/script/mozjs-45/mozjs_global_environment.h
+++ b/src/cobalt/script/mozjs-45/mozjs_global_environment.h
@@ -118,10 +118,9 @@
       const scoped_refptr<Wrappable>& wrappable);
 
   // Any tracked InterfaceData will have it's GC handles visited and marked as
-  // roots. The MozjsGlobalEnvironment takes ownership of the InterfaceData
-  // instances and will destroy them.
-  void CacheInterfaceData(intptr_t key, InterfaceData* interface_data);
-  InterfaceData* GetInterfaceData(intptr_t key);
+  // roots.  |key| is the interface's unique id, which is generated during
+  // bindings idl compilation.
+  InterfaceData* GetInterfaceData(int key);
 
   // This will be called during garbage collection after GC objects have been
   // marked, but before they have been finalized. This allows an opportunity to
@@ -157,7 +156,6 @@
     JSContext** const context;
   };
 
-  typedef base::hash_map<intptr_t, InterfaceData*> CachedInterfaceData;
   typedef base::hash_multimap<Wrappable*, JS::Heap<JSObject*> >
       CachedWrapperMultiMap;
 
@@ -167,8 +165,8 @@
   WeakHeapObjectManager weak_object_manager_;
   CachedWrapperMultiMap kept_alive_objects_;
   scoped_ptr<ReferencedObjectMap> referenced_objects_;
-  CachedInterfaceData cached_interface_data_;
-  STLValueDeleter<CachedInterfaceData> cached_interface_data_deleter_;
+  std::vector<InterfaceData> cached_interface_data_;
+
   ContextDestructor context_destructor_;
   scoped_ptr<WrapperFactory> wrapper_factory_;
   scoped_ptr<MozjsScriptValueFactory> script_value_factory_;
diff --git a/src/cobalt/script/mozjs-45/wrapper_private.cc b/src/cobalt/script/mozjs-45/wrapper_private.cc
index e344ef3..4dff206 100644
--- a/src/cobalt/script/mozjs-45/wrapper_private.cc
+++ b/src/cobalt/script/mozjs-45/wrapper_private.cc
@@ -129,6 +129,9 @@
 // static
 WrapperPrivate* WrapperPrivate::GetFromWrapperObject(JS::HandleObject wrapper) {
   DCHECK(!js::IsProxy(wrapper));
+  if (!(JS_GetClass(wrapper)->flags & JSCLASS_HAS_PRIVATE)) {
+    return NULL;
+  }
   WrapperPrivate* private_data =
       static_cast<WrapperPrivate*>(JS_GetPrivate(wrapper));
   DCHECK(private_data);
diff --git a/src/cobalt/script/mozjs-45/wrapper_private.h b/src/cobalt/script/mozjs-45/wrapper_private.h
index 0483cea..642395a 100644
--- a/src/cobalt/script/mozjs-45/wrapper_private.h
+++ b/src/cobalt/script/mozjs-45/wrapper_private.h
@@ -79,15 +79,19 @@
       const scoped_refptr<Wrappable>& wrappable, JSContext* context,
       WrapperFactory* wrapper_factory);
 
-  // Get the WrapperPrivate instance associated with this Wrapper object.
+  // Get the |WrapperPrivate| instance associated with this |Wrapper| object.
+  // Will return |NULL| if |object| does not have a |Wrappable|, which also
+  // implies that it is not a |Wrapper|.
   static WrapperPrivate* GetFromWrapperObject(JS::HandleObject object);
 
   // Get the WrapperPrivate instance associated with the target of this proxy.
   static WrapperPrivate* GetFromProxyObject(JSContext* context,
                                             JS::HandleObject proxy_object);
 
-  // Get the WrapperPrivate instance associated with the object, which may
-  // be a proxy or a proxy target.
+  // Get the |WrapperPrivate| instance associated with the object, which may
+  // be a proxy or a proxy target. Will return |NULL| if the |JSObject| that
+  // results from traversing |object|'s proxy chain does not have a
+  // |Wrappable|, which also implies that it is not a |Wrapper|.
   static WrapperPrivate* GetFromObject(JSContext* context,
                                        JS::HandleObject object);
 
diff --git a/src/cobalt/script/mozjs/mozjs_callback_function.h b/src/cobalt/script/mozjs/mozjs_callback_function.h
index 7a2aebd..1046f62 100644
--- a/src/cobalt/script/mozjs/mozjs_callback_function.h
+++ b/src/cobalt/script/mozjs/mozjs_callback_function.h
@@ -29,6 +29,7 @@
 #include "cobalt/script/mozjs/util/stack_trace_helpers.h"
 #include "cobalt/script/mozjs/weak_heap_object.h"
 #include "nb/memory_scope.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/src/jsapi.h"
 #include "third_party/mozjs/js/src/jscntxt.h"
 
@@ -74,29 +75,27 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 0;
-
-      JSBool call_result = JS::Call(context_, this_value, function, 0, NULL,
-          return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 0;
+    JSBool call_result = JS::Call(context_, this_value, function, 0, NULL,
+        return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -140,34 +139,32 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 1;
-
-      JS::Value args[1];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 1;
+    JS::Value args[1];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -212,35 +209,33 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 2;
-
-      JS::Value args[2];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-      ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 2;
+    JS::Value args[2];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+    ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -286,36 +281,34 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 3;
-
-      JS::Value args[3];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-      ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
-      ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 3;
+    JS::Value args[3];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+    ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
+    ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -362,37 +355,35 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 4;
-
-      JS::Value args[4];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-      ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
-      ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
-      ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 4;
+    JS::Value args[4];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+    ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
+    ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
+    ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -441,38 +432,36 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 5;
-
-      JS::Value args[5];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-      ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
-      ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
-      ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
-      ToJSValue(context_, a5, auto_array_rooter.handleAt(4));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 5;
+    JS::Value args[5];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+    ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
+    ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
+    ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
+    ToJSValue(context_, a5, auto_array_rooter.handleAt(4));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -522,39 +511,37 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 6;
-
-      JS::Value args[6];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-      ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
-      ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
-      ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
-      ToJSValue(context_, a5, auto_array_rooter.handleAt(4));
-      ToJSValue(context_, a6, auto_array_rooter.handleAt(5));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 6;
+    JS::Value args[6];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+    ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
+    ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
+    ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
+    ToJSValue(context_, a5, auto_array_rooter.handleAt(4));
+    ToJSValue(context_, a6, auto_array_rooter.handleAt(5));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
@@ -605,40 +592,38 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
-
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other
-      // specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = 7;
-
-      JS::Value args[7];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
-      ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
-      ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
-      ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
-      ToJSValue(context_, a5, auto_array_rooter.handleAt(4));
-      ToJSValue(context_, a6, auto_array_rooter.handleAt(5));
-      ToJSValue(context_, a7, auto_array_rooter.handleAt(6));
-
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+      return callback_result;
     }
+
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
+
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = 7;
+    JS::Value args[7];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    ToJSValue(context_, a1, auto_array_rooter.handleAt(0));
+    ToJSValue(context_, a2, auto_array_rooter.handleAt(1));
+    ToJSValue(context_, a3, auto_array_rooter.handleAt(2));
+    ToJSValue(context_, a4, auto_array_rooter.handleAt(3));
+    ToJSValue(context_, a5, auto_array_rooter.handleAt(4));
+    ToJSValue(context_, a6, auto_array_rooter.handleAt(5));
+    ToJSValue(context_, a7, auto_array_rooter.handleAt(6));
+
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
+    }
+
     return callback_result;
   }
 
diff --git a/src/cobalt/script/mozjs/mozjs_callback_function.h.pump b/src/cobalt/script/mozjs/mozjs_callback_function.h.pump
index c44d9d9..3cfea93 100644
--- a/src/cobalt/script/mozjs/mozjs_callback_function.h.pump
+++ b/src/cobalt/script/mozjs/mozjs_callback_function.h.pump
@@ -34,6 +34,7 @@
 #include "cobalt/script/mozjs/util/stack_trace_helpers.h"
 #include "cobalt/script/mozjs/weak_heap_object.h"
 #include "nb/memory_scope.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/src/jsapi.h"
 #include "third_party/mozjs/js/src/jscntxt.h"
 
@@ -93,41 +94,40 @@
     if (!function) {
       DLOG(WARNING) << "Function was garbage collected.";
       callback_result.exception = true;
-    } else {
-      JSAutoCompartment auto_compartment(context_, function);
-      JSExceptionState* previous_exception_state =
-          JS_SaveExceptionState(context_);
+      return callback_result;
+    }
 
-      // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
-      // Callback 'this' is set to null, unless overridden by other specifications
-      JS::Value this_value(JS::NullValue());
-      JS::RootedValue return_value(context_);
-      const int kNumArguments = $(ARITY);
+    JSAutoCompartment auto_compartment(context_, function);
+    AutoSaveExceptionState auto_save_exception_state(context_);
 
+    // https://www.w3.org/TR/WebIDL/#es-invoking-callback-functions
+    // Callback 'this' is set to null, unless overridden by other specifications
+    JS::Value this_value(JS::NullValue());
+    JS::RootedValue return_value(context_);
+    const int kNumArguments = $(ARITY);
 
 $if ARITY > 0 [[
-      JS::Value args[$(ARITY)];
-      js::SetValueRangeToNull(args, kNumArguments);
-      js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
-      $for ARG [[ToJSValue(context_, a$(ARG), auto_array_rooter.handleAt($(ARG - 1)));
-      ]]
+    JS::Value args[$(ARITY)];
+    js::SetValueRangeToNull(args, kNumArguments);
+    js::AutoValueArray auto_array_rooter(context_, args, kNumArguments);
+    $for ARG [[ToJSValue(context_, a$(ARG), auto_array_rooter.handleAt($(ARG - 1)));
+    ]]
 
-      JSBool call_result = JS::Call(context_, this_value, function,
-          kNumArguments, args, return_value.address());
+    JSBool call_result = JS::Call(context_, this_value, function,
+        kNumArguments, args, return_value.address());
 ]] $else [[
-      JSBool call_result = JS::Call(context_, this_value, function, 0, NULL,
-          return_value.address());
+    JSBool call_result = JS::Call(context_, this_value, function, 0, NULL,
+        return_value.address());
 ]]
 
-      if (!call_result) {
-        DLOG(WARNING) << "Exception in callback: "
-                      << util::GetExceptionString(context_);
-        callback_result.exception = true;
-      } else {
-        callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
-      }
-      JS_RestoreExceptionState(context_, previous_exception_state);
+    if (!call_result) {
+      DLOG(WARNING) << "Exception in callback: "
+                    << util::GetExceptionString(context_);
+      callback_result.exception = true;
+    } else {
+      callback_result = ConvertCallbackReturnValue<R>(context_, return_value);
     }
+
     return callback_result;
   }
 
diff --git a/src/cobalt/script/mozjs/mozjs_global_environment.cc b/src/cobalt/script/mozjs/mozjs_global_environment.cc
index e7d64a1..200095f 100644
--- a/src/cobalt/script/mozjs/mozjs_global_environment.cc
+++ b/src/cobalt/script/mozjs/mozjs_global_environment.cc
@@ -29,6 +29,7 @@
 #include "cobalt/script/mozjs/referenced_object_map.h"
 #include "cobalt/script/mozjs/util/exception_helpers.h"
 #include "nb/memory_scope.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/public/RootingAPI.h"
 #include "third_party/mozjs/js/src/jsfriendapi.h"
 #include "third_party/mozjs/js/src/jsfun.h"
@@ -208,7 +209,7 @@
 
   JSAutoRequest auto_request(context_);
   JSAutoCompartment auto_compartment(context_, global_object_proxy_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  AutoSaveExceptionState auto_save_exception_state(context_);
   JS::RootedValue result_value(context_);
 
   std::string error_message;
@@ -227,7 +228,6 @@
     }
   }
   last_error_message_ = NULL;
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return success;
 }
 
@@ -239,7 +239,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   JSAutoRequest auto_request(context_);
   JSAutoCompartment auto_compartment(context_, global_object_proxy_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  AutoSaveExceptionState auto_save_exception_state(context_);
   JS::RootedValue result_value(context_);
   bool success = EvaluateScriptInternal(source_code, &result_value);
   if (success && out_opaque_handle) {
@@ -247,7 +247,6 @@
                                                 wrapper_factory());
     out_opaque_handle->emplace(owning_object.get(), mozjs_object_holder);
   }
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return success;
 }
 
diff --git a/src/cobalt/script/mozjs/wrapper_private.cc b/src/cobalt/script/mozjs/wrapper_private.cc
index 3814020..90257d4 100644
--- a/src/cobalt/script/mozjs/wrapper_private.cc
+++ b/src/cobalt/script/mozjs/wrapper_private.cc
@@ -127,6 +127,9 @@
 // static
 WrapperPrivate* WrapperPrivate::GetFromWrapperObject(JS::HandleObject wrapper) {
   DCHECK(!js::IsProxy(wrapper));
+  if (!(JS_GetClass(wrapper)->flags & JSCLASS_HAS_PRIVATE)) {
+    return NULL;
+  }
   WrapperPrivate* private_data =
       static_cast<WrapperPrivate*>(JS_GetPrivate(wrapper));
   DCHECK(private_data);
diff --git a/src/cobalt/script/mozjs/wrapper_private.h b/src/cobalt/script/mozjs/wrapper_private.h
index 5f15731..a016647 100644
--- a/src/cobalt/script/mozjs/wrapper_private.h
+++ b/src/cobalt/script/mozjs/wrapper_private.h
@@ -79,15 +79,19 @@
       const scoped_refptr<Wrappable>& wrappable, JSContext* context,
       WrapperFactory* wrapper_factory);
 
-  // Get the WrapperPrivate instance associated with this Wrapper object.
+  // Get the |WrapperPrivate| instance associated with this |Wrapper| object.
+  // Will return |NULL| if |object| does not have a |Wrappable|, which also
+  // implies that it is not a |Wrapper|.
   static WrapperPrivate* GetFromWrapperObject(JS::HandleObject object);
 
   // Get the WrapperPrivate instance associated with the target of this proxy.
   static WrapperPrivate* GetFromProxyObject(JSContext* context,
                                             JS::HandleObject proxy_object);
 
-  // Get the WrapperPrivate instance associated with the object, which may
-  // be a proxy or a proxy target.
+  // Get the |WrapperPrivate| instance associated with the object, which may
+  // be a proxy or a proxy target. Will return |NULL| if the |JSObject| that
+  // results from traversing |object|'s proxy chain does not have a
+  // |Wrappable|, which also implies that it is not a |Wrapper|.
   static WrapperPrivate* GetFromObject(JSContext* context,
                                        JS::HandleObject object);
 
diff --git a/src/starboard/linux/x64x11/gcc/4.2/starboard_platform.gyp b/src/cobalt/sso/sso.gyp
similarity index 63%
rename from src/starboard/linux/x64x11/gcc/4.2/starboard_platform.gyp
rename to src/cobalt/sso/sso.gyp
index 71a6d38..8551a2e 100644
--- a/src/starboard/linux/x64x11/gcc/4.2/starboard_platform.gyp
+++ b/src/cobalt/sso/sso.gyp
@@ -1,4 +1,4 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
+# Copyright 2017 Google Inc. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -11,8 +11,21 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 {
-  'includes': [
-    '../starboard_platform.gyp',
+  'variables': {
+    'sb_pedantic_warnings': 1,
+  },
+  'targets': [
+    {
+      'target_name': 'sso',
+      'type': 'none',
+      'sources': [
+        'sso_interface.h',
+      ],
+      'dependencies': [
+        '<(DEPTH)/cobalt/base/base.gyp:base',
+      ],
+    },
   ],
 }
diff --git a/src/cobalt/sso/sso_interface.h b/src/cobalt/sso/sso_interface.h
new file mode 100644
index 0000000..eb9db07
--- /dev/null
+++ b/src/cobalt/sso/sso_interface.h
@@ -0,0 +1,42 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef COBALT_SSO_SSO_INTERFACE_H_
+#define COBALT_SSO_SSO_INTERFACE_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+
+namespace cobalt {
+namespace sso {
+
+// Porters should inherit from this class, and implement the pure
+// virtual functions.
+class SsoInterface {
+ public:
+  virtual ~SsoInterface() {}
+  virtual std::string getApiKey() const = 0;
+  virtual std::string getOauthClientId() const = 0;
+  virtual std::string getOauthClientSecret() const = 0;
+};
+
+// Porters should implement this function in the |starboard|
+// directory, and link the definition inside cobalt.
+scoped_ptr<SsoInterface> CreateSSO();
+
+}  // namespace sso
+}  // namespace cobalt
+
+#endif  // COBALT_SSO_SSO_INTERFACE_H_
diff --git a/src/cobalt/system_window/system_window.cc b/src/cobalt/system_window/system_window.cc
index 9ca6339..444b411 100644
--- a/src/cobalt/system_window/system_window.cc
+++ b/src/cobalt/system_window/system_window.cc
@@ -12,12 +12,14 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "cobalt/system_window/system_window.h"
+
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/stringprintf.h"
 #include "cobalt/base/event_dispatcher.h"
 #include "cobalt/system_window/input_event.h"
-#include "cobalt/system_window/system_window.h"
+#include "starboard/double.h"
 #include "starboard/system.h"
 
 namespace cobalt {
@@ -27,6 +29,11 @@
 
 SystemWindow* g_the_window = NULL;
 
+int Round(const float f) {
+  double d(f + 0.5f);
+  return static_cast<int>(SbDoubleFloor(d));
+}
+
 }  // namespace
 
 SystemWindow::SystemWindow(base::EventDispatcher* event_dispatcher,
@@ -75,6 +82,12 @@
   return window_size.video_pixel_ratio;
 }
 
+math::Size SystemWindow::GetVideoOutputResolution() const {
+  float ratio = GetVideoPixelRatio();
+  math::Size size = GetWindowSize();
+  return math::Size(Round(size.width() * ratio), Round(size.height() * ratio));
+}
+
 SbWindow SystemWindow::GetSbWindow() { return window_; }
 
 void* SystemWindow::GetWindowHandle() {
diff --git a/src/cobalt/system_window/system_window.h b/src/cobalt/system_window/system_window.h
index 08aee67..b9f6017 100644
--- a/src/cobalt/system_window/system_window.h
+++ b/src/cobalt/system_window/system_window.h
@@ -76,6 +76,11 @@
   // to be played in higher resolution than the window.
   float GetVideoPixelRatio() const;
 
+  // Returns the resolution of the video output size, which may be different
+  // from the window size. This will generally be GetWindowSize() multiplied by
+  // GetVideoPixelRatio().
+  math::Size GetVideoOutputResolution() const;
+
   base::EventDispatcher* event_dispatcher() const { return event_dispatcher_; }
 
   // Returns a handle to the Starboard window object.
diff --git a/src/cobalt/webdriver/webdriver.gyp b/src/cobalt/webdriver/webdriver.gyp
index 64e7481..73cfe7d 100644
--- a/src/cobalt/webdriver/webdriver.gyp
+++ b/src/cobalt/webdriver/webdriver.gyp
@@ -100,7 +100,7 @@
       'type': 'none',
       'copies': [
         {
-          'destination': '<(static_contents_output_data_dir)/webdriver',
+          'destination': '<(sb_static_contents_output_data_dir)/webdriver',
           'conditions': [
             ['enable_webdriver==1', {
               'files': ['content/webdriver-init.js'],
diff --git a/src/cobalt/webdriver_benchmarks/README.md b/src/cobalt/webdriver_benchmarks/README.md
deleted file mode 100644
index da77083..0000000
--- a/src/cobalt/webdriver_benchmarks/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Framework for webdriver-driven benchmarks.
-
-Please see tests/README.md
diff --git a/src/cobalt/webdriver_benchmarks/__init__.py b/src/cobalt/webdriver_benchmarks/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/cobalt/webdriver_benchmarks/__init__.py
+++ /dev/null
diff --git a/src/cobalt/webdriver_benchmarks/c_val_names.py b/src/cobalt/webdriver_benchmarks/c_val_names.py
deleted file mode 100644
index 6ce4f4d..0000000
--- a/src/cobalt/webdriver_benchmarks/c_val_names.py
+++ /dev/null
@@ -1,89 +0,0 @@
-"""Provides cval names needed by the webdriver benchmarks."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-
-def count_dom_active_java_script_events():
-  return "Count.DOM.ActiveJavaScriptEvents"
-
-
-def count_dom_html_elements_document():
-  return "Count.MainWebModule.DOM.HtmlElement.Document"
-
-
-def count_dom_html_elements_total():
-  return "Count.MainWebModule.DOM.HtmlElement.Total"
-
-
-def count_dom_html_script_element_execute():
-  return "Count.MainWebModule.DOM.HtmlScriptElement.Execute"
-
-
-def count_layout_boxes():
-  return "Count.MainWebModule.Layout.Box"
-
-
-def count_image_cache_loading_resources():
-  return "Count.MainWebModule.ImageCache.LoadingResources"
-
-
-def count_image_cache_requested_resources():
-  return "Count.MainWebModule.ImageCache.RequestedResources"
-
-
-def count_rasterize_new_render_tree():
-  return "Count.Renderer.Rasterize.NewRenderTree"
-
-
-def event_duration_dom_video_start_delay():
-  return "Event.Duration.MainWebModule.DOM.VideoStartDelay"
-
-
-def event_is_processing():
-  return "Event.MainWebModule.IsProcessing"
-
-
-def event_value_dictionary(event_type):
-  return "Event.MainWebModule.{}.ValueDictionary".format(event_type)
-
-
-def layout_is_dirty():
-  return "MainWebModule.Layout.IsDirty"
-
-
-def rasterize_animations_entry_list():
-  return "Renderer.Rasterize.Animations.EntryList"
-
-
-def renderer_has_active_animations():
-  return "Renderer.HasActiveAnimations"
-
-
-def time_browser_navigate():
-  return "Time.Browser.Navigate"
-
-
-def time_browser_on_load_event():
-  return "Time.Browser.OnLoadEvent"
-
-
-def time_cobalt_start():
-  return "Time.Cobalt.Start"
-
-
-def time_dom_html_script_element_execute():
-  return "Time.MainWebModule.DOM.HtmlScriptElement.Execute"
-
-
-def time_rasterize_animations_start():
-  return "Time.Renderer.Rasterize.Animations.Start"
-
-
-def time_rasterize_animations_end():
-  return "Time.Renderer.Rasterize.Animations.End"
-
-
-def time_rasterize_new_render_tree():
-  return "Time.Renderer.Rasterize.NewRenderTree"
diff --git a/src/cobalt/webdriver_benchmarks/container_util.py b/src/cobalt/webdriver_benchmarks/container_util.py
deleted file mode 100644
index 2544b11..0000000
--- a/src/cobalt/webdriver_benchmarks/container_util.py
+++ /dev/null
@@ -1,90 +0,0 @@
-"""Base class for WebDriver tests."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import math
-
-
-def mean(list_values):
-  """Returns the mean of a list of numeric values.
-
-  Args:
-      list_values: A list of numeric values.
-  Returns:
-      Appropriate value.
-  """
-  if not list_values:
-    return None
-
-  return sum(list_values) / len(list_values)
-
-
-def percentile(list_values, target_percentile):
-  """Returns the percentile of a list.
-
-  This method interpolates between two numbers if the percentile lands between
-  two data points.
-
-  Args:
-      list_values: A sortable list of values
-      target_percentile: A number ranging from 0-100.
-  Returns:
-      Appropriate value.
-  Raises:
-    RuntimeError: Raised on invalid args.
-  """
-  if not list_values:
-    return None
-  if target_percentile > 100 or target_percentile < 0:
-    raise RuntimeError("target_percentile must be 0-100")
-  sorted_values = sorted(list_values)
-
-  if target_percentile == 100:
-    return sorted_values[-1]
-  fractional, index = math.modf(
-      (len(sorted_values) - 1) * (target_percentile * 0.01))
-  index = int(index)
-
-  if len(sorted_values) == index + 1:
-    return sorted_values[index]
-
-  return sorted_values[index] * (
-      1 - fractional) + sorted_values[index + 1] * fractional
-
-
-def sample_variance(list_values):
-  """Returns the variance of a list of numeric values.
-
-  Args:
-      list_values: A list of numeric values.
-  Returns:
-      Appropriate value.
-  """
-  if not list_values:
-    return None
-  if len(list_values) <= 1:
-    return 0
-
-  mean_of_values = mean(list_values)
-  dif_squared_sum = 0
-  for value in list_values:
-    dif = value - mean_of_values
-    dif_squared_sum += dif * dif
-
-  return dif_squared_sum / (len(list_values) - 1)
-
-
-def sample_standard_deviation(list_values):
-  """Returns the standard deviation of a list of numeric values.
-
-  Args:
-      list_values: A list of numeric values.
-  Returns:
-      Appropriate value.
-  """
-  if not list_values:
-    return None
-
-  return math.sqrt(sample_variance(list_values))
diff --git a/src/cobalt/webdriver_benchmarks/container_util_test.py b/src/cobalt/webdriver_benchmarks/container_util_test.py
deleted file mode 100755
index 8c29bb4..0000000
--- a/src/cobalt/webdriver_benchmarks/container_util_test.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python2
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Unit tests for tv_testcase.py."""
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-import unittest
-
-# This directory is a package
-sys.path.insert(0, os.path.abspath('.'))
-# pylint: disable=C6203,C6203
-# pylint: disable=g-import-not-at-top
-import container_util
-
-
-class MeanTest(unittest.TestCase):
-
-  def test_empty_case(self):
-    self.assertEqual(container_util.mean([]), None)
-
-  def test_one_item(self):
-    self.assertEqual(container_util.mean([1]), 1)
-
-  def test_two_items(self):
-    self.assertAlmostEqual(container_util.mean([4, 1]), 2.5)
-
-  def test_three_items(self):
-    self.assertAlmostEqual(container_util.mean([4, -4, 9]), 3)
-
-  def test_four_items(self):
-    self.assertAlmostEqual(container_util.mean([6, 0, 1, -2]), 1.25)
-
-
-class MedianPercentileTest(unittest.TestCase):
-
-  def test_empty_case(self):
-    self.assertEqual(container_util.percentile([], 50), None)
-
-  def test_one_item(self):
-    self.assertEqual(container_util.percentile([1], 50), 1)
-
-  def test_two_items(self):
-    self.assertAlmostEqual(container_util.percentile([4, 1], 50), 2.5)
-
-  def test_three_items(self):
-    self.assertAlmostEqual(container_util.percentile([4, -4, -2], 50), -2)
-
-  def test_four_items(self):
-    self.assertAlmostEqual(container_util.percentile([4, 0, 1, -2], 50), 0.5)
-
-
-class PercentileTest(unittest.TestCase):
-
-  def test_one_item(self):
-    self.assertEqual(container_util.percentile([1], 10), 1)
-    self.assertEqual(container_util.percentile([2], 50), 2)
-    self.assertEqual(container_util.percentile([3], 90), 3)
-
-  def test_two_items(self):
-    self.assertEqual(container_util.percentile([2, 1], 10), 1.1)
-    self.assertEqual(container_util.percentile([2, 3], 50), 2.5)
-    self.assertEqual(container_util.percentile([3, 4], 90), 3.9)
-    self.assertEqual(container_util.percentile([3, 4], 100), 4)
-
-  def test_five_items(self):
-    self.assertEqual(container_util.percentile([2, 1, 3, 4, 5], 10), 1.4)
-    self.assertEqual(container_util.percentile([2, 1, 3, 4, 5], 50), 3)
-    self.assertEqual(container_util.percentile([2, 1, 3, 4, 5], 90), 4.6)
-    self.assertEqual(container_util.percentile([2, 1, 3, 4, 5], 100), 5)
-
-
-if __name__ == '__main__':
-  sys.exit(unittest.main())
diff --git a/src/cobalt/webdriver_benchmarks/default_query_param_constants.py b/src/cobalt/webdriver_benchmarks/default_query_param_constants.py
deleted file mode 100644
index c2347f2..0000000
--- a/src/cobalt/webdriver_benchmarks/default_query_param_constants.py
+++ /dev/null
@@ -1,10 +0,0 @@
-"""Default query params to use when loading URLs."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-BASE_QUERY_PARAMS = {}
-
-INIT_QUERY_PARAMS = {}
-INIT_QUERY_PARAMS_TRIGGER_RELOAD = False
diff --git a/src/cobalt/webdriver_benchmarks/tests/README.md b/src/cobalt/webdriver_benchmarks/tests/README.md
deleted file mode 100644
index 81fde36..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/README.md
+++ /dev/null
@@ -1,292 +0,0 @@
-# Cobalt Webdriver-driven Benchmarks
-
-This directory contains a set of webdriver-driven benchmarks
-for Cobalt.
-
-Each file should contain a set of tests in Python "unittest" format.
-
-All tests included within [performance.py](performance.py) will be run on the
-build system. Results can be recorded in the build results database.
-
-## Running the tests
-
-In most cases, you will want to run all performance tests, and you can do so by
-executing the script [performance.py](performance.py). You can call
-`python performance.py --help` to see a list of commandline parameters to call
-it with.  For example, to run tests on the raspi-2 QA build, you should run the
-following command:
-
-```
-python performance.py -p raspi-2 -c qa -d $RASPI_ADDR
-```
-
-Where `RASPI_ADDR` is set to the IP of the target Raspberry Pi device.
-
-To run individual tests, simply execute the script directly. For all tests,
-platform configuration will be inferred from the environment if set. Otherwise,
-it must be specified via commandline parameters.
-
-## Creating a new test
-
- 1. If appropriate, create a new file borrowing the boilerplate from
-    an existing simple file, such as
-    [browse_horizontal.py](performance/non_video/browse_horizontal.py).
-
- 2. Add the file name to the tests added within
-    [performance.py](performance.py), causing it run when
-    [performance](performance.py) is run.
-
- 3. If this file contains internal names or details, consider adding it
-    to the "EXCLUDE.FILES" list.
-
- 4. Use the `record_test_result*` methods in `tv_testcase_util` where
-    appropriate.
-
- 5. Results must be added to the build results database schema. See
-    the internal
-    [README-Updating-Result-Schema.md](README-Updating-Result-Schema.md) file.
-
-## Testing against specific loaders/labels
-
-To run the benchmarks against any desired loader, a --url command line parameter
-can be provided. This will be the url that the tests will run against.
-
-It should have the following format:
-
-```
-python performance.py -p raspi-2 -c qa -d $RASPI_ADDR --url https://www.youtube.com/tv?loader=nllive
-```
-
-## Benchmark Results
-
-The results will be printed to stdout.  You should redirect output to a file
-if you would like to store the results.  Each line of the benchmark output
-prefixed with `webdriver_benchmark TEST_RESULT:` provides the result of one
-measurment.  Those lines have the following format:
-
-```
-webdriver_benchmark TEST_RESULT: result_name result_value
-```
-
-where `result_name` is the name of the result and `result_value` is a number
-providing the measured result for that metric.  For example,
-
-```
-webdriver_benchmark TEST RESULT: wbBrowseHorizontalDurLayoutBoxTreeUpdateUsedSizesUsPct50 3061.5
-```
-
-gives the 50th percentile of the duration Cobalt took to update the box tree's
-used sizes, on a horizontal scroll event, in microseconds.
-
-Note that most time-based measurements are in microseconds.
-
-### Interesting Timing-Related Benchmarks
-Some particularly interesting timing-related benchmark results are:
-
-#### Startup
- - `wbStartupDurLaunchToBrowseUs`: Measures the time it takes to launch Cobalt
-   and load the desired URL. The measurement ends when all images finish loading
-   and the final render tree is produced. This is only run once so it will be
-   noiser than other values but provides the most accurate measurement of the
-   requirement startup time.
- - `wbStartupDurLaunchToUsableUs`: Measures the time it takes to launch Cobalt,
-   and fully load the desired URL, including loading all scripts. The
-   measurement ends when the Player JavaScript code finishes loading on the
-   Browse page, which is the point when Cobalt is fully usable. This is only run
-   once so it will be noiser than other values but provides the most accurate
-   measurement of the time when Cobalt is usable.
- - `wbStartupDurNavigateToBrowseUs*`: Measures the time it takes to navigate to
-   the desired URL when Cobalt is already loaded. The measurement ends when all
-   images finish loading and the final render tree is produced. This is run
-   multiple times, so it will be less noisy than `wbStartupDurLaunchToBrowseUs`,
-   but it does not include Cobalt initialization so it is not as accurate of a
-   measurement.
- - `wbStartupDurNavigateToUsableUs`: Measures the time it takes to navigate to
-   the desired URL when Cobalt is already loaded, including loading all scripts.
-   The measurement ends when the Player JavaScript code finishes loading on the
-   Browse page, which is the point when Cobalt is fully usable. This is run
-   multiple times, so it will be less noisy than `wbStartupDurLaunchToUsableUs`,
-   but it does not include Cobalt initialization so it is not as accurate of a
-   measurement.
-
-#### Browse Horizontal Scroll Events
- - `wbBrowseHorizontalDurTotalUs*`: Measures the latency (i.e. JavaScript
-   execution time + layout time) during horizontal scroll events from keypress
-   until the render tree is submitted to the rasterize thread. It does not
-   include the time taken to rasterize the render tree so it will be smaller
-   than the observed latency.
- - `wbBrowseHorizontalDurAnimationsStartDelayUs*`: Measures the input latency
-   during horizontal scroll events from the keypress until the animation starts.
-   This is the most accurate measure of input latency.
- - `wbBrowseHorizontalDurAnimationsEndDelayUs*`: Measures the latency during
-   horizontal scroll events from the keypress until the animation ends.
- - `wbBrowseHorizontalDurFinalRenderTreeDelayUs*`: Measures the latency during
-   horizontal scroll events from the keypress until the final render tree is
-   rendered and processing stops.
- - `wbBrowseHorizontalDurRasterizeAnimationsUs*`: Measures the time it takes to
-   render each frame of the animation triggered by a horizontal scroll event.
-   The inverse of this number is the framerate.
-
-#### Browse Vertical Scroll Events
- - `wbBrowseVerticalDurTotalUs*`: Measures the latency (i.e. JavaScript
-   execution time + layout time) during vertical scroll events from keypress
-   until the render tree is submitted to the rasterize thread. It does not
-   include the time taken to rasterize the render tree so it will be smaller
-   than the observed latency.
- - `wbBrowseVerticalDurAnimationsStartDelayUs*`: Measures the input latency
-   during vertical scroll events from the keypress until the animation starts.
-   This is the most accurate measure of input latency.
- - `wbBrowseVerticalDurAnimationsEndDelayUs*`: Measures the latency during
-   vertical scroll events from the keypress until the animation ends.
- - `wbBrowseVerticalDurFinalRenderTreeDelayUs*`: Measures the latency during
-   vertical scroll events from the keypress until the final render tree is
-   rendered and processing stops.
- - `wbBrowseVerticalDurRasterizeAnimationsUs*`: Measures the time it takes to
-   render each frame of the animation triggered by a vertical scroll event.
-   The inverse of this number is the framerate.
-
-#### Browse-to-Watch
- - `wbBrowseToWatchDurVideoStartDelay*`: Measures the browse-to-watch time.
-
-In each case above, the `*` symbol can be one of either `Mean`, `Pct25`,
-`Pct50`, `Pct75` or `Pct95`.  For example, `wbStartupDurBlankToBrowseUsMean` or
-`wbStartupDurBlankToBrowseUsPct95` are both valid measurements. The webdriver
-benchmarks runs its tests many times in order to obtain multiple samples, so you
-can drill into the data by exploring either the mean, or the various
-percentiles.
-
-### Interesting Count-Related Benchmarks
-Some particularly interesting count-related benchmark results are:
-
-#### Startup
- - `wbStartupCntDomHtmlElements*`: Lists the number of HTML elements in
-   existence after startup completes. This includes HTML elements that are no
-   longer in the DOM but have not been garbage collected yet.
- - `wbStartupCntDocumentDomHtmlElements*`: Lists the number of HTML
-   elements within the DOM tree after startup completes.
- - `wbStartupCntLayoutBoxes*`: Lists the number of layout boxes within
-   the layout tree after startup completes.
- - `wbStartupCntRenderTrees*`: Lists the number of render trees that were
-   generated during startup.
- - `wbStartupCntRequestedImages*`: Lists the number of images that were
-   requested during startup.
-
-#### Browse Horizontal Scroll Events
- - `wbBrowseHorizontalCntDomHtmlElements*`: Lists the number of HTML elements in
-   existence after the event. This includes HTML elements that are no longer in
-   the DOM but have not been garbage collected yet.
- - `wbBrowseHorizontalCntDocumentDomHtmlElements*`: Lists the number of HTML
-   elements within the DOM tree after the event.
- - `wbBrowseHorizontalCntLayoutBoxes*`: Lists the number of layout boxes within
-   the layout tree after the event.
- - `wbBrowseHorizontalCntLayoutBoxesCreated*`: Lists the number of new layout
-   boxes that were created during the event.
- - `wbBrowseHorizontalCntRenderTrees*`: Lists the number of render trees that
-   were generated by the event.
- - `wbBrowseHorizontalCntRequestedImages*`: Lists the number of images that were
-   requested as a result of the event.
-
-#### Browse Vertical Scroll Events
- - `wbBrowseVerticalCntDomHtmlElements*`: Lists the number of HTML elements in
-   existence after the event. This includes HTML elements that are no longer in
-   the DOM but have not been garbage collected yet.
- - `wbBrowseVerticalCntDocumentDomHtmlElements*`: Lists the number of HTML
-   elements within the DOM tree after the event.
- - `wbBrowseVerticalCntLayoutBoxes*`: Lists the number of layout boxes within
-   the layout tree after the event.
- - `wbBrowseVerticalCntLayoutBoxesCreated*`: Lists the number of new layout
-   boxes that were created during the event.
- - `wbBrowseVerticalCntRenderTrees*`: Lists the number of render trees that
-   were generated by the event.
- - `wbBrowseVerticalCntRequestedImages*`: Lists the number of images that were
-   requested as a result of the event.
-
-In each case above,  the `*` symbol can be one of either `Max`, `Median`, or
-`Mean`. For example, `wbBrowseVerticalCntDomHtmlElementsMax` or
-`wbBrowseVerticalCntDomHtmlElementsMedian` are both valid measurements. The
-webdriver benchmarks runs its tests many times in order to obtain multiple
-samples, so you can drill into the data by exploring either the max, median, or
-mean.
-
-### Filtering results
-
-The webdriver benchmarks output many metrics, but you may only be interested
-in a few.  You will have to manually filter only the metrics that you are
-interested in.  You can do so with `grep`, for example:
-
-```
-python performance.py -p raspi-2 -c qa -d $RASPI_ADDR > results.txt
-echo "" > filtered_results.txt
-printf "=================================TIMING-RELATED=================================\n" >> filtered_results.txt
-printf "\nSTARTUP\n" >> filtered_results.txt
-grep -o "wbStartupDurLaunchToBrowseUs.*$" results.txt >> filtered_results.txt
-grep -o "wbStartupDurLaunchToUsableUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbStartupDurNavigateToBrowseUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbStartupDurNavigateToUsableUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-printf "\nBROWSE HORIZONTAL SCROLL EVENTS\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalDurTotalUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalDurAnimationsStartDelayUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalDurAnimationsEndDelayUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalDurFinalRenderTreeDelayUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalDurRasterizeAnimationsUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-printf "\nBROWSE VERTICAL SCROLL EVENTS\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalDurTotalUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalDurAnimationsStartDelayUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalDurAnimationsEndDelayUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalDurFinalRenderTreeDelayUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalDurRasterizeAnimationsUs.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-printf "\nBROWSE TO WATCH\n" >> filtered_results.txt
-grep -o "wbBrowseToWatchDurVideoStartDelay.*$" results.txt >> filtered_results.txt
-printf "\n\n=================================COUNT-RELATED==================================\n" >> filtered_results.txt
-printf "\nSTARTUP\n" >> filtered_results.txt
-grep -o "wbStartupCntDomHtmlElements.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbStartupCntDomDocumentHtmlElements.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbStartupCntLayoutBoxes.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbStartupCntRenderTrees.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbStartupCntRequestedImages.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-printf "\nBROWSE HORIZONTAL SCROLL EVENTS\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalCntDomHtmlElementsM.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalCntDomDocumentHtmlElements.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalCntLayoutBoxesM.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalCntLayoutBoxesCreated.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalCntRenderTrees.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseHorizontalCntRequestedImages.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-printf "\nBROWSE VERTICAL SCROLL EVENTS\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalCntDomHtmlElementsM.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalCntDomDocumentHtmlElements.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalCntLayoutBoxesM.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalCntLayoutBoxesCreated.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalCntRenderTrees.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-grep -o "wbBrowseVerticalCntRequestedImages.*$" results.txt >> filtered_results.txt
-printf "\n" >> filtered_results.txt
-cat filtered_results.txt
-```
diff --git a/src/cobalt/webdriver_benchmarks/tests/__init__.py b/src/cobalt/webdriver_benchmarks/tests/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/__init__.py
+++ /dev/null
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance.py b/src/cobalt/webdriver_benchmarks/tests/performance.py
deleted file mode 100644
index 8495f71..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/python2
-"""Target for running all performance test cases."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import importlib
-import os
-import sys
-import unittest
-
-# The parent directory is a module
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
-
-# pylint: disable=C6204,C6203
-import tv_testcase
-
-
-def _add_test(test_suite, dir_path, test_name):
-  if os.path.isfile(os.path.join(dir_path, test_name + ".py")):
-    print("Adding test: {}".format(test_name))
-    test_suite.addTest(unittest.TestLoader().loadTestsFromModule(
-        importlib.import_module("tests." + test_name)))
-
-
-# pylint: disable=unused-argument
-def load_tests(loader, tests, pattern):
-  """This is a Python unittest "load_tests protocol method."""
-  test_suite = unittest.TestSuite()
-  dir_path = os.path.dirname(__file__)
-
-  _add_test(test_suite, dir_path, "performance_non_video")
-  _add_test(test_suite, dir_path, "performance_video")
-
-  return test_suite
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/__init__.py b/src/cobalt/webdriver_benchmarks/tests/performance/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/__init__.py
+++ /dev/null
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/__init__.py b/src/cobalt/webdriver_benchmarks/tests/performance/non_video/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/__init__.py
+++ /dev/null
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_horizontal.py b/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_horizontal.py
deleted file mode 100755
index 2da83c6..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_horizontal.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python2
-"""Simple benchmark of horizontally navigating shelves during browse."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-
-# Add the base webdriver_benchmarks path
-sys.path.insert(0,
-                os.path.dirname(
-                    os.path.dirname((os.path.dirname(
-                        os.path.dirname(os.path.realpath(__file__)))))))
-
-# pylint: disable=C6204,C6203
-import tv_testcase
-import tv_testcase_event_recorder
-import tv_testcase_util
-
-# selenium imports
-keys = tv_testcase_util.import_selenium_module("webdriver.common.keys")
-
-NUM_LOAD_TV_CALLS = 5
-NUM_ITERATIONS_PER_LOAD_TV_CALL = 20
-
-BROWSE_HORIZONTAL_EVENT_NAME = "wbBrowseHorizontal"
-BROWSE_HORIZONTAL_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_DOWN
-
-
-class BrowseHorizontalTest(tv_testcase.TvTestCase):
-
-  def test_simple(self):
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, BROWSE_HORIZONTAL_EVENT_NAME, BROWSE_HORIZONTAL_EVENT_TYPE)
-    recorder = tv_testcase_event_recorder.EventRecorder(recorder_options)
-
-    for _ in xrange(NUM_LOAD_TV_CALLS):
-      self.load_tv()
-      self.send_keys(keys.Keys.ARROW_RIGHT)
-      self.wait_for_processing_complete_after_focused_shelf()
-
-      for _ in xrange(NUM_ITERATIONS_PER_LOAD_TV_CALL):
-        recorder.on_start_event()
-        self.send_keys(keys.Keys.ARROW_RIGHT)
-        self.wait_for_processing_complete_after_focused_shelf()
-        recorder.on_end_event()
-
-    recorder.on_end_test()
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_to_guide.py b/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_to_guide.py
deleted file mode 100755
index 7e5230f..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_to_guide.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python2
-"""Simple benchmark for going from browse to guide and back."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-
-# Add the base webdriver_benchmarks path
-sys.path.insert(0,
-                os.path.dirname(
-                    os.path.dirname((os.path.dirname(
-                        os.path.dirname(os.path.realpath(__file__)))))))
-
-# pylint: disable=C6204,C6203
-import tv
-import tv_testcase
-import tv_testcase_event_recorder
-import tv_testcase_util
-
-# selenium imports
-keys = tv_testcase_util.import_selenium_module("webdriver.common.keys")
-
-NUM_LOAD_TV_CALLS = 1
-NUM_ITERATIONS_PER_LOAD_TV_CALL = 20
-
-BROWSE_TO_GUIDE_EVENT_NAME = "wbBrowseToGuide"
-BROWSE_TO_GUIDE_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_DOWN
-
-GUIDE_TO_BROWSE_EVENT_NAME = "wbGuideToBrowse"
-GUIDE_TO_BROWSE_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_DOWN
-
-
-class BrowseToGuideTest(tv_testcase.TvTestCase):
-
-  def test_simple(self):
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, BROWSE_TO_GUIDE_EVENT_NAME, BROWSE_TO_GUIDE_EVENT_TYPE)
-    browse_to_guide_recorder = tv_testcase_event_recorder.EventRecorder(
-        recorder_options)
-
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, GUIDE_TO_BROWSE_EVENT_NAME, GUIDE_TO_BROWSE_EVENT_TYPE)
-    guide_to_browse_recorder = tv_testcase_event_recorder.EventRecorder(
-        recorder_options)
-
-    for _ in xrange(NUM_LOAD_TV_CALLS):
-      self.load_tv()
-
-      for _ in xrange(NUM_ITERATIONS_PER_LOAD_TV_CALL):
-        browse_to_guide_recorder.on_start_event()
-        self.send_keys(keys.Keys.ARROW_LEFT)
-        self.wait_for_processing_complete()
-        self.assert_displayed(tv.FOCUSED_GUIDE)
-        browse_to_guide_recorder.on_end_event()
-
-        guide_to_browse_recorder.on_start_event()
-        self.send_keys(keys.Keys.ARROW_RIGHT)
-        self.wait_for_processing_complete_after_focused_shelf()
-        guide_to_browse_recorder.on_end_event()
-
-    browse_to_guide_recorder.on_end_test()
-    guide_to_browse_recorder.on_end_test()
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_to_search.py b/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_to_search.py
deleted file mode 100755
index a2d82de..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_to_search.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/python2
-"""Simple benchmark for going from browse to search and back."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-
-# Add the base webdriver_benchmarks path
-sys.path.insert(0,
-                os.path.dirname(
-                    os.path.dirname((os.path.dirname(
-                        os.path.dirname(os.path.realpath(__file__)))))))
-
-# pylint: disable=C6204,C6203
-import tv
-import tv_testcase
-import tv_testcase_event_recorder
-import tv_testcase_util
-
-# selenium imports
-keys = tv_testcase_util.import_selenium_module("webdriver.common.keys")
-
-NUM_LOAD_TV_CALLS = 1
-NUM_ITERATIONS_PER_LOAD_TV_CALL = 20
-
-BROWSE_TO_SEARCH_EVENT_NAME = "wbBrowseToSearch"
-BROWSE_TO_SEARCH_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_UP
-
-SEARCH_TO_BROWSE_EVENT_NAME = "wbSearchToBrowse"
-SEARCH_TO_BROWSE_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_UP
-
-
-class BrowseToSearchTest(tv_testcase.TvTestCase):
-
-  def test_simple(self):
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, BROWSE_TO_SEARCH_EVENT_NAME, BROWSE_TO_SEARCH_EVENT_TYPE)
-    recorder_options.record_animations = False
-    browse_to_search_recorder = tv_testcase_event_recorder.EventRecorder(
-        recorder_options)
-
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, SEARCH_TO_BROWSE_EVENT_NAME, SEARCH_TO_BROWSE_EVENT_TYPE)
-    recorder_options.record_animations = False
-    search_to_browse_recorder = tv_testcase_event_recorder.EventRecorder(
-        recorder_options)
-
-    for _ in xrange(NUM_LOAD_TV_CALLS):
-      self.load_tv()
-
-      for _ in xrange(NUM_ITERATIONS_PER_LOAD_TV_CALL):
-        browse_to_search_recorder.on_start_event()
-        self.send_keys("s")
-        self.wait_for_processing_complete(False)
-        self.assert_displayed(tv.FOCUSED_SEARCH)
-        browse_to_search_recorder.on_end_event()
-
-        search_to_browse_recorder.on_start_event()
-        self.send_keys(keys.Keys.ESCAPE)
-        self.wait_for_processing_complete_after_focused_shelf()
-        search_to_browse_recorder.on_end_event()
-
-      browse_to_search_recorder.on_end_test()
-      search_to_browse_recorder.on_end_test()
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_vertical.py b/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_vertical.py
deleted file mode 100755
index 08a687e..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/browse_vertical.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python2
-"""Simple benchmark of vertically navigating shelves during browse."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-
-# Add the base webdriver_benchmarks path
-sys.path.insert(0,
-                os.path.dirname(
-                    os.path.dirname((os.path.dirname(
-                        os.path.dirname(os.path.realpath(__file__)))))))
-
-# pylint: disable=C6204,C6203
-import tv_testcase
-import tv_testcase_event_recorder
-import tv_testcase_util
-
-# selenium imports
-keys = tv_testcase_util.import_selenium_module("webdriver.common.keys")
-
-NUM_LOAD_TV_CALLS = 4
-NUM_ITERATIONS_PER_LOAD_TV_CALL = 25
-
-BROWSE_VERTICAL_EVENT_NAME = "wbBrowseVertical"
-BROWSE_VERTICAL_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_DOWN
-
-
-class BrowseVerticalTest(tv_testcase.TvTestCase):
-
-  def test_simple(self):
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, BROWSE_VERTICAL_EVENT_NAME, BROWSE_VERTICAL_EVENT_TYPE)
-    recorder = tv_testcase_event_recorder.EventRecorder(recorder_options)
-
-    for _ in xrange(NUM_LOAD_TV_CALLS):
-      self.load_tv()
-      self.send_keys(keys.Keys.ARROW_DOWN)
-      self.wait_for_processing_complete_after_focused_shelf()
-
-      for _ in xrange(NUM_ITERATIONS_PER_LOAD_TV_CALL):
-        recorder.on_start_event()
-        self.send_keys(keys.Keys.ARROW_DOWN)
-        self.wait_for_processing_complete_after_focused_shelf()
-        recorder.on_end_event()
-
-    recorder.on_end_test()
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/startup.py b/src/cobalt/webdriver_benchmarks/tests/performance/non_video/startup.py
deleted file mode 100755
index c37008e..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/non_video/startup.py
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/python2
-"""Simple benchmark for measuring startup time."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-
-# Add the base webdriver_benchmarks path
-sys.path.insert(0,
-                os.path.dirname(
-                    os.path.dirname((os.path.dirname(
-                        os.path.dirname(os.path.realpath(__file__)))))))
-
-# pylint: disable=C6204,C6203
-import c_val_names
-import tv_testcase
-import tv_testcase_util
-
-NUM_LOAD_TV_ITERATIONS = 20
-
-STARTUP_RECORD_NAME = "wbStartup"
-
-
-class StartupTest(tv_testcase.TvTestCase):
-
-  def setUp(self):
-    # Override TvTestCase's setUp() so that blank startup can first be measured.
-    pass
-
-  def test_simple(self):
-    """This test tries to measure the startup time for the YouTube TV page."""
-    self.wait_for_processing_complete()
-    self.wait_for_html_script_element_execute_count(2)
-
-    # Measure durations for the intial launch.
-    launch_time = self.get_cval(c_val_names.time_cobalt_start())
-    navigate_time = self.get_cval(c_val_names.time_browser_navigate())
-    on_load_event_time = self.get_cval(c_val_names.time_browser_on_load_event())
-    browse_time = self.get_cval(c_val_names.time_rasterize_new_render_tree())
-    usable_time = self.get_cval(
-        c_val_names.time_dom_html_script_element_execute())
-
-    dur_launch_to_navigate_us = navigate_time - launch_time
-    dur_launch_to_on_load_event_us = on_load_event_time - launch_time
-    dur_launch_to_browse_us = browse_time - launch_time
-    dur_launch_to_usable_us = usable_time - launch_time
-
-    # Call TvTestCase's setUp() now that the launch times have been measured.
-    super(StartupTest, self).setUp()
-
-    # Count record strategies
-    count_record_strategies = []
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMean())
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMin())
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMedian())
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMax())
-
-    # Duration record strategies
-    duration_record_strategies = []
-    duration_record_strategies.append(tv_testcase_util.RecordStrategyMean())
-    duration_record_strategies.append(tv_testcase_util.RecordStrategyMin())
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(25))
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(50))
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(75))
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(95))
-    duration_record_strategies.append(tv_testcase_util.RecordStrategyMax())
-
-    # Count recorders
-    count_total_html_element_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "CntDomHtmlElements", count_record_strategies)
-    count_document_html_element_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "CntDomDocumentHtmlElements",
-        count_record_strategies)
-    count_layout_box_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "CntLayoutBoxes", count_record_strategies)
-    count_render_trees_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "CntRenderTrees", count_record_strategies)
-    count_requested_images_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "CntRequestedImages", count_record_strategies)
-
-    # Duration recorders
-    duration_navigate_to_on_load_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "DurNavigateToOnLoadUs",
-        duration_record_strategies)
-    duration_navigate_to_browse_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "DurNavigateToBrowseUs",
-        duration_record_strategies)
-    duration_navigate_to_usable_recorder = tv_testcase_util.ResultsRecorder(
-        STARTUP_RECORD_NAME + "DurNavigateToUsableUs",
-        duration_record_strategies)
-
-    # Now measure counts and durations from reloading the URL.
-    for _ in range(NUM_LOAD_TV_ITERATIONS):
-      count_render_trees_start = self.get_cval(
-          c_val_names.count_rasterize_new_render_tree())
-
-      self.load_tv()
-
-      count_render_trees_end = self.get_cval(
-          c_val_names.count_rasterize_new_render_tree())
-
-      count_total_html_elements = self.get_cval(
-          c_val_names.count_dom_html_elements_total())
-      count_document_html_elements = self.get_cval(
-          c_val_names.count_dom_html_elements_document())
-      count_layout_boxes = self.get_cval(c_val_names.count_layout_boxes())
-      count_requested_images = self.get_cval(
-          c_val_names.count_image_cache_requested_resources())
-
-      navigate_time = self.get_cval(c_val_names.time_browser_navigate())
-      on_load_event_time = self.get_cval(
-          c_val_names.time_browser_on_load_event())
-      browse_time = self.get_cval(c_val_names.time_rasterize_new_render_tree())
-      usable_time = self.get_cval(
-          c_val_names.time_dom_html_script_element_execute())
-
-      count_total_html_element_recorder.collect_value(count_total_html_elements)
-      count_document_html_element_recorder.collect_value(
-          count_document_html_elements)
-      count_layout_box_recorder.collect_value(count_layout_boxes)
-      count_render_trees_recorder.collect_value(count_render_trees_end -
-                                                count_render_trees_start)
-      count_requested_images_recorder.collect_value(count_requested_images)
-
-      duration_navigate_to_on_load_recorder.collect_value(
-          on_load_event_time - navigate_time)
-      duration_navigate_to_browse_recorder.collect_value(
-          browse_time - navigate_time)
-      duration_navigate_to_usable_recorder.collect_value(
-          usable_time - navigate_time)
-
-    # Record the counts
-    count_total_html_element_recorder.on_end_test()
-    count_document_html_element_recorder.on_end_test()
-    count_layout_box_recorder.on_end_test()
-    count_render_trees_recorder.on_end_test()
-    count_requested_images_recorder.on_end_test()
-
-    # Record the durations
-    tv_testcase_util.record_test_result(
-        STARTUP_RECORD_NAME + "DurLaunchToNavigateUs",
-        dur_launch_to_navigate_us)
-    tv_testcase_util.record_test_result(
-        STARTUP_RECORD_NAME + "DurLaunchToOnLoadUs",
-        dur_launch_to_on_load_event_us)
-    tv_testcase_util.record_test_result(
-        STARTUP_RECORD_NAME + "DurLaunchToBrowseUs", dur_launch_to_browse_us)
-    tv_testcase_util.record_test_result(
-        STARTUP_RECORD_NAME + "DurLaunchToUsableUs", dur_launch_to_usable_us)
-
-    duration_navigate_to_on_load_recorder.on_end_test()
-    duration_navigate_to_browse_recorder.on_end_test()
-    duration_navigate_to_usable_recorder.on_end_test()
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/video/__init__.py b/src/cobalt/webdriver_benchmarks/tests/performance/video/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/video/__init__.py
+++ /dev/null
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance/video/browse_to_watch.py b/src/cobalt/webdriver_benchmarks/tests/performance/video/browse_to_watch.py
deleted file mode 100755
index 248e73c..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance/video/browse_to_watch.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/python2
-"""Simple benchmark for starting a video from browse."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os
-import sys
-
-# Add the base webdriver_benchmarks path
-sys.path.insert(0,
-                os.path.dirname(
-                    os.path.dirname((os.path.dirname(
-                        os.path.dirname(os.path.realpath(__file__)))))))
-
-# pylint: disable=C6204,C6203
-import tv_testcase
-import tv_testcase_event_recorder
-import tv_testcase_util
-
-# selenium imports
-keys = tv_testcase_util.import_selenium_module("webdriver.common.keys")
-
-MAX_VIDEO_FAILURE_COUNT = 10
-MAX_SKIPPABLE_AD_COUNT = 8
-
-NUM_LOAD_TV_CALLS = 4
-NUM_ITERATIONS_PER_LOAD_TV_CALL = 25
-
-BROWSE_TO_WATCH_EVENT_NAME = "wbBrowseToWatch"
-BROWSE_TO_WATCH_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_UP
-
-WATCH_TO_BROWSE_EVENT_NAME = "wbWatchToBrowse"
-WATCH_TO_BROWSE_EVENT_TYPE = tv_testcase_util.EVENT_TYPE_KEY_UP
-
-
-class BrowseToWatchTest(tv_testcase.TvTestCase):
-
-  class VideoFailureException(BaseException):
-    """Exception thrown when MAX_VIDEO_FAILURE_COUNT is exceeded."""
-
-  class AdvertisementFailureException(BaseException):
-    """Exception thrown when MAX_SKIPPABLE_AD_COUNT is exceeded."""
-
-  def test_simple(self):
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, BROWSE_TO_WATCH_EVENT_NAME, BROWSE_TO_WATCH_EVENT_TYPE)
-    recorder_options.record_animations = False
-    recorder_options.record_video = True
-    browse_to_watch_recorder = tv_testcase_event_recorder.EventRecorder(
-        recorder_options)
-
-    recorder_options = tv_testcase_event_recorder.EventRecorderOptions(
-        self, WATCH_TO_BROWSE_EVENT_NAME, WATCH_TO_BROWSE_EVENT_TYPE)
-    recorder_options.record_animations = False
-    watch_to_browse_recorder = tv_testcase_event_recorder.EventRecorder(
-        recorder_options)
-
-    failure_count = 0
-    skippable_ad_count = 0
-
-    for _ in xrange(NUM_LOAD_TV_CALLS):
-      self.load_tv()
-
-      for _ in xrange(NUM_ITERATIONS_PER_LOAD_TV_CALL):
-        self.send_keys(keys.Keys.ARROW_DOWN)
-        self.wait_for_processing_complete_after_focused_shelf()
-
-        browse_to_watch_recorder.on_start_event()
-        self.send_keys(keys.Keys.ENTER)
-
-        if not self.wait_for_media_element_playing():
-          failure_count += 1
-          print("Video failed to play! {} events failed.".format(failure_count))
-          if failure_count > MAX_VIDEO_FAILURE_COUNT:
-            raise BrowseToWatchTest.VideoFailureException()
-
-          self.send_keys(keys.Keys.ESCAPE)
-          self.wait_for_processing_complete_after_focused_shelf()
-          continue
-
-        if self.skip_advertisement_if_playing():
-          skippable_ad_count += 1
-          print(
-              "Encountered skippable ad! {} total.".format(skippable_ad_count))
-          if skippable_ad_count > MAX_SKIPPABLE_AD_COUNT:
-            raise BrowseToWatchTest.AdvertisementFailureException()
-
-          self.wait_for_title_card_hidden()
-          self.send_keys(keys.Keys.ESCAPE)
-          self.wait_for_processing_complete_after_focused_shelf()
-          continue
-
-        browse_to_watch_recorder.on_end_event()
-
-        # Wait for the title card hidden before sending the escape. Otherwise,
-        # two escapes are required to exit the video.
-        self.wait_for_title_card_hidden()
-
-        watch_to_browse_recorder.on_start_event()
-        self.send_keys(keys.Keys.ESCAPE)
-        self.wait_for_processing_complete_after_focused_shelf()
-        watch_to_browse_recorder.on_end_event()
-
-    browse_to_watch_recorder.on_end_test()
-    watch_to_browse_recorder.on_end_test()
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance_non_video.py b/src/cobalt/webdriver_benchmarks/tests/performance_non_video.py
deleted file mode 100644
index f71a433..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance_non_video.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/python2
-"""Target for running non-video performance test cases."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import importlib
-import os
-import sys
-import unittest
-
-# The parent directory is a module
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
-
-# pylint: disable=C6204,C6203
-import tv_testcase
-
-
-def _add_test(test_suite, dir_path, test_name):
-  if os.path.isfile(
-      os.path.join(dir_path, "performance", "non_video", test_name + ".py")):
-    print("Adding test: {}".format(test_name))
-    test_suite.addTest(unittest.TestLoader().loadTestsFromModule(
-        importlib.import_module("tests.performance.non_video." + test_name)))
-
-
-# pylint: disable=unused-argument
-def load_tests(loader, tests, pattern):
-  """This is a Python unittest "load_tests protocol method."""
-  test_suite = unittest.TestSuite()
-  dir_path = os.path.dirname(__file__)
-
-  # "startup" must be the first test added. The timings that it
-  # records require it to run first.
-  _add_test(test_suite, dir_path, "startup")
-  _add_test(test_suite, dir_path, "browse_horizontal")
-  _add_test(test_suite, dir_path, "browse_vertical")
-  _add_test(test_suite, dir_path, "browse_to_guide")
-  _add_test(test_suite, dir_path, "browse_to_search")
-
-  return test_suite
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tests/performance_video.py b/src/cobalt/webdriver_benchmarks/tests/performance_video.py
deleted file mode 100755
index 3784cc2..0000000
--- a/src/cobalt/webdriver_benchmarks/tests/performance_video.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/python2
-"""Target for running video performance test cases."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import importlib
-import os
-import sys
-import unittest
-
-# The parent directory is a module
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
-
-# pylint: disable=C6204,C6203
-import tv_testcase
-
-
-def _add_test(test_suite, dir_path, test_name):
-  if os.path.isfile(
-      os.path.join(dir_path, "performance", "video", test_name + ".py")):
-    print("Adding test: {}".format(test_name))
-    test_suite.addTest(unittest.TestLoader().loadTestsFromModule(
-        importlib.import_module("tests.performance.video." + test_name)))
-
-
-# pylint: disable=unused-argument
-def load_tests(loader, tests, pattern):
-  """This is a Python unittest "load_tests protocol method."""
-  test_suite = unittest.TestSuite()
-  dir_path = os.path.dirname(__file__)
-
-  _add_test(test_suite, dir_path, "browse_to_watch")
-
-  return test_suite
-
-
-if __name__ == "__main__":
-  tv_testcase.main()
diff --git a/src/cobalt/webdriver_benchmarks/tv.py b/src/cobalt/webdriver_benchmarks/tv.py
deleted file mode 100644
index 332b3c9..0000000
--- a/src/cobalt/webdriver_benchmarks/tv.py
+++ /dev/null
@@ -1,13 +0,0 @@
-"""CSS Constants."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-FOCUSED_GUIDE = '.focused.guide'
-FOCUSED_SEARCH = '.focused.search'
-FOCUSED_SHELF = '.focused.selected.shelf'
-FOCUSED_SHELF_TITLE = '.focused.selected.shelf .shelf-header-title .main'
-SKIP_AD_BUTTON_CAN_SKIP = '.skip-ad-button.canskip'
-SKIP_AD_BUTTON_HIDDEN = '.skip-ad-button.hidden'
-TITLE_CARD_HIDDEN = '.title-card.hidden'
diff --git a/src/cobalt/webdriver_benchmarks/tv_testcase.py b/src/cobalt/webdriver_benchmarks/tv_testcase.py
deleted file mode 100644
index dc49278..0000000
--- a/src/cobalt/webdriver_benchmarks/tv_testcase.py
+++ /dev/null
@@ -1,343 +0,0 @@
-"""Base class for WebDriver tests."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import json
-import logging
-import os
-import sys
-import time
-import unittest
-
-# This directory is a package
-sys.path.insert(0, os.path.abspath("."))
-# pylint: disable=C6204,C6203
-import c_val_names
-import tv
-import tv_testcase_runner
-import tv_testcase_util
-
-try:
-  import custom_query_param_constants as query_param_constants
-except ImportError:
-  import default_query_param_constants as query_param_constants
-
-# selenium imports
-# pylint: disable=C0103
-ActionChains = tv_testcase_util.import_selenium_module(
-    submodule="webdriver.common.action_chains").ActionChains
-keys = tv_testcase_util.import_selenium_module("webdriver.common.keys")
-
-WINDOWDRIVER_CREATED_TIMEOUT_SECONDS = 30
-WEBMODULE_LOADED_TIMEOUT_SECONDS = 30
-PAGE_LOAD_WAIT_SECONDS = 30
-PROCESSING_TIMEOUT_SECONDS = 60
-HTML_SCRIPT_ELEMENT_EXECUTE_TIMEOUT_SECONDS = 30
-MEDIA_TIMEOUT_SECONDS = 30
-SKIP_AD_TIMEOUT_SECONDS = 30
-TITLE_CARD_HIDDEN_TIMEOUT_SECONDS = 30
-
-_is_initialized = False
-
-
-class TvTestCase(unittest.TestCase):
-  """Base class for WebDriver tests.
-
-  Style note: snake_case is used for function names here so as to match
-  with an internal class with the same name.
-  """
-
-  class WindowDriverCreatedTimeoutException(BaseException):
-    """Exception thrown when WindowDriver was not created in time."""
-
-  class WebModuleLoadedTimeoutException(BaseException):
-    """Exception thrown when WebModule was not loaded in time."""
-
-  class ProcessingTimeoutException(BaseException):
-    """Exception thrown when processing did not complete in time."""
-
-  class HtmlScriptElementExecuteTimeoutException(BaseException):
-    """Exception thrown when processing did not complete in time."""
-
-  class TitleCardHiddenTimeoutException(BaseException):
-    """Exception thrown when title card did not disappear in time."""
-
-  @classmethod
-  def setUpClass(cls):
-    print("Running " + cls.__name__)
-
-  @classmethod
-  def tearDownClass(cls):
-    print("Done " + cls.__name__)
-
-  def setUp(self):
-    global _is_initialized
-    if not _is_initialized:
-      # Initialize the tests.
-      query_params = query_param_constants.INIT_QUERY_PARAMS
-      triggers_reload = query_param_constants.INIT_QUERY_PARAMS_TRIGGER_RELOAD
-      self.load_tv(query_params, triggers_reload)
-      _is_initialized = True
-
-  def get_webdriver(self):
-    return tv_testcase_runner.GetWebDriver()
-
-  def get_default_url(self):
-    return tv_testcase_runner.GetDefaultUrl()
-
-  def get_cval(self, cval_name):
-    """Returns the Python object represented by a JSON cval string.
-
-    Args:
-      cval_name: Name of the cval.
-    Returns:
-      Python object represented by the JSON cval string
-    """
-    javascript_code = "return h5vcc.cVal.getValue('{}')".format(cval_name)
-    json_result = self.get_webdriver().execute_script(javascript_code)
-    if json_result is None:
-      return None
-    else:
-      return json.loads(json_result)
-
-  def load_blank(self):
-    """Loads about:blank and waits for it to finish.
-
-    Raises:
-      Underlying WebDriver exceptions
-    """
-    self.clear_url_loaded_events()
-    self.get_webdriver().get("about:blank")
-    self.wait_for_url_loaded_events()
-
-  def load_tv(self, query_params=None, triggers_reload=False):
-    """Loads the main TV page and waits for it to display.
-
-    Args:
-      query_params: A dict containing additional query parameters.
-      triggers_reload: Whether or not the navigation will trigger a reload.
-    Raises:
-      Underlying WebDriver exceptions
-    """
-    self.get_webdriver().execute_script("h5vcc.storage.clearCookies()")
-    self.clear_url_loaded_events()
-    self.get_webdriver().get(
-        tv_testcase_util.generate_url(self.get_default_url(), query_params))
-    self.wait_for_url_loaded_events()
-    if triggers_reload:
-      self.clear_url_loaded_events()
-      self.wait_for_url_loaded_events()
-    # Note that the internal tests use "expect_transition" which is
-    # a mechanism that sets a maximum timeout for a "@with_retries"
-    # decorator-driven success retry loop for subsequent webdriver requests.
-    #
-    # We'll skip that sophistication here.
-    self.wait_for_processing_complete_after_focused_shelf()
-
-  def poll_until_found(self, css_selector):
-    """Polls until an element is found.
-
-    Args:
-      css_selector: A CSS selector
-    Raises:
-      Underlying WebDriver exceptions
-    """
-    start_time = time.time()
-    while ((not self.find_elements(css_selector)) and
-           (time.time() - start_time < PAGE_LOAD_WAIT_SECONDS)):
-      time.sleep(1)
-    self.assert_displayed(css_selector)
-
-  def unique_find(self, unique_selector):
-    """Finds and returns a uniquely selected element.
-
-    Args:
-      unique_selector: A CSS selector that will select only one element
-    Raises:
-      Underlying WebDriver exceptions
-      AssertError: the element isn't unique
-    Returns:
-      Element
-    """
-    return self.find_elements(unique_selector, expected_num=1)[0]
-
-  def assert_displayed(self, css_selector):
-    """Asserts that an element is displayed.
-
-    Args:
-      css_selector: A CSS selector
-    Raises:
-      Underlying WebDriver exceptions
-      AssertError: the element isn't found
-    """
-    # TODO does not actually assert that it's visible, like webdriver.py
-    # probably does.
-    self.assertTrue(self.unique_find(css_selector))
-
-  def find_elements(self, css_selector, expected_num=None):
-    """Finds elements based on a selector.
-
-    Args:
-      css_selector: A CSS selector
-      expected_num: Expected number of matching elements
-    Raises:
-      Underlying WebDriver exceptions
-      AssertError: expected_num isn't met
-    Returns:
-      Array of selected elements
-    """
-    elements = self.get_webdriver().find_elements_by_css_selector(css_selector)
-    if expected_num is not None:
-      self.assertEqual(len(elements), expected_num)
-    return elements
-
-  def send_keys(self, key_events):
-    """Sends keys to whichever element currently has focus.
-
-    Args:
-      key_events: key events
-
-    Raises:
-      Underlying WebDriver exceptions
-    """
-    ActionChains(self.get_webdriver()).send_keys(key_events).perform()
-
-  def clear_url_loaded_events(self):
-    """Clear the events that indicate that Cobalt finished loading a URL."""
-    tv_testcase_runner.GetWindowDriverCreated().clear()
-    tv_testcase_runner.GetWebModuleLoaded().clear()
-
-  def wait_for_url_loaded_events(self):
-    """Wait for the events indicating that Cobalt finished loading a URL."""
-    windowdriver_created = tv_testcase_runner.GetWindowDriverCreated()
-    if not windowdriver_created.wait(WINDOWDRIVER_CREATED_TIMEOUT_SECONDS):
-      raise TvTestCase.WindowDriverCreatedTimeoutException()
-
-    webmodule_loaded = tv_testcase_runner.GetWebModuleLoaded()
-    if not webmodule_loaded.wait(WEBMODULE_LOADED_TIMEOUT_SECONDS):
-      raise TvTestCase.WebModuleLoadedTimeoutException()
-
-  def wait_for_processing_complete_after_focused_shelf(self):
-    """Waits for Cobalt to focus on a shelf and complete pending layouts."""
-    self.poll_until_found(tv.FOCUSED_SHELF)
-    self.assert_displayed(tv.FOCUSED_SHELF_TITLE)
-    self.wait_for_processing_complete()
-
-  def wait_for_processing_complete(self, check_animations=True):
-    """Waits for Cobalt to complete processing.
-
-    This method requires two consecutive iterations through its loop where
-    Cobalt is not processing before treating processing as complete. This
-    protects against a brief window between two different processing sections
-    being mistaken as completed processing.
-
-    Args:
-      check_animations: Whether or not animations should be checked when
-                        determining if processing is complete.
-
-    Raises:
-      ProcessingTimeoutException: Processing is not complete within the
-      required time.
-    """
-    start_time = time.time()
-
-    # First simply check for whether or not the event is still processing.
-    # There's no need to check anything else while the event is still going on.
-    # Once it is done processing, it won't get re-set, so there's no need to
-    # re-check it.
-    while self.get_cval(c_val_names.event_is_processing()):
-      if time.time() - start_time > PROCESSING_TIMEOUT_SECONDS:
-        raise TvTestCase.ProcessingTimeoutException()
-
-      time.sleep(0.1)
-
-    # Now wait for all processing to complete in Cobalt.
-    count = 0
-    while count < 2:
-      if self.is_processing(check_animations):
-        count = 0
-      else:
-        count += 1
-
-      if time.time() - start_time > PROCESSING_TIMEOUT_SECONDS:
-        raise TvTestCase.ProcessingTimeoutException()
-
-      time.sleep(0.1)
-
-  def is_processing(self, check_animations):
-    """Checks to see if Cobalt is currently processing."""
-    return (self.get_cval(c_val_names.count_dom_active_java_script_events()) or
-            self.get_cval(c_val_names.layout_is_dirty()) or
-            (check_animations and
-             self.get_cval(c_val_names.renderer_has_active_animations())) or
-            self.get_cval(c_val_names.count_image_cache_loading_resources()))
-
-  def wait_for_html_script_element_execute_count(self, required_count):
-    """Waits for specified number of html script element Execute() calls.
-
-    Args:
-      required_count: the number of executions that must occur
-
-    Raises:
-      HtmlScriptElementExecuteTimeoutException: The required html script element
-      executions did not occur within the required time.
-    """
-    start_time = time.time()
-    while self.get_cval(
-        c_val_names.count_dom_html_script_element_execute()) < required_count:
-      if time.time() - start_time > HTML_SCRIPT_ELEMENT_EXECUTE_TIMEOUT_SECONDS:
-        raise TvTestCase.HtmlScriptElementExecuteTimeoutException()
-      time.sleep(0.1)
-
-  def wait_for_media_element_playing(self):
-    """Waits for a video to begin playing.
-
-    Returns:
-      Whether or not the video started.
-    """
-    start_time = time.time()
-    while self.get_cval(
-        c_val_names.event_duration_dom_video_start_delay()) == 0:
-      if time.time() - start_time > MEDIA_TIMEOUT_SECONDS:
-        return False
-      time.sleep(0.1)
-
-    return True
-
-  def skip_advertisement_if_playing(self):
-    """Waits to skip an ad if it is encountered.
-
-    Returns:
-      True if a skippable advertisement was encountered
-    """
-    start_time = time.time()
-    if not self.find_elements(tv.SKIP_AD_BUTTON_HIDDEN):
-      while not self.find_elements(tv.SKIP_AD_BUTTON_CAN_SKIP):
-        if time.time() - start_time > SKIP_AD_TIMEOUT_SECONDS:
-          return True
-        time.sleep(0.1)
-      self.send_keys(keys.Keys.ENTER)
-      self.wait_for_processing_complete(False)
-      return True
-
-    return False
-
-  def wait_for_title_card_hidden(self):
-    """Waits for the title to disappear while a video is playing.
-
-    Raises:
-      TitleCardHiddenTimeoutException: The title card did not become hidden in
-      the required time.
-    """
-    start_time = time.time()
-    while not self.find_elements(tv.TITLE_CARD_HIDDEN):
-      if time.time() - start_time > TITLE_CARD_HIDDEN_TIMEOUT_SECONDS:
-        raise TvTestCase.TitleCardHiddenTimeoutException()
-      time.sleep(1)
-
-
-def main():
-  logging.basicConfig(level=logging.DEBUG)
-  tv_testcase_runner.main()
diff --git a/src/cobalt/webdriver_benchmarks/tv_testcase_event_recorder.py b/src/cobalt/webdriver_benchmarks/tv_testcase_event_recorder.py
deleted file mode 100644
index 363bde4..0000000
--- a/src/cobalt/webdriver_benchmarks/tv_testcase_event_recorder.py
+++ /dev/null
@@ -1,264 +0,0 @@
-#!/usr/bin/python2
-"""Records stats on an event injected by a benchmark test."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import c_val_names
-import tv_testcase_util
-
-
-class EventRecorderOptions(object):
-  """Contains all of the parameters needed by EventRecorder."""
-
-  def __init__(self, test, event_name, event_type):
-    """Initializes the event recorder options.
-
-    Args:
-      test: specific benchmark test being run
-      event_name: name of the event being recorded
-      event_type: type of event being recorded (tv_testcase_util.py)
-    """
-    self.test = test
-    self.event_name = event_name
-    self.event_type = event_type
-
-    self.record_animations = True
-    self.record_video = False
-
-
-class EventRecorder(object):
-  """Records stats on an event injected by a benchmark test.
-
-  Handles collecting event data over all of the instances of a specific event
-  injected by a benchmark test and records statistics on the data when the test
-  ends. The specific event types that can be injected are listed within
-  tv_testcase_util.py.
-
-  Both rasterize animations and video start delay data can potentially be
-  recorded, depending on the |record_animations| and |record_video| option
-  flags.
-  """
-
-  def __init__(self, options):
-    """Initializes the event recorder.
-
-    Handles setting up this event recorder, including creating all of its
-    recorders, based upon the passed in options.
-
-    Args:
-      options: the settings to use in creating this event recorder
-    """
-    self.test = options.test
-    self.event_name = options.event_name
-    self.event_type = options.event_type
-
-    self.render_tree_failure_count = 0
-
-    # Each entry in the list contains a tuple with a key and value recorder.
-    self.value_dictionary_recorders = []
-
-    # Optional animations recorders
-    self.animations_recorder = None
-    self.animations_start_delay_recorder = None
-    self.animations_end_delay_recorder = None
-
-    # Optional video recorders
-    self.video_delay_recorder = None
-
-    # Count record strategies
-    count_record_strategies = []
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMean())
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMedian())
-    count_record_strategies.append(tv_testcase_util.RecordStrategyMax())
-
-    # Duration record strategies
-    duration_record_strategies = []
-    duration_record_strategies.append(tv_testcase_util.RecordStrategyMean())
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(25))
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(50))
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(75))
-    duration_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(95))
-
-    # Video delay record strategies
-    video_delay_record_strategies = []
-    video_delay_record_strategies.append(tv_testcase_util.RecordStrategyMean())
-    video_delay_record_strategies.append(tv_testcase_util.RecordStrategyMin())
-    video_delay_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(25))
-    video_delay_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(50))
-    video_delay_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(75))
-    video_delay_record_strategies.append(
-        tv_testcase_util.RecordStrategyPercentile(95))
-    video_delay_record_strategies.append(tv_testcase_util.RecordStrategyMax())
-    video_delay_record_strategies.append(
-        tv_testcase_util.RecordStrategyStandardDeviation())
-
-    # Dictionary count recorders
-    self._add_value_dictionary_recorder("CntDomEventListeners",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomNodes", count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomHtmlElements",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomDocumentHtmlElements",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomHtmlElementsCreated",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomUpdateMatchingRules",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomUpdateComputedStyle",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomGenerateHtmlComputedStyle",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntDomGeneratePseudoComputedStyle",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntLayoutBoxes",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntLayoutBoxesCreated",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntLayoutUpdateSize",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntLayoutRenderAndAnimate",
-                                        count_record_strategies)
-    self._add_value_dictionary_recorder("CntLayoutUpdateCrossReferences",
-                                        count_record_strategies)
-
-    # Dictionary duration recorders
-    self._add_value_dictionary_recorder("DurTotalUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurDomInjectEventUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurDomRunAnimationFrameCallbacksUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurDomUpdateComputedStyleUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurLayoutBoxTreeUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurLayoutBoxTreeBoxGenerationUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurLayoutBoxTreeUpdateUsedSizesUs",
-                                        duration_record_strategies)
-    self._add_value_dictionary_recorder("DurLayoutRenderAndAnimateUs",
-                                        duration_record_strategies)
-
-    self.count_render_trees_recorder = tv_testcase_util.ResultsRecorder(
-        self.event_name + "CntRenderTrees", count_record_strategies)
-    self.count_requested_images_recorder = tv_testcase_util.ResultsRecorder(
-        self.event_name + "CntRequestedImages", count_record_strategies)
-
-    # Optional animations recorder
-    if options.record_animations:
-      self.animations_recorder = tv_testcase_util.ResultsRecorder(
-          self.event_name + "DurRasterizeAnimationsUs",
-          duration_record_strategies)
-      self.animations_start_delay_recorder = tv_testcase_util.ResultsRecorder(
-          self.event_name + "DurAnimationsStartDelayUs",
-          duration_record_strategies)
-      self.animations_end_delay_recorder = tv_testcase_util.ResultsRecorder(
-          self.event_name + "DurAnimationsEndDelayUs",
-          duration_record_strategies)
-
-    self.final_render_tree_delay_recorder = tv_testcase_util.ResultsRecorder(
-        self.event_name + "DurFinalRenderTreeDelayUs",
-        duration_record_strategies)
-
-    # Optional video recorder
-    if options.record_video:
-      self.video_delay_recorder = tv_testcase_util.ResultsRecorder(
-          self.event_name + "DurVideoStartDelayUs",
-          video_delay_record_strategies)
-
-  def _add_value_dictionary_recorder(self, key, record_strategies):
-    recorder = tv_testcase_util.ResultsRecorder(self.event_name + key,
-                                                record_strategies)
-    self.value_dictionary_recorders.append((key, recorder))
-
-  def on_start_event(self):
-    """Handles logic related to the start of the event instance."""
-    self.count_render_trees_start = self.test.get_cval(
-        c_val_names.count_rasterize_new_render_tree())
-    self.count_requested_images_start = self.test.get_cval(
-        c_val_names.count_image_cache_requested_resources())
-
-  def on_end_event(self):
-    """Handles logic related to the end of the event instance."""
-
-    value_dictionary = self.test.get_cval(
-        c_val_names.event_value_dictionary(self.event_type))
-
-    # If the event failed to produce a render tree, then its data is not
-    # collected. Log the failure and return.
-    if not value_dictionary or not value_dictionary.get("ProducedRenderTree"):
-      self.render_tree_failure_count += 1
-      print("{} event failed to produce render tree! {} events failed.".format(
-          self.event_name, self.render_tree_failure_count))
-      return
-
-    event_start_time = value_dictionary.get("StartTime")
-
-    # Record all of the values from the event.
-    for value_dictionary_recorder in self.value_dictionary_recorders:
-      value = value_dictionary.get(value_dictionary_recorder[0])
-      if value is not None:
-        value_dictionary_recorder[1].collect_value(value)
-
-    self.count_render_trees_end = self.test.get_cval(
-        c_val_names.count_rasterize_new_render_tree())
-    self.count_render_trees_recorder.collect_value(
-        self.count_render_trees_end - self.count_render_trees_start)
-
-    self.count_requested_images_end = self.test.get_cval(
-        c_val_names.count_image_cache_requested_resources())
-    self.count_requested_images_recorder.collect_value(
-        self.count_requested_images_end - self.count_requested_images_start)
-
-    if self.animations_recorder:
-      animation_entries = self.test.get_cval(
-          c_val_names.rasterize_animations_entry_list())
-      for value in animation_entries:
-        self.animations_recorder.collect_value(value)
-
-      animations_start_time = self.test.get_cval(
-          c_val_names.time_rasterize_animations_start())
-      self.animations_start_delay_recorder.collect_value(
-          animations_start_time - event_start_time)
-      animations_end_time = self.test.get_cval(
-          c_val_names.time_rasterize_animations_end())
-      self.animations_end_delay_recorder.collect_value(animations_end_time -
-                                                       event_start_time)
-
-    final_render_tree_time = self.test.get_cval(
-        c_val_names.time_rasterize_new_render_tree())
-    self.final_render_tree_delay_recorder.collect_value(final_render_tree_time -
-                                                        event_start_time)
-
-    if self.video_delay_recorder:
-      self.video_delay_recorder.collect_value(
-          self.test.get_cval(
-              c_val_names.event_duration_dom_video_start_delay()))
-
-  def on_end_test(self):
-    """Handles logic related to the end of the test."""
-
-    for value_dictionary_recorder in self.value_dictionary_recorders:
-      value_dictionary_recorder[1].on_end_test()
-
-    self.count_render_trees_recorder.on_end_test()
-    self.count_requested_images_recorder.on_end_test()
-
-    if self.animations_recorder:
-      self.animations_recorder.on_end_test()
-      self.animations_start_delay_recorder.on_end_test()
-      self.animations_end_delay_recorder.on_end_test()
-
-    self.final_render_tree_delay_recorder.on_end_test()
-
-    if self.video_delay_recorder:
-      self.video_delay_recorder.on_end_test()
diff --git a/src/cobalt/webdriver_benchmarks/tv_testcase_runner.py b/src/cobalt/webdriver_benchmarks/tv_testcase_runner.py
deleted file mode 100755
index 6f9981c..0000000
--- a/src/cobalt/webdriver_benchmarks/tv_testcase_runner.py
+++ /dev/null
@@ -1,296 +0,0 @@
-#!/usr/bin/python2
-"""Runs webdriver-based Cobalt benchmark tests."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import argparse
-import importlib
-import inspect
-import os
-import re
-import sys
-import thread
-import threading
-import unittest
-
-import tv_testcase_util
-
-arg_parser = argparse.ArgumentParser(
-    description="Runs Webdriver-based Cobalt benchmark tests")
-arg_parser.add_argument(
-    "-p",
-    "--platform",
-    help="Cobalt platform, eg 'linux-x64x11'."
-    "Fetched from environment if absent.")
-arg_parser.add_argument(
-    "-e",
-    "--executable",
-    help="Path to Cobalt executable. "
-    "Auto-derived if absent.")
-arg_parser.add_argument(
-    "-c",
-    "--config",
-    choices=["debug", "devel", "qa", "gold"],
-    help="Build config (eg, 'qa' or 'devel'). Not used if "
-    "--executable is specified. Fetched from environment "
-    "if needed and absent.")
-arg_parser.add_argument(
-    "-d",
-    "--devkit_name",
-    help="Devkit or IP address for app_launcher."
-    "Current hostname used if absent.")
-arg_parser.add_argument(
-    "--command_line",
-    nargs="*",
-    help="Command line arguments to pass to the Cobalt executable.")
-arg_parser.add_argument(
-    "--url", help="Specifies the URL to run the tests against.")
-arg_parser.add_argument(
-    "-o", "--log_file", help="Logfile pathname. stdout if absent.")
-
-# Pattern to match Cobalt log line for when the WebDriver port has been
-# opened.
-RE_WEBDRIVER_LISTEN = re.compile(r"Starting WebDriver server on port (\d+)")
-# Pattern to match Cobalt log line for when a WindowDriver has been created.
-RE_WINDOWDRIVER_CREATED = re.compile(
-    r"^\[\d+/\d+:INFO:browser_module\.cc\(\d+\)\] Created WindowDriver: ID=\S+")
-# Pattern to match Cobalt log line for when a WebModule is has been loaded.
-RE_WEBMODULE_LOADED = re.compile(
-    r"^\[\d+/\d+:INFO:browser_module\.cc\(\d+\)\] Loaded WebModule")
-
-DEFAULT_STARTUP_TIMEOUT_SECONDS = 2 * 60
-WEBDRIVER_HTTP_TIMEOUT_SECONDS = 2 * 60
-COBALT_EXIT_TIMEOUT_SECONDS = 5
-
-COBALT_WEBDRIVER_CAPABILITIES = {
-    "browserName": "cobalt",
-    "javascriptEnabled": True,
-    "platform": "LINUX"
-}
-
-_webdriver = None
-_windowdriver_created = threading.Event()
-_webmodule_loaded = threading.Event()
-_default_url = "https://www.youtube.com/tv"
-
-
-def GetWebDriver():
-  """Returns the active connect WebDriver instance."""
-  return _webdriver
-
-
-def GetWindowDriverCreated():
-  """Returns the WindowDriver created instance."""
-  return _windowdriver_created
-
-
-def GetWebModuleLoaded():
-  """Returns the WebModule loaded instance."""
-  return _webmodule_loaded
-
-
-def GetDefaultUrl():
-  """Returns the default url to use with tests."""
-  return _default_url
-
-
-class TimeoutException(Exception):
-  pass
-
-
-class CobaltRunner(object):
-  """Runs a Cobalt browser w/ a WebDriver client attached."""
-  test_script_started = threading.Event()
-  selenium_webdriver_module = None
-  webdriver = None
-  launcher = None
-  log_file_path = None
-  thread = None
-  failed = False
-  should_exit = threading.Event()
-
-  def __init__(self, platform, executable, devkit_name, command_line_args,
-               default_url, log_file_path):
-    global _default_url
-    if default_url is not None:
-      _default_url = default_url
-
-    self.selenium_webdriver_module = tv_testcase_util.import_selenium_module(
-        "webdriver")
-
-    script_path = os.path.realpath(inspect.getsourcefile(lambda: 0))
-    app_launcher_path = os.path.realpath(
-        os.path.join(
-            os.path.dirname(script_path), "..", "..", "tools", "lbshell"))
-    sys.path.append(app_launcher_path)
-    app_launcher = importlib.import_module("app_launcher")
-    self.launcher = app_launcher.CreateLauncher(
-        platform, executable, devkit_name=devkit_name, close_output_file=False)
-
-    args = []
-    if command_line_args is not None:
-      for command_line_arg in command_line_args:
-        args.append("--" + command_line_arg)
-    args.append("--enable_webdriver")
-    args.append("--null_savegame")
-    args.append("--debug_console=off")
-    args.append("--url=" + _default_url)
-
-    self.launcher.SetArgs(args)
-    self.launcher.SetOutputCallback(self._HandleLine)
-    self.log_file_path = log_file_path
-    self.log_file = None
-
-  def __enter__(self):
-    self.thread = threading.Thread(target=self.Run)
-    self.thread.start()
-    try:
-      self.WaitForStart()
-    except KeyboardInterrupt:
-      # potentially from thread.interrupt_main(). We will treat as
-      # a timeout regardless
-      self.SetShouldExit(failed=True)
-      raise TimeoutException
-    return self
-
-  def __exit__(self, exc_type, exc_value, traceback):
-    # The unittest module terminates with a SystemExit
-    # If this is a successful exit, then this is a successful run
-    success = exc_type is None or (exc_type is SystemExit and
-                                   not exc_value.code)
-    self.SetShouldExit(failed=not success)
-    self.thread.join(COBALT_EXIT_TIMEOUT_SECONDS)
-
-  def _HandleLine(self, line):
-    """Internal log line callback."""
-
-    if RE_WINDOWDRIVER_CREATED.search(line):
-      _windowdriver_created.set()
-      return
-
-    if RE_WEBMODULE_LOADED.search(line):
-      _webmodule_loaded.set()
-      return
-
-    # Wait for WebDriver port here then connect
-    if self.test_script_started.is_set():
-      return
-
-    match = RE_WEBDRIVER_LISTEN.search(line)
-    if not match:
-      return
-
-    port = match.group(1)
-    print("WebDriver port opened:" + port + "\n", file=self.log_file)
-    self._StartWebdriver(port)
-
-  def SetShouldExit(self, failed=False):
-    """Indicates cobalt process should exit."""
-    self.failed = failed
-    self.should_exit.set()
-    self.launcher.SendKill()
-
-  def _GetProcessIPAddress(self):
-    return self.launcher.GetProcessIPAddress()
-
-  def _StartWebdriver(self, port):
-    global _webdriver
-    url = "http://{}:{}/".format(self._GetProcessIPAddress(), port)
-    self.webdriver = self.selenium_webdriver_module.Remote(
-        url, COBALT_WEBDRIVER_CAPABILITIES)
-    self.webdriver.command_executor.set_timeout(WEBDRIVER_HTTP_TIMEOUT_SECONDS)
-    print("Selenium Connected\n", file=self.log_file)
-    _webdriver = self.webdriver
-    self.test_script_started.set()
-
-  def WaitForStart(self):
-    """Waits for the webdriver client to attach to Cobalt."""
-    startup_timeout_seconds = self.launcher.GetStartupTimeout()
-    if not startup_timeout_seconds:
-      startup_timeout_seconds = DEFAULT_STARTUP_TIMEOUT_SECONDS
-
-    if not self.test_script_started.wait(startup_timeout_seconds):
-      self.SetShouldExit(failed=True)
-      raise TimeoutException
-    print("Cobalt started", file=self.log_file)
-
-  def Run(self):
-    """Thread run routine."""
-
-    # Use stdout if log_file_path is unspecified
-    # If log_file_path is specified, make sure to close it
-    to_close = None
-    try:
-      if self.log_file_path:
-        self.log_file = open(self.log_file_path, "w")
-        to_close = self.log_file
-      else:
-        self.log_file = sys.stdout
-
-      self.launcher.SetOutputFile(self.log_file)
-      print("Running launcher", file=self.log_file)
-      self.launcher.Run()
-      print(
-          "Cobalt terminated. failed: " + str(self.failed), file=self.log_file)
-      # This is watched for in webdriver_benchmark_test.py
-      if not self.failed:
-        print("{}\n".format(tv_testcase_util.TEST_COMPLETE))
-    # pylint: disable=broad-except
-    except Exception as ex:
-      print("Exception running Cobalt " + str(ex), file=sys.stderr)
-    finally:
-      if to_close:
-        to_close.close()
-      if not self.should_exit.is_set():
-        # If the main thread is not expecting us to exit,
-        # we must interrupt it.
-        thread.interrupt_main()
-    return 0
-
-
-def GetCobaltExecutablePath(platform, config):
-  """Auto-derives a path to a cobalt executable."""
-  if config is None:
-    try:
-      config = os.environ["BUILD_TYPE"]
-    except KeyError:
-      sys.stderr.write("Must specify --config or --executable\n")
-      sys.exit(1)
-  script_path = os.path.realpath(inspect.getsourcefile(lambda: 0))
-  script_dir = os.path.dirname(script_path)
-  out_dir = os.path.join(script_dir, "..", "..", "out")
-  executable_directory = os.path.join(out_dir, "{}_{}".format(platform, config))
-  return os.path.join(executable_directory, "cobalt")
-
-
-def main():
-  args = arg_parser.parse_args()
-  # Keep unittest module from seeing these args
-  sys.argv = sys.argv[:1]
-
-  platform = args.platform
-  if platform is None:
-    try:
-      platform = os.environ["BUILD_PLATFORM"]
-    except KeyError:
-      sys.stderr.write("Must specify --platform\n")
-      sys.exit(1)
-
-  executable = args.executable
-  if executable is None:
-    executable = GetCobaltExecutablePath(platform, args.config)
-
-  try:
-    with CobaltRunner(platform, executable, args.devkit_name, args.command_line,
-                      args.url, args.log_file) as runner:
-      unittest.main(testRunner=unittest.TextTestRunner(
-          verbosity=0, stream=runner.log_file))
-  except TimeoutException:
-    print("Timeout waiting for Cobalt to start", file=sys.stderr)
-    sys.exit(1)
-
-
-if __name__ == "__main__":
-  main()
diff --git a/src/cobalt/webdriver_benchmarks/tv_testcase_util.py b/src/cobalt/webdriver_benchmarks/tv_testcase_util.py
deleted file mode 100644
index 5d9f87f..0000000
--- a/src/cobalt/webdriver_benchmarks/tv_testcase_util.py
+++ /dev/null
@@ -1,216 +0,0 @@
-"""Provides constants and functions needed by tv_testcase classes."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import importlib
-import json
-import sys
-
-# pylint: disable=C6204
-from urllib import urlencode
-import urlparse
-
-import container_util
-
-try:
-  import custom_query_param_constants as query_param_constants
-except ImportError:
-  import default_query_param_constants as query_param_constants
-
-# These are watched for in webdriver_benchmark_test.py
-TEST_RESULT = "webdriver_benchmark TEST RESULT"
-TEST_COMPLETE = "webdriver_benchmark TEST COMPLETE"
-
-# These are event types that can be injected
-EVENT_TYPE_KEY_DOWN = "KeyDown"
-EVENT_TYPE_KEY_UP = "KeyUp"
-
-
-def import_selenium_module(submodule=None):
-  """Dynamically imports a selenium.webdriver submodule.
-
-  This is done because selenium 3.0 is not commonly pre-installed
-  on workstations, and we want to have a friendly error message for that
-  case.
-
-  Args:
-    submodule: module subpath underneath "selenium.webdriver"
-  Returns:
-    appropriate module
-  """
-  if submodule:
-    module_path = ".".join(("selenium", submodule))
-  else:
-    module_path = "selenium"
-  # As of this writing, Google uses selenium 3.0.0b2 internally, so
-  # thats what we will target here as well.
-  try:
-    module = importlib.import_module(module_path)
-    if submodule is None:
-      # Only the top-level module has __version__
-      if not module.__version__.startswith("3.0"):
-        raise ImportError("Not version 3.0.x")
-  except ImportError:
-    sys.stderr.write("Could not import {}\n"
-                     "Please install selenium >= 3.0.0b2.\n"
-                     "Commonly: \"sudo pip install 'selenium>=3.0.0b2'\"\n"
-                     .format(module_path))
-    sys.exit(1)
-  return module
-
-
-def generate_url(default_url, query_params_override=None):
-  """Returns the URL indicated by the path and query parameters.
-
-  Args:
-    default_url: the default url to use; its query params may be overridden
-    query_params_override: optional query params that override the ones
-                           contained within the default URL
-  Returns:
-    the url generated from the parameters
-  """
-  parsed_url = list(urlparse.urlparse(default_url))
-
-  query_params = query_param_constants.BASE_QUERY_PARAMS
-  if query_params_override:
-    query_params.update(query_params_override)
-  else:
-    query_params.update(urlparse.parse_qsl(parsed_url[4]))
-
-  parsed_url[4] = urlencode(query_params, doseq=True)
-  return urlparse.urlunparse(parsed_url)
-
-
-def record_test_result(name, result):
-  """Records an individual scalar result of a benchmark test.
-
-  Args:
-    name: string name of test case
-    result: Test result. Must be JSON encodable scalar.
-  """
-  value_to_record = result
-
-  string_value_to_record = json.JSONEncoder().encode(value_to_record)
-  print("{}: {} {}\n".format(TEST_RESULT, name, string_value_to_record))
-  sys.stdout.flush()
-
-
-class RecordStrategyMax(object):
-  """"Records the max of an array of values."""
-
-  def run(self, name, values):
-    """Records the max of an array of values.
-
-    Args:
-      name: string name of test case
-      values: must be array of JSON encodable scalar
-    """
-    record_test_result("{}Max".format(name), max(values))
-
-
-class RecordStrategyMin(object):
-  """"Records the min of an array of values."""
-
-  def run(self, name, values):
-    """Records the min of an array of values.
-
-    Args:
-      name: string name of test case
-      values: must be array of JSON encodable scalar
-    """
-    record_test_result("{}Min".format(name), min(values))
-
-
-class RecordStrategyMean(object):
-  """"Records the mean of an array of values."""
-
-  def run(self, name, values):
-    """Records the mean of an array of values.
-
-    Args:
-      name: string name of test case
-      values: must be array of JSON encodable scalar
-    """
-    record_test_result("{}Mean".format(name), container_util.mean(values))
-
-
-class RecordStrategyMedian(object):
-  """"Records the median of an array of test results."""
-
-  def run(self, name, values):
-    """Records the median of an array of values.
-
-    Args:
-      name: string name of test case
-      values: must be array of JSON encodable scalar
-    """
-    record_test_result("{}Median".format(name),
-                       container_util.percentile(values, 50))
-
-
-class RecordStrategyPercentile(object):
-  """"Records the specified percentile of an array of test results."""
-
-  def __init__(self, percentile):
-    """Initializes the record strategy.
-
-    Args:
-      percentile: the percentile to record
-    """
-    self.percentile = percentile
-
-  def run(self, name, values):
-    """Records the percentile of an array of values.
-
-    Args:
-      name: string name of test case
-      values: must be array of JSON encodable scalar
-    Raises:
-      RuntimeError: Raised on invalid args.
-    """
-    record_test_result("{}Pct{}".format(name, self.percentile),
-                       container_util.percentile(values, self.percentile))
-
-
-class RecordStrategyStandardDeviation(object):
-  """Records the standard deviation of an array of values."""
-
-  def run(self, name, values):
-    """Records the standard deviation of an array of values.
-
-    Args:
-      name: string name of test case
-      values: must be array of JSON encodable scalar
-    Raises:
-      RuntimeError: Raised on invalid args.
-    """
-    record_test_result("{}StdDev".format(name),
-                       container_util.sample_standard_deviation(values))
-
-
-class ResultsRecorder(object):
-  """"Collects values and records results after a benchmark test ends."""
-
-  def __init__(self, name, record_strategies):
-    """Initializes the value recorder.
-
-    Args:
-      name: the name to use when recording test results
-      record_strategies: the strategies to use when the test ends
-    """
-    self.name = name
-    self.record_strategies = record_strategies
-    self.values = []
-
-  def collect_value(self, value):
-    self.values.append(value)
-
-  def on_end_test(self):
-    """Handles logic related to the end of the benchmark test."""
-
-    # Only run the strategies if values have been collected.
-    if self.values:
-      for record_strategy in self.record_strategies:
-        record_strategy.run(self.name, self.values)
diff --git a/src/cobalt/websocket/web_socket_impl.cc b/src/cobalt/websocket/web_socket_impl.cc
index ed6995f..9381765 100644
--- a/src/cobalt/websocket/web_socket_impl.cc
+++ b/src/cobalt/websocket/web_socket_impl.cc
@@ -15,6 +15,7 @@
 #include "cobalt/websocket/web_socket_impl.h"
 
 #include <algorithm>
+#include <cstdint>
 
 #include "base/basictypes.h"
 #include "base/bind_helpers.h"
@@ -586,12 +587,13 @@
   DCHECK(delegate_task_runner_->BelongsToCurrentThread());
 
   bool close_was_clean = false;
-  net::WebSocketError close_code = net::kWebSocketErrorAbnormalClosure;
+  std::uint16_t close_code =
+      static_cast<std::uint16_t>(net::kWebSocketErrorAbnormalClosure);
   std::string close_reason;
 
   if (peer_close_info_) {
     close_was_clean = true;
-    close_code = peer_close_info_->code;
+    close_code = static_cast<std::uint16_t>(peer_close_info_->code);
     close_reason = peer_close_info_->reason;
   }
 
@@ -773,7 +775,7 @@
   header.masked = true;
   header.payload_length = length;
 
-  *buffered_amount += length;
+  *buffered_amount += static_cast<int>(length);
 
   return SendHelper(header, data, error_message);
 }
@@ -795,7 +797,7 @@
   header.masked = true;
   header.payload_length = length;
 
-  *buffered_amount += length;
+  *buffered_amount += static_cast<int>(length);
 
   return SendHelper(header, data, error_message);
 }
diff --git a/src/crypto/apple_keychain.h b/src/crypto/apple_keychain.h
deleted file mode 100644
index 840ccee..0000000
--- a/src/crypto/apple_keychain.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 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 CRYPTO_KEYCHAIN_MAC_H_
-#define CRYPTO_KEYCHAIN_MAC_H_
-
-#include <Security/Security.h>
-
-#include "base/basictypes.h"
-#include "crypto/crypto_export.h"
-
-#if defined (OS_IOS)
-typedef void* SecKeychainRef;
-typedef void* SecKeychainItemRef;
-typedef void SecKeychainAttributeList;
-#endif
-
-namespace crypto {
-
-// Wraps the KeychainServices API in a very thin layer, to allow it to be
-// mocked out for testing.
-
-// See Keychain Services documentation for function documentation, as these call
-// through directly to their Keychain Services equivalents (Foo ->
-// SecKeychainFoo). The only exception is Free, which should be used for
-// anything returned from this class that would normally be freed with
-// CFRelease (to aid in testing).
-class CRYPTO_EXPORT AppleKeychain {
- public:
-  AppleKeychain();
-  virtual ~AppleKeychain();
-
-  virtual OSStatus FindGenericPassword(CFTypeRef keychainOrArray,
-                                       UInt32 serviceNameLength,
-                                       const char* serviceName,
-                                       UInt32 accountNameLength,
-                                       const char* accountName,
-                                       UInt32* passwordLength,
-                                       void** passwordData,
-                                       SecKeychainItemRef* itemRef) const;
-
-  virtual OSStatus ItemFreeContent(SecKeychainAttributeList* attrList,
-                                   void* data) const;
-
-  virtual OSStatus AddGenericPassword(SecKeychainRef keychain,
-                                      UInt32 serviceNameLength,
-                                      const char* serviceName,
-                                      UInt32 accountNameLength,
-                                      const char* accountName,
-                                      UInt32 passwordLength,
-                                      const void* passwordData,
-                                      SecKeychainItemRef* itemRef) const;
-
-#if !defined(OS_IOS)
-  virtual OSStatus ItemCopyAttributesAndData(
-      SecKeychainItemRef itemRef,
-      SecKeychainAttributeInfo* info,
-      SecItemClass* itemClass,
-      SecKeychainAttributeList** attrList,
-      UInt32* length,
-      void** outData) const;
-
-  virtual OSStatus ItemModifyAttributesAndData(
-      SecKeychainItemRef itemRef,
-      const SecKeychainAttributeList* attrList,
-      UInt32 length,
-      const void* data) const;
-
-  virtual OSStatus ItemFreeAttributesAndData(SecKeychainAttributeList* attrList,
-                                             void* data) const;
-
-  virtual OSStatus ItemDelete(SecKeychainItemRef itemRef) const;
-
-  virtual OSStatus SearchCreateFromAttributes(
-      CFTypeRef keychainOrArray,
-      SecItemClass itemClass,
-      const SecKeychainAttributeList* attrList,
-      SecKeychainSearchRef* searchRef) const;
-
-  virtual OSStatus SearchCopyNext(SecKeychainSearchRef searchRef,
-                                  SecKeychainItemRef* itemRef) const;
-
-  virtual OSStatus AddInternetPassword(SecKeychainRef keychain,
-                                       UInt32 serverNameLength,
-                                       const char* serverName,
-                                       UInt32 securityDomainLength,
-                                       const char* securityDomain,
-                                       UInt32 accountNameLength,
-                                       const char* accountName,
-                                       UInt32 pathLength, const char* path,
-                                       UInt16 port, SecProtocolType protocol,
-                                       SecAuthenticationType authenticationType,
-                                       UInt32 passwordLength,
-                                       const void* passwordData,
-                                       SecKeychainItemRef* itemRef) const;
-
-  // Calls CFRelease on the given ref, after checking that |ref| is non-NULL.
-  virtual void Free(CFTypeRef ref) const;
-#endif  // !defined(OS_IOS)
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AppleKeychain);
-};
-
-}  // namespace crypto
-
-#endif  // CRYPTO_KEYCHAIN_MAC_H_
diff --git a/src/crypto/apple_keychain_ios.mm b/src/crypto/apple_keychain_ios.mm
deleted file mode 100644
index 1a4c9d5..0000000
--- a/src/crypto/apple_keychain_ios.mm
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (c) 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 "crypto/apple_keychain.h"
-
-#import <Foundation/Foundation.h>
-
-#include "base/mac/foundation_util.h"
-#include "base/mac/scoped_cftyperef.h"
-#include "base/memory/scoped_nsobject.h"
-
-namespace {
-
-enum KeychainAction {
-  kKeychainActionCreate,
-  kKeychainActionUpdate
-};
-
-// Creates a dictionary that can be used to query the keystore.
-// Ownership follows the Create rule.
-CFDictionaryRef CreateGenericPasswordQuery(UInt32 serviceNameLength,
-                                           const char* serviceName,
-                                           UInt32 accountNameLength,
-                                           const char* accountName) {
-  CFMutableDictionaryRef query =
-      CFDictionaryCreateMutable(NULL,
-                                5,
-                                &kCFTypeDictionaryKeyCallBacks,
-                                &kCFTypeDictionaryValueCallBacks);
-  // Type of element is generic password.
-  CFDictionarySetValue(query, kSecClass, kSecClassGenericPassword);
-
-  // Set the service name.
-  scoped_nsobject<NSString> service_name_ns(
-      [[NSString alloc] initWithBytes:serviceName
-                               length:serviceNameLength
-                             encoding:NSUTF8StringEncoding]);
-  CFDictionarySetValue(query, kSecAttrService,
-                       base::mac::NSToCFCast(service_name_ns));
-
-  // Set the account name.
-  scoped_nsobject<NSString> account_name_ns(
-      [[NSString alloc] initWithBytes:accountName
-                               length:accountNameLength
-                             encoding:NSUTF8StringEncoding]);
-  CFDictionarySetValue(query, kSecAttrAccount,
-                       base::mac::NSToCFCast(account_name_ns));
-
-  // Use the proper search constants, return only the data of the first match.
-  CFDictionarySetValue(query, kSecMatchLimit, kSecMatchLimitOne);
-  CFDictionarySetValue(query, kSecReturnData, kCFBooleanTrue);
-  return query;
-}
-
-// Creates a dictionary conatining the data to save into the keychain.
-// Ownership follows the Create rule.
-CFDictionaryRef CreateKeychainData(UInt32 serviceNameLength,
-                                   const char* serviceName,
-                                   UInt32 accountNameLength,
-                                   const char* accountName,
-                                   UInt32 passwordLength,
-                                   const void* passwordData,
-                                   KeychainAction action) {
-  CFMutableDictionaryRef keychain_data =
-      CFDictionaryCreateMutable(NULL,
-                                0,
-                                &kCFTypeDictionaryKeyCallBacks,
-                                &kCFTypeDictionaryValueCallBacks);
-
-  // Set the password.
-  NSData* password = [NSData dataWithBytes:passwordData length:passwordLength];
-  CFDictionarySetValue(keychain_data, kSecValueData,
-                       base::mac::NSToCFCast(password));
-
-  // If this is not a creation, no structural information is needed.
-  if (action != kKeychainActionCreate)
-    return keychain_data;
-
-  // Set the type of the data.
-  CFDictionarySetValue(keychain_data, kSecClass, kSecClassGenericPassword);
-
-  // Only allow access when the device has been unlocked.
-  CFDictionarySetValue(keychain_data,
-                       kSecAttrAccessible,
-                       kSecAttrAccessibleWhenUnlocked);
-
-  // Set the service name.
-  scoped_nsobject<NSString> service_name_ns(
-      [[NSString alloc] initWithBytes:serviceName
-                               length:serviceNameLength
-                             encoding:NSUTF8StringEncoding]);
-  CFDictionarySetValue(keychain_data, kSecAttrService,
-                       base::mac::NSToCFCast(service_name_ns));
-
-  // Set the account name.
-  scoped_nsobject<NSString> account_name_ns(
-      [[NSString alloc] initWithBytes:accountName
-                               length:accountNameLength
-                             encoding:NSUTF8StringEncoding]);
-  CFDictionarySetValue(keychain_data, kSecAttrAccount,
-                       base::mac::NSToCFCast(account_name_ns));
-
-  return keychain_data;
-}
-
-}  // namespace
-
-namespace crypto {
-
-AppleKeychain::AppleKeychain() {}
-
-AppleKeychain::~AppleKeychain() {}
-
-OSStatus AppleKeychain::ItemFreeContent(SecKeychainAttributeList* attrList,
-                                        void* data) const {
-  free(data);
-  return noErr;
-}
-
-OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain,
-                                           UInt32 serviceNameLength,
-                                           const char* serviceName,
-                                           UInt32 accountNameLength,
-                                           const char* accountName,
-                                           UInt32 passwordLength,
-                                           const void* passwordData,
-                                           SecKeychainItemRef* itemRef) const {
-  base::mac::ScopedCFTypeRef<CFDictionaryRef> query(
-      CreateGenericPasswordQuery(serviceNameLength,
-                                 serviceName,
-                                 accountNameLength,
-                                 accountName));
-  // Check that there is not already a password.
-  OSStatus status = SecItemCopyMatching(query, NULL);
-  if (status == errSecItemNotFound) {
-    // A new entry must be created.
-    base::mac::ScopedCFTypeRef<CFDictionaryRef> keychain_data(
-        CreateKeychainData(serviceNameLength,
-                           serviceName,
-                           accountNameLength,
-                           accountName,
-                           passwordLength,
-                           passwordData,
-                           kKeychainActionCreate));
-    status = SecItemAdd(keychain_data, NULL);
-  } else if (status == noErr) {
-    // The entry must be updated.
-    base::mac::ScopedCFTypeRef<CFDictionaryRef> keychain_data(
-        CreateKeychainData(serviceNameLength,
-                           serviceName,
-                           accountNameLength,
-                           accountName,
-                           passwordLength,
-                           passwordData,
-                           kKeychainActionUpdate));
-    status = SecItemUpdate(query, keychain_data);
-  }
-
-  return status;
-}
-
-OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray,
-                                            UInt32 serviceNameLength,
-                                            const char* serviceName,
-                                            UInt32 accountNameLength,
-                                            const char* accountName,
-                                            UInt32* passwordLength,
-                                            void** passwordData,
-                                            SecKeychainItemRef* itemRef) const {
-  DCHECK((passwordData && passwordLength) ||
-         (!passwordData && !passwordLength));
-  base::mac::ScopedCFTypeRef<CFDictionaryRef> query(
-      CreateGenericPasswordQuery(serviceNameLength,
-                                 serviceName,
-                                 accountNameLength,
-                                 accountName));
-
-  // Get the keychain item containing the password.
-  CFTypeRef resultRef = NULL;
-  OSStatus status = SecItemCopyMatching(query, &resultRef);
-  base::mac::ScopedCFTypeRef<CFTypeRef> result(resultRef);
-
-  if (status != noErr) {
-    if (passwordData) {
-      *passwordData = NULL;
-      *passwordLength = 0;
-    }
-    return status;
-  }
-
-  if (passwordData) {
-    CFDataRef data = base::mac::CFCast<CFDataRef>(result);
-    NSUInteger length = CFDataGetLength(data);
-    *passwordData = malloc(length * sizeof(UInt8));
-    CFDataGetBytes(data, CFRangeMake(0, length), (UInt8*)*passwordData);
-    *passwordLength = length;
-  }
-  return status;
-}
-
-}  // namespace crypto
diff --git a/src/crypto/apple_keychain_mac.mm b/src/crypto/apple_keychain_mac.mm
deleted file mode 100644
index 240c320..0000000
--- a/src/crypto/apple_keychain_mac.mm
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 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 "crypto/apple_keychain.h"
-
-#import <Foundation/Foundation.h>
-
-#include "base/synchronization/lock.h"
-#include "crypto/mac_security_services_lock.h"
-
-namespace crypto {
-
-AppleKeychain::AppleKeychain() {}
-
-AppleKeychain::~AppleKeychain() {}
-
-OSStatus AppleKeychain::ItemCopyAttributesAndData(
-    SecKeychainItemRef itemRef,
-    SecKeychainAttributeInfo* info,
-    SecItemClass* itemClass,
-    SecKeychainAttributeList** attrList,
-    UInt32* length,
-    void** outData) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass,
-                                              attrList, length, outData);
-}
-
-OSStatus AppleKeychain::ItemModifyAttributesAndData(
-    SecKeychainItemRef itemRef,
-    const SecKeychainAttributeList* attrList,
-    UInt32 length,
-    const void* data) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainItemModifyAttributesAndData(itemRef, attrList, length,
-                                                data);
-}
-
-OSStatus AppleKeychain::ItemFreeAttributesAndData(
-    SecKeychainAttributeList* attrList,
-    void* data) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainItemFreeAttributesAndData(attrList, data);
-}
-
-OSStatus AppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainItemDelete(itemRef);
-}
-
-OSStatus AppleKeychain::SearchCreateFromAttributes(
-    CFTypeRef keychainOrArray,
-    SecItemClass itemClass,
-    const SecKeychainAttributeList* attrList,
-    SecKeychainSearchRef* searchRef) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainSearchCreateFromAttributes(keychainOrArray, itemClass,
-                                               attrList, searchRef);
-}
-
-OSStatus AppleKeychain::SearchCopyNext(SecKeychainSearchRef searchRef,
-                                       SecKeychainItemRef* itemRef) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainSearchCopyNext(searchRef, itemRef);
-}
-
-OSStatus AppleKeychain::AddInternetPassword(
-    SecKeychainRef keychain,
-    UInt32 serverNameLength,
-    const char* serverName,
-    UInt32 securityDomainLength,
-    const char* securityDomain,
-    UInt32 accountNameLength,
-    const char* accountName,
-    UInt32 pathLength,
-    const char* path,
-    UInt16 port,
-    SecProtocolType protocol,
-    SecAuthenticationType authenticationType,
-    UInt32 passwordLength,
-    const void* passwordData,
-    SecKeychainItemRef* itemRef) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainAddInternetPassword(keychain,
-                                        serverNameLength, serverName,
-                                        securityDomainLength, securityDomain,
-                                        accountNameLength, accountName,
-                                        pathLength, path,
-                                        port, protocol, authenticationType,
-                                        passwordLength, passwordData,
-                                        itemRef);
-}
-
-OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray,
-                                            UInt32 serviceNameLength,
-                                            const char* serviceName,
-                                            UInt32 accountNameLength,
-                                            const char* accountName,
-                                            UInt32* passwordLength,
-                                            void** passwordData,
-                                            SecKeychainItemRef* itemRef) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainFindGenericPassword(keychainOrArray,
-                                        serviceNameLength,
-                                        serviceName,
-                                        accountNameLength,
-                                        accountName,
-                                        passwordLength,
-                                        passwordData,
-                                        itemRef);
-}
-
-OSStatus AppleKeychain::ItemFreeContent(SecKeychainAttributeList* attrList,
-                                        void* data) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainItemFreeContent(attrList, data);
-}
-
-OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain,
-                                           UInt32 serviceNameLength,
-                                           const char* serviceName,
-                                           UInt32 accountNameLength,
-                                           const char* accountName,
-                                           UInt32 passwordLength,
-                                           const void* passwordData,
-                                           SecKeychainItemRef* itemRef) const {
-  base::AutoLock lock(GetMacSecurityServicesLock());
-  return SecKeychainAddGenericPassword(keychain,
-                                       serviceNameLength,
-                                       serviceName,
-                                       accountNameLength,
-                                       accountName,
-                                       passwordLength,
-                                       passwordData,
-                                       itemRef);
-}
-
-void AppleKeychain::Free(CFTypeRef ref) const {
-  if (ref)
-    CFRelease(ref);
-}
-
-}  // namespace crypto
diff --git a/src/crypto/capi_util.cc b/src/crypto/capi_util.cc
deleted file mode 100644
index 2cf1062..0000000
--- a/src/crypto/capi_util.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2011 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 "crypto/capi_util.h"
-
-#include "base/basictypes.h"
-#include "base/memory/singleton.h"
-#include "base/synchronization/lock.h"
-
-namespace {
-
-class CAPIUtilSingleton {
- public:
-  static CAPIUtilSingleton* GetInstance() {
-    return Singleton<CAPIUtilSingleton>::get();
-  }
-
-  // Returns a lock to guard calls to CryptAcquireContext with
-  // CRYPT_DELETEKEYSET or CRYPT_NEWKEYSET.
-  base::Lock& acquire_context_lock() {
-    return acquire_context_lock_;
-  }
-
- private:
-  friend class Singleton<CAPIUtilSingleton>;
-  friend struct DefaultSingletonTraits<CAPIUtilSingleton>;
-
-  CAPIUtilSingleton() {}
-
-  base::Lock acquire_context_lock_;
-
-  DISALLOW_COPY_AND_ASSIGN(CAPIUtilSingleton);
-};
-
-}  // namespace
-
-namespace crypto {
-
-BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
-                               LPCWSTR container,
-                               LPCWSTR provider,
-                               DWORD prov_type,
-                               DWORD flags) {
-  base::AutoLock lock(CAPIUtilSingleton::GetInstance()->acquire_context_lock());
-  return CryptAcquireContext(prov, container, provider, prov_type, flags);
-}
-
-void* WINAPI CryptAlloc(size_t size) {
-  return malloc(size);
-}
-
-void WINAPI CryptFree(void* p) {
-  free(p);
-}
-
-}  // namespace crypto
diff --git a/src/crypto/capi_util.h b/src/crypto/capi_util.h
deleted file mode 100644
index 09a44e7..0000000
--- a/src/crypto/capi_util.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 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 CRYPTO_CAPI_UTIL_H_
-#define CRYPTO_CAPI_UTIL_H_
-
-#include <windows.h>
-#include <wincrypt.h>
-
-#include "crypto/crypto_export.h"
-
-namespace crypto {
-
-// CryptAcquireContext when passed CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET in
-// flags is not thread-safe. For such calls, we create a global lock to
-// synchronize it.
-//
-// From "Threading Issues with Cryptographic Service Providers",
-// <http://msdn.microsoft.com/en-us/library/aa388149(v=VS.85).aspx>:
-//
-// "The CryptAcquireContext function is generally thread safe unless
-// CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET is specified in the dwFlags
-// parameter."
-CRYPTO_EXPORT BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
-                                             LPCWSTR container,
-                                             LPCWSTR provider,
-                                             DWORD prov_type,
-                                             DWORD flags);
-
-// Wrappers of malloc and free for CryptoAPI routines that need memory
-// allocators, such as in CRYPT_DECODE_PARA. Such routines require WINAPI
-// calling conventions.
-CRYPTO_EXPORT void* WINAPI CryptAlloc(size_t size);
-CRYPTO_EXPORT void WINAPI CryptFree(void* p);
-
-}  // namespace crypto
-
-#endif  // CRYPTO_CAPI_UTIL_H_
diff --git a/src/crypto/crypto.gyp b/src/crypto/crypto.gyp
index 0925b7f..9409336 100644
--- a/src/crypto/crypto.gyp
+++ b/src/crypto/crypto.gyp
@@ -1,23 +1,6 @@
-# Copyright (c) 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.
-
 {
   'variables': {
     'chromium_code': 1,
-    # Put all transitive dependencies for Windows HMAC here.
-    # This is required so that we can build them for nacl win64.
-    'hmac_win64_related_sources': [
-      'hmac.cc',
-      'hmac.h',
-      'hmac_win.cc',
-      'secure_util.cc',
-      'secure_util.h',
-      'symmetric_key.h',
-      'symmetric_key_win.cc',
-      'third_party/nss/chromium-sha256.h',
-      'third_party/nss/sha512.cc',
-    ],
   },
   'targets': [
     {
@@ -27,6 +10,8 @@
       'dependencies': [
         '../base/base.gyp:base',
         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
+        '../third_party/openssl/openssl.gyp:openssl',
+        '<(DEPTH)/starboard/starboard.gyp:starboard',
       ],
       'defines': [
         'CRYPTO_IMPLEMENTATION',
@@ -34,236 +19,53 @@
       'msvs_disabled_warnings': [
         4018,
       ],
-      'conditions': [
-        [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and OS != "lb_shell"', {
-          'dependencies': [
-            '../build/linux/system.gyp:ssl',
-          ],
-          'export_dependent_settings': [
-            '../build/linux/system.gyp:ssl',
-          ],
-          'conditions': [
-            [ 'chromeos==1', {
-                'sources/': [ ['include', '_chromeos\\.cc$'] ]
-              },
-            ],
-          ],
-        }, {  # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android"
-            'sources/': [
-              ['exclude', '_nss\.cc$'],
-              ['include', 'ec_private_key_nss\.cc$'],
-              ['include', 'ec_signature_creator_nss\.cc$'],
-              ['include', 'encryptor_nss\.cc$'],
-              ['include', 'hmac_nss\.cc$'],
-              ['include', 'signature_verifier_nss\.cc$'],
-              ['include', 'symmetric_key_nss\.cc$'],
-            ],
-            'sources!': [
-              'hmac_win.cc',
-              'openpgp_symmetric_encryption.cc',
-              'openpgp_symmetric_encryption.h',
-              'symmetric_key_win.cc',
-            ],
-        }],
-        [ 'OS != "mac" and OS != "ios"', {
-          'sources!': [
-            'apple_keychain.h',
-            'mock_apple_keychain.cc',
-            'mock_apple_keychain.h',
-          ],
-        }],
-        [ 'OS == "android"', {
-            'dependencies': [
-              '../third_party/openssl/openssl.gyp:openssl',
-            ],
-            'sources/': [
-              ['exclude', 'ec_private_key_nss\.cc$'],
-              ['exclude', 'ec_signature_creator_nss\.cc$'],
-              ['exclude', 'encryptor_nss\.cc$'],
-              ['exclude', 'hmac_nss\.cc$'],
-              ['exclude', 'signature_verifier_nss\.cc$'],
-              ['exclude', 'symmetric_key_nss\.cc$'],
-            ],
-        }],
-        [ 'os_bsd==1', {
-          'link_settings': {
-            'libraries': [
-              '-L/usr/local/lib -lexecinfo',
-              ],
-            },
-          },
-        ],
-        [ 'OS == "ios"', {
-          'sources!': [
-            # This class is stubbed out on iOS.
-            'rsa_private_key.cc',
-          ],
-        }],
-        [ 'OS == "mac"', {
-          'link_settings': {
-            'libraries': [
-              '$(SDKROOT)/System/Library/Frameworks/Security.framework',
-            ],
-          },
-        }, {  # OS != "mac"
-          'sources!': [
-            'cssm_init.cc',
-            'cssm_init.h',
-            'mac_security_services_lock.cc',
-            'mac_security_services_lock.h',
-          ],
-        }],
-        [ 'OS == "mac" or OS == "ios" or OS == "win"', {
-          'dependencies': [
-            '../third_party/nss/nss.gyp:nspr',
-            '../third_party/nss/nss.gyp:nss',
-          ],
-          'export_dependent_settings': [
-            '../third_party/nss/nss.gyp:nspr',
-            '../third_party/nss/nss.gyp:nss',
-          ],
-        }],
-        [ 'OS != "win"', {
-          'sources!': [
-            'capi_util.h',
-            'capi_util.cc',
-          ],
-        }],
-        ['OS == "lb_shell"', {
-          'dependencies' : [
-            '<(lbshell_root)/build/projects/posix_emulation.gyp:posix_emulation',
-          ],
-        }],
-        ['OS == "starboard"', {
-          'dependencies' : [
-            '<(DEPTH)/starboard/starboard.gyp:starboard',
-          ],
-        }],
-        ['OS == "lb_shell" or OS == "starboard"', {
-          'dependencies' : [
-            '../third_party/openssl/openssl.gyp:openssl',
-          ],
-          'sources/': [
-            ['exclude', '_nss.cc$'],
-          ],
-        }],
-        [ 'use_openssl==1', {
-            # TODO(joth): Use a glob to match exclude patterns once the
-            #             OpenSSL file set is complete.
-            'sources!': [
-              'ec_private_key_nss.cc',
-              'ec_signature_creator_nss.cc',
-              'encryptor_nss.cc',
-              'hmac_nss.cc',
-              'nss_util.cc',
-              'nss_util.h',
-              'openpgp_symmetric_encryption.cc',
-              'rsa_private_key_nss.cc',
-              'secure_hash_default.cc',
-              'signature_creator_nss.cc',
-              'signature_verifier_nss.cc',
-              'symmetric_key_nss.cc',
-              'third_party/nss/chromium-blapi.h',
-              'third_party/nss/chromium-blapit.h',
-              'third_party/nss/chromium-nss.h',
-              'third_party/nss/chromium-sha256.h',
-              'third_party/nss/pk11akey.cc',
-              'third_party/nss/secsign.cc',
-              'third_party/nss/sha512.cc',
-            ],
-          }, {
-            'sources!': [
-              'ec_private_key_openssl.cc',
-              'ec_signature_creator_openssl.cc',
-              'encryptor_openssl.cc',
-              'hmac_openssl.cc',
-              'openssl_util.cc',
-              'openssl_util.h',
-              'rsa_private_key_openssl.cc',
-              'secure_hash_openssl.cc',
-              'signature_creator_openssl.cc',
-              'signature_verifier_openssl.cc',
-              'symmetric_key_openssl.cc',
-            ],
-        },],
-      ],
       'sources': [
-        # NOTE: all transitive dependencies of HMAC on windows need
-        #     to be placed in the source list above.
-        '<@(hmac_win64_related_sources)',
-        'apple_keychain.h',
-        'apple_keychain_ios.mm',
-        'apple_keychain_mac.mm',
-        'capi_util.cc',
-        'capi_util.h',
         'crypto_export.h',
         'crypto_module_blocking_password_delegate.h',
-        'cssm_init.cc',
-        'cssm_init.h',
-        'ghash.cc',
-        'ghash.h',
         'ec_private_key.h',
-        'ec_private_key_nss.cc',
         'ec_private_key_openssl.cc',
         'ec_signature_creator.cc',
         'ec_signature_creator.h',
         'ec_signature_creator_impl.h',
-        'ec_signature_creator_nss.cc',
         'ec_signature_creator_openssl.cc',
         'encryptor.cc',
         'encryptor.h',
-        'encryptor_nss.cc',
         'encryptor_openssl.cc',
-        'hmac_nss.cc',
+        'ghash.cc',
+        'ghash.h',
+        'hmac.cc',
+        'hmac.h',
         'hmac_openssl.cc',
-        'mac_security_services_lock.cc',
-        'mac_security_services_lock.h',
-        'mock_apple_keychain.cc',
-        'mock_apple_keychain.h',
-        'mock_apple_keychain_ios.cc',
-        'mock_apple_keychain_mac.cc',
-        'p224_spake.cc',
-        'p224_spake.h',
-        'nss_util.cc',
-        'nss_util.h',
-        'nss_util_internal.h',
-        'openpgp_symmetric_encryption.cc',
-        'openpgp_symmetric_encryption.h',
         'openssl_util.cc',
         'openssl_util.h',
         'p224.cc',
         'p224.h',
-        'random.h',
+        'p224_spake.cc',
+        'p224_spake.h',
         'random.cc',
+        'random.h',
         'rsa_private_key.cc',
         'rsa_private_key.h',
         'rsa_private_key_ios.cc',
         'rsa_private_key_mac.cc',
-        'rsa_private_key_nss.cc',
         'rsa_private_key_openssl.cc',
         'rsa_private_key_win.cc',
         'scoped_capi_types.h',
         'scoped_nss_types.h',
         'secure_hash.h',
-        'secure_hash_default.cc',
         'secure_hash_openssl.cc',
+        'secure_util.cc',
+        'secure_util.h',
         'sha2.cc',
         'sha2.h',
         'signature_creator.h',
         'signature_creator_mac.cc',
-        'signature_creator_nss.cc',
         'signature_creator_openssl.cc',
         'signature_creator_win.cc',
         'signature_verifier.h',
-        'signature_verifier_nss.cc',
         'signature_verifier_openssl.cc',
-        'symmetric_key_nss.cc',
+        'symmetric_key.h',
         'symmetric_key_openssl.cc',
-        'third_party/nss/chromium-blapi.h',
-        'third_party/nss/chromium-blapit.h',
-        'third_party/nss/chromium-nss.h',
-        'third_party/nss/pk11akey.cc',
-        'third_party/nss/secsign.cc',
       ],
     },
     {
@@ -279,18 +81,15 @@
         'encryptor_unittest.cc',
         'ghash_unittest.cc',
         'hmac_unittest.cc',
-        'nss_util_unittest.cc',
         'p224_unittest.cc',
         'p224_spake_unittest.cc',
         'random_unittest.cc',
         'rsa_private_key_unittest.cc',
-        'rsa_private_key_nss_unittest.cc',
         'secure_hash_unittest.cc',
         'sha2_unittest.cc',
         'signature_creator_unittest.cc',
         'signature_verifier_unittest.cc',
         'symmetric_key_unittest.cc',
-        'openpgp_symmetric_encryption_unittest.cc',
       ],
       'dependencies': [
         'crypto',
@@ -299,85 +98,9 @@
         '../testing/gmock.gyp:gmock',
         '../testing/gtest.gyp:gtest',
       ],
-      'conditions': [
-        [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios" and OS != "lb_shell"', {
-          'conditions': [
-            [ 'linux_use_tcmalloc==1', {
-                'dependencies': [
-                  '../base/allocator/allocator.gyp:allocator',
-                ],
-              },
-            ],
-          ],
-          'dependencies': [
-            '../build/linux/system.gyp:ssl',
-          ],
-        }, {  # os_posix != 1 or OS == "mac" or OS == "android" or OS == "ios"
-          'sources!': [
-            'rsa_private_key_nss_unittest.cc',
-            'openpgp_symmetric_encryption_unittest.cc',
-          ]
-        }],
-        [ 'OS == "mac" or OS == "ios" or OS == "win"', {
-          'dependencies': [
-            '../third_party/nss/nss.gyp:nss',
-          ],
-        }],
-        ['OS == "ios"', {
-          'sources!': [
-            # These tests are excluded because they test classes that are not
-            # implemented on iOS.
-            'rsa_private_key_unittest.cc',
-            'signature_creator_unittest.cc',
-            'signature_verifier_unittest.cc',
-          ],
-        }],
-        [ 'OS == "mac"', {
-          'dependencies': [
-            '../third_party/nss/nss.gyp:nspr',
-          ],
-        }],
-        [ 'use_openssl==1', {
-          'sources!': [
-            'nss_util_unittest.cc',
-            'openpgp_symmetric_encryption_unittest.cc',
-            'rsa_private_key_nss_unittest.cc',
-          ],
-        }],
-      ],
     },
   ],
   'conditions': [
-    [ 'OS == "win"', {
-      'targets': [
-        {
-          'target_name': 'crypto_nacl_win64',
-          # We do not want nacl_helper to depend on NSS because this would
-          # require including a 64-bit copy of NSS. Thus, use the native APIs
-          # for the helper.
-          'type': '<(component)',
-          'dependencies': [
-            '../base/base.gyp:base_nacl_win64',
-            '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
-          ],
-          'sources': [
-            '<@(hmac_win64_related_sources)',
-          ],
-          'defines': [
-           'CRYPTO_IMPLEMENTATION',
-           '<@(nacl_win64_defines)',
-          ],
-          'msvs_disabled_warnings': [
-            4018,
-          ],
-          'configurations': {
-            'Common_Base': {
-              'msvs_target_platform': 'x64',
-            },
-          },
-        },
-      ],
-    }],
     ['cobalt==1', {
       'targets': [
         {
diff --git a/src/crypto/cssm_init.cc b/src/crypto/cssm_init.cc
deleted file mode 100644
index cf5ac25..0000000
--- a/src/crypto/cssm_init.cc
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright (c) 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 "crypto/cssm_init.h"
-
-#include <Security/SecBase.h>
-
-#include "base/logging.h"
-#include "base/mac/scoped_cftyperef.h"
-#include "base/memory/singleton.h"
-#include "base/sys_string_conversions.h"
-
-// When writing crypto code for Mac OS X, you may find the following
-// documentation useful:
-// - Common Security: CDSA and CSSM, Version 2 (with corrigenda)
-//   http://www.opengroup.org/security/cdsa.htm
-// - Apple Cryptographic Service Provider Functional Specification
-// - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/
-
-namespace {
-
-void* CSSMMalloc(CSSM_SIZE size, void* alloc_ref) {
-  return malloc(size);
-}
-
-void CSSMFree(void* mem_ptr, void* alloc_ref) {
-  free(mem_ptr);
-}
-
-void* CSSMRealloc(void* ptr, CSSM_SIZE size, void* alloc_ref) {
-  return realloc(ptr, size);
-}
-
-void* CSSMCalloc(uint32 num, CSSM_SIZE size, void* alloc_ref) {
-  return calloc(num, size);
-}
-
-class CSSMInitSingleton {
- public:
-  static CSSMInitSingleton* GetInstance() {
-    return Singleton<CSSMInitSingleton,
-                     LeakySingletonTraits<CSSMInitSingleton> >::get();
-  }
-
-  CSSM_CSP_HANDLE csp_handle() const { return csp_handle_; }
-  CSSM_CL_HANDLE cl_handle() const { return cl_handle_; }
-  CSSM_TP_HANDLE tp_handle() const { return tp_handle_; }
-
- private:
-  CSSMInitSingleton()
-      : inited_(false), csp_loaded_(false), cl_loaded_(false),
-        tp_loaded_(false), csp_handle_(CSSM_INVALID_HANDLE),
-        cl_handle_(CSSM_INVALID_HANDLE), tp_handle_(CSSM_INVALID_HANDLE) {
-    static CSSM_VERSION version = {2, 0};
-    // TODO(wtc): what should our caller GUID be?
-    static const CSSM_GUID test_guid = {
-      0xFADE, 0, 0, { 1, 2, 3, 4, 5, 6, 7, 0 }
-    };
-    CSSM_RETURN crtn;
-    CSSM_PVC_MODE pvc_policy = CSSM_PVC_NONE;
-    crtn = CSSM_Init(&version, CSSM_PRIVILEGE_SCOPE_NONE, &test_guid,
-                     CSSM_KEY_HIERARCHY_NONE, &pvc_policy, NULL);
-    if (crtn) {
-      NOTREACHED();
-      return;
-    }
-    inited_ = true;
-
-    crtn = CSSM_ModuleLoad(&gGuidAppleCSP, CSSM_KEY_HIERARCHY_NONE, NULL, NULL);
-    if (crtn) {
-      NOTREACHED();
-      return;
-    }
-    csp_loaded_ = true;
-    crtn = CSSM_ModuleLoad(
-        &gGuidAppleX509CL, CSSM_KEY_HIERARCHY_NONE, NULL, NULL);
-    if (crtn) {
-      NOTREACHED();
-      return;
-    }
-    cl_loaded_ = true;
-    crtn = CSSM_ModuleLoad(
-        &gGuidAppleX509TP, CSSM_KEY_HIERARCHY_NONE, NULL, NULL);
-    if (crtn) {
-      NOTREACHED();
-      return;
-    }
-    tp_loaded_ = true;
-
-    const CSSM_API_MEMORY_FUNCS cssmMemoryFunctions = {
-      CSSMMalloc,
-      CSSMFree,
-      CSSMRealloc,
-      CSSMCalloc,
-      NULL
-    };
-
-    crtn = CSSM_ModuleAttach(&gGuidAppleCSP, &version, &cssmMemoryFunctions, 0,
-                             CSSM_SERVICE_CSP, 0, CSSM_KEY_HIERARCHY_NONE,
-                             NULL, 0, NULL, &csp_handle_);
-    DCHECK_EQ(CSSM_OK, crtn);
-    crtn = CSSM_ModuleAttach(&gGuidAppleX509CL, &version, &cssmMemoryFunctions,
-                             0, CSSM_SERVICE_CL, 0, CSSM_KEY_HIERARCHY_NONE,
-                             NULL, 0, NULL, &cl_handle_);
-    DCHECK_EQ(CSSM_OK, crtn);
-    crtn = CSSM_ModuleAttach(&gGuidAppleX509TP, &version, &cssmMemoryFunctions,
-                             0, CSSM_SERVICE_TP, 0, CSSM_KEY_HIERARCHY_NONE,
-                             NULL, 0, NULL, &tp_handle_);
-    DCHECK_EQ(CSSM_OK, crtn);
-  }
-
-  ~CSSMInitSingleton() {
-    CSSM_RETURN crtn;
-    if (csp_handle_) {
-      CSSM_RETURN crtn = CSSM_ModuleDetach(csp_handle_);
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-    if (cl_handle_) {
-      CSSM_RETURN crtn = CSSM_ModuleDetach(cl_handle_);
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-    if (tp_handle_) {
-      CSSM_RETURN crtn = CSSM_ModuleDetach(tp_handle_);
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-    if (csp_loaded_) {
-      crtn = CSSM_ModuleUnload(&gGuidAppleCSP, NULL, NULL);
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-    if (cl_loaded_) {
-      crtn = CSSM_ModuleUnload(&gGuidAppleX509CL, NULL, NULL);
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-    if (tp_loaded_) {
-      crtn = CSSM_ModuleUnload(&gGuidAppleX509TP, NULL, NULL);
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-    if (inited_) {
-      crtn = CSSM_Terminate();
-      DCHECK_EQ(CSSM_OK, crtn);
-    }
-  }
-
-  bool inited_;  // True if CSSM_Init has been called successfully.
-  bool csp_loaded_;  // True if gGuidAppleCSP has been loaded
-  bool cl_loaded_;  // True if gGuidAppleX509CL has been loaded.
-  bool tp_loaded_;  // True if gGuidAppleX509TP has been loaded.
-  CSSM_CSP_HANDLE csp_handle_;
-  CSSM_CL_HANDLE cl_handle_;
-  CSSM_TP_HANDLE tp_handle_;
-
-  friend struct DefaultSingletonTraits<CSSMInitSingleton>;
-};
-
-}  // namespace
-
-namespace crypto {
-
-void EnsureCSSMInit() {
-  CSSMInitSingleton::GetInstance();
-}
-
-CSSM_CSP_HANDLE GetSharedCSPHandle() {
-  return CSSMInitSingleton::GetInstance()->csp_handle();
-}
-
-CSSM_CL_HANDLE GetSharedCLHandle() {
-  return CSSMInitSingleton::GetInstance()->cl_handle();
-}
-
-CSSM_TP_HANDLE GetSharedTPHandle() {
-  return CSSMInitSingleton::GetInstance()->tp_handle();
-}
-
-void* CSSMMalloc(CSSM_SIZE size) {
-  return ::CSSMMalloc(size, NULL);
-}
-
-void CSSMFree(void* ptr) {
-  ::CSSMFree(ptr, NULL);
-}
-
-void LogCSSMError(const char* fn_name, CSSM_RETURN err) {
-  if (!err)
-    return;
-  base::mac::ScopedCFTypeRef<CFStringRef> cfstr(
-      SecCopyErrorMessageString(err, NULL));
-  LOG(ERROR) << fn_name << " returned " << err
-             << " (" << base::SysCFStringRefToUTF8(cfstr) << ")";
-}
-
-ScopedCSSMData::ScopedCSSMData() {
-  memset(&data_, 0, sizeof(data_));
-}
-
-ScopedCSSMData::~ScopedCSSMData() {
-  if (data_.Data) {
-    CSSMFree(data_.Data);
-    data_.Data = NULL;
-  }
-}
-
-}  // namespace crypto
diff --git a/src/crypto/cssm_init.h b/src/crypto/cssm_init.h
deleted file mode 100644
index e711099..0000000
--- a/src/crypto/cssm_init.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 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 CRYPTO_CSSM_INIT_H_
-#define CRYPTO_CSSM_INIT_H_
-
-#include <Security/cssm.h>
-
-#include "base/basictypes.h"
-#include "crypto/crypto_export.h"
-
-namespace crypto {
-
-// Initialize CSSM if it isn't already initialized.  This must be called before
-// any other CSSM functions.  This function is thread-safe, and CSSM will only
-// ever be initialized once.  CSSM will be properly shut down on program exit.
-CRYPTO_EXPORT void EnsureCSSMInit();
-
-// Returns the shared CSP handle used by CSSM functions.
-CRYPTO_EXPORT CSSM_CSP_HANDLE GetSharedCSPHandle();
-
-// Returns the shared CL handle used by CSSM functions.
-CRYPTO_EXPORT CSSM_CL_HANDLE GetSharedCLHandle();
-
-// Returns the shared TP handle used by CSSM functions.
-CRYPTO_EXPORT CSSM_TP_HANDLE GetSharedTPHandle();
-
-// Set of pointers to memory function wrappers that are required for CSSM
-extern const CSSM_API_MEMORY_FUNCS kCssmMemoryFunctions;
-
-// Utility function to log an error message including the error name.
-CRYPTO_EXPORT void LogCSSMError(const char *function_name, CSSM_RETURN err);
-
-// Utility functions to allocate and release CSSM memory.
-void* CSSMMalloc(CSSM_SIZE size);
-CRYPTO_EXPORT void CSSMFree(void* ptr);
-
-// Wrapper class for CSSM_DATA type. This should only be used when using the
-// CL/TP/CSP handles from above, since that's the only time we're guaranteed (or
-// supposed to be guaranteed) that our memory management functions will be used.
-// Apple's Sec* APIs manage their own memory so it shouldn't be used for those.
-// The constructor initializes data_ to zero and the destructor releases the
-// data properly.
-class ScopedCSSMData {
- public:
-  ScopedCSSMData();
-  ~ScopedCSSMData();
-  operator CSSM_DATA*() { return &data_; }
-  CSSM_DATA* operator ->() { return &data_; }
-
- private:
-  CSSM_DATA data_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScopedCSSMData);
-};
-
-}  // namespace crypto
-
-#endif  // CRYPTO_CSSM_INIT_H_
diff --git a/src/crypto/ec_private_key_nss.cc b/src/crypto/ec_private_key_nss.cc
deleted file mode 100644
index 9bb9df1..0000000
--- a/src/crypto/ec_private_key_nss.cc
+++ /dev/null
@@ -1,365 +0,0 @@
-// Copyright (c) 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 "crypto/ec_private_key.h"
-
-extern "C" {
-// Work around NSS missing SEC_BEGIN_PROTOS in secmodt.h.  This must come before
-// other NSS headers.
-#include <secmodt.h>
-}
-
-#include <cryptohi.h>
-#include <keyhi.h>
-#include <pk11pub.h>
-#include <secmod.h>
-
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "crypto/nss_util.h"
-#include "crypto/nss_util_internal.h"
-#include "crypto/scoped_nss_types.h"
-#include "crypto/third_party/nss/chromium-nss.h"
-
-namespace {
-
-PK11SlotInfo* GetKeySlot() {
-  return crypto::GetPublicNSSKeySlot();
-}
-
-class EllipticCurveSupportChecker {
- public:
-  EllipticCurveSupportChecker() {
-    // NOTE: we can do this check here only because we use the NSS internal
-    // slot.  If we support other slots in the future, checking whether they
-    // support ECDSA may block NSS, and the value may also change as devices are
-    // inserted/removed, so we would need to re-check on every use.
-    crypto::EnsureNSSInit();
-    crypto::ScopedPK11Slot slot(GetKeySlot());
-    supported_ = PK11_DoesMechanism(slot.get(), CKM_EC_KEY_PAIR_GEN) &&
-        PK11_DoesMechanism(slot.get(), CKM_ECDSA);
-  }
-
-  bool Supported() {
-    return supported_;
-  }
-
- private:
-  bool supported_;
-};
-
-static base::LazyInstance<EllipticCurveSupportChecker>::Leaky
-    g_elliptic_curve_supported = LAZY_INSTANCE_INITIALIZER;
-
-// Copied from rsa_private_key_nss.cc.
-static bool ReadAttribute(SECKEYPrivateKey* key,
-                          CK_ATTRIBUTE_TYPE type,
-                          std::vector<uint8>* output) {
-  SECItem item;
-  SECStatus rv;
-  rv = PK11_ReadRawAttribute(PK11_TypePrivKey, key, type, &item);
-  if (rv != SECSuccess) {
-    DLOG(ERROR) << "PK11_ReadRawAttribute: " << PORT_GetError();
-    return false;
-  }
-
-  output->assign(item.data, item.data + item.len);
-  SECITEM_FreeItem(&item, PR_FALSE);
-  return true;
-}
-
-}  // namespace
-
-namespace crypto {
-
-ECPrivateKey::~ECPrivateKey() {
-  if (key_)
-    SECKEY_DestroyPrivateKey(key_);
-  if (public_key_)
-    SECKEY_DestroyPublicKey(public_key_);
-}
-
-// static
-bool ECPrivateKey::IsSupported() {
-  return g_elliptic_curve_supported.Get().Supported();
-}
-
-// static
-ECPrivateKey* ECPrivateKey::Create() {
-  return CreateWithParams(PR_FALSE /* not permanent */,
-                          PR_FALSE /* not sensitive */);
-}
-
-// static
-ECPrivateKey* ECPrivateKey::CreateSensitive() {
-#if defined(USE_NSS)
-  return CreateWithParams(PR_TRUE /* permanent */,
-                          PR_TRUE /* sensitive */);
-#else
-  // If USE_NSS is not defined, we initialize NSS with no databases, so we can't
-  // create permanent keys.
-  NOTREACHED();
-  return NULL;
-#endif
-}
-
-// static
-ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
-    const std::string& password,
-    const std::vector<uint8>& encrypted_private_key_info,
-    const std::vector<uint8>& subject_public_key_info) {
-  return CreateFromEncryptedPrivateKeyInfoWithParams(
-      password,
-      encrypted_private_key_info,
-      subject_public_key_info,
-      PR_FALSE /* not permanent */,
-      PR_FALSE /* not sensitive */);
-}
-
-// static
-ECPrivateKey* ECPrivateKey::CreateSensitiveFromEncryptedPrivateKeyInfo(
-    const std::string& password,
-    const std::vector<uint8>& encrypted_private_key_info,
-    const std::vector<uint8>& subject_public_key_info) {
-#if defined(USE_NSS)
-  return CreateFromEncryptedPrivateKeyInfoWithParams(
-      password,
-      encrypted_private_key_info,
-      subject_public_key_info,
-      PR_TRUE /* permanent */,
-      PR_TRUE /* sensitive */);
-#else
-  // If USE_NSS is not defined, we initialize NSS with no databases, so we can't
-  // create permanent keys.
-  NOTREACHED();
-  return NULL;
-#endif
-}
-
-// static
-bool ECPrivateKey::ImportFromEncryptedPrivateKeyInfo(
-    const std::string& password,
-    const uint8* encrypted_private_key_info,
-    size_t encrypted_private_key_info_len,
-    CERTSubjectPublicKeyInfo* decoded_spki,
-    bool permanent,
-    bool sensitive,
-    SECKEYPrivateKey** key,
-    SECKEYPublicKey** public_key) {
-  ScopedPK11Slot slot(GetKeySlot());
-  if (!slot.get())
-    return false;
-
-  *public_key = SECKEY_ExtractPublicKey(decoded_spki);
-
-  if (!*public_key) {
-    DLOG(ERROR) << "SECKEY_ExtractPublicKey: " << PORT_GetError();
-    return false;
-  }
-
-  SECItem encoded_epki = {
-    siBuffer,
-    const_cast<unsigned char*>(encrypted_private_key_info),
-    static_cast<unsigned>(encrypted_private_key_info_len)
-  };
-  SECKEYEncryptedPrivateKeyInfo epki;
-  memset(&epki, 0, sizeof(epki));
-
-  ScopedPLArenaPool arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
-
-  SECStatus rv = SEC_QuickDERDecodeItem(
-      arena.get(),
-      &epki,
-      SEC_ASN1_GET(SECKEY_EncryptedPrivateKeyInfoTemplate),
-      &encoded_epki);
-  if (rv != SECSuccess) {
-    DLOG(ERROR) << "SEC_QuickDERDecodeItem: " << PORT_GetError();
-    SECKEY_DestroyPublicKey(*public_key);
-    *public_key = NULL;
-    return false;
-  }
-
-  SECItem password_item = {
-    siBuffer,
-    reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())),
-    static_cast<unsigned>(password.size())
-  };
-
-  rv = ImportEncryptedECPrivateKeyInfoAndReturnKey(
-      slot.get(),
-      &epki,
-      &password_item,
-      NULL,  // nickname
-      &(*public_key)->u.ec.publicValue,
-      permanent,
-      sensitive,
-      key,
-      NULL);  // wincx
-  if (rv != SECSuccess) {
-    DLOG(ERROR) << "ImportEncryptedECPrivateKeyInfoAndReturnKey: "
-                << PORT_GetError();
-    SECKEY_DestroyPublicKey(*public_key);
-    *public_key = NULL;
-    return false;
-  }
-
-  return true;
-}
-
-bool ECPrivateKey::ExportEncryptedPrivateKey(
-    const std::string& password,
-    int iterations,
-    std::vector<uint8>* output) {
-  // We export as an EncryptedPrivateKeyInfo bundle instead of a plain PKCS #8
-  // PrivateKeyInfo because PK11_ImportDERPrivateKeyInfoAndReturnKey doesn't
-  // support EC keys.
-  // https://bugzilla.mozilla.org/show_bug.cgi?id=327773
-  SECItem password_item = {
-    siBuffer,
-    reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())),
-    static_cast<unsigned>(password.size())
-  };
-
-  SECKEYEncryptedPrivateKeyInfo* encrypted = PK11_ExportEncryptedPrivKeyInfo(
-      NULL, // Slot, optional.
-      SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC,
-      &password_item,
-      key_,
-      iterations,
-      NULL); // wincx.
-
-  if (!encrypted) {
-    DLOG(ERROR) << "PK11_ExportEncryptedPrivKeyInfo: " << PORT_GetError();
-    return false;
-  }
-
-  ScopedPLArenaPool arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
-  SECItem der_key = {siBuffer, NULL, 0};
-  SECItem* encoded_item = SEC_ASN1EncodeItem(
-      arena.get(),
-      &der_key,
-      encrypted,
-      SEC_ASN1_GET(SECKEY_EncryptedPrivateKeyInfoTemplate));
-  SECKEY_DestroyEncryptedPrivateKeyInfo(encrypted, PR_TRUE);
-  if (!encoded_item) {
-    DLOG(ERROR) << "SEC_ASN1EncodeItem: " << PORT_GetError();
-    return false;
-  }
-
-  output->assign(der_key.data, der_key.data + der_key.len);
-
-  return true;
-}
-
-bool ECPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
-  ScopedSECItem der_pubkey(
-      SECKEY_EncodeDERSubjectPublicKeyInfo(public_key_));
-  if (!der_pubkey.get()) {
-    return false;
-  }
-
-  output->assign(der_pubkey->data, der_pubkey->data + der_pubkey->len);
-  return true;
-}
-
-bool ECPrivateKey::ExportValue(std::vector<uint8>* output) {
-  return ReadAttribute(key_, CKA_VALUE, output);
-}
-
-bool ECPrivateKey::ExportECParams(std::vector<uint8>* output) {
-  return ReadAttribute(key_, CKA_EC_PARAMS, output);
-}
-
-ECPrivateKey::ECPrivateKey() : key_(NULL), public_key_(NULL) {}
-
-// static
-ECPrivateKey* ECPrivateKey::CreateWithParams(bool permanent,
-                                             bool sensitive) {
-  EnsureNSSInit();
-
-  scoped_ptr<ECPrivateKey> result(new ECPrivateKey);
-
-  ScopedPK11Slot slot(GetKeySlot());
-  if (!slot.get())
-    return NULL;
-
-  SECOidData* oid_data = SECOID_FindOIDByTag(SEC_OID_SECG_EC_SECP256R1);
-  if (!oid_data) {
-    DLOG(ERROR) << "SECOID_FindOIDByTag: " << PORT_GetError();
-    return NULL;
-  }
-
-  // SECKEYECParams is a SECItem containing the DER encoded ASN.1 ECParameters
-  // value.  For a named curve, that is just the OBJECT IDENTIFIER of the curve.
-  // In addition to the oid data, the encoding requires one byte for the ASN.1
-  // tag and one byte for the length (assuming the length is <= 127).
-  DCHECK_LE(oid_data->oid.len, 127U);
-  std::vector<unsigned char> parameters_buf(2 + oid_data->oid.len);
-  SECKEYECParams ec_parameters = {
-    siDEROID, &parameters_buf[0],
-    static_cast<unsigned>(parameters_buf.size())
-  };
-
-  ec_parameters.data[0] = SEC_ASN1_OBJECT_ID;
-  ec_parameters.data[1] = oid_data->oid.len;
-  memcpy(ec_parameters.data + 2, oid_data->oid.data, oid_data->oid.len);
-
-  result->key_ = PK11_GenerateKeyPair(slot.get(),
-                                      CKM_EC_KEY_PAIR_GEN,
-                                      &ec_parameters,
-                                      &result->public_key_,
-                                      permanent,
-                                      sensitive,
-                                      NULL);
-  if (!result->key_) {
-    DLOG(ERROR) << "PK11_GenerateKeyPair: " << PORT_GetError();
-    return NULL;
-  }
-
-  return result.release();
-}
-
-// static
-ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfoWithParams(
-    const std::string& password,
-    const std::vector<uint8>& encrypted_private_key_info,
-    const std::vector<uint8>& subject_public_key_info,
-    bool permanent,
-    bool sensitive) {
-  EnsureNSSInit();
-
-  scoped_ptr<ECPrivateKey> result(new ECPrivateKey);
-
-  SECItem encoded_spki = {
-    siBuffer,
-    const_cast<unsigned char*>(&subject_public_key_info[0]),
-    static_cast<unsigned>(subject_public_key_info.size())
-  };
-  CERTSubjectPublicKeyInfo* decoded_spki = SECKEY_DecodeDERSubjectPublicKeyInfo(
-      &encoded_spki);
-  if (!decoded_spki) {
-    DLOG(ERROR) << "SECKEY_DecodeDERSubjectPublicKeyInfo: " << PORT_GetError();
-    return NULL;
-  }
-
-  bool success = ECPrivateKey::ImportFromEncryptedPrivateKeyInfo(
-      password,
-      &encrypted_private_key_info[0],
-      encrypted_private_key_info.size(),
-      decoded_spki,
-      permanent,
-      sensitive,
-      &result->key_,
-      &result->public_key_);
-
-  SECKEY_DestroySubjectPublicKeyInfo(decoded_spki);
-
-  if (success)
-    return result.release();
-
-  return NULL;
-}
-
-}  // namespace crypto
diff --git a/src/crypto/ec_signature_creator_nss.cc b/src/crypto/ec_signature_creator_nss.cc
deleted file mode 100644
index 3e3626f..0000000
--- a/src/crypto/ec_signature_creator_nss.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 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 "crypto/ec_signature_creator_impl.h"
-
-#include <cryptohi.h>
-#include <pk11pub.h>
-#include <secerr.h>
-#include <sechash.h>
-#if defined(OS_POSIX)
-#include <unistd.h>
-#endif
-
-#include "base/logging.h"
-#include "crypto/ec_private_key.h"
-#include "crypto/nss_util.h"
-#include "crypto/scoped_nss_types.h"
-
-namespace crypto {
-
-namespace {
-
-SECStatus SignData(SECItem* result,
-                   SECItem* input,
-                   SECKEYPrivateKey* key,
-                   HASH_HashType hash_type,
-                   size_t* out_signature_len) {
-  if (key->keyType != ecKey) {
-    DLOG(FATAL) << "Should be using an EC key.";
-    PORT_SetError(SEC_ERROR_INVALID_ARGS);
-    return SECFailure;
-  }
-
-  // Hash the input.
-  std::vector<uint8> hash_data(HASH_ResultLen(hash_type));
-  SECStatus rv = HASH_HashBuf(
-      hash_type, &hash_data[0], input->data, input->len);
-  if (rv != SECSuccess)
-    return rv;
-  SECItem hash = {siBuffer, &hash_data[0],
-                  static_cast<unsigned int>(hash_data.size())};
-
-  // Compute signature of hash.
-  int signature_len = PK11_SignatureLen(key);
-  std::vector<uint8> signature_data(signature_len);
-  SECItem sig = {siBuffer, &signature_data[0],
-                 static_cast<unsigned int>(signature_len)};
-  rv = PK11_Sign(key, &sig, &hash);
-  if (rv != SECSuccess)
-    return rv;
-
-  *out_signature_len = sig.len;
-
-  // DER encode the signature.
-  return DSAU_EncodeDerSigWithLen(result, &sig, sig.len);
-}
-
-}  // namespace
-
-ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key)
-    : key_(key),
-      signature_len_(0) {
-  EnsureNSSInit();
-}
-
-ECSignatureCreatorImpl::~ECSignatureCreatorImpl() {}
-
-bool ECSignatureCreatorImpl::Sign(const uint8* data,
-                                  int data_len,
-                                  std::vector<uint8>* signature) {
-  // Data to be signed
-  SECItem secret;
-  secret.type = siBuffer;
-  secret.len = data_len;
-  secret.data = const_cast<unsigned char*>(data);
-
-  // SECItem to receive the output buffer.
-  SECItem result;
-  result.type = siBuffer;
-  result.len = 0;
-  result.data = NULL;
-
-  // Sign the secret data and save it to |result|.
-  SECStatus rv =
-      SignData(&result, &secret, key_->key(), HASH_AlgSHA256, &signature_len_);
-  if (rv != SECSuccess) {
-    DLOG(ERROR) << "DerSignData: " << PORT_GetError();
-    return false;
-  }
-
-  // Copy the signed data into the output vector.
-  signature->assign(result.data, result.data + result.len);
-  SECITEM_FreeItem(&result, PR_FALSE /* only free |result.data| */);
-  return true;
-}
-
-bool ECSignatureCreatorImpl::DecodeSignature(
-    const std::vector<uint8>& der_sig,
-    std::vector<uint8>* out_raw_sig) {
-  SECItem der_sig_item;
-  der_sig_item.type = siBuffer;
-  der_sig_item.len = der_sig.size();
-  der_sig_item.data = const_cast<uint8*>(&der_sig[0]);
-
-  SECItem* raw_sig = DSAU_DecodeDerSigToLen(&der_sig_item, signature_len_);
-  if (!raw_sig)
-    return false;
-  out_raw_sig->assign(raw_sig->data, raw_sig->data + raw_sig->len);
-  SECITEM_FreeItem(raw_sig, PR_TRUE /* free SECItem structure itself. */);
-  return true;
-}
-
-}  // namespace crypto
diff --git a/src/crypto/encryptor_nss.cc b/src/crypto/encryptor_nss.cc
deleted file mode 100644
index 280e38b..0000000
--- a/src/crypto/encryptor_nss.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) 2011 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 "crypto/encryptor.h"
-
-#include <cryptohi.h>
-#include <vector>
-
-#include "base/logging.h"
-#include "crypto/nss_util.h"
-#include "crypto/symmetric_key.h"
-
-namespace crypto {
-
-namespace {
-
-inline CK_MECHANISM_TYPE GetMechanism(Encryptor::Mode mode) {
-  switch (mode) {
-    case Encryptor::CBC:
-      return CKM_AES_CBC_PAD;
-    case Encryptor::CTR:
-      // AES-CTR encryption uses ECB encryptor as a building block since
-      // NSS doesn't support CTR encryption mode.
-      return CKM_AES_ECB;
-    default:
-      NOTREACHED() << "Unsupported mode of operation";
-      break;
-  }
-  return static_cast<CK_MECHANISM_TYPE>(-1);
-}
-
-}  // namespace
-
-Encryptor::Encryptor()
-    : key_(NULL),
-      mode_(CBC) {
-  EnsureNSSInit();
-}
-
-Encryptor::~Encryptor() {
-}
-
-bool Encryptor::Init(SymmetricKey* key,
-                     Mode mode,
-                     const base::StringPiece& iv) {
-  DCHECK(key);
-  DCHECK(CBC == mode || CTR == mode) << "Unsupported mode of operation";
-
-  key_ = key;
-  mode_ = mode;
-
-  if (mode == CBC && iv.size() != AES_BLOCK_SIZE)
-    return false;
-
-  switch (mode) {
-    case CBC:
-      SECItem iv_item;
-      iv_item.type = siBuffer;
-      iv_item.data = reinterpret_cast<unsigned char*>(
-          const_cast<char *>(iv.data()));
-      iv_item.len = iv.size();
-
-      param_.reset(PK11_ParamFromIV(GetMechanism(mode), &iv_item));
-      break;
-    case CTR:
-      param_.reset(PK11_ParamFromIV(GetMechanism(mode), NULL));
-      break;
-  }
-
-  return param_ != NULL;
-}
-
-bool Encryptor::Encrypt(const base::StringPiece& plaintext,
-                        std::string* ciphertext) {
-  CHECK(!plaintext.empty() || (mode_ == CBC));
-  ScopedPK11Context context(PK11_CreateContextBySymKey(GetMechanism(mode_),
-                                                       CKA_ENCRYPT,
-                                                       key_->key(),
-                                                       param_.get()));
-  if (!context.get())
-    return false;
-
-  return (mode_ == CTR) ?
-      CryptCTR(context.get(), plaintext, ciphertext) :
-      Crypt(context.get(), plaintext, ciphertext);
-}
-
-bool Encryptor::Decrypt(const base::StringPiece& ciphertext,
-                        std::string* plaintext) {
-  CHECK(!ciphertext.empty());
-  ScopedPK11Context context(PK11_CreateContextBySymKey(
-      GetMechanism(mode_), (mode_ == CTR ? CKA_ENCRYPT : CKA_DECRYPT),
-      key_->key(), param_.get()));
-  if (!context.get())
-    return false;
-
-  return (mode_ == CTR) ?
-      CryptCTR(context.get(), ciphertext, plaintext) :
-      Crypt(context.get(), ciphertext, plaintext);
-}
-
-bool Encryptor::Crypt(PK11Context* context,
-                      const base::StringPiece& input,
-                      std::string* output) {
-  size_t output_len = input.size() + AES_BLOCK_SIZE;
-  CHECK_GT(output_len, input.size());
-
-  output->resize(output_len);
-  uint8* output_data =
-      reinterpret_cast<uint8*>(const_cast<char*>(output->data()));
-
-  int input_len = input.size();
-  uint8* input_data =
-      reinterpret_cast<uint8*>(const_cast<char*>(input.data()));
-
-  int op_len;
-  SECStatus rv = PK11_CipherOp(context,
-                               output_data,
-                               &op_len,
-                               output_len,
-                               input_data,
-                               input_len);
-
-  if (SECSuccess != rv) {
-    output->clear();
-    return false;
-  }
-
-  unsigned int digest_len;
-  rv = PK11_DigestFinal(context,
-                        output_data + op_len,
-                        &digest_len,
-                        output_len - op_len);
-  if (SECSuccess != rv) {
-    output->clear();
-    return false;
-  }
-
-  output->resize(op_len + digest_len);
-  return true;
-}
-
-bool Encryptor::CryptCTR(PK11Context* context,
-                         const base::StringPiece& input,
-                         std::string* output) {
-  if (!counter_.get()) {
-    LOG(ERROR) << "Counter value not set in CTR mode.";
-    return false;
-  }
-
-  size_t output_len = ((input.size() + AES_BLOCK_SIZE - 1) / AES_BLOCK_SIZE) *
-      AES_BLOCK_SIZE;
-  CHECK_GE(output_len, input.size());
-  output->resize(output_len);
-  uint8* output_data =
-      reinterpret_cast<uint8*>(const_cast<char*>(output->data()));
-
-  size_t mask_len;
-  bool ret = GenerateCounterMask(input.size(), output_data, &mask_len);
-  if (!ret)
-    return false;
-
-  CHECK_EQ(mask_len, output_len);
-  int op_len;
-  SECStatus rv = PK11_CipherOp(context,
-                               output_data,
-                               &op_len,
-                               output_len,
-                               output_data,
-                               mask_len);
-  if (SECSuccess != rv)
-    return false;
-  CHECK_EQ(static_cast<int>(mask_len), op_len);
-
-  unsigned int digest_len;
-  rv = PK11_DigestFinal(context,
-                        NULL,
-                        &digest_len,
-                        0);
-  if (SECSuccess != rv)
-    return false;
-  CHECK(!digest_len);
-
-  // Use |output_data| to mask |input|.
-  MaskMessage(
-      reinterpret_cast<uint8*>(const_cast<char*>(input.data())),
-      input.length(), output_data, output_data);
-  output->resize(input.length());
-  return true;
-}
-
-}  // namespace crypto
diff --git a/src/crypto/hmac_nss.cc b/src/crypto/hmac_nss.cc
deleted file mode 100644
index e14282c..0000000
--- a/src/crypto/hmac_nss.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2011 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 "crypto/hmac.h"
-
-#include <nss.h>
-#include <pk11pub.h>
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "crypto/nss_util.h"
-#include "crypto/scoped_nss_types.h"
-
-namespace crypto {
-
-struct HMACPlatformData {
-  CK_MECHANISM_TYPE mechanism_;
-  ScopedPK11Slot slot_;
-  ScopedPK11SymKey sym_key_;
-};
-
-HMAC::HMAC(HashAlgorithm hash_alg)
-    : hash_alg_(hash_alg), plat_(new HMACPlatformData()) {
-  // Only SHA-1 and SHA-256 hash algorithms are supported.
-  switch (hash_alg_) {
-    case SHA1:
-      plat_->mechanism_ = CKM_SHA_1_HMAC;
-      break;
-    case SHA256:
-      plat_->mechanism_ = CKM_SHA256_HMAC;
-      break;
-    default:
-      NOTREACHED() << "Unsupported hash algorithm";
-      break;
-  }
-}
-
-HMAC::~HMAC() {
-}
-
-bool HMAC::Init(const unsigned char *key, size_t key_length) {
-  EnsureNSSInit();
-
-  if (plat_->slot_.get()) {
-    // Init must not be called more than twice on the same HMAC object.
-    NOTREACHED();
-    return false;
-  }
-
-  plat_->slot_.reset(PK11_GetInternalSlot());
-  if (!plat_->slot_.get()) {
-    NOTREACHED();
-    return false;
-  }
-
-  SECItem key_item;
-  key_item.type = siBuffer;
-  key_item.data = const_cast<unsigned char*>(key);  // NSS API isn't const.
-  key_item.len = key_length;
-
-  plat_->sym_key_.reset(PK11_ImportSymKey(plat_->slot_.get(),
-                                          plat_->mechanism_,
-                                          PK11_OriginUnwrap,
-                                          CKA_SIGN,
-                                          &key_item,
-                                          NULL));
-  if (!plat_->sym_key_.get()) {
-    NOTREACHED();
-    return false;
-  }
-
-  return true;
-}
-
-bool HMAC::Sign(const base::StringPiece& data,
-                unsigned char* digest,
-                size_t digest_length) const {
-  if (!plat_->sym_key_.get()) {
-    // Init has not been called before Sign.
-    NOTREACHED();
-    return false;
-  }
-
-  SECItem param = { siBuffer, NULL, 0 };
-  ScopedPK11Context context(PK11_CreateContextBySymKey(plat_->mechanism_,
-                                                       CKA_SIGN,
-                                                       plat_->sym_key_.get(),
-                                                       &param));
-  if (!context.get()) {
-    NOTREACHED();
-    return false;
-  }
-
-  if (PK11_DigestBegin(context.get()) != SECSuccess) {
-    NOTREACHED();
-    return false;
-  }
-
-  if (PK11_DigestOp(context.get(),
-                    reinterpret_cast<const unsigned char*>(data.data()),
-                    data.length()) != SECSuccess) {
-    NOTREACHED();
-    return false;
-  }
-
-  unsigned int len = 0;
-  if (PK11_DigestFinal(context.get(),
-                       digest, &len, digest_length) != SECSuccess) {
-    NOTREACHED();
-    return false;
-  }
-
-  return true;
-}
-
-}  // namespace crypto
diff --git a/src/crypto/hmac_win.cc b/src/crypto/hmac_win.cc
deleted file mode 100644
index ba7d827..0000000
--- a/src/crypto/hmac_win.cc
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright (c) 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 "crypto/hmac.h"
-
-#include <windows.h>
-#include <wincrypt.h>
-
-#include <algorithm>
-#include <vector>
-
-#include "base/logging.h"
-#include "crypto/scoped_capi_types.h"
-#include "crypto/third_party/nss/chromium-blapi.h"
-#include "crypto/third_party/nss/chromium-sha256.h"
-
-namespace crypto {
-
-namespace {
-
-// Implementation of HMAC-SHA-256:
-//
-// SHA-256 is supported in Windows XP SP3 or later.  We still need to support
-// Windows XP SP2, so unfortunately we have to implement HMAC-SHA-256 here.
-
-enum {
-  SHA256_BLOCK_SIZE = 64  // Block size (in bytes) of the input to SHA-256.
-};
-
-// NSS doesn't accept size_t for text size, divide the data into smaller
-// chunks as needed.
-void Wrapped_SHA256_Update(SHA256Context* ctx, const unsigned char* text,
-                           size_t text_len) {
-  const unsigned int kChunkSize = 1 << 30;
-  while (text_len > kChunkSize) {
-    SHA256_Update(ctx, text, kChunkSize);
-    text += kChunkSize;
-    text_len -= kChunkSize;
-  }
-  SHA256_Update(ctx, text, (unsigned int)text_len);
-}
-
-// See FIPS 198: The Keyed-Hash Message Authentication Code (HMAC).
-void ComputeHMACSHA256(const unsigned char* key, size_t key_len,
-                       const unsigned char* text, size_t text_len,
-                       unsigned char* output, size_t output_len) {
-  SHA256Context ctx;
-
-  // Pre-process the key, if necessary.
-  unsigned char key0[SHA256_BLOCK_SIZE];
-  if (key_len > SHA256_BLOCK_SIZE) {
-    SHA256_Begin(&ctx);
-    Wrapped_SHA256_Update(&ctx, key, key_len);
-    SHA256_End(&ctx, key0, NULL, SHA256_LENGTH);
-    memset(key0 + SHA256_LENGTH, 0, SHA256_BLOCK_SIZE - SHA256_LENGTH);
-  } else {
-    memcpy(key0, key, key_len);
-    if (key_len < SHA256_BLOCK_SIZE)
-      memset(key0 + key_len, 0, SHA256_BLOCK_SIZE - key_len);
-  }
-
-  unsigned char padded_key[SHA256_BLOCK_SIZE];
-  unsigned char inner_hash[SHA256_LENGTH];
-
-  // XOR key0 with ipad.
-  for (int i = 0; i < SHA256_BLOCK_SIZE; ++i)
-    padded_key[i] = key0[i] ^ 0x36;
-
-  // Compute the inner hash.
-  SHA256_Begin(&ctx);
-  SHA256_Update(&ctx, padded_key, SHA256_BLOCK_SIZE);
-  Wrapped_SHA256_Update(&ctx, text, text_len);
-  SHA256_End(&ctx, inner_hash, NULL, SHA256_LENGTH);
-
-  // XOR key0 with opad.
-  for (int i = 0; i < SHA256_BLOCK_SIZE; ++i)
-    padded_key[i] = key0[i] ^ 0x5c;
-
-  // Compute the outer hash.
-  SHA256_Begin(&ctx);
-  SHA256_Update(&ctx, padded_key, SHA256_BLOCK_SIZE);
-  SHA256_Update(&ctx, inner_hash, SHA256_LENGTH);
-  SHA256_End(&ctx, output, NULL, (unsigned int) output_len);
-}
-
-}  // namespace
-
-struct HMACPlatformData {
-  ~HMACPlatformData() {
-    if (!raw_key_.empty()) {
-      SecureZeroMemory(&raw_key_[0], raw_key_.size());
-    }
-
-    // Destroy the key before releasing the provider.
-    key_.reset();
-  }
-
-  ScopedHCRYPTPROV provider_;
-  ScopedHCRYPTKEY key_;
-
-  // For HMAC-SHA-256 only.
-  std::vector<unsigned char> raw_key_;
-};
-
-HMAC::HMAC(HashAlgorithm hash_alg)
-    : hash_alg_(hash_alg), plat_(new HMACPlatformData()) {
-  // Only SHA-1 and SHA-256 hash algorithms are supported now.
-  DCHECK(hash_alg_ == SHA1 || hash_alg_ == SHA256);
-}
-
-bool HMAC::Init(const unsigned char* key, size_t key_length) {
-  if (plat_->provider_ || plat_->key_ || !plat_->raw_key_.empty()) {
-    // Init must not be called more than once on the same HMAC object.
-    NOTREACHED();
-    return false;
-  }
-
-  if (hash_alg_ == SHA256) {
-    plat_->raw_key_.assign(key, key + key_length);
-    return true;
-  }
-
-  if (!CryptAcquireContext(plat_->provider_.receive(), NULL, NULL,
-                           PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
-    NOTREACHED();
-    return false;
-  }
-
-  // This code doesn't work on Win2k because PLAINTEXTKEYBLOB and
-  // CRYPT_IPSEC_HMAC_KEY are not supported on Windows 2000.  PLAINTEXTKEYBLOB
-  // allows the import of an unencrypted key.  For Win2k support, a cubmbersome
-  // exponent-of-one key procedure must be used:
-  //     http://support.microsoft.com/kb/228786/en-us
-  // CRYPT_IPSEC_HMAC_KEY allows keys longer than 16 bytes.
-
-  struct KeyBlob {
-    BLOBHEADER header;
-    DWORD key_size;
-    BYTE key_data[1];
-  };
-  size_t key_blob_size = std::max(offsetof(KeyBlob, key_data) + key_length,
-                                  sizeof(KeyBlob));
-  std::vector<BYTE> key_blob_storage = std::vector<BYTE>(key_blob_size);
-  KeyBlob* key_blob = reinterpret_cast<KeyBlob*>(&key_blob_storage[0]);
-  key_blob->header.bType = PLAINTEXTKEYBLOB;
-  key_blob->header.bVersion = CUR_BLOB_VERSION;
-  key_blob->header.reserved = 0;
-  key_blob->header.aiKeyAlg = CALG_RC2;
-  key_blob->key_size = static_cast<DWORD>(key_length);
-  memcpy(key_blob->key_data, key, key_length);
-
-  if (!CryptImportKey(plat_->provider_, &key_blob_storage[0],
-                      (DWORD)key_blob_storage.size(), 0,
-                      CRYPT_IPSEC_HMAC_KEY, plat_->key_.receive())) {
-    NOTREACHED();
-    return false;
-  }
-
-  // Destroy the copy of the key.
-  SecureZeroMemory(key_blob->key_data, key_length);
-
-  return true;
-}
-
-HMAC::~HMAC() {
-}
-
-bool HMAC::Sign(const base::StringPiece& data,
-                unsigned char* digest,
-                size_t digest_length) const {
-  if (hash_alg_ == SHA256) {
-    if (plat_->raw_key_.empty())
-      return false;
-    ComputeHMACSHA256(&plat_->raw_key_[0], plat_->raw_key_.size(),
-                      reinterpret_cast<const unsigned char*>(data.data()),
-                      data.size(), digest, digest_length);
-    return true;
-  }
-
-  if (!plat_->provider_ || !plat_->key_)
-    return false;
-
-  if (hash_alg_ != SHA1) {
-    NOTREACHED();
-    return false;
-  }
-
-  ScopedHCRYPTHASH hash;
-  if (!CryptCreateHash(plat_->provider_, CALG_HMAC, plat_->key_, 0,
-                       hash.receive()))
-    return false;
-
-  HMAC_INFO hmac_info;
-  memset(&hmac_info, 0, sizeof(hmac_info));
-  hmac_info.HashAlgid = CALG_SHA1;
-  if (!CryptSetHashParam(hash, HP_HMAC_INFO,
-                         reinterpret_cast<BYTE*>(&hmac_info), 0))
-    return false;
-
-  if (!CryptHashData(hash, reinterpret_cast<const BYTE*>(data.data()),
-                     static_cast<DWORD>(data.size()), 0))
-    return false;
-
-  DWORD sha1_size = static_cast<DWORD>(digest_length);
-  return !!CryptGetHashParam(hash, HP_HASHVAL, digest, &sha1_size, 0);
-}
-
-}  // namespace crypto
diff --git a/src/crypto/mac_security_services_lock.cc b/src/crypto/mac_security_services_lock.cc
deleted file mode 100644
index c0b8712..0000000
--- a/src/crypto/mac_security_services_lock.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2011 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 "crypto/mac_security_services_lock.h"
-
-#include "base/memory/singleton.h"
-#include "base/synchronization/lock.h"
-
-namespace {
-
-// This singleton pertains to Apple's wrappers over their own CSSM handles,
-// as opposed to our own CSSM_CSP_HANDLE in cssm_init.cc.
-class SecurityServicesSingleton {
- public:
-  static SecurityServicesSingleton* GetInstance() {
-    return Singleton<SecurityServicesSingleton,
-                     LeakySingletonTraits<SecurityServicesSingleton> >::get();
-  }
-
-  base::Lock& lock() { return lock_; }
-
- private:
-  friend struct DefaultSingletonTraits<SecurityServicesSingleton>;
-
-  SecurityServicesSingleton() {}
-  ~SecurityServicesSingleton() {}
-
-  base::Lock lock_;
-
-  DISALLOW_COPY_AND_ASSIGN(SecurityServicesSingleton);
-};
-
-}  // namespace
-
-namespace crypto {
-
-base::Lock& GetMacSecurityServicesLock() {
-  return SecurityServicesSingleton::GetInstance()->lock();
-}
-
-}  // namespace crypto
diff --git a/src/crypto/mac_security_services_lock.h b/src/crypto/mac_security_services_lock.h
deleted file mode 100644
index 06850cd..0000000
--- a/src/crypto/mac_security_services_lock.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 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 CRYPTO_MAC_SECURITY_SERVICES_LOCK_H_
-#define CRYPTO_MAC_SECURITY_SERVICES_LOCK_H_
-
-#include "crypto/crypto_export.h"
-
-namespace base {
-class Lock;
-}
-
-
-namespace crypto {
-
-// The Mac OS X certificate and key management wrappers over CSSM are not
-// thread-safe. In particular, code that accesses the CSSM database is
-// problematic.
-//
-// http://developer.apple.com/mac/library/documentation/Security/Reference/certifkeytrustservices/Reference/reference.html
-CRYPTO_EXPORT base::Lock& GetMacSecurityServicesLock();
-
-}  // namespace crypto
-
-#endif  // CRYPTO_MAC_SECURITY_SERVICES_LOCK_H_
diff --git a/src/crypto/mock_apple_keychain.cc b/src/crypto/mock_apple_keychain.cc
deleted file mode 100644
index bcabab8..0000000
--- a/src/crypto/mock_apple_keychain.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 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 "base/logging.h"
-#include "base/time.h"
-#include "crypto/mock_apple_keychain.h"
-
-namespace crypto {
-
-OSStatus MockAppleKeychain::FindGenericPassword(
-    CFTypeRef keychainOrArray,
-    UInt32 serviceNameLength,
-    const char* serviceName,
-    UInt32 accountNameLength,
-    const char* accountName,
-    UInt32* passwordLength,
-    void** passwordData,
-    SecKeychainItemRef* itemRef) const {
-  // When simulating |noErr|, return canned |passwordData| and
-  // |passwordLength|.  Otherwise, just return given code.
-  if (find_generic_result_ == noErr) {
-    static const char kPassword[] = "my_password";
-    DCHECK(passwordData);
-    // The function to free this data is mocked so the cast is fine.
-    *passwordData = const_cast<char*>(kPassword);
-    DCHECK(passwordLength);
-    *passwordLength = arraysize(kPassword);
-    password_data_count_++;
-  }
-
-  return find_generic_result_;
-}
-
-OSStatus MockAppleKeychain::ItemFreeContent(SecKeychainAttributeList* attrList,
-                                            void* data) const {
-  // No-op.
-  password_data_count_--;
-  return noErr;
-}
-
-OSStatus MockAppleKeychain::AddGenericPassword(
-    SecKeychainRef keychain,
-    UInt32 serviceNameLength,
-    const char* serviceName,
-    UInt32 accountNameLength,
-    const char* accountName,
-    UInt32 passwordLength,
-    const void* passwordData,
-    SecKeychainItemRef* itemRef) const {
-  called_add_generic_ = true;
-
-  DCHECK_GT(passwordLength, 0U);
-  DCHECK(passwordData);
-  add_generic_password_ =
-      std::string(const_cast<char*>(static_cast<const char*>(passwordData)),
-                  passwordLength);
-  return noErr;
-}
-
-}  // namespace crypto
diff --git a/src/crypto/mock_apple_keychain.h b/src/crypto/mock_apple_keychain.h
deleted file mode 100644
index efbb438..0000000
--- a/src/crypto/mock_apple_keychain.h
+++ /dev/null
@@ -1,251 +0,0 @@
-// Copyright (c) 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 CRYPTO_MOCK_KEYCHAIN_MAC_H_
-#define CRYPTO_MOCK_KEYCHAIN_MAC_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "crypto/apple_keychain.h"
-
-namespace crypto {
-
-// Mock Keychain wrapper for testing code that interacts with the OS X
-// Keychain.  Implemented by storing SecKeychainAttributeList and
-// KeychainPasswordData values in separate mutable containers and
-// mapping them to integer keys.
-//
-// Note that "const" is pretty much meaningless for this class; the const-ness
-// of AppleKeychain doesn't apply to the actual keychain data, so all of the
-// Mock data is mutable; don't assume that it won't change over the life of
-// tests.
-class CRYPTO_EXPORT MockAppleKeychain : public AppleKeychain {
- public:
-  MockAppleKeychain();
-  virtual ~MockAppleKeychain();
-
-  // AppleKeychain implementation.
-  virtual OSStatus FindGenericPassword(
-      CFTypeRef keychainOrArray,
-      UInt32 serviceNameLength,
-      const char* serviceName,
-      UInt32 accountNameLength,
-      const char* accountName,
-      UInt32* passwordLength,
-      void** passwordData,
-      SecKeychainItemRef* itemRef) const OVERRIDE;
-  virtual OSStatus ItemFreeContent(SecKeychainAttributeList* attrList,
-                                   void* data) const OVERRIDE;
-  virtual OSStatus AddGenericPassword(
-      SecKeychainRef keychain,
-      UInt32 serviceNameLength,
-      const char* serviceName,
-      UInt32 accountNameLength,
-      const char* accountName,
-      UInt32 passwordLength,
-      const void* passwordData,
-      SecKeychainItemRef* itemRef) const OVERRIDE;
-
-#if !defined(OS_IOS)
-  virtual OSStatus ItemCopyAttributesAndData(
-      SecKeychainItemRef itemRef,
-      SecKeychainAttributeInfo* info,
-      SecItemClass* itemClass,
-      SecKeychainAttributeList** attrList,
-      UInt32* length,
-      void** outData) const OVERRIDE;
-  // Pass "fail_me" as the data to get errSecAuthFailed.
-  virtual OSStatus ItemModifyAttributesAndData(
-      SecKeychainItemRef itemRef,
-      const SecKeychainAttributeList* attrList,
-      UInt32 length,
-      const void* data) const OVERRIDE;
-  virtual OSStatus ItemFreeAttributesAndData(SecKeychainAttributeList* attrList,
-                                             void* data) const OVERRIDE;
-  virtual OSStatus ItemDelete(SecKeychainItemRef itemRef) const OVERRIDE;
-  virtual OSStatus SearchCreateFromAttributes(
-      CFTypeRef keychainOrArray,
-      SecItemClass itemClass,
-      const SecKeychainAttributeList* attrList,
-      SecKeychainSearchRef* searchRef) const OVERRIDE;
-  virtual OSStatus SearchCopyNext(SecKeychainSearchRef searchRef,
-                                  SecKeychainItemRef* itemRef) const OVERRIDE;
-  // Pass "some.domain.com" as the serverName to get errSecDuplicateItem.
-  virtual OSStatus AddInternetPassword(
-      SecKeychainRef keychain,
-      UInt32 serverNameLength,
-      const char* serverName,
-      UInt32 securityDomainLength,
-      const char* securityDomain,
-      UInt32 accountNameLength,
-      const char* accountName,
-      UInt32 pathLength, const char* path,
-      UInt16 port, SecProtocolType protocol,
-      SecAuthenticationType authenticationType,
-      UInt32 passwordLength,
-      const void* passwordData,
-      SecKeychainItemRef* itemRef) const OVERRIDE;
-  virtual void Free(CFTypeRef ref) const OVERRIDE;
-
-  // Return the counts of objects returned by Create/Copy functions but never
-  // Free'd as they should have been.
-  int UnfreedSearchCount() const;
-  int UnfreedKeychainItemCount() const;
-  int UnfreedAttributeDataCount() const;
-
-  // Returns true if all items added with AddInternetPassword have a creator
-  // code set.
-  bool CreatorCodesSetForAddedItems() const;
-
-  struct KeychainTestData {
-    const SecAuthenticationType auth_type;
-    const char* server;
-    const SecProtocolType protocol;
-    const char* path;
-    const UInt32 port;
-    const char* security_domain;
-    const char* creation_date;
-    const char* username;
-    const char* password;
-    const bool negative_item;
-  };
-  // Adds a keychain item with the given info to the test set.
-  void AddTestItem(const KeychainTestData& item_data);
-#endif  // !defined(OS_IOS)
-
-  // |FindGenericPassword()| can return different results depending on user
-  // interaction with the system Keychain.  For mocking purposes we allow the
-  // user of this class to specify the result code of the
-  // |FindGenericPassword()| call so we can simulate the result of different
-  // user interactions.
-  void set_find_generic_result(OSStatus result) {
-    find_generic_result_ = result;
-  }
-
-  // Returns the true if |AddGenericPassword()| was called.
-  bool called_add_generic() const { return called_add_generic_; }
-
-  // Returns the value of the password set when |AddGenericPassword()| was
-  // called.
-  std::string add_generic_password() const { return add_generic_password_; }
-
-  // Returns the number of allocations - deallocations for password data.
-  int password_data_count() const { return password_data_count_; }
-
- private:
-
-  // Type used for the keys in the std::map(s) and MockAppleKeychain items.
-  typedef uintptr_t MockKeychainItemType;
-
-  // Type of the map holding the mock keychain attributes.
-  typedef std::map<MockKeychainItemType, SecKeychainAttributeList>
-      MockKeychainAttributesMap;
-
-#if !defined(OS_IOS)
-  // Returns true if the keychain already contains a password that matches the
-  // attributes provided.
-  bool AlreadyContainsInternetPassword(
-      UInt32 serverNameLength,
-      const char* serverName,
-      UInt32 securityDomainLength,
-      const char* securityDomain,
-      UInt32 accountNameLength,
-      const char* accountName,
-      UInt32 pathLength,
-      const char* path,
-      UInt16 port,
-      SecProtocolType protocol,
-      SecAuthenticationType authenticationType) const;
-  // Initializes storage for keychain data at |key|.
-  void InitializeKeychainData(MockKeychainItemType key) const;
-  // Sets the data and length of |tag| in the item-th test item.
-  void SetTestDataBytes(
-      MockKeychainItemType item,
-      UInt32 tag,
-      const void* data,
-      size_t length);
-  // Sets the data and length of |tag| in the item-th test item based on
-  // |value|. The null-terminator will not be included; the Keychain Services
-  // docs don't indicate whether it is or not, so clients should not assume
-  // that it will be.
-  void SetTestDataString(MockKeychainItemType item,
-                         UInt32 tag,
-                         const char* value);
-  // Sets the data of the corresponding attribute of the item-th test item to
-  // |value|. Assumes that the space has alread been allocated, and the length
-  // set.
-  void SetTestDataPort(MockKeychainItemType item, UInt32 value);
-  void SetTestDataProtocol(MockKeychainItemType item, SecProtocolType value);
-  void SetTestDataAuthType(MockKeychainItemType item,
-                           SecAuthenticationType value);
-  void SetTestDataNegativeItem(MockKeychainItemType item, Boolean value);
-  void SetTestDataCreator(MockKeychainItemType item, OSType value);
-  // Sets the password data and length for the item-th test item.
-  void SetTestDataPasswordBytes(MockKeychainItemType item,
-                                const void* data,
-                                size_t length);
-  // Sets the password for the item-th test item. As with SetTestDataString,
-  // the data will not be null-terminated.
-  void SetTestDataPasswordString(MockKeychainItemType item, const char* value);
-
-  // Returns the address of the attribute in attribute_list with tag |tag|.
-  static SecKeychainAttribute* AttributeWithTag(
-      const SecKeychainAttributeList& attribute_list,
-      UInt32 tag);
-
-  static const SecKeychainSearchRef kDummySearchRef;
-
-  typedef struct KeychainPasswordData {
-    KeychainPasswordData() : data(NULL), length(0) {}
-    void* data;
-    UInt32 length;
-  } KeychainPasswordData;
-
-  // Mutable because the MockAppleKeychain API requires its internal keychain
-  // storage to be modifiable by users of this class.
-  mutable MockKeychainAttributesMap keychain_attr_list_;
-  mutable std::map<MockKeychainItemType,
-                   KeychainPasswordData> keychain_data_;
-  mutable MockKeychainItemType next_item_key_;
-
-  // Tracks the items that should be returned in subsequent calls to
-  // SearchCopyNext, based on the last call to SearchCreateFromAttributes.
-  // We can't handle multiple active searches, since we don't track the search
-  // ref we return, but we don't need to for our mocking.
-  mutable std::vector<MockKeychainItemType> remaining_search_results_;
-
-  // Track copies and releases to make sure they balance. Really these should
-  // be maps to track per item, but this should be good enough to catch
-  // real mistakes.
-  mutable int search_copy_count_;
-  mutable int keychain_item_copy_count_;
-  mutable int attribute_data_copy_count_;
-
-  // Tracks which items (by key) were added with AddInternetPassword.
-  mutable std::set<MockKeychainItemType> added_via_api_;
-#endif  // !defined(OS_IOS)
-
-  // Result code for the |FindGenericPassword()| method.
-  OSStatus find_generic_result_;
-
-  // Records whether |AddGenericPassword()| gets called.
-  mutable bool called_add_generic_;
-
-  // Tracks the allocations and frees of password data in |FindGenericPassword|
-  // and |ItemFreeContent|.
-  mutable int password_data_count_;
-
-  // Records the password being set when |AddGenericPassword()| gets called.
-  mutable std::string add_generic_password_;
-};
-
-}  // namespace crypto
-
-#endif  // CRYPTO_MOCK_KEYCHAIN_MAC_H_
diff --git a/src/crypto/nss_util.cc b/src/crypto/nss_util.cc
deleted file mode 100644
index 69d74f5..0000000
--- a/src/crypto/nss_util.cc
+++ /dev/null
@@ -1,816 +0,0 @@
-// Copyright (c) 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 "crypto/nss_util.h"
-#include "crypto/nss_util_internal.h"
-
-#include <nss.h>
-#include <pk11pub.h>
-#include <plarena.h>
-#include <prerror.h>
-#include <prinit.h>
-#include <prtime.h>
-#include <secmod.h>
-
-#if defined(OS_LINUX)
-#include <linux/nfs_fs.h>
-#include <sys/vfs.h>
-#elif defined(OS_OPENBSD)
-#include <sys/mount.h>
-#include <sys/param.h>
-#endif
-
-#include <vector>
-
-#include "base/debug/alias.h"
-#include "base/environment.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/files/scoped_temp_dir.h"
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/native_library.h"
-#include "base/stringprintf.h"
-#include "base/threading/thread_restrictions.h"
-#include "build/build_config.h"
-
-#if defined(OS_CHROMEOS)
-#include "crypto/symmetric_key.h"
-#endif
-
-// USE_NSS means we use NSS for everything crypto-related.  If USE_NSS is not
-// defined, such as on Mac and Windows, we use NSS for SSL only -- we don't
-// use NSS for crypto or certificate verification, and we don't use the NSS
-// certificate and key databases.
-#if defined(USE_NSS)
-#include "base/synchronization/lock.h"
-#include "crypto/crypto_module_blocking_password_delegate.h"
-#endif  // defined(USE_NSS)
-
-namespace crypto {
-
-namespace {
-
-#if defined(OS_CHROMEOS)
-const char kNSSDatabaseName[] = "Real NSS database";
-
-// Constants for loading the Chrome OS TPM-backed PKCS #11 library.
-const char kChapsModuleName[] = "Chaps";
-const char kChapsPath[] = "libchaps.so";
-
-// Fake certificate authority database used for testing.
-static const FilePath::CharType kReadOnlyCertDB[] =
-    FILE_PATH_LITERAL("/etc/fake_root_ca/nssdb");
-#endif  // defined(OS_CHROMEOS)
-
-std::string GetNSSErrorMessage() {
-  std::string result;
-  if (PR_GetErrorTextLength()) {
-    scoped_array<char> error_text(new char[PR_GetErrorTextLength() + 1]);
-    PRInt32 copied = PR_GetErrorText(error_text.get());
-    result = std::string(error_text.get(), copied);
-  } else {
-    result = StringPrintf("NSS error code: %d", PR_GetError());
-  }
-  return result;
-}
-
-#if defined(USE_NSS)
-FilePath GetDefaultConfigDirectory() {
-  FilePath dir = file_util::GetHomeDir();
-  if (dir.empty()) {
-    LOG(ERROR) << "Failed to get home directory.";
-    return dir;
-  }
-  dir = dir.AppendASCII(".pki").AppendASCII("nssdb");
-  if (!file_util::CreateDirectory(dir)) {
-    LOG(ERROR) << "Failed to create " << dir.value() << " directory.";
-    dir.clear();
-  }
-  return dir;
-}
-
-#if defined(OS_CHROMEOS)
-// Supplemental user key id.
-unsigned char kSupplementalUserKeyId[] = {
-  0xCC, 0x13, 0x19, 0xDE, 0x75, 0x5E, 0xFE, 0xFA,
-  0x5E, 0x71, 0xD4, 0xA6, 0xFB, 0x00, 0x00, 0xCC
-};
-#endif  // defined(OS_CHROMEOS)
-
-
-// On non-chromeos platforms, return the default config directory.
-// On chromeos, return a read-only directory with fake root CA certs for testing
-// (which will not exist on non-testing images).  These root CA certs are used
-// by the local Google Accounts server mock we use when testing our login code.
-// If this directory is not present, NSS_Init() will fail.  It is up to the
-// caller to failover to NSS_NoDB_Init() at that point.
-FilePath GetInitialConfigDirectory() {
-#if defined(OS_CHROMEOS)
-  return FilePath(kReadOnlyCertDB);
-#else
-  return GetDefaultConfigDirectory();
-#endif  // defined(OS_CHROMEOS)
-}
-
-// This callback for NSS forwards all requests to a caller-specified
-// CryptoModuleBlockingPasswordDelegate object.
-char* PKCS11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) {
-#if defined(OS_CHROMEOS)
-  // If we get asked for a password for the TPM, then return the
-  // well known password we use, as long as the TPM slot has been
-  // initialized.
-  if (crypto::IsTPMTokenReady()) {
-    std::string token_name;
-    std::string user_pin;
-    crypto::GetTPMTokenInfo(&token_name, &user_pin);
-    if (PK11_GetTokenName(slot) == token_name)
-      return PORT_Strdup(user_pin.c_str());
-  }
-#endif
-  crypto::CryptoModuleBlockingPasswordDelegate* delegate =
-      reinterpret_cast<crypto::CryptoModuleBlockingPasswordDelegate*>(arg);
-  if (delegate) {
-    bool cancelled = false;
-    std::string password = delegate->RequestPassword(PK11_GetTokenName(slot),
-                                                     retry != PR_FALSE,
-                                                     &cancelled);
-    if (cancelled)
-      return NULL;
-    char* result = PORT_Strdup(password.c_str());
-    password.replace(0, password.size(), password.size(), 0);
-    return result;
-  }
-  DLOG(ERROR) << "PK11 password requested with NULL arg";
-  return NULL;
-}
-
-// NSS creates a local cache of the sqlite database if it detects that the
-// filesystem the database is on is much slower than the local disk.  The
-// detection doesn't work with the latest versions of sqlite, such as 3.6.22
-// (NSS bug https://bugzilla.mozilla.org/show_bug.cgi?id=578561).  So we set
-// the NSS environment variable NSS_SDB_USE_CACHE to "yes" to override NSS's
-// detection when database_dir is on NFS.  See http://crbug.com/48585.
-//
-// TODO(wtc): port this function to other USE_NSS platforms.  It is defined
-// only for OS_LINUX and OS_OPENBSD simply because the statfs structure
-// is OS-specific.
-//
-// Because this function sets an environment variable it must be run before we
-// go multi-threaded.
-void UseLocalCacheOfNSSDatabaseIfNFS(const FilePath& database_dir) {
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
-  struct statfs buf;
-  if (statfs(database_dir.value().c_str(), &buf) == 0) {
-#if defined(OS_LINUX)
-    if (buf.f_type == NFS_SUPER_MAGIC) {
-#elif defined(OS_OPENBSD)
-    if (strcmp(buf.f_fstypename, MOUNT_NFS) == 0) {
-#endif
-      scoped_ptr<base::Environment> env(base::Environment::Create());
-      const char* use_cache_env_var = "NSS_SDB_USE_CACHE";
-      if (!env->HasVar(use_cache_env_var))
-        env->SetVar(use_cache_env_var, "yes");
-    }
-  }
-#endif  // defined(OS_LINUX) || defined(OS_OPENBSD)
-}
-
-PK11SlotInfo* FindSlotWithTokenName(const std::string& token_name) {
-  AutoSECMODListReadLock auto_lock;
-  SECMODModuleList* head = SECMOD_GetDefaultModuleList();
-  for (SECMODModuleList* item = head; item != NULL; item = item->next) {
-    int slot_count = item->module->loaded ? item->module->slotCount : 0;
-    for (int i = 0; i < slot_count; i++) {
-      PK11SlotInfo* slot = item->module->slots[i];
-      if (PK11_GetTokenName(slot) == token_name)
-        return PK11_ReferenceSlot(slot);
-    }
-  }
-  return NULL;
-}
-
-#endif  // defined(USE_NSS)
-
-// A singleton to initialize/deinitialize NSPR.
-// Separate from the NSS singleton because we initialize NSPR on the UI thread.
-// Now that we're leaking the singleton, we could merge back with the NSS
-// singleton.
-class NSPRInitSingleton {
- private:
-  friend struct base::DefaultLazyInstanceTraits<NSPRInitSingleton>;
-
-  NSPRInitSingleton() {
-    PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
-  }
-
-  // NOTE(willchan): We don't actually execute this code since we leak NSS to
-  // prevent non-joinable threads from using NSS after it's already been shut
-  // down.
-  ~NSPRInitSingleton() {
-    PL_ArenaFinish();
-    PRStatus prstatus = PR_Cleanup();
-    if (prstatus != PR_SUCCESS)
-      LOG(ERROR) << "PR_Cleanup failed; was NSPR initialized on wrong thread?";
-  }
-};
-
-base::LazyInstance<NSPRInitSingleton>::Leaky
-    g_nspr_singleton = LAZY_INSTANCE_INITIALIZER;
-
-// This is a LazyInstance so that it will be deleted automatically when the
-// unittest exits.  NSSInitSingleton is a LeakySingleton, so it would not be
-// deleted if it were a regular member.
-base::LazyInstance<base::ScopedTempDir> g_test_nss_db_dir =
-    LAZY_INSTANCE_INITIALIZER;
-
-// Force a crash with error info on NSS_NoDB_Init failure.
-void CrashOnNSSInitFailure() {
-  int nss_error = PR_GetError();
-  int os_error = PR_GetOSError();
-  base::debug::Alias(&nss_error);
-  base::debug::Alias(&os_error);
-  LOG(ERROR) << "Error initializing NSS without a persistent database: "
-             << GetNSSErrorMessage();
-  LOG(FATAL) << "nss_error=" << nss_error << ", os_error=" << os_error;
-}
-
-class NSSInitSingleton {
- public:
-#if defined(OS_CHROMEOS)
-  void OpenPersistentNSSDB() {
-    if (!chromeos_user_logged_in_) {
-      // GetDefaultConfigDirectory causes us to do blocking IO on UI thread.
-      // Temporarily allow it until we fix http://crbug.com/70119
-      base::ThreadRestrictions::ScopedAllowIO allow_io;
-      chromeos_user_logged_in_ = true;
-
-      // This creates another DB slot in NSS that is read/write, unlike
-      // the fake root CA cert DB and the "default" crypto key
-      // provider, which are still read-only (because we initialized
-      // NSS before we had a cryptohome mounted).
-      software_slot_ = OpenUserDB(GetDefaultConfigDirectory(),
-                                  kNSSDatabaseName);
-    }
-  }
-
-  void EnableTPMTokenForNSS() {
-    tpm_token_enabled_for_nss_ = true;
-  }
-
-  bool InitializeTPMToken(const std::string& token_name,
-                          const std::string& user_pin) {
-    // If EnableTPMTokenForNSS hasn't been called, return false.
-    if (!tpm_token_enabled_for_nss_)
-      return false;
-
-    // If everything is already initialized, then return true.
-    if (chaps_module_ && tpm_slot_)
-      return true;
-
-    tpm_token_name_ = token_name;
-    tpm_user_pin_ = user_pin;
-
-    // This tries to load the Chaps module so NSS can talk to the hardware
-    // TPM.
-    if (!chaps_module_) {
-      chaps_module_ = LoadModule(
-          kChapsModuleName,
-          kChapsPath,
-          // For more details on these parameters, see:
-          // https://developer.mozilla.org/en/PKCS11_Module_Specs
-          // slotFlags=[PublicCerts] -- Certificates and public keys can be
-          //   read from this slot without requiring a call to C_Login.
-          // askpw=only -- Only authenticate to the token when necessary.
-          "NSS=\"slotParams=(0={slotFlags=[PublicCerts] askpw=only})\"");
-    }
-    if (chaps_module_){
-      // If this gets set, then we'll use the TPM for certs with
-      // private keys, otherwise we'll fall back to the software
-      // implementation.
-      tpm_slot_ = GetTPMSlot();
-
-      return tpm_slot_ != NULL;
-    }
-    return false;
-  }
-
-  void GetTPMTokenInfo(std::string* token_name, std::string* user_pin) {
-    if (!tpm_token_enabled_for_nss_) {
-      LOG(ERROR) << "GetTPMTokenInfo called before TPM Token is ready.";
-      return;
-    }
-    if (token_name)
-      *token_name = tpm_token_name_;
-    if (user_pin)
-      *user_pin = tpm_user_pin_;
-  }
-
-  bool IsTPMTokenReady() {
-    return tpm_slot_ != NULL;
-  }
-
-  PK11SlotInfo* GetTPMSlot() {
-    std::string token_name;
-    GetTPMTokenInfo(&token_name, NULL);
-    return FindSlotWithTokenName(token_name);
-  }
-
-  SymmetricKey* GetSupplementalUserKey() {
-    DCHECK(chromeos_user_logged_in_);
-
-    PK11SlotInfo* slot = NULL;
-    PK11SymKey* key = NULL;
-    SECItem keyID;
-    CK_MECHANISM_TYPE type = CKM_AES_ECB;
-
-    slot = GetPublicNSSKeySlot();
-    if (!slot)
-      goto done;
-
-    if (PK11_Authenticate(slot, PR_TRUE, NULL) != SECSuccess)
-      goto done;
-
-    keyID.type = siBuffer;
-    keyID.data = kSupplementalUserKeyId;
-    keyID.len = static_cast<int>(sizeof(kSupplementalUserKeyId));
-
-    // Find/generate AES key.
-    key = PK11_FindFixedKey(slot, type, &keyID, NULL);
-    if (!key) {
-      const int kKeySizeInBytes = 32;
-      key = PK11_TokenKeyGen(slot, type, NULL,
-                             kKeySizeInBytes,
-                             &keyID, PR_TRUE, NULL);
-    }
-
-  done:
-    if (slot)
-      PK11_FreeSlot(slot);
-
-    return key ? SymmetricKey::CreateFromKey(key) : NULL;
-  }
-#endif  // defined(OS_CHROMEOS)
-
-
-  bool OpenTestNSSDB() {
-    if (test_slot_)
-      return true;
-    if (!g_test_nss_db_dir.Get().CreateUniqueTempDir())
-      return false;
-    test_slot_ = OpenUserDB(g_test_nss_db_dir.Get().path(), "Test DB");
-    return !!test_slot_;
-  }
-
-  void CloseTestNSSDB() {
-    if (test_slot_) {
-      SECStatus status = SECMOD_CloseUserDB(test_slot_);
-      if (status != SECSuccess)
-        PLOG(ERROR) << "SECMOD_CloseUserDB failed: " << PORT_GetError();
-      PK11_FreeSlot(test_slot_);
-      test_slot_ = NULL;
-      ignore_result(g_test_nss_db_dir.Get().Delete());
-    }
-  }
-
-  PK11SlotInfo* GetPublicNSSKeySlot() {
-    if (test_slot_)
-      return PK11_ReferenceSlot(test_slot_);
-    if (software_slot_)
-      return PK11_ReferenceSlot(software_slot_);
-    return PK11_GetInternalKeySlot();
-  }
-
-  PK11SlotInfo* GetPrivateNSSKeySlot() {
-    if (test_slot_)
-      return PK11_ReferenceSlot(test_slot_);
-
-#if defined(OS_CHROMEOS)
-    if (tpm_token_enabled_for_nss_) {
-      if (IsTPMTokenReady()) {
-        return PK11_ReferenceSlot(tpm_slot_);
-      } else {
-        // If we were supposed to get the hardware token, but were
-        // unable to, return NULL rather than fall back to sofware.
-        return NULL;
-      }
-    }
-#endif
-    // If we weren't supposed to enable the TPM for NSS, then return
-    // the software slot.
-    if (software_slot_)
-      return PK11_ReferenceSlot(software_slot_);
-    return PK11_GetInternalKeySlot();
-  }
-
-#if defined(USE_NSS)
-  base::Lock* write_lock() {
-    return &write_lock_;
-  }
-#endif  // defined(USE_NSS)
-
-  // This method is used to force NSS to be initialized without a DB.
-  // Call this method before NSSInitSingleton() is constructed.
-  static void ForceNoDBInit() {
-    force_nodb_init_ = true;
-  }
-
- private:
-  friend struct base::DefaultLazyInstanceTraits<NSSInitSingleton>;
-
-  NSSInitSingleton()
-      : tpm_token_enabled_for_nss_(false),
-        chaps_module_(NULL),
-        software_slot_(NULL),
-        test_slot_(NULL),
-        tpm_slot_(NULL),
-        root_(NULL),
-        chromeos_user_logged_in_(false) {
-    EnsureNSPRInit();
-
-    // We *must* have NSS >= 3.12.3.  See bug 26448.
-    COMPILE_ASSERT(
-        (NSS_VMAJOR == 3 && NSS_VMINOR == 12 && NSS_VPATCH >= 3) ||
-        (NSS_VMAJOR == 3 && NSS_VMINOR > 12) ||
-        (NSS_VMAJOR > 3),
-        nss_version_check_failed);
-    // Also check the run-time NSS version.
-    // NSS_VersionCheck is a >= check, not strict equality.
-    if (!NSS_VersionCheck("3.12.3")) {
-      // It turns out many people have misconfigured NSS setups, where
-      // their run-time NSPR doesn't match the one their NSS was compiled
-      // against.  So rather than aborting, complain loudly.
-      LOG(ERROR) << "NSS_VersionCheck(\"3.12.3\") failed.  "
-                    "We depend on NSS >= 3.12.3, and this error is not fatal "
-                    "only because many people have busted NSS setups (for "
-                    "example, using the wrong version of NSPR). "
-                    "Please upgrade to the latest NSS and NSPR, and if you "
-                    "still get this error, contact your distribution "
-                    "maintainer.";
-    }
-
-    SECStatus status = SECFailure;
-    bool nodb_init = force_nodb_init_;
-
-#if !defined(USE_NSS)
-    // Use the system certificate store, so initialize NSS without database.
-    nodb_init = true;
-#endif
-
-    if (nodb_init) {
-      status = NSS_NoDB_Init(NULL);
-      if (status != SECSuccess) {
-        CrashOnNSSInitFailure();
-        return;
-      }
-#if defined(OS_IOS)
-      root_ = InitDefaultRootCerts();
-#endif  // defined(OS_IOS)
-    } else {
-#if defined(USE_NSS)
-      FilePath database_dir = GetInitialConfigDirectory();
-      if (!database_dir.empty()) {
-        // This duplicates the work which should have been done in
-        // EarlySetupForNSSInit. However, this function is idempotent so
-        // there's no harm done.
-        UseLocalCacheOfNSSDatabaseIfNFS(database_dir);
-
-        // Initialize with a persistent database (likely, ~/.pki/nssdb).
-        // Use "sql:" which can be shared by multiple processes safely.
-        std::string nss_config_dir =
-            StringPrintf("sql:%s", database_dir.value().c_str());
-#if defined(OS_CHROMEOS)
-        status = NSS_Init(nss_config_dir.c_str());
-#else
-        status = NSS_InitReadWrite(nss_config_dir.c_str());
-#endif
-        if (status != SECSuccess) {
-          LOG(ERROR) << "Error initializing NSS with a persistent "
-                        "database (" << nss_config_dir
-                     << "): " << GetNSSErrorMessage();
-        }
-      }
-      if (status != SECSuccess) {
-        VLOG(1) << "Initializing NSS without a persistent database.";
-        status = NSS_NoDB_Init(NULL);
-        if (status != SECSuccess) {
-          CrashOnNSSInitFailure();
-          return;
-        }
-      }
-
-      PK11_SetPasswordFunc(PKCS11PasswordFunc);
-
-      // If we haven't initialized the password for the NSS databases,
-      // initialize an empty-string password so that we don't need to
-      // log in.
-      PK11SlotInfo* slot = PK11_GetInternalKeySlot();
-      if (slot) {
-        // PK11_InitPin may write to the keyDB, but no other thread can use NSS
-        // yet, so we don't need to lock.
-        if (PK11_NeedUserInit(slot))
-          PK11_InitPin(slot, NULL, NULL);
-        PK11_FreeSlot(slot);
-      }
-
-      root_ = InitDefaultRootCerts();
-#endif  // defined(USE_NSS)
-    }
-
-    // Disable MD5 certificate signatures. (They are disabled by default in
-    // NSS 3.14.)
-    NSS_SetAlgorithmPolicy(SEC_OID_MD5, 0, NSS_USE_ALG_IN_CERT_SIGNATURE);
-    NSS_SetAlgorithmPolicy(SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION,
-                           0, NSS_USE_ALG_IN_CERT_SIGNATURE);
-  }
-
-  // NOTE(willchan): We don't actually execute this code since we leak NSS to
-  // prevent non-joinable threads from using NSS after it's already been shut
-  // down.
-  ~NSSInitSingleton() {
-    if (tpm_slot_) {
-      PK11_FreeSlot(tpm_slot_);
-      tpm_slot_ = NULL;
-    }
-    if (software_slot_) {
-      SECMOD_CloseUserDB(software_slot_);
-      PK11_FreeSlot(software_slot_);
-      software_slot_ = NULL;
-    }
-    CloseTestNSSDB();
-    if (root_) {
-      SECMOD_UnloadUserModule(root_);
-      SECMOD_DestroyModule(root_);
-      root_ = NULL;
-    }
-    if (chaps_module_) {
-      SECMOD_UnloadUserModule(chaps_module_);
-      SECMOD_DestroyModule(chaps_module_);
-      chaps_module_ = NULL;
-    }
-
-    SECStatus status = NSS_Shutdown();
-    if (status != SECSuccess) {
-      // We VLOG(1) because this failure is relatively harmless (leaking, but
-      // we're shutting down anyway).
-      VLOG(1) << "NSS_Shutdown failed; see http://crbug.com/4609";
-    }
-  }
-
-#if defined(USE_NSS) || defined(OS_IOS)
-  // Load nss's built-in root certs.
-  SECMODModule* InitDefaultRootCerts() {
-    SECMODModule* root = LoadModule("Root Certs", "libnssckbi.so", NULL);
-    if (root)
-      return root;
-
-    // Aw, snap.  Can't find/load root cert shared library.
-    // This will make it hard to talk to anybody via https.
-    NOTREACHED();
-    return NULL;
-  }
-
-  // Load the given module for this NSS session.
-  SECMODModule* LoadModule(const char* name,
-                           const char* library_path,
-                           const char* params) {
-    std::string modparams = StringPrintf(
-        "name=\"%s\" library=\"%s\" %s",
-        name, library_path, params ? params : "");
-
-    // Shouldn't need to const_cast here, but SECMOD doesn't properly
-    // declare input string arguments as const.  Bug
-    // https://bugzilla.mozilla.org/show_bug.cgi?id=642546 was filed
-    // on NSS codebase to address this.
-    SECMODModule* module = SECMOD_LoadUserModule(
-        const_cast<char*>(modparams.c_str()), NULL, PR_FALSE);
-    if (!module) {
-      LOG(ERROR) << "Error loading " << name << " module into NSS: "
-                 << GetNSSErrorMessage();
-      return NULL;
-    }
-    return module;
-  }
-#endif
-
-  static PK11SlotInfo* OpenUserDB(const FilePath& path,
-                                  const char* description) {
-    const std::string modspec =
-        StringPrintf("configDir='sql:%s' tokenDescription='%s'",
-                     path.value().c_str(), description);
-    PK11SlotInfo* db_slot = SECMOD_OpenUserDB(modspec.c_str());
-    if (db_slot) {
-      if (PK11_NeedUserInit(db_slot))
-        PK11_InitPin(db_slot, NULL, NULL);
-    }
-    else {
-      LOG(ERROR) << "Error opening persistent database (" << modspec
-                 << "): " << GetNSSErrorMessage();
-    }
-    return db_slot;
-  }
-
-  // If this is set to true NSS is forced to be initialized without a DB.
-  static bool force_nodb_init_;
-
-  bool tpm_token_enabled_for_nss_;
-  std::string tpm_token_name_;
-  std::string tpm_user_pin_;
-  SECMODModule* chaps_module_;
-  PK11SlotInfo* software_slot_;
-  PK11SlotInfo* test_slot_;
-  PK11SlotInfo* tpm_slot_;
-  SECMODModule* root_;
-  bool chromeos_user_logged_in_;
-#if defined(USE_NSS)
-  // TODO(davidben): When https://bugzilla.mozilla.org/show_bug.cgi?id=564011
-  // is fixed, we will no longer need the lock.
-  base::Lock write_lock_;
-#endif  // defined(USE_NSS)
-};
-
-// static
-bool NSSInitSingleton::force_nodb_init_ = false;
-
-base::LazyInstance<NSSInitSingleton>::Leaky
-    g_nss_singleton = LAZY_INSTANCE_INITIALIZER;
-}  // namespace
-
-#if defined(USE_NSS)
-void EarlySetupForNSSInit() {
-  FilePath database_dir = GetInitialConfigDirectory();
-  if (!database_dir.empty())
-    UseLocalCacheOfNSSDatabaseIfNFS(database_dir);
-}
-#endif
-
-void EnsureNSPRInit() {
-  g_nspr_singleton.Get();
-}
-
-void InitNSSSafely() {
-  // We might fork, but we haven't loaded any security modules.
-  DisableNSSForkCheck();
-  // If we're sandboxed, we shouldn't be able to open user security modules,
-  // but it's more correct to tell NSS to not even try.
-  // Loading user security modules would have security implications.
-  ForceNSSNoDBInit();
-  // Initialize NSS.
-  EnsureNSSInit();
-}
-
-void EnsureNSSInit() {
-  // Initializing SSL causes us to do blocking IO.
-  // Temporarily allow it until we fix
-  //   http://code.google.com/p/chromium/issues/detail?id=59847
-  base::ThreadRestrictions::ScopedAllowIO allow_io;
-  g_nss_singleton.Get();
-}
-
-void ForceNSSNoDBInit() {
-  NSSInitSingleton::ForceNoDBInit();
-}
-
-void DisableNSSForkCheck() {
-  scoped_ptr<base::Environment> env(base::Environment::Create());
-  env->SetVar("NSS_STRICT_NOFORK", "DISABLED");
-}
-
-void LoadNSSLibraries() {
-  // Some NSS libraries are linked dynamically so load them here.
-#if defined(USE_NSS)
-  // Try to search for multiple directories to load the libraries.
-  std::vector<FilePath> paths;
-
-  // Use relative path to Search PATH for the library files.
-  paths.push_back(FilePath());
-
-  // For Debian derivatives NSS libraries are located here.
-  paths.push_back(FilePath("/usr/lib/nss"));
-
-  // Ubuntu 11.10 (Oneiric) places the libraries here.
-#if defined(ARCH_CPU_X86_64)
-  paths.push_back(FilePath("/usr/lib/x86_64-linux-gnu/nss"));
-#elif defined(ARCH_CPU_X86)
-  paths.push_back(FilePath("/usr/lib/i386-linux-gnu/nss"));
-#elif defined(ARCH_CPU_ARMEL)
-  paths.push_back(FilePath("/usr/lib/arm-linux-gnueabi/nss"));
-#endif
-
-  // A list of library files to load.
-  std::vector<std::string> libs;
-  libs.push_back("libsoftokn3.so");
-  libs.push_back("libfreebl3.so");
-
-  // For each combination of library file and path, check for existence and
-  // then load.
-  size_t loaded = 0;
-  for (size_t i = 0; i < libs.size(); ++i) {
-    for (size_t j = 0; j < paths.size(); ++j) {
-      FilePath path = paths[j].Append(libs[i]);
-      base::NativeLibrary lib = base::LoadNativeLibrary(path, NULL);
-      if (lib) {
-        ++loaded;
-        break;
-      }
-    }
-  }
-
-  if (loaded == libs.size()) {
-    VLOG(3) << "NSS libraries loaded.";
-  } else {
-    LOG(ERROR) << "Failed to load NSS libraries.";
-  }
-#endif
-}
-
-bool CheckNSSVersion(const char* version) {
-  return !!NSS_VersionCheck(version);
-}
-
-#if defined(USE_NSS)
-ScopedTestNSSDB::ScopedTestNSSDB()
-  : is_open_(g_nss_singleton.Get().OpenTestNSSDB()) {
-}
-
-ScopedTestNSSDB::~ScopedTestNSSDB() {
-  // TODO(mattm): Close the dababase once NSS 3.14 is required,
-  // which fixes https://bugzilla.mozilla.org/show_bug.cgi?id=588269
-  // Resource leaks are suppressed. http://crbug.com/156433 .
-}
-
-base::Lock* GetNSSWriteLock() {
-  return g_nss_singleton.Get().write_lock();
-}
-
-AutoNSSWriteLock::AutoNSSWriteLock() : lock_(GetNSSWriteLock()) {
-  // May be NULL if the lock is not needed in our version of NSS.
-  if (lock_)
-    lock_->Acquire();
-}
-
-AutoNSSWriteLock::~AutoNSSWriteLock() {
-  if (lock_) {
-    lock_->AssertAcquired();
-    lock_->Release();
-  }
-}
-
-AutoSECMODListReadLock::AutoSECMODListReadLock()
-      : lock_(SECMOD_GetDefaultModuleListLock()) {
-    SECMOD_GetReadLock(lock_);
-  }
-
-AutoSECMODListReadLock::~AutoSECMODListReadLock() {
-  SECMOD_ReleaseReadLock(lock_);
-}
-
-#endif  // defined(USE_NSS)
-
-#if defined(OS_CHROMEOS)
-void OpenPersistentNSSDB() {
-  g_nss_singleton.Get().OpenPersistentNSSDB();
-}
-
-void EnableTPMTokenForNSS() {
-  g_nss_singleton.Get().EnableTPMTokenForNSS();
-}
-
-void GetTPMTokenInfo(std::string* token_name, std::string* user_pin) {
-  g_nss_singleton.Get().GetTPMTokenInfo(token_name, user_pin);
-}
-
-bool IsTPMTokenReady() {
-  return g_nss_singleton.Get().IsTPMTokenReady();
-}
-
-bool InitializeTPMToken(const std::string& token_name,
-                        const std::string& user_pin) {
-  return g_nss_singleton.Get().InitializeTPMToken(token_name, user_pin);
-}
-
-SymmetricKey* GetSupplementalUserKey() {
-  return g_nss_singleton.Get().GetSupplementalUserKey();
-}
-#endif  // defined(OS_CHROMEOS)
-
-base::Time PRTimeToBaseTime(PRTime prtime) {
-  return base::Time::FromInternalValue(
-      prtime + base::Time::UnixEpoch().ToInternalValue());
-}
-
-PRTime BaseTimeToPRTime(base::Time time) {
-  return time.ToInternalValue() - base::Time::UnixEpoch().ToInternalValue();
-}
-
-PK11SlotInfo* GetPublicNSSKeySlot() {
-  return g_nss_singleton.Get().GetPublicNSSKeySlot();
-}
-
-PK11SlotInfo* GetPrivateNSSKeySlot() {
-  return g_nss_singleton.Get().GetPrivateNSSKeySlot();
-}
-
-}  // namespace crypto
diff --git a/src/crypto/nss_util_internal.h b/src/crypto/nss_util_internal.h
deleted file mode 100644
index 056ec28..0000000
--- a/src/crypto/nss_util_internal.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 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 CRYPTO_NSS_UTIL_INTERNAL_H_
-#define CRYPTO_NSS_UTIL_INTERNAL_H_
-
-#include <secmodt.h>
-
-#include "crypto/crypto_export.h"
-
-// These functions return a type defined in an NSS header, and so cannot be
-// declared in nss_util.h.  Hence, they are declared here.
-
-namespace crypto {
-
-// Returns a reference to the default NSS key slot for storing
-// public-key data only (e.g. server certs). Caller must release
-// returned reference with PK11_FreeSlot.
-CRYPTO_EXPORT PK11SlotInfo* GetPublicNSSKeySlot();
-
-// Returns a reference to the default slot for storing private-key and
-// mixed private-key/public-key data.  Returns a hardware (TPM) NSS
-// key slot if on ChromeOS and EnableTPMForNSS() has been called
-// successfully. Caller must release returned reference with
-// PK11_FreeSlot.
-CRYPTO_EXPORT PK11SlotInfo* GetPrivateNSSKeySlot();
-
-// A helper class that acquires the SECMOD list read lock while the
-// AutoSECMODListReadLock is in scope.
-class AutoSECMODListReadLock {
- public:
-  AutoSECMODListReadLock();
-  ~AutoSECMODListReadLock();
-
- private:
-  SECMODListLock* lock_;
-  DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock);
-};
-
-}  // namespace crypto
-
-#endif  // CRYPTO_NSS_UTIL_INTERNAL_H_
diff --git a/src/crypto/nss_util_unittest.cc b/src/crypto/nss_util_unittest.cc
deleted file mode 100644
index cc24b61..0000000
--- a/src/crypto/nss_util_unittest.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2011 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 "crypto/nss_util.h"
-
-#include <prtime.h>
-
-#include "base/time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace crypto {
-
-TEST(NSSUtilTest, PRTimeConversion) {
-  EXPECT_EQ(base::Time::UnixEpoch(), PRTimeToBaseTime(0));
-  EXPECT_EQ(0, BaseTimeToPRTime(base::Time::UnixEpoch()));
-
-  PRExplodedTime prxtime;
-  prxtime.tm_params.tp_gmt_offset = 0;
-  prxtime.tm_params.tp_dst_offset = 0;
-  base::Time::Exploded exploded;
-  prxtime.tm_year = exploded.year = 2011;
-  exploded.month = 12;
-  prxtime.tm_month = 11;
-  prxtime.tm_wday = exploded.day_of_week = 0;  // Should be unusued.
-  prxtime.tm_mday = exploded.day_of_month = 10;
-  prxtime.tm_hour = exploded.hour = 2;
-  prxtime.tm_min = exploded.minute = 52;
-  prxtime.tm_sec = exploded.second = 19;
-  exploded.millisecond = 342;
-  prxtime.tm_usec = 342000;
-
-  PRTime pr_time = PR_ImplodeTime(&prxtime);
-  base::Time base_time = base::Time::FromUTCExploded(exploded);
-
-  EXPECT_EQ(base_time, PRTimeToBaseTime(pr_time));
-  EXPECT_EQ(pr_time, BaseTimeToPRTime(base_time));
-}
-
-}  // namespace crypto
diff --git a/src/crypto/openpgp_symmetric_encryption.cc b/src/crypto/openpgp_symmetric_encryption.cc
deleted file mode 100644
index 702952b..0000000
--- a/src/crypto/openpgp_symmetric_encryption.cc
+++ /dev/null
@@ -1,795 +0,0 @@
-// Copyright (c) 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 "crypto/openpgp_symmetric_encryption.h"
-
-#include <stdlib.h>
-
-#include <sechash.h>
-#include <cryptohi.h>
-
-#include <vector>
-
-#include "base/logging.h"
-#include "crypto/random.h"
-#include "crypto/scoped_nss_types.h"
-#include "crypto/nss_util.h"
-
-namespace crypto {
-
-namespace {
-
-// Reader wraps a StringPiece and provides methods to read several datatypes
-// while advancing the StringPiece.
-class Reader {
- public:
-  Reader(base::StringPiece input)
-      : data_(input) {
-  }
-
-  bool U8(uint8* out) {
-    if (data_.size() < 1)
-      return false;
-    *out = static_cast<uint8>(data_[0]);
-    data_.remove_prefix(1);
-    return true;
-  }
-
-  bool U32(uint32* out) {
-    if (data_.size() < 4)
-      return false;
-    *out = static_cast<uint32>(data_[0]) << 24 |
-           static_cast<uint32>(data_[1]) << 16 |
-           static_cast<uint32>(data_[2]) << 8 |
-           static_cast<uint32>(data_[3]);
-    data_.remove_prefix(4);
-    return true;
-  }
-
-  // Prefix sets |*out| to the first |n| bytes of the StringPiece and advances
-  // the StringPiece by |n|.
-  bool Prefix(size_t n, base::StringPiece *out) {
-    if (data_.size() < n)
-      return false;
-    *out = base::StringPiece(data_.data(), n);
-    data_.remove_prefix(n);
-    return true;
-  }
-
-  // Remainder returns the remainer of the StringPiece and advances it to the
-  // end.
-  base::StringPiece Remainder() {
-    base::StringPiece ret = data_;
-    data_ = base::StringPiece();
-    return ret;
-  }
-
-  typedef base::StringPiece Position;
-
-  Position tell() const {
-    return data_;
-  }
-
-  void Seek(Position p) {
-    data_ = p;
-  }
-
-  bool Skip(size_t n) {
-    if (data_.size() < n)
-      return false;
-    data_.remove_prefix(n);
-    return true;
-  }
-
-  bool empty() const {
-    return data_.empty();
-  }
-
-  size_t size() const {
-    return data_.size();
-  }
-
- private:
-  base::StringPiece data_;
-};
-
-// SaltedIteratedS2K implements the salted and iterated string-to-key
-// convertion. See RFC 4880, section 3.7.1.3.
-void SaltedIteratedS2K(unsigned cipher_key_length,
-                       HASH_HashType hash_function,
-                       base::StringPiece passphrase,
-                       base::StringPiece salt,
-                       unsigned count,
-                       uint8 *out_key) {
-  const std::string combined = salt.as_string() + passphrase.as_string();
-  const size_t combined_len = combined.size();
-
-  unsigned done = 0;
-  uint8 zero[1] = {0};
-
-  HASHContext* hash_context = HASH_Create(hash_function);
-
-  for (unsigned i = 0; done < cipher_key_length; i++) {
-    HASH_Begin(hash_context);
-
-    for (unsigned j = 0; j < i; j++)
-      HASH_Update(hash_context, zero, sizeof(zero));
-
-    unsigned written = 0;
-    while (written < count) {
-      if (written + combined_len > count) {
-        unsigned todo = count - written;
-        HASH_Update(hash_context,
-                     reinterpret_cast<const uint8*>(combined.data()),
-                     todo);
-        written = count;
-      } else {
-        HASH_Update(hash_context,
-                     reinterpret_cast<const uint8*>(combined.data()),
-                     combined_len);
-        written += combined_len;
-      }
-    }
-
-    unsigned num_hash_bytes;
-    uint8 digest[HASH_LENGTH_MAX];
-    HASH_End(hash_context, digest, &num_hash_bytes, sizeof(digest));
-
-    unsigned todo = cipher_key_length - done;
-    if (todo > num_hash_bytes)
-      todo = num_hash_bytes;
-    memcpy(out_key + done, digest, todo);
-    done += todo;
-  }
-
-  HASH_Destroy(hash_context);
-}
-
-// CreateAESContext sets up |out_key| to be an AES context, with the given key,
-// in ECB mode and with no IV.
-bool CreateAESContext(const uint8* key, unsigned key_len,
-                      ScopedPK11Context* out_decryption_context) {
-  ScopedPK11Slot slot(PK11_GetInternalSlot());
-  if (!slot.get())
-    return false;
-  SECItem key_item;
-  key_item.type = siBuffer;
-  key_item.data = const_cast<uint8*>(key);
-  key_item.len = key_len;
-  ScopedPK11SymKey pk11_key(PK11_ImportSymKey(
-      slot.get(), CKM_AES_ECB, PK11_OriginUnwrap, CKA_ENCRYPT, &key_item,
-      NULL));
-  if (!pk11_key.get())
-    return false;
-  ScopedSECItem iv_param(PK11_ParamFromIV(CKM_AES_ECB, NULL));
-  out_decryption_context->reset(
-      PK11_CreateContextBySymKey(CKM_AES_ECB, CKA_ENCRYPT, pk11_key.get(),
-                                 iv_param.get()));
-  return out_decryption_context->get() != NULL;
-}
-
-
-// These constants are the tag numbers for the various packet types that we
-// use.
-static const unsigned kSymmetricKeyEncryptedTag = 3;
-static const unsigned kSymmetricallyEncryptedTag = 18;
-static const unsigned kCompressedTag = 8;
-static const unsigned kLiteralDataTag = 11;
-
-class Decrypter {
- public:
-  ~Decrypter() {
-    for (std::vector<void*>::iterator
-         i = arena_.begin(); i != arena_.end(); i++) {
-      free(*i);
-    }
-    arena_.clear();
-  }
-
-  OpenPGPSymmetricEncrytion::Result Decrypt(base::StringPiece in,
-                                            base::StringPiece passphrase,
-                                            base::StringPiece *out_contents) {
-    Reader reader(in);
-    unsigned tag;
-    base::StringPiece contents;
-    ScopedPK11Context decryption_context;
-
-    if (!ParsePacket(&reader, &tag, &contents))
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    if (tag != kSymmetricKeyEncryptedTag)
-      return OpenPGPSymmetricEncrytion::NOT_SYMMETRICALLY_ENCRYPTED;
-    Reader inner(contents);
-    OpenPGPSymmetricEncrytion::Result result =
-      ParseSymmetricKeyEncrypted(&inner, passphrase, &decryption_context);
-    if (result != OpenPGPSymmetricEncrytion::OK)
-      return result;
-
-    if (!ParsePacket(&reader, &tag, &contents))
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    if (tag != kSymmetricallyEncryptedTag)
-      return OpenPGPSymmetricEncrytion::NOT_SYMMETRICALLY_ENCRYPTED;
-    if (!reader.empty())
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    inner = Reader(contents);
-    if (!ParseSymmetricallyEncrypted(&inner, &decryption_context, &contents))
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-
-    reader = Reader(contents);
-    if (!ParsePacket(&reader, &tag, &contents))
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    if (tag == kCompressedTag)
-      return OpenPGPSymmetricEncrytion::COMPRESSED;
-    if (tag != kLiteralDataTag)
-      return OpenPGPSymmetricEncrytion::NOT_SYMMETRICALLY_ENCRYPTED;
-    inner = Reader(contents);
-    if (!ParseLiteralData(&inner, out_contents))
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-
-    return OpenPGPSymmetricEncrytion::OK;
-  }
-
- private:
-  // ParsePacket parses an OpenPGP packet from reader. See RFC 4880, section
-  // 4.2.2.
-  bool ParsePacket(Reader *reader,
-                   unsigned *out_tag,
-                   base::StringPiece *out_contents) {
-    uint8 header;
-    if (!reader->U8(&header))
-      return false;
-    if ((header & 0x80) == 0) {
-      // Tag byte must have MSB set.
-      return false;
-    }
-
-    if ((header & 0x40) == 0) {
-      // Old format packet.
-      *out_tag = (header & 0x3f) >> 2;
-
-      uint8 length_type = header & 3;
-      if (length_type == 3) {
-        *out_contents = reader->Remainder();
-        return true;
-      }
-
-      const unsigned length_bytes = 1 << length_type;
-      size_t length = 0;
-      for (unsigned i = 0; i < length_bytes; i++) {
-        uint8 length_byte;
-        if (!reader->U8(&length_byte))
-          return false;
-        length <<= 8;
-        length |= length_byte;
-      }
-
-      return reader->Prefix(length, out_contents);
-    }
-
-    // New format packet.
-    *out_tag = header & 0x3f;
-    size_t length;
-    bool is_partial;
-    if (!ParseLength(reader, &length, &is_partial))
-      return false;
-    if (is_partial)
-      return ParseStreamContents(reader, length, out_contents);
-    return reader->Prefix(length, out_contents);
-  }
-
-  // ParseStreamContents parses all the chunks of a partial length stream from
-  // reader. See http://tools.ietf.org/html/rfc4880#section-4.2.2.4
-  bool ParseStreamContents(Reader *reader,
-                           size_t length,
-                           base::StringPiece *out_contents) {
-    const Reader::Position beginning_of_stream = reader->tell();
-    const size_t first_chunk_length = length;
-
-    // First we parse the stream to find its length.
-    if (!reader->Skip(length))
-      return false;
-
-    for (;;) {
-      size_t chunk_length;
-      bool is_partial;
-
-      if (!ParseLength(reader, &chunk_length, &is_partial))
-        return false;
-      if (length + chunk_length < length)
-        return false;
-      length += chunk_length;
-      if (!reader->Skip(chunk_length))
-        return false;
-      if (!is_partial)
-        break;
-    }
-
-    // Now we have the length of the whole stream in |length|.
-    char* buf = reinterpret_cast<char*>(malloc(length));
-    arena_.push_back(buf);
-    size_t j = 0;
-    reader->Seek(beginning_of_stream);
-
-    base::StringPiece first_chunk;
-    if (!reader->Prefix(first_chunk_length, &first_chunk))
-      return false;
-    memcpy(buf + j, first_chunk.data(), first_chunk_length);
-    j += first_chunk_length;
-
-    // Now we parse the stream again, this time copying into |buf|
-    for (;;) {
-      size_t chunk_length;
-      bool is_partial;
-
-      if (!ParseLength(reader, &chunk_length, &is_partial))
-        return false;
-      base::StringPiece chunk;
-      if (!reader->Prefix(chunk_length, &chunk))
-        return false;
-      memcpy(buf + j, chunk.data(), chunk_length);
-      j += chunk_length;
-      if (!is_partial)
-        break;
-    }
-
-    *out_contents = base::StringPiece(buf, length);
-    return true;
-  }
-
-  // ParseLength parses an OpenPGP length from reader. See RFC 4880, section
-  // 4.2.2.
-  bool ParseLength(Reader *reader, size_t *out_length, bool *out_is_prefix) {
-    uint8 length_spec;
-    if (!reader->U8(&length_spec))
-      return false;
-
-    *out_is_prefix = false;
-    if (length_spec < 192) {
-      *out_length = length_spec;
-      return true;
-    } else if (length_spec < 224) {
-      uint8 next_byte;
-      if (!reader->U8(&next_byte))
-        return false;
-
-      *out_length = (length_spec - 192) << 8;
-      *out_length += next_byte;
-      return true;
-    } else if (length_spec < 255) {
-      *out_length = 1u << (length_spec & 0x1f);
-      *out_is_prefix = true;
-      return true;
-    } else {
-      uint32 length32;
-      if (!reader->U32(&length32))
-        return false;
-      *out_length = length32;
-      return true;
-    }
-  }
-
-  // ParseSymmetricKeyEncrypted parses a passphrase protected session key. See
-  // RFC 4880, section 5.3.
-  OpenPGPSymmetricEncrytion::Result ParseSymmetricKeyEncrypted(
-      Reader *reader,
-      base::StringPiece passphrase,
-      ScopedPK11Context *decryption_context) {
-    uint8 version, cipher, s2k_type, hash_func_id;
-    if (!reader->U8(&version) || version != 4)
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-
-    if (!reader->U8(&cipher) ||
-        !reader->U8(&s2k_type) ||
-        !reader->U8(&hash_func_id)) {
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    }
-
-    uint8 cipher_key_length = OpenPGPCipherIdToKeyLength(cipher);
-    if (cipher_key_length == 0)
-      return OpenPGPSymmetricEncrytion::UNKNOWN_CIPHER;
-
-    HASH_HashType hash_function;
-    switch (hash_func_id) {
-    case 2:  // SHA-1
-      hash_function = HASH_AlgSHA1;
-      break;
-    case 8:  // SHA-256
-      hash_function = HASH_AlgSHA256;
-      break;
-    default:
-      return OpenPGPSymmetricEncrytion::UNKNOWN_HASH;
-    }
-
-    // This chunk of code parses the S2K specifier. See RFC 4880, section 3.7.1.
-    base::StringPiece salt;
-    uint8 key[32];
-    uint8 count_spec;
-    switch (s2k_type) {
-    case 1:
-      if (!reader->Prefix(8, &salt))
-        return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-      // Fall through.
-    case 0:
-      SaltedIteratedS2K(cipher_key_length, hash_function, passphrase, salt,
-                        passphrase.size() + salt.size(), key);
-      break;
-    case 3:
-      if (!reader->Prefix(8, &salt) ||
-          !reader->U8(&count_spec)) {
-        return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-      }
-      SaltedIteratedS2K(
-          cipher_key_length, hash_function, passphrase, salt,
-          static_cast<unsigned>(
-            16 + (count_spec&15)) << ((count_spec >> 4) + 6), key);
-      break;
-    default:
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    }
-
-    if (!CreateAESContext(key, cipher_key_length, decryption_context))
-      return OpenPGPSymmetricEncrytion::INTERNAL_ERROR;
-
-    if (reader->empty()) {
-      // The resulting key is used directly.
-      return OpenPGPSymmetricEncrytion::OK;
-    }
-
-    // The S2K derived key encrypts another key that follows:
-    base::StringPiece encrypted_key = reader->Remainder();
-    if (encrypted_key.size() < 1)
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-
-    uint8* plaintext_key = reinterpret_cast<uint8*>(
-        malloc(encrypted_key.size()));
-    arena_.push_back(plaintext_key);
-
-    CFBDecrypt(encrypted_key, decryption_context, plaintext_key);
-
-    cipher_key_length = OpenPGPCipherIdToKeyLength(plaintext_key[0]);
-    if (cipher_key_length == 0)
-      return OpenPGPSymmetricEncrytion::UNKNOWN_CIPHER;
-    if (encrypted_key.size() != 1u + cipher_key_length)
-      return OpenPGPSymmetricEncrytion::PARSE_ERROR;
-    if (!CreateAESContext(plaintext_key + 1, cipher_key_length,
-                          decryption_context)) {
-      return OpenPGPSymmetricEncrytion::INTERNAL_ERROR;
-    }
-    return OpenPGPSymmetricEncrytion::OK;
-  }
-
-  // CFBDecrypt decrypts the cipher-feedback encrypted data in |in| to |out|
-  // using |decryption_context| and assumes an IV of all zeros.
-  void CFBDecrypt(base::StringPiece in, ScopedPK11Context* decryption_context,
-                  uint8* out) {
-    // We need this for PK11_CipherOp to write to, but we never check it as we
-    // work in ECB mode, one block at a time.
-    int out_len;
-
-    uint8 mask[AES_BLOCK_SIZE];
-    memset(mask, 0, sizeof(mask));
-
-    unsigned used = AES_BLOCK_SIZE;
-
-    for (size_t i = 0; i < in.size(); i++) {
-      if (used == AES_BLOCK_SIZE) {
-        PK11_CipherOp(decryption_context->get(), mask, &out_len, sizeof(mask),
-                      mask, AES_BLOCK_SIZE);
-        used = 0;
-      }
-
-      uint8 t = in[i];
-      out[i] = t ^ mask[used];
-      mask[used] = t;
-      used++;
-    }
-  }
-
-  // OpenPGPCipherIdToKeyLength converts an OpenPGP cipher id (see RFC 4880,
-  // section 9.2) to the key length of that cipher. It returns 0 on error.
-  unsigned OpenPGPCipherIdToKeyLength(uint8 cipher) {
-    switch (cipher) {
-    case 7:  // AES-128
-      return 16;
-    case 8:  // AES-192
-      return 24;
-    case 9:  // AES-256
-      return 32;
-    default:
-      return 0;
-    }
-  }
-
-  // ParseSymmetricallyEncrypted parses a Symmetrically Encrypted packet. See
-  // RFC 4880, sections 5.7 and 5.13.
-  bool ParseSymmetricallyEncrypted(Reader *reader,
-                                   ScopedPK11Context *decryption_context,
-                                   base::StringPiece *out_plaintext) {
-    // We need this for PK11_CipherOp to write to, but we never check it as we
-    // work in ECB mode, one block at a time.
-    int out_len;
-
-    uint8 version;
-    if (!reader->U8(&version) || version != 1)
-      return false;
-
-    base::StringPiece prefix_sp;
-    if (!reader->Prefix(AES_BLOCK_SIZE + 2, &prefix_sp))
-      return false;
-    uint8 prefix[AES_BLOCK_SIZE + 2];
-    memcpy(prefix, prefix_sp.data(), sizeof(prefix));
-
-    uint8 prefix_copy[AES_BLOCK_SIZE + 2];
-    uint8 fre[AES_BLOCK_SIZE];
-
-    memset(prefix_copy, 0, AES_BLOCK_SIZE);
-    PK11_CipherOp(decryption_context->get(), fre, &out_len, sizeof(fre),
-                  prefix_copy, AES_BLOCK_SIZE);
-    for (unsigned i = 0; i < AES_BLOCK_SIZE; i++)
-      prefix_copy[i] = fre[i] ^ prefix[i];
-    PK11_CipherOp(decryption_context->get(), fre, &out_len, sizeof(fre), prefix,
-                  AES_BLOCK_SIZE);
-    prefix_copy[AES_BLOCK_SIZE] = prefix[AES_BLOCK_SIZE] ^ fre[0];
-    prefix_copy[AES_BLOCK_SIZE + 1] = prefix[AES_BLOCK_SIZE + 1] ^ fre[1];
-
-    if (prefix_copy[AES_BLOCK_SIZE - 2] != prefix_copy[AES_BLOCK_SIZE] ||
-        prefix_copy[AES_BLOCK_SIZE - 1] != prefix_copy[AES_BLOCK_SIZE + 1]) {
-      return false;
-    }
-
-    fre[0] = prefix[AES_BLOCK_SIZE];
-    fre[1] = prefix[AES_BLOCK_SIZE + 1];
-
-    unsigned out_used = 2;
-
-    const size_t plaintext_size = reader->size();
-    if (plaintext_size < SHA1_LENGTH + 2) {
-      // Too small to contain an MDC trailer.
-      return false;
-    }
-
-    uint8* plaintext = reinterpret_cast<uint8*>(malloc(plaintext_size));
-    arena_.push_back(plaintext);
-
-    for (size_t i = 0; i < plaintext_size; i++) {
-      uint8 b;
-      if (!reader->U8(&b))
-        return false;
-      if (out_used == AES_BLOCK_SIZE) {
-        PK11_CipherOp(decryption_context->get(), fre, &out_len, sizeof(fre),
-                      fre, AES_BLOCK_SIZE);
-        out_used = 0;
-      }
-
-      plaintext[i] = b ^ fre[out_used];
-      fre[out_used++] = b;
-    }
-
-    // The plaintext should be followed by a Modification Detection Code
-    // packet. This packet is specified such that the header is always
-    // serialized as exactly these two bytes:
-    if (plaintext[plaintext_size - SHA1_LENGTH - 2] != 0xd3 ||
-        plaintext[plaintext_size - SHA1_LENGTH - 1] != 0x14) {
-      return false;
-    }
-
-    HASHContext* hash_context = HASH_Create(HASH_AlgSHA1);
-    HASH_Begin(hash_context);
-    HASH_Update(hash_context, prefix_copy, sizeof(prefix_copy));
-    HASH_Update(hash_context, plaintext, plaintext_size - SHA1_LENGTH);
-    uint8 digest[SHA1_LENGTH];
-    unsigned num_hash_bytes;
-    HASH_End(hash_context, digest, &num_hash_bytes, sizeof(digest));
-    HASH_Destroy(hash_context);
-
-    if (memcmp(digest, &plaintext[plaintext_size - SHA1_LENGTH],
-               SHA1_LENGTH) != 0) {
-      return false;
-    }
-
-    *out_plaintext = base::StringPiece(reinterpret_cast<char*>(plaintext),
-                                       plaintext_size - SHA1_LENGTH);
-    return true;
-  }
-
-  // ParseLiteralData parses a Literal Data packet. See RFC 4880, section 5.9.
-  bool ParseLiteralData(Reader *reader, base::StringPiece *out_data) {
-    uint8 is_binary, filename_len;
-    if (!reader->U8(&is_binary) ||
-        !reader->U8(&filename_len) ||
-        !reader->Skip(filename_len) ||
-        !reader->Skip(sizeof(uint32) /* mtime */)) {
-      return false;
-    }
-
-    *out_data = reader->Remainder();
-    return true;
-  }
-
-  // arena_ contains malloced pointers that are used as temporary space during
-  // the decryption.
-  std::vector<void*> arena_;
-};
-
-class Encrypter {
- public:
-  // ByteString is used throughout in order to avoid signedness issues with a
-  // std::string.
-  typedef std::basic_string<uint8> ByteString;
-
-  static ByteString Encrypt(base::StringPiece plaintext,
-                            base::StringPiece passphrase) {
-    ByteString key;
-    ByteString ske = SerializeSymmetricKeyEncrypted(passphrase, &key);
-
-    ByteString literal_data = SerializeLiteralData(plaintext);
-    ByteString se = SerializeSymmetricallyEncrypted(literal_data, key);
-    return ske + se;
-  }
-
- private:
-  // MakePacket returns an OpenPGP packet tagged as type |tag|. It always uses
-  // new-format headers. See RFC 4880, section 4.2.
-  static ByteString MakePacket(unsigned tag, const ByteString& contents) {
-    ByteString header;
-    header.push_back(0x80 | 0x40 | tag);
-
-    if (contents.size() < 192) {
-      header.push_back(contents.size());
-    } else if (contents.size() < 8384) {
-      size_t length = contents.size();
-      length -= 192;
-      header.push_back(192 + (length >> 8));
-      header.push_back(length & 0xff);
-    } else {
-      size_t length = contents.size();
-      header.push_back(255);
-      header.push_back(length >> 24);
-      header.push_back(length >> 16);
-      header.push_back(length >> 8);
-      header.push_back(length);
-    }
-
-    return header + contents;
-  }
-
-  // SerializeLiteralData returns a Literal Data packet containing |contents|
-  // as binary data with no filename nor mtime specified. See RFC 4880, section
-  // 5.9.
-  static ByteString SerializeLiteralData(base::StringPiece contents) {
-    ByteString literal_data;
-    literal_data.push_back(0x74);  // text mode
-    literal_data.push_back(0x00);  // no filename
-    literal_data.push_back(0x00);  // zero mtime
-    literal_data.push_back(0x00);
-    literal_data.push_back(0x00);
-    literal_data.push_back(0x00);
-    literal_data += ByteString(reinterpret_cast<const uint8*>(contents.data()),
-                               contents.size());
-    return MakePacket(kLiteralDataTag, literal_data);
-  }
-
-  // SerializeSymmetricKeyEncrypted generates a random AES-128 key from
-  // |passphrase|, sets |out_key| to it and returns a Symmetric Key Encrypted
-  // packet. See RFC 4880, section 5.3.
-  static ByteString SerializeSymmetricKeyEncrypted(base::StringPiece passphrase,
-                                                   ByteString *out_key) {
-    ByteString ske;
-    ske.push_back(4);  // version 4
-    ske.push_back(7);  // AES-128
-    ske.push_back(3);  // iterated and salted S2K
-    ske.push_back(2);  // SHA-1
-
-    uint64 salt64;
-    crypto::RandBytes(&salt64, sizeof(salt64));
-    ByteString salt(sizeof(salt64), 0);
-
-    // It's a random value, so endianness doesn't matter.
-    ske += ByteString(reinterpret_cast<uint8*>(&salt64), sizeof(salt64));
-    ske.push_back(96);  // iteration count of 65536
-
-    uint8 key[16];
-    SaltedIteratedS2K(
-        sizeof(key), HASH_AlgSHA1, passphrase,
-        base::StringPiece(reinterpret_cast<char*>(&salt64), sizeof(salt64)),
-        65536, key);
-    *out_key = ByteString(key, sizeof(key));
-    return MakePacket(kSymmetricKeyEncryptedTag, ske);
-  }
-
-  // SerializeSymmetricallyEncrypted encrypts |plaintext| with |key| and
-  // returns a Symmetrically Encrypted packet containing the ciphertext. See
-  // RFC 4880, section 5.7.
-  static ByteString SerializeSymmetricallyEncrypted(ByteString plaintext,
-                                                    const ByteString& key) {
-    // We need this for PK11_CipherOp to write to, but we never check it as we
-    // work in ECB mode, one block at a time.
-    int out_len;
-
-    ByteString packet;
-    packet.push_back(1);  // version 1
-    static const unsigned kBlockSize = 16;  // AES block size
-
-    uint8 prefix[kBlockSize + 2], fre[kBlockSize], iv[kBlockSize];
-    crypto::RandBytes(iv, kBlockSize);
-    memset(fre, 0, sizeof(fre));
-
-    ScopedPK11Context aes_context;
-    CHECK(CreateAESContext(key.data(), key.size(), &aes_context));
-
-    PK11_CipherOp(aes_context.get(), fre, &out_len, sizeof(fre), fre,
-                  AES_BLOCK_SIZE);
-    for (unsigned i = 0; i < 16; i++)
-      prefix[i] = iv[i] ^ fre[i];
-    PK11_CipherOp(aes_context.get(), fre, &out_len, sizeof(fre), prefix,
-                  AES_BLOCK_SIZE);
-    prefix[kBlockSize] = iv[kBlockSize - 2] ^ fre[0];
-    prefix[kBlockSize + 1] = iv[kBlockSize - 1] ^ fre[1];
-
-    packet += ByteString(prefix, sizeof(prefix));
-
-    ByteString plaintext_copy = plaintext;
-    plaintext_copy.push_back(0xd3);  // MDC packet
-    plaintext_copy.push_back(20);  // packet length (20 bytes)
-
-    HASHContext* hash_context = HASH_Create(HASH_AlgSHA1);
-    HASH_Begin(hash_context);
-    HASH_Update(hash_context, iv, sizeof(iv));
-    HASH_Update(hash_context, iv + kBlockSize - 2, 2);
-    HASH_Update(hash_context, plaintext_copy.data(), plaintext_copy.size());
-    uint8 digest[SHA1_LENGTH];
-    unsigned num_hash_bytes;
-    HASH_End(hash_context, digest, &num_hash_bytes, sizeof(digest));
-    HASH_Destroy(hash_context);
-
-    plaintext_copy += ByteString(digest, sizeof(digest));
-
-    fre[0] = prefix[kBlockSize];
-    fre[1] = prefix[kBlockSize+1];
-    unsigned out_used = 2;
-
-    for (size_t i = 0; i < plaintext_copy.size(); i++) {
-      if (out_used == kBlockSize) {
-        PK11_CipherOp(aes_context.get(), fre, &out_len, sizeof(fre), fre,
-                      AES_BLOCK_SIZE);
-        out_used = 0;
-      }
-
-      uint8 c = plaintext_copy[i] ^ fre[out_used];
-      fre[out_used++] = c;
-      packet.push_back(c);
-    }
-
-    return MakePacket(kSymmetricallyEncryptedTag, packet);
-  }
-};
-
-}  // anonymous namespace
-
-// static
-OpenPGPSymmetricEncrytion::Result OpenPGPSymmetricEncrytion::Decrypt(
-    base::StringPiece encrypted,
-    base::StringPiece passphrase,
-    std::string *out) {
-  EnsureNSSInit();
-
-  Decrypter decrypter;
-  base::StringPiece result;
-  Result reader = decrypter.Decrypt(encrypted, passphrase, &result);
-  if (reader == OK)
-    *out = result.as_string();
-  return reader;
-}
-
-// static
-std::string OpenPGPSymmetricEncrytion::Encrypt(
-    base::StringPiece plaintext,
-    base::StringPiece passphrase) {
-  EnsureNSSInit();
-
-  Encrypter::ByteString b =
-      Encrypter::Encrypt(plaintext, passphrase);
-  return std::string(reinterpret_cast<const char*>(b.data()), b.size());
-}
-
-}  // namespace crypto
diff --git a/src/crypto/openpgp_symmetric_encryption.h b/src/crypto/openpgp_symmetric_encryption.h
deleted file mode 100644
index f70f2cb..0000000
--- a/src/crypto/openpgp_symmetric_encryption.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 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 CRYPTO_OPENPGP_SYMMETRIC_ENCRYPTION_H_
-#define CRYPTO_OPENPGP_SYMMETRIC_ENCRYPTION_H_
-
-#include <string>
-
-#include "base/string_piece.h"
-#include "crypto/crypto_export.h"
-
-namespace crypto {
-
-// OpenPGPSymmetricEncrytion implements enough of RFC 4880 to read and write
-// uncompressed, symmetrically encrypted data. You can create ciphertext
-// compatable with this code from the command line with:
-//    gpg --compress-algo=NONE --cipher-algo=AES -c
-//
-// Likewise, the output of this can be decrypted on the command line with:
-//    gpg < input
-class CRYPTO_EXPORT OpenPGPSymmetricEncrytion {
- public:
-  enum Result {
-    OK,
-    UNKNOWN_CIPHER,  // you forgot to pass --cipher-algo=AES to gpg
-    UNKNOWN_HASH,
-    NOT_SYMMETRICALLY_ENCRYPTED,  // it's OpenPGP data, but not correct form
-    COMPRESSED,  // you forgot to pass --compress-algo=NONE
-    PARSE_ERROR,  // it's not OpenPGP data.
-    INTERNAL_ERROR,
-  };
-
-  static Result Decrypt(base::StringPiece encrypted,
-                        base::StringPiece passphrase,
-                        std::string *out);
-
-  static std::string Encrypt(base::StringPiece plaintext,
-                             base::StringPiece passphrase);
-};
-
-}  // namespace crypto
-
-#endif  // CRYPTO_OPENPGP_SYMMETRIC_ENCRYPTION_H_
-
diff --git a/src/crypto/openpgp_symmetric_encryption_unittest.cc b/src/crypto/openpgp_symmetric_encryption_unittest.cc
deleted file mode 100644
index 6185719..0000000
--- a/src/crypto/openpgp_symmetric_encryption_unittest.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2011 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 "crypto/openpgp_symmetric_encryption.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace crypto {
-
-// These test vectors were created by hand using either GPG or the Go OpenPGP
-// library.
-
-// AES-128, GPG
-static const uint8 kTestMessage1[] = {
-  0x8c, 0x0d, 0x04, 0x07, 0x03, 0x02, 0x69, 0x24, 0xaf, 0xbf, 0x0b, 0x31, 0x98,
-  0x6d, 0x60, 0xd2, 0x3d, 0x01, 0xc4, 0x29, 0xab, 0xec, 0x1b, 0xdf, 0xfa, 0x90,
-  0x86, 0x92, 0x94, 0xc7, 0xa5, 0xe7, 0xd8, 0x80, 0x0a, 0x55, 0x3e, 0xbd, 0x10,
-  0xef, 0x40, 0xfe, 0xb7, 0x39, 0x83, 0x4e, 0x5e, 0x77, 0x9d, 0x57, 0x94, 0xb6,
-  0xe4, 0x59, 0xa7, 0x32, 0x76, 0x22, 0x48, 0xed, 0x37, 0xe8, 0x6f, 0xf9, 0x80,
-  0x04, 0xa1, 0xe4, 0xbf, 0x40, 0xa6, 0x9b, 0xd1, 0x3e, 0xba, 0xaa, 0x52, 0xd0,
-};
-
-// AES-256, GPG
-static const uint8 kTestMessage2[] = {
-  0x8c, 0x0d, 0x04, 0x09, 0x03, 0x02, 0xd6, 0xb0, 0x34, 0xa0, 0xb8, 0x6c, 0x15,
-  0xb8, 0x60, 0xd2, 0x3d, 0x01, 0x97, 0xe4, 0x46, 0x56, 0xc5, 0xc9, 0xc7, 0x81,
-  0xd1, 0x09, 0xf3, 0xa0, 0x5d, 0x3b, 0xa7, 0xe3, 0x68, 0xb4, 0x19, 0xd2, 0x76,
-  0x83, 0x38, 0x13, 0x98, 0xb8, 0xaf, 0x54, 0x51, 0x52, 0xbb, 0xc5, 0x7d, 0x8a,
-  0x70, 0x66, 0x40, 0x0b, 0xb5, 0x92, 0xc3, 0xd3, 0x51, 0x63, 0x5d, 0x99, 0x9b,
-  0x96, 0x82, 0xe1, 0xfe, 0xac, 0xa8, 0xa5, 0x87, 0x8b, 0x3f, 0xd1, 0x90, 0x70,
-};
-
-// AES-128, Go
-static const uint8 kTestMessage3[] = {
-  0xc3, 0x1e, 0x04, 0x07, 0x03, 0x02, 0x74, 0x1e, 0x2d, 0x7d, 0x2e, 0xdf, 0x20,
-  0xdb, 0x60, 0xb1, 0x22, 0xca, 0x39, 0x74, 0x2f, 0xe8, 0x2f, 0x09, 0xf8, 0xa4,
-  0x13, 0x76, 0x14, 0x65, 0x6e, 0xb9, 0xd2, 0xe0, 0x01, 0xe4, 0x40, 0x83, 0x90,
-  0x3c, 0x76, 0xac, 0x23, 0x3e, 0xd2, 0xb0, 0xb2, 0x1c, 0x9d, 0x24, 0xcb, 0x7b,
-  0xe1, 0x0c, 0x6b, 0xe0, 0x86, 0xe0, 0x22, 0xe1, 0xf2, 0xcb, 0xe0, 0xf3, 0xe2,
-  0xbf, 0xdd, 0x89, 0xda, 0xe0, 0x83, 0xe3, 0xd9, 0x34, 0xf9, 0xaa, 0x17, 0x96,
-  0x6a, 0x28, 0xe0, 0xca, 0xe2, 0x78, 0xca, 0x0e, 0x7d, 0xe0, 0xeb, 0xe4, 0xca,
-  0xe6, 0xf0, 0x90, 0x4f, 0x22, 0x91, 0xf9, 0xb2, 0xbb, 0x19, 0x0b, 0x45, 0xc0,
-  0x16, 0x9e, 0xe2, 0xdb, 0x30, 0xad, 0xbb, 0xe1, 0xb8, 0x12, 0x00,
-};
-
-// AES-128, salted S2K, GPG
-static const uint8 kTestMessage4[] = {
-  0x8c, 0x0c, 0x04, 0x07, 0x01, 0x02, 0xf8, 0x42, 0x78, 0x07, 0x04, 0xaa, 0x54,
-  0xcc, 0xd2, 0x3d, 0x01, 0xcf, 0xb7, 0x30, 0xe1, 0xed, 0xb2, 0x53, 0x6e, 0x4a,
-  0xbc, 0x49, 0x27, 0x45, 0xde, 0x1d, 0x5b, 0xe2, 0x17, 0x43, 0x39, 0x79, 0xdc,
-  0xa5, 0xb7, 0x1a, 0x1b, 0xb7, 0x29, 0x9c, 0xb5, 0x69, 0x2f, 0x42, 0xc5, 0xe5,
-  0x0c, 0x78, 0x57, 0x16, 0xa6, 0x46, 0x22, 0x18, 0x0c, 0xa2, 0xb3, 0x8c, 0xee,
-  0xa1, 0xde, 0x38, 0xf1, 0xca, 0x73, 0xd3, 0xd6, 0xa3, 0x61, 0x47, 0xe2,
-};
-
-TEST(OpenPGPSymmetricEncrytionTest, AES128GPG) {
-  base::StringPiece encrypted(reinterpret_cast<const char*>(kTestMessage1),
-                              sizeof(kTestMessage1));
-  std::string out;
-
-  OpenPGPSymmetricEncrytion::Result r =
-      OpenPGPSymmetricEncrytion::Decrypt(encrypted, "testing", &out);
-  EXPECT_EQ(OpenPGPSymmetricEncrytion::OK, r);
-  EXPECT_EQ("Hello world\n", out);
-}
-
-TEST(OpenPGPSymmetricEncrytionTest, AES256GPG) {
-  base::StringPiece encrypted(reinterpret_cast<const char*>(kTestMessage2),
-                              sizeof(kTestMessage2));
-  std::string out;
-
-  OpenPGPSymmetricEncrytion::Result r =
-      OpenPGPSymmetricEncrytion::Decrypt(encrypted, "testing", &out);
-  EXPECT_EQ(OpenPGPSymmetricEncrytion::OK, r);
-  EXPECT_EQ("Hello world\n", out);
-}
-
-TEST(OpenPGPSymmetricEncrytionTest, AES128Go) {
-  base::StringPiece encrypted(reinterpret_cast<const char*>(kTestMessage3),
-                              sizeof(kTestMessage3));
-  std::string out;
-
-  OpenPGPSymmetricEncrytion::Result r =
-      OpenPGPSymmetricEncrytion::Decrypt(encrypted, "testing", &out);
-  EXPECT_EQ(OpenPGPSymmetricEncrytion::OK, r);
-  EXPECT_EQ("Hello world\n", out);
-}
-
-TEST(OpenPGPSymmetricEncrytionTest, SaltedS2K) {
-  base::StringPiece encrypted(reinterpret_cast<const char*>(kTestMessage4),
-                              sizeof(kTestMessage4));
-  std::string out;
-
-  OpenPGPSymmetricEncrytion::Result r =
-      OpenPGPSymmetricEncrytion::Decrypt(encrypted, "testing", &out);
-  EXPECT_EQ(OpenPGPSymmetricEncrytion::OK, r);
-  EXPECT_EQ("Hello world\n", out);
-}
-
-TEST(OpenPGPSymmetricEncrytionTest, Encrypt) {
-  for (unsigned i = 0; i < 16; i++) {
-    std::string encrypted =
-        OpenPGPSymmetricEncrytion::Encrypt("Hello world\n", "testing");
-
-    std::string out;
-    OpenPGPSymmetricEncrytion::Result r =
-        OpenPGPSymmetricEncrytion::Decrypt(encrypted, "testing", &out);
-    EXPECT_EQ(OpenPGPSymmetricEncrytion::OK, r);
-    EXPECT_EQ("Hello world\n", out);
-  }
-}
-
-}  // namespace crypto
diff --git a/src/crypto/rsa_private_key_nss_unittest.cc b/src/crypto/rsa_private_key_nss_unittest.cc
deleted file mode 100644
index 0ec801d..0000000
--- a/src/crypto/rsa_private_key_nss_unittest.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2011 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 "crypto/rsa_private_key.h"
-
-#include <keyhi.h>
-#include <pk11pub.h>
-
-#include "base/memory/scoped_ptr.h"
-#include "crypto/nss_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace crypto {
-
-class RSAPrivateKeyNSSTest : public testing::Test {
- public:
-  RSAPrivateKeyNSSTest() {}
-  virtual ~RSAPrivateKeyNSSTest() {}
-
-  virtual void SetUp() {
-#if defined(OS_CHROMEOS)
-    OpenPersistentNSSDB();
-#endif
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(RSAPrivateKeyNSSTest);
-};
-
-TEST_F(RSAPrivateKeyNSSTest, FindFromPublicKey) {
-  // Create a keypair, which will put the keys in the user's NSSDB.
-  scoped_ptr<crypto::RSAPrivateKey> key_pair(RSAPrivateKey::Create(256));
-
-  std::vector<uint8> public_key;
-  ASSERT_TRUE(key_pair->ExportPublicKey(&public_key));
-
-  scoped_ptr<crypto::RSAPrivateKey> key_pair_2(
-      crypto::RSAPrivateKey::FindFromPublicKeyInfo(public_key));
-
-  EXPECT_EQ(key_pair->key_->pkcs11ID, key_pair_2->key_->pkcs11ID);
-}
-
-TEST_F(RSAPrivateKeyNSSTest, FailedFindFromPublicKey) {
-  // Create a keypair, which will put the keys in the user's NSSDB.
-  scoped_ptr<crypto::RSAPrivateKey> key_pair(RSAPrivateKey::Create(256));
-
-  std::vector<uint8> public_key;
-  ASSERT_TRUE(key_pair->ExportPublicKey(&public_key));
-
-  // Remove the keys from the DB, and make sure we can't find them again.
-  if (key_pair->key_) {
-    PK11_DestroyTokenObject(key_pair->key_->pkcs11Slot,
-                            key_pair->key_->pkcs11ID);
-  }
-  if (key_pair->public_key_) {
-    PK11_DestroyTokenObject(key_pair->public_key_->pkcs11Slot,
-                            key_pair->public_key_->pkcs11ID);
-  }
-
-  EXPECT_EQ(NULL, crypto::RSAPrivateKey::FindFromPublicKeyInfo(public_key));
-}
-
-}  // namespace crypto
diff --git a/src/crypto/secure_hash_default.cc b/src/crypto/secure_hash_default.cc
deleted file mode 100644
index 7b912e1..0000000
--- a/src/crypto/secure_hash_default.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 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 "crypto/secure_hash.h"
-
-#include "base/logging.h"
-#include "base/pickle.h"
-#include "crypto/third_party/nss/chromium-blapi.h"
-#include "crypto/third_party/nss/chromium-sha256.h"
-
-namespace crypto {
-
-namespace {
-
-const char kSHA256Descriptor[] = "NSS";
-
-class SecureHashSHA256NSS : public SecureHash {
- public:
-  static const int kSecureHashVersion = 1;
-
-  SecureHashSHA256NSS() {
-    SHA256_Begin(&ctx_);
-  }
-
-  virtual ~SecureHashSHA256NSS() {
-    memset(&ctx_, 0, sizeof(ctx_));
-  }
-
-  // SecureHash implementation:
-  virtual void Update(const void* input, size_t len) OVERRIDE {
-    SHA256_Update(&ctx_, static_cast<const unsigned char*>(input), len);
-  }
-
-  virtual void Finish(void* output, size_t len) OVERRIDE {
-    SHA256_End(&ctx_, static_cast<unsigned char*>(output), NULL,
-               static_cast<unsigned int>(len));
-  }
-
-  virtual bool Serialize(Pickle* pickle) OVERRIDE;
-  virtual bool Deserialize(PickleIterator* data_iterator) OVERRIDE;
-
- private:
-  SHA256Context ctx_;
-};
-
-bool SecureHashSHA256NSS::Serialize(Pickle* pickle) {
-  if (!pickle)
-    return false;
-
-  if (!pickle->WriteInt(kSecureHashVersion) ||
-      !pickle->WriteString(kSHA256Descriptor) ||
-      !pickle->WriteBytes(&ctx_, sizeof(ctx_))) {
-    return false;
-  }
-
-  return true;
-}
-
-bool SecureHashSHA256NSS::Deserialize(PickleIterator* data_iterator) {
-  int version;
-  if (!data_iterator->ReadInt(&version))
-    return false;
-
-  if (version > kSecureHashVersion)
-    return false;  // We don't know how to deal with this.
-
-  std::string type;
-  if (!data_iterator->ReadString(&type))
-    return false;
-
-  if (type != kSHA256Descriptor)
-    return false;  // It's the wrong kind.
-
-  const char* data = NULL;
-  if (!data_iterator->ReadBytes(&data, sizeof(ctx_)))
-    return false;
-
-  memcpy(&ctx_, data, sizeof(ctx_));
-
-  return true;
-}
-
-}  // namespace
-
-SecureHash* SecureHash::Create(Algorithm algorithm) {
-  switch (algorithm) {
-    case SHA256:
-      return new SecureHashSHA256NSS();
-    default:
-      NOTIMPLEMENTED();
-      return NULL;
-  }
-}
-
-}  // namespace crypto
diff --git a/src/crypto/symmetric_key_nss.cc b/src/crypto/symmetric_key_nss.cc
deleted file mode 100644
index 7fd0c32..0000000
--- a/src/crypto/symmetric_key_nss.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 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 "crypto/symmetric_key.h"
-
-#include <nss.h>
-#include <pk11pub.h>
-
-#include "base/logging.h"
-#include "crypto/nss_util.h"
-
-namespace crypto {
-
-SymmetricKey::~SymmetricKey() {}
-
-// static
-SymmetricKey* SymmetricKey::GenerateRandomKey(Algorithm algorithm,
-                                              size_t key_size_in_bits) {
-  DCHECK_EQ(AES, algorithm);
-
-  EnsureNSSInit();
-  if (key_size_in_bits == 0)
-    return NULL;
-
-  ScopedPK11Slot slot(PK11_GetInternalSlot());
-  if (!slot.get())
-    return NULL;
-
-  PK11SymKey* sym_key = PK11_KeyGen(slot.get(), CKM_AES_KEY_GEN, NULL,
-                                    key_size_in_bits / 8, NULL);
-  if (!sym_key)
-    return NULL;
-
-  return new SymmetricKey(sym_key);
-}
-
-// static
-SymmetricKey* SymmetricKey::DeriveKeyFromPassword(Algorithm algorithm,
-                                                  const std::string& password,
-                                                  const std::string& salt,
-                                                  size_t iterations,
-                                                  size_t key_size_in_bits) {
-  EnsureNSSInit();
-  if (salt.empty() || iterations == 0 || key_size_in_bits == 0)
-    return NULL;
-
-  SECItem password_item;
-  password_item.type = siBuffer;
-  password_item.data = reinterpret_cast<unsigned char*>(
-      const_cast<char *>(password.data()));
-  password_item.len = password.size();
-
-  SECItem salt_item;
-  salt_item.type = siBuffer;
-  salt_item.data = reinterpret_cast<unsigned char*>(
-      const_cast<char *>(salt.data()));
-  salt_item.len = salt.size();
-
-  SECOidTag cipher_algorithm =
-      algorithm == AES ? SEC_OID_AES_256_CBC : SEC_OID_HMAC_SHA1;
-  ScopedSECAlgorithmID alg_id(PK11_CreatePBEV2AlgorithmID(SEC_OID_PKCS5_PBKDF2,
-                                                          cipher_algorithm,
-                                                          SEC_OID_HMAC_SHA1,
-                                                          key_size_in_bits / 8,
-                                                          iterations,
-                                                          &salt_item));
-  if (!alg_id.get())
-    return NULL;
-
-  ScopedPK11Slot slot(PK11_GetInternalSlot());
-  if (!slot.get())
-    return NULL;
-
-  PK11SymKey* sym_key = PK11_PBEKeyGen(slot.get(), alg_id.get(), &password_item,
-                                       PR_FALSE, NULL);
-  if (!sym_key)
-    return NULL;
-
-  return new SymmetricKey(sym_key);
-}
-
-// static
-SymmetricKey* SymmetricKey::Import(Algorithm algorithm,
-                                   const std::string& raw_key) {
-  EnsureNSSInit();
-  CK_MECHANISM_TYPE cipher =
-      algorithm == AES ? CKM_AES_CBC : CKM_SHA_1_HMAC;
-
-  SECItem key_item;
-  key_item.type = siBuffer;
-  key_item.data = reinterpret_cast<unsigned char*>(
-      const_cast<char *>(raw_key.data()));
-  key_item.len = raw_key.size();
-
-  ScopedPK11Slot slot(PK11_GetInternalSlot());
-  if (!slot.get())
-    return NULL;
-
-  // The exact value of the |origin| argument doesn't matter to NSS as long as
-  // it's not PK11_OriginFortezzaHack, so we pass PK11_OriginUnwrap as a
-  // placeholder.
-  PK11SymKey* sym_key = PK11_ImportSymKey(slot.get(), cipher, PK11_OriginUnwrap,
-                                          CKA_ENCRYPT, &key_item, NULL);
-  if (!sym_key)
-    return NULL;
-
-  return new SymmetricKey(sym_key);
-}
-
-bool SymmetricKey::GetRawKey(std::string* raw_key) {
-  SECStatus rv = PK11_ExtractKeyValue(key_.get());
-  if (SECSuccess != rv)
-    return false;
-
-  SECItem* key_item = PK11_GetKeyData(key_.get());
-  if (!key_item)
-    return false;
-
-  raw_key->assign(reinterpret_cast<char*>(key_item->data), key_item->len);
-  return true;
-}
-
-#if defined(OS_CHROMEOS)
-// static
-SymmetricKey* SymmetricKey::CreateFromKey(PK11SymKey* key) {
-  return new SymmetricKey(key);
-}
-#endif
-
-SymmetricKey::SymmetricKey(PK11SymKey* key) : key_(key) {
-  DCHECK(key);
-}
-
-}  // namespace crypto
diff --git a/src/crypto/symmetric_key_win.cc b/src/crypto/symmetric_key_win.cc
deleted file mode 100644
index f4cd751..0000000
--- a/src/crypto/symmetric_key_win.cc
+++ /dev/null
@@ -1,536 +0,0 @@
-// Copyright (c) 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 "crypto/symmetric_key.h"
-
-#include <vector>
-
-// TODO(wtc): replace scoped_array by std::vector.
-#include "base/memory/scoped_ptr.h"
-#include "base/sys_byteorder.h"
-
-namespace crypto {
-
-namespace {
-
-// The following is a non-public Microsoft header documented in MSDN under
-// CryptImportKey / CryptExportKey. Following the header is the byte array of
-// the actual plaintext key.
-struct PlaintextBlobHeader {
-  BLOBHEADER hdr;
-  DWORD cbKeySize;
-};
-
-// CryptoAPI makes use of three distinct ALG_IDs for AES, rather than just
-// CALG_AES (which exists, but depending on the functions you are calling, may
-// result in function failure, whereas the subtype would succeed).
-ALG_ID GetAESAlgIDForKeySize(size_t key_size_in_bits) {
-  // Only AES-128/-192/-256 is supported in CryptoAPI.
-  switch (key_size_in_bits) {
-    case 128:
-      return CALG_AES_128;
-    case 192:
-      return CALG_AES_192;
-    case 256:
-      return CALG_AES_256;
-    default:
-      NOTREACHED();
-      return 0;
-  }
-};
-
-// Imports a raw/plaintext key of |key_size| stored in |*key_data| into a new
-// key created for the specified |provider|. |alg| contains the algorithm of
-// the key being imported.
-// If |key_data| is intended to be used as an HMAC key, then |alg| should be
-// CALG_HMAC.
-// If successful, returns true and stores the imported key in |*key|.
-// TODO(wtc): use this function in hmac_win.cc.
-bool ImportRawKey(HCRYPTPROV provider,
-                  ALG_ID alg,
-                  const void* key_data, size_t key_size,
-                  ScopedHCRYPTKEY* key) {
-  DCHECK_GT(key_size, 0);
-
-  DWORD actual_size =
-      static_cast<DWORD>(sizeof(PlaintextBlobHeader) + key_size);
-  std::vector<BYTE> tmp_data(actual_size);
-  BYTE* actual_key = &tmp_data[0];
-  memcpy(actual_key + sizeof(PlaintextBlobHeader), key_data, key_size);
-  PlaintextBlobHeader* key_header =
-      reinterpret_cast<PlaintextBlobHeader*>(actual_key);
-  memset(key_header, 0, sizeof(PlaintextBlobHeader));
-
-  key_header->hdr.bType = PLAINTEXTKEYBLOB;
-  key_header->hdr.bVersion = CUR_BLOB_VERSION;
-  key_header->hdr.aiKeyAlg = alg;
-
-  key_header->cbKeySize = static_cast<DWORD>(key_size);
-
-  HCRYPTKEY unsafe_key = NULL;
-  DWORD flags = CRYPT_EXPORTABLE;
-  if (alg == CALG_HMAC) {
-    // Though it may appear odd that IPSEC and RC2 are being used, this is
-    // done in accordance with Microsoft's FIPS 140-2 Security Policy for the
-    // RSA Enhanced Provider, as the approved means of using arbitrary HMAC
-    // key material.
-    key_header->hdr.aiKeyAlg = CALG_RC2;
-    flags |= CRYPT_IPSEC_HMAC_KEY;
-  }
-
-  BOOL ok =
-      CryptImportKey(provider, actual_key, actual_size, 0, flags, &unsafe_key);
-
-  // Clean up the temporary copy of key, regardless of whether it was imported
-  // sucessfully or not.
-  SecureZeroMemory(actual_key, actual_size);
-
-  if (!ok)
-    return false;
-
-  key->reset(unsafe_key);
-  return true;
-}
-
-// Attempts to generate a random AES key of |key_size_in_bits|. Returns true
-// if generation is successful, storing the generated key in |*key| and the
-// key provider (CSP) in |*provider|.
-bool GenerateAESKey(size_t key_size_in_bits,
-                    ScopedHCRYPTPROV* provider,
-                    ScopedHCRYPTKEY* key) {
-  DCHECK(provider);
-  DCHECK(key);
-
-  ALG_ID alg = GetAESAlgIDForKeySize(key_size_in_bits);
-  if (alg == 0)
-    return false;
-
-  ScopedHCRYPTPROV safe_provider;
-  // Note: The only time NULL is safe to be passed as pszContainer is when
-  // dwFlags contains CRYPT_VERIFYCONTEXT, as all keys generated and/or used
-  // will be treated as ephemeral keys and not persisted.
-  BOOL ok = CryptAcquireContext(safe_provider.receive(), NULL, NULL,
-                                PROV_RSA_AES, CRYPT_VERIFYCONTEXT);
-  if (!ok)
-    return false;
-
-  ScopedHCRYPTKEY safe_key;
-  // In the FIPS 140-2 Security Policy for CAPI on XP/Vista+, Microsoft notes
-  // that CryptGenKey makes use of the same functionality exposed via
-  // CryptGenRandom. The reason this is being used, as opposed to
-  // CryptGenRandom and CryptImportKey is for compliance with the security
-  // policy
-  ok = CryptGenKey(safe_provider.get(), alg, CRYPT_EXPORTABLE,
-                   safe_key.receive());
-  if (!ok)
-    return false;
-
-  key->swap(safe_key);
-  provider->swap(safe_provider);
-
-  return true;
-}
-
-// Returns true if the HMAC key size meets the requirement of FIPS 198
-// Section 3.  |alg| is the hash function used in the HMAC.
-bool CheckHMACKeySize(size_t key_size_in_bits, ALG_ID alg) {
-  DWORD hash_size = 0;
-  switch (alg) {
-    case CALG_SHA1:
-      hash_size = 20;
-      break;
-    case CALG_SHA_256:
-      hash_size = 32;
-      break;
-    case CALG_SHA_384:
-      hash_size = 48;
-      break;
-    case CALG_SHA_512:
-      hash_size = 64;
-      break;
-  }
-  if (hash_size == 0)
-    return false;
-
-  // An HMAC key must be >= L/2, where L is the output size of the hash
-  // function being used.
-  return (key_size_in_bits >= (hash_size / 2 * 8) &&
-         (key_size_in_bits % 8) == 0);
-}
-
-// Attempts to generate a random, |key_size_in_bits|-long HMAC key, for use
-// with the hash function |alg|.
-// |key_size_in_bits| must be >= 1/2 the hash size of |alg| for security.
-// Returns true if generation is successful, storing the generated key in
-// |*key| and the key provider (CSP) in |*provider|.
-bool GenerateHMACKey(size_t key_size_in_bits,
-                     ALG_ID alg,
-                     ScopedHCRYPTPROV* provider,
-                     ScopedHCRYPTKEY* key,
-                     scoped_array<BYTE>* raw_key) {
-  DCHECK(provider);
-  DCHECK(key);
-  DCHECK(raw_key);
-
-  if (!CheckHMACKeySize(key_size_in_bits, alg))
-    return false;
-
-  ScopedHCRYPTPROV safe_provider;
-  // See comment in GenerateAESKey as to why NULL is acceptable for the
-  // container name.
-  BOOL ok = CryptAcquireContext(safe_provider.receive(), NULL, NULL,
-                                PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
-  if (!ok)
-    return false;
-
-  DWORD key_size_in_bytes = static_cast<DWORD>(key_size_in_bits / 8);
-  scoped_array<BYTE> random(new BYTE[key_size_in_bytes]);
-  ok = CryptGenRandom(safe_provider, key_size_in_bytes, random.get());
-  if (!ok)
-    return false;
-
-  ScopedHCRYPTKEY safe_key;
-  bool rv = ImportRawKey(safe_provider, CALG_HMAC, random.get(),
-                         key_size_in_bytes, &safe_key);
-  if (rv) {
-    key->swap(safe_key);
-    provider->swap(safe_provider);
-    raw_key->swap(random);
-  }
-
-  SecureZeroMemory(random.get(), key_size_in_bytes);
-  return rv;
-}
-
-// Attempts to create an HMAC hash instance using the specified |provider|
-// and |key|. The inner hash function will be |hash_alg|. If successful,
-// returns true and stores the hash in |*hash|.
-// TODO(wtc): use this function in hmac_win.cc.
-bool CreateHMACHash(HCRYPTPROV provider,
-                    HCRYPTKEY key,
-                    ALG_ID hash_alg,
-                    ScopedHCRYPTHASH* hash) {
-  ScopedHCRYPTHASH safe_hash;
-  BOOL ok = CryptCreateHash(provider, CALG_HMAC, key, 0, safe_hash.receive());
-  if (!ok)
-    return false;
-
-  HMAC_INFO hmac_info;
-  memset(&hmac_info, 0, sizeof(hmac_info));
-  hmac_info.HashAlgid = hash_alg;
-
-  ok = CryptSetHashParam(safe_hash, HP_HMAC_INFO,
-                         reinterpret_cast<const BYTE*>(&hmac_info), 0);
-  if (!ok)
-    return false;
-
-  hash->swap(safe_hash);
-  return true;
-}
-
-// Computes a block of the derived key using the PBKDF2 function F for the
-// specified |block_index| using the PRF |hash|, writing the output to
-// |output_buf|.
-// |output_buf| must have enough space to accomodate the output of the PRF
-// specified by |hash|.
-// Returns true if the block was successfully computed.
-bool ComputePBKDF2Block(HCRYPTHASH hash,
-                        DWORD hash_size,
-                        const std::string& salt,
-                        size_t iterations,
-                        uint32 block_index,
-                        BYTE* output_buf) {
-  // From RFC 2898:
-  // 3. <snip> The function F is defined as the exclusive-or sum of the first
-  //    c iterates of the underlying pseudorandom function PRF applied to the
-  //    password P and the concatenation of the salt S and the block index i:
-  //      F (P, S, c, i) = U_1 \xor U_2 \xor ... \xor U_c
-  //    where
-  //      U_1 = PRF(P, S || INT (i))
-  //      U_2 = PRF(P, U_1)
-  //      ...
-  //      U_c = PRF(P, U_{c-1})
-  ScopedHCRYPTHASH safe_hash;
-  BOOL ok = CryptDuplicateHash(hash, NULL, 0, safe_hash.receive());
-  if (!ok)
-    return false;
-
-  // Iteration U_1: Compute PRF for S.
-  ok = CryptHashData(safe_hash, reinterpret_cast<const BYTE*>(salt.data()),
-                     static_cast<DWORD>(salt.size()), 0);
-  if (!ok)
-    return false;
-
-  // Iteration U_1: and append (big-endian) INT (i).
-  uint32 big_endian_block_index = base::HostToNet32(block_index);
-  ok = CryptHashData(safe_hash,
-                     reinterpret_cast<BYTE*>(&big_endian_block_index),
-                     sizeof(big_endian_block_index), 0);
-
-  std::vector<BYTE> hash_value(hash_size);
-
-  DWORD size = hash_size;
-  ok = CryptGetHashParam(safe_hash, HP_HASHVAL, &hash_value[0], &size, 0);
-  if (!ok  || size != hash_size)
-    return false;
-
-  memcpy(output_buf, &hash_value[0], hash_size);
-
-  // Iteration 2 - c: Compute U_{iteration} by applying the PRF to
-  // U_{iteration - 1}, then xor the resultant hash with |output|, which
-  // contains U_1 ^ U_2 ^ ... ^ U_{iteration - 1}.
-  for (size_t iteration = 2; iteration <= iterations; ++iteration) {
-    safe_hash.reset();
-    ok = CryptDuplicateHash(hash, NULL, 0, safe_hash.receive());
-    if (!ok)
-      return false;
-
-    ok = CryptHashData(safe_hash, &hash_value[0], hash_size, 0);
-    if (!ok)
-      return false;
-
-    size = hash_size;
-    ok = CryptGetHashParam(safe_hash, HP_HASHVAL, &hash_value[0], &size, 0);
-    if (!ok || size != hash_size)
-      return false;
-
-    for (int i = 0; i < hash_size; ++i)
-      output_buf[i] ^= hash_value[i];
-  }
-
-  return true;
-}
-
-}  // namespace
-
-SymmetricKey::~SymmetricKey() {
-  // TODO(wtc): create a "secure" string type that zeroes itself in the
-  // destructor.
-  if (!raw_key_.empty())
-    SecureZeroMemory(const_cast<char *>(raw_key_.data()), raw_key_.size());
-}
-
-// static
-SymmetricKey* SymmetricKey::GenerateRandomKey(Algorithm algorithm,
-                                              size_t key_size_in_bits) {
-  DCHECK_GE(key_size_in_bits, 8);
-
-  ScopedHCRYPTPROV provider;
-  ScopedHCRYPTKEY key;
-
-  bool ok = false;
-  scoped_array<BYTE> raw_key;
-
-  switch (algorithm) {
-    case AES:
-      ok = GenerateAESKey(key_size_in_bits, &provider, &key);
-      break;
-    case HMAC_SHA1:
-      ok = GenerateHMACKey(key_size_in_bits, CALG_SHA1, &provider,
-                           &key, &raw_key);
-      break;
-  }
-
-  if (!ok) {
-    NOTREACHED();
-    return NULL;
-  }
-
-  size_t key_size_in_bytes = key_size_in_bits / 8;
-  if (raw_key == NULL)
-    key_size_in_bytes = 0;
-
-  SymmetricKey* result = new SymmetricKey(provider.release(),
-                                          key.release(),
-                                          raw_key.get(),
-                                          key_size_in_bytes);
-  if (raw_key != NULL)
-    SecureZeroMemory(raw_key.get(), key_size_in_bytes);
-
-  return result;
-}
-
-// static
-SymmetricKey* SymmetricKey::DeriveKeyFromPassword(Algorithm algorithm,
-                                                  const std::string& password,
-                                                  const std::string& salt,
-                                                  size_t iterations,
-                                                  size_t key_size_in_bits) {
-  // CryptoAPI lacks routines to perform PBKDF2 derivation as specified
-  // in RFC 2898, so it must be manually implemented. Only HMAC-SHA1 is
-  // supported as the PRF.
-
-  // While not used until the end, sanity-check the input before proceeding
-  // with the expensive computation.
-  DWORD provider_type = 0;
-  ALG_ID alg = 0;
-  switch (algorithm) {
-    case AES:
-      provider_type = PROV_RSA_AES;
-      alg = GetAESAlgIDForKeySize(key_size_in_bits);
-      break;
-    case HMAC_SHA1:
-      provider_type = PROV_RSA_FULL;
-      alg = CALG_HMAC;
-      break;
-    default:
-      NOTREACHED();
-      break;
-  }
-  if (provider_type == 0 || alg == 0)
-    return NULL;
-
-  ScopedHCRYPTPROV provider;
-  BOOL ok = CryptAcquireContext(provider.receive(), NULL, NULL, provider_type,
-                                CRYPT_VERIFYCONTEXT);
-  if (!ok)
-    return NULL;
-
-  // Convert the user password into a key suitable to be fed into the PRF
-  // function.
-  ScopedHCRYPTKEY password_as_key;
-  BYTE* password_as_bytes =
-      const_cast<BYTE*>(reinterpret_cast<const BYTE*>(password.data()));
-  if (!ImportRawKey(provider, CALG_HMAC, password_as_bytes,
-                    password.size(), &password_as_key))
-    return NULL;
-
-  // Configure the PRF function. Only HMAC variants are supported, with the
-  // only hash function supported being SHA1.
-  // TODO(rsleevi): Support SHA-256 on XP SP3+.
-  ScopedHCRYPTHASH prf;
-  if (!CreateHMACHash(provider, password_as_key, CALG_SHA1, &prf))
-    return NULL;
-
-  DWORD hLen = 0;
-  DWORD param_size = sizeof(hLen);
-  ok = CryptGetHashParam(prf, HP_HASHSIZE,
-                         reinterpret_cast<BYTE*>(&hLen), &param_size, 0);
-  if (!ok || hLen == 0)
-    return NULL;
-
-  // 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and stop.
-  size_t dkLen = key_size_in_bits / 8;
-  DCHECK_GT(dkLen, 0);
-
-  if ((dkLen / hLen) > 0xFFFFFFFF) {
-    DLOG(ERROR) << "Derived key too long.";
-    return NULL;
-  }
-
-  // 2. Let l be the number of hLen-octet blocks in the derived key,
-  //    rounding up, and let r be the number of octets in the last
-  //    block:
-  size_t L = (dkLen + hLen - 1) / hLen;
-  DCHECK_GT(L, 0);
-
-  size_t total_generated_size = L * hLen;
-  std::vector<BYTE> generated_key(total_generated_size);
-  BYTE* block_offset = &generated_key[0];
-
-  // 3. For each block of the derived key apply the function F defined below
-  //    to the password P, the salt S, the iteration count c, and the block
-  //    index to compute the block:
-  //    T_1 = F (P, S, c, 1)
-  //    T_2 = F (P, S, c, 2)
-  //    ...
-  //    T_l = F (P, S, c, l)
-  // <snip>
-  // 4. Concatenate the blocks and extract the first dkLen octets to produce
-  //    a derived key DK:
-  //    DK = T_1 || T_2 || ... || T_l<0..r-1>
-  for (uint32 block_index = 1; block_index <= L; ++block_index) {
-    if (!ComputePBKDF2Block(prf, hLen, salt, iterations, block_index,
-                            block_offset))
-        return NULL;
-    block_offset += hLen;
-  }
-
-  // Convert the derived key bytes into a key handle for the desired algorithm.
-  ScopedHCRYPTKEY key;
-  if (!ImportRawKey(provider, alg, &generated_key[0], dkLen, &key))
-    return NULL;
-
-  SymmetricKey* result = new SymmetricKey(provider.release(), key.release(),
-                                          &generated_key[0], dkLen);
-
-  SecureZeroMemory(&generated_key[0], total_generated_size);
-
-  return result;
-}
-
-// static
-SymmetricKey* SymmetricKey::Import(Algorithm algorithm,
-                                   const std::string& raw_key) {
-  DWORD provider_type = 0;
-  ALG_ID alg = 0;
-  switch (algorithm) {
-    case AES:
-      provider_type = PROV_RSA_AES;
-      alg = GetAESAlgIDForKeySize(raw_key.size() * 8);
-      break;
-    case HMAC_SHA1:
-      provider_type = PROV_RSA_FULL;
-      alg = CALG_HMAC;
-      break;
-    default:
-      NOTREACHED();
-      break;
-  }
-  if (provider_type == 0 || alg == 0)
-    return NULL;
-
-  ScopedHCRYPTPROV provider;
-  BOOL ok = CryptAcquireContext(provider.receive(), NULL, NULL, provider_type,
-                                CRYPT_VERIFYCONTEXT);
-  if (!ok)
-    return NULL;
-
-  ScopedHCRYPTKEY key;
-  if (!ImportRawKey(provider, alg, raw_key.data(), raw_key.size(), &key))
-    return NULL;
-
-  return new SymmetricKey(provider.release(), key.release(),
-                          raw_key.data(), raw_key.size());
-}
-
-bool SymmetricKey::GetRawKey(std::string* raw_key) {
-  // Short circuit for when the key was supplied to the constructor.
-  if (!raw_key_.empty()) {
-    *raw_key = raw_key_;
-    return true;
-  }
-
-  DWORD size = 0;
-  BOOL ok = CryptExportKey(key_, 0, PLAINTEXTKEYBLOB, 0, NULL, &size);
-  if (!ok)
-    return false;
-
-  std::vector<BYTE> result(size);
-
-  ok = CryptExportKey(key_, 0, PLAINTEXTKEYBLOB, 0, &result[0], &size);
-  if (!ok)
-    return false;
-
-  PlaintextBlobHeader* header =
-      reinterpret_cast<PlaintextBlobHeader*>(&result[0]);
-  raw_key->assign(reinterpret_cast<char*>(&result[sizeof(*header)]),
-                  header->cbKeySize);
-
-  SecureZeroMemory(&result[0], size);
-
-  return true;
-}
-
-SymmetricKey::SymmetricKey(HCRYPTPROV provider,
-                           HCRYPTKEY key,
-                           const void* key_data, size_t key_size_in_bytes)
-    : provider_(provider), key_(key) {
-  if (key_data) {
-    raw_key_.assign(reinterpret_cast<const char*>(key_data),
-                    key_size_in_bytes);
-  }
-}
-
-}  // namespace crypto
diff --git a/src/glimp/entry_points/gles_2_0.cc b/src/glimp/entry_points/gles_2_0.cc
index 884318a..bc0e09b 100644
--- a/src/glimp/entry_points/gles_2_0.cc
+++ b/src/glimp/entry_points/gles_2_0.cc
@@ -661,7 +661,12 @@
 void GL_APIENTRY glGetTexParameteriv(GLenum target,
                                      GLenum pname,
                                      GLint* params) {
-  SB_NOTIMPLEMENTED();
+  gles::Context* context = GetCurrentContext();
+  if (!context) {
+    return;
+  }
+
+  context->GetTexParameteriv(target, pname, params);
 }
 
 void GL_APIENTRY glGetUniformfv(GLuint program,
diff --git a/src/glimp/gles/context.cc b/src/glimp/gles/context.cc
index 65b7f47..efb5067 100644
--- a/src/glimp/gles/context.cc
+++ b/src/glimp/gles/context.cc
@@ -1172,8 +1172,82 @@
       return Sampler::kWrapModeInvalid;
   }
 }
+
+GLenum GLEnumFromMinFilter(Sampler::MinFilter min_filter) {
+  switch (min_filter) {
+    case Sampler::kMinFilterNearest:
+      return GL_NEAREST;
+    case Sampler::kMinFilterLinear:
+      return GL_LINEAR;
+    case Sampler::kMinFilterNearestMipMapNearest:
+      return GL_NEAREST_MIPMAP_NEAREST;
+    case Sampler::kMinFilterNearestMipMapLinear:
+      return GL_NEAREST_MIPMAP_LINEAR;
+    case Sampler::kMinFilterLinearMipMapNearest:
+      return GL_LINEAR_MIPMAP_NEAREST;
+    case Sampler::kMinFilterLinearMipMapLinear:
+      return GL_LINEAR_MIPMAP_LINEAR;
+    default: {
+      SB_NOTREACHED();
+      return GL_LINEAR;
+    }
+  }
+}
+
+GLenum GLEnumFromMagFilter(Sampler::MagFilter mag_filter) {
+  switch (mag_filter) {
+    case Sampler::kMagFilterNearest:
+      return GL_NEAREST;
+    case Sampler::kMagFilterLinear:
+      return GL_LINEAR;
+    default: {
+      SB_NOTREACHED();
+      return GL_LINEAR;
+    }
+  }
+}
+
+GLenum GLEnumFromWrapMode(Sampler::WrapMode wrap_mode) {
+  switch (wrap_mode) {
+    case Sampler::kWrapModeClampToEdge:
+      return GL_CLAMP_TO_EDGE;
+    case Sampler::kWrapModeMirroredRepeat:
+      return GL_MIRRORED_REPEAT;
+    case Sampler::kWrapModeRepeat:
+      return GL_REPEAT;
+    default: {
+      SB_NOTREACHED();
+      return GL_REPEAT;
+    }
+  }
+}
 }  // namespace
 
+void Context::GetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
+  GLIMP_TRACE_EVENT0(__FUNCTION__);
+  Sampler* active_sampler = (*GetBoundTextureForTarget(target, active_texture_))
+                                ->sampler_parameters();
+  switch (pname) {
+    case GL_TEXTURE_MAG_FILTER: {
+      *params = GLEnumFromMagFilter(active_sampler->mag_filter);
+    } break;
+    case GL_TEXTURE_MIN_FILTER: {
+      *params = GLEnumFromMinFilter(active_sampler->min_filter);
+    } break;
+    case GL_TEXTURE_WRAP_S: {
+      *params = GLEnumFromWrapMode(active_sampler->wrap_s);
+    } break;
+    case GL_TEXTURE_WRAP_T: {
+      *params = GLEnumFromWrapMode(active_sampler->wrap_t);
+    } break;
+
+    default: {
+      SetError(GL_INVALID_ENUM);
+      return;
+    }
+  }
+}
+
 void Context::TexParameteri(GLenum target, GLenum pname, GLint param) {
   GLIMP_TRACE_EVENT0(__FUNCTION__);
   Sampler* active_sampler = (*GetBoundTextureForTarget(target, active_texture_))
diff --git a/src/glimp/gles/context.h b/src/glimp/gles/context.h
index e0163cd..b47c769 100644
--- a/src/glimp/gles/context.h
+++ b/src/glimp/gles/context.h
@@ -133,6 +133,7 @@
   void DeleteTextures(GLsizei n, const GLuint* textures);
   void ActiveTexture(GLenum texture);
   void BindTexture(GLenum target, GLuint texture);
+  void GetTexParameteriv(GLenum target, GLenum pname, GLint* params);
   void TexParameteri(GLenum target, GLenum pname, GLint param);
   void TexImage2D(GLenum target,
                   GLint level,
diff --git a/src/googleurl/googleurl.gyp b/src/googleurl/googleurl.gyp
index 595cf6f..093a61d 100644
--- a/src/googleurl/googleurl.gyp
+++ b/src/googleurl/googleurl.gyp
@@ -99,17 +99,6 @@
       'defines': [
         'FULL_FILESYSTEM_URL_SUPPORT=1',
       ],
-      'conditions': [
-        ['os_posix==1 and OS!="mac" and OS!="ios"', {
-          'conditions': [
-            ['linux_use_tcmalloc==1', {
-              'dependencies': [
-                '<(DEPTH)/base/allocator/allocator.gyp:allocator',
-              ],
-            }],
-          ],
-        }],
-      ],
     },
   ],
 }
diff --git a/src/media/media.gyp b/src/media/media.gyp
index 9469203..5757809 100644
--- a/src/media/media.gyp
+++ b/src/media/media.gyp
@@ -367,6 +367,24 @@
         'filters/video_frame_generator.h',
         'filters/video_renderer_base.cc',
         'filters/video_renderer_base.h',
+        'mp4/aac.cc',
+        'mp4/aac.h',
+        'mp4/avc.cc',
+        'mp4/avc.h',
+        'mp4/box_definitions.cc',
+        'mp4/box_definitions.h',
+        'mp4/box_reader.cc',
+        'mp4/box_reader.h',
+        'mp4/cenc.cc',
+        'mp4/cenc.h',
+        'mp4/es_descriptor.cc',
+        'mp4/es_descriptor.h',
+        'mp4/mp4_stream_parser.cc',
+        'mp4/mp4_stream_parser.h',
+        'mp4/offset_byte_queue.cc',
+        'mp4/offset_byte_queue.h',
+        'mp4/track_run_iterator.cc',
+        'mp4/track_run_iterator.h',
         'video/capture/fake_video_capture_device.cc',
         'video/capture/fake_video_capture_device.h',
         'video/capture/linux/video_capture_device_linux.cc',
@@ -799,19 +817,6 @@
             ],
           },
         }],
-        # A simple WebM encoder for animated avatars on ChromeOS.
-        ['chromeos==1', {
-          'dependencies': [
-            '../third_party/libvpx/libvpx.gyp:libvpx',
-            '../third_party/libyuv/libyuv.gyp:libyuv',
-          ],
-          'sources': [
-            'webm/chromeos/ebml_writer.cc',
-            'webm/chromeos/ebml_writer.h',
-            'webm/chromeos/webm_encoder.cc',
-            'webm/chromeos/webm_encoder.h',
-          ],
-        }],
         ['OS=="linux" or OS=="freebsd" or OS=="solaris"', {
           'link_settings': {
             'libraries': [
@@ -944,28 +949,6 @@
             },
           },
         }],
-        ['proprietary_codecs==1 or branding=="Chrome" or OS=="lb_shell" or OS=="starboard"', {
-          'sources': [
-            'mp4/aac.cc',
-            'mp4/aac.h',
-            'mp4/avc.cc',
-            'mp4/avc.h',
-            'mp4/box_definitions.cc',
-            'mp4/box_definitions.h',
-            'mp4/box_reader.cc',
-            'mp4/box_reader.h',
-            'mp4/cenc.cc',
-            'mp4/cenc.h',
-            'mp4/es_descriptor.cc',
-            'mp4/es_descriptor.h',
-            'mp4/mp4_stream_parser.cc',
-            'mp4/mp4_stream_parser.h',
-            'mp4/offset_byte_queue.cc',
-            'mp4/offset_byte_queue.h',
-            'mp4/track_run_iterator.cc',
-            'mp4/track_run_iterator.h',
-          ],
-        }],
       ],
       'target_conditions': [
         ['OS == "ios"', {
@@ -1074,6 +1057,13 @@
         'filters/source_buffer_stream_unittest.cc',
         'filters/video_decoder_selector_unittest.cc',
         'filters/video_renderer_base_unittest.cc',
+        'mp4/aac_unittest.cc',
+        'mp4/avc_unittest.cc',
+        'mp4/box_reader_unittest.cc',
+        'mp4/es_descriptor_unittest.cc',
+        'mp4/mp4_stream_parser_unittest.cc',
+        'mp4/offset_byte_queue_unittest.cc',
+        'mp4/track_run_iterator_unittest.cc',
         'video/capture/video_capture_device_unittest.cc',
         'webm/cluster_builder.cc',
         'webm/cluster_builder.h',
@@ -1098,15 +1088,6 @@
             '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
           ],
         }],
-        ['os_posix==1 and OS!="mac" and OS!="ios"', {
-          'conditions': [
-            ['linux_use_tcmalloc==1', {
-              'dependencies': [
-                '../base/allocator/allocator.gyp:allocator',
-              ],
-            }],
-          ],
-        }],
         ['OS == "ios"', {
           'sources/': [
             ['exclude', '.*'],
@@ -1156,17 +1137,6 @@
             'base/simd/convert_rgb_to_yuv_unittest.cc',
           ],
         }],
-        ['proprietary_codecs==1 or branding=="Chrome" or OS=="lb_shell" or OS=="starboard"', {
-          'sources': [
-            'mp4/aac_unittest.cc',
-            'mp4/avc_unittest.cc',
-            'mp4/box_reader_unittest.cc',
-            'mp4/es_descriptor_unittest.cc',
-            'mp4/mp4_stream_parser_unittest.cc',
-            'mp4/offset_byte_queue_unittest.cc',
-            'mp4/track_run_iterator_unittest.cc',
-          ],
-        }],
         ['OS == "lb_shell" or OS=="starboard"', {
           'sources': [
             'audio/mock_shell_audio_streamer.h',
@@ -1432,53 +1402,6 @@
         },
       ],
     }],
-    ['(OS == "win" or toolkit_uses_gtk == 1) and use_aura != 1', {
-      'targets': [
-        {
-          'target_name': 'shader_bench',
-          'type': 'executable',
-          'dependencies': [
-            'media',
-            'yuv_convert',
-            '../base/base.gyp:base',
-            '../ui/gl/gl.gyp:gl',
-            '../ui/ui.gyp:ui',
-          ],
-          'sources': [
-            'tools/shader_bench/cpu_color_painter.cc',
-            'tools/shader_bench/cpu_color_painter.h',
-            'tools/shader_bench/gpu_color_painter.cc',
-            'tools/shader_bench/gpu_color_painter.h',
-            'tools/shader_bench/gpu_painter.cc',
-            'tools/shader_bench/gpu_painter.h',
-            'tools/shader_bench/painter.cc',
-            'tools/shader_bench/painter.h',
-            'tools/shader_bench/shader_bench.cc',
-            'tools/shader_bench/window.cc',
-            'tools/shader_bench/window.h',
-          ],
-          'conditions': [
-            ['toolkit_uses_gtk == 1', {
-              'dependencies': [
-                '../build/linux/system.gyp:gtk',
-              ],
-              'sources': [
-                'tools/shader_bench/window_linux.cc',
-              ],
-            }],
-            ['OS=="win"', {
-              'dependencies': [
-                '../third_party/angle/src/build_angle.gyp:libEGL',
-                '../third_party/angle/src/build_angle.gyp:libGLESv2',
-              ],
-              'sources': [
-                'tools/shader_bench/window_win.cc',
-              ],
-            }],
-          ],
-        },
-      ],
-    }],
     ['OS == "linux" and target_arch != "arm" and target_arch != "mipsel"', {
       'targets': [
         {
@@ -1695,99 +1618,5 @@
 
       ],
     }],
-    ['OS != "android" and OS != "ios" and OS != "lb_shell" and OS != "starboard"', {
-      # Android and iOS do not use ffmpeg, so disable the targets which require
-      # it.
-      'targets': [
-        {
-          'target_name': 'ffmpeg_unittests',
-          'type': 'executable',
-          'dependencies': [
-            '../base/base.gyp:base',
-            '../base/base.gyp:base_i18n',
-            '../base/base.gyp:test_support_base',
-            '../base/base.gyp:test_support_perf',
-            '../testing/gtest.gyp:gtest',
-            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
-            'media',
-            'media_test_support',
-          ],
-          'sources': [
-            'ffmpeg/ffmpeg_unittest.cc',
-          ],
-          'conditions': [
-            ['toolkit_uses_gtk == 1', {
-              'dependencies': [
-                # Needed for the following #include chain:
-                #   base/run_all_unittests.cc
-                #   ../base/test_suite.h
-                #   gtk/gtk.h
-                '../build/linux/system.gyp:gtk',
-              ],
-              'conditions': [
-                ['linux_use_tcmalloc==1', {
-                  'dependencies': [
-                    '../base/allocator/allocator.gyp:allocator',
-                  ],
-                }],
-              ],
-            }],
-          ],
-        },
-        {
-          'target_name': 'ffmpeg_regression_tests',
-          'type': 'executable',
-          'dependencies': [
-            '../base/base.gyp:test_support_base',
-            '../testing/gmock.gyp:gmock',
-            '../testing/gtest.gyp:gtest',
-            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
-            'media',
-            'media_test_support',
-          ],
-          'sources': [
-            'base/run_all_unittests.cc',
-            'base/test_data_util.cc',
-            'ffmpeg/ffmpeg_regression_tests.cc',
-            'filters/pipeline_integration_test_base.cc',
-          ],
-          'conditions': [
-            ['os_posix==1 and OS!="mac"', {
-              'conditions': [
-                ['linux_use_tcmalloc==1', {
-                  'dependencies': [
-                    '../base/allocator/allocator.gyp:allocator',
-                  ],
-                }],
-              ],
-            }],
-          ],
-        },
-        {
-          'target_name': 'ffmpeg_tests',
-          'type': 'executable',
-          'dependencies': [
-            '../base/base.gyp:base',
-            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
-            'media',
-          ],
-          'sources': [
-            'test/ffmpeg_tests/ffmpeg_tests.cc',
-          ],
-        },
-        {
-          'target_name': 'media_bench',
-          'type': 'executable',
-          'dependencies': [
-            '../base/base.gyp:base',
-            '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
-            'media',
-          ],
-          'sources': [
-            'tools/media_bench/media_bench.cc',
-          ],
-        },
-      ],
-    }]
   ],
 }
diff --git a/src/media/media_untrusted.gyp b/src/media/media_untrusted.gyp
index 4abbe56..b29f7d1 100644
--- a/src/media/media_untrusted.gyp
+++ b/src/media/media_untrusted.gyp
@@ -10,7 +10,7 @@
     '../native_client/build/untrusted.gypi',
   ],
   'conditions': [
-    ['disable_nacl==0 and disable_nacl_untrusted==0', {
+    ['disable_nacl==0', {
       'targets': [
         {
           'target_name': 'shared_memory_support_untrusted',
diff --git a/src/nb/multipart_allocator.cc b/src/nb/multipart_allocator.cc
new file mode 100644
index 0000000..093b04d
--- /dev/null
+++ b/src/nb/multipart_allocator.cc
@@ -0,0 +1,168 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "nb/multipart_allocator.h"
+
+#include <algorithm>
+
+#include "starboard/log.h"
+#include "starboard/memory.h"
+
+namespace nb {
+
+MultipartAllocator::Allocations::Allocations(void* buffer, int buffer_size)
+    : number_of_buffers_(1),
+      buffers_(&buffer_),
+      buffer_sizes_(&buffer_size_),
+      buffer_(buffer),
+      buffer_size_(buffer_size) {
+  SB_DCHECK(buffer != NULL);
+  SB_DCHECK(buffer_size > 0);
+}
+
+MultipartAllocator::Allocations::Allocations(int number_of_buffers,
+                                             void** buffers,
+                                             const int* buffer_sizes)
+    : number_of_buffers_(0), buffers_(NULL), buffer_sizes_(NULL) {
+  SB_DCHECK(number_of_buffers > 0);
+  SB_DCHECK(buffers != NULL);
+  SB_DCHECK(buffer_sizes != NULL);
+
+  Assign(number_of_buffers, buffers, buffer_sizes);
+
+  for (int i = 0; i < number_of_buffers_; ++i) {
+    SB_DCHECK(buffers_[i] != NULL);
+    SB_DCHECK(buffer_sizes_[i] > 0);
+  }
+}
+
+MultipartAllocator::Allocations::Allocations(const Allocations& that)
+    : number_of_buffers_(0), buffers_(NULL), buffer_sizes_(NULL) {
+  Assign(that.number_of_buffers_, that.buffers_, that.buffer_sizes_);
+}
+
+MultipartAllocator::Allocations::~Allocations() {
+  Destroy();
+}
+
+MultipartAllocator::Allocations& MultipartAllocator::Allocations::operator=(
+    const Allocations& that) {
+  Destroy();
+  Assign(that.number_of_buffers_, that.buffers_, that.buffer_sizes_);
+  return *this;
+}
+
+int MultipartAllocator::Allocations::size() const {
+  int size = 0;
+
+  for (size_t i = 0; i < number_of_buffers_; ++i) {
+    size += buffer_sizes_[i];
+  }
+
+  return size;
+}
+
+void MultipartAllocator::Allocations::ShrinkTo(int size) {
+  for (size_t i = 0; i < number_of_buffers_; ++i) {
+    if (size >= buffer_sizes_[i]) {
+      size -= buffer_sizes_[i];
+    } else {
+      buffer_sizes_[i] = size;
+      size = 0;
+      ++i;
+      while (i < number_of_buffers_) {
+        buffer_sizes_[i] = 0;
+        ++i;
+      }
+      break;
+    }
+  }
+
+  SB_DCHECK(size == 0);
+}
+
+void MultipartAllocator::Allocations::Write(int destination_offset,
+                                            const void* src,
+                                            int size) {
+  size_t buffer_index = 0;
+  const uint8_t* src_in_uint8 = static_cast<const uint8_t*>(src);
+  while (size > 0) {
+    if (buffer_index >= number_of_buffers_) {
+      SB_NOTREACHED();
+      return;
+    }
+    if (buffer_sizes_[buffer_index] <= destination_offset) {
+      destination_offset -= buffer_sizes_[buffer_index];
+    } else {
+      int bytes_to_copy =
+          std::min(size, buffer_sizes_[buffer_index] - destination_offset);
+      uint8_t* destination_in_uint8 =
+          static_cast<uint8_t*>(buffers_[buffer_index]);
+      SbMemoryCopy(destination_in_uint8 + destination_offset, src_in_uint8,
+                   bytes_to_copy);
+      destination_offset = 0;
+      src_in_uint8 += bytes_to_copy;
+      size -= bytes_to_copy;
+    }
+    ++buffer_index;
+  }
+}
+
+void MultipartAllocator::Allocations::Read(void* destination) const {
+  uint8_t* destination_in_uint8 = static_cast<uint8_t*>(destination);
+
+  for (size_t i = 0; i < number_of_buffers_; ++i) {
+    SbMemoryCopy(destination_in_uint8, buffers_[i], buffer_sizes_[i]);
+    destination_in_uint8 += buffer_sizes_[i];
+  }
+}
+
+void MultipartAllocator::Allocations::Assign(int number_of_buffers,
+                                             void** buffers,
+                                             const int* buffer_sizes) {
+  SB_DCHECK(number_of_buffers_ == 0);
+  SB_DCHECK(buffers_ == NULL);
+  SB_DCHECK(buffer_sizes_ == NULL);
+
+  number_of_buffers_ = number_of_buffers;
+  if (number_of_buffers_ == 0) {
+    buffers_ = NULL;
+    buffer_sizes_ = NULL;
+    return;
+  }
+  if (number_of_buffers_ == 1) {
+    buffers_ = &buffer_;
+    buffer_sizes_ = &buffer_size_;
+    buffer_ = buffers[0];
+    buffer_size_ = buffer_sizes[0];
+    return;
+  }
+  buffers_ = new void*[number_of_buffers_];
+  buffer_sizes_ = new int[number_of_buffers_];
+  SbMemoryCopy(buffers_, buffers, sizeof(*buffers_) * number_of_buffers_);
+  SbMemoryCopy(buffer_sizes_, buffer_sizes,
+               sizeof(*buffer_sizes_) * number_of_buffers_);
+}
+
+void MultipartAllocator::Allocations::Destroy() {
+  if (number_of_buffers_ > 1) {
+    delete[] buffers_;
+    delete[] buffer_sizes_;
+  }
+  number_of_buffers_ = 0;
+  buffers_ = NULL;
+  buffer_sizes_ = NULL;
+}
+
+}  // namespace nb
diff --git a/src/nb/multipart_allocator.h b/src/nb/multipart_allocator.h
new file mode 100644
index 0000000..b29e114
--- /dev/null
+++ b/src/nb/multipart_allocator.h
@@ -0,0 +1,82 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef NB_MULTIPART_ALLOCATOR_H_
+#define NB_MULTIPART_ALLOCATOR_H_
+
+#include "starboard/configuration.h"
+#include "starboard/types.h"
+
+namespace nb {
+
+// The class can fulfill allocation request by more than one blocks.  It also
+// provides a nested class to manage such allocations.
+class MultipartAllocator {
+ public:
+  class Allocations {
+   public:
+    Allocations()
+        : number_of_buffers_(0), buffers_(NULL), buffer_sizes_(NULL) {}
+    Allocations(void* buffer, int buffer_size);
+    Allocations(int number_of_buffers, void** buffers, const int* buffer_sizes);
+    Allocations(const Allocations& that);
+    ~Allocations();
+
+    Allocations& operator=(const Allocations& that);
+
+    int size() const;
+
+    void* const* buffers() { return buffers_; }
+    const void* const* buffers() const { return buffers_; }
+
+    const int* buffer_sizes() const { return buffer_sizes_; }
+
+    int number_of_buffers() const { return number_of_buffers_; }
+
+    void ShrinkTo(int size);
+    // Write |size| bytes from |src| to buffers start from |destination_offset|.
+    void Write(int destination_offset, const void* src, int size);
+    // Read data from the Allocations into |destination|.  |destination| is
+    // guaranteed to have enough space to hold all data contained.
+    void Read(void* destination) const;
+
+   private:
+    void Assign(int number_of_buffers, void** buffers, const int* buffer_sizes);
+    void Destroy();
+
+    int number_of_buffers_;
+    void** buffers_;
+    int* buffer_sizes_;
+    // Store data in the class to avoid allocate memory when there is only one
+    // buffer.  In this case |buffers_| and |buffer_sizes_| will point to
+    // |buffer_| and |buffer_size_| respectively.
+    void* buffer_;
+    int buffer_size_;
+  };
+
+  virtual ~MultipartAllocator() {}
+
+  // Allocate a memory block that contains at least |size| bytes and its
+  // address is aligned to |alignment|.  It returns an empty Allocations object
+  // on failure.
+  virtual Allocations Allocate(size_t size,
+                               size_t alignment,
+                               intptr_t context) = 0;
+  // Free a memory block previously allocated by calling Allocate().
+  virtual void Free(Allocations allocations) = 0;
+};
+
+}  // namespace nb
+
+#endif  // NB_MULTIPART_ALLOCATOR_H_
diff --git a/src/nb/multipart_allocator_test.cc b/src/nb/multipart_allocator_test.cc
new file mode 100644
index 0000000..c1e5ecf
--- /dev/null
+++ b/src/nb/multipart_allocator_test.cc
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "nb/multipart_allocator.h"
+
+#include <vector>
+
+#include "starboard/configuration.h"
+#include "starboard/log.h"
+#include "starboard/memory.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace nb {
+namespace {
+
+TEST(MultipartAllocatorAllocationsTest, DefaultCtor) {
+  MultipartAllocator::Allocations allocations;
+  EXPECT_EQ(allocations.number_of_buffers(), 0);
+  // Call these functions as a sanity check that they are still callable.
+  allocations.buffers();
+  allocations.buffer_sizes();
+}
+
+TEST(MultipartAllocatorAllocationsTest, CopyCtor) {
+  {
+    // Allocations with 0 blocks.
+    MultipartAllocator::Allocations allocations;
+    MultipartAllocator::Allocations copy(allocations);
+    EXPECT_EQ(copy.number_of_buffers(), 0);
+    // Call these functions as a sanity check that they are still callable.
+    copy.buffers();
+    copy.buffer_sizes();
+  }
+
+  {
+    // Allocations with one blocks.
+    const int kBufferSize = 128;
+    char buffer[kBufferSize];
+
+    MultipartAllocator::Allocations allocations(buffer, kBufferSize);
+    MultipartAllocator::Allocations copy(allocations);
+    EXPECT_EQ(copy.number_of_buffers(), 1);
+    EXPECT_EQ(copy.buffers()[0], buffer);
+    EXPECT_EQ(copy.buffer_sizes()[0], kBufferSize);
+  }
+
+  {
+    // Allocations with more than one blocks.
+    const int kBufferSize0 = 128;
+    const int kBufferSize1 = 16;
+    char buffer0[kBufferSize0];
+    char buffer1[kBufferSize1];
+
+    std::vector<void*> buffers = {buffer0, buffer1};
+    std::vector<int> buffer_sizes = {kBufferSize0, kBufferSize1};
+
+    MultipartAllocator::Allocations allocations(
+        static_cast<int>(buffers.size()), buffers.data(), buffer_sizes.data());
+    MultipartAllocator::Allocations copy(allocations);
+    EXPECT_EQ(copy.number_of_buffers(), 2);
+    EXPECT_EQ(copy.buffers()[0], buffer0);
+    EXPECT_EQ(copy.buffer_sizes()[0], kBufferSize0);
+    EXPECT_EQ(copy.buffers()[1], buffer1);
+    EXPECT_EQ(copy.buffer_sizes()[1], kBufferSize1);
+  }
+}
+
+TEST(MultipartAllocatorAllocationsTest, AssignmentOperator) {
+  {
+    // Allocations with 0 blocks.
+    MultipartAllocator::Allocations allocations;
+    MultipartAllocator::Allocations copy;
+    copy = allocations;
+    EXPECT_EQ(copy.number_of_buffers(), 0);
+    // Call these functions as a sanity check that they are still callable.
+    copy.buffers();
+    copy.buffer_sizes();
+  }
+
+  {
+    // Allocations with one blocks.
+    const int kBufferSize = 128;
+    char buffer[kBufferSize];
+
+    MultipartAllocator::Allocations allocations(buffer, kBufferSize);
+    MultipartAllocator::Allocations copy;
+    copy = allocations;
+    EXPECT_EQ(copy.number_of_buffers(), 1);
+    EXPECT_EQ(copy.buffers()[0], buffer);
+    EXPECT_EQ(copy.buffer_sizes()[0], kBufferSize);
+  }
+
+  {
+    // Allocations with more than one blocks.
+    const int kBufferSize0 = 128;
+    const int kBufferSize1 = 16;
+    char buffer0[kBufferSize0];
+    char buffer1[kBufferSize1];
+
+    std::vector<void*> buffers = {buffer0, buffer1};
+    std::vector<int> buffer_sizes = {kBufferSize0, kBufferSize1};
+
+    MultipartAllocator::Allocations allocations(
+        static_cast<int>(buffers.size()), buffers.data(), buffer_sizes.data());
+    MultipartAllocator::Allocations copy;
+    copy = allocations;
+    EXPECT_EQ(copy.number_of_buffers(), 2);
+    EXPECT_EQ(copy.buffers()[0], buffer0);
+    EXPECT_EQ(copy.buffer_sizes()[0], kBufferSize0);
+    EXPECT_EQ(copy.buffers()[1], buffer1);
+    EXPECT_EQ(copy.buffer_sizes()[1], kBufferSize1);
+  }
+}
+
+TEST(MultipartAllocatorAllocationsTest, SingleBuffer) {
+  const int kBufferSize = 128;
+  char buffer[kBufferSize];
+
+  MultipartAllocator::Allocations allocations(buffer, kBufferSize);
+  EXPECT_EQ(allocations.number_of_buffers(), 1);
+  EXPECT_EQ(allocations.buffers()[0], buffer);
+  EXPECT_EQ(allocations.buffer_sizes()[0], kBufferSize);
+}
+
+TEST(MultipartAllocatorAllocationsTest, SingleBufferShrunk) {
+  const int kBufferSize = 128;
+  char buffer[kBufferSize];
+
+  MultipartAllocator::Allocations allocations(buffer, kBufferSize);
+
+  allocations.ShrinkTo(kBufferSize / 2);
+  EXPECT_EQ(allocations.number_of_buffers(), 1);
+  EXPECT_EQ(allocations.buffers()[0], buffer);
+  EXPECT_EQ(allocations.buffer_sizes()[0], kBufferSize / 2);
+
+  allocations.ShrinkTo(0);
+  EXPECT_EQ(allocations.number_of_buffers(), 1);
+  EXPECT_EQ(allocations.buffers()[0], buffer);
+  EXPECT_EQ(allocations.buffer_sizes()[0], 0);
+}
+
+TEST(MultipartAllocatorAllocationsTest, SingleBufferWrite) {
+  const int kBufferSize = 128;
+  char buffer[kBufferSize * 2];  // Use extra space for boundary checking.
+  char source[kBufferSize];
+
+  MultipartAllocator::Allocations allocations(buffer, kBufferSize);
+  SbMemorySet(source, 'x', kBufferSize);
+
+  SbMemorySet(buffer, 0, kBufferSize * 2);
+  allocations.Write(0, source, kBufferSize);
+  EXPECT_EQ(SbMemoryCompare(buffer, source, kBufferSize), 0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer + kBufferSize, kBufferSize));
+
+  SbMemorySet(buffer, 0, kBufferSize * 2);
+  allocations.Write(kBufferSize / 2, source, kBufferSize / 2);
+  EXPECT_TRUE(SbMemoryIsZero(buffer, kBufferSize / 2));
+  EXPECT_EQ(SbMemoryCompare(buffer + kBufferSize / 2, source, kBufferSize / 2),
+            0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer + kBufferSize, kBufferSize));
+
+  SbMemorySet(buffer, 0, kBufferSize * 2);
+  allocations.Write(kBufferSize, source, 0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer, kBufferSize * 2));
+  EXPECT_TRUE(SbMemoryIsZero(buffer + kBufferSize, kBufferSize));
+}
+
+TEST(MultipartAllocatorAllocationsTest, SingleBufferRead) {
+  const int kBufferSize = 128;
+  char buffer[kBufferSize];
+  char destination[kBufferSize * 2];
+
+  MultipartAllocator::Allocations allocations(buffer, kBufferSize);
+
+  SbMemorySet(buffer, 'x', kBufferSize);
+  SbMemorySet(destination, 0, kBufferSize * 2);
+  allocations.Read(destination);
+  EXPECT_EQ(SbMemoryCompare(buffer, destination, kBufferSize), 0);
+  EXPECT_TRUE(SbMemoryIsZero(destination + kBufferSize, kBufferSize));
+}
+
+TEST(MultipartAllocatorAllocationsTest, MultipleBuffers) {
+  const int kBufferSize0 = 128;
+  const int kBufferSize1 = 16;
+  char buffer0[kBufferSize0];
+  char buffer1[kBufferSize1];
+
+  std::vector<void*> buffers = {buffer0, buffer1};
+  std::vector<int> buffer_sizes = {kBufferSize0, kBufferSize1};
+
+  MultipartAllocator::Allocations allocations(
+      static_cast<int>(buffers.size()), buffers.data(), buffer_sizes.data());
+  EXPECT_EQ(allocations.number_of_buffers(), 2);
+  EXPECT_EQ(allocations.buffers()[0], buffer0);
+  EXPECT_EQ(allocations.buffers()[1], buffer1);
+  EXPECT_EQ(allocations.buffer_sizes()[0], kBufferSize0);
+  EXPECT_EQ(allocations.buffer_sizes()[1], kBufferSize1);
+}
+
+TEST(MultipartAllocatorAllocationsTest, MultipleBuffersShrink) {
+  const int kBufferSize0 = 128;
+  const int kBufferSize1 = 16;
+  char buffer0[kBufferSize0];
+  char buffer1[kBufferSize1];
+
+  std::vector<void*> buffers = {buffer0, buffer1};
+  std::vector<int> buffer_sizes = {kBufferSize0, kBufferSize1};
+
+  MultipartAllocator::Allocations allocations(
+      static_cast<int>(buffers.size()), buffers.data(), buffer_sizes.data());
+
+  allocations.ShrinkTo(kBufferSize0 + kBufferSize1 / 2);
+  EXPECT_EQ(allocations.number_of_buffers(), 2);
+  EXPECT_EQ(allocations.buffers()[0], buffer0);
+  EXPECT_EQ(allocations.buffers()[1], buffer1);
+  EXPECT_EQ(allocations.buffer_sizes()[0], kBufferSize0);
+  EXPECT_EQ(allocations.buffer_sizes()[1], kBufferSize1 / 2);
+
+  allocations.ShrinkTo(kBufferSize0);
+  EXPECT_EQ(allocations.number_of_buffers(), 2);
+  EXPECT_EQ(allocations.buffers()[0], buffer0);
+  EXPECT_EQ(allocations.buffers()[1], buffer1);
+  EXPECT_EQ(allocations.buffer_sizes()[0], kBufferSize0);
+  EXPECT_EQ(allocations.buffer_sizes()[1], 0);
+
+  allocations.ShrinkTo(kBufferSize0 / 2);
+  EXPECT_EQ(allocations.number_of_buffers(), 2);
+  EXPECT_EQ(allocations.buffers()[0], buffer0);
+  EXPECT_EQ(allocations.buffers()[1], buffer1);
+  EXPECT_EQ(allocations.buffer_sizes()[0], kBufferSize0 / 2);
+  EXPECT_EQ(allocations.buffer_sizes()[1], 0);
+
+  allocations.ShrinkTo(0);
+  EXPECT_EQ(allocations.number_of_buffers(), 2);
+  EXPECT_EQ(allocations.buffers()[0], buffer0);
+  EXPECT_EQ(allocations.buffers()[1], buffer1);
+  EXPECT_EQ(allocations.buffer_sizes()[0], 0);
+  EXPECT_EQ(allocations.buffer_sizes()[1], 0);
+}
+
+TEST(MultipartAllocatorAllocationsTest, MultipleBuffersWrite) {
+  const int kBufferSize0 = 128;
+  const int kBufferSize1 = 16;
+  char buffer0[kBufferSize0];
+  char buffer1[kBufferSize1 * 2];  // Use extra space for boundary checking.
+  char source[kBufferSize0 + kBufferSize1];
+
+  std::vector<void*> buffers = {buffer0, buffer1};
+  std::vector<int> buffer_sizes = {kBufferSize0, kBufferSize1};
+
+  MultipartAllocator::Allocations allocations(
+      static_cast<int>(buffers.size()), buffers.data(), buffer_sizes.data());
+  SbMemorySet(source, 'x', kBufferSize0 + kBufferSize1);
+
+  SbMemorySet(buffer0, 0, kBufferSize0);
+  SbMemorySet(buffer1, 0, kBufferSize1 * 2);
+  allocations.Write(0, source, kBufferSize0 + kBufferSize1);
+  EXPECT_EQ(SbMemoryCompare(buffer0, source, kBufferSize0), 0);
+  EXPECT_EQ(SbMemoryCompare(buffer1, source, kBufferSize1), 0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer1 + kBufferSize1, kBufferSize1));
+
+  SbMemorySet(buffer0, 0, kBufferSize0);
+  SbMemorySet(buffer1, 0, kBufferSize1 * 2);
+  allocations.Write(kBufferSize0 / 2, source, kBufferSize0 / 2 + kBufferSize1);
+  EXPECT_TRUE(SbMemoryIsZero(buffer0, kBufferSize0 / 2));
+  EXPECT_EQ(
+      SbMemoryCompare(buffer0 + kBufferSize0 / 2, source, kBufferSize0 / 2), 0);
+  EXPECT_EQ(SbMemoryCompare(buffer1, source, kBufferSize1), 0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer1 + kBufferSize1, kBufferSize1));
+
+  SbMemorySet(buffer0, 0, kBufferSize0);
+  SbMemorySet(buffer1, 0, kBufferSize1 * 2);
+  allocations.Write(kBufferSize0, source, kBufferSize1);
+  EXPECT_TRUE(SbMemoryIsZero(buffer0, kBufferSize0));
+  EXPECT_EQ(SbMemoryCompare(buffer1, source, kBufferSize1), 0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer1 + kBufferSize1, kBufferSize1));
+
+  SbMemorySet(buffer0, 0, kBufferSize0);
+  SbMemorySet(buffer1, 0, kBufferSize1 * 2);
+  allocations.Write(kBufferSize0 + kBufferSize1, source, 0);
+  EXPECT_TRUE(SbMemoryIsZero(buffer0, kBufferSize0));
+  EXPECT_TRUE(SbMemoryIsZero(buffer1, kBufferSize1 * 2));
+}
+
+TEST(MultipartAllocatorAllocationsTest, MultipleBuffersRead) {
+  const int kBufferSize0 = 128;
+  const int kBufferSize1 = 16;
+  char buffer0[kBufferSize0];
+  char buffer1[kBufferSize1];
+  char destination[kBufferSize0 + kBufferSize1 * 2];
+
+  std::vector<void*> buffers = {buffer0, buffer1};
+  std::vector<int> buffer_sizes = {kBufferSize0, kBufferSize1};
+
+  MultipartAllocator::Allocations allocations(
+      static_cast<int>(buffers.size()), buffers.data(), buffer_sizes.data());
+
+  SbMemorySet(buffer0, 'x', kBufferSize0);
+  SbMemorySet(buffer1, 'y', kBufferSize1);
+  SbMemorySet(destination, 0, kBufferSize0 + kBufferSize1 * 2);
+  allocations.Read(destination);
+  EXPECT_EQ(SbMemoryCompare(buffer0, destination, kBufferSize0), 0);
+  EXPECT_EQ(SbMemoryCompare(buffer1, destination + kBufferSize0, kBufferSize1),
+            0);
+  EXPECT_TRUE(
+      SbMemoryIsZero(destination + kBufferSize0 + kBufferSize1, kBufferSize1));
+}
+
+}  // namespace
+}  // namespace nb
diff --git a/src/nb/nb.gyp b/src/nb/nb.gyp
index f778a3c..8523211 100644
--- a/src/nb/nb.gyp
+++ b/src/nb/nb.gyp
@@ -46,6 +46,8 @@
             'memory_scope.cc',
             'memory_scope.h',
             'move.h',
+            'multipart_allocator.cc',
+            'multipart_allocator.h',
             'pointer_arithmetic.h',
             'rect.h',
             'ref_counted.cc',
@@ -53,6 +55,7 @@
             'reuse_allocator_base.cc',
             'reuse_allocator_base.h',
             'rewindable_vector.h',
+            'starboard_memory_allocator.h',
             'scoped_ptr.h',
             'simple_thread.cc',
             'simple_thread.h',
@@ -96,6 +99,7 @@
             'fixed_no_free_allocator_test.cc',
             'lexical_cast_test.cc',
             'memory_scope_test.cc',
+            'multipart_allocator_test.cc',
             'rewindable_vector_test.cc',
             'run_all_unittests.cc',
             'std_allocator_test.cc',
diff --git a/src/nb/reuse_allocator_base.cc b/src/nb/reuse_allocator_base.cc
index 75c0394..576ebe9 100644
--- a/src/nb/reuse_allocator_base.cc
+++ b/src/nb/reuse_allocator_base.cc
@@ -24,9 +24,20 @@
 
 namespace nb {
 
+namespace {
+
 // Minimum block size to avoid extremely small blocks inside the block list and
 // to ensure that a zero sized allocation will return a non-zero sized block.
 const std::size_t kMinBlockSizeBytes = 16;
+// Using a minimum value for size and alignment keeps things rounded and aligned
+// and help us avoid creating tiny and/or badly misaligned free blocks.  Also
+// ensures even for a 0-byte request will get a unique block.
+const std::size_t kMinAlignment = 16;
+// The max lines of allocation to print inside PrintAllocations().  Set to 0 to
+// print all allocations.
+const int kMaxAllocationLinesToPrint = 0;
+
+}  // namespace
 
 bool ReuseAllocatorBase::MemoryBlock::Merge(const MemoryBlock& other) {
   if (AsInteger(address_) + size_ == AsInteger(other.address_)) {
@@ -106,14 +117,9 @@
 }
 
 void* ReuseAllocatorBase::Allocate(std::size_t size, std::size_t alignment) {
-  // Keeping things rounded and aligned will help us avoid creating tiny and/or
-  // badly misaligned free blocks.  Also ensure even for a 0-byte request we
-  // return a unique block.
-  const std::size_t kMinAlignment = 16;
   size = AlignUp(std::max(size, kMinAlignment), kMinAlignment);
   alignment = AlignUp(std::max<std::size_t>(alignment, 1), kMinAlignment);
 
-  MemoryBlock allocated_block;
   bool allocate_from_front;
   FreeBlockSet::iterator free_block_iter =
       FindFreeBlock(size, alignment, free_blocks_.begin(), free_blocks_.end(),
@@ -130,6 +136,7 @@
   // The block is big enough.  We may waste some space due to alignment.
   RemoveFreeBlock(free_block_iter);
 
+  MemoryBlock allocated_block;
   MemoryBlock free_block;
   block.Allocate(size, alignment, allocate_from_front, &allocated_block,
                  &free_block);
@@ -151,8 +158,9 @@
 void ReuseAllocatorBase::PrintAllocations() const {
   typedef std::map<std::size_t, std::size_t> SizesHistogram;
   SizesHistogram sizes_histogram;
-  for (AllocatedBlockMap::const_iterator iter = allocated_blocks_.begin();
-       iter != allocated_blocks_.end(); ++iter) {
+
+  for (auto iter = allocated_blocks_.begin(); iter != allocated_blocks_.end();
+       ++iter) {
     std::size_t block_size = iter->second.size();
     if (sizes_histogram.find(block_size) == sizes_histogram.end()) {
       sizes_histogram[block_size] = 0;
@@ -160,11 +168,49 @@
     sizes_histogram[block_size] = sizes_histogram[block_size] + 1;
   }
 
+  SB_LOG(INFO) << "Total allocation: " << total_allocated_ << " bytes in "
+               << allocated_blocks_.size() << " blocks";
+
+  int lines = 0;
+  std::size_t accumulated_blocks = 0;
   for (SizesHistogram::const_iterator iter = sizes_histogram.begin();
        iter != sizes_histogram.end(); ++iter) {
-    SB_LOG(INFO) << iter->first << " : " << iter->second;
+    if (lines == kMaxAllocationLinesToPrint - 1 &&
+        sizes_histogram.size() > kMaxAllocationLinesToPrint) {
+      SB_LOG(INFO) << "\t" << iter->first << ".."
+                   << sizes_histogram.rbegin()->first << " : "
+                   << allocated_blocks_.size() - accumulated_blocks;
+      break;
+    }
+    SB_LOG(INFO) << "\t" << iter->first << " : " << iter->second;
+    ++lines;
+    accumulated_blocks += iter->second;
   }
-  SB_LOG(INFO) << "Total allocations: " << allocated_blocks_.size();
+
+  SB_LOG(INFO) << "Total free blocks: " << free_blocks_.size();
+  sizes_histogram.clear();
+  for (auto iter = free_blocks_.begin(); iter != free_blocks_.end(); ++iter) {
+    if (sizes_histogram.find(iter->size()) == sizes_histogram.end()) {
+      sizes_histogram[iter->size()] = 0;
+    }
+    sizes_histogram[iter->size()] = sizes_histogram[iter->size()] + 1;
+  }
+
+  lines = 0;
+  accumulated_blocks = 0;
+  for (SizesHistogram::const_iterator iter = sizes_histogram.begin();
+       iter != sizes_histogram.end(); ++iter) {
+    if (lines == kMaxAllocationLinesToPrint - 1 &&
+        sizes_histogram.size() > kMaxAllocationLinesToPrint) {
+      SB_LOG(INFO) << "\t" << iter->first << ".."
+                   << sizes_histogram.rbegin()->first << " : "
+                   << allocated_blocks_.size() - accumulated_blocks;
+      break;
+    }
+    SB_LOG(INFO) << "\t" << iter->first << " : " << iter->second;
+    ++lines;
+    accumulated_blocks += iter->second;
+  }
 }
 
 bool ReuseAllocatorBase::TryFree(void* memory) {
@@ -188,6 +234,59 @@
   return true;
 }
 
+void* ReuseAllocatorBase::AllocateBestBlock(std::size_t alignment,
+                                            intptr_t context,
+                                            std::size_t* size_hint) {
+  const std::size_t kMinAlignment = 16;
+  std::size_t size =
+      AlignUp(std::max(*size_hint, kMinAlignment), kMinAlignment);
+  alignment = AlignUp(std::max<std::size_t>(alignment, 1), kMinAlignment);
+
+  bool allocate_from_front;
+  FreeBlockSet::iterator free_block_iter =
+      FindBestFreeBlock(size, alignment, context, free_blocks_.begin(),
+                        free_blocks_.end(), &allocate_from_front);
+
+  if (free_block_iter == free_blocks_.end()) {
+    free_block_iter = ExpandToFit(*size_hint, alignment);
+    if (free_block_iter == free_blocks_.end()) {
+      return NULL;
+    }
+  }
+
+  MemoryBlock block = *free_block_iter;
+  // The block is big enough.  We may waste some space due to alignment.
+  RemoveFreeBlock(free_block_iter);
+
+  MemoryBlock allocated_block;
+  void* user_address;
+
+  if (block.CanFullfill(size, alignment)) {
+    MemoryBlock free_block;
+    block.Allocate(size, alignment, allocate_from_front, &allocated_block,
+                   &free_block);
+    if (free_block.size() > 0) {
+      SB_DCHECK(free_block.address());
+      AddFreeBlock(free_block);
+    }
+    user_address = AlignUp(allocated_block.address(), alignment);
+  } else {
+    allocated_block = block;
+    user_address = AlignUp(allocated_block.address(), alignment);
+  }
+  SB_DCHECK(AsInteger(user_address) >= AsInteger(allocated_block.address()));
+  uintptr_t offset =
+      AsInteger(user_address) - AsInteger(allocated_block.address());
+  SB_DCHECK(allocated_block.size() >= offset);
+  if (allocated_block.size() - offset < *size_hint) {
+    *size_hint = allocated_block.size() - offset;
+  }
+
+  AddAllocatedBlock(user_address, allocated_block);
+
+  return user_address;
+}
+
 ReuseAllocatorBase::ReuseAllocatorBase(Allocator* fallback_allocator,
                                        std::size_t initial_capacity,
                                        std::size_t allocation_increment)
diff --git a/src/nb/reuse_allocator_base.h b/src/nb/reuse_allocator_base.h
index e5782fd..747c6fd 100644
--- a/src/nb/reuse_allocator_base.h
+++ b/src/nb/reuse_allocator_base.h
@@ -23,6 +23,7 @@
 
 #include "nb/allocator.h"
 #include "starboard/configuration.h"
+#include "starboard/types.h"
 
 namespace nb {
 
@@ -46,6 +47,19 @@
 
   bool TryFree(void* memory);
 
+  // Try to allocate a memory block for the |*size_hint| passed in.  If there is
+  // no such block available, the function may return a block whose size is less
+  // than |*size_hint| and set |*size_hint| to that size.  |context| will be
+  // passed to FindBestFreeBlock() as is, which is useful when the user of a
+  // sub-class wants to pass extra information along with the allocation request
+  // to FindBestFreeBlock().  The function never sets |*size_hint| to a value
+  // greater than the value passed in.
+  // This allows the caller to allocate multiple smaller blocks to fulfill a
+  // large allocation request.
+  void* AllocateBestBlock(std::size_t alignment,
+                          intptr_t context,
+                          std::size_t* size_hint);
+
  protected:
   class MemoryBlock {
    public:
@@ -84,6 +98,7 @@
    private:
     void* address_;
     std::size_t size_;
+    std::size_t requested_size_;
   };
 
   // Freelist sorted by address.
@@ -106,6 +121,21 @@
                                                FreeBlockSet::iterator end,
                                                bool* allocate_from_front) = 0;
 
+  // The inherited class can implement this function to return a block whose
+  // size might be smaller than the |size| passed in.  AllocateBestBlock() uses
+  // this functional internally.  The default implementation simply calls
+  // FindFreeBlock() and fails if there isn't a block that is large enough for
+  // |size| bytes.
+  virtual FreeBlockSet::iterator FindBestFreeBlock(std::size_t size,
+                                                   std::size_t alignment,
+                                                   intptr_t context,
+                                                   FreeBlockSet::iterator begin,
+                                                   FreeBlockSet::iterator end,
+                                                   bool* allocate_from_front) {
+    SB_UNREFERENCED_PARAMETER(context);
+    return FindFreeBlock(size, alignment, begin, end, allocate_from_front);
+  }
+
  private:
   // Map from pointers we returned to the user, back to memory blocks.
   typedef std::map<void*, MemoryBlock> AllocatedBlockMap;
diff --git a/src/nb/starboard_memory_allocator.h b/src/nb/starboard_memory_allocator.h
new file mode 100644
index 0000000..5f53112
--- /dev/null
+++ b/src/nb/starboard_memory_allocator.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NB_STARBOARD_MEMORY_ALLOCATOR_H_
+#define NB_STARBOARD_MEMORY_ALLOCATOR_H_
+
+#include "nb/allocator.h"
+#include "starboard/configuration.h"
+#include "starboard/memory.h"
+
+namespace nb {
+
+// StarboardMemoryAllocator is an allocator that allocates and frees memory
+// using SbMemoryAllocateAligned() and SbMemoryDeallocate() in
+// starboard/memory.h.
+class StarboardMemoryAllocator : public Allocator {
+ public:
+  void* Allocate(std::size_t size) SB_OVERRIDE { return Allocate(size, 1); }
+
+  void* Allocate(std::size_t size, std::size_t alignment) SB_OVERRIDE {
+    return SbMemoryAllocateAligned(alignment, size);
+  }
+
+  void* AllocateForAlignment(std::size_t* size,
+                             std::size_t alignment) SB_OVERRIDE {
+    return Allocate(*size, alignment);
+  }
+  void Free(void* memory) SB_OVERRIDE { SbMemoryDeallocate(memory); }
+  std::size_t GetCapacity() const SB_OVERRIDE {
+    // Returns 0 here to avoid tracking the allocated memory.
+    return 0;
+  }
+  std::size_t GetAllocated() const SB_OVERRIDE {
+    // Returns 0 here to avoid tracking the allocated memory.
+    return 0;
+  }
+  void PrintAllocations() const SB_OVERRIDE {}
+};
+
+}  // namespace nb
+
+#endif  // NB_STARBOARD_MEMORY_ALLOCATOR_H_
diff --git a/src/sql/sql.gyp b/src/sql/sql.gyp
index 8d354f9..ff30949 100644
--- a/src/sql/sql.gyp
+++ b/src/sql/sql.gyp
@@ -63,15 +63,6 @@
         '..',
       ],
       'conditions': [
-        ['os_posix==1 and OS!="mac" and OS!="ios"', {
-          'conditions': [
-            ['linux_use_tcmalloc==1', {
-              'dependencies': [
-                '../base/allocator/allocator.gyp:allocator',
-              ],
-            }],
-          ],
-        }],
         ['OS == "android" and gtest_target_type == "shared_library"', {
           'dependencies': [
             '../testing/android/native_test.gyp:native_test_native_code',
diff --git a/src/starboard/build/convert_i18n_data.gypi b/src/starboard/build/convert_i18n_data.gypi
index 461e046..31a1d6c 100644
--- a/src/starboard/build/convert_i18n_data.gypi
+++ b/src/starboard/build/convert_i18n_data.gypi
@@ -37,7 +37,7 @@
 
 {
   'variables': {
-    'output_dir': '<(PRODUCT_DIR)/content/data/i18n'
+    'output_dir': '<(sb_static_contents_output_base_dir)/data/i18n'
   },
 
   'inputs': [
diff --git a/src/starboard/build/copy_test_data.gypi b/src/starboard/build/copy_test_data.gypi
index 13ac050..92ef910 100644
--- a/src/starboard/build/copy_test_data.gypi
+++ b/src/starboard/build/copy_test_data.gypi
@@ -53,12 +53,12 @@
     '<!@pymod_do_main(starboard.build.copy_data --inputs <(input_files))',
   ],
   'outputs': [
-    '<!@pymod_do_main(starboard.build.copy_data -o <(PRODUCT_DIR)/content/dir_source_root/<(output_dir) --outputs <(input_files))',
+    '<!@pymod_do_main(starboard.build.copy_data -o <(sb_static_contents_output_base_dir)/dir_source_root/<(output_dir) --outputs <(input_files))',
   ],
   'action': [
     'python',
     '<(DEPTH)/starboard/build/copy_data.py',
-    '-o', '<(PRODUCT_DIR)/content/dir_source_root/<(output_dir)',
+    '-o', '<(sb_static_contents_output_base_dir)/dir_source_root/<(output_dir)',
     '<@(input_files)',
   ],
 }
diff --git a/src/starboard/creator/ci20directfb/README.md b/src/starboard/creator/ci20directfb/README.md
deleted file mode 100644
index e0c1251..0000000
--- a/src/starboard/creator/ci20directfb/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Setting up Starboard to use DirectFB on a Creator Ci20
-
-See `starboard/raspi/directfb/README.md`.  The steps for getting directfb
-running on the Ci20 are identical.
diff --git a/src/starboard/creator/ci20directfb/atomic_public.h b/src/starboard/creator/ci20directfb/atomic_public.h
deleted file mode 100644
index 2a182e7..0000000
--- a/src/starboard/creator/ci20directfb/atomic_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_CREATOR_CI20DIRECTFB_ATOMIC_PUBLIC_H_
-#define STARBOARD_CREATOR_CI20DIRECTFB_ATOMIC_PUBLIC_H_
-
-#include "starboard/linux/shared/atomic_public.h"
-
-#endif  // STARBOARD_CREATOR_CI20DIRECTFB_ATOMIC_PUBLIC_H_
diff --git a/src/starboard/creator/ci20directfb/configuration_public.h b/src/starboard/creator/ci20directfb/configuration_public.h
deleted file mode 100644
index 651c203..0000000
--- a/src/starboard/creator/ci20directfb/configuration_public.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_CREATOR_CI20DIRECTFB_CONFIGURATION_PUBLIC_H_
-#define STARBOARD_CREATOR_CI20DIRECTFB_CONFIGURATION_PUBLIC_H_
-
-#include "starboard/creator/shared/configuration_public.h"
-
-// Indicates whether or not the given platform supports rendering of NV12
-// textures. These textures typically originate from video decoders.
-#undef SB_HAS_NV12_TEXTURE_SUPPORT
-#define SB_HAS_NV12_TEXTURE_SUPPORT 0
-
-// This configuration supports the blitter API (implemented via DirectFB).
-#undef SB_HAS_BLITTER
-#define SB_HAS_BLITTER 1
-
-// Unfortunately, DirectFB does not support bilinear filtering.  According to
-// http://osdir.com/ml/graphics.directfb.user/2008-06/msg00028.html, "smooth
-// scaling is not supported in conjunction with blending", and we need blending
-// more.
-#undef SB_HAS_BILINEAR_FILTERING_SUPPORT
-#define SB_HAS_BILINEAR_FILTERING_SUPPORT 0
-
-// DirectFB's only 32-bit RGBA color format is word-order ARGB.  This translates
-// to byte-order ARGB for big endian platforms and byte-order BGRA for
-// little-endian platforms.
-#undef SB_PREFERRED_RGBA_BYTE_ORDER
-#if SB_IS(BIG_ENDIAN)
-#define SB_PREFERRED_RGBA_BYTE_ORDER SB_PREFERRED_RGBA_BYTE_ORDER_ARGB
-#else
-#define SB_PREFERRED_RGBA_BYTE_ORDER SB_PREFERRED_RGBA_BYTE_ORDER_BGRA
-#endif
-
-#endif  // STARBOARD_CREATOR_CI20DIRECTFB_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/creator/ci20directfb/gyp_configuration.gypi b/src/starboard/creator/ci20directfb/gyp_configuration.gypi
deleted file mode 100644
index 8d8c263..0000000
--- a/src/starboard/creator/ci20directfb/gyp_configuration.gypi
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-{
-  'variables': {
-    'platform_libraries': [
-      '-ldirectfb',
-      '-ldirect',
-    ],
-    'gl_type': 'none',
-  },
-
-  'target_defaults': {
-    'default_configuration': 'creator-ci20directfb_debug',
-    'configurations': {
-      'creator-ci20directfb_debug': {
-        'inherit_from': ['debug_base'],
-      },
-      'creator-ci20directfb_devel': {
-        'inherit_from': ['devel_base'],
-      },
-      'creator-ci20directfb_qa': {
-        'inherit_from': ['qa_base'],
-      },
-      'creator-ci20directfb_gold': {
-        'inherit_from': ['gold_base'],
-      },
-    }, # end of configurations
-  },
-
-  'includes': [
-    '../shared/gyp_configuration.gypi',
-  ],
-}
diff --git a/src/starboard/creator/ci20directfb/gyp_configuration.py b/src/starboard/creator/ci20directfb/gyp_configuration.py
deleted file mode 100644
index 4e712f5..0000000
--- a/src/starboard/creator/ci20directfb/gyp_configuration.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Starboard Creator Ci20 DirectFB platform configuration for gyp_cobalt."""
-
-import logging
-import os
-import sys
-
-# Import the shared Creator platform configuration.
-sys.path.append(
-    os.path.realpath(
-        os.path.join(os.path.dirname(__file__), os.pardir, 'shared')))
-import gyp_configuration  # pylint: disable=import-self,g-import-not-at-top
-
-
-def CreatePlatformConfig():
-  try:
-    return gyp_configuration.PlatformConfig('creator-ci20directfb')
-  except RuntimeError as e:
-    logging.critical(e)
-    return None
diff --git a/src/starboard/creator/ci20directfb/main.cc b/src/starboard/creator/ci20directfb/main.cc
deleted file mode 100644
index 68d7761..0000000
--- a/src/starboard/creator/ci20directfb/main.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "starboard/configuration.h"
-#include "starboard/shared/directfb/application_directfb.h"
-#include "starboard/shared/signal/crash_signals.h"
-#include "starboard/shared/signal/suspend_signals.h"
-
-int main(int argc, char** argv) {
-  tzset();
-  starboard::shared::signal::InstallCrashSignalHandlers();
-  starboard::shared::signal::InstallSuspendSignalHandlers();
-  starboard::ApplicationDirectFB application;
-  int result = application.Run(argc, argv);
-  starboard::shared::signal::UninstallSuspendSignalHandlers();
-  starboard::shared::signal::UninstallCrashSignalHandlers();
-  return result;
-}
diff --git a/src/starboard/creator/ci20directfb/starboard_platform.gyp b/src/starboard/creator/ci20directfb/starboard_platform.gyp
deleted file mode 100644
index e7ca37e..0000000
--- a/src/starboard/creator/ci20directfb/starboard_platform.gyp
+++ /dev/null
@@ -1,348 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-{
-  'targets': [
-    {
-      'target_name': 'starboard_base_symbolize',
-      'type': 'static_library',
-      'sources': [
-        '<(DEPTH)/base/third_party/symbolize/demangle.cc',
-        '<(DEPTH)/base/third_party/symbolize/symbolize.cc',
-      ],
-    },
-    {
-      'target_name': 'starboard_platform',
-      'type': 'static_library',
-      'sources': [
-        '<(DEPTH)/starboard/creator/ci20directfb/configuration_public.h',
-        '<(DEPTH)/starboard/creator/ci20directfb/main.cc',
-        '<(DEPTH)/starboard/creator/ci20directfb/system_get_property.cc',
-        '<(DEPTH)/starboard/linux/shared/atomic_public.h',
-        '<(DEPTH)/starboard/linux/shared/system_get_connection_type.cc',
-        '<(DEPTH)/starboard/linux/shared/system_get_device_type.cc',
-        '<(DEPTH)/starboard/linux/shared/system_get_path.cc',
-        '<(DEPTH)/starboard/linux/shared/system_has_capability.cc',
-        '<(DEPTH)/starboard/shared/alsa/alsa_audio_sink_type.cc',
-        '<(DEPTH)/starboard/shared/alsa/alsa_audio_sink_type.h',
-        '<(DEPTH)/starboard/shared/alsa/alsa_util.cc',
-        '<(DEPTH)/starboard/shared/alsa/alsa_util.h',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_get_max_channels.cc',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_get_nearest_supported_sample_frequency.cc',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_is_audio_frame_storage_type_supported.cc',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_is_audio_sample_type_supported.cc',
-        '<(DEPTH)/starboard/shared/directfb/application_directfb.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_blit_rect_to_rect.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_create_context.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_create_default_device.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_create_pixel_data.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_create_render_target_surface.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_create_surface_from_pixel_data.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_create_swap_chain_from_window.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_destroy_context.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_destroy_device.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_destroy_pixel_data.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_destroy_surface.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_destroy_swap_chain.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_download_surface_pixels.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_fill_rect.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_flip_swap_chain.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_flush_context.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_get_max_contexts.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_get_pixel_data_pitch_in_bytes.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_get_pixel_data_pointer.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_get_render_target_from_surface.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_get_render_target_from_swap_chain.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_get_surface_info.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_internal.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_is_pixel_format_supported_by_download_surface_pixels.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_is_pixel_format_supported_by_pixel_data.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_is_surface_format_supported_by_render_target_surface.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_set_blending.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_set_color.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_set_modulate_blits_with_color.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_set_render_target.cc',
-        '<(DEPTH)/starboard/shared/directfb/blitter_set_scissor.cc',
-        '<(DEPTH)/starboard/shared/directfb/window_create.cc',
-        '<(DEPTH)/starboard/shared/directfb/window_destroy.cc',
-        '<(DEPTH)/starboard/shared/directfb/window_get_platform_handle.cc',
-        '<(DEPTH)/starboard/shared/directfb/window_get_size.cc',
-        '<(DEPTH)/starboard/shared/directfb/window_internal.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_allocate_aligned_unchecked.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_allocate_unchecked.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_free.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_free_aligned.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_map.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_reallocate_unchecked.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_unmap.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_audio_decoder.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_audio_decoder.h',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_common.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_common.h',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_video_decoder.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_video_decoder.h',
-        '<(DEPTH)/starboard/shared/gcc/atomic_gcc_public.h',
-        '<(DEPTH)/starboard/shared/iso/character_is_alphanumeric.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_digit.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_hex_digit.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_space.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_upper.cc',
-        '<(DEPTH)/starboard/shared/iso/character_to_lower.cc',
-        '<(DEPTH)/starboard/shared/iso/character_to_upper.cc',
-        '<(DEPTH)/starboard/shared/iso/directory_close.cc',
-        '<(DEPTH)/starboard/shared/iso/directory_get_next.cc',
-        '<(DEPTH)/starboard/shared/iso/directory_open.cc',
-        '<(DEPTH)/starboard/shared/iso/double_absolute.cc',
-        '<(DEPTH)/starboard/shared/iso/double_exponent.cc',
-        '<(DEPTH)/starboard/shared/iso/double_floor.cc',
-        '<(DEPTH)/starboard/shared/iso/double_is_finite.cc',
-        '<(DEPTH)/starboard/shared/iso/double_is_nan.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_compare.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_copy.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_find_byte.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_move.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_set.cc',
-        '<(DEPTH)/starboard/shared/iso/string_compare.cc',
-        '<(DEPTH)/starboard/shared/iso/string_compare_all.cc',
-        '<(DEPTH)/starboard/shared/iso/string_find_character.cc',
-        '<(DEPTH)/starboard/shared/iso/string_find_last_character.cc',
-        '<(DEPTH)/starboard/shared/iso/string_find_string.cc',
-        '<(DEPTH)/starboard/shared/iso/string_get_length.cc',
-        '<(DEPTH)/starboard/shared/iso/string_get_length_wide.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_double.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_signed_integer.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_uint64.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_unsigned_integer.cc',
-        '<(DEPTH)/starboard/shared/iso/string_scan.cc',
-        '<(DEPTH)/starboard/shared/iso/system_binary_search.cc',
-        '<(DEPTH)/starboard/shared/iso/system_sort.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_add.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_create.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_destroy.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_internal.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_remove.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait_timed.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_wake_up.cc',
-        '<(DEPTH)/starboard/shared/linux/byte_swap.cc',
-        '<(DEPTH)/starboard/shared/linux/get_home_directory.cc',
-        '<(DEPTH)/starboard/shared/linux/memory_get_stack_bounds.cc',
-        '<(DEPTH)/starboard/shared/linux/page_internal.cc',
-        '<(DEPTH)/starboard/shared/linux/socket_get_local_interface_address.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_random_data.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_stack.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_total_cpu_memory.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_used_cpu_memory.cc',
-        '<(DEPTH)/starboard/shared/linux/system_is_debugger_attached.cc',
-        '<(DEPTH)/starboard/shared/linux/system_symbolize.cc',
-        '<(DEPTH)/starboard/shared/linux/thread_get_id.cc',
-        '<(DEPTH)/starboard/shared/linux/thread_get_name.cc',
-        '<(DEPTH)/starboard/shared/linux/thread_set_name.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_get_current.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_get_property.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_get_signed_in.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_internal.cc',
-        '<(DEPTH)/starboard/shared/posix/directory_create.cc',
-        '<(DEPTH)/starboard/shared/posix/file_can_open.cc',
-        '<(DEPTH)/starboard/shared/posix/file_close.cc',
-        '<(DEPTH)/starboard/shared/posix/file_delete.cc',
-        '<(DEPTH)/starboard/shared/posix/file_exists.cc',
-        '<(DEPTH)/starboard/shared/posix/file_flush.cc',
-        '<(DEPTH)/starboard/shared/posix/file_get_info.cc',
-        '<(DEPTH)/starboard/shared/posix/file_get_path_info.cc',
-        '<(DEPTH)/starboard/shared/posix/file_open.cc',
-        '<(DEPTH)/starboard/shared/posix/file_read.cc',
-        '<(DEPTH)/starboard/shared/posix/file_seek.cc',
-        '<(DEPTH)/starboard/shared/posix/file_truncate.cc',
-        '<(DEPTH)/starboard/shared/posix/file_write.cc',
-        '<(DEPTH)/starboard/shared/posix/log.cc',
-        '<(DEPTH)/starboard/shared/posix/log_flush.cc',
-        '<(DEPTH)/starboard/shared/posix/log_format.cc',
-        '<(DEPTH)/starboard/shared/posix/log_is_tty.cc',
-        '<(DEPTH)/starboard/shared/posix/log_raw.cc',
-        '<(DEPTH)/starboard/shared/posix/memory_flush.cc',
-        '<(DEPTH)/starboard/shared/posix/set_non_blocking_internal.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_accept.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_bind.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_clear_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_connect.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_create.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_destroy.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_free_resolution.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_get_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_get_local_address.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_internal.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_is_connected.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_is_connected_and_idle.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_join_multicast_group.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_listen.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_receive_from.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_resolve.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_send_to.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_broadcast.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_receive_buffer_size.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_reuse_address.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_send_buffer_size.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_tcp_keep_alive.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_tcp_no_delay.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_tcp_window_scaling.cc',
-        '<(DEPTH)/starboard/shared/posix/string_compare_no_case.cc',
-        '<(DEPTH)/starboard/shared/posix/string_compare_no_case_n.cc',
-        '<(DEPTH)/starboard/shared/posix/string_compare_wide.cc',
-        '<(DEPTH)/starboard/shared/posix/string_format.cc',
-        '<(DEPTH)/starboard/shared/posix/string_format_wide.cc',
-        '<(DEPTH)/starboard/shared/posix/system_break_into_debugger.cc',
-        '<(DEPTH)/starboard/shared/posix/system_clear_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_error_string.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_locale_id.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_number_of_processors.cc',
-        '<(DEPTH)/starboard/shared/posix/thread_sleep.cc',
-        '<(DEPTH)/starboard/shared/posix/time_get_monotonic_now.cc',
-        '<(DEPTH)/starboard/shared/posix/time_get_monotonic_thread_now.cc',
-        '<(DEPTH)/starboard/shared/posix/time_get_now.cc',
-        '<(DEPTH)/starboard/shared/posix/time_zone_get_current.cc',
-        '<(DEPTH)/starboard/shared/posix/time_zone_get_dst_name.cc',
-        '<(DEPTH)/starboard/shared/posix/time_zone_get_name.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_broadcast.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_create.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_destroy.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_signal.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_wait.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_wait_timed.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_acquire.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_acquire_try.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_create.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_destroy.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_release.cc',
-        '<(DEPTH)/starboard/shared/pthread/once.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_create.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_create_local_key.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_destroy_local_key.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_detach.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_get_current.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_get_local_value.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_is_equal.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_join.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_set_local_value.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_yield.cc',
-        '<(DEPTH)/starboard/shared/signal/crash_signals.h',
-        '<(DEPTH)/starboard/shared/signal/crash_signals_sigaction.cc',
-        '<(DEPTH)/starboard/shared/signal/suspend_signals.cc',
-        '<(DEPTH)/starboard/shared/signal/suspend_signals.h',
-        '<(DEPTH)/starboard/shared/starboard/application.cc',
-        '<(DEPTH)/starboard/shared/starboard/command_line.cc',
-        '<(DEPTH)/starboard/shared/starboard/command_line.h',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_create.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_destroy.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_is_valid.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/stub_audio_sink_type.h',
-        '<(DEPTH)/starboard/shared/starboard/blitter_blit_rect_to_rect_tiled.cc',
-        '<(DEPTH)/starboard/shared/starboard/blitter_blit_rects_to_rects.cc',
-        '<(DEPTH)/starboard/shared/starboard/directory_can_open.cc',
-        '<(DEPTH)/starboard/shared/starboard/event_cancel.cc',
-        '<(DEPTH)/starboard/shared/starboard/event_schedule.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_mode_string_to_flags.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_close_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_delete_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_get_record_size.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_open_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_read_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_write_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/log_message.cc',
-        '<(DEPTH)/starboard/shared/starboard/log_raw_dump_stack.cc',
-        '<(DEPTH)/starboard/shared/starboard/log_raw_format.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/media_can_play_mime_and_key_system.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/media_is_output_protected.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/media_set_output_protection.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/mime_parser.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/mime_parser.h',
-        '<(DEPTH)/starboard/shared/starboard/new.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/audio_decoder_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/video_decoder_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/player_create.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_destroy.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_get_info.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/player_seek.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_set_bounds.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_set_pause.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_set_volume.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_worker.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_worker.h',
-        '<(DEPTH)/starboard/shared/starboard/player/player_write_end_of_stream.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_write_sample.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/video_frame_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/video_frame_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/queue_application.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_concat.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_concat_wide.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_copy.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_copy_wide.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_duplicate.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_get_random_uint64.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_pause.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_stop.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_suspend.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_unpause.cc',
-        '<(DEPTH)/starboard/shared/starboard/window_set_default_options.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_create_transformer.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_destroy_transformer.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_get_tag.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_set_authenticated_data.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_set_initialization_vector.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_transform.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_close_session.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_create_system.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_destroy_system.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_generate_session_update_request.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_system_internal.h',
-        '<(DEPTH)/starboard/shared/stub/drm_update_session.cc',
-        '<(DEPTH)/starboard/shared/stub/media_get_audio_configuration.cc',
-        '<(DEPTH)/starboard/shared/stub/media_get_audio_output_count.cc',
-        '<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
-        '<(DEPTH)/starboard/shared/stub/system_clear_platform_error.cc',
-        '<(DEPTH)/starboard/shared/stub/system_get_total_gpu_memory.cc',
-        '<(DEPTH)/starboard/shared/stub/system_get_used_gpu_memory.cc',
-        '<(DEPTH)/starboard/shared/stub/system_hide_splash_screen.cc',
-        '<(DEPTH)/starboard/shared/stub/system_raise_platform_error.cc',
-      ],
-      'include_dirs': [
-        '<(sysroot)/mipsel-r2-hard/usr/include/directfb',
-      ],
-      'defines': [
-        # This must be defined when building Starboard, and must not when
-        # building Starboard client code.
-        'STARBOARD_IMPLEMENTATION',
-      ],
-      'dependencies': [
-        '<(DEPTH)/starboard/common/common.gyp:common',
-        '<(DEPTH)/third_party/dlmalloc/dlmalloc.gyp:dlmalloc',
-        '<(DEPTH)/third_party/libevent/libevent.gyp:libevent',
-        'starboard_base_symbolize',
-      ],
-    },
-  ],
-}
diff --git a/src/starboard/creator/ci20directfb/system_get_property.cc b/src/starboard/creator/ci20directfb/system_get_property.cc
deleted file mode 100644
index 51ca55f..0000000
--- a/src/starboard/creator/ci20directfb/system_get_property.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "starboard/system.h"
-
-#include "starboard/log.h"
-#include "starboard/string.h"
-
-namespace {
-
-const char* kFriendlyName = "Creator Ci20";
-const char* kPlatformName = "DirectFB; Creator Ci20 JZ4780";
-
-bool CopyStringAndTestIfSuccess(char* out_value,
-                                int value_length,
-                                const char* from_value) {
-  if (SbStringGetLength(from_value) + 1 > value_length)
-    return false;
-  SbStringCopy(out_value, from_value, value_length);
-  return true;
-}
-
-}  // namespace
-
-bool SbSystemGetProperty(SbSystemPropertyId property_id,
-                         char* out_value,
-                         int value_length) {
-  if (!out_value || !value_length) {
-    return false;
-  }
-
-  switch (property_id) {
-    case kSbSystemPropertyBrandName:
-    case kSbSystemPropertyChipsetModelNumber:
-    case kSbSystemPropertyFirmwareVersion:
-    case kSbSystemPropertyModelName:
-    case kSbSystemPropertyModelYear:
-    case kSbSystemPropertyNetworkOperatorName:
-    case kSbSystemPropertySpeechApiKey:
-      return false;
-
-    case kSbSystemPropertyFriendlyName:
-      return CopyStringAndTestIfSuccess(out_value, value_length, kFriendlyName);
-
-    case kSbSystemPropertyPlatformName:
-      return CopyStringAndTestIfSuccess(out_value, value_length, kPlatformName);
-
-    case kSbSystemPropertyPlatformUuid:
-      SB_NOTIMPLEMENTED();
-      return CopyStringAndTestIfSuccess(out_value, value_length, "N/A");
-
-    default:
-      SB_DLOG(WARNING) << __FUNCTION__
-                       << ": Unrecognized property: " << property_id;
-      break;
-  }
-
-  return false;
-}
diff --git a/src/starboard/creator/ci20directfb/thread_types_public.h b/src/starboard/creator/ci20directfb/thread_types_public.h
deleted file mode 100644
index b531032..0000000
--- a/src/starboard/creator/ci20directfb/thread_types_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_CREATOR_CI20DIRECTFB_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_CREATOR_CI20DIRECTFB_THREAD_TYPES_PUBLIC_H_
-
-#include "starboard/linux/shared/thread_types_public.h"
-
-#endif  // STARBOARD_CREATOR_CI20DIRECTFB_THREAD_TYPES_PUBLIC_H_
diff --git a/src/starboard/creator/ci20x11/atomic_public.h b/src/starboard/creator/ci20x11/atomic_public.h
deleted file mode 100644
index 932fe9d..0000000
--- a/src/starboard/creator/ci20x11/atomic_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_CREATOR_CI20X11_ATOMIC_PUBLIC_H_
-#define STARBOARD_CREATOR_CI20X11_ATOMIC_PUBLIC_H_
-
-#include "starboard/linux/shared/atomic_public.h"
-
-#endif  // STARBOARD_CREATOR_CI20X11_ATOMIC_PUBLIC_H_
diff --git a/src/starboard/creator/ci20x11/configuration_public.h b/src/starboard/creator/ci20x11/configuration_public.h
deleted file mode 100644
index 4c00bad..0000000
--- a/src/starboard/creator/ci20x11/configuration_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_CREATOR_CI20X11_CONFIGURATION_PUBLIC_H_
-#define STARBOARD_CREATOR_CI20X11_CONFIGURATION_PUBLIC_H_
-
-#include "starboard/creator/shared/configuration_public.h"
-
-#endif  // STARBOARD_CREATOR_CI20X11_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/creator/ci20x11/gyp_configuration.gypi b/src/starboard/creator/ci20x11/gyp_configuration.gypi
deleted file mode 100644
index a2ea1b8..0000000
--- a/src/starboard/creator/ci20x11/gyp_configuration.gypi
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-{
-  'variables': {
-    'platform_libraries': [
-      '-lEGL',
-      '-lGLESv2',
-      '-lX11',
-      '-lXcomposite',
-      '-lXext',
-      '-lXrender',
-    ],
-  },
-
-  'target_defaults': {
-    'default_configuration': 'creator-ci20x11_debug',
-    'configurations': {
-      'creator-ci20x11_debug': {
-        'inherit_from': ['debug_base'],
-      },
-      'creator-ci20x11_devel': {
-        'inherit_from': ['devel_base'],
-      },
-      'creator-ci20x11_qa': {
-        'inherit_from': ['qa_base'],
-      },
-      'creator-ci20x11_gold': {
-        'inherit_from': ['gold_base'],
-      },
-    }, # end of configurations
-  },
-
-  'includes': [
-    '../shared/gyp_configuration.gypi',
-  ],
-}
diff --git a/src/starboard/creator/ci20x11/gyp_configuration.py b/src/starboard/creator/ci20x11/gyp_configuration.py
deleted file mode 100644
index 1c062df..0000000
--- a/src/starboard/creator/ci20x11/gyp_configuration.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Starboard Creator Ci20 X11 platform configuration for gyp_cobalt."""
-
-import logging
-import os
-import sys
-
-# Import the shared Creator platform configuration.
-sys.path.append(
-    os.path.realpath(
-        os.path.join(os.path.dirname(__file__), os.pardir, 'shared')))
-import gyp_configuration  # pylint: disable=import-self,g-import-not-at-top
-
-
-def CreatePlatformConfig():
-  try:
-    return gyp_configuration.PlatformConfig('creator-ci20x11')
-  except RuntimeError as e:
-    logging.critical(e)
-    return None
diff --git a/src/starboard/creator/ci20x11/main.cc b/src/starboard/creator/ci20x11/main.cc
deleted file mode 100644
index 7086895..0000000
--- a/src/starboard/creator/ci20x11/main.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "starboard/configuration.h"
-#include "starboard/shared/signal/crash_signals.h"
-#include "starboard/shared/signal/suspend_signals.h"
-#include "starboard/shared/x11/application_x11.h"
-
-extern "C" SB_EXPORT_PLATFORM int main(int argc, char** argv) {
-  tzset();
-  starboard::shared::signal::InstallCrashSignalHandlers();
-  starboard::shared::signal::InstallSuspendSignalHandlers();
-  starboard::shared::x11::ApplicationX11 application;
-  int result = application.Run(argc, argv);
-  starboard::shared::signal::UninstallSuspendSignalHandlers();
-  starboard::shared::signal::UninstallCrashSignalHandlers();
-  return result;
-}
diff --git a/src/starboard/creator/ci20x11/starboard_platform.gyp b/src/starboard/creator/ci20x11/starboard_platform.gyp
deleted file mode 100644
index f412dec..0000000
--- a/src/starboard/creator/ci20x11/starboard_platform.gyp
+++ /dev/null
@@ -1,314 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-{
-  'targets': [
-    {
-      'target_name': 'starboard_base_symbolize',
-      'type': 'static_library',
-      'sources': [
-        '<(DEPTH)/base/third_party/symbolize/demangle.cc',
-        '<(DEPTH)/base/third_party/symbolize/symbolize.cc',
-      ],
-    },
-    {
-      'target_name': 'starboard_platform',
-      'type': 'static_library',
-      'sources': [
-        '<(DEPTH)/starboard/creator/ci20x11/atomic_public.h',
-        '<(DEPTH)/starboard/creator/ci20x11/configuration_public.h',
-        '<(DEPTH)/starboard/creator/ci20x11/main.cc',
-        '<(DEPTH)/starboard/creator/ci20x11/system_get_property.cc',
-        '<(DEPTH)/starboard/linux/shared/atomic_public.h',
-        '<(DEPTH)/starboard/linux/shared/system_get_connection_type.cc',
-        '<(DEPTH)/starboard/linux/shared/system_get_device_type.cc',
-        '<(DEPTH)/starboard/linux/shared/system_get_path.cc',
-        '<(DEPTH)/starboard/linux/shared/system_has_capability.cc',
-        '<(DEPTH)/starboard/shared/alsa/alsa_audio_sink_type.cc',
-        '<(DEPTH)/starboard/shared/alsa/alsa_audio_sink_type.h',
-        '<(DEPTH)/starboard/shared/alsa/alsa_util.cc',
-        '<(DEPTH)/starboard/shared/alsa/alsa_util.h',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_get_max_channels.cc',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_get_nearest_supported_sample_frequency.cc',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_is_audio_frame_storage_type_supported.cc',
-        '<(DEPTH)/starboard/shared/alsa/audio_sink_is_audio_sample_type_supported.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_allocate_aligned_unchecked.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_allocate_unchecked.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_free.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_free_aligned.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_map.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_reallocate_unchecked.cc',
-        '<(DEPTH)/starboard/shared/dlmalloc/memory_unmap.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_audio_decoder.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_audio_decoder.h',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_common.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_common.h',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_video_decoder.cc',
-        '<(DEPTH)/starboard/shared/ffmpeg/ffmpeg_video_decoder.h',
-        '<(DEPTH)/starboard/shared/gcc/atomic_gcc_public.h',
-        '<(DEPTH)/starboard/shared/iso/character_is_alphanumeric.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_digit.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_hex_digit.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_space.cc',
-        '<(DEPTH)/starboard/shared/iso/character_is_upper.cc',
-        '<(DEPTH)/starboard/shared/iso/character_to_lower.cc',
-        '<(DEPTH)/starboard/shared/iso/character_to_upper.cc',
-        '<(DEPTH)/starboard/shared/iso/directory_close.cc',
-        '<(DEPTH)/starboard/shared/iso/directory_get_next.cc',
-        '<(DEPTH)/starboard/shared/iso/directory_open.cc',
-        '<(DEPTH)/starboard/shared/iso/double_absolute.cc',
-        '<(DEPTH)/starboard/shared/iso/double_exponent.cc',
-        '<(DEPTH)/starboard/shared/iso/double_floor.cc',
-        '<(DEPTH)/starboard/shared/iso/double_is_finite.cc',
-        '<(DEPTH)/starboard/shared/iso/double_is_nan.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_compare.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_copy.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_find_byte.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_move.cc',
-        '<(DEPTH)/starboard/shared/iso/memory_set.cc',
-        '<(DEPTH)/starboard/shared/iso/string_compare.cc',
-        '<(DEPTH)/starboard/shared/iso/string_compare_all.cc',
-        '<(DEPTH)/starboard/shared/iso/string_find_character.cc',
-        '<(DEPTH)/starboard/shared/iso/string_find_last_character.cc',
-        '<(DEPTH)/starboard/shared/iso/string_find_string.cc',
-        '<(DEPTH)/starboard/shared/iso/string_get_length.cc',
-        '<(DEPTH)/starboard/shared/iso/string_get_length_wide.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_double.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_signed_integer.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_uint64.cc',
-        '<(DEPTH)/starboard/shared/iso/string_parse_unsigned_integer.cc',
-        '<(DEPTH)/starboard/shared/iso/string_scan.cc',
-        '<(DEPTH)/starboard/shared/iso/system_binary_search.cc',
-        '<(DEPTH)/starboard/shared/iso/system_sort.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_add.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_create.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_destroy.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_internal.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_remove.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait_timed.cc',
-        '<(DEPTH)/starboard/shared/libevent/socket_waiter_wake_up.cc',
-        '<(DEPTH)/starboard/shared/linux/byte_swap.cc',
-        '<(DEPTH)/starboard/shared/linux/get_home_directory.cc',
-        '<(DEPTH)/starboard/shared/linux/memory_get_stack_bounds.cc',
-        '<(DEPTH)/starboard/shared/linux/page_internal.cc',
-        '<(DEPTH)/starboard/shared/linux/socket_get_local_interface_address.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_random_data.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_stack.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_total_cpu_memory.cc',
-        '<(DEPTH)/starboard/shared/linux/system_get_used_cpu_memory.cc',
-        '<(DEPTH)/starboard/shared/linux/system_is_debugger_attached.cc',
-        '<(DEPTH)/starboard/shared/linux/system_symbolize.cc',
-        '<(DEPTH)/starboard/shared/linux/thread_get_id.cc',
-        '<(DEPTH)/starboard/shared/linux/thread_get_name.cc',
-        '<(DEPTH)/starboard/shared/linux/thread_set_name.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_get_current.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_get_property.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_get_signed_in.cc',
-        '<(DEPTH)/starboard/shared/nouser/user_internal.cc',
-        '<(DEPTH)/starboard/shared/posix/directory_create.cc',
-        '<(DEPTH)/starboard/shared/posix/file_can_open.cc',
-        '<(DEPTH)/starboard/shared/posix/file_close.cc',
-        '<(DEPTH)/starboard/shared/posix/file_delete.cc',
-        '<(DEPTH)/starboard/shared/posix/file_exists.cc',
-        '<(DEPTH)/starboard/shared/posix/file_flush.cc',
-        '<(DEPTH)/starboard/shared/posix/file_get_info.cc',
-        '<(DEPTH)/starboard/shared/posix/file_get_path_info.cc',
-        '<(DEPTH)/starboard/shared/posix/file_open.cc',
-        '<(DEPTH)/starboard/shared/posix/file_read.cc',
-        '<(DEPTH)/starboard/shared/posix/file_seek.cc',
-        '<(DEPTH)/starboard/shared/posix/file_truncate.cc',
-        '<(DEPTH)/starboard/shared/posix/file_write.cc',
-        '<(DEPTH)/starboard/shared/posix/log.cc',
-        '<(DEPTH)/starboard/shared/posix/log_flush.cc',
-        '<(DEPTH)/starboard/shared/posix/log_format.cc',
-        '<(DEPTH)/starboard/shared/posix/log_is_tty.cc',
-        '<(DEPTH)/starboard/shared/posix/log_raw.cc',
-        '<(DEPTH)/starboard/shared/posix/memory_flush.cc',
-        '<(DEPTH)/starboard/shared/posix/set_non_blocking_internal.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_accept.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_bind.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_clear_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_connect.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_create.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_destroy.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_free_resolution.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_get_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_get_local_address.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_internal.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_is_connected.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_is_connected_and_idle.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_join_multicast_group.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_listen.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_receive_from.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_resolve.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_send_to.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_broadcast.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_receive_buffer_size.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_reuse_address.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_send_buffer_size.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_tcp_keep_alive.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_tcp_no_delay.cc',
-        '<(DEPTH)/starboard/shared/posix/socket_set_tcp_window_scaling.cc',
-        '<(DEPTH)/starboard/shared/posix/string_compare_no_case.cc',
-        '<(DEPTH)/starboard/shared/posix/string_compare_no_case_n.cc',
-        '<(DEPTH)/starboard/shared/posix/string_compare_wide.cc',
-        '<(DEPTH)/starboard/shared/posix/string_format.cc',
-        '<(DEPTH)/starboard/shared/posix/string_format_wide.cc',
-        '<(DEPTH)/starboard/shared/posix/system_break_into_debugger.cc',
-        '<(DEPTH)/starboard/shared/posix/system_clear_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_error_string.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_last_error.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_locale_id.cc',
-        '<(DEPTH)/starboard/shared/posix/system_get_number_of_processors.cc',
-        '<(DEPTH)/starboard/shared/posix/thread_sleep.cc',
-        '<(DEPTH)/starboard/shared/posix/time_get_monotonic_now.cc',
-        '<(DEPTH)/starboard/shared/posix/time_get_monotonic_thread_now.cc',
-        '<(DEPTH)/starboard/shared/posix/time_get_now.cc',
-        '<(DEPTH)/starboard/shared/posix/time_zone_get_current.cc',
-        '<(DEPTH)/starboard/shared/posix/time_zone_get_dst_name.cc',
-        '<(DEPTH)/starboard/shared/posix/time_zone_get_name.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_broadcast.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_create.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_destroy.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_signal.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_wait.cc',
-        '<(DEPTH)/starboard/shared/pthread/condition_variable_wait_timed.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_acquire.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_acquire_try.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_create.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_destroy.cc',
-        '<(DEPTH)/starboard/shared/pthread/mutex_release.cc',
-        '<(DEPTH)/starboard/shared/pthread/once.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_create.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_create_local_key.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_create_priority.h',
-        '<(DEPTH)/starboard/shared/pthread/thread_destroy_local_key.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_detach.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_get_current.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_get_local_value.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_is_equal.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_join.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_set_local_value.cc',
-        '<(DEPTH)/starboard/shared/pthread/thread_yield.cc',
-        '<(DEPTH)/starboard/shared/signal/crash_signals.h',
-        '<(DEPTH)/starboard/shared/signal/crash_signals_sigaction.cc',
-        '<(DEPTH)/starboard/shared/signal/suspend_signals.cc',
-        '<(DEPTH)/starboard/shared/signal/suspend_signals.h',
-        '<(DEPTH)/starboard/shared/starboard/application.cc',
-        '<(DEPTH)/starboard/shared/starboard/command_line.cc',
-        '<(DEPTH)/starboard/shared/starboard/command_line.h',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_create.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_destroy.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/audio_sink_is_valid.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc',
-        '<(DEPTH)/starboard/shared/starboard/audio_sink/stub_audio_sink_type.h',
-        '<(DEPTH)/starboard/shared/starboard/directory_can_open.cc',
-        '<(DEPTH)/starboard/shared/starboard/event_cancel.cc',
-        '<(DEPTH)/starboard/shared/starboard/event_schedule.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_mode_string_to_flags.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_close_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_delete_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_get_record_size.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_open_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_read_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/file_storage/storage_write_record.cc',
-        '<(DEPTH)/starboard/shared/starboard/log_message.cc',
-        '<(DEPTH)/starboard/shared/starboard/log_raw_dump_stack.cc',
-        '<(DEPTH)/starboard/shared/starboard/log_raw_format.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/media_can_play_mime_and_key_system.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/media_is_output_protected.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/media_set_output_protection.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/mime_type.cc',
-        '<(DEPTH)/starboard/shared/starboard/media/mime_type.h',
-        '<(DEPTH)/starboard/shared/starboard/new.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/audio_decoder_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/audio_renderer_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/video_decoder_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/filter/video_renderer_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/input_buffer_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/player_create.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_destroy.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_get_info.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/player/player_seek.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_set_bounds.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_set_pause.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_set_volume.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_worker.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_worker.h',
-        '<(DEPTH)/starboard/shared/starboard/player/player_write_end_of_stream.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/player_write_sample.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/video_frame_internal.cc',
-        '<(DEPTH)/starboard/shared/starboard/player/video_frame_internal.h',
-        '<(DEPTH)/starboard/shared/starboard/queue_application.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_concat.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_concat_wide.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_copy.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_copy_wide.cc',
-        '<(DEPTH)/starboard/shared/starboard/string_duplicate.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_get_random_uint64.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_pause.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_stop.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_suspend.cc',
-        '<(DEPTH)/starboard/shared/starboard/system_request_unpause.cc',
-        '<(DEPTH)/starboard/shared/starboard/window_set_default_options.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_create_transformer.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_destroy_transformer.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_get_tag.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_set_authenticated_data.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_set_initialization_vector.cc',
-        '<(DEPTH)/starboard/shared/stub/cryptography_transform.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_close_session.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_create_system.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_destroy_system.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_generate_session_update_request.cc',
-        '<(DEPTH)/starboard/shared/stub/drm_system_internal.h',
-        '<(DEPTH)/starboard/shared/stub/drm_update_session.cc',
-        '<(DEPTH)/starboard/shared/stub/media_get_audio_configuration.cc',
-        '<(DEPTH)/starboard/shared/stub/media_get_audio_output_count.cc',
-        '<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
-        '<(DEPTH)/starboard/shared/stub/system_clear_platform_error.cc',
-        '<(DEPTH)/starboard/shared/stub/system_get_total_gpu_memory.cc',
-        '<(DEPTH)/starboard/shared/stub/system_get_used_gpu_memory.cc',
-        '<(DEPTH)/starboard/shared/stub/system_hide_splash_screen.cc',
-        '<(DEPTH)/starboard/shared/stub/system_raise_platform_error.cc',
-        '<(DEPTH)/starboard/shared/x11/application_x11.cc',
-        '<(DEPTH)/starboard/shared/x11/window_create.cc',
-        '<(DEPTH)/starboard/shared/x11/window_destroy.cc',
-        '<(DEPTH)/starboard/shared/x11/window_get_platform_handle.cc',
-        '<(DEPTH)/starboard/shared/x11/window_get_size.cc',
-        '<(DEPTH)/starboard/shared/x11/window_internal.cc',
-      ],
-      'defines': [
-        # This must be defined when building Starboard, and must not when
-        # building Starboard client code.
-        'STARBOARD_IMPLEMENTATION',
-      ],
-      'dependencies': [
-        '<(DEPTH)/starboard/common/common.gyp:common',
-        '<(DEPTH)/third_party/dlmalloc/dlmalloc.gyp:dlmalloc',
-        '<(DEPTH)/third_party/libevent/libevent.gyp:libevent',
-        'starboard_base_symbolize',
-      ],
-    },
-  ],
-}
diff --git a/src/starboard/creator/ci20x11/system_get_property.cc b/src/starboard/creator/ci20x11/system_get_property.cc
deleted file mode 100644
index 9d71165..0000000
--- a/src/starboard/creator/ci20x11/system_get_property.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "starboard/system.h"
-
-#include "starboard/log.h"
-#include "starboard/string.h"
-
-namespace {
-
-const char* kFriendlyName = "Creator Ci20";
-const char* kPlatformName = "Creator Ci20 JZ4780";
-
-bool CopyStringAndTestIfSuccess(char* out_value,
-                                int value_length,
-                                const char* from_value) {
-  if (SbStringGetLength(from_value) + 1 > value_length)
-    return false;
-  SbStringCopy(out_value, from_value, value_length);
-  return true;
-}
-
-}  // namespace
-
-bool SbSystemGetProperty(SbSystemPropertyId property_id,
-                         char* out_value,
-                         int value_length) {
-  if (!out_value || !value_length) {
-    return false;
-  }
-
-  switch (property_id) {
-    case kSbSystemPropertyBrandName:
-    case kSbSystemPropertyChipsetModelNumber:
-    case kSbSystemPropertyFirmwareVersion:
-    case kSbSystemPropertyModelName:
-    case kSbSystemPropertyModelYear:
-    case kSbSystemPropertyNetworkOperatorName:
-    case kSbSystemPropertySpeechApiKey:
-      return false;
-
-    case kSbSystemPropertyFriendlyName:
-      return CopyStringAndTestIfSuccess(out_value, value_length, kFriendlyName);
-
-    case kSbSystemPropertyPlatformName:
-      return CopyStringAndTestIfSuccess(out_value, value_length, kPlatformName);
-
-    case kSbSystemPropertyPlatformUuid:
-      SB_NOTIMPLEMENTED();
-      return CopyStringAndTestIfSuccess(out_value, value_length, "N/A");
-
-    default:
-      SB_DLOG(WARNING) << __FUNCTION__
-                       << ": Unrecognized property: " << property_id;
-      break;
-  }
-
-  return false;
-}
diff --git a/src/starboard/creator/ci20x11/thread_types_public.h b/src/starboard/creator/ci20x11/thread_types_public.h
deleted file mode 100644
index 7437a70..0000000
--- a/src/starboard/creator/ci20x11/thread_types_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_CREATOR_CI20X11_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_CREATOR_CI20X11_THREAD_TYPES_PUBLIC_H_
-
-#include "starboard/linux/shared/thread_types_public.h"
-
-#endif  // STARBOARD_CREATOR_CI20X11_THREAD_TYPES_PUBLIC_H_
diff --git a/src/starboard/creator/shared/configuration_public.h b/src/starboard/creator/shared/configuration_public.h
deleted file mode 100644
index f8b220e..0000000
--- a/src/starboard/creator/shared/configuration_public.h
+++ /dev/null
@@ -1,432 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// The shared Starboard configuration for Creator devices.
-
-#ifndef STARBOARD_CREATOR_SHARED_CONFIGURATION_PUBLIC_H_
-#define STARBOARD_CREATOR_SHARED_CONFIGURATION_PUBLIC_H_
-
-// --- Architecture Configuration --------------------------------------------
-
-// Whether the current platform is big endian. SB_IS_LITTLE_ENDIAN will be
-// automatically set based on this.
-#define SB_IS_BIG_ENDIAN 0
-
-// Whether the current platform is an ARM architecture.
-#define SB_IS_ARCH_ARM 0
-
-// Whether the current platform is a MIPS architecture.
-#define SB_IS_ARCH_MIPS 1
-
-// Whether the current platform is a PPC architecture.
-#define SB_IS_ARCH_PPC 0
-
-// Whether the current platform is an x86 architecture.
-#define SB_IS_ARCH_X86 0
-
-// Whether the current platform is a 32-bit architecture.
-#define SB_IS_32_BIT 1
-
-// Whether the current platform is a 64-bit architecture.
-#define SB_IS_64_BIT 0
-
-// Whether the current platform's pointers are 32-bit.
-// Whether the current platform's longs are 32-bit.
-#if SB_IS(32_BIT)
-#define SB_HAS_32_BIT_POINTERS 1
-#define SB_HAS_32_BIT_LONG 1
-#else
-#define SB_HAS_32_BIT_POINTERS 0
-#define SB_HAS_32_BIT_LONG 0
-#endif
-
-// Whether the current platform's pointers are 64-bit.
-// Whether the current platform's longs are 64-bit.
-#if SB_IS(64_BIT)
-#define SB_HAS_64_BIT_POINTERS 1
-#define SB_HAS_64_BIT_LONG 1
-#else
-#define SB_HAS_64_BIT_POINTERS 0
-#define SB_HAS_64_BIT_LONG 0
-#endif
-
-// Configuration parameters that allow the application to make some general
-// compile-time decisions with respect to the the number of cores likely to be
-// available on this platform. For a definitive measure, the application should
-// still call SbSystemGetNumberOfProcessors at runtime.
-
-// Whether the current platform is expected to have many cores (> 6), or a
-// wildly varying number of cores.
-#define SB_HAS_MANY_CORES 0
-
-// Whether the current platform is expected to have exactly 1 core.
-#define SB_HAS_1_CORE 0
-
-// Whether the current platform is expected to have exactly 2 cores.
-#define SB_HAS_2_CORES 1
-
-// Whether the current platform is expected to have exactly 4 cores.
-#define SB_HAS_4_CORES 0
-
-// Whether the current platform is expected to have exactly 6 cores.
-#define SB_HAS_6_CORES 0
-
-// Whether the current platform's thread scheduler will automatically balance
-// threads between cores, as opposed to systems where threads will only ever run
-// on the specifically pinned core.
-#define SB_HAS_CROSS_CORE_SCHEDULER 1
-
-// The API version implemented by this platform.
-#define SB_API_VERSION 2
-
-// --- System Header Configuration -------------------------------------------
-
-// Any system headers listed here that are not provided by the platform will be
-// emulated in starboard/types.h.
-
-// Whether the current platform provides the standard header stdarg.h.
-#define SB_HAS_STDARG_H 1
-
-// Whether the current platform provides the standard header stdbool.h.
-#define SB_HAS_STDBOOL_H 1
-
-// Whether the current platform provides the standard header stddef.h.
-#define SB_HAS_STDDEF_H 1
-
-// Whether the current platform provides the standard header stdint.h.
-#define SB_HAS_STDINT_H 1
-
-// Whether the current platform provides the standard header inttypes.h.
-#define SB_HAS_INTTYPES_H 1
-
-// Whether the current platform provides the standard header wchar.h.
-#define SB_HAS_WCHAR_H 1
-
-// Whether the current platform provides the standard header limits.h.
-#define SB_HAS_LIMITS_H 1
-
-// Whether the current platform provides the standard header float.h.
-#define SB_HAS_FLOAT_H 1
-
-// Whether the current platform provides ssize_t.
-#define SB_HAS_SSIZE_T 1
-
-// Whether the current platform has microphone supported.
-#define SB_HAS_MICROPHONE 0
-
-// Whether the current platform has speech recognizer.
-#define SB_HAS_SPEECH_RECOGNIZER 0
-
-// Whether the current platform has speech synthesis.
-#define SB_HAS_SPEECH_SYNTHESIS 0
-
-// Type detection for wchar_t.
-#if defined(__WCHAR_MAX__) && \
-    (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
-#define SB_IS_WCHAR_T_UTF32 1
-#elif defined(__WCHAR_MAX__) && \
-    (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
-#define SB_IS_WCHAR_T_UTF16 1
-#endif
-
-// Chrome only defines these two if ARMEL or MIPSEL are defined.
-#if defined(__ARMEL__)
-// Chrome has an exclusion for iOS here, we should too when we support iOS.
-#define SB_IS_WCHAR_T_UNSIGNED 1
-#elif defined(__MIPSEL__)
-#define SB_IS_WCHAR_T_SIGNED 1
-#endif
-
-// --- Architecture Configuration --------------------------------------------
-
-// On default Linux, you must be a superuser in order to set real time
-// scheduling on threads.
-#define SB_HAS_THREAD_PRIORITY_SUPPORT 0
-
-// --- Compiler Configuration ------------------------------------------------
-
-// The platform's annotation for forcing a C function to be inlined.
-#define SB_C_FORCE_INLINE __inline__ __attribute__((always_inline))
-
-// The platform's annotation for marking a C function as suggested to be
-// inlined.
-#define SB_C_INLINE inline
-
-// The platform's annotation for marking a C function as forcibly not
-// inlined.
-#define SB_C_NOINLINE __attribute__((noinline))
-
-// The platform's annotation for marking a symbol as exported outside of the
-// current shared library.
-#define SB_EXPORT_PLATFORM __attribute__((visibility("default")))
-
-// The platform's annotation for marking a symbol as imported from outside of
-// the current linking unit.
-#define SB_IMPORT_PLATFORM
-
-// --- Extensions Configuration ----------------------------------------------
-
-// GCC/Clang doesn't define a long long hash function, except for Android and
-// Game consoles.
-#define SB_HAS_LONG_LONG_HASH 0
-
-// GCC/Clang doesn't define a string hash function, except for Game Consoles.
-#define SB_HAS_STRING_HASH 0
-
-// Desktop Linux needs a using statement for the hash functions.
-#define SB_HAS_HASH_USING 0
-
-// Set this to 1 if hash functions for custom types can be defined as a
-// hash_value() function. Otherwise, they need to be placed inside a
-// partially-specified hash struct template with an operator().
-#define SB_HAS_HASH_VALUE 0
-
-// Set this to 1 if use of hash_map or hash_set causes a deprecation warning
-// (which then breaks the build).
-#define SB_HAS_HASH_WARNING 1
-
-// The location to include hash_map on this platform.
-#define SB_HASH_MAP_INCLUDE <ext/hash_map>
-
-// C++'s hash_map and hash_set are often found in different namespaces depending
-// on the compiler.
-#define SB_HASH_NAMESPACE __gnu_cxx
-
-// The location to include hash_set on this platform.
-#define SB_HASH_SET_INCLUDE <ext/hash_set>
-
-// Define this to how this platform copies varargs blocks.
-#define SB_VA_COPY(dest, source) va_copy(dest, source)
-
-// --- Filesystem Configuration ----------------------------------------------
-
-// The current platform's maximum length of the name of a single directory
-// entry, not including the absolute path.
-#define SB_FILE_MAX_NAME 64
-
-// The current platform's maximum length of an absolute path.
-#define SB_FILE_MAX_PATH 4096
-
-// The current platform's maximum number of files that can be opened at the
-// same time by one process.
-#define SB_FILE_MAX_OPEN 256
-
-// The current platform's file path component separator character. This is the
-// character that appears after a directory in a file path. For example, the
-// absolute canonical path of the file "/path/to/a/file.txt" uses '/' as a path
-// component separator character.
-#define SB_FILE_SEP_CHAR '/'
-
-// The current platform's alternate file path component separator character.
-// This is like SB_FILE_SEP_CHAR, except if your platform supports an alternate
-// character, then you can place that here. For example, on windows machines,
-// the primary separator character is probably '\', but the alternate is '/'.
-#define SB_FILE_ALT_SEP_CHAR '/'
-
-// The current platform's search path component separator character. When
-// specifying an ordered list of absolute paths of directories to search for a
-// given reason, this is the character that appears between entries. For
-// example, the search path of "/etc/search/first:/etc/search/second" uses ':'
-// as a search path component separator character.
-#define SB_PATH_SEP_CHAR ':'
-
-// The string form of SB_FILE_SEP_CHAR.
-#define SB_FILE_SEP_STRING "/"
-
-// The string form of SB_FILE_ALT_SEP_CHAR.
-#define SB_FILE_ALT_SEP_STRING "/"
-
-// The string form of SB_PATH_SEP_CHAR.
-#define SB_PATH_SEP_STRING ":"
-
-// --- Memory Configuration --------------------------------------------------
-
-// The memory page size, which controls the size of chunks on memory that
-// allocators deal with, and the alignment of those chunks. This doesn't have to
-// be the hardware-defined physical page size, but it should be a multiple of
-// it.
-#define SB_MEMORY_PAGE_SIZE 4096
-
-// Whether this platform has and should use an MMAP function to map physical
-// memory to the virtual address space.
-#define SB_HAS_MMAP 1
-
-// Whether this platform can map executable memory. Implies SB_HAS_MMAP. This is
-// required for platforms that want to JIT.
-#define SB_CAN_MAP_EXECUTABLE_MEMORY 1
-
-// Whether this platform has and should use an growable heap (e.g. with sbrk())
-// to map physical memory to the virtual address space.
-#define SB_HAS_VIRTUAL_REGIONS 0
-
-// Specifies the alignment for IO Buffers, in bytes. Some low-level network APIs
-// may require buffers to have a specific alignment, and this is the place to
-// specify that.
-#define SB_NETWORK_IO_BUFFER_ALIGNMENT 16
-
-// Determines the alignment that allocations should have on this platform.
-#define SB_MALLOC_ALIGNMENT ((size_t)16U)
-
-// Determines the threshhold of allocation size that should be done with mmap
-// (if available), rather than allocated within the core heap.
-#define SB_DEFAULT_MMAP_THRESHOLD ((size_t)(256 * 1024U))
-
-// Defines the path where memory debugging logs should be written to.
-#define SB_MEMORY_LOG_PATH "/tmp/starboard"
-
-// --- Thread Configuration --------------------------------------------------
-
-// Defines the maximum number of simultaneous threads for this platform. Some
-// platforms require sharing thread handles with other kinds of system handles,
-// like mutexes, so we want to keep this managable.
-#define SB_MAX_THREADS 90
-
-// The maximum number of thread local storage keys supported by this platform.
-#define SB_MAX_THREAD_LOCAL_KEYS 512
-
-// The maximum length of the name for a thread, including the NULL-terminator.
-#define SB_MAX_THREAD_NAME_LENGTH 16;
-
-// --- Graphics Configuration ------------------------------------------------
-
-// Specifies whether this platform supports a performant accelerated blitter
-// API. The basic requirement is a scaled, clipped, alpha-blended blit.
-#define SB_HAS_BLITTER 0
-
-// Specifies the preferred byte order of color channels in a pixel. Refer to
-// starboard/configuration.h for the possible values. EGL/GLES platforms should
-// generally prefer a byte order of RGBA, regardless of endianness.
-#define SB_PREFERRED_RGBA_BYTE_ORDER SB_PREFERRED_RGBA_BYTE_ORDER_RGBA
-
-// Indicates whether or not the given platform supports bilinear filtering.
-// This can be checked to enable/disable renderer tests that verify that this is
-// working properly.
-#define SB_HAS_BILINEAR_FILTERING_SUPPORT 1
-
-// Indicates whether or not the given platform supports rendering of NV12
-// textures. These textures typically originate from video decoders.
-#define SB_HAS_NV12_TEXTURE_SUPPORT 1
-
-// Whether the current platform should frequently flip their display buffer.
-// If this is not required (e.g. SB_MUST_FREQUENTLY_FLIP_DISPLAY_BUFFER is set
-// to 0), then optimizations where the display buffer is not flipped if the
-// scene hasn't changed are enabled.
-#define SB_MUST_FREQUENTLY_FLIP_DISPLAY_BUFFER 0
-
-// --- Media Configuration ---------------------------------------------------
-
-// Specifies whether this platform has support for a possibly-decrypting
-// elementary stream player for at least H.264/AAC (and AES-128-CTR, if
-// decrypting). A player is responsible for ingesting an audio and video
-// elementary stream, optionally-encrypted, and ultimately producing
-// synchronized audio/video. If a player is defined, it must choose one of the
-// supported composition methods below.
-#define SB_HAS_PLAYER 1
-
-#if SB_API_VERSION < 4
-// Specifies whether this platform's player will produce an OpenGL texture that
-// the client must draw every frame with its graphics rendering. It may be that
-// we get a texture handle, but cannot perform operations like GlReadPixels on
-// it if it is DRM-protected.
-#define SB_IS_PLAYER_PRODUCING_TEXTURE 0
-
-// Specifies whether this platform's player is composited with a formal
-// compositor, where the client must specify how video is to be composited into
-// the graphicals scene.
-#define SB_IS_PLAYER_COMPOSITED 0
-
-// Specifies whether this platform's player uses a "punch-out" model, where
-// video is rendered to the far background, and the graphics plane is
-// automatically composited on top of the video by the platform. The client must
-// punch an alpha hole out of the graphics plane for video to show through.  In
-// this case, changing the video bounds must be tightly synchronized between the
-// player and the graphics plane.
-#define SB_IS_PLAYER_PUNCHED_OUT 1
-#endif  // SB_API_VERSION < 4
-
-// Specifies whether this platform has webm/vp9 support.  This should be set to
-// non-zero on platforms with webm/vp9 support.
-#define SB_HAS_MEDIA_WEBM_VP9_SUPPORT 0
-
-// Specifies the stack size for threads created inside media stack.  Set to 0 to
-// use the default thread stack size.  Set to non-zero to explicitly set the
-// stack size for media stack threads.
-#define SB_MEDIA_THREAD_STACK_SIZE 0U
-
-// --- Decoder-only Params ---
-
-// Specifies how media buffers must be aligned on this platform as some
-// decoders may have special requirement on the alignment of buffers being
-// decoded.
-#define SB_MEDIA_BUFFER_ALIGNMENT 128U
-
-// Specifies how video frame buffers must be aligned on this platform.
-#define SB_MEDIA_VIDEO_FRAME_ALIGNMENT 256U
-
-// The encoded video frames are compressed in different ways, their decoding
-// time can vary a lot.  Occasionally a single frame can take longer time to
-// decode than the average time per frame.  The player has to cache some frames
-// to account for such inconsistency.  The number of frames being cached are
-// controlled by the following two macros.
-//
-// Specify the number of video frames to be cached before the playback starts.
-// Note that set this value too large may increase the playback start delay.
-#define SB_MEDIA_MAXIMUM_VIDEO_PREROLL_FRAMES 4
-
-// Specify the number of video frames to be cached during playback.  A large
-// value leads to more stable fps but also causes the app to use more memory.
-#define SB_MEDIA_MAXIMUM_VIDEO_FRAMES 12
-
-// --- Network Configuration -------------------------------------------------
-
-// Specifies whether this platform supports IPV6.
-#define SB_HAS_IPV6 1
-
-// Specifies whether this platform supports pipe.
-#define SB_HAS_PIPE 1
-
-// --- Tuneable Parameters ---------------------------------------------------
-
-// Specifies the network receive buffer size in bytes, set via
-// SbSocketSetReceiveBufferSize().
-//
-// Setting this to 0 indicates that SbSocketSetReceiveBufferSize() should
-// not be called. Use this for OSs (such as Linux) where receive buffer
-// auto-tuning is better.
-//
-// On some platforms, this may affect max TCP window size which may
-// dramatically affect throughput in the presence of latency.
-//
-// If your platform does not have a good TCP auto-tuning mechanism,
-// a setting of (128 * 1024) here is recommended.
-#define SB_NETWORK_RECEIVE_BUFFER_SIZE (0)
-
-// --- User Configuration ----------------------------------------------------
-
-// The maximum number of users that can be signed in at the same time.
-#define SB_USER_MAX_SIGNED_IN 1
-
-// --- Timing API ------------------------------------------------------------
-
-// Whether this platform has an API to retrieve how long the current thread
-// has spent in the executing state.
-#define SB_HAS_TIME_THREAD_NOW 1
-
-// --- Platform Specific Audits ----------------------------------------------
-
-#if !defined(__GNUC__)
-#error "CREATOR_SHARED builds need a GCC-like compiler (for the moment)."
-#endif
-
-#endif  // STARBOARD_CREATOR_SHARED_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/creator/shared/gyp_configuration.gypi b/src/starboard/creator/shared/gyp_configuration.gypi
deleted file mode 100644
index 2d7e40d..0000000
--- a/src/starboard/creator/shared/gyp_configuration.gypi
+++ /dev/null
@@ -1,152 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-{
-  'variables': {
-    'target_arch': 'mips',
-    'target_os': 'linux',
-
-    'enable_webdriver': 0,
-    'in_app_dial%': 0,
-    'gl_type%': 'system_gles3',
-
-    'scratch_surface_cache_size_in_bytes' : 0,
-
-    # This should have a default value in cobalt/base.gypi. See the comment
-    # there for acceptable values for this variable.
-    'javascript_engine': 'mozjs',
-    'cobalt_enable_jit': 0,
-
-    # Define platform specific compiler and linker flags.
-    # Refer to base.gypi for a list of all available variables.
-    'compiler_flags_host': [
-      '-O2',
-    ],
-    'compiler_flags': [
-      # We'll pretend not to be Linux, but Starboard instead.
-      '-U__linux__',
-      '--sysroot=<(sysroot)',
-      '-EL',
-
-      # Suppress some warnings that will be hard to fix.
-      '-Wno-unused-local-typedefs',
-      '-Wno-unused-result',
-      '-Wno-deprecated-declarations',
-      '-Wno-missing-field-initializers',
-      '-Wno-comment',
-      '-Wno-narrowing',
-      '-Wno-unknown-pragmas',
-      '-Wno-type-limits',  # TODO: We should actually look into these.
-    ],
-    'linker_flags': [
-      '--sysroot=<(sysroot)',
-      '-EL',
-
-      # We don't wrap these symbols, but this ensures that they aren't
-      # linked in.
-      '-Wl,--wrap=malloc',
-      '-Wl,--wrap=calloc',
-      '-Wl,--wrap=realloc',
-      '-Wl,--wrap=memalign',
-      '-Wl,--wrap=reallocalign',
-      '-Wl,--wrap=free',
-      '-Wl,--wrap=strdup',
-      '-Wl,--wrap=malloc_usable_size',
-      '-Wl,--wrap=malloc_stats_fast',
-      '-Wl,--wrap=__cxa_demangle',
-    ],
-    'compiler_flags_debug': [
-      '-O0',
-    ],
-    'compiler_flags_cc_debug': [
-      '-frtti',
-    ],
-    'compiler_flags_devel': [
-      '-O2',
-    ],
-    'compiler_flags_cc_devel': [
-      '-frtti',
-    ],
-    'compiler_flags_qa': [
-      '-O2',
-    ],
-    'compiler_flags_cc_qa': [
-      '-fno-rtti',
-    ],
-    'compiler_flags_gold': [
-      '-O2',
-    ],
-    'compiler_flags_cc_gold': [
-      '-fno-rtti',
-    ],
-    'platform_libraries': [
-      '-lasound',
-      '-lavcodec',
-      '-lavformat',
-      '-lavresample',
-      '-lavutil',
-      '-lm',
-      '-lpthread',
-      '-lpulse',
-      '-lrt',
-    ],
-    'conditions': [
-      ['cobalt_fastbuild==0', {
-        'compiler_flags_debug': [
-          '-g',
-        ],
-        'compiler_flags_devel': [
-          '-g',
-        ],
-        'compiler_flags_qa': [
-        ],
-        'compiler_flags_gold': [
-        ],
-      }],
-    ],
-  },
-
-  'target_defaults': {
-    'defines': [
-      # Cobalt on Linux flag
-      'COBALT_LINUX',
-      '__STDC_FORMAT_MACROS', # so that we get PRI*
-      # Enable GNU extensions to get prototypes like ffsl.
-      '_GNU_SOURCE=1',
-    ],
-    'cflags_c': [
-      '-std=c11',
-    ],
-    'cflags_cc': [
-      '-std=gnu++11',
-      '-Wno-literal-suffix',
-    ],
-    'target_conditions': [
-      ['sb_pedantic_warnings==1', {
-        'cflags': [
-          '-Wall',
-          '-Wextra',
-          '-Wunreachable-code',
-        ],
-      },{
-        'cflags': [
-          # Do not warn about unused function params.
-          '-Wno-unused-parameter',
-          # Do not warn for implicit type conversions that may change a value.
-          '-Wno-conversion',
-        ],
-      }],
-    ],
-  }, # end of target_defaults
-}
diff --git a/src/starboard/creator/shared/gyp_configuration.py b/src/starboard/creator/shared/gyp_configuration.py
deleted file mode 100644
index 373a70e..0000000
--- a/src/starboard/creator/shared/gyp_configuration.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Starboard Creator Ci20 platform configuration for gyp_cobalt."""
-
-import logging
-import os
-import sys
-
-import config.starboard
-
-
-class PlatformConfig(config.starboard.PlatformConfigStarboard):
-  """Starboard ci20 platform configuration."""
-
-  def __init__(self, platform):
-    super(PlatformConfig, self).__init__(platform)
-
-  def _GetCi20Home(self):
-    try:
-      ci20_home = os.environ['CI20_HOME']
-    except KeyError:
-      logging.critical('ci20 builds require the `CI20_HOME\' '
-                       'environment variable to be set.')
-      sys.exit(1)
-    return ci20_home
-
-  def GetVariables(self, configuration):
-    ci20_home = self._GetCi20Home()
-
-    relative_sysroot = os.path.join('mips-mti-linux-gnu', '2016.05-03',
-                                    'sysroot')
-    sysroot = os.path.join(ci20_home, relative_sysroot)
-
-    if not os.path.isdir(sysroot):
-      logging.critical(
-          'ci20 builds require $CI20_HOME/%s to be a valid directory.',
-          relative_sysroot)
-      sys.exit(1)
-    variables = super(PlatformConfig, self).GetVariables(configuration)
-    variables.update({
-        'clang': 0,
-        'sysroot': sysroot,
-    })
-
-    return variables
-
-  def GetEnvironmentVariables(self):
-    ci20_home = self._GetCi20Home()
-
-    toolchain_bin_dir = os.path.join(ci20_home, 'mips-mti-linux-gnu',
-                                     '2016.05-03', 'bin')
-
-    env_variables = {
-        'CC': os.path.join(toolchain_bin_dir, 'mips-mti-linux-gnu-gcc'),
-        'CXX': os.path.join(toolchain_bin_dir, 'mips-mti-linux-gnu-g++'),
-        'CC_host': 'gcc',
-        'CXX_host': 'g++',
-        'LD_host': 'g++',
-        'ARFLAGS_host': 'rcs',
-        'ARTHINFLAGS_host': 'rcsT',
-    }
-    return env_variables
diff --git a/src/starboard/event.h b/src/starboard/event.h
index e854b27..9788ecd 100644
--- a/src/starboard/event.h
+++ b/src/starboard/event.h
@@ -47,8 +47,8 @@
 //
 // The first event that a Starboard application receives is either |Start|
 // (kSbEventTypeStart) or |Preload| (kSbEventTypePreload). |Start| puts the
-// application application in the |STARTED| state, whereas |Preload| puts the
-// application in the |PRELOADING| state.
+// application in the |STARTED| state, whereas |Preload| puts the application in
+// the |PRELOADING| state.
 //
 // |PRELOADING| can only happen as the first application state. In this state,
 // the application should start and run as normal, but will not receive any
diff --git a/src/starboard/linux/shared/decode_target_internal.cc b/src/starboard/linux/shared/decode_target_internal.cc
index 1b2613b..f6c2186 100644
--- a/src/starboard/linux/shared/decode_target_internal.cc
+++ b/src/starboard/linux/shared/decode_target_internal.cc
@@ -131,7 +131,16 @@
   params.frame = frame;
 
 #if SB_HAS(GLES2)
-  SbDecodeTargetRunInGlesContext(provider, &CreateWithContextRunner, &params);
+  if (!provider) {
+    if (SbDecodeTargetIsValid(params.decode_target_out)) {
+      // Should the decode target have been created and the GLES context been
+      // somehow lost, it is released without the context
+      SbDecodeTargetRelease(params.decode_target_out);
+    }
+    params.decode_target_out = kSbDecodeTargetInvalid;
+  } else {
+    SbDecodeTargetRunInGlesContext(provider, &CreateWithContextRunner, &params);
+  }
 #endif
 
   return params.decode_target_out;
diff --git a/src/starboard/linux/shared/media_is_video_supported.cc b/src/starboard/linux/shared/media_is_video_supported.cc
new file mode 100644
index 0000000..dde7820
--- /dev/null
+++ b/src/starboard/linux/shared/media_is_video_supported.cc
@@ -0,0 +1,29 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "starboard/shared/starboard/media/media_support_internal.h"
+
+#include "starboard/configuration.h"
+#include "starboard/media.h"
+
+SB_EXPORT bool SbMediaIsVideoSupported(SbMediaVideoCodec video_codec,
+                                       int frame_width,
+                                       int frame_height,
+                                       int64_t bitrate,
+                                       int fps) {
+  return (video_codec == kSbMediaVideoCodecH264 ||
+          video_codec == kSbMediaVideoCodecVp9) &&
+         frame_width <= 1920 && frame_height <= 1080 &&
+         bitrate <= SB_MEDIA_MAX_VIDEO_BITRATE_IN_BITS_PER_SECOND && fps <= 60;
+}
diff --git a/src/starboard/linux/shared/player_components_impl.cc b/src/starboard/linux/shared/player_components_impl.cc
new file mode 100644
index 0000000..49c8850
--- /dev/null
+++ b/src/starboard/linux/shared/player_components_impl.cc
@@ -0,0 +1,84 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "starboard/shared/starboard/player/filter/player_components.h"
+
+#include "starboard/audio_sink.h"
+#include "starboard/shared/ffmpeg/ffmpeg_audio_decoder.h"
+#include "starboard/shared/ffmpeg/ffmpeg_video_decoder.h"
+#include "starboard/shared/libvpx/vpx_video_decoder.h"
+#include "starboard/shared/starboard/player/filter/audio_renderer_impl_internal.h"
+#include "starboard/shared/starboard/player/filter/video_renderer_impl_internal.h"
+
+namespace starboard {
+namespace shared {
+namespace starboard {
+namespace player {
+namespace filter {
+
+// static
+scoped_ptr<PlayerComponents> PlayerComponents::Create(
+    const AudioParameters& audio_parameters,
+    const VideoParameters& video_parameters) {
+  typedef ::starboard::shared::ffmpeg::AudioDecoder AudioDecoderImpl;
+  typedef ::starboard::shared::ffmpeg::VideoDecoder FfmpegVideoDecoderImpl;
+  typedef ::starboard::shared::vpx::VideoDecoder VpxVideoDecoderImpl;
+
+  // TODO: This is not ideal as we should really handle the creation failure of
+  // audio sink inside the audio renderer to give the renderer a chance to
+  // resample the decoded audio.
+  const int audio_channels = audio_parameters.audio_header.number_of_channels;
+  if (audio_channels > SbAudioSinkGetMaxChannels()) {
+    return scoped_ptr<PlayerComponents>(NULL);
+  }
+
+  AudioDecoderImpl* audio_decoder = new AudioDecoderImpl(
+      audio_parameters.audio_codec, audio_parameters.audio_header);
+  if (!audio_decoder->is_valid()) {
+    delete audio_decoder;
+    return scoped_ptr<PlayerComponents>(NULL);
+  }
+
+  scoped_ptr<HostedVideoDecoder> video_decoder;
+  if (video_parameters.video_codec == kSbMediaVideoCodecVp9) {
+    VpxVideoDecoderImpl* vpx_video_decoder = new VpxVideoDecoderImpl(
+        video_parameters.video_codec, video_parameters.output_mode,
+        video_parameters.decode_target_graphics_context_provider);
+    video_decoder.reset(vpx_video_decoder);
+  } else {
+    FfmpegVideoDecoderImpl* ffmpeg_video_decoder = new FfmpegVideoDecoderImpl(
+        video_parameters.video_codec, video_parameters.output_mode,
+        video_parameters.decode_target_graphics_context_provider);
+    if (!ffmpeg_video_decoder->is_valid()) {
+      delete ffmpeg_video_decoder;
+      return scoped_ptr<PlayerComponents>(NULL);
+    }
+    video_decoder.reset(ffmpeg_video_decoder);
+  }
+
+  AudioRendererImpl* audio_renderer =
+      new AudioRendererImpl(scoped_ptr<AudioDecoder>(audio_decoder).Pass(),
+                            audio_parameters.audio_header);
+  VideoRendererImpl* video_renderer =
+      new VideoRendererImpl(video_decoder.Pass());
+
+  return scoped_ptr<PlayerComponents>(
+      new PlayerComponents(audio_renderer, video_renderer));
+}
+
+}  // namespace filter
+}  // namespace player
+}  // namespace starboard
+}  // namespace shared
+}  // namespace starboard
diff --git a/src/starboard/linux/shared/starboard_platform.gypi b/src/starboard/linux/shared/starboard_platform.gypi
index b20fee6..f896d17 100644
--- a/src/starboard/linux/shared/starboard_platform.gypi
+++ b/src/starboard/linux/shared/starboard_platform.gypi
@@ -20,6 +20,8 @@
       '<(DEPTH)/starboard/linux/shared/decode_target_internal.cc',
       '<(DEPTH)/starboard/linux/shared/decode_target_internal.h',
       '<(DEPTH)/starboard/linux/shared/decode_target_release.cc',
+      '<(DEPTH)/starboard/linux/shared/media_is_video_supported.cc',
+      '<(DEPTH)/starboard/linux/shared/player_components_impl.cc',
       '<(DEPTH)/starboard/linux/shared/system_get_connection_type.cc',
       '<(DEPTH)/starboard/linux/shared/system_get_device_type.cc',
       '<(DEPTH)/starboard/linux/shared/system_get_path.cc',
@@ -85,6 +87,8 @@
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait.cc',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_wait_timed.cc',
       '<(DEPTH)/starboard/shared/libevent/socket_waiter_wake_up.cc',
+      '<(DEPTH)/starboard/shared/libvpx/vpx_video_decoder.cc',
+      '<(DEPTH)/starboard/shared/libvpx/vpx_video_decoder.h',
       '<(DEPTH)/starboard/shared/linux/byte_swap.cc',
       '<(DEPTH)/starboard/shared/linux/get_home_directory.cc',
       '<(DEPTH)/starboard/shared/linux/memory_get_stack_bounds.cc',
@@ -223,7 +227,6 @@
       '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_output_count_stereo_only.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_is_audio_supported_aac_and_opus.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_is_output_protected.cc',
-      '<(DEPTH)/starboard/shared/starboard/media/media_is_video_supported_h264_1080p_hfr_only.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_set_output_protection.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_util.cc',
       '<(DEPTH)/starboard/shared/starboard/media/media_util.h',
@@ -241,7 +244,6 @@
       '<(DEPTH)/starboard/shared/starboard/player/filter/audio_time_stretcher.h',
       '<(DEPTH)/starboard/shared/starboard/player/filter/decoded_audio_queue.cc',
       '<(DEPTH)/starboard/shared/starboard/player/filter/decoded_audio_queue.h',
-      '<(DEPTH)/starboard/shared/starboard/player/filter/ffmpeg_player_components_impl.cc',
       '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc',
       '<(DEPTH)/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.h',
       '<(DEPTH)/starboard/shared/starboard/player/filter/player_components.h',
@@ -340,6 +342,7 @@
       '<(DEPTH)/starboard/linux/shared/starboard_base_symbolize.gyp:starboard_base_symbolize',
       '<(DEPTH)/third_party/dlmalloc/dlmalloc.gyp:dlmalloc',
       '<(DEPTH)/third_party/libevent/libevent.gyp:libevent',
+      '<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
     ],
   },
 }
diff --git a/src/starboard/linux/x64x11/cpp11/compiler_flags.gypi b/src/starboard/linux/x64x11/cpp11/compiler_flags.gypi
deleted file mode 100644
index 56dae63..0000000
--- a/src/starboard/linux/x64x11/cpp11/compiler_flags.gypi
+++ /dev/null
@@ -1,164 +0,0 @@
-# Copyright 2017 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Platform specific compiler flags for Linux on Starboard. Included from
-# gyp_configuration.gypi.
-#
-{
-  'variables': {
-    'compiler_flags_host': [
-      '-O2',
-    ],
-    'linker_flags': [
-    ],
-    'compiler_flags_debug': [
-      '-frtti',
-      '-O0',
-    ],
-    'compiler_flags_devel': [
-      '-frtti',
-      '-O2',
-    ],
-    'compiler_flags_qa': [
-      '-fno-rtti',
-      '-O2',
-      '-gline-tables-only',
-    ],
-    'compiler_flags_gold': [
-      '-fno-rtti',
-      '-O2',
-      '-gline-tables-only',
-    ],
-    'conditions': [
-      ['clang==1', {
-        'common_clang_flags': [
-          '-Werror',
-          '-fcolor-diagnostics',
-          # Default visibility to hidden, to enable dead stripping.
-          '-fvisibility=hidden',
-          # Warn for implicit type conversions that may change a value.
-          '-Wconversion',
-          '-Wno-c++11-compat',
-          # This (rightfully) complains about 'override', which we use
-          # heavily.
-          '-Wno-c++11-extensions',
-          # Warns on switches on enums that cover all enum values but
-          # also contain a default: branch. Chrome is full of that.
-          '-Wno-covered-switch-default',
-          # protobuf uses hash_map.
-          '-Wno-deprecated',
-          '-fno-exceptions',
-          # Don't warn about the "struct foo f = {0};" initialization pattern.
-          '-Wno-missing-field-initializers',
-          # Do not warn for implicit sign conversions.
-          '-Wno-sign-conversion',
-          '-fno-strict-aliasing',  # See http://crbug.com/32204
-          '-Wno-unnamed-type-template-args',
-          # Triggered by the COMPILE_ASSERT macro.
-          '-Wno-unused-local-typedef',
-        ],
-      }],
-      ['cobalt_fastbuild==0', {
-        'compiler_flags_debug': [
-          '-g',
-        ],
-        'compiler_flags_devel': [
-          '-g',
-        ],
-        'compiler_flags_qa': [
-          '-gline-tables-only',
-        ],
-        'compiler_flags_gold': [
-          '-gline-tables-only',
-        ],
-      }],
-    ],
-  },
-
-  'target_defaults': {
-    'defines': [
-      # By default, <EGL/eglplatform.h> pulls in some X11 headers that have some
-      # nasty macros (|Status|, for example) that conflict with Chromium base.
-      'MESA_EGL_NO_X11_HEADERS'
-    ],
-    'cflags_c': [
-      # Limit to C99. This allows Linux to be a canary build for any
-      # C11 features that are not supported on some platforms' compilers.
-      '-std=c99',
-    ],
-    'cflags_cc': [
-      '-std=gnu++11',
-      # Don't warn about an implicit exception spec mismatch
-      '-Wno-implicit-exception-spec-mismatch',
-      # Don't warn about inline new and delete
-      '-Wno-inline-new-delete',
-    ],
-    'target_conditions': [
-      ['sb_pedantic_warnings==1', {
-        'cflags': [
-          '-Wall',
-          '-Wextra',
-          '-Wunreachable-code',
-          '<@(common_clang_flags)',
-        ],
-      },{
-        'cflags': [
-          '<@(common_clang_flags)',
-          # 'this' pointer cannot be NULL...pointer may be assumed
-          # to always convert to true.
-          '-Wno-undefined-bool-conversion',
-          # Skia doesn't use overrides.
-          '-Wno-inconsistent-missing-override',
-          # Do not warn about unused function params.
-          '-Wno-unused-parameter',
-          # Do not warn for implicit type conversions that may change a value.
-          '-Wno-conversion',
-          # shifting a negative signed value is undefined
-          '-Wno-shift-negative-value',
-          # Width of bit-field exceeds width of its type- value will be truncated
-          '-Wno-bitfield-width',
-          # Do not warn if a function or variable cannot be implicitly
-          # instantiated.
-          '-Wno-undefined-var-template',
-        ],
-      }],
-      ['use_asan==1', {
-        'cflags': [
-          '-fsanitize=address',
-          '-fno-omit-frame-pointer',
-        ],
-        'ldflags': [
-          '-fsanitize=address',
-          # Force linking of the helpers in sanitizer_options.cc
-          '-Wl,-u_sanitizer_options_link_helper',
-        ],
-        'defines': [
-          'ADDRESS_SANITIZER',
-        ],
-      }],
-      ['use_tsan==1', {
-        'cflags': [
-          '-fsanitize=thread',
-          '-fno-omit-frame-pointer',
-        ],
-        'ldflags': [
-          '-fsanitize=thread',
-        ],
-        'defines': [
-          'THREAD_SANITIZER',
-        ],
-      }],
-    ],
-  }, # end of target_defaults
-}
diff --git a/src/starboard/linux/x64x11/cpp11/configuration_public.h b/src/starboard/linux/x64x11/cpp11/configuration_public.h
deleted file mode 100644
index 1c14924..0000000
--- a/src/starboard/linux/x64x11/cpp11/configuration_public.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// The Starboard configuration for Desktop X86 Linux. Other devices will have
-// specific Starboard implementations, even if they ultimately are running some
-// version of Linux.
-
-// Other source files should never include this header directly, but should
-// include the generic "starboard/configuration.h" instead.
-
-#ifndef STARBOARD_LINUX_X64X11_CPP11_CONFIGURATION_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_CPP11_CONFIGURATION_PUBLIC_H_
-
-#include "starboard/linux/x64x11/configuration_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_CPP11_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/linux/x64x11/cpp11/gyp_configuration.gypi b/src/starboard/linux/x64x11/cpp11/gyp_configuration.gypi
deleted file mode 100644
index fcc5747..0000000
--- a/src/starboard/linux/x64x11/cpp11/gyp_configuration.gypi
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2017 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-{
-  'variables': {
-    # This should have a default value in cobalt/base.gypi. See the comment
-    # there for acceptable values for this variable.
-    'javascript_engine': 'mozjs-45',
-    'cobalt_enable_jit': 1,
-  },
-  'target_defaults': {
-    'default_configuration': 'linux-x64x11-cpp11_debug',
-    'configurations': {
-      'linux-x64x11-cpp11_debug': {
-        'inherit_from': ['debug_base'],
-      },
-      'linux-x64x11-cpp11_devel': {
-        'inherit_from': ['devel_base'],
-      },
-      'linux-x64x11-cpp11_qa': {
-        'inherit_from': ['qa_base'],
-      },
-      'linux-x64x11-cpp11_gold': {
-        'inherit_from': ['gold_base'],
-      },
-    }, # end of configurations
-  },
-
-  'includes': [
-    'compiler_flags.gypi',
-    '../libraries.gypi',
-    '../../shared/gyp_configuration.gypi',
-  ],
-}
diff --git a/src/starboard/linux/x64x11/cpp11/gyp_configuration.py b/src/starboard/linux/x64x11/cpp11/gyp_configuration.py
deleted file mode 100644
index c5dab76..0000000
--- a/src/starboard/linux/x64x11/cpp11/gyp_configuration.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2017 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Starboard Linux X64 X11 platform configuration for gyp_cobalt."""
-
-import logging
-import os
-import sys
-
-# Import the shared Linux platform configuration.
-sys.path.append(
-    os.path.realpath(
-        os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
-                     'shared')))
-# pylint: disable=import-self,g-import-not-at-top
-import gyp_configuration
-
-
-def CreatePlatformConfig():
-  try:
-    return gyp_configuration.PlatformConfig('linux-x64x11-cpp11')
-  except RuntimeError as e:
-    logging.critical(e)
-    return None
diff --git a/src/starboard/linux/x64x11/cpp11/starboard_platform.gyp b/src/starboard/linux/x64x11/cpp11/starboard_platform.gyp
deleted file mode 100644
index 42b0bf5..0000000
--- a/src/starboard/linux/x64x11/cpp11/starboard_platform.gyp
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2017 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-{
-  'includes': [
-    '../starboard_platform.gypi'
-  ],
-  'targets': [
-    {
-      'target_name': 'starboard_platform',
-      'type': 'static_library',
-      'sources': ['<@(starboard_platform_sources)'],
-      'defines': [
-        # This must be defined when building Starboard, and must not when
-        # building Starboard client code.
-        'STARBOARD_IMPLEMENTATION',
-      ],
-      'dependencies': [
-        '<@(starboard_platform_dependencies)',
-      ],
-    },
-  ],
-}
diff --git a/src/starboard/linux/x64x11/directgles/gyp_configuration.gypi b/src/starboard/linux/x64x11/directgles/gyp_configuration.gypi
index 3cfea95..09f46da 100644
--- a/src/starboard/linux/x64x11/directgles/gyp_configuration.gypi
+++ b/src/starboard/linux/x64x11/directgles/gyp_configuration.gypi
@@ -15,33 +15,11 @@
 {
   'variables': {
     # Use the direct-to-GLES rasterizer.
-    # This rasterizer falls back to the hardware skia rasterizer in certain
-    # situations.
-    # NOTE: This rasterizer allocates offscreen render targets upfront,
-    # including a full screen scratch surface.
     'rasterizer_type': 'direct-gles',
 
-    # Accommodate the direct-to-GLES rasterizer's additional memory overhead
-    # by reducing the image cache size. This is only an issue when additional
-    # memory is required for video frames, so shrink the image cache size
-    # only during video playback.
-    'image_cache_capacity_multiplier_when_playing_video': '0.5f',
-
-    # This dictates how much GPU memory will be used for the offscreen render
-    # target atlases. One will be used as a cache and the other used as a
-    # working scratch. It is recommended to allot enough memory for two
-    # atlases that are roughly a quarter of the framebuffer. (The render
-    # target atlases use power-of-2 dimenions.) If the target web app frequently
-    # uses effects which require offscreen targets, then more memory should be
-    # reserved for optimal performance.
-    'surface_cache_size_in_bytes': 2 * (1024 * 512 * 4),
-
     # The rasterizer does not benefit much from rendering only the dirty
     # region. Disable this option since it costs GPU time.
     'render_dirty_region_only': 0,
-
-    # Map to mesh is not yet supported with the DirectGLES renderer.
-    'enable_map_to_mesh': 0,
   },
   'target_defaults': {
     'default_configuration': 'linux-x64x11-directgles_debug',
diff --git a/src/starboard/linux/x64x11/gcc/4.2/atomic_public.h b/src/starboard/linux/x64x11/gcc/4.2/atomic_public.h
deleted file mode 100644
index 2c0c554..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/atomic_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_LINUX_X64X11_GCC_4_2_ATOMIC_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_GCC_4_2_ATOMIC_PUBLIC_H_
-
-#include "starboard/linux/x64x11/atomic_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_GCC_4_2_ATOMIC_PUBLIC_H_
diff --git a/src/starboard/linux/x64x11/gcc/4.2/compiler_flags.gypi b/src/starboard/linux/x64x11/gcc/4.2/compiler_flags.gypi
deleted file mode 100644
index 49a5317..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/compiler_flags.gypi
+++ /dev/null
@@ -1,118 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Platform specific compiler flags for Linux on Starboard. Included from
-# gyp_configuration.gypi.
-#
-{
-  'variables': {
-    'compiler_flags_host': [
-      '-O2',
-    ],
-    'linker_flags': [
-    ],
-    'compiler_flags_cc_debug': [
-      '-frtti',
-    ],
-    'compiler_flags_debug': [
-      '-O0',
-    ],
-    'compiler_flags_cc_devel': [
-      '-frtti',
-    ],
-    'compiler_flags_devel': [
-      '-O2',
-    ],
-    'compiler_flags_cc_qa': [
-      '-O2',
-    ],
-    'compiler_flags_qa': [
-      '-O2',
-    ],
-    'compiler_flags_cc_gold': [
-      '-fno-rtti',
-    ],
-    'compiler_flags_gold': [
-      '-O2',
-    ],
-    'common_compiler_flags': [
-      # Default visibility to hidden, to enable dead stripping.
-      '-fvisibility=hidden',
-      # protobuf uses hash_map.
-      '-fno-exceptions',
-      # Don't warn about the "struct foo f = {0};" initialization pattern.
-      '-Wno-missing-field-initializers',
-      '-fno-strict-aliasing',  # See http://crbug.com/32204
-      # Don't warn about any conversions.
-      '-Wno-conversion',
-      # Don't warn about unreachable code. See
-      # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46158
-      '-Wno-unreachable-code',
-      '-Wno-deprecated-declarations',
-      # Disable warning:
-      # 'comparison is always true due to limited range of data type'
-      '-Wno-extra',
-      # Don't warn about inlining
-      '-Wno-inline',
-    ],
-    'conditions': [
-      ['cobalt_fastbuild==0', {
-        'compiler_flags_debug': [
-          '-g',
-        ],
-        'compiler_flags_devel': [
-          '-g',
-        ],
-        'compiler_flags_qa': [
-        ],
-        'compiler_flags_gold': [
-        ],
-      }],
-    ],
-  },
-
-  'target_defaults': {
-    'cflags': [
-      # Find the system headers
-      '-isystem /usr/include/x86_64-linux-gnu',
-    ],
-    'cflags_c': [
-      # Limit to C99. This allows Linux to be a canary build for any
-      # C11 features that are not supported on some platforms' compilers.
-      '-std=c99',
-    ],
-    'cflags_cc': [
-      '-std=gnu++98',
-      # Don't warn for invalid access to non-static data member of NULL object.
-      '-Wno-invalid-offsetof',
-      # Don't warn about deprecated use
-      '-Wno-deprecated',
-    ],
-    'target_conditions': [
-      ['sb_pedantic_warnings==1', {
-        'cflags': [
-          '-Wall',
-          '-Wextra',
-          '<@(common_compiler_flags)',
-        ],
-      },{
-        'cflags': [
-          '<@(common_compiler_flags)',
-          # Do not warn about unused function params.
-          '-Wno-unused-parameter',
-        ],
-      }],
-    ],
-  }, # end of target_defaults
-}
diff --git a/src/starboard/linux/x64x11/gcc/4.2/configuration_public.h b/src/starboard/linux/x64x11/gcc/4.2/configuration_public.h
deleted file mode 100644
index 7e1f9b1..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/configuration_public.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_LINUX_X64X11_GCC_4_2_CONFIGURATION_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_GCC_4_2_CONFIGURATION_PUBLIC_H_
-
-#include "starboard/linux/x64x11/configuration_public.h"
-
-// Indicates that there is no support for alignment at greater than 16 bytes for
-// items on the stack.
-#define SB_HAS_QUIRK_DOES_NOT_STACK_ALIGN_OVER_16_BYTES 1
-
-#endif  // STARBOARD_LINUX_X64X11_GCC_4_2_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/linux/x64x11/gcc/4.2/download_gcc.sh b/src/starboard/linux/x64x11/gcc/4.2/download_gcc.sh
deleted file mode 100755
index 6bb9c7d..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/download_gcc.sh
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/bin/bash
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This script downloads and compiles gcc version 4.2.4.
-
-# Note: This gcc version has a quadruplet 'x86_64-unknown-linux-gnu' instead
-# of the'x86_64-linux-gnu' triplet. As a result, the compiler flag
-# "-isystem /usr/include/x86_64-linux-gnu" must be used when any system
-# headers are needed.
-
-set -e
-
-toolchain_name="gcc"
-version="4.2.4"
-toolchain_folder="x86_64-linux-gnu-${toolchain_name}-${version}"
-
-binary_path="gcc/bin/g++"
-build_duration="about 10 minutes"
-
-source ../../toolchain_paths.sh
-
-(
-  texinfo_install_folder=${PWD}/"texinfo"
-  # Download and compile texinfo
-  if [ ! -f texinfo/bin/info ]; then
-    texinfo_version="texinfo-4.13"
-    wget -c https://ftp.gnu.org/gnu/texinfo/${texinfo_version}a.tar.gz
-    rm -rf texinfo ${texinfo_version}
-    tar -xzf ${texinfo_version}a.tar.gz
-    cd ${texinfo_version}/
-    ./configure --prefix=${texinfo_install_folder}
-    make -j"$(nproc)" && make install
-    cd ${toolchain_path}
-  fi
-  export PATH=${texinfo_install_folder}/bin:${PATH}
-
-  # Download gcc
-  if [ ! -e gcc-${version}/"README" ]; then
-    file="gcc-${version}.tar.bz2"
-    wget -c https://ftp.gnu.org/gnu/gcc/gcc-${version}/${file}
-    wget -c https://ftp.gnu.org/gnu/gcc/gcc-${version}/${file}.sig
-    wget -c https://ftp.gnu.org/gnu/gnu-keyring.gpg
-    signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg ${file}.sig`
-    if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi
-    rm -rf gcc-${version}
-    tar -xjf ${file}
-    cd gcc-${version}
-
-    if [ -f ./contrib/download_prerequisites ]; then
-      ./contrib/download_prerequisites
-    fi
-    cd ${toolchain_path}
-
-    # Replace 'struct siginfo' with 'siginfo_t' in linux-unwind.h (compilation fix).
-    sed -i 's:struct siginfo:siginfo_t:g' gcc-${version}/gcc/config/i386/linux-unwind.h
-
-    # Apply patch for "Bug 21706 - MAXPATHLEN usage in [gcc]/gcc/tlink.c"
-    # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21706
-    wget -c -O maxpathlen.patch https://gcc.gnu.org/bugzilla/attachment.cgi?id=16643
-    patch -d gcc-${version} -p0 <maxpathlen.patch
-  fi
-
-  # Create clean build folder for gcc
-  rm -rf gcc gcc-${version}-build
-  mkdir gcc-${version}-build
-  cd gcc-${version}-build
-
-  export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
-  export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
-
-  gcc_install_folder=$(realpath ${PWD}/"..")/"gcc"
-  # Configure gcc for installation into ${gcc_install_folder}
-  ${toolchain_path}/gcc-${version}/configure \
-    --prefix=${gcc_install_folder} \
-    --disable-multilib \
-    --enable-languages="c,c++"
-
-  LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/usr/lib32
-  export LIBRARY_PATH
-
-  # Build and 'install' gcc
-  make -j"$(nproc)" && make install
-  cd ${toolchain_path}
-
-  ls -l ${toolchain_binary}
-  ${toolchain_binary} --version
-) >${logfile} 2>&1
diff --git a/src/starboard/linux/x64x11/gcc/4.2/gyp_configuration.gypi b/src/starboard/linux/x64x11/gcc/4.2/gyp_configuration.gypi
deleted file mode 100644
index b8a22da..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/gyp_configuration.gypi
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-{
-  'variables': {
-    # This should have a default value in cobalt/base.gypi. See the comment
-    # there for acceptable values for this variable.
-    'javascript_engine': 'mozjs',
-    'cobalt_enable_jit': 1,
-  },
-  'target_defaults': {
-    'default_configuration': 'linux-x64x11-gcc-4-2_debug',
-    'configurations': {
-      'linux-x64x11-gcc-4-2_debug': {
-        'inherit_from': ['debug_base'],
-      },
-      'linux-x64x11-gcc-4-2_devel': {
-        'inherit_from': ['devel_base'],
-      },
-      'linux-x64x11-gcc-4-2_qa': {
-        'inherit_from': ['qa_base'],
-      },
-      'linux-x64x11-gcc-4-2_gold': {
-        'inherit_from': ['gold_base'],
-      },
-    }, # end of configurations
-  },
-
-  'includes': [
-    'compiler_flags.gypi',
-    '../gyp_configuration.gypi',
-  ],
-}
diff --git a/src/starboard/linux/x64x11/gcc/4.2/gyp_configuration.py b/src/starboard/linux/x64x11/gcc/4.2/gyp_configuration.py
deleted file mode 100644
index 48bc725..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/gyp_configuration.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Starboard Linux X64 X11 gcc 4.2 platform configuration for gyp_cobalt."""
-
-import logging
-import os
-import subprocess
-import sys
-
-# Import the shared Linux platform configuration.
-sys.path.append(
-    os.path.realpath(
-        os.path.join(
-            os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
-            'shared')))
-# pylint: disable=import-self,g-import-not-at-top
-import gyp_configuration as shared_configuration
-import gyp_utils
-
-
-class PlatformConfig(shared_configuration.PlatformConfig):
-  """Starboard Linux platform configuration."""
-
-  def __init__(self, platform, asan_enabled_by_default=False):
-    super(PlatformConfig, self).__init__(
-        platform, asan_enabled_by_default, goma_supports_compiler=False)
-
-    # Run the script that ensures gcc 4.2.4 is installed.
-    script_path = os.path.dirname(os.path.realpath(__file__))
-    subprocess.call(
-        os.path.join(script_path, 'download_gcc.sh'), cwd=script_path)
-
-  def GetVariables(self, configuration):
-    variables = super(PlatformConfig, self).GetVariables(configuration)
-    variables.update({'clang': 0,})
-    return variables
-
-  def GetEnvironmentVariables(self):
-    env_variables = super(PlatformConfig, self).GetEnvironmentVariables()
-    toolchain_bin_dir = os.path.join(gyp_utils.GetToolchainsDir(),
-                                     'x86_64-linux-gnu-gcc-4.2.4', 'gcc', 'bin')
-    env_variables.update({
-        'LIBRARY_PATH':
-            '/usr/lib/x86_64-linux-gnu',
-        'CC':
-            os.path.join(toolchain_bin_dir, 'gcc'),
-        'CXX':
-            'LIBRARY_PATH=/usr/lib/x86_64-linux-gnu ' + os.path.join(
-                toolchain_bin_dir, 'g++'),
-    })
-    return env_variables
-
-
-def CreatePlatformConfig():
-  try:
-    return PlatformConfig('linux-x64x11-gcc-4-2')
-  except RuntimeError as e:
-    logging.critical(e)
-    return None
diff --git a/src/starboard/linux/x64x11/gcc/4.2/thread_types_public.h b/src/starboard/linux/x64x11/gcc/4.2/thread_types_public.h
deleted file mode 100644
index abf5a97..0000000
--- a/src/starboard/linux/x64x11/gcc/4.2/thread_types_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_LINUX_X64X11_GCC_4_2_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_GCC_4_2_THREAD_TYPES_PUBLIC_H_
-
-#include "starboard/linux/x64x11/thread_types_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_GCC_4_2_THREAD_TYPES_PUBLIC_H_
diff --git a/src/starboard/linux/x64x11/gcc/4.4/atomic_public.h b/src/starboard/linux/x64x11/gcc/4.4/atomic_public.h
deleted file mode 100644
index e4a65cc..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/atomic_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_LINUX_X64X11_GCC_4_4_ATOMIC_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_GCC_4_4_ATOMIC_PUBLIC_H_
-
-#include "starboard/linux/x64x11/atomic_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_GCC_4_4_ATOMIC_PUBLIC_H_
diff --git a/src/starboard/linux/x64x11/gcc/4.4/compiler_flags.gypi b/src/starboard/linux/x64x11/gcc/4.4/compiler_flags.gypi
deleted file mode 100644
index 7c5b9c9..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/compiler_flags.gypi
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Platform specific compiler flags for Linux on Starboard. Included from
-# gyp_configuration.gypi.
-#
-{
-  'variables': {
-    'compiler_flags_host': [
-      '-O2',
-    ],
-    'linker_flags': [
-    ],
-    'compiler_flags_cc_debug': [
-      '-frtti',
-    ],
-    'compiler_flags_debug': [
-      '-O0',
-    ],
-    'compiler_flags_cc_devel': [
-      '-frtti',
-    ],
-    'compiler_flags_devel': [
-      '-O2',
-    ],
-    'compiler_flags_cc_qa': [
-      '-fno-rtti',
-    ],
-    'compiler_flags_qa': [
-      '-O2',
-    ],
-    'compiler_flags_cc_gold': [
-      '-fno-rtti',
-    ],
-    'compiler_flags_gold': [
-      '-O2',
-    ],
-    'common_compiler_flags': [
-      # Default visibility to hidden, to enable dead stripping.
-      '-fvisibility=hidden',
-      # protobuf uses hash_map.
-      '-fno-exceptions',
-      # Don't warn about the "struct foo f = {0};" initialization pattern.
-      '-Wno-missing-field-initializers',
-      '-fno-strict-aliasing',  # See http://crbug.com/32204
-      # Don't warn about any conversions.
-      '-Wno-conversion',
-      # Don't warn about unreachable code. See
-      # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46158
-      '-Wno-unreachable-code',
-      '-Wno-deprecated-declarations',
-      # Disable warning:
-      # 'comparison is always true due to limited range of data type'
-      '-Wno-extra',
-      # Don't warn about inlining
-      '-Wno-inline',
-    ],
-    'conditions': [
-      ['cobalt_fastbuild==0', {
-        'compiler_flags_debug': [
-          '-g',
-        ],
-        'compiler_flags_devel': [
-          '-g',
-        ],
-        'compiler_flags_qa': [
-        ],
-        'compiler_flags_gold': [
-        ],
-      }],
-    ],
-  },
-
-  'target_defaults': {
-    'cflags_c': [
-      # Limit to C99. This allows Linux to be a canary build for any
-      # C11 features that are not supported on some platforms' compilers.
-      '-std=c99',
-    ],
-    'cflags_cc': [
-      '-std=gnu++98',
-      # Don't warn for invalid access to non-static data member of NULL object.
-      '-Wno-invalid-offsetof',
-      # Don't warn about deprecated use
-      '-Wno-deprecated',
-    ],
-    'target_conditions': [
-      ['sb_pedantic_warnings==1', {
-        'cflags': [
-          '-Wall',
-          '-Wextra',
-          '<@(common_compiler_flags)',
-        ],
-      },{
-        'cflags': [
-          '<@(common_compiler_flags)',
-          # Do not warn about unused function params.
-          '-Wno-unused-parameter',
-        ],
-      }],
-    ],
-  }, # end of target_defaults
-}
diff --git a/src/starboard/linux/x64x11/gcc/4.4/configuration_public.h b/src/starboard/linux/x64x11/gcc/4.4/configuration_public.h
deleted file mode 100644
index bd403d2..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/configuration_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_LINUX_X64X11_GCC_4_4_CONFIGURATION_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_GCC_4_4_CONFIGURATION_PUBLIC_H_
-
-#include "starboard/linux/x64x11/configuration_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_GCC_4_4_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/linux/x64x11/gcc/4.4/gyp_configuration.gypi b/src/starboard/linux/x64x11/gcc/4.4/gyp_configuration.gypi
deleted file mode 100644
index 322ade0..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/gyp_configuration.gypi
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-{
-  'variables': {
-    # This should have a default value in cobalt/base.gypi. See the comment
-    # there for acceptable values for this variable.
-    'javascript_engine': 'mozjs',
-    'cobalt_enable_jit': 1,
-  },
-  'target_defaults': {
-    'default_configuration': 'linux-x64x11-gcc-4-4_debug',
-    'configurations': {
-      'linux-x64x11-gcc-4-4_debug': {
-        'inherit_from': ['debug_base'],
-      },
-      'linux-x64x11-gcc-4-4_devel': {
-        'inherit_from': ['devel_base'],
-      },
-      'linux-x64x11-gcc-4-4_qa': {
-        'inherit_from': ['qa_base'],
-      },
-      'linux-x64x11-gcc-4-4_gold': {
-        'inherit_from': ['gold_base'],
-      },
-    }, # end of configurations
-  },
-
-  'includes': [
-    'compiler_flags.gypi',
-    '../gyp_configuration.gypi',
-  ],
-}
diff --git a/src/starboard/linux/x64x11/gcc/4.4/gyp_configuration.py b/src/starboard/linux/x64x11/gcc/4.4/gyp_configuration.py
deleted file mode 100644
index 3d6e006..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/gyp_configuration.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Starboard Linux X64 X11 gcc 4.4 platform configuration for gyp_cobalt."""
-
-import logging
-import os
-import sys
-
-# Import the shared Linux platform configuration.
-sys.path.append(
-    os.path.realpath(
-        os.path.join(
-            os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
-            'shared')))
-# pylint: disable=import-self,g-import-not-at-top
-import gyp_configuration as shared_configuration
-
-
-class PlatformConfig(shared_configuration.PlatformConfig):
-  """Starboard Linux platform configuration."""
-
-  def __init__(self, platform, asan_enabled_by_default=False):
-    super(PlatformConfig, self).__init__(
-        platform, asan_enabled_by_default, goma_supports_compiler=False)
-
-  def GetVariables(self, configuration):
-    variables = super(PlatformConfig, self).GetVariables(configuration)
-    variables.update({'clang': 0,})
-    return variables
-
-  def GetEnvironmentVariables(self):
-    env_variables = super(PlatformConfig, self).GetEnvironmentVariables()
-    env_variables.update({
-        'CC': 'gcc-4.4',
-        'CXX': 'g++-4.4',
-    })
-    return env_variables
-
-
-def CreatePlatformConfig():
-  try:
-    return PlatformConfig('linux-x64x11-gcc-4-4')
-  except RuntimeError as e:
-    logging.critical(e)
-    return None
diff --git a/src/starboard/linux/x64x11/gcc/4.4/starboard_platform.gyp b/src/starboard/linux/x64x11/gcc/4.4/starboard_platform.gyp
deleted file mode 100644
index 71a6d38..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/starboard_platform.gyp
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-{
-  'includes': [
-    '../starboard_platform.gyp',
-  ],
-}
diff --git a/src/starboard/linux/x64x11/gcc/4.4/thread_types_public.h b/src/starboard/linux/x64x11/gcc/4.4/thread_types_public.h
deleted file mode 100644
index 164a9a8..0000000
--- a/src/starboard/linux/x64x11/gcc/4.4/thread_types_public.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef STARBOARD_LINUX_X64X11_GCC_4_4_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_GCC_4_4_THREAD_TYPES_PUBLIC_H_
-
-#include "starboard/linux/x64x11/thread_types_public.h"
-
-#endif  // STARBOARD_LINUX_X64X11_GCC_4_4_THREAD_TYPES_PUBLIC_H_
diff --git a/src/starboard/raspi/2/directgles/gyp_configuration.gypi b/src/starboard/raspi/2/directgles/gyp_configuration.gypi
index 98d9129..fdac07a 100644
--- a/src/starboard/raspi/2/directgles/gyp_configuration.gypi
+++ b/src/starboard/raspi/2/directgles/gyp_configuration.gypi
@@ -15,27 +15,8 @@
 {
   'variables': {
     # Use the direct-to-GLES rasterizer.
-    # This rasterizer falls back to the hardware skia rasterizer in certain
-    # situations.
-    # NOTE: This rasterizer allocates offscreen render targets upfront,
-    # including a full screen scratch surface.
     'rasterizer_type': 'direct-gles',
 
-    # Accommodate the direct-to-GLES rasterizer's additional memory overhead
-    # by reducing the image cache size. This is only an issue when additional
-    # memory is required for video frames, so shrink the image cache size
-    # only during video playback.
-    'image_cache_capacity_multiplier_when_playing_video': '0.5f',
-
-    # This dictates how much GPU memory will be used for the offscreen render
-    # target atlases. One will be used as a cache and the other used as a
-    # working scratch. It is recommended to allot enough memory for two
-    # atlases that are roughly a quarter of the framebuffer. (The render
-    # target atlases use power-of-2 dimenions.) If the target web app frequently
-    # uses effects which require offscreen targets, then more memory should be
-    # reserved for optimal performance.
-    'surface_cache_size_in_bytes': 2 * (1024 * 512 * 4),
-
     # The rasterizer does not benefit much from rendering only the dirty
     # region. Disable this option since it costs GPU time.
     'render_dirty_region_only': 0,
diff --git a/src/starboard/shared/ffmpeg/ffmpeg_video_decoder.cc b/src/starboard/shared/ffmpeg/ffmpeg_video_decoder.cc
index 111d974..98a8680 100644
--- a/src/starboard/shared/ffmpeg/ffmpeg_video_decoder.cc
+++ b/src/starboard/shared/ffmpeg/ffmpeg_video_decoder.cc
@@ -366,6 +366,12 @@
   SB_UNREFERENCED_PARAMETER(codec);
   SB_UNREFERENCED_PARAMETER(drm_system);
 
+#if defined(SB_FORCE_DECODE_TO_TEXTURE_ONLY)
+  // Starboard lib targets may not draw directly to the window, so punch through
+  // video is not made available.
+  return output_mode == kSbPlayerOutputModeDecodeToTexture;
+#endif  // defined(SB_FORCE_DECODE_TO_TEXTURE_ONLY)
+
   if (output_mode == kSbPlayerOutputModePunchOut ||
       output_mode == kSbPlayerOutputModeDecodeToTexture) {
     return true;
diff --git a/src/starboard/shared/libvpx/vpx_video_decoder.cc b/src/starboard/shared/libvpx/vpx_video_decoder.cc
new file mode 100644
index 0000000..14727f9
--- /dev/null
+++ b/src/starboard/shared/libvpx/vpx_video_decoder.cc
@@ -0,0 +1,264 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "starboard/shared/libvpx/vpx_video_decoder.h"
+
+#include "starboard/linux/shared/decode_target_internal.h"
+#include "starboard/thread.h"
+
+namespace starboard {
+namespace shared {
+namespace vpx {
+
+VideoDecoder::VideoDecoder(SbMediaVideoCodec video_codec,
+                           SbPlayerOutputMode output_mode,
+                           SbDecodeTargetGraphicsContextProvider*
+                               decode_target_graphics_context_provider)
+    : host_(NULL),
+      current_frame_width_(0),
+      current_frame_height_(0),
+      stream_ended_(false),
+      error_occured_(false),
+      decoder_thread_(kSbThreadInvalid),
+      output_mode_(output_mode),
+      decode_target_graphics_context_provider_(
+          decode_target_graphics_context_provider),
+      decode_target_(kSbDecodeTargetInvalid) {
+  SB_DCHECK(video_codec == kSbMediaVideoCodecVp9);
+}
+
+VideoDecoder::~VideoDecoder() {
+  Reset();
+  TeardownCodec();
+}
+
+void VideoDecoder::SetHost(Host* host) {
+  SB_DCHECK(host != NULL);
+  SB_DCHECK(host_ == NULL);
+  host_ = host;
+}
+
+void VideoDecoder::WriteInputBuffer(const InputBuffer& input_buffer) {
+  SB_DCHECK(queue_.Poll().type == kInvalid);
+  SB_DCHECK(host_ != NULL);
+
+  if (stream_ended_) {
+    SB_LOG(ERROR) << "WriteInputFrame() was called after WriteEndOfStream().";
+    return;
+  }
+
+  if (!SbThreadIsValid(decoder_thread_)) {
+    decoder_thread_ =
+        SbThreadCreate(0, kSbThreadPriorityHigh, kSbThreadNoAffinity, true,
+                       "vp9_video_dec", &VideoDecoder::ThreadEntryPoint, this);
+    SB_DCHECK(SbThreadIsValid(decoder_thread_));
+  }
+
+  queue_.Put(Event(input_buffer));
+}
+
+void VideoDecoder::WriteEndOfStream() {
+  SB_DCHECK(host_ != NULL);
+
+  // We have to flush the decoder to decode the rest frames and to ensure that
+  // Decode() is not called when the stream is ended.
+  stream_ended_ = true;
+  queue_.Put(Event(kWriteEndOfStream));
+}
+
+void VideoDecoder::Reset() {
+  // Join the thread to ensure that all callbacks in process are finished.
+  if (SbThreadIsValid(decoder_thread_)) {
+    queue_.Put(Event(kReset));
+    SbThreadJoin(decoder_thread_, NULL);
+  }
+
+  decoder_thread_ = kSbThreadInvalid;
+  error_occured_ = false;
+  stream_ended_ = false;
+
+  TeardownCodec();
+}
+
+// static
+void* VideoDecoder::ThreadEntryPoint(void* context) {
+  SB_DCHECK(context);
+  VideoDecoder* decoder = reinterpret_cast<VideoDecoder*>(context);
+  decoder->DecoderThreadFunc();
+  return NULL;
+}
+
+void VideoDecoder::DecoderThreadFunc() {
+  for (;;) {
+    Event event = queue_.Get();
+    if (event.type == kReset) {
+      return;
+    }
+    if (error_occured_) {
+      continue;
+    }
+    if (event.type == kWriteInputBuffer) {
+      DecodeOneBuffer(event.input_buffer);
+    } else {
+      SB_DCHECK(event.type == kWriteEndOfStream);
+      // TODO: Flush the frames inside the decoder, though this is not required
+      //       for vp9 in most cases.
+      host_->OnDecoderStatusUpdate(kBufferFull, VideoFrame::CreateEOSFrame());
+    }
+  }
+}
+
+bool VideoDecoder::UpdateDecodeTarget(const scoped_refptr<VideoFrame>& frame) {
+  SbDecodeTarget decode_target = DecodeTargetCreate(
+      decode_target_graphics_context_provider_, frame, decode_target_);
+
+  // Lock only after the post to the renderer thread, to prevent deadlock.
+  ScopedLock lock(decode_target_mutex_);
+  decode_target_ = decode_target;
+
+  if (!SbDecodeTargetIsValid(decode_target)) {
+    SB_LOG(ERROR) << "Could not acquire a decode target from provider.";
+    return false;
+  }
+
+  return true;
+}
+
+void VideoDecoder::ReportError() {
+  error_occured_ = true;
+  host_->OnDecoderStatusUpdate(kFatalError, NULL);
+}
+
+void VideoDecoder::InitializeCodec() {
+  context_.reset(new vpx_codec_ctx);
+  vpx_codec_dec_cfg_t vpx_config = {0};
+  vpx_config.w = current_frame_width_;
+  vpx_config.h = current_frame_height_;
+  vpx_config.threads = 8;
+
+  vpx_codec_err_t status =
+      vpx_codec_dec_init(context_.get(), vpx_codec_vp9_dx(), &vpx_config, 0);
+  if (status != VPX_CODEC_OK) {
+    ReportError();
+    context_.reset();
+  }
+}
+
+void VideoDecoder::TeardownCodec() {
+  if (context_) {
+    vpx_codec_destroy(context_.get());
+    context_.reset();
+  }
+
+  if (output_mode_ == kSbPlayerOutputModeDecodeToTexture) {
+    ScopedLock lock(decode_target_mutex_);
+    if (SbDecodeTargetIsValid(decode_target_)) {
+      DecodeTargetRelease(decode_target_graphics_context_provider_,
+                          decode_target_);
+      decode_target_ = kSbDecodeTargetInvalid;
+    }
+  }
+}
+
+void VideoDecoder::DecodeOneBuffer(const InputBuffer& input_buffer) {
+  const SbMediaVideoSampleInfo* sample_info = input_buffer.video_sample_info();
+  SB_DCHECK(sample_info);
+  if (!context_ || sample_info->frame_width != current_frame_width_ ||
+      sample_info->frame_height != current_frame_height_) {
+    current_frame_width_ = sample_info->frame_width;
+    current_frame_height_ = sample_info->frame_height;
+    TeardownCodec();
+    InitializeCodec();
+  }
+
+  SB_DCHECK(context_);
+
+  SbMediaTime pts = input_buffer.pts();
+  vpx_codec_err_t status = vpx_codec_decode(context_.get(), input_buffer.data(),
+                                            input_buffer.size(), &pts, 0);
+  if (status != VPX_CODEC_OK) {
+    SB_DLOG(ERROR) << "vpx_codec_decode() failed, status=" << status;
+    ReportError();
+    return;
+  }
+
+  // Gets pointer to decoded data.
+  vpx_codec_iter_t dummy = NULL;
+  const vpx_image_t* vpx_image = vpx_codec_get_frame(context_.get(), &dummy);
+  if (!vpx_image) {
+    return;
+  }
+
+  if (vpx_image->user_priv != &pts) {
+    SB_DLOG(ERROR) << "Invalid output timestamp.";
+    ReportError();
+    return;
+  }
+
+  if (vpx_image->fmt != VPX_IMG_FMT_YV12) {
+    SB_DCHECK(vpx_image->fmt == VPX_IMG_FMT_I420)
+        << "Invalid vpx_image->fmt: " << vpx_image->fmt;
+    if (vpx_image->fmt != VPX_IMG_FMT_I420) {
+      ReportError();
+      return;
+    }
+  }
+
+  SB_DCHECK(vpx_image->stride[VPX_PLANE_Y] ==
+            vpx_image->stride[VPX_PLANE_U] * 2);
+  SB_DCHECK(vpx_image->stride[VPX_PLANE_U] == vpx_image->stride[VPX_PLANE_V]);
+  SB_DCHECK(vpx_image->planes[VPX_PLANE_Y] < vpx_image->planes[VPX_PLANE_U]);
+  SB_DCHECK(vpx_image->planes[VPX_PLANE_U] < vpx_image->planes[VPX_PLANE_V]);
+
+  if (vpx_image->stride[VPX_PLANE_Y] != vpx_image->stride[VPX_PLANE_U] * 2 ||
+      vpx_image->stride[VPX_PLANE_U] != vpx_image->stride[VPX_PLANE_V] ||
+      vpx_image->planes[VPX_PLANE_Y] >= vpx_image->planes[VPX_PLANE_U] ||
+      vpx_image->planes[VPX_PLANE_U] >= vpx_image->planes[VPX_PLANE_V]) {
+    ReportError();
+    return;
+  }
+
+  // Create a VideoFrame from decoded frame data. The data is in YV12 format.
+  // Each component of a pixel takes one byte and they are in their own planes.
+  // UV planes have half resolution both vertically and horizontally.
+  scoped_refptr<VideoFrame> frame = VideoFrame::CreateYV12Frame(
+      current_frame_width_, current_frame_height_,
+      vpx_image->stride[VPX_PLANE_Y], pts, vpx_image->planes[VPX_PLANE_Y],
+      vpx_image->planes[VPX_PLANE_U], vpx_image->planes[VPX_PLANE_V]);
+  host_->OnDecoderStatusUpdate(kNeedMoreInput, frame);
+
+  if (output_mode_ == kSbPlayerOutputModeDecodeToTexture) {
+    UpdateDecodeTarget(frame);
+  }
+}
+
+// When in decode-to-texture mode, this returns the current decoded video frame.
+SbDecodeTarget VideoDecoder::GetCurrentDecodeTarget() {
+  SB_DCHECK(output_mode_ == kSbPlayerOutputModeDecodeToTexture);
+
+  // We must take a lock here since this function can be called from a
+  // separate thread.
+  ScopedLock lock(decode_target_mutex_);
+  if (SbDecodeTargetIsValid(decode_target_)) {
+    // Make a disposable copy, since the state is internally reused by this
+    // class (to avoid recreating GL objects).
+    return DecodeTargetCopy(decode_target_);
+  } else {
+    return kSbDecodeTargetInvalid;
+  }
+}
+
+}  // namespace vpx
+}  // namespace shared
+}  // namespace starboard
diff --git a/src/starboard/shared/libvpx/vpx_video_decoder.h b/src/starboard/shared/libvpx/vpx_video_decoder.h
new file mode 100644
index 0000000..50b39ce
--- /dev/null
+++ b/src/starboard/shared/libvpx/vpx_video_decoder.h
@@ -0,0 +1,125 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef STARBOARD_SHARED_LIBVPX_VPX_VIDEO_DECODER_H_
+#define STARBOARD_SHARED_LIBVPX_VPX_VIDEO_DECODER_H_
+
+#include "starboard/log.h"
+#include "starboard/media.h"
+#include "starboard/queue.h"
+#include "starboard/shared/internal_only.h"
+#include "starboard/shared/starboard/player/filter/video_decoder_internal.h"
+#include "starboard/shared/starboard/player/input_buffer_internal.h"
+#include "starboard/shared/starboard/player/video_frame_internal.h"
+#include "starboard/thread.h"
+
+#define VPX_CODEC_DISABLE_COMPAT 1
+#include "third_party/libvpx/vpx/vp8dx.h"
+#include "third_party/libvpx/vpx/vpx_decoder.h"
+
+namespace starboard {
+namespace shared {
+namespace vpx {
+
+class VideoDecoder : public starboard::player::filter::HostedVideoDecoder {
+ public:
+  typedef starboard::player::InputBuffer InputBuffer;
+  typedef starboard::player::VideoFrame VideoFrame;
+
+  VideoDecoder(SbMediaVideoCodec video_codec,
+               SbPlayerOutputMode output_mode,
+               SbDecodeTargetGraphicsContextProvider*
+                   decode_target_graphics_context_provider);
+  ~VideoDecoder() SB_OVERRIDE;
+
+  void SetHost(Host* host) SB_OVERRIDE;
+  void WriteInputBuffer(const InputBuffer& input_buffer) SB_OVERRIDE;
+  void WriteEndOfStream() SB_OVERRIDE;
+  void Reset() SB_OVERRIDE;
+
+ private:
+  enum EventType {
+    kInvalid,
+    kReset,
+    kWriteInputBuffer,
+    kWriteEndOfStream,
+  };
+
+  struct Event {
+    EventType type;
+    // |input_buffer| is only used when |type| is kWriteInputBuffer.
+    InputBuffer input_buffer;
+
+    explicit Event(EventType type = kInvalid) : type(type) {
+      SB_DCHECK(type != kWriteInputBuffer);
+    }
+
+    explicit Event(InputBuffer input_buffer)
+        : type(kWriteInputBuffer), input_buffer(input_buffer) {}
+  };
+
+  static void* ThreadEntryPoint(void* context);
+  void DecoderThreadFunc();
+
+  void ReportError();
+
+  // The following three functions are only called on the decoder thread except
+  // that TeardownCodec() can also be called on other threads when the decoder
+  // thread is not running.
+  void InitializeCodec();
+  void TeardownCodec();
+  void DecodeOneBuffer(const InputBuffer& input_buffer);
+
+  SbDecodeTarget GetCurrentDecodeTarget() SB_OVERRIDE;
+
+  bool UpdateDecodeTarget(const scoped_refptr<VideoFrame>& frame);
+
+  // |host_| will be initialized inside SetHost() and will not be changed during
+  // the life time of this class.
+  Host* host_;
+
+  Queue<Event> queue_;
+
+  int current_frame_width_;
+  int current_frame_height_;
+  scoped_ptr<vpx_codec_ctx> context_;
+
+  bool stream_ended_;
+  bool error_occured_;
+
+  // Working thread to avoid lengthy decoding work block the player thread.
+  SbThread decoder_thread_;
+
+  // Decode-to-texture related state.
+  SbPlayerOutputMode output_mode_;
+
+  SbDecodeTargetGraphicsContextProvider*
+      decode_target_graphics_context_provider_;
+
+  // If decode-to-texture is enabled, then we store the decode target texture
+  // inside of this |decode_target_| member.
+  SbDecodeTarget decode_target_;
+
+  // GetCurrentDecodeTarget() needs to be called from an arbitrary thread
+  // to obtain the current decode target (which ultimately ends up being a
+  // copy of |decode_target_|), we need to safe-guard access to |decode_target_|
+  // and we do so through this mutex.
+  Mutex decode_target_mutex_;
+};
+
+}  // namespace vpx
+}  // namespace shared
+}  // namespace starboard
+
+#endif  // STARBOARD_SHARED_LIBVPX_VPX_VIDEO_DECODER_H_
diff --git a/src/starboard/shared/nouser/user_get_property.cc b/src/starboard/shared/nouser/user_get_property.cc
index 98c7c12..a146df3 100644
--- a/src/starboard/shared/nouser/user_get_property.cc
+++ b/src/starboard/shared/nouser/user_get_property.cc
@@ -24,10 +24,10 @@
 
   switch (property_id) {
     case kSbUserPropertyUserName:
-      return SbStringGetLength(user->name) + 1;
+      return static_cast<int>(SbStringGetLength(user->name) + 1);
 
     case kSbUserPropertyUserId:
-      return SbStringGetLength(user->id) + 1;
+      return static_cast<int>(SbStringGetLength(user->id) + 1);
 
     case kSbUserPropertyHomeDirectory: {
       char path[SB_FILE_MAX_PATH];
@@ -35,7 +35,7 @@
               user, path, SB_ARRAY_SIZE_INT(path))) {
         return 0;
       }
-      return SbStringGetLength(path);
+      return static_cast<int>(SbStringGetLength(path));
     }
 
     case kSbUserPropertyAvatarUrl:
diff --git a/src/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc b/src/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc
index a34477e..597820a 100644
--- a/src/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc
+++ b/src/starboard/shared/starboard/audio_sink/stub_audio_sink_type.cc
@@ -39,6 +39,7 @@
   bool IsType(Type* type) SB_OVERRIDE { return type_ == type; }
 #if SB_API_VERSION >= 4
   void SetPlaybackRate(double playback_rate) SB_OVERRIDE {
+    SB_UNREFERENCED_PARAMETER(playback_rate);
     SB_NOTIMPLEMENTED();
   }
 #endif  // SB_API_VERSION >= 4
@@ -135,6 +136,12 @@
     SbAudioSinkUpdateSourceStatusFunc update_source_status_func,
     SbAudioSinkConsumeFramesFunc consume_frames_func,
     void* context) {
+  SB_UNREFERENCED_PARAMETER(audio_frame_storage_type);
+  SB_UNREFERENCED_PARAMETER(audio_sample_type);
+  SB_UNREFERENCED_PARAMETER(channels);
+  SB_UNREFERENCED_PARAMETER(frame_buffers_size_in_frames);
+  SB_UNREFERENCED_PARAMETER(frame_buffers);
+
   return new StubAudioSink(this, sampling_frequency_hz,
                            update_source_status_func, consume_frames_func,
                            context);
diff --git a/src/starboard/shared/starboard/command_line.cc b/src/starboard/shared/starboard/command_line.cc
index f4a8459..5a93b7b 100644
--- a/src/starboard/shared/starboard/command_line.cc
+++ b/src/starboard/shared/starboard/command_line.cc
@@ -68,7 +68,6 @@
     CommandLine::StringType arg = argv[i];
 
     // Begin inlined TrimWhitespace TRIM_ALL from base/string_util.cc
-    CommandLine::StringType::size_type last_char = arg.length() - 1;
     CommandLine::StringType::size_type first_good_char =
         arg.find_first_not_of(kWhitespaceASCII);
     CommandLine::StringType::size_type last_good_char =
@@ -170,6 +169,7 @@
 
 void CommandLine::AppendArguments(const CommandLine& other,
                                   bool include_program) {
+  SB_UNREFERENCED_PARAMETER(include_program);
   AppendSwitchesAndArguments(*this, other.argv());
 }
 
diff --git a/src/starboard/shared/starboard/file_storage/storage_read_record.cc b/src/starboard/shared/starboard/file_storage/storage_read_record.cc
index 46d06d7..a70f386 100644
--- a/src/starboard/shared/starboard/file_storage/storage_read_record.cc
+++ b/src/starboard/shared/starboard/file_storage/storage_read_record.cc
@@ -12,9 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "starboard/storage.h"
+
+#include <algorithm>
+
 #include "starboard/log.h"
 #include "starboard/shared/starboard/file_storage/storage_internal.h"
-#include "starboard/storage.h"
 #include "starboard/string.h"
 #include "starboard/user.h"
 
@@ -38,7 +41,9 @@
   char* destination = out_data;
   int64_t to_read = total;
   while (to_read > 0) {
-    int64_t bytes_read = SbFileRead(record->file, destination, to_read);
+    int to_read_max =
+        static_cast<int>(std::min(to_read, static_cast<int64_t>(kSbInt32Max)));
+    int bytes_read = SbFileRead(record->file, destination, to_read_max);
     if (bytes_read < 0) {
       return -1;
     }
diff --git a/src/starboard/shared/starboard/file_storage/storage_write_record.cc b/src/starboard/shared/starboard/file_storage/storage_write_record.cc
index f6fa234..d47d6e6 100644
--- a/src/starboard/shared/starboard/file_storage/storage_write_record.cc
+++ b/src/starboard/shared/starboard/file_storage/storage_write_record.cc
@@ -14,6 +14,8 @@
 
 #include "starboard/storage.h"
 
+#include <algorithm>
+
 #include "starboard/file.h"
 #include "starboard/shared/starboard/file_storage/storage_internal.h"
 
@@ -34,7 +36,9 @@
   const char* source = data;
   int64_t to_write = data_size;
   while (to_write > 0) {
-    int64_t bytes_written = SbFileWrite(record->file, source, to_write);
+    int to_write_max =
+        static_cast<int>(std::min(to_write, static_cast<int64_t>(kSbInt32Max)));
+    int bytes_written = SbFileWrite(record->file, source, to_write_max);
     if (bytes_written < 0) {
       SbFileTruncate(record->file, 0);
       return false;
diff --git a/src/starboard/shared/starboard/localized_strings.cc b/src/starboard/shared/starboard/localized_strings.cc
index 0f802e6..e25e5af 100644
--- a/src/starboard/shared/starboard/localized_strings.cc
+++ b/src/starboard/shared/starboard/localized_strings.cc
@@ -14,9 +14,12 @@
 
 #include "starboard/shared/starboard/localized_strings.h"
 
+#include <algorithm>
+
 #include "starboard/file.h"
 #include "starboard/log.h"
 #include "starboard/system.h"
+#include "starboard/types.h"
 
 namespace starboard {
 namespace shared {
@@ -64,10 +67,12 @@
 
   char* buffer = new char[file_info.size];
   SB_DCHECK(buffer);
-  int bytes_to_read = file_info.size;
+  int64_t bytes_to_read = file_info.size;
   char* buffer_pos = buffer;
   while (bytes_to_read > 0) {
-    int bytes_read = file.Read(buffer_pos, bytes_to_read);
+    int max_bytes_to_read = static_cast<int>(
+        std::min(static_cast<int64_t>(kSbInt32Min), bytes_to_read));
+    int bytes_read = file.Read(buffer_pos, max_bytes_to_read);
     if (bytes_read < 0) {
       SB_DLOG(ERROR) << "Read from i18n file failed.";
       delete[] buffer;
diff --git a/src/starboard/shared/starboard/log_message.cc b/src/starboard/shared/starboard/log_message.cc
index 5e267b2..28d1503 100644
--- a/src/starboard/shared/starboard/log_message.cc
+++ b/src/starboard/shared/starboard/log_message.cc
@@ -36,7 +36,7 @@
 #pragma optimize("", off)
 #endif
 
-void Alias(const void* var) {}
+void Alias(const void* /*var*/) {}
 
 #if defined(COMPILER_MSVC)
 #pragma optimize("", on)
diff --git a/src/starboard/shared/starboard/player/decoded_audio_internal.cc b/src/starboard/shared/starboard/player/decoded_audio_internal.cc
index 5ee70b0..1c357c3 100644
--- a/src/starboard/shared/starboard/player/decoded_audio_internal.cc
+++ b/src/starboard/shared/starboard/player/decoded_audio_internal.cc
@@ -51,7 +51,7 @@
     bytes_per_sample = 4;
   }
   SB_DCHECK(size_ % (bytes_per_sample * channels_) == 0);
-  return size_ / bytes_per_sample / channels_;
+  return static_cast<int>(size_ / bytes_per_sample / channels_);
 }
 
 void DecodedAudio::ShrinkTo(size_t new_size) {
diff --git a/src/starboard/shared/starboard/player/filter/audio_renderer_impl_internal.cc b/src/starboard/shared/starboard/player/filter/audio_renderer_impl_internal.cc
index 1251d5d..29fc319 100644
--- a/src/starboard/shared/starboard/player/filter/audio_renderer_impl_internal.cc
+++ b/src/starboard/shared/starboard/player/filter/audio_renderer_impl_internal.cc
@@ -88,9 +88,6 @@
 
   frame_buffers_[0] = &frame_buffer_[0];
 
-// TODO: The audio sink on Android is currently broken on certain devices, which
-// causes all of playback to hang.  Log it for now, so we can tell when it
-// happens, but this should be removed once the sink is fixed.
 #if defined(NDEBUG)
   const bool kLogFramesConsumed = false;
 #else
@@ -299,8 +296,8 @@
   *is_playing = !paused_.load() && !seeking_.load();
 
   if (*is_playing) {
-    *frames_in_buffer =
-        frames_sent_to_sink_.load() - frames_consumed_by_sink_.load();
+    *frames_in_buffer = static_cast<int>(frames_sent_to_sink_.load() -
+                                         frames_consumed_by_sink_.load());
     *offset_in_frames = frames_consumed_by_sink_.load() % kMaxCachedFrames;
   } else {
     *frames_in_buffer = *offset_in_frames = 0;
@@ -415,8 +412,8 @@
     // There are still audio data not appended so schedule a callback later.
     SbTimeMonotonic delay = 0;
     if (kMaxCachedFrames - frames_in_buffer < kMaxCachedFrames / 4) {
-      int frames_to_delay =
-          kMaxCachedFrames / 4 - (kMaxCachedFrames - frames_in_buffer);
+      int frames_to_delay = static_cast<int>(
+          kMaxCachedFrames / 4 - (kMaxCachedFrames - frames_in_buffer));
       delay = frames_to_delay * kSbTimeSecond / decoder_->GetSamplesPerSecond();
     }
     process_audio_data_scheduled_ = true;
@@ -427,8 +424,8 @@
 bool AudioRendererImpl::AppendAudioToFrameBuffer() {
   SB_DCHECK(BelongsToCurrentThread());
 
-  int frames_in_buffer =
-      frames_sent_to_sink_.load() - frames_consumed_by_sink_.load();
+  int frames_in_buffer = static_cast<int>(frames_sent_to_sink_.load() -
+                                          frames_consumed_by_sink_.load());
 
   if (kMaxCachedFrames - frames_in_buffer < kFrameAppendUnit) {
     return false;
@@ -438,7 +435,8 @@
 
   // When |playback_rate_| is 0, try to fill the buffer with playback rate as 1.
   // Otherwise the preroll will never finish.
-  float playback_rate_to_fill = playback_rate_ == 0.f ? 1.f : playback_rate_;
+  float playback_rate_to_fill =
+      playback_rate_ == 0.0 ? 1.f : static_cast<float>(playback_rate_);
   scoped_refptr<DecodedAudio> decoded_audio =
       time_stretcher_.Read(kFrameAppendUnit, playback_rate_to_fill);
   SB_DCHECK(decoded_audio);
diff --git a/src/starboard/shared/starboard/player/filter/audio_time_stretcher.cc b/src/starboard/shared/starboard/player/filter/audio_time_stretcher.cc
index 5d5b589..4f2cbf5 100644
--- a/src/starboard/shared/starboard/player/filter/audio_time_stretcher.cc
+++ b/src/starboard/shared/starboard/player/filter/audio_time_stretcher.cc
@@ -208,8 +208,8 @@
     return dest;
   }
 
-  int slower_step = ceil(ola_window_size_ * playback_rate);
-  int faster_step = ceil(ola_window_size_ / playback_rate);
+  int slower_step = static_cast<int>(ceil(ola_window_size_ * playback_rate));
+  int faster_step = static_cast<int>(ceil(ola_window_size_ / playback_rate));
 
   // Optimize the most common |playback_rate| ~= 1 case to use a single copy
   // instead of copying frame by frame.
@@ -267,7 +267,7 @@
 int AudioTimeStretcher::ConvertMillisecondsToFrames(int ms) const {
   const double kMillsecondsPerSeconds =
       static_cast<double>(kSbTimeSecond / kSbTimeMillisecond);
-  return ms * (samples_per_second_ / kMillsecondsPerSeconds);
+  return static_cast<int>(ms * (samples_per_second_ / kMillsecondsPerSeconds));
 }
 
 bool AudioTimeStretcher::RunOneWsolaIteration(double playback_rate) {
diff --git a/src/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc b/src/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc
index b641fec..556c96c 100644
--- a/src/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc
+++ b/src/starboard/shared/starboard/player/filter/filter_based_player_worker_handler.cc
@@ -142,6 +142,7 @@
 }
 
 bool FilterBasedPlayerWorkerHandler::Seek(SbMediaTime seek_to_pts, int ticket) {
+  SB_UNREFERENCED_PARAMETER(ticket);
   SB_DCHECK(job_queue_->BelongsToCurrentThread());
 
   if (!audio_renderer_ || !video_renderer_) {
diff --git a/src/starboard/shared/starboard/player/filter/video_renderer_impl_internal.cc b/src/starboard/shared/starboard/player/filter/video_renderer_impl_internal.cc
index 78ab565..fb8e940 100644
--- a/src/starboard/shared/starboard/player/filter/video_renderer_impl_internal.cc
+++ b/src/starboard/shared/starboard/player/filter/video_renderer_impl_internal.cc
@@ -86,6 +86,7 @@
 scoped_refptr<VideoFrame> VideoRendererImpl::GetCurrentFrame(
     SbMediaTime media_time) {
   SB_DCHECK(thread_checker_.CalledOnValidThread());
+  ScopedLock lock(mutex_);
 
   if (frames_.empty()) {
     return last_displayed_frame_;
@@ -105,6 +106,7 @@
 
 bool VideoRendererImpl::IsEndOfStreamPlayed() const {
   SB_DCHECK(thread_checker_.CalledOnValidThread());
+  ScopedLock lock(mutex_);
   return end_of_stream_written_ && frames_.size() <= 1;
 }
 
diff --git a/src/starboard/shared/starboard/player/filter/wsola_internal.cc b/src/starboard/shared/starboard/player/filter/wsola_internal.cc
index a7291cf..f1f32f5 100644
--- a/src/starboard/shared/starboard/player/filter/wsola_internal.cc
+++ b/src/starboard/shared/starboard/player/filter/wsola_internal.cc
@@ -17,7 +17,9 @@
 // limitations under the License.
 
 // MSVC++ requires this to be set before any other includes to get M_PI.
+#if !defined(_USE_MATH_DEFINES)
 #define _USE_MATH_DEFINES
+#endif
 
 #include "starboard/shared/starboard/player/filter/wsola_internal.h"
 
@@ -290,7 +292,7 @@
 }
 
 void GetSymmetricHanningWindow(int window_length, float* window) {
-  const float scale = 2.0f * M_PI / window_length;
+  const float scale = static_cast<float>(2.0 * M_PI) / window_length;
   for (int n = 0; n < window_length; ++n)
     window[n] = 0.5f * (1.0f - cosf(n * scale));
 }
diff --git a/src/starboard/shared/starboard/player/input_buffer_internal.cc b/src/starboard/shared/starboard/player/input_buffer_internal.cc
index 3ff537f..9c44224 100644
--- a/src/starboard/shared/starboard/player/input_buffer_internal.cc
+++ b/src/starboard/shared/starboard/player/input_buffer_internal.cc
@@ -14,6 +14,7 @@
 
 #include "starboard/shared/starboard/player/input_buffer_internal.h"
 
+#include <numeric>
 #include <vector>
 
 #include "starboard/atomic.h"
@@ -43,22 +44,55 @@
         context_(context),
         data_(static_cast<const uint8_t*>(sample_buffer)),
         size_(sample_buffer_size),
-        pts_(sample_pts),
-        has_video_sample_info_(video_sample_info != NULL),
-        has_drm_info_(sample_drm_info != NULL) {
+        pts_(sample_pts) {
     SB_DCHECK(deallocate_sample_func);
-    if (has_video_sample_info_) {
-      video_sample_info_ = *video_sample_info;
-    }
-    if (has_drm_info_) {
-      SB_DCHECK(sample_drm_info->subsample_count > 0);
+    TryToAssignVideoSampleInfo(video_sample_info);
+    TryToAssignDrmSampleInfo(sample_drm_info);
+  }
 
-      subsamples_.assign(sample_drm_info->subsample_mapping,
-                         sample_drm_info->subsample_mapping +
-                             sample_drm_info->subsample_count);
-      drm_info_ = *sample_drm_info;
-      drm_info_.subsample_mapping =
-          subsamples_.empty() ? NULL : &subsamples_[0];
+  ReferenceCountedBuffer(SbMediaType sample_type,
+                         SbPlayerDeallocateSampleFunc deallocate_sample_func,
+                         SbPlayer player,
+                         void* context,
+                         const void** sample_buffers,
+                         int* sample_buffer_sizes,
+                         int number_of_sample_buffers,
+                         SbMediaTime sample_pts,
+                         const SbMediaVideoSampleInfo* video_sample_info,
+                         const SbDrmSampleInfo* sample_drm_info)
+      : ref_count_(0),
+        sample_type_(sample_type),
+        deallocate_sample_func_(deallocate_sample_func),
+        player_(player),
+        context_(context),
+        pts_(sample_pts) {
+    SB_DCHECK(deallocate_sample_func);
+    SB_DCHECK(number_of_sample_buffers > 0);
+
+    TryToAssignVideoSampleInfo(video_sample_info);
+    TryToAssignDrmSampleInfo(sample_drm_info);
+
+    if (number_of_sample_buffers == 1) {
+      data_ = static_cast<const uint8_t*>(sample_buffers[0]);
+      size_ = sample_buffer_sizes[0];
+    } else if (number_of_sample_buffers > 1) {
+      // TODO: This simply concatenating multi-part buffers into one large
+      // buffer.  It serves the purpose to test the Cobalt media code work with
+      // multi-part sample buffer but we should proper implement InputBuffer to
+      // ensure that the concatenating of multi-part buffers is handled inside
+      // the renderers or the decoders so the SbPlayer implementation won't use
+      // too much memory.
+      size_ =
+          std::accumulate(sample_buffer_sizes,
+                          sample_buffer_sizes + number_of_sample_buffers, 0);
+      flattened_data_.reserve(size_);
+      for (int i = 0; i < number_of_sample_buffers; ++i) {
+        const uint8_t* data = static_cast<const uint8_t*>(sample_buffers[i]);
+        flattened_data_.insert(flattened_data_.end(), data,
+                               data + sample_buffer_sizes[i]);
+      }
+      DeallocateSampleBuffer(sample_buffers[0]);
+      data_ = flattened_data_.data();
     }
   }
 
@@ -81,13 +115,12 @@
   }
   void SetDecryptedContent(const void* buffer, int size) {
     SB_DCHECK(size == size_);
-    SB_DCHECK(deallocate_sample_func_);
-    DeallocateSampleBuffer();
+    DeallocateSampleBuffer(data_);
 
     if (size > 0) {
-      decrypted_data_.resize(size);
-      SbMemoryCopy(&decrypted_data_[0], buffer, size);
-      data_ = &decrypted_data_[0];
+      flattened_data_.resize(size);
+      SbMemoryCopy(flattened_data_.data(), buffer, size);
+      data_ = flattened_data_.data();
     } else {
       data_ = NULL;
     }
@@ -96,11 +129,43 @@
   }
 
  private:
-  ~ReferenceCountedBuffer() { DeallocateSampleBuffer(); }
+  ~ReferenceCountedBuffer() { DeallocateSampleBuffer(data_); }
 
-  void DeallocateSampleBuffer() {
+  void TryToAssignVideoSampleInfo(
+      const SbMediaVideoSampleInfo* video_sample_info) {
+    has_video_sample_info_ = video_sample_info != NULL;
+
+    if (!has_video_sample_info_) {
+      return;
+    }
+
+    video_sample_info_ = *video_sample_info;
+    if (video_sample_info_.color_metadata) {
+      color_metadata_ = *video_sample_info_.color_metadata;
+      video_sample_info_.color_metadata = &color_metadata_;
+    } else {
+      video_sample_info_.color_metadata = NULL;
+    }
+  }
+  void TryToAssignDrmSampleInfo(const SbDrmSampleInfo* sample_drm_info) {
+    has_drm_info_ = sample_drm_info != NULL;
+
+    if (!has_drm_info_) {
+      return;
+    }
+
+    SB_DCHECK(sample_drm_info->subsample_count > 0);
+
+    subsamples_.assign(
+        sample_drm_info->subsample_mapping,
+        sample_drm_info->subsample_mapping + sample_drm_info->subsample_count);
+    drm_info_ = *sample_drm_info;
+    drm_info_.subsample_mapping = subsamples_.empty() ? NULL : &subsamples_[0];
+  }
+
+  void DeallocateSampleBuffer(const void* buffer) {
     if (deallocate_sample_func_) {
-      deallocate_sample_func_(player_, context_, const_cast<uint8_t*>(data_));
+      deallocate_sample_func_(player_, context_, buffer);
       deallocate_sample_func_ = NULL;
     }
   }
@@ -114,10 +179,11 @@
   int size_;
   SbMediaTime pts_;
   bool has_video_sample_info_;
+  SbMediaColorMetadata color_metadata_;
   SbMediaVideoSampleInfo video_sample_info_;
   bool has_drm_info_;
   SbDrmSampleInfo drm_info_;
-  std::vector<uint8_t> decrypted_data_;
+  std::vector<uint8_t> flattened_data_;
   std::vector<SbDrmSubSampleMapping> subsamples_;
 
   SB_DISALLOW_COPY_AND_ASSIGN(ReferenceCountedBuffer);
@@ -140,6 +206,23 @@
   buffer_->AddRef();
 }
 
+InputBuffer::InputBuffer(SbMediaType sample_type,
+                         SbPlayerDeallocateSampleFunc deallocate_sample_func,
+                         SbPlayer player,
+                         void* context,
+                         const void** sample_buffers,
+                         int* sample_buffer_sizes,
+                         int number_of_sample_buffers,
+                         SbMediaTime sample_pts,
+                         const SbMediaVideoSampleInfo* video_sample_info,
+                         const SbDrmSampleInfo* sample_drm_info) {
+  buffer_ = new ReferenceCountedBuffer(
+      sample_type, deallocate_sample_func, player, context, sample_buffers,
+      sample_buffer_sizes, number_of_sample_buffers, sample_pts,
+      video_sample_info, sample_drm_info);
+  buffer_->AddRef();
+}
+
 InputBuffer::InputBuffer(const InputBuffer& that) {
   buffer_ = that.buffer_;
   if (buffer_) {
diff --git a/src/starboard/shared/starboard/player/input_buffer_internal.h b/src/starboard/shared/starboard/player/input_buffer_internal.h
index 123beab..5c45e78 100644
--- a/src/starboard/shared/starboard/player/input_buffer_internal.h
+++ b/src/starboard/shared/starboard/player/input_buffer_internal.h
@@ -42,6 +42,16 @@
               SbMediaTime sample_pts,
               const SbMediaVideoSampleInfo* video_sample_info,
               const SbDrmSampleInfo* sample_drm_info);
+  InputBuffer(SbMediaType sample_type,
+              SbPlayerDeallocateSampleFunc deallocate_sample_func,
+              SbPlayer player,
+              void* context,
+              const void** sample_buffers,
+              int* sample_buffer_sizes,
+              int number_of_sample_buffers,
+              SbMediaTime sample_pts,
+              const SbMediaVideoSampleInfo* video_sample_info,
+              const SbDrmSampleInfo* sample_drm_info);
   InputBuffer(const InputBuffer& that);
   ~InputBuffer();
 
diff --git a/src/starboard/shared/starboard/player/job_queue.cc b/src/starboard/shared/starboard/player/job_queue.cc
index 02be55c..82b553a 100644
--- a/src/starboard/shared/starboard/player/job_queue.cc
+++ b/src/starboard/shared/starboard/player/job_queue.cc
@@ -103,6 +103,7 @@
     ScopedLock scoped_lock(mutex_);
     stopped_ = true;
     time_to_job_map_.clear();
+    condition_.Signal();
   }
 }
 
@@ -204,6 +205,9 @@
     if (delay > 0) {
       if (wait_for_next_job) {
         condition_.WaitTimed(delay);
+        if (time_to_job_map_.empty()) {
+          return false;
+        }
       } else {
         return false;
       }
diff --git a/src/starboard/shared/starboard/player/player_internal.cc b/src/starboard/shared/starboard/player/player_internal.cc
index a64fed3..5fe32f8 100644
--- a/src/starboard/shared/starboard/player/player_internal.cc
+++ b/src/starboard/shared/starboard/player/player_internal.cc
@@ -72,8 +72,9 @@
 
 void SbPlayerPrivate::WriteSample(
     SbMediaType sample_type,
-    const void* sample_buffer,
-    int sample_buffer_size,
+    const void** sample_buffers,
+    int* sample_buffer_sizes,
+    int number_of_sample_buffers,
     SbMediaTime sample_pts,
     const SbMediaVideoSampleInfo* video_sample_info,
     const SbDrmSampleInfo* sample_drm_info) {
@@ -81,7 +82,8 @@
     ++total_video_frames_;
   }
   InputBuffer input_buffer(sample_type, sample_deallocate_func_, this, context_,
-                           sample_buffer, sample_buffer_size, sample_pts,
+                           sample_buffers, sample_buffer_sizes,
+                           number_of_sample_buffers, sample_pts,
                            video_sample_info, sample_drm_info);
   worker_->WriteSample(input_buffer);
 }
@@ -131,6 +133,7 @@
 #endif  // SB_API_VERSION >= 4
 
 void SbPlayerPrivate::SetVolume(double volume) {
+  SB_UNREFERENCED_PARAMETER(volume);
   SB_NOTIMPLEMENTED();
 }
 
diff --git a/src/starboard/shared/starboard/player/player_internal.h b/src/starboard/shared/starboard/player/player_internal.h
index d04d0f9..6eb3d4b 100644
--- a/src/starboard/shared/starboard/player/player_internal.h
+++ b/src/starboard/shared/starboard/player/player_internal.h
@@ -39,8 +39,9 @@
 
   void Seek(SbMediaTime seek_to_pts, int ticket);
   void WriteSample(SbMediaType sample_type,
-                   const void* sample_buffer,
-                   int sample_buffer_size,
+                   const void** sample_buffers,
+                   int* sample_buffer_sizes,
+                   int number_of_sample_buffers,
                    SbMediaTime sample_pts,
                    const SbMediaVideoSampleInfo* video_sample_info,
                    const SbDrmSampleInfo* sample_drm_info);
diff --git a/src/starboard/shared/starboard/player/player_set_bounds.cc b/src/starboard/shared/starboard/player/player_set_bounds.cc
index 6974370..c4ac286 100644
--- a/src/starboard/shared/starboard/player/player_set_bounds.cc
+++ b/src/starboard/shared/starboard/player/player_set_bounds.cc
@@ -34,5 +34,4 @@
   player->SetBounds(x, y, width, height);
 }
 
-#endif  // SB_API_VERSION >= 4 || \
-           SB_IS(PLAYER_PUNCHED_OUT)
+#endif  // SB_API_VERSION >= 4 || SB_IS(PLAYER_PUNCHED_OUT)
diff --git a/src/starboard/shared/starboard/player/player_worker.cc b/src/starboard/shared/starboard/player/player_worker.cc
index 5e9f302..b9ba48a 100644
--- a/src/starboard/shared/starboard/player/player_worker.cc
+++ b/src/starboard/shared/starboard/player/player_worker.cc
@@ -240,8 +240,7 @@
     UpdatePlayerState(kSbPlayerStateError);
   }
 }
-#endif  // SB_API_VERSION >= 4 || \
-           SB_IS(PLAYER_PUNCHED_OUT)
+#endif  // SB_API_VERSION >= 4 || SB_IS(PLAYER_PUNCHED_OUT)
 
 void PlayerWorker::DoSetPause(bool pause) {
   SB_DCHECK(job_queue_->BelongsToCurrentThread());
diff --git a/src/starboard/shared/starboard/player/player_worker.h b/src/starboard/shared/starboard/player/player_worker.h
index 4599be9..eeade17 100644
--- a/src/starboard/shared/starboard/player/player_worker.h
+++ b/src/starboard/shared/starboard/player/player_worker.h
@@ -120,8 +120,7 @@
   void SetBounds(Bounds bounds) {
     job_queue_->Schedule(Bind(&PlayerWorker::DoSetBounds, this, bounds));
   }
-#endif  // SB_API_VERSION >= 4 || \
-           SB_IS(PLAYER_PUNCHED_OUT)
+#endif  // SB_API_VERSION >= 4 || SB_IS(PLAYER_PUNCHED_OUT)
 
   void SetPause(bool pause) {
     job_queue_->Schedule(Bind(&PlayerWorker::DoSetPause, this, pause));
@@ -171,8 +170,7 @@
   void DoWriteEndOfStream(SbMediaType sample_type);
 #if SB_API_VERSION >= 4 || SB_IS(PLAYER_PUNCHED_OUT)
   void DoSetBounds(Bounds bounds);
-#endif  // SB_API_VERSION >= 4 || \
-           SB_IS(PLAYER_PUNCHED_OUT)
+#endif  // SB_API_VERSION >= 4 || SB_IS(PLAYER_PUNCHED_OUT)
   void DoSetPause(bool pause);
 #if SB_API_VERSION >= 4
   void DoSetPlaybackRate(double rate);
diff --git a/src/starboard/shared/starboard/player/player_write_sample.cc b/src/starboard/shared/starboard/player/player_write_sample.cc
index 477e434..a92797b 100644
--- a/src/starboard/shared/starboard/player/player_write_sample.cc
+++ b/src/starboard/shared/starboard/player/player_write_sample.cc
@@ -32,9 +32,9 @@
     return;
   }
 
-  if (number_of_sample_buffers != 1) {
+  if (number_of_sample_buffers < 1) {
     SB_DLOG(WARNING) << "SbPlayerWriteSample() doesn't support"
-                     << " |number_of_sample_buffers| other than one.";
+                     << " |number_of_sample_buffers| less than one.";
     return;
   }
 
@@ -48,8 +48,9 @@
     return;
   }
 
-  player->WriteSample(sample_type, sample_buffers[0], sample_buffer_sizes[0],
-                      sample_pts, video_sample_info, sample_drm_info);
+  player->WriteSample(sample_type, sample_buffers, sample_buffer_sizes,
+                      number_of_sample_buffers, sample_pts, video_sample_info,
+                      sample_drm_info);
 }
 
 #else  // SB_API_VERSION >= 4
diff --git a/src/starboard/shared/starboard/player/video_frame_internal.cc b/src/starboard/shared/starboard/player/video_frame_internal.cc
index c000c26..934fbde 100644
--- a/src/starboard/shared/starboard/player/video_frame_internal.cc
+++ b/src/starboard/shared/starboard/player/video_frame_internal.cc
@@ -55,13 +55,18 @@
   SbMemorySet(s_clamp_table, 0, 512);
   SbMemorySet(s_clamp_table + 768, 0xff, 512);
 
-  for (int i = 0; i < 256; ++i) {
-    s_y_to_rgb[i] = (static_cast<uint8_t>(i) - 16) * 1.164f;
-    s_v_to_r[i] = (static_cast<uint8_t>(i) - 128) * 1.793f;
-    s_u_to_g[i] = (static_cast<uint8_t>(i) - 128) * -0.213;
-    s_v_to_g[i] = (static_cast<uint8_t>(i) - 128) * -0.533f;
-    s_u_to_b[i] = (static_cast<uint8_t>(i) - 128) * 2.112f;
-    s_clamp_table[512 + i] = i;
+  uint8_t i = 0;
+  while (true) {
+    s_y_to_rgb[i] = static_cast<int>((i - 16) * 1.164f);
+    s_v_to_r[i] = static_cast<int>((i - 128) * 1.793f);
+    s_u_to_g[i] = static_cast<int>((i - 128) * -0.213f);
+    s_v_to_g[i] = static_cast<int>((i - 128) * -0.533f);
+    s_u_to_b[i] = static_cast<int>((i - 128) * 2.112f);
+    s_clamp_table[512 + static_cast<std::size_t>(i)] = i;
+    if (i == 255) {
+      break;
+    }
+    ++i;
   }
 
   s_yuv_to_rgb_lookup_table_initialized = true;
@@ -151,7 +156,10 @@
     const uint8_t* y = &y_data[row * GetPlane(0).pitch_in_bytes];
     const uint8_t* u = &u_data[row / 2 * GetPlane(1).pitch_in_bytes];
     const uint8_t* v = &v_data[row / 2 * GetPlane(2).pitch_in_bytes];
-    int v_to_r, u_to_g, v_to_g, u_to_b;
+    int v_to_r = 0;
+    int u_to_g = 0;
+    int v_to_g = 0;
+    int u_to_b = 0;
 
     for (int column = 0; column < width; ++column) {
       if (column % 2 == 0) {
diff --git a/src/starboard/shared/stub/drm_close_session.cc b/src/starboard/shared/stub/drm_close_session.cc
index 61b251a..518c702 100644
--- a/src/starboard/shared/stub/drm_close_session.cc
+++ b/src/starboard/shared/stub/drm_close_session.cc
@@ -17,4 +17,7 @@
 void SbDrmCloseSession(SbDrmSystem drm_system,
                        const void* session_id,
                        int session_id_size) {
+  SB_UNREFERENCED_PARAMETER(drm_system);
+  SB_UNREFERENCED_PARAMETER(session_id);
+  SB_UNREFERENCED_PARAMETER(session_id_size);
 }
diff --git a/src/starboard/shared/stub/drm_create_system.cc b/src/starboard/shared/stub/drm_create_system.cc
index c5cd1fb..a9a1c84 100644
--- a/src/starboard/shared/stub/drm_create_system.cc
+++ b/src/starboard/shared/stub/drm_create_system.cc
@@ -19,5 +19,9 @@
     void* context,
     SbDrmSessionUpdateRequestFunc update_request_callback,
     SbDrmSessionUpdatedFunc session_updated_callback) {
+  SB_UNREFERENCED_PARAMETER(context);
+  SB_UNREFERENCED_PARAMETER(key_system);
+  SB_UNREFERENCED_PARAMETER(update_request_callback);
+  SB_UNREFERENCED_PARAMETER(session_updated_callback);
   return kSbDrmSystemInvalid;
 }
diff --git a/src/starboard/shared/stub/drm_destroy_system.cc b/src/starboard/shared/stub/drm_destroy_system.cc
index 6e13124..8e7aad3 100644
--- a/src/starboard/shared/stub/drm_destroy_system.cc
+++ b/src/starboard/shared/stub/drm_destroy_system.cc
@@ -15,4 +15,5 @@
 #include "starboard/drm.h"
 
 void SbDrmDestroySystem(SbDrmSystem drm_system) {
+  SB_UNREFERENCED_PARAMETER(drm_system);
 }
diff --git a/src/starboard/shared/stub/drm_generate_session_update_request.cc b/src/starboard/shared/stub/drm_generate_session_update_request.cc
index 5d14858..7506e11 100644
--- a/src/starboard/shared/stub/drm_generate_session_update_request.cc
+++ b/src/starboard/shared/stub/drm_generate_session_update_request.cc
@@ -14,11 +14,11 @@
 
 #include "starboard/drm.h"
 
-void SbDrmGenerateSessionUpdateRequest(SbDrmSystem drm_system,
+void SbDrmGenerateSessionUpdateRequest(SbDrmSystem /*drm_system*/,
 #if SB_API_VERSION >= 4
-                                       int ticket,
+                                       int /*ticket*/,
 #endif  // SB_API_VERSION >= 4
-                                       const char* type,
-                                       const void* initialization_data,
-                                       int initialization_data_size) {
+                                       const char* /*type*/,
+                                       const void* /*initialization_data*/,
+                                       int /*initialization_data_size*/) {
 }
diff --git a/src/starboard/shared/stub/drm_update_session.cc b/src/starboard/shared/stub/drm_update_session.cc
index 7f0d11f..5c7a9d6 100644
--- a/src/starboard/shared/stub/drm_update_session.cc
+++ b/src/starboard/shared/stub/drm_update_session.cc
@@ -14,12 +14,12 @@
 
 #include "starboard/drm.h"
 
-void SbDrmUpdateSession(SbDrmSystem drm_system,
+void SbDrmUpdateSession(SbDrmSystem /*drm_system*/,
 #if SB_API_VERSION >= 4
-                        int ticket,
+                        int /*ticket*/,
 #endif  // SB_API_VERSION >= 4
-                        const void* key,
-                        int key_size,
-                        const void* session_id,
-                        int session_id_size) {
+                        const void* /*key*/,
+                        int /*key_size*/,
+                        const void* /*session_id*/,
+                        int /*session_id_size*/) {
 }
diff --git a/src/starboard/shared/stub/image_decode.cc b/src/starboard/shared/stub/image_decode.cc
index dd8d4d8..d0d7782 100644
--- a/src/starboard/shared/stub/image_decode.cc
+++ b/src/starboard/shared/stub/image_decode.cc
@@ -25,6 +25,11 @@
                              int data_size,
                              const char* mime_type,
                              SbDecodeTargetFormat format) {
+  SB_UNREFERENCED_PARAMETER(data);
+  SB_UNREFERENCED_PARAMETER(data_size);
+  SB_UNREFERENCED_PARAMETER(format);
+  SB_UNREFERENCED_PARAMETER(mime_type);
+  SB_UNREFERENCED_PARAMETER(provider);
   return kSbDecodeTargetInvalid;
 }
 #else   // SB_API_VERSION >= 4
@@ -33,6 +38,11 @@
                              int data_size,
                              const char* mime_type,
                              SbDecodeTargetFormat format) {
+  SB_UNREFERENCED_PARAMETER(data);
+  SB_UNREFERENCED_PARAMETER(data_size);
+  SB_UNREFERENCED_PARAMETER(format);
+  SB_UNREFERENCED_PARAMETER(mime_type);
+  SB_UNREFERENCED_PARAMETER(provider);
   return kSbDecodeTargetInvalid;
 }
 #endif  // SB_API_VERSION >= 4
diff --git a/src/starboard/shared/stub/image_is_decode_supported.cc b/src/starboard/shared/stub/image_is_decode_supported.cc
index b620022..c4426fd 100644
--- a/src/starboard/shared/stub/image_is_decode_supported.cc
+++ b/src/starboard/shared/stub/image_is_decode_supported.cc
@@ -21,5 +21,7 @@
 
 bool SbImageIsDecodeSupported(const char* mime_type,
                               SbDecodeTargetFormat format) {
+  SB_UNREFERENCED_PARAMETER(mime_type);
+  SB_UNREFERENCED_PARAMETER(format);
   return false;
 }
diff --git a/src/starboard/shared/stub/media_set_output_protection.cc b/src/starboard/shared/stub/media_set_output_protection.cc
index 043318f..4bc1938 100644
--- a/src/starboard/shared/stub/media_set_output_protection.cc
+++ b/src/starboard/shared/stub/media_set_output_protection.cc
@@ -17,5 +17,6 @@
 #include "starboard/log.h"
 
 bool SbMediaSetOutputProtection(bool enabled) {
+  SB_UNREFERENCED_PARAMETER(enabled);
   return false;
 }
diff --git a/src/starboard/shared/uwp/application_uwp.cc b/src/starboard/shared/uwp/application_uwp.cc
index 1911a61..f7c44e1 100644
--- a/src/starboard/shared/uwp/application_uwp.cc
+++ b/src/starboard/shared/uwp/application_uwp.cc
@@ -14,8 +14,11 @@
 
 #include "starboard/shared/uwp/application_uwp.h"
 
-#include <windows.h>
 #include <WinSock2.h>
+#include <mfapi.h>
+#include <ppltasks.h>
+#include <windows.h>
+#include <D3D11.h>
 
 #include <memory>
 #include <string>
@@ -25,17 +28,25 @@
 #include "starboard/log.h"
 #include "starboard/shared/starboard/application.h"
 #include "starboard/shared/starboard/audio_sink/audio_sink_internal.h"
+#include "starboard/shared/starboard/player/video_frame_internal.h"
 #include "starboard/shared/uwp/window_internal.h"
 #include "starboard/shared/win32/thread_private.h"
 #include "starboard/shared/win32/wchar_utils.h"
 #include "starboard/string.h"
+#include "starboard/system.h"
 
+namespace sbwin32 = starboard::shared::win32;
+
+using Microsoft::WRL::ComPtr;
 using starboard::shared::starboard::Application;
 using starboard::shared::starboard::CommandLine;
 using starboard::shared::uwp::ApplicationUwp;
 using starboard::shared::uwp::GetArgvZero;
+using starboard::shared::win32::stringToPlatformString;
 using starboard::shared::win32::wchar_tToUTF8;
+using starboard::shared::starboard::player::VideoFrame;
 using Windows::ApplicationModel::Activation::ActivationKind;
+using Windows::ApplicationModel::Activation::DialReceiverActivatedEventArgs;
 using Windows::ApplicationModel::Activation::IActivatedEventArgs;
 using Windows::ApplicationModel::Activation::IProtocolActivatedEventArgs;
 using Windows::ApplicationModel::Core::CoreApplication;
@@ -44,25 +55,30 @@
 using Windows::ApplicationModel::Core::IFrameworkViewSource;
 using Windows::ApplicationModel::SuspendingEventArgs;
 using Windows::Foundation::EventHandler;
+using Windows::Foundation::IAsyncOperation;
 using Windows::Foundation::TimeSpan;
 using Windows::Foundation::TypedEventHandler;
 using Windows::Foundation::Uri;
-using Windows::System::Threading::TimerElapsedHandler;
 using Windows::System::Threading::ThreadPoolTimer;
-using Windows::UI::Core::CoreDispatcherPriority;
+using Windows::System::Threading::TimerElapsedHandler;
 using Windows::System::UserAuthenticationStatus;
+using Windows::UI::Core::CoreDispatcherPriority;
 using Windows::UI::Core::CoreProcessEventsOption;
 using Windows::UI::Core::CoreWindow;
 using Windows::UI::Core::DispatchedHandler;
 using Windows::UI::Core::KeyEventArgs;
-
-namespace sbwin32 = starboard::shared::win32;
+using Windows::UI::Popups::IUICommand;
+using Windows::UI::Popups::MessageDialog;
+using Windows::UI::Popups::UICommand;
+using Windows::UI::Popups::UICommandInvokedHandler;
 
 namespace {
 
 const int kWinSockVersionMajor = 2;
 const int kWinSockVersionMinor = 2;
 
+const char kYouTubeTVurl[] = "--url=https://www.youtube.com/tv/?";
+
 int main_return_value = 0;
 
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
@@ -116,8 +132,79 @@
                              Application::DeleteArrayDestructor<const char*>));
 }
 
+// Returns if |full_string| ends with |substring|.
+bool ends_with(const std::string& full_string, const std::string& substring) {
+  if (substring.length() > full_string.length()) {
+    return false;
+  }
+  return std::equal(substring.rbegin(), substring.rend(), full_string.rbegin());
+}
+
 }  // namespace
 
+// Note that this is a "struct" and not a "class" because
+// that's how it's defined in starboard/system.h
+struct SbSystemPlatformErrorPrivate {
+  SbSystemPlatformErrorPrivate(const SbSystemPlatformErrorPrivate&) = delete;
+  SbSystemPlatformErrorPrivate& operator=(
+      const SbSystemPlatformErrorPrivate&) = delete;
+
+  SbSystemPlatformErrorPrivate(
+      SbSystemPlatformErrorType type,
+      SbSystemPlatformErrorCallback callback,
+      void* user_data)
+      : callback_(callback), user_data_(user_data) {
+    SB_DCHECK(type == kSbSystemPlatformErrorTypeConnectionError);
+
+    ApplicationUwp* app = ApplicationUwp::Get();
+    app->RunInMainThreadAsync([this, callback, user_data, app]() {
+      MessageDialog^ dialog = ref new MessageDialog(
+          app->GetString("UNABLE_TO_CONTACT_YOUTUBE_1",
+              "Sorry, could not connect to YouTube."));
+      dialog->Commands->Append(
+          MakeUICommand(
+              "OFFLINE_MESSAGE_TRY_AGAIN", "Try again",
+              kSbSystemPlatformErrorResponsePositive));
+      dialog->Commands->Append(
+          MakeUICommand(
+              "EXIT_BUTTON", "Exit",
+              kSbSystemPlatformErrorResponseCancel));
+      dialog->DefaultCommandIndex = 0;
+      dialog->CancelCommandIndex = 1;
+      IAsyncOperation<IUICommand^>^ operation = dialog->ShowAsync();
+      dialog_operation_ = operation;
+      concurrency::create_task(operation).then([this](IUICommand^ command) {
+        delete this;
+      });
+    });
+  }
+
+  UICommand^ MakeUICommand(
+      const char* id,
+      const char* fallback,
+      SbSystemPlatformErrorResponse response) {
+    ApplicationUwp* app = ApplicationUwp::Get();
+    Platform::String^ label = app->GetString(id, fallback);
+
+    return ref new UICommand(label,
+      ref new UICommandInvokedHandler(
+        [this, response](IUICommand^ command) {
+          callback_(response, user_data_);
+        }));
+  }
+
+  void Clear() {
+    ApplicationUwp::Get()->RunInMainThreadAsync([this]() {
+      dialog_operation_->Cancel();
+    });
+  }
+
+ private:
+  SbSystemPlatformErrorCallback callback_;
+  void* user_data_;
+  Platform::Agile<IAsyncOperation<IUICommand^>> dialog_operation_;
+};
+
 ref class App sealed : public IFrameworkView {
  public:
   App() : previously_activated_(false) {}
@@ -143,8 +230,6 @@
   }
   virtual void Load(Platform::String^ entryPoint) {}
   virtual void Run() {
-    args_.push_back(GetArgvZero());
-    argv_.push_back(args_.begin()->c_str());
     main_return_value = application_.Run(
         static_cast<int>(argv_.size()), const_cast<char**>(argv_.data()));
   }
@@ -180,6 +265,8 @@
 
   void OnActivated(
       CoreApplicationView^ applicationView, IActivatedEventArgs^ args) {
+    bool command_line_set = false;
+
     // Please see application lifecyle description:
     // https://docs.microsoft.com/en-us/windows/uwp/launch-resume/app-lifecycle
     // Note that this document was written for Xaml apps not core apps,
@@ -195,7 +282,9 @@
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
       // The starboard: scheme provides commandline arguments, but that's
       // only allowed during a process's first activation.
-      if (!previously_activated_ && uri->SchemeName->Equals("starboard")) {
+      std::string scheme = sbwin32::platformStringToString(uri->SchemeName);
+
+      if (!previously_activated_ && ends_with(scheme, "-starboard")) {
         std::string uri_string = wchar_tToUTF8(uri->RawUri->Data());
         // args_ is a vector of std::string, but argv_ is a vector of
         // char* into args_ so as to compose a char**.
@@ -205,7 +294,8 @@
         }
 
         ApplicationUwp::Get()->SetCommandLine(
-          static_cast<int>(argv_.size()), argv_.data());
+            static_cast<int>(argv_.size()), argv_.data());
+        command_line_set = true;
       }
 #endif  // defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
       if (uri->SchemeName->Equals("youtube") ||
@@ -221,20 +311,40 @@
           ApplicationUwp::Get()->SetStartLink(uri_string.c_str());
         }
       }
+    } else if (args->Kind == ActivationKind::DialReceiver) {
+      if (!previously_activated_) {
+        DialReceiverActivatedEventArgs ^ dial_args =
+            dynamic_cast<DialReceiverActivatedEventArgs ^>(args);
+        SB_CHECK(dial_args);
+        Platform::String ^ arguments = dial_args->Arguments;
+        std::string activation_args =
+            kYouTubeTVurl + sbwin32::platformStringToString(arguments);
+        SB_DLOG(INFO) << "Dial Activation url: " << activation_args;
+        args_.push_back(activation_args);
+        argv_.push_back(args_.back().c_str());
+        ApplicationUwp::Get()->SetCommandLine(static_cast<int>(argv_.size()),
+          argv_.data());
+        command_line_set = true;
+      }
     }
     previous_activation_kind_ = args->Kind;
 
     if (!previously_activated_) {
+      if (!command_line_set) {
+        args_.push_back(GetArgvZero());
+        argv_.push_back(args_.begin()->c_str());
+        ApplicationUwp::Get()->SetCommandLine(
+            static_cast<int>(argv_.size()), argv_.data());
+      }
       CoreWindow::GetForCurrentThread()->Activate();
       // Call DispatchStart async so the UWP system thinks we're activated.
       // Some tools seem to want the application to be activated before
       // interacting with them, some things are disallowed during activation
       // (such as exiting), and DispatchStart (for example) runs
       // automated tests synchronously.
-      CoreWindow::GetForCurrentThread()->Dispatcher->RunAsync(
-          CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]() {
-            ApplicationUwp::Get()->DispatchStart();
-          }));
+      ApplicationUwp::Get()->RunInMainThreadAsync([this]() {
+        ApplicationUwp::Get()->DispatchStart();
+      });
     }
     previously_activated_ = true;
   }
@@ -275,7 +385,8 @@
   return arg;
 }
 
-ApplicationUwp::ApplicationUwp() : window_(kSbWindowInvalid) {}
+ApplicationUwp::ApplicationUwp()
+    : window_(kSbWindowInvalid), localized_strings_(SbSystemGetLocaleId()) {}
 
 ApplicationUwp::~ApplicationUwp() {}
 
@@ -324,14 +435,12 @@
 }
 
 void ApplicationUwp::Inject(Application::Event* event) {
-  CoreWindow::GetForCurrentThread()->Dispatcher->RunAsync(
-    CoreDispatcherPriority::Normal,
-    ref new DispatchedHandler([this, event]() {
-      bool result = DispatchAndDelete(event);
-      if (!result) {
-        CoreApplication::Exit();
-      }
-    }));
+  RunInMainThreadAsync([this, event]() {
+    bool result = DispatchAndDelete(event);
+    if (!result) {
+      CoreApplication::Exit();
+    }
+  });
 }
 
 void ApplicationUwp::InjectTimedEvent(Application::TimedEvent* timed_event) {
@@ -350,16 +459,14 @@
   ScopedLock lock(mutex_);
   ThreadPoolTimer^ timer = ThreadPoolTimer::CreateTimer(
     ref new TimerElapsedHandler([this, timed_event](ThreadPoolTimer^ timer) {
-      core_window_->Dispatcher->RunAsync(
-        CoreDispatcherPriority::Normal,
-        ref new DispatchedHandler([this, timed_event]() {
-          timed_event->callback(timed_event->context);
-          ScopedLock lock(mutex_);
-          auto it = timer_event_map_.find(timed_event->id);
-          if (it != timer_event_map_.end()) {
-            timer_event_map_.erase(it);
-          }
-        }));
+      RunInMainThreadAsync([this, timed_event]() {
+        timed_event->callback(timed_event->context);
+        ScopedLock lock(mutex_);
+        auto it = timer_event_map_.find(timed_event->id);
+        if (it != timer_event_map_.end()) {
+          timer_event_map_.erase(it);
+        }
+      });
     }), timespan);
   timer_event_map_.emplace(timed_event->id, timer);
 }
@@ -383,6 +490,47 @@
   SB_NOTIMPLEMENTED();
   return 0;
 }
+SbSystemPlatformError ApplicationUwp::OnSbSystemRaisePlatformError(
+    SbSystemPlatformErrorType type,
+    SbSystemPlatformErrorCallback callback,
+    void* user_data) {
+  return new SbSystemPlatformErrorPrivate(type, callback, user_data);
+}
+
+void ApplicationUwp::OnSbSystemClearPlatformError(
+    SbSystemPlatformError handle) {
+  if (handle == kSbSystemPlatformErrorInvalid) {
+    return;
+  }
+  static_cast<SbSystemPlatformErrorPrivate*>(handle)->Clear();
+}
+
+Platform::String^ ApplicationUwp::GetString(
+    const char* id, const char* fallback) const {
+  return stringToPlatformString(localized_strings_.GetString(id, fallback));
+}
+
+void ApplicationUwp::AcceptFrame(SbPlayer player,
+                                 const scoped_refptr<VideoFrame>& frame,
+                                 int x,
+                                 int y,
+                                 int width,
+                                 int height) {
+  SB_UNREFERENCED_PARAMETER(player);
+  SB_UNREFERENCED_PARAMETER(frame);
+  SB_UNREFERENCED_PARAMETER(x);
+  SB_UNREFERENCED_PARAMETER(y);
+  SB_UNREFERENCED_PARAMETER(width);
+  SB_UNREFERENCED_PARAMETER(height);
+
+  if (frame->IsEndOfStream()) {
+    // TODO: Implement.
+  } else {
+    ID3D11Texture2D* dx_texture =
+        static_cast<ID3D11Texture2D*>(frame->native_texture());
+    SB_UNREFERENCED_PARAMETER(dx_texture);
+  }
+}
 
 }  // namespace uwp
 }  // namespace shared
diff --git a/src/starboard/shared/uwp/application_uwp.h b/src/starboard/shared/uwp/application_uwp.h
index 8bdc00d..b326d1e 100644
--- a/src/starboard/shared/uwp/application_uwp.h
+++ b/src/starboard/shared/uwp/application_uwp.h
@@ -25,6 +25,7 @@
 #include "starboard/shared/internal_only.h"
 #include "starboard/shared/starboard/application.h"
 #include "starboard/shared/starboard/command_line.h"
+#include "starboard/shared/starboard/localized_strings.h"
 #include "starboard/shared/uwp/winrt_workaround.h"
 #include "starboard/types.h"
 #include "starboard/window.h"
@@ -81,6 +82,23 @@
     shared::starboard::Application::SetStartLink(link);
   }
 
+  SbSystemPlatformError OnSbSystemRaisePlatformError(
+     SbSystemPlatformErrorType type,
+     SbSystemPlatformErrorCallback callback,
+     void* user_data);
+
+  void OnSbSystemClearPlatformError(SbSystemPlatformError handle);
+
+  // Schedules a lambda to run on the main thread and returns immediately.
+  template<typename T>
+  void RunInMainThreadAsync(const T& lambda) {
+    core_window_->Dispatcher->RunAsync(
+      CoreDispatcherPriority::Normal,
+      ref new DispatchedHandler(lambda));
+  }
+
+  Platform::String^ GetString(const char* id, const char* fallback) const;
+
  private:
   // --- Application overrides ---
   bool IsStartImmediate() SB_OVERRIDE { return false; }
@@ -93,10 +111,19 @@
   TimedEvent* GetNextDueTimedEvent() SB_OVERRIDE;
   SbTimeMonotonic GetNextTimedEventTargetTime() SB_OVERRIDE;
 
+  void AcceptFrame(SbPlayer player,
+                   const scoped_refptr<VideoFrame>& frame,
+                   int x,
+                   int y,
+                   int width,
+                   int height) SB_OVERRIDE;
+
   // The single open window, if any.
   SbWindow window_;
   Platform::Agile<Windows::UI::Core::CoreWindow> core_window_;
 
+  shared::starboard::LocalizedStrings localized_strings_;
+
   Mutex mutex_;
   // Locked by mutex_
   std::unordered_map<SbEventId, Windows::System::Threading::ThreadPoolTimer^>
diff --git a/src/starboard/shared/uwp/application_uwp_key_event.cc b/src/starboard/shared/uwp/application_uwp_key_event.cc
index be64071..73b7d27 100644
--- a/src/starboard/shared/uwp/application_uwp_key_event.cc
+++ b/src/starboard/shared/uwp/application_uwp_key_event.cc
@@ -28,6 +28,9 @@
 namespace {
 
 SbKey VirtualKeyToSbKey(VirtualKey key) {
+// Disable warning for Invalid valid values from switch of enum.
+#pragma warning(push)
+#pragma warning(disable : 4063)
   switch (key) {
     case VirtualKey::None:
     case VirtualKey::NavigationView:
@@ -155,6 +158,23 @@
     case VirtualKey::F22: return kSbKeyF22;
     case VirtualKey::F23: return kSbKeyF23;
     case VirtualKey::F24: return kSbKeyF24;
+    // SbKeys were originally modeled after the windows virtual key mappings [1].
+    // UWP VirtualKey uses a very similar mapping, but the UWP enum does not
+    // contain all of the Virtual-Key Codes.
+    // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
+    case 0xBA: return kSbKeyOem1;  // Used for ";:" key with US keyboards.
+    case 0xBB: return kSbKeyOemPlus;
+    case 0xBC: return kSbKeyOemComma;
+    case 0xBD: return kSbKeyOemMinus;
+    case 0xBE: return kSbKeyOemPeriod;
+    case 0xBF: return kSbKeyOem2;  // Used for "/?" key with US keyboards.
+    case 0xC0: return kSbKeyOem3;  // Used for "~" with US keyboards.
+    case 0xDB: return kSbKeyOem4;  // Used for "[{" with US keyboards.
+    case 0xDC: return kSbKeyOem5;  // Used for "\|" with US keyboards.
+    case 0xDD: return kSbKeyOem6;  // Used for "]}" with US keyboards.
+    case 0xDE: return kSbKeyOem7;  // Used for quotes with US keyboards.
+    case 0xDF: return kSbKeyOem8;  // Used for misc. chars with US keyboards.
+    case 0xE2: return kSbKeyOem102;  // Used for "/" or angle bracket keys.
     case VirtualKey::NumberKeyLock: return kSbKeyNumlock;
     case VirtualKey::Scroll: return kSbKeyScroll;
     case VirtualKey::LeftShift: return kSbKeyLshift;
@@ -212,17 +232,13 @@
     default:
       return kSbKeyUnknown;
   }
+#pragma warning(pop)  // Warning 4093 (Invalid valid values from switch of enum)
 }
 
 // Returns true if a given VirtualKey is currently being held down.
 bool IsDown(CoreWindow^ sender, VirtualKey key) {
-  switch (sender->GetKeyState(key)) {
-    case CoreVirtualKeyStates::Down:
-    case CoreVirtualKeyStates::Locked:
-      return true;
-    default:
-      return false;
-  }
+  return ((sender->GetKeyState(key) & CoreVirtualKeyStates::Down) ==
+          CoreVirtualKeyStates::Down);
 }
 
 }  // namespace
diff --git a/src/starboard/shared/uwp/cobalt/xhr_modify_headers.cc b/src/starboard/shared/uwp/cobalt/xhr_modify_headers.cc
index 9497a40..9ec452d 100644
--- a/src/starboard/shared/uwp/cobalt/xhr_modify_headers.cc
+++ b/src/starboard/shared/uwp/cobalt/xhr_modify_headers.cc
@@ -14,7 +14,10 @@
 
 #include "cobalt/xhr/xhr_modify_headers.h"
 
-#include <base/logging.h>
+#include "base/logging.h"
+#include "base/synchronization/waitable_event.h"
+
+#include "starboard/mutex.h"
 #include "starboard/shared/uwp/async_utils.h"
 #include "starboard/shared/uwp/winrt_workaround.h"
 #include "starboard/shared/win32/wchar_utils.h"
@@ -27,6 +30,9 @@
 using Windows::Security::Authentication::Web::Core::WebTokenRequestStatus;
 using Windows::Security::Credentials::WebAccountProvider;
 using Windows::System::UserAuthenticationStatus;
+using Windows::UI::Core::CoreWindow;
+using Windows::UI::Core::CoreDispatcherPriority;
+using Windows::UI::Core::DispatchedHandler;
 
 namespace sbwin32 = starboard::shared::win32;
 
@@ -91,6 +97,28 @@
   return os;
 }
 
+WebTokenRequestResult^ RequestToken(WebTokenRequest^ request) {
+  using starboard::shared::uwp::WaitForResult;
+  IAsyncOperation<WebTokenRequestResult ^> ^ request_operation = nullptr;
+  base::WaitableEvent request_operation_set(false, false);
+  // Ensure WebAuthenticationCoreManager::RequestTokenAsync is called on the
+  // UI thread, since documentation states that "This method cannot be called
+  // from background threads", per
+  // https://docs.microsoft.com/en-us/uwp/api/windows.security.authentication.web.core.webauthenticationcoremanager
+  Windows::ApplicationModel::Core::CoreApplication::MainView->CoreWindow
+      ->Dispatcher->RunAsync(
+          CoreDispatcherPriority::Normal,
+          ref new DispatchedHandler(
+              [&request, &request_operation_set, &request_operation] {
+                request_operation =
+                    WebAuthenticationCoreManager::RequestTokenAsync(request);
+                request_operation_set.Signal();
+              }));
+  request_operation_set.Wait();
+  WebTokenRequestResult^ result = WaitForResult(request_operation);
+  return result;
+}
+
 bool PopulateToken(const std::string& relying_party, std::string* out) {
   using starboard::shared::uwp::WaitForResult;
   DCHECK(out);
@@ -108,8 +136,7 @@
       WebAuthenticationCoreManager::GetTokenSilentlyAsync(request));
   if (token_result->ResponseStatus ==
       WebTokenRequestStatus::UserInteractionRequired) {
-    token_result =
-        WaitForResult(WebAuthenticationCoreManager::RequestTokenAsync(request));
+    token_result = RequestToken(request);
   }
 
   if (token_result->ResponseStatus == WebTokenRequestStatus::Success) {
@@ -135,6 +162,7 @@
 
   return false;
 }
+
 }  // namespace
 
 namespace cobalt {
diff --git a/src/starboard/shared/uwp/starboard_platform.gypi b/src/starboard/shared/uwp/starboard_platform.gypi
index 9e107a2..5370972 100644
--- a/src/starboard/shared/uwp/starboard_platform.gypi
+++ b/src/starboard/shared/uwp/starboard_platform.gypi
@@ -19,6 +19,8 @@
       'application_uwp_key_event.cc',
       'async_utils.h',
       'system_get_property.cc',
+      'system_clear_platform_error.cc',
+      'system_raise_platform_error.cc',
       'window_create.cc',
       'window_destroy.cc',
       'window_get_platform_handle.cc',
@@ -27,6 +29,7 @@
       'window_internal.cc',
       'window_internal.h',
       'winrt_workaround.h',
+      '<(DEPTH)/starboard/shared/starboard/localized_strings.cc',
       '<(DEPTH)/starboard/shared/starboard/system_request_pause.cc',
       '<(DEPTH)/starboard/shared/starboard/system_request_stop.cc',
       '<(DEPTH)/starboard/shared/starboard/system_request_suspend.cc',
diff --git a/src/starboard/linux/x64x11/cpp11/thread_types_public.h b/src/starboard/shared/uwp/system_clear_platform_error.cc
similarity index 69%
rename from src/starboard/linux/x64x11/cpp11/thread_types_public.h
rename to src/starboard/shared/uwp/system_clear_platform_error.cc
index 9ab0ac3..4d71d25 100644
--- a/src/starboard/linux/x64x11/cpp11/thread_types_public.h
+++ b/src/starboard/shared/uwp/system_clear_platform_error.cc
@@ -12,9 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+#include "starboard/system.h"
 
-#include "starboard/linux/shared/thread_types_public.h"
+#include "starboard/shared/uwp/application_uwp.h"
 
-#endif  // STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+using starboard::shared::uwp::ApplicationUwp;
+
+void SbSystemClearPlatformError(SbSystemPlatformError handle) {
+  ApplicationUwp::Get()->OnSbSystemClearPlatformError(handle);
+}
diff --git a/src/starboard/linux/x64x11/cpp11/thread_types_public.h b/src/starboard/shared/uwp/system_raise_platform_error.cc
similarity index 61%
copy from src/starboard/linux/x64x11/cpp11/thread_types_public.h
copy to src/starboard/shared/uwp/system_raise_platform_error.cc
index 9ab0ac3..e1cb395 100644
--- a/src/starboard/linux/x64x11/cpp11/thread_types_public.h
+++ b/src/starboard/shared/uwp/system_raise_platform_error.cc
@@ -12,9 +12,16 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
-#define STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+#include "starboard/system.h"
 
-#include "starboard/linux/shared/thread_types_public.h"
+#include "starboard/shared/uwp/application_uwp.h"
 
-#endif  // STARBOARD_LINUX_X64X11_CPP11_THREAD_TYPES_PUBLIC_H_
+using starboard::shared::uwp::ApplicationUwp;
+
+SbSystemPlatformError SbSystemRaisePlatformError(
+    SbSystemPlatformErrorType type,
+    SbSystemPlatformErrorCallback callback,
+    void* user_data) {
+  return ApplicationUwp::Get()->OnSbSystemRaisePlatformError(
+      type, callback, user_data);
+}
diff --git a/src/starboard/shared/win32/audio_sink.cc b/src/starboard/shared/win32/audio_sink.cc
index 66597c9..cc7b530 100644
--- a/src/starboard/shared/win32/audio_sink.cc
+++ b/src/starboard/shared/win32/audio_sink.cc
@@ -33,6 +33,8 @@
 void CHECK_HRESULT_OK(HRESULT hr) {
   SB_DCHECK(SUCCEEDED(hr)) << std::hex << hr;
 }
+
+const int kMaxBuffersSubmittedPerLoop = 2;
 }
 
 namespace starboard {
@@ -162,6 +164,7 @@
 
   int submitted_frames = 0;
   uint64_t samples_played = 0;
+  int queued_buffers = 0;
   for (;;) {
     {
       ScopedLock lock(mutex_);
@@ -188,13 +191,17 @@
     int unsubmitted_frames = frames_in_buffer - submitted_frames;
     int unsubmitted_start =
         (offset_in_frames + submitted_frames) % frame_buffers_size_in_frames_;
-    if (unsubmitted_frames == 0) {
+    if (unsubmitted_frames == 0 ||
+        queued_buffers +
+            kMaxBuffersSubmittedPerLoop > XAUDIO2_MAX_QUEUED_BUFFERS) {
       // submit nothing
     } else if (unsubmitted_start + unsubmitted_frames <=
                frame_buffers_size_in_frames_) {
       SubmitSourceBuffer(unsubmitted_start, unsubmitted_frames);
     } else {
       int count_tail_frames = frame_buffers_size_in_frames_ - unsubmitted_start;
+      // Note since we can submit up to two source buffers at a time,
+      // kMaxBuffersSubmittedPerLoop = 2.
       SubmitSourceBuffer(unsubmitted_start, count_tail_frames);
       SubmitSourceBuffer(0, unsubmitted_frames - count_tail_frames);
     }
@@ -213,6 +220,7 @@
     consume_frame_func_(consumed_frames_int, context_);
     submitted_frames -= consumed_frames_int;
     samples_played = voice_state.SamplesPlayed;
+    queued_buffers = voice_state.BuffersQueued;
   }
 }
 
@@ -265,13 +273,13 @@
   WAVEFORMATEX wfx;
 
   wfx.wFormatTag = SampleTypeToFormatTag(audio_sample_type);
-  wfx.nChannels = channels;
+  wfx.nChannels = static_cast<WORD>(channels);
   wfx.nSamplesPerSec = sampling_frequency_hz;
   wfx.nAvgBytesPerSec = channels *
                         SampleTypeToBitsPerSample(audio_sample_type) *
                         sampling_frequency_hz / 8;
   wfx.wBitsPerSample = SampleTypeToBitsPerSample(audio_sample_type);
-  wfx.nBlockAlign = (channels * wfx.wBitsPerSample) / 8;
+  wfx.nBlockAlign = static_cast<WORD>((channels * wfx.wBitsPerSample) / 8);
   wfx.cbSize = 0;
 
   return new XAudioAudioSink(
diff --git a/src/starboard/shared/win32/error_utils.cc b/src/starboard/shared/win32/error_utils.cc
index 5a279ae..d152821 100644
--- a/src/starboard/shared/win32/error_utils.cc
+++ b/src/starboard/shared/win32/error_utils.cc
@@ -17,12 +17,141 @@
 
 #include "starboard/shared/win32/error_utils.h"
 
+#include <Mfapi.h>
+#include <Mferror.h>
+#include <propvarutil.h>
+
+#include <utility>
+
 #include "starboard/log.h"
 #include "starboard/shared/win32/wchar_utils.h"
 
 namespace starboard {
 namespace shared {
 namespace win32 {
+namespace {
+
+std::string GetFormatHresultMessage(HRESULT hr) {
+  std::stringstream ss;
+  LPWSTR error_message;
+  int message_size = FormatMessage(
+      FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER |
+          FORMAT_MESSAGE_IGNORE_INSERTS,
+      nullptr,  // Unused with FORMAT_MESSAGE_FROM_SYSTEM.
+      hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+      (LPTSTR)&error_message,
+      0,  // Minimum size for output buffer.
+      nullptr);
+  SB_DCHECK(message_size);
+  ss << wchar_tToUTF8(error_message);
+  LocalFree(error_message);
+  return ss.str();
+}
+
+
+#define MAKE_HR_PAIR(X) std::pair<HRESULT, std::string>(X, #X)
+const std::pair<HRESULT, std::string> kHresultValueStrings[] = {
+  MAKE_HR_PAIR(S_OK),
+  MAKE_HR_PAIR(MF_E_PLATFORM_NOT_INITIALIZED),
+  MAKE_HR_PAIR(MF_E_BUFFERTOOSMALL),
+  MAKE_HR_PAIR(MF_E_INVALIDREQUEST),
+  MAKE_HR_PAIR(MF_E_INVALIDSTREAMNUMBER),
+  MAKE_HR_PAIR(MF_E_INVALIDMEDIATYPE),
+  MAKE_HR_PAIR(MF_E_NOTACCEPTING),
+  MAKE_HR_PAIR(MF_E_NOT_INITIALIZED),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_REPRESENTATION),
+  MAKE_HR_PAIR(MF_E_NO_MORE_TYPES),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_SERVICE),
+  MAKE_HR_PAIR(MF_E_UNEXPECTED),
+  MAKE_HR_PAIR(MF_E_INVALIDNAME),
+  MAKE_HR_PAIR(MF_E_INVALIDTYPE),
+  MAKE_HR_PAIR(MF_E_INVALID_FILE_FORMAT),
+  MAKE_HR_PAIR(MF_E_INVALIDINDEX),
+  MAKE_HR_PAIR(MF_E_INVALID_TIMESTAMP),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_SCHEME),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_BYTESTREAM_TYPE),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_TIME_FORMAT),
+  MAKE_HR_PAIR(MF_E_NO_SAMPLE_TIMESTAMP),
+  MAKE_HR_PAIR(MF_E_NO_SAMPLE_DURATION),
+  MAKE_HR_PAIR(MF_E_INVALID_STREAM_DATA),
+  MAKE_HR_PAIR(MF_E_RT_UNAVAILABLE),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_RATE),
+  MAKE_HR_PAIR(MF_E_THINNING_UNSUPPORTED),
+  MAKE_HR_PAIR(MF_E_REVERSE_UNSUPPORTED),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_RATE_TRANSITION),
+  MAKE_HR_PAIR(MF_E_RATE_CHANGE_PREEMPTED),
+  MAKE_HR_PAIR(MF_E_NOT_FOUND),
+  MAKE_HR_PAIR(MF_E_NOT_AVAILABLE),
+  MAKE_HR_PAIR(MF_E_NO_CLOCK),
+  MAKE_HR_PAIR(MF_S_MULTIPLE_BEGIN),
+  MAKE_HR_PAIR(MF_E_MULTIPLE_BEGIN),
+  MAKE_HR_PAIR(MF_E_MULTIPLE_SUBSCRIBERS),
+  MAKE_HR_PAIR(MF_E_TIMER_ORPHANED),
+  MAKE_HR_PAIR(MF_E_STATE_TRANSITION_PENDING),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_STATE_TRANSITION),
+  MAKE_HR_PAIR(MF_E_UNRECOVERABLE_ERROR_OCCURRED),
+  MAKE_HR_PAIR(MF_E_SAMPLE_HAS_TOO_MANY_BUFFERS),
+  MAKE_HR_PAIR(MF_E_SAMPLE_NOT_WRITABLE),
+  MAKE_HR_PAIR(MF_E_INVALID_KEY),
+  MAKE_HR_PAIR(MF_E_BAD_STARTUP_VERSION),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_CAPTION),
+  MAKE_HR_PAIR(MF_E_INVALID_POSITION),
+  MAKE_HR_PAIR(MF_E_ATTRIBUTENOTFOUND),
+  MAKE_HR_PAIR(MF_E_PROPERTY_TYPE_NOT_ALLOWED),
+  MAKE_HR_PAIR(MF_E_TOPO_INVALID_OPTIONAL_NODE),
+  MAKE_HR_PAIR(MF_E_TOPO_CANNOT_FIND_DECRYPTOR),
+  MAKE_HR_PAIR(MF_E_TOPO_CODEC_NOT_FOUND),
+  MAKE_HR_PAIR(MF_E_TOPO_CANNOT_CONNECT),
+  MAKE_HR_PAIR(MF_E_TOPO_UNSUPPORTED),
+  MAKE_HR_PAIR(MF_E_TOPO_INVALID_TIME_ATTRIBUTES),
+  MAKE_HR_PAIR(MF_E_TOPO_LOOPS_IN_TOPOLOGY),
+  MAKE_HR_PAIR(MF_E_TOPO_MISSING_PRESENTATION_DESCRIPTOR),
+  MAKE_HR_PAIR(MF_E_TOPO_MISSING_STREAM_DESCRIPTOR),
+  MAKE_HR_PAIR(MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED),
+  MAKE_HR_PAIR(MF_E_TOPO_MISSING_SOURCE),
+  MAKE_HR_PAIR(MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_TYPE_NOT_SET),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_STREAM_CHANGE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_INPUT_REMAINING),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROFILE_MISSING),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROFILE_INVALID_OR_CORRUPT),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROFILE_TRUNCATED),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_PID_NOT_RECOGNIZED),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_VARIANT_TYPE_WRONG),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_NOT_WRITEABLE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_ARRAY_VALUE_WRONG_NUM_DIM),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_VALUE_SIZE_WRONG),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_VALUE_OUT_OF_RANGE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_PROPERTY_VALUE_INCOMPATIBLE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_OUTPUT_MEDIATYPE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_INPUT_MEDIATYPE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_CONFLICTS_WITH_OTHER_CURRENTLY_ENABLED_FEATURES),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_NEED_MORE_INPUT),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_SPKR_CONFIG),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING),
+  MAKE_HR_PAIR(MF_S_TRANSFORM_DO_NOT_PROPAGATE_EVENT),
+  MAKE_HR_PAIR(MF_E_UNSUPPORTED_D3D_TYPE),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_ASYNC_LOCKED),
+  MAKE_HR_PAIR(MF_E_TRANSFORM_CANNOT_INITIALIZE_ACM_DRIVER),
+};
+#undef MAKE_HR_PAIR
+
+bool FindHResultEnumString(HRESULT hr, std::string* output) {
+  const size_t n = sizeof(kHresultValueStrings) /
+                   sizeof(*kHresultValueStrings);
+
+  for (auto i = 0; i < n; ++i) {
+    const auto& elems = kHresultValueStrings[i];
+    if (hr == elems.first) {
+      *output = elems.second;
+      return true;
+    }
+  }
+  return false;
+}
+
+}
 
 std::ostream& operator<<(std::ostream& os, const Win32ErrorCode& error_code) {
   LPWSTR error_message;
@@ -51,6 +180,20 @@
 #endif  // defined(_DEBUG)
 }
 
+std::string HResultToString(HRESULT hr) {
+  std::string enum_str;
+  bool has_enum_str = FindHResultEnumString(hr, &enum_str);
+  std::string error_message = GetFormatHresultMessage(hr);
+
+  std::stringstream ss;
+  if (has_enum_str) {
+    ss << enum_str << ": ";
+  }
+
+  ss << "\"" << error_message << "\"";
+  return ss.str();
+}
+
 }  // namespace win32
 }  // namespace shared
 }  // namespace starboard
diff --git a/src/starboard/shared/win32/error_utils.h b/src/starboard/shared/win32/error_utils.h
index 2a7dcfb..173dd53 100644
--- a/src/starboard/shared/win32/error_utils.h
+++ b/src/starboard/shared/win32/error_utils.h
@@ -1,49 +1,59 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Not breaking these functions up because however one is implemented, the
-// others should be implemented similarly.
-
-#ifndef STARBOARD_SHARED_WIN32_ERROR_UTILS_H_
-#define STARBOARD_SHARED_WIN32_ERROR_UTILS_H_
-
-#include <windows.h>
-
-#include <iostream>
-
-namespace starboard {
-namespace shared {
-namespace win32 {
-
-class Win32ErrorCode {
- public:
-  explicit Win32ErrorCode(DWORD error_code) : error_code_(error_code) {}
-
-  HRESULT GetHRESULT() const { return HRESULT_FROM_WIN32(error_code_); }
-
- private:
-  DWORD error_code_;
-};
-
-std::ostream& operator<<(std::ostream& os, const Win32ErrorCode& error_code);
-
-// Checks for system errors and logs a human-readable error if GetLastError()
-// returns an error code. Noops on non-debug builds.
-void DebugLogWinError();
-
-}  // namespace win32
-}  // namespace shared
-}  // namespace starboard
-
-#endif  // STARBOARD_SHARED_WIN32_ERROR_UTILS_H_
+// Copyright 2017 Google Inc. All Rights Reserved.

+//

+// Licensed under the Apache License, Version 2.0 (the "License");

+// you may not use this file except in compliance with the License.

+// You may obtain a copy of the License at

+//

+//     http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

+// Not breaking these functions up because however one is implemented, the

+// others should be implemented similarly.

+

+#ifndef STARBOARD_SHARED_WIN32_ERROR_UTILS_H_

+#define STARBOARD_SHARED_WIN32_ERROR_UTILS_H_

+

+#include <windows.h>

+

+#include <iostream>

+#include <string>

+

+#include "starboard/log.h"

+

+namespace starboard {

+namespace shared {

+namespace win32 {

+

+class Win32ErrorCode {

+ public:

+  explicit Win32ErrorCode(DWORD error_code) : error_code_(error_code) {}

+

+  HRESULT GetHRESULT() const { return HRESULT_FROM_WIN32(error_code_); }

+

+ private:

+  DWORD error_code_;

+};

+

+std::ostream& operator<<(std::ostream& os, const Win32ErrorCode& error_code);

+

+// Checks for system errors and logs a human-readable error if GetLastError()

+// returns an error code. Noops on non-debug builds.

+void DebugLogWinError();

+

+std::string HResultToString(HRESULT hr);

+

+inline void CheckResult(HRESULT hr) {
+  SB_DCHECK(SUCCEEDED(hr)) << "HRESULT was " << std::hex << hr
+      << " which translates to\n---> \"" << HResultToString(hr) << "\"";
+}

+

+}  // namespace win32

+}  // namespace shared

+}  // namespace starboard

+

+#endif  // STARBOARD_SHARED_WIN32_ERROR_UTILS_H_

diff --git a/src/starboard/shared/win32/memory_map.cc b/src/starboard/shared/win32/memory_map.cc
index 8ec19f5..8624e3a 100644
--- a/src/starboard/shared/win32/memory_map.cc
+++ b/src/starboard/shared/win32/memory_map.cc
@@ -19,15 +19,19 @@
 #include "starboard/log.h"
 
 void* SbMemoryMap(int64_t size_bytes, int flags, const char* name) {
+  SB_UNREFERENCED_PARAMETER(name);
   if (size_bytes == 0) {
     return SB_MEMORY_MAP_FAILED;
   }
-  ULONG protect;
+  ULONG protect = PAGE_NOACCESS;
   // |flags| is a bitmask of SbMemoryMapFlags, but |protect| is not a bitmask.
   switch (flags) {
     case kSbMemoryMapProtectRead:
       protect = PAGE_READONLY;
       break;
+    case kSbMemoryMapProtectWrite:
+      // Windows does not provide write only mode privileges
+      // are escalated to read/write.
     case kSbMemoryMapProtectReadWrite:
       protect = PAGE_READWRITE;
       break;
diff --git a/src/starboard/shared/win32/once.cc b/src/starboard/shared/win32/once.cc
index 2a31d3a..970916c 100644
--- a/src/starboard/shared/win32/once.cc
+++ b/src/starboard/shared/win32/once.cc
@@ -20,6 +20,8 @@
 BOOL CALLBACK OnceTrampoline(PINIT_ONCE once_control,
                              void* parameter,
                              void** context) {
+  SB_UNREFERENCED_PARAMETER(context);
+  SB_UNREFERENCED_PARAMETER(once_control);
   static_cast<SbOnceInitRoutine>(parameter)();
   return true;
 }
diff --git a/src/starboard/shared/win32/socket_set_tcp_keep_alive.cc b/src/starboard/shared/win32/socket_set_tcp_keep_alive.cc
index aca24ef..82820c9 100644
--- a/src/starboard/shared/win32/socket_set_tcp_keep_alive.cc
+++ b/src/starboard/shared/win32/socket_set_tcp_keep_alive.cc
@@ -16,11 +16,13 @@
 
 #include <winsock2.h>
 
+#include "starboard/log.h"
 #include "starboard/shared/win32/socket_internal.h"
 
 namespace sbwin32 = starboard::shared::win32;
 
 bool SbSocketSetTcpKeepAlive(SbSocket socket, bool value, SbTime period) {
+  SB_UNREFERENCED_PARAMETER(period);
   const DWORD should_set_keepalive = value;
   bool result = sbwin32::SetBooleanSocketOption(
       socket, SOL_SOCKET, SO_KEEPALIVE, "SO_KEEPALIVE", value);
diff --git a/src/starboard/shared/win32/thread_set_name.cc b/src/starboard/shared/win32/thread_set_name.cc
index aca4ad2..1a7db98 100644
--- a/src/starboard/shared/win32/thread_set_name.cc
+++ b/src/starboard/shared/win32/thread_set_name.cc
@@ -62,5 +62,5 @@
   // We store the thread name in our own TLS context as well as telling
   // the OS because it's much easier to retrieve from our own TLS context.
   thread_private->name_ = name;
-  SetThreadName(-1, name);
+  SetThreadName(static_cast<DWORD>(-1), name);
 }
diff --git a/src/starboard/shared/win32/time_zone_get_name.cc b/src/starboard/shared/win32/time_zone_get_name.cc
index 6b2be53..def88fb 100644
--- a/src/starboard/shared/win32/time_zone_get_name.cc
+++ b/src/starboard/shared/win32/time_zone_get_name.cc
@@ -29,7 +29,7 @@
  private:
   TimeZoneString() {
     DYNAMIC_TIME_ZONE_INFORMATION time_zone_info;
-    DWORD zone_id = GetDynamicTimeZoneInformation(&time_zone_info);
+    GetDynamicTimeZoneInformation(&time_zone_info);
 
     std::wstring wide_string = time_zone_info.TimeZoneKeyName;
     value_ = starboard::shared::win32::wchar_tToUTF8(wide_string.c_str());
diff --git a/src/starboard/shared/x11/application_x11.cc b/src/starboard/shared/x11/application_x11.cc
index 9e11f7c..19fb1f2 100644
--- a/src/starboard/shared/x11/application_x11.cc
+++ b/src/starboard/shared/x11/application_x11.cc
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #define XK_3270  // for XK_3270_BackTab
 #include <X11/keysym.h>
+#include <X11/Xatom.h>
 #include <X11/XF86keysym.h>
 #include <X11/XKBlib.h>
 #include <X11/Xlib.h>
@@ -27,6 +28,7 @@
 #include <algorithm>
 #include <iomanip>
 
+#include "starboard/common/scoped_ptr.h"
 #include "starboard/event.h"
 #include "starboard/input.h"
 #include "starboard/key.h"
@@ -714,7 +716,8 @@
       composite_event_id_(kSbEventIdInvalid),
       frame_read_index_(0),
       frame_written_(false),
-      display_(NULL) {
+      display_(NULL),
+      paste_buffer_key_release_pending_(false) {
   SbAudioSinkPrivate::Initialize();
 }
 
@@ -848,6 +851,11 @@
 
   XEvent x_event;
 
+  shared::starboard::Application::Event* pending_event = GetPendingEvent();
+  if (pending_event) {
+    return pending_event;
+  }
+
   if (XNextEventTimed(display_, &x_event, time)) {
     return XEventToEvent(&x_event);
   } else {
@@ -909,6 +917,198 @@
   wm_delete_atom_ = None;
 }
 
+shared::starboard::Application::Event* ApplicationX11::GetPendingEvent() {
+  typedef struct {
+    SbKey key;
+    unsigned int modifiers;
+  } KeyModifierData;
+
+  static const KeyModifierData ASCIIKeyModifierMap[] = {
+      // 0x00 ... 0x0F
+      /* .0 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .1 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .2 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .3 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .4 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .5 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .6 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .7 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .8 */ {kSbKeyBackspace, kSbKeyModifiersNone},
+      /* .9 */ {kSbKeyTab, kSbKeyModifiersNone},
+      /* .A */ {kSbKeyBacktab, kSbKeyModifiersNone},
+      /* .B */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .C */ {kSbKeyClear, kSbKeyModifiersNone},
+      /* .D */ {kSbKeyReturn, kSbKeyModifiersNone},
+      /* .E */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .F */ {kSbKeyUnknown, kSbKeyModifiersNone},
+
+      // 0x10 ... 0x1F
+      /* .0 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .1 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .2 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .3 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .4 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .5 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .6 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .7 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .8 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .9 */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .A */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .B */ {kSbKeyEscape, kSbKeyModifiersNone},
+      /* .C */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .D */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .E */ {kSbKeyUnknown, kSbKeyModifiersNone},
+      /* .F */ {kSbKeyUnknown, kSbKeyModifiersNone},
+
+      // 0x20 ... 0x2F
+      /* .0 */ {kSbKeySpace, kSbKeyModifiersNone},
+      /* .1 */ {kSbKey1, kSbKeyModifiersShift},
+      /* .2 */ {kSbKeyOem7, kSbKeyModifiersShift},
+      /* .3 */ {kSbKey3, kSbKeyModifiersShift},
+      /* .4 */ {kSbKey4, kSbKeyModifiersShift},
+      /* .5 */ {kSbKey5, kSbKeyModifiersShift},
+      /* .6 */ {kSbKey7, kSbKeyModifiersShift},
+      /* .7 */ {kSbKeyOem7, kSbKeyModifiersNone},
+      /* .8 */ {kSbKey9, kSbKeyModifiersShift},
+      /* .9 */ {kSbKey0, kSbKeyModifiersShift},
+      /* .A */ {kSbKey8, kSbKeyModifiersShift},
+      /* .B */ {kSbKeyOemPlus, kSbKeyModifiersShift},
+      /* .C */ {kSbKeyOemComma, kSbKeyModifiersNone},
+      /* .D */ {kSbKeyOemMinus, kSbKeyModifiersNone},
+      /* .E */ {kSbKeyOemPeriod, kSbKeyModifiersNone},
+      /* .F */ {kSbKeyOem2, kSbKeyModifiersNone},
+
+      // 0x30 ... 0x3F
+      /* .0 */ {kSbKey0, kSbKeyModifiersNone},
+      /* .1 */ {kSbKey1, kSbKeyModifiersNone},
+      /* .2 */ {kSbKey2, kSbKeyModifiersNone},
+      /* .3 */ {kSbKey3, kSbKeyModifiersNone},
+      /* .4 */ {kSbKey4, kSbKeyModifiersNone},
+      /* .5 */ {kSbKey5, kSbKeyModifiersNone},
+      /* .6 */ {kSbKey6, kSbKeyModifiersNone},
+      /* .7 */ {kSbKey7, kSbKeyModifiersNone},
+      /* .8 */ {kSbKey8, kSbKeyModifiersNone},
+      /* .9 */ {kSbKey9, kSbKeyModifiersNone},
+      /* .A */ {kSbKeyOem1, kSbKeyModifiersShift},
+      /* .B */ {kSbKeyOem1, kSbKeyModifiersNone},
+      /* .C */ {kSbKeyOemComma, kSbKeyModifiersShift},
+      /* .D */ {kSbKeyOemPlus, kSbKeyModifiersNone},
+      /* .E */ {kSbKeyOemPeriod, kSbKeyModifiersShift},
+      /* .F */ {kSbKeyOem2, kSbKeyModifiersShift},
+
+      // 0x40 ... 0x4F
+      /* .0 */ {kSbKey2, kSbKeyModifiersShift},
+      /* .1 */ {kSbKeyA, kSbKeyModifiersShift},
+      /* .2 */ {kSbKeyB, kSbKeyModifiersShift},
+      /* .3 */ {kSbKeyC, kSbKeyModifiersShift},
+      /* .4 */ {kSbKeyD, kSbKeyModifiersShift},
+      /* .5 */ {kSbKeyE, kSbKeyModifiersShift},
+      /* .6 */ {kSbKeyF, kSbKeyModifiersShift},
+      /* .7 */ {kSbKeyG, kSbKeyModifiersShift},
+      /* .8 */ {kSbKeyH, kSbKeyModifiersShift},
+      /* .9 */ {kSbKeyI, kSbKeyModifiersShift},
+      /* .A */ {kSbKeyJ, kSbKeyModifiersShift},
+      /* .B */ {kSbKeyK, kSbKeyModifiersShift},
+      /* .C */ {kSbKeyL, kSbKeyModifiersShift},
+      /* .D */ {kSbKeyM, kSbKeyModifiersShift},
+      /* .E */ {kSbKeyN, kSbKeyModifiersShift},
+      /* .F */ {kSbKeyO, kSbKeyModifiersShift},
+
+      // 0x50 ... 0x5F
+      /* .0 */ {kSbKeyP, kSbKeyModifiersShift},
+      /* .1 */ {kSbKeyQ, kSbKeyModifiersShift},
+      /* .2 */ {kSbKeyR, kSbKeyModifiersShift},
+      /* .3 */ {kSbKeyS, kSbKeyModifiersShift},
+      /* .4 */ {kSbKeyT, kSbKeyModifiersShift},
+      /* .5 */ {kSbKeyU, kSbKeyModifiersShift},
+      /* .6 */ {kSbKeyV, kSbKeyModifiersShift},
+      /* .7 */ {kSbKeyW, kSbKeyModifiersShift},
+      /* .8 */ {kSbKeyX, kSbKeyModifiersShift},
+      /* .9 */ {kSbKeyY, kSbKeyModifiersShift},
+      /* .A */ {kSbKeyZ, kSbKeyModifiersShift},
+      /* .B */ {kSbKeyOem4, kSbKeyModifiersNone},
+      /* .C */ {kSbKeyOem5, kSbKeyModifiersNone},
+      /* .D */ {kSbKeyOem6, kSbKeyModifiersNone},
+      /* .E */ {kSbKey6, kSbKeyModifiersShift},
+      /* .F */ {kSbKeyOemMinus, kSbKeyModifiersShift},
+
+      // 0x60 ... 0x6F
+      /* .0 */ {kSbKeyOem3, kSbKeyModifiersNone},
+      /* .1 */ {kSbKeyA, kSbKeyModifiersNone},
+      /* .2 */ {kSbKeyB, kSbKeyModifiersNone},
+      /* .3 */ {kSbKeyC, kSbKeyModifiersNone},
+      /* .4 */ {kSbKeyD, kSbKeyModifiersNone},
+      /* .5 */ {kSbKeyE, kSbKeyModifiersNone},
+      /* .6 */ {kSbKeyF, kSbKeyModifiersNone},
+      /* .7 */ {kSbKeyG, kSbKeyModifiersNone},
+      /* .8 */ {kSbKeyH, kSbKeyModifiersNone},
+      /* .9 */ {kSbKeyI, kSbKeyModifiersNone},
+      /* .A */ {kSbKeyJ, kSbKeyModifiersNone},
+      /* .B */ {kSbKeyK, kSbKeyModifiersNone},
+      /* .C */ {kSbKeyL, kSbKeyModifiersNone},
+      /* .D */ {kSbKeyM, kSbKeyModifiersNone},
+      /* .E */ {kSbKeyN, kSbKeyModifiersNone},
+      /* .F */ {kSbKeyO, kSbKeyModifiersNone},
+
+      // 0x70 ... 0x7F
+      /* .0 */ {kSbKeyP, kSbKeyModifiersNone},
+      /* .1 */ {kSbKeyQ, kSbKeyModifiersNone},
+      /* .2 */ {kSbKeyR, kSbKeyModifiersNone},
+      /* .3 */ {kSbKeyS, kSbKeyModifiersNone},
+      /* .4 */ {kSbKeyT, kSbKeyModifiersNone},
+      /* .5 */ {kSbKeyU, kSbKeyModifiersNone},
+      /* .6 */ {kSbKeyV, kSbKeyModifiersNone},
+      /* .7 */ {kSbKeyW, kSbKeyModifiersNone},
+      /* .8 */ {kSbKeyX, kSbKeyModifiersNone},
+      /* .9 */ {kSbKeyY, kSbKeyModifiersNone},
+      /* .A */ {kSbKeyZ, kSbKeyModifiersNone},
+      /* .B */ {kSbKeyOem4, kSbKeyModifiersShift},
+      /* .C */ {kSbKeyOem5, kSbKeyModifiersShift},
+      /* .D */ {kSbKeyOem6, kSbKeyModifiersShift},
+      /* .E */ {kSbKeyOem3, kSbKeyModifiersShift},
+      /* .F */ {kSbKeyUnknown, kSbKeyModifiersNone},
+  };
+
+  KeyModifierData key_modifiers;
+  unsigned char character;
+  while (!paste_buffer_pending_characters_.empty()) {
+    character = paste_buffer_pending_characters_.front();
+    if (character < SB_ARRAY_SIZE(ASCIIKeyModifierMap)) {
+      key_modifiers = ASCIIKeyModifierMap[character];
+      if (key_modifiers.key != kSbKeyUnknown) {
+        break;
+      }
+    }
+    paste_buffer_pending_characters_.pop();
+  }
+
+  if (paste_buffer_pending_characters_.empty()) {
+    return NULL;
+  }
+
+  if (paste_buffer_key_release_pending_) {
+    paste_buffer_pending_characters_.pop();
+  }
+
+  scoped_ptr<SbInputData> data(new SbInputData());
+  SbMemorySet(data.get(), 0, sizeof(*data));
+  data->window = windows_[0];
+  SB_DCHECK(SbWindowIsValid(data->window));
+  data->type = paste_buffer_key_release_pending_ ? kSbInputEventTypeUnpress
+                                                 : kSbInputEventTypePress;
+  data->device_type = kSbInputDeviceTypeKeyboard;
+  data->device_id = kKeyboardDeviceId;
+  data->key = key_modifiers.key;
+  data->key_location = kSbKeyLocationUnspecified;
+  data->key_modifiers = key_modifiers.modifiers;
+  data->position.x = 0;
+  data->position.y = 0;
+
+  paste_buffer_key_release_pending_ = !paste_buffer_key_release_pending_;
+  return new Event(kSbEventTypeInput, data.release(),
+                   &DeleteDestructor<SbInputData>);
+}
+
 shared::starboard::Application::Event* ApplicationX11::XEventToEvent(
     XEvent* x_event) {
   switch (x_event->type) {
@@ -933,39 +1133,65 @@
     case KeyRelease: {
       // User pressed key.
       XKeyEvent* x_key_event = reinterpret_cast<XKeyEvent*>(x_event);
-      SbInputData* data = new SbInputData();
-      SbMemorySet(data, 0, sizeof(*data));
+
+      SbKey key = XKeyEventToSbKey(x_key_event);
+      unsigned int key_modifiers =
+          XEventStateToSbKeyModifiers(x_key_event->state);
+
+      bool is_press_event = KeyPress == x_event->type;
+      bool is_paste_keypress = is_press_event &&
+                               (key_modifiers & kSbKeyModifiersCtrl) &&
+                               key == kSbKeyV;
+      is_paste_keypress |= is_press_event &&
+                           (key_modifiers & kSbKeyModifiersShift) &&
+                           key == kSbKeyInsert;
+      if (is_paste_keypress) {
+        // Handle Ctrl-V or Shift-Insert as paste.
+        const Atom xtarget = XInternAtom(x_key_event->display, "TEXT", 0);
+        // Request the paste buffer, which will be sent as a separate
+        // SelectionNotify XEvent.
+        XConvertSelection(x_key_event->display, XA_PRIMARY, xtarget, XA_PRIMARY,
+                          x_key_event->window, CurrentTime);
+        return NULL;
+      }
+
+      scoped_ptr<SbInputData> data(new SbInputData());
+      SbMemorySet(data.get(), 0, sizeof(*data));
       data->window = FindWindow(x_key_event->window);
       SB_DCHECK(SbWindowIsValid(data->window));
-      data->type = (x_event->type == KeyPress ? kSbInputEventTypePress
-                                              : kSbInputEventTypeUnpress);
+      data->type = x_event->type == KeyPress ? kSbInputEventTypePress
+                                             : kSbInputEventTypeUnpress;
       data->device_type = kSbInputDeviceTypeKeyboard;
       data->device_id = kKeyboardDeviceId;
-      data->key = XKeyEventToSbKey(x_key_event);
+      data->key = key;
+      data->key_modifiers = key_modifiers;
       data->key_location = XKeyEventToSbKeyLocation(x_key_event);
-      data->key_modifiers = XEventStateToSbKeyModifiers(x_key_event->state);
       data->position.x = x_key_event->x;
       data->position.y = x_key_event->y;
-      return new Event(kSbEventTypeInput, data, &DeleteDestructor<SbInputData>);
+      return new Event(kSbEventTypeInput, data.release(),
+                       &DeleteDestructor<SbInputData>);
     }
     case ButtonPress:
     case ButtonRelease: {
       XButtonEvent* x_button_event = reinterpret_cast<XButtonEvent*>(x_event);
-      SbInputData* data = new SbInputData();
-      SbMemorySet(data, 0, sizeof(*data));
+      bool is_press_event = ButtonPress == x_event->type;
+      bool is_wheel_event = XButtonEventIsWheelEvent(x_button_event);
+#if SB_API_VERSION >= SB_POINTER_INPUT_API_VERSION
+      if (is_wheel_event && !is_press_event) {
+        // unpress events from the wheel are discarded.
+        return NULL;
+      }
+#endif
+      scoped_ptr<SbInputData> data(new SbInputData());
+      SbMemorySet(data.get(), 0, sizeof(*data));
       data->window = FindWindow(x_button_event->window);
       SB_DCHECK(SbWindowIsValid(data->window));
       data->key = XButtonEventToSbKey(x_button_event);
-      bool is_press_event = ButtonPress == x_event->type;
       data->type =
           is_press_event ? kSbInputEventTypePress : kSbInputEventTypeUnpress;
       data->device_type = kSbInputDeviceTypeMouse;
-      if (XButtonEventIsWheelEvent(x_button_event)) {
+      if (is_wheel_event) {
 #if SB_API_VERSION >= SB_POINTER_INPUT_API_VERSION
-        if (!is_press_event) {
-          // unpress events from the wheel are discarded.
-          return NULL;
-        }
         data->pressure = NAN;
         data->size = {NAN, NAN};
         data->tilt = {NAN, NAN};
@@ -981,12 +1207,13 @@
       data->key_modifiers = XEventStateToSbKeyModifiers(x_button_event->state);
       data->position.x = x_button_event->x;
       data->position.y = x_button_event->y;
-      return new Event(kSbEventTypeInput, data, &DeleteDestructor<SbInputData>);
+      return new Event(kSbEventTypeInput, data.release(),
+                       &DeleteDestructor<SbInputData>);
     }
     case MotionNotify: {
       XMotionEvent* x_motion_event = reinterpret_cast<XMotionEvent*>(x_event);
-      SbInputData* data = new SbInputData();
-      SbMemorySet(data, 0, sizeof(*data));
+      scoped_ptr<SbInputData> data(new SbInputData());
+      SbMemorySet(data.get(), 0, sizeof(*data));
       data->window = FindWindow(x_motion_event->window);
       SB_DCHECK(SbWindowIsValid(data->window));
 #if SB_API_VERSION >= SB_POINTER_INPUT_API_VERSION
@@ -1000,7 +1227,8 @@
       data->key_modifiers = XEventStateToSbKeyModifiers(x_motion_event->state);
       data->position.x = x_motion_event->x;
       data->position.y = x_motion_event->y;
-      return new Event(kSbEventTypeInput, data, &DeleteDestructor<SbInputData>);
+      return new Event(kSbEventTypeInput, data.release(),
+                       &DeleteDestructor<SbInputData>);
     }
     case FocusIn: {
       Unpause(NULL, NULL);
@@ -1014,6 +1242,31 @@
       // Ignore window size, position, border, and stacking order events.
       return NULL;
     }
+    case SelectionNotify: {
+      XSelectionEvent* x_selection_event =
+          reinterpret_cast<XSelectionEvent*>(x_event);
+
+      unsigned long nitems = 0;       // NOLINT(runtime/int)
+      unsigned long bytes_after = 0;  // NOLINT(runtime/int)
+      int format = 0;
+      unsigned char* property = NULL;
+      Atom type = XA_PRIMARY;
+
+      if (XGetWindowProperty(x_selection_event->display,
+                             x_selection_event->requestor, XA_PRIMARY, 0, 4096,
+                             False, AnyPropertyType, &type, &format, &nitems,
+                             &bytes_after, &property)) {
+        return NULL;
+      }
+
+      if (property && nitems) {
+        for (unsigned char* ptr = property; *ptr; ++ptr) {
+          paste_buffer_pending_characters_.push(*ptr);
+        }
+      }
+      XFree(property);
+      break;
+    }
     default: {
       SB_DLOG(INFO) << "Unrecognized event type = " << x_event->type;
       break;
diff --git a/src/starboard/shared/x11/application_x11.h b/src/starboard/shared/x11/application_x11.h
index f61f8ba..a0235b1 100644
--- a/src/starboard/shared/x11/application_x11.h
+++ b/src/starboard/shared/x11/application_x11.h
@@ -17,6 +17,7 @@
 
 #include <X11/Xlib.h>
 
+#include <queue>
 #include <vector>
 
 #include "starboard/configuration.h"
@@ -87,6 +88,10 @@
   // Shuts X down.
   void StopX();
 
+  // Retreive the next pending event, such as keypresses from a paste buffer.
+  // Returns NULL if there are no pending events.
+  Event* GetPendingEvent();
+
   // Creates a new shared::Application::Event from an XEvent, passing ownership
   // of the Event to the caller.
   Event* XEventToEvent(XEvent* x_event);
@@ -106,6 +111,12 @@
 
   Display* display_;
   SbWindowVector windows_;
+
+  // Storage for characters pending from a clipboard paste.
+  std::queue<unsigned char> paste_buffer_pending_characters_;
+  // Indicates whether a key press event that requires a matching release has
+  // been dispatched.
+  bool paste_buffer_key_release_pending_;
 };
 
 }  // namespace x11
diff --git a/src/starboard/win/console/starboard_platform.gyp b/src/starboard/win/console/starboard_platform.gyp
index 134c3b2..ac1558d 100644
--- a/src/starboard/win/console/starboard_platform.gyp
+++ b/src/starboard/win/console/starboard_platform.gyp
@@ -19,9 +19,12 @@
       'configuration_public.h',
       'main.cc',
       'thread_types_public.h',
+      '<@(stub_media_player)',
       '../shared/system_get_path.cc',
       '<(DEPTH)/starboard/shared/starboard/queue_application.cc',
       '<(DEPTH)/starboard/shared/starboard/queue_application.h',
+      '<(DEPTH)/starboard/shared/stub/system_clear_platform_error.cc',
+      '<(DEPTH)/starboard/shared/stub/system_raise_platform_error.cc',
       '<(DEPTH)/starboard/shared/stub/system_request_pause.cc',
       '<(DEPTH)/starboard/shared/stub/system_request_stop.cc',
       '<(DEPTH)/starboard/shared/stub/system_request_suspend.cc',
diff --git a/src/starboard/win/shared/configuration_public.h b/src/starboard/win/shared/configuration_public.h
index 1d66e6c..98fecdd 100644
--- a/src/starboard/win/shared/configuration_public.h
+++ b/src/starboard/win/shared/configuration_public.h
@@ -20,7 +20,7 @@
 
 // The API version implemented by this platform. This will generally be set to
 // the current value of SB_MAXIMUM_API_VERSION at the time of implementation.
-#define SB_API_VERSION SB_EXPERIMENTAL_API_VERSION
+#define SB_API_VERSION 6
 
 // --- Architecture Configuration --------------------------------------------
 
diff --git a/src/starboard/win/shared/gyp_configuration.gypi b/src/starboard/win/shared/gyp_configuration.gypi
index 8a2ebfd..cee97a6 100644
--- a/src/starboard/win/shared/gyp_configuration.gypi
+++ b/src/starboard/win/shared/gyp_configuration.gypi
@@ -59,6 +59,8 @@
         'msvs_settings': {
           'VCLinkerTool': {
             'AdditionalDependencies': [
+              'mfplat.lib',
+              'mfuuid.lib',
               'windowsapp.lib',
             ],
             'AdditionalLibraryDirectories!': [
diff --git a/src/starboard/win/shared/starboard_platform.gypi b/src/starboard/win/shared/starboard_platform.gypi
index 2b520d0..7c80fad 100644
--- a/src/starboard/win/shared/starboard_platform.gypi
+++ b/src/starboard/win/shared/starboard_platform.gypi
@@ -14,6 +14,27 @@
 {
   'variables': {
     'sb_pedantic_warnings': 1,
+    'stub_media_player': [
+      '<(DEPTH)/starboard/shared/stub/player_create.cc',
+      '<(DEPTH)/starboard/shared/stub/player_destroy.cc',
+      '<(DEPTH)/starboard/shared/stub/player_get_current_frame.cc',
+      '<(DEPTH)/starboard/shared/stub/player_get_info.cc',
+      '<(DEPTH)/starboard/shared/stub/player_output_mode_supported.cc',
+      '<(DEPTH)/starboard/shared/stub/player_seek.cc',
+      '<(DEPTH)/starboard/shared/stub/player_set_bounds.cc',
+      '<(DEPTH)/starboard/shared/stub/player_set_pause.cc',
+      '<(DEPTH)/starboard/shared/stub/player_set_playback_rate.cc',
+      '<(DEPTH)/starboard/shared/stub/player_set_volume.cc',
+      '<(DEPTH)/starboard/shared/stub/player_write_end_of_stream.cc',
+      '<(DEPTH)/starboard/shared/stub/player_write_sample.cc',
+      '<(DEPTH)/starboard/shared/stub/media_can_play_mime_and_key_system.cc',
+      '<(DEPTH)/starboard/shared/stub/media_get_audio_configuration.cc',
+      '<(DEPTH)/starboard/shared/stub/media_get_audio_output_count.cc',
+      '<(DEPTH)/starboard/shared/stub/media_is_audio_supported.cc',
+      '<(DEPTH)/starboard/shared/stub/media_is_output_protected.cc',
+      '<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
+      '<(DEPTH)/starboard/shared/stub/media_is_video_supported.cc',
+    ],
   },
   'targets': [
     {
@@ -108,8 +129,6 @@
         '<(DEPTH)/starboard/shared/stub/cryptography_set_authenticated_data.cc',
         '<(DEPTH)/starboard/shared/stub/cryptography_set_initialization_vector.cc',
         '<(DEPTH)/starboard/shared/stub/cryptography_transform.cc',
-        '<(DEPTH)/starboard/shared/stub/decode_target_get_info.cc',
-        '<(DEPTH)/starboard/shared/stub/decode_target_release.cc',
         '<(DEPTH)/starboard/shared/stub/drm_close_session.cc',
         '<(DEPTH)/starboard/shared/stub/drm_create_system.cc',
         '<(DEPTH)/starboard/shared/stub/drm_destroy_system.cc',
@@ -118,13 +137,6 @@
         '<(DEPTH)/starboard/shared/stub/drm_update_session.cc',
         '<(DEPTH)/starboard/shared/stub/image_decode.cc',
         '<(DEPTH)/starboard/shared/stub/image_is_decode_supported.cc',
-        '<(DEPTH)/starboard/shared/stub/media_can_play_mime_and_key_system.cc',
-        '<(DEPTH)/starboard/shared/stub/media_get_audio_configuration.cc',
-        '<(DEPTH)/starboard/shared/stub/media_get_audio_output_count.cc',
-        '<(DEPTH)/starboard/shared/stub/media_is_audio_supported.cc',
-        '<(DEPTH)/starboard/shared/stub/media_is_output_protected.cc',
-        '<(DEPTH)/starboard/shared/stub/media_is_supported.cc',
-        '<(DEPTH)/starboard/shared/stub/media_is_video_supported.cc',
         '<(DEPTH)/starboard/shared/stub/media_set_output_protection.cc',
         '<(DEPTH)/starboard/shared/stub/microphone_close.cc',
         '<(DEPTH)/starboard/shared/stub/microphone_create.cc',
@@ -133,26 +145,12 @@
         '<(DEPTH)/starboard/shared/stub/microphone_is_sample_rate_supported.cc',
         '<(DEPTH)/starboard/shared/stub/microphone_open.cc',
         '<(DEPTH)/starboard/shared/stub/microphone_read.cc',
-        '<(DEPTH)/starboard/shared/stub/player_create.cc',
-        '<(DEPTH)/starboard/shared/stub/player_destroy.cc',
-        '<(DEPTH)/starboard/shared/stub/player_get_current_frame.cc',
-        '<(DEPTH)/starboard/shared/stub/player_get_info.cc',
-        '<(DEPTH)/starboard/shared/stub/player_output_mode_supported.cc',
-        '<(DEPTH)/starboard/shared/stub/player_seek.cc',
-        '<(DEPTH)/starboard/shared/stub/player_set_bounds.cc',
-        '<(DEPTH)/starboard/shared/stub/player_set_pause.cc',
-        '<(DEPTH)/starboard/shared/stub/player_set_playback_rate.cc',
-        '<(DEPTH)/starboard/shared/stub/player_set_volume.cc',
-        '<(DEPTH)/starboard/shared/stub/player_write_end_of_stream.cc',
-        '<(DEPTH)/starboard/shared/stub/player_write_sample.cc',
-        '<(DEPTH)/starboard/shared/stub/system_clear_platform_error.cc',
         '<(DEPTH)/starboard/shared/stub/system_get_stack.cc',
         '<(DEPTH)/starboard/shared/stub/system_get_total_gpu_memory.cc',
         '<(DEPTH)/starboard/shared/stub/system_get_used_gpu_memory.cc',
         '<(DEPTH)/starboard/shared/stub/system_has_capability.cc',
         '<(DEPTH)/starboard/shared/stub/system_hide_splash_screen.cc',
         '<(DEPTH)/starboard/shared/stub/system_is_debugger_attached.cc',
-        '<(DEPTH)/starboard/shared/stub/system_raise_platform_error.cc',
         '<(DEPTH)/starboard/shared/stub/system_symbolize.cc',
         '<(DEPTH)/starboard/shared/stub/time_zone_get_dst_name.cc',
         '<(DEPTH)/starboard/shared/win32/audio_sink.cc',
@@ -307,6 +305,23 @@
         # VS2017 always defines this for UWP apps
         '__WRL_NO_DEFAULT_LIB__',
       ],
+      'dependencies': [
+        'convert_i18n_data'
+      ]
     },
+    {
+      'target_name': 'convert_i18n_data',
+      'type': 'none',
+      'actions': [
+        {
+          'action_name': 'convert_i18n_data',
+          'variables': {
+            'input_files':
+              '<!(find <(DEPTH)/cobalt/content/i18n/platform/xb1/*.xlb)',
+          },
+          'includes': [ '../../build/convert_i18n_data.gypi' ],
+        },
+      ],
+    }
   ],
 }
diff --git a/src/third_party/angle/angle.gyp b/src/third_party/angle/angle.gyp
index 1bf5056..356d9cd 100644
--- a/src/third_party/angle/angle.gyp
+++ b/src/third_party/angle/angle.gyp
@@ -19,18 +19,6 @@
         'angle_link_glx%': 0,
         'angle_gl_library_type%': 'static_library',
         'dcheck_always_on%': 0,
-        'conditions':
-        [
-            ['OS=="linux" and use_x11==1 and chromeos==0',
-            {
-                'angle_enable_gl%': 1,
-                'angle_enable_vulkan%': 1,
-            }],
-            ['OS=="mac"',
-            {
-                'angle_enable_gl%': 1,
-            }],
-        ],
         'angle_enable_null%': 1, # Available on all platforms
     },
     'includes':
@@ -259,32 +247,6 @@
                         '<@(libangle_gpu_info_util_linux_sources)',
                     ],
                 }],
-                ['OS=="linux" and use_x11==1',
-                {
-                    'sources':
-                    [
-                        '<@(libangle_gpu_info_util_x11_sources)',
-                    ],
-                    'defines':
-                    [
-                        'GPU_INFO_USE_X11',
-                    ],
-                    'dependencies':
-                    [
-                        '<(DEPTH)/third_party/angle/src/third_party/libXNVCtrl/libXNVCtrl.gyp:libXNVCtrl',
-                    ],
-                    'link_settings':
-                    {
-                        'ldflags':
-                        [
-                            '<!@(<(pkg-config) --libs-only-L --libs-only-other x11 xi xext)',
-                        ],
-                        'libraries':
-                        [
-                            '<!@(<(pkg-config) --libs-only-l x11 xi xext) -ldl',
-                        ],
-                    },
-                }],
                 ['OS=="linux" and use_libpci==1',
                 {
                     'sources':
diff --git a/src/third_party/angle/gyp/common_defines.gypi b/src/third_party/angle/gyp/common_defines.gypi
index fc2b7b9..e489f05 100644
--- a/src/third_party/angle/gyp/common_defines.gypi
+++ b/src/third_party/angle/gyp/common_defines.gypi
@@ -18,15 +18,7 @@
         # - EGL_PLATFORM_SURFACELESS because there are no native windows
         'use_ozone%': 0,
 
-        'conditions':
-        [
-            ['OS=="linux" and use_x11==1 and chromeos==0', {
-                'angle_use_glx%': 1,
-            },
-            {
-                'angle_use_glx%': 0,
-            }],
-        ],
+        'angle_use_glx%': 0,
 
         # root of the OSX SDK for Chromium builds, the system root for standalone builds
         'SDKROOT%': "",
diff --git a/src/third_party/angle/gyp/standalone.gypi b/src/third_party/angle/gyp/standalone.gypi
index f18cc04..7cc789b 100644
--- a/src/third_party/angle/gyp/standalone.gypi
+++ b/src/third_party/angle/gyp/standalone.gypi
@@ -5,11 +5,6 @@
 {
     'variables':
     {
-        # chromeos=1 is used in some build configurations to disable GL
-        # and GLX code because it typically wouldn't build for Chrome OS.
-        # It does not mean "enable Chrome OS code."
-        'chromeos': 0,
-
         # Chrome OS chroot builds need a special pkg-config, so make it possible to change.
         'pkg-config%': 'pkg-config',
 
@@ -21,22 +16,9 @@
             {
                 'use_ozone%': 0,
             },
-            'conditions':
-            [
-                ['OS=="linux" and use_ozone==0',
-                {
-                    'use_x11': 1,
-                },
-                {
-                    'use_x11': 0,
-                }],
-            ],
 
             # Copy conditionally-set variables out one scope.
             'use_ozone%': '<(use_ozone)',
         },
-
-        # Copy conditionally-set variables out one scope.
-        'use_x11%': '<(use_x11)',
     },
 }
diff --git a/src/third_party/angle/src/angle.gyp b/src/third_party/angle/src/angle.gyp
index 36623f6..6d6aa1d 100644
--- a/src/third_party/angle/src/angle.gyp
+++ b/src/third_party/angle/src/angle.gyp
@@ -32,11 +32,6 @@
                 'angle_enable_hlsl%': 1,
                 'angle_enable_vulkan%': 1,
             }],
-            ['OS=="linux" and use_x11==1 and chromeos==0',
-            {
-                'angle_enable_gl%': 1,
-                'angle_enable_vulkan%': 1,
-            }],
             ['OS=="mac"',
             {
                 'angle_enable_gl%': 1,
@@ -278,32 +273,6 @@
                         '<@(libangle_gpu_info_util_linux_sources)',
                     ],
                 }],
-                ['OS=="linux" and use_x11==1',
-                {
-                    'sources':
-                    [
-                        '<@(libangle_gpu_info_util_x11_sources)',
-                    ],
-                    'defines':
-                    [
-                        'GPU_INFO_USE_X11',
-                    ],
-                    'dependencies':
-                    [
-                        '<(DEPTH)/src/third_party/libXNVCtrl/libXNVCtrl.gyp:libXNVCtrl',
-                    ],
-                    'link_settings':
-                    {
-                        'ldflags':
-                        [
-                            '<!@(<(pkg-config) --libs-only-L --libs-only-other x11 xi xext)',
-                        ],
-                        'libraries':
-                        [
-                            '<!@(<(pkg-config) --libs-only-l x11 xi xext) -ldl',
-                        ],
-                    },
-                }],
                 ['OS=="linux" and use_libpci==1',
                 {
                     'sources':
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/RendererD3D.h b/src/third_party/angle/src/libANGLE/renderer/d3d/RendererD3D.h
index 1e65249..8a68444 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/RendererD3D.h
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/RendererD3D.h
@@ -218,6 +218,7 @@
     virtual gl::Error generateMipmapUsingD3D(TextureStorage *storage,
                                              const gl::TextureState &textureState) = 0;
     virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) = 0;
+    virtual TextureStorage *createTextureStorage2D(IUnknown *texture, bool bindChroma) = 0;
     virtual TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
                                                          RenderTargetD3D *renderTargetD3D) = 0;
     virtual TextureStorage *createTextureStorageExternal(
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
index 4e3252d..d5ece5d 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
@@ -18,6 +18,12 @@
 #include <EGL/eglext.h>
 #include <algorithm>
 
+// {3C3A43AB-C69B-46C9-AA8D-B0CFFCD4596D}
+static const GUID kCobaltNv12BindChroma = {
+  0x3c3a43ab, 0xc69b, 0x46c9,
+  { 0xaa, 0x8d, 0xb0, 0xcf, 0xfc, 0xd4, 0x59, 0x6d }
+};
+
 namespace rx
 {
 
@@ -42,7 +48,9 @@
       mHeight(static_cast<EGLint>(attribs.get(EGL_HEIGHT, 0))),
       mSwapInterval(1),
       mShareHandle(0),
-      mD3DTexture(nullptr)
+      mD3DTexture(nullptr),
+      mBuftype(buftype),
+      mBindChroma(false)
 {
     if (window != nullptr && !mFixedSize)
     {
@@ -57,12 +65,19 @@
             break;
 
         case EGL_D3D_TEXTURE_ANGLE:
+        {
             mD3DTexture = static_cast<IUnknown *>(clientBuffer);
             ASSERT(mD3DTexture != nullptr);
             mD3DTexture->AddRef();
             mRenderer->getD3DTextureInfo(state.config, mD3DTexture, &mWidth, &mHeight,
                                          &mRenderTargetFormat);
+
+            UINT out;
+            HRESULT hr = static_cast<ID3D11DeviceChild*>(mD3DTexture)->
+                GetPrivateData(kCobaltNv12BindChroma, &out, nullptr);
+            mBindChroma = (SUCCEEDED(hr)) && (out != 0);
             break;
+        }
 
         default:
             break;
@@ -91,6 +106,18 @@
         }
     }
 
+    if (mBuftype == EGL_D3D_TEXTURE_ANGLE)
+    {
+        ID3D11Texture2D* d3Texture = static_cast<ID3D11Texture2D*>(mD3DTexture);
+
+        D3D11_TEXTURE2D_DESC texture_desc;
+        d3Texture->GetDesc(&texture_desc);
+        if ((texture_desc.BindFlags & D3D11_BIND_RENDER_TARGET) == 0)
+        {
+            return egl::Error(EGL_SUCCESS);
+        }
+    }
+
     egl::Error error = resetSwapChain();
     if (error.isError())
     {
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h b/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
index 3be2888..acc451a 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
@@ -57,6 +57,16 @@
                                         const gl::ImageIndex &imageIndex,
                                         FramebufferAttachmentRenderTarget **rtOut) override;
 
+    IUnknown *getD3DTexture() const
+    {
+        return mD3DTexture;
+    }
+
+    bool getBindChroma() const
+    {
+      return mBindChroma;
+    }
+
   protected:
     SurfaceD3D(const egl::SurfaceState &state,
                RendererD3D *renderer,
@@ -90,6 +100,8 @@
 
     HANDLE mShareHandle;
     IUnknown *mD3DTexture;
+    EGLenum mBuftype;
+    bool mBindChroma;
 };
 
 class WindowSurfaceD3D : public SurfaceD3D
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/third_party/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
index 5c33fc4..8a25f72 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -1174,7 +1174,11 @@
     SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
     ASSERT(surfaceD3D);
 
-    mTexStorage = mRenderer->createTextureStorage2D(surfaceD3D->getSwapChain());
+    if (surfaceD3D->getSwapChain() == nullptr)
+        mTexStorage = mRenderer->createTextureStorage2D(
+            surfaceD3D->getD3DTexture(), surfaceD3D->getBindChroma());
+    else
+        mTexStorage = mRenderer->createTextureStorage2D(surfaceD3D->getSwapChain());
     mEGLImageTarget = false;
 
     mDirtyImages = true;
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
index 1e70363..601f6ad 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
@@ -6,6 +6,7 @@
 // DebugAnnotator11.cpp: D3D11 helpers for adding trace annotations.
 //
 
+#include <D3D11_4.h>
 #include "libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h"
 
 #include "common/debug.h"
@@ -109,6 +110,11 @@
             mUserDefinedAnnotation = d3d11::DynamicCastComObject<ID3DUserDefinedAnnotation>(context);
             ASSERT(mUserDefinedAnnotation != nullptr);
             mInitialized = true;
+            ID3D11Multithread* multithread =
+                d3d11::DynamicCastComObject<ID3D11Multithread>(context);
+            ASSERT(multithread != nullptr);
+            multithread->SetMultithreadProtected(true);
+            SafeRelease(multithread);
         }
 
         SafeRelease(device);
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 4c544ce..f1c3712 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -6,6 +6,7 @@
 
 // Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer.
 
+#include <D3D11_4.h>
 #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
 
 #include <EGL/eglext.h>
@@ -784,6 +785,11 @@
         mDevice->GetImmediateContext(&mDeviceContext);
         mRenderer11DeviceCaps.featureLevel = mDevice->GetFeatureLevel();
     }
+    ID3D11Multithread* multithread =
+        d3d11::DynamicCastComObject<ID3D11Multithread>(mDeviceContext);
+    ASSERT(multithread != nullptr);
+    multithread->SetMultithreadProtected(true);
+    SafeRelease(multithread);
 
     d3d11::SetDebugName(mDeviceContext, "DeviceContext");
 
@@ -1295,6 +1301,7 @@
         case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
         case DXGI_FORMAT_R16G16B16A16_FLOAT:
         case DXGI_FORMAT_R32G32B32A32_FLOAT:
+        case DXGI_FORMAT_NV12:
             break;
 
         default:
@@ -4031,6 +4038,11 @@
     return new TextureStorage11_2D(this, swapChain11);
 }
 
+TextureStorage *Renderer11::createTextureStorage2D(IUnknown *texture, bool bindChroma)
+{
+    return new TextureStorage11_2D(this, texture, bindChroma);
+}
+
 TextureStorage *Renderer11::createTextureStorageEGLImage(EGLImageD3D *eglImage,
                                                          RenderTargetD3D *renderTargetD3D)
 {
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
index 7bd881f..e95ab1f 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
@@ -263,6 +263,7 @@
     gl::Error generateMipmapUsingD3D(TextureStorage *storage,
                                      const gl::TextureState &textureState) override;
     TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) override;
+    TextureStorage *createTextureStorage2D(IUnknown *texture, bool bindChroma) override;
     TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
                                                  RenderTargetD3D *renderTargetD3D) override;
     TextureStorage *createTextureStorageExternal(
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index df04525..066dd92 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -713,7 +713,37 @@
       mLevelZeroTexture(nullptr),
       mLevelZeroRenderTarget(nullptr),
       mUseLevelZeroTexture(false),
-      mSwizzleTexture(nullptr)
+      mSwizzleTexture(nullptr),
+      mBindChroma(false)
+{
+    mTexture->AddRef();
+
+    for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        mAssociatedImages[i]     = nullptr;
+        mRenderTarget[i]         = nullptr;
+    }
+
+    D3D11_TEXTURE2D_DESC texDesc;
+    mTexture->GetDesc(&texDesc);
+    mMipLevels     = texDesc.MipLevels;
+    mTextureWidth  = texDesc.Width;
+    mTextureHeight = texDesc.Height;
+    mTextureDepth  = 1;
+    mHasKeyedMutex = (texDesc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer, IUnknown *texture, bool bindChroma)
+    : TextureStorage11(renderer,
+                       0,
+                       0,
+                       0),
+      mTexture(static_cast<ID3D11Texture2D*>(texture)),
+      mLevelZeroTexture(nullptr),
+      mLevelZeroRenderTarget(nullptr),
+      mUseLevelZeroTexture(false),
+      mSwizzleTexture(nullptr),
+      mBindChroma(bindChroma)
 {
     mTexture->AddRef();
 
@@ -1161,6 +1191,23 @@
     srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
     srvDesc.Texture2D.MipLevels       = mipLevels;
 
+    ID3D11Texture2D* d3Texture;
+    HRESULT hr = texture->QueryInterface(IID_PPV_ARGS(&d3Texture));
+
+    if (S_OK == hr)
+    {
+        D3D11_TEXTURE2D_DESC texture_desc;
+        d3Texture->GetDesc(&texture_desc);
+        if (texture_desc.Format == DXGI_FORMAT_NV12)
+        {
+            if (mBindChroma)
+                srvDesc.Format = DXGI_FORMAT_R8G8_UNORM;
+            else
+                srvDesc.Format = DXGI_FORMAT_R8_UNORM;
+        }
+        d3Texture->Release();
+    }
+
     ID3D11Resource *srvTexture = texture;
 
     if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
index 195d432..2df906b 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
@@ -154,6 +154,7 @@
 {
   public:
     TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain);
+    TextureStorage11_2D(Renderer11 *renderer, IUnknown *texture, bool bindChroma);
     TextureStorage11_2D(Renderer11 *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly = false);
     ~TextureStorage11_2D() override;
 
@@ -207,6 +208,7 @@
     d3d11::RenderTargetView mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
 
     Image11 *mAssociatedImages[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+    bool mBindChroma;
 };
 
 class TextureStorage11_External : public TextureStorage11
diff --git a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
index 02513cf..e15c766 100644
--- a/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
@@ -106,8 +106,6 @@
             break;
         case DXGI_FORMAT_NV11:
             break;
-        case DXGI_FORMAT_NV12:
-            break;
         case DXGI_FORMAT_P010:
             break;
         case DXGI_FORMAT_P016:
@@ -210,6 +208,7 @@
             break;
         case DXGI_FORMAT_R8G8B8A8_UINT:
             return GL_UNSIGNED_INT;
+        case DXGI_FORMAT_NV12:
         case DXGI_FORMAT_R8G8B8A8_UNORM:
             return GL_UNSIGNED_NORMALIZED;
         case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
@@ -355,8 +354,6 @@
             break;
         case DXGI_FORMAT_NV11:
             break;
-        case DXGI_FORMAT_NV12:
-            break;
         case DXGI_FORMAT_P010:
             break;
         case DXGI_FORMAT_P016:
@@ -459,6 +456,7 @@
             break;
         case DXGI_FORMAT_R8G8B8A8_UINT:
             return Format::Get(Format::ID::R8G8B8A8_UINT);
+        case DXGI_FORMAT_NV12:
         case DXGI_FORMAT_R8G8B8A8_UNORM:
             return Format::Get(Format::ID::R8G8B8A8_UNORM);
         case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
diff --git a/src/third_party/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp b/src/third_party/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp
index daa6363..5bdaff3 100644
--- a/src/third_party/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp
+++ b/src/third_party/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp
@@ -655,13 +655,20 @@
         return egl::Error(EGL_NOT_INITIALIZED, "Could not retrieve D3D11CreateDevice address.");
     }
 
+    ID3D11DeviceContext* context;
     HRESULT result = d3d11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, nullptr, 0,
-                                       D3D11_SDK_VERSION, &mD3D11Device, nullptr, nullptr);
+                                       D3D11_SDK_VERSION, &mD3D11Device, nullptr, context);
     if (FAILED(result))
     {
         return egl::Error(EGL_NOT_INITIALIZED, "Could not create D3D11 device, error: 0x%X",
                           result);
     }
+    ID3D11Multithread* multithread =
+        d3d11::DynamicCastComObject<ID3D11Multithread>(context);
+    ASSERT(multithread != nullptr);
+    multithread->SetMultithreadProtected(true);
+    SafeRelease(multithread);
+    SafeRelease(context);
 
     egl::Error error = registerD3DDevice(mD3D11Device, &mD3D11DeviceHandle);
     if (error.isError())
diff --git a/src/third_party/angle/src/tests/angle_end2end_tests.gypi b/src/third_party/angle/src/tests/angle_end2end_tests.gypi
index 0c616a5..ce5bf62 100644
--- a/src/third_party/angle/src/tests/angle_end2end_tests.gypi
+++ b/src/third_party/angle/src/tests/angle_end2end_tests.gypi
@@ -151,12 +151,5 @@
                 '<@(angle_end2end_tests_win_sources)',
             ],
         }],
-        ['use_x11==1',
-        {
-            'sources':
-            [
-                '<@(angle_end2end_tests_x11_sources)',
-            ],
-        }],
     ]
 }
diff --git a/src/third_party/angle/src/tests/deqp.gypi b/src/third_party/angle/src/tests/deqp.gypi
index 7f611cb..416bb46 100644
--- a/src/third_party/angle/src/tests/deqp.gypi
+++ b/src/third_party/angle/src/tests/deqp.gypi
@@ -1217,13 +1217,6 @@
                 # GoogleTest doesn't support WinRT
                 'angle_build_deqp_gtest_executables%': 1,
             }],
-            ['OS=="linux" and use_x11==1',
-            {
-                'deqp_include_dirs':
-                [
-                    '<(deqp_path)/framework/platform/x11',
-                ],
-            }],
             ['OS=="linux"',
             {
                 'deqp_defines':
diff --git a/src/third_party/angle/util/util.gyp b/src/third_party/angle/util/util.gyp
index 8b11c9a..4727834 100644
--- a/src/third_party/angle/util/util.gyp
+++ b/src/third_party/angle/util/util.gyp
@@ -140,24 +140,6 @@
                             ],
                         },
                     }],
-                    ['use_x11==1',
-                    {
-                        'sources':
-                        [
-                            '<@(util_x11_sources)',
-                        ],
-                        'link_settings':
-                        {
-                            'ldflags':
-                            [
-                                '<!@(<(pkg-config) --libs-only-L --libs-only-other x11 xi)',
-                            ],
-                            'libraries':
-                            [
-                                '<!@(<(pkg-config) --libs-only-l x11 xi)',
-                            ],
-                        },
-                    }],
                     ['use_ozone==1',
                     {
                         'sources':
diff --git a/src/third_party/libvpx/libvpx.gyp b/src/third_party/libvpx/libvpx.gyp
index d99bd16..0d8dce3 100644
--- a/src/third_party/libvpx/libvpx.gyp
+++ b/src/third_party/libvpx/libvpx.gyp
@@ -6,41 +6,25 @@
     {
       'target_name': 'libvpx',
       'type': 'static_library',
-      'conditions': [
-        ['target_arch == "ps4"', {
-          'variables': {
-            'use_system_yasm': '1',
-            'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
-            'yasm_flags': [
-              '-f', 'elf64',
-              '-I', '<(libvpx_source)',
-              '-I', '<(libvpx_source)/platforms/<(target_arch)',
-            ],
-          },
-          'includes': [
-            '../yasm/yasm_compile.gypi'
-          ],
-          'include_dirs': [
-            '<(libvpx_source)',
-            '<(libvpx_source)/platforms/<(target_arch)',
-            '<(libvpx_source)/vpx_mem/memory_manager/include/',
-            '<(libvpx_source)/third_party/libyuv/include',
-          ],
-          # Always optimize libvpx at O3.
-          # Debug performance is too slow.
-          'cflags': ['-O3'],
-          'cflags!': ['-O0', '-O2'],
-        }],
+      'include_dirs': [
+        '<(libvpx_source)',
+        '<(libvpx_source)/platforms/linux-x64',
+        '<(libvpx_source)/vpx_mem/memory_manager/include/',
       ],
+      # Always optimize libvpx at O3.
+      # Debug performance is too slow.
+      'cflags': ['-O3'],
+      'cflags!': ['-O0', '-O2'],
+      'ldflags': ['--error-limit=0'],
       # This list was generated by running configure and then
       # make libvpx_srcs.txt
       'sources': [
-        'platforms/ps4/vp9_rtcd.h',
-        'platforms/ps4/vpx_config.c',
-        'platforms/ps4/vpx_config.h',
-        'platforms/ps4/vpx_dsp_rtcd.h',
-        'platforms/ps4/vpx_scale_rtcd.h',
-        'platforms/ps4/vpx_version.h',
+        'platforms/linux-x64/vp9_rtcd.h',
+        'platforms/linux-x64/vpx_config.c',
+        'platforms/linux-x64/vpx_config.h',
+        'platforms/linux-x64/vpx_dsp_rtcd.h',
+        'platforms/linux-x64/vpx_scale_rtcd.h',
+        'platforms/linux-x64/vpx_version.h',
         'vp9/common/vp9_alloccommon.c',
         'vp9/common/vp9_alloccommon.h',
         'vp9/common/vp9_blockd.c',
@@ -139,28 +123,9 @@
         'vpx_dsp/vpx_dsp_common.h',
         'vpx_dsp/vpx_dsp_rtcd.c',
         'vpx_dsp/vpx_filter.h',
-        'vpx_dsp/x86/add_noise_sse2.asm',
         'vpx_dsp/x86/convolve.h',
-        'vpx_dsp/x86/halfpix_variance_impl_sse2.asm',
-        'vpx_dsp/x86/halfpix_variance_sse2.c',
-        'vpx_dsp/x86/intrapred_sse2.asm',
-        'vpx_dsp/x86/intrapred_ssse3.asm',
-        'vpx_dsp/x86/inv_txfm_sse2.c',
-        'vpx_dsp/x86/inv_txfm_sse2.h',
-        'vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm',
-        'vpx_dsp/x86/inv_wht_sse2.asm',
         'vpx_dsp/x86/loopfilter_sse2.c',
-        'vpx_dsp/x86/ssim_opt_x86_64.asm',
-        'vpx_dsp/x86/subpel_variance_sse2.asm',
-        'vpx_dsp/x86/txfm_common_sse2.h',
-        'vpx_dsp/x86/variance_sse2.c',
         'vpx_dsp/x86/vpx_asm_stubs.c',
-        'vpx_dsp/x86/vpx_convolve_copy_sse2.asm',
-        'vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c',
-        'vpx_dsp/x86/vpx_subpixel_8t_sse2.asm',
-        'vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm',
-        'vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm',
-        'vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm',
         'vpx_mem/include/vpx_mem_intrnl.h',
         'vpx_mem/vpx_mem.c',
         'vpx_mem/vpx_mem.h',
diff --git a/src/third_party/libvpx/platforms/linux-x64/README.md b/src/third_party/libvpx/platforms/linux-x64/README.md
new file mode 100644
index 0000000..495eb99
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/README.md
@@ -0,0 +1,38 @@
+The config files must be generated for the particular architecture, in our case
+Linux x64.
+
+It was generated by running:  
+`$ ./configure --target=x86_64-linux-gcc --disable-vp8 --disable-examples
+--disable-webm-io --disable-vp9-encoder --disable-avx --disable-sse4_1
+--disable-ssse3 --disable-mmx --disable-sse --disable-sse2 --disable-sse3
+--disable-runtime_cpu_detect`
+
+Any configure problems will be logged in config.log.
+
+This will generate some vpx_config files in the source directory. They don't
+show up in '`git status`' because they are listed in `.gitignore`.
+
+Now run "`make`" in order to generate `vp9_rtcd.h`, `vpx_scale_rtcd.h`, and
+`vpx_version.h`.
+
+Everything should build and you should end up with `libvpx.a`.
+
+At this point, you should have the following files:
+```
+  vp9_rtcd.h
+  vpx_config.c
+  vpx_config.h
+  vpx_dsp_rtcd.h
+  vpx_scale_rtcd.h
+  vpx_version.h
+```
+
+Any other generated files can be discarded.
+
+To generate the test data, set `LIBVPX_TEST_DATA_PATH` to a local directory, and
+run '`make testdata`'.
+
+The list of source files can be generated by running  
+`$ make libvpx_srcs.txt`
+
+This can be used to update the sources rule in `libvpx.gyp`.
diff --git a/src/third_party/libvpx/platforms/linux-x64/vp9_rtcd.h b/src/third_party/libvpx/platforms/linux-x64/vp9_rtcd.h
new file mode 100644
index 0000000..743e823
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/vp9_rtcd.h
@@ -0,0 +1,58 @@
+#ifndef VP9_RTCD_H_
+#define VP9_RTCD_H_
+
+#ifdef RTCD_C
+#define RTCD_EXTERN
+#else
+#define RTCD_EXTERN extern
+#endif
+
+/*
+ * VP9
+ */
+
+#include "vpx/vpx_integer.h"
+#include "vp9/common/vp9_common.h"
+#include "vp9/common/vp9_enums.h"
+
+struct macroblockd;
+
+/* Encoder forward decls */
+struct macroblock;
+struct vp9_variance_vtable;
+struct search_site_config;
+struct mv;
+union int_mv;
+struct yv12_buffer_config;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void vp9_iht16x16_256_add_c(const tran_low_t *input, uint8_t *output, int pitch, int tx_type);
+#define vp9_iht16x16_256_add vp9_iht16x16_256_add_c
+
+void vp9_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type);
+#define vp9_iht4x4_16_add vp9_iht4x4_16_add_c
+
+void vp9_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type);
+#define vp9_iht8x8_64_add vp9_iht8x8_64_add_c
+
+void vp9_rtcd(void);
+
+#ifdef RTCD_C
+#include "vpx_ports/x86.h"
+static void setup_rtcd_internal(void)
+{
+    int flags = x86_simd_caps();
+
+    (void)flags;
+
+}
+#endif
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif
diff --git a/src/third_party/libvpx/platforms/linux-x64/vpx_config.c b/src/third_party/libvpx/platforms/linux-x64/vpx_config.c
new file mode 100644
index 0000000..fbcbd7e
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/vpx_config.c
@@ -0,0 +1,10 @@
+/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
+/*  */
+/* Use of this source code is governed by a BSD-style license */
+/* that can be found in the LICENSE file in the root of the source */
+/* tree. An additional intellectual property rights grant can be found */
+/* in the file PATENTS.  All contributing project authors may */
+/* be found in the AUTHORS file in the root of the source tree. */
+#include "vpx/vpx_codec.h"
+static const char* const cfg = "--target=x86_64-linux-gcc --disable-vp8 --disable-examples --disable-webm-io --disable-vp9-encoder --disable-avx --disable-sse4_1 --disable-ssse3 --disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-runtime_cpu_detect";
+const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/src/third_party/libvpx/platforms/linux-x64/vpx_config.h b/src/third_party/libvpx/platforms/linux-x64/vpx_config.h
new file mode 100644
index 0000000..923cc6e
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/vpx_config.h
@@ -0,0 +1,98 @@
+/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
+/*  */
+/* Use of this source code is governed by a BSD-style license */
+/* that can be found in the LICENSE file in the root of the source */
+/* tree. An additional intellectual property rights grant can be found */
+/* in the file PATENTS.  All contributing project authors may */
+/* be found in the AUTHORS file in the root of the source tree. */
+/* This file automatically generated by configure. Do not edit! */
+#ifndef VPX_CONFIG_H
+#define VPX_CONFIG_H
+#define RESTRICT    
+#define INLINE      inline
+#define ARCH_ARM 0
+#define ARCH_MIPS 0
+#define ARCH_X86 0
+#define ARCH_X86_64 1
+#define HAVE_EDSP 0
+#define HAVE_MEDIA 0
+#define HAVE_NEON 0
+#define HAVE_NEON_ASM 0
+#define HAVE_MIPS32 0
+#define HAVE_DSPR2 0
+#define HAVE_MSA 0
+#define HAVE_MIPS64 0
+#define HAVE_MMX 0
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
+#define HAVE_SSE3 0
+#define HAVE_SSSE3 0
+#define HAVE_SSE4_1 0
+#define HAVE_AVX 0
+#define HAVE_AVX2 0
+#define HAVE_VPX_PORTS 1
+#define HAVE_PTHREAD_H 1
+#define HAVE_UNISTD_H 1
+#define CONFIG_DEPENDENCY_TRACKING 1
+#define CONFIG_EXTERNAL_BUILD 0
+#define CONFIG_INSTALL_DOCS 0
+#define CONFIG_INSTALL_BINS 1
+#define CONFIG_INSTALL_LIBS 1
+#define CONFIG_INSTALL_SRCS 0
+#define CONFIG_USE_X86INC 1
+#define CONFIG_DEBUG 0
+#define CONFIG_GPROF 0
+#define CONFIG_GCOV 0
+#define CONFIG_RVCT 0
+#define CONFIG_GCC 1
+#define CONFIG_MSVS 0
+#define CONFIG_PIC 0
+#define CONFIG_BIG_ENDIAN 0
+#define CONFIG_CODEC_SRCS 0
+#define CONFIG_DEBUG_LIBS 0
+#define CONFIG_DEQUANT_TOKENS 0
+#define CONFIG_DC_RECON 0
+#define CONFIG_RUNTIME_CPU_DETECT 0
+#define CONFIG_POSTPROC 1
+#define CONFIG_VP9_POSTPROC 0
+#define CONFIG_MULTITHREAD 1
+#define CONFIG_INTERNAL_STATS 0
+#define CONFIG_VP8_ENCODER 0
+#define CONFIG_VP8_DECODER 0
+#define CONFIG_VP9_ENCODER 0
+#define CONFIG_VP9_DECODER 1
+#define CONFIG_VP10_ENCODER 0
+#define CONFIG_VP10_DECODER 0
+#define CONFIG_VP8 0
+#define CONFIG_VP9 1
+#define CONFIG_VP10 0
+#define CONFIG_ENCODERS 0
+#define CONFIG_DECODERS 1
+#define CONFIG_STATIC_MSVCRT 0
+#define CONFIG_SPATIAL_RESAMPLING 1
+#define CONFIG_REALTIME_ONLY 0
+#define CONFIG_ONTHEFLY_BITPACKING 0
+#define CONFIG_ERROR_CONCEALMENT 0
+#define CONFIG_SHARED 0
+#define CONFIG_STATIC 1
+#define CONFIG_SMALL 0
+#define CONFIG_POSTPROC_VISUALIZER 0
+#define CONFIG_OS_SUPPORT 1
+#define CONFIG_UNIT_TESTS 1
+#define CONFIG_WEBM_IO 0
+#define CONFIG_LIBYUV 1
+#define CONFIG_DECODE_PERF_TESTS 0
+#define CONFIG_ENCODE_PERF_TESTS 0
+#define CONFIG_MULTI_RES_ENCODING 0
+#define CONFIG_TEMPORAL_DENOISING 1
+#define CONFIG_VP9_TEMPORAL_DENOISING 0
+#define CONFIG_COEFFICIENT_RANGE_CHECKING 0
+#define CONFIG_VP9_HIGHBITDEPTH 0
+#define CONFIG_BETTER_HW_COMPATIBILITY 0
+#define CONFIG_EXPERIMENTAL 0
+#define CONFIG_SIZE_LIMIT 0
+#define CONFIG_SPATIAL_SVC 0
+#define CONFIG_FP_MB_STATS 0
+#define CONFIG_EMULATE_HARDWARE 0
+#define CONFIG_MISC_FIXES 0
+#endif /* VPX_CONFIG_H */
diff --git a/src/third_party/libvpx/platforms/linux-x64/vpx_dsp_rtcd.h b/src/third_party/libvpx/platforms/linux-x64/vpx_dsp_rtcd.h
new file mode 100644
index 0000000..9b0d0d9
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/vpx_dsp_rtcd.h
@@ -0,0 +1,516 @@
+#ifndef VPX_DSP_RTCD_H_
+#define VPX_DSP_RTCD_H_
+
+#ifdef RTCD_C
+#define RTCD_EXTERN
+#else
+#define RTCD_EXTERN extern
+#endif
+
+/*
+ * DSP
+ */
+
+#include "vpx/vpx_integer.h"
+#include "vpx_dsp/vpx_dsp_common.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void vpx_comp_avg_pred_c(uint8_t *comp_pred, const uint8_t *pred, int width, int height, const uint8_t *ref, int ref_stride);
+#define vpx_comp_avg_pred vpx_comp_avg_pred_c
+
+void vpx_convolve8_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve8 vpx_convolve8_c
+
+void vpx_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve8_avg vpx_convolve8_avg_c
+
+void vpx_convolve8_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve8_avg_horiz vpx_convolve8_avg_horiz_c
+
+void vpx_convolve8_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve8_avg_vert vpx_convolve8_avg_vert_c
+
+void vpx_convolve8_horiz_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve8_horiz vpx_convolve8_horiz_c
+
+void vpx_convolve8_vert_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve8_vert vpx_convolve8_vert_c
+
+void vpx_convolve_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve_avg vpx_convolve_avg_c
+
+void vpx_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_convolve_copy vpx_convolve_copy_c
+
+void vpx_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d117_predictor_16x16 vpx_d117_predictor_16x16_c
+
+void vpx_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d117_predictor_32x32 vpx_d117_predictor_32x32_c
+
+void vpx_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d117_predictor_4x4 vpx_d117_predictor_4x4_c
+
+void vpx_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d117_predictor_8x8 vpx_d117_predictor_8x8_c
+
+void vpx_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d135_predictor_16x16 vpx_d135_predictor_16x16_c
+
+void vpx_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d135_predictor_32x32 vpx_d135_predictor_32x32_c
+
+void vpx_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d135_predictor_4x4 vpx_d135_predictor_4x4_c
+
+void vpx_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d135_predictor_8x8 vpx_d135_predictor_8x8_c
+
+void vpx_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d153_predictor_16x16 vpx_d153_predictor_16x16_c
+
+void vpx_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d153_predictor_32x32 vpx_d153_predictor_32x32_c
+
+void vpx_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d153_predictor_4x4 vpx_d153_predictor_4x4_c
+
+void vpx_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d153_predictor_8x8 vpx_d153_predictor_8x8_c
+
+void vpx_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207_predictor_16x16 vpx_d207_predictor_16x16_c
+
+void vpx_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207_predictor_32x32 vpx_d207_predictor_32x32_c
+
+void vpx_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207_predictor_4x4 vpx_d207_predictor_4x4_c
+
+void vpx_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207_predictor_8x8 vpx_d207_predictor_8x8_c
+
+void vpx_d207e_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207e_predictor_16x16 vpx_d207e_predictor_16x16_c
+
+void vpx_d207e_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207e_predictor_32x32 vpx_d207e_predictor_32x32_c
+
+void vpx_d207e_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207e_predictor_4x4 vpx_d207e_predictor_4x4_c
+
+void vpx_d207e_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d207e_predictor_8x8 vpx_d207e_predictor_8x8_c
+
+void vpx_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45_predictor_16x16 vpx_d45_predictor_16x16_c
+
+void vpx_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45_predictor_32x32 vpx_d45_predictor_32x32_c
+
+void vpx_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45_predictor_4x4 vpx_d45_predictor_4x4_c
+
+void vpx_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45_predictor_8x8 vpx_d45_predictor_8x8_c
+
+void vpx_d45e_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45e_predictor_16x16 vpx_d45e_predictor_16x16_c
+
+void vpx_d45e_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45e_predictor_32x32 vpx_d45e_predictor_32x32_c
+
+void vpx_d45e_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45e_predictor_4x4 vpx_d45e_predictor_4x4_c
+
+void vpx_d45e_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d45e_predictor_8x8 vpx_d45e_predictor_8x8_c
+
+void vpx_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63_predictor_16x16 vpx_d63_predictor_16x16_c
+
+void vpx_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63_predictor_32x32 vpx_d63_predictor_32x32_c
+
+void vpx_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63_predictor_4x4 vpx_d63_predictor_4x4_c
+
+void vpx_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63_predictor_8x8 vpx_d63_predictor_8x8_c
+
+void vpx_d63e_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63e_predictor_16x16 vpx_d63e_predictor_16x16_c
+
+void vpx_d63e_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63e_predictor_32x32 vpx_d63e_predictor_32x32_c
+
+void vpx_d63e_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63e_predictor_4x4 vpx_d63e_predictor_4x4_c
+
+void vpx_d63e_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63e_predictor_8x8 vpx_d63e_predictor_8x8_c
+
+void vpx_d63f_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_d63f_predictor_4x4 vpx_d63f_predictor_4x4_c
+
+void vpx_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_128_predictor_16x16 vpx_dc_128_predictor_16x16_c
+
+void vpx_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_128_predictor_32x32 vpx_dc_128_predictor_32x32_c
+
+void vpx_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_128_predictor_4x4 vpx_dc_128_predictor_4x4_c
+
+void vpx_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_128_predictor_8x8 vpx_dc_128_predictor_8x8_c
+
+void vpx_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_left_predictor_16x16 vpx_dc_left_predictor_16x16_c
+
+void vpx_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_left_predictor_32x32 vpx_dc_left_predictor_32x32_c
+
+void vpx_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_left_predictor_4x4 vpx_dc_left_predictor_4x4_c
+
+void vpx_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_left_predictor_8x8 vpx_dc_left_predictor_8x8_c
+
+void vpx_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_predictor_16x16 vpx_dc_predictor_16x16_c
+
+void vpx_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_predictor_32x32 vpx_dc_predictor_32x32_c
+
+void vpx_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_predictor_4x4 vpx_dc_predictor_4x4_c
+
+void vpx_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_predictor_8x8 vpx_dc_predictor_8x8_c
+
+void vpx_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_top_predictor_16x16 vpx_dc_top_predictor_16x16_c
+
+void vpx_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_top_predictor_32x32 vpx_dc_top_predictor_32x32_c
+
+void vpx_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_top_predictor_4x4 vpx_dc_top_predictor_4x4_c
+
+void vpx_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_dc_top_predictor_8x8 vpx_dc_top_predictor_8x8_c
+
+void vpx_get16x16var_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum);
+#define vpx_get16x16var vpx_get16x16var_c
+
+unsigned int vpx_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride);
+#define vpx_get4x4sse_cs vpx_get4x4sse_cs_c
+
+void vpx_get8x8var_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum);
+#define vpx_get8x8var vpx_get8x8var_c
+
+unsigned int vpx_get_mb_ss_c(const int16_t *);
+#define vpx_get_mb_ss vpx_get_mb_ss_c
+
+void vpx_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_h_predictor_16x16 vpx_h_predictor_16x16_c
+
+void vpx_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_h_predictor_32x32 vpx_h_predictor_32x32_c
+
+void vpx_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_h_predictor_4x4 vpx_h_predictor_4x4_c
+
+void vpx_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_h_predictor_8x8 vpx_h_predictor_8x8_c
+
+void vpx_he_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_he_predictor_4x4 vpx_he_predictor_4x4_c
+
+void vpx_idct16x16_10_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct16x16_10_add vpx_idct16x16_10_add_c
+
+void vpx_idct16x16_1_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct16x16_1_add vpx_idct16x16_1_add_c
+
+void vpx_idct16x16_256_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct16x16_256_add vpx_idct16x16_256_add_c
+
+void vpx_idct32x32_1024_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct32x32_1024_add vpx_idct32x32_1024_add_c
+
+void vpx_idct32x32_135_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct32x32_135_add vpx_idct32x32_135_add_c
+
+void vpx_idct32x32_1_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct32x32_1_add vpx_idct32x32_1_add_c
+
+void vpx_idct32x32_34_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct32x32_34_add vpx_idct32x32_34_add_c
+
+void vpx_idct4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct4x4_16_add vpx_idct4x4_16_add_c
+
+void vpx_idct4x4_1_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct4x4_1_add vpx_idct4x4_1_add_c
+
+void vpx_idct8x8_12_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct8x8_12_add vpx_idct8x8_12_add_c
+
+void vpx_idct8x8_1_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct8x8_1_add vpx_idct8x8_1_add_c
+
+void vpx_idct8x8_64_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_idct8x8_64_add vpx_idct8x8_64_add_c
+
+void vpx_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_iwht4x4_16_add vpx_iwht4x4_16_add_c
+
+void vpx_iwht4x4_1_add_c(const tran_low_t *input, uint8_t *dest, int dest_stride);
+#define vpx_iwht4x4_1_add vpx_iwht4x4_1_add_c
+
+void vpx_lpf_horizontal_4_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_horizontal_4 vpx_lpf_horizontal_4_c
+
+void vpx_lpf_horizontal_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
+#define vpx_lpf_horizontal_4_dual vpx_lpf_horizontal_4_dual_c
+
+void vpx_lpf_horizontal_8_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_horizontal_8 vpx_lpf_horizontal_8_c
+
+void vpx_lpf_horizontal_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
+#define vpx_lpf_horizontal_8_dual vpx_lpf_horizontal_8_dual_c
+
+void vpx_lpf_horizontal_edge_16_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_horizontal_edge_16 vpx_lpf_horizontal_edge_16_c
+
+void vpx_lpf_horizontal_edge_8_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_horizontal_edge_8 vpx_lpf_horizontal_edge_8_c
+
+void vpx_lpf_vertical_16_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_vertical_16 vpx_lpf_vertical_16_c
+
+void vpx_lpf_vertical_16_dual_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_vertical_16_dual vpx_lpf_vertical_16_dual_c
+
+void vpx_lpf_vertical_4_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_vertical_4 vpx_lpf_vertical_4_c
+
+void vpx_lpf_vertical_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
+#define vpx_lpf_vertical_4_dual vpx_lpf_vertical_4_dual_c
+
+void vpx_lpf_vertical_8_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
+#define vpx_lpf_vertical_8 vpx_lpf_vertical_8_c
+
+void vpx_lpf_vertical_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
+#define vpx_lpf_vertical_8_dual vpx_lpf_vertical_8_dual_c
+
+unsigned int vpx_mse16x16_c(const uint8_t *src_ptr, int  source_stride, const uint8_t *ref_ptr, int  recon_stride, unsigned int *sse);
+#define vpx_mse16x16 vpx_mse16x16_c
+
+unsigned int vpx_mse16x8_c(const uint8_t *src_ptr, int  source_stride, const uint8_t *ref_ptr, int  recon_stride, unsigned int *sse);
+#define vpx_mse16x8 vpx_mse16x8_c
+
+unsigned int vpx_mse8x16_c(const uint8_t *src_ptr, int  source_stride, const uint8_t *ref_ptr, int  recon_stride, unsigned int *sse);
+#define vpx_mse8x16 vpx_mse8x16_c
+
+unsigned int vpx_mse8x8_c(const uint8_t *src_ptr, int  source_stride, const uint8_t *ref_ptr, int  recon_stride, unsigned int *sse);
+#define vpx_mse8x8 vpx_mse8x8_c
+
+void vpx_plane_add_noise_c(uint8_t *Start, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int Width, unsigned int Height, int Pitch);
+#define vpx_plane_add_noise vpx_plane_add_noise_c
+
+void vpx_scaled_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_scaled_2d vpx_scaled_2d_c
+
+void vpx_scaled_avg_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_scaled_avg_2d vpx_scaled_avg_2d_c
+
+void vpx_scaled_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_scaled_avg_horiz vpx_scaled_avg_horiz_c
+
+void vpx_scaled_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_scaled_avg_vert vpx_scaled_avg_vert_c
+
+void vpx_scaled_horiz_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_scaled_horiz vpx_scaled_horiz_c
+
+void vpx_scaled_vert_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
+#define vpx_scaled_vert vpx_scaled_vert_c
+
+uint32_t vpx_sub_pixel_avg_variance16x16_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance16x16 vpx_sub_pixel_avg_variance16x16_c
+
+uint32_t vpx_sub_pixel_avg_variance16x32_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance16x32 vpx_sub_pixel_avg_variance16x32_c
+
+uint32_t vpx_sub_pixel_avg_variance16x8_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance16x8 vpx_sub_pixel_avg_variance16x8_c
+
+uint32_t vpx_sub_pixel_avg_variance32x16_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance32x16 vpx_sub_pixel_avg_variance32x16_c
+
+uint32_t vpx_sub_pixel_avg_variance32x32_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance32x32 vpx_sub_pixel_avg_variance32x32_c
+
+uint32_t vpx_sub_pixel_avg_variance32x64_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance32x64 vpx_sub_pixel_avg_variance32x64_c
+
+uint32_t vpx_sub_pixel_avg_variance4x4_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance4x4 vpx_sub_pixel_avg_variance4x4_c
+
+uint32_t vpx_sub_pixel_avg_variance4x8_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance4x8 vpx_sub_pixel_avg_variance4x8_c
+
+uint32_t vpx_sub_pixel_avg_variance64x32_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance64x32 vpx_sub_pixel_avg_variance64x32_c
+
+uint32_t vpx_sub_pixel_avg_variance64x64_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance64x64 vpx_sub_pixel_avg_variance64x64_c
+
+uint32_t vpx_sub_pixel_avg_variance8x16_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance8x16 vpx_sub_pixel_avg_variance8x16_c
+
+uint32_t vpx_sub_pixel_avg_variance8x4_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance8x4 vpx_sub_pixel_avg_variance8x4_c
+
+uint32_t vpx_sub_pixel_avg_variance8x8_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred);
+#define vpx_sub_pixel_avg_variance8x8 vpx_sub_pixel_avg_variance8x8_c
+
+uint32_t vpx_sub_pixel_variance16x16_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance16x16 vpx_sub_pixel_variance16x16_c
+
+uint32_t vpx_sub_pixel_variance16x32_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance16x32 vpx_sub_pixel_variance16x32_c
+
+uint32_t vpx_sub_pixel_variance16x8_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance16x8 vpx_sub_pixel_variance16x8_c
+
+uint32_t vpx_sub_pixel_variance32x16_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance32x16 vpx_sub_pixel_variance32x16_c
+
+uint32_t vpx_sub_pixel_variance32x32_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance32x32 vpx_sub_pixel_variance32x32_c
+
+uint32_t vpx_sub_pixel_variance32x64_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance32x64 vpx_sub_pixel_variance32x64_c
+
+uint32_t vpx_sub_pixel_variance4x4_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance4x4 vpx_sub_pixel_variance4x4_c
+
+uint32_t vpx_sub_pixel_variance4x8_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance4x8 vpx_sub_pixel_variance4x8_c
+
+uint32_t vpx_sub_pixel_variance64x32_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance64x32 vpx_sub_pixel_variance64x32_c
+
+uint32_t vpx_sub_pixel_variance64x64_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance64x64 vpx_sub_pixel_variance64x64_c
+
+uint32_t vpx_sub_pixel_variance8x16_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance8x16 vpx_sub_pixel_variance8x16_c
+
+uint32_t vpx_sub_pixel_variance8x4_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance8x4 vpx_sub_pixel_variance8x4_c
+
+uint32_t vpx_sub_pixel_variance8x8_c(const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse);
+#define vpx_sub_pixel_variance8x8 vpx_sub_pixel_variance8x8_c
+
+void vpx_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_tm_predictor_16x16 vpx_tm_predictor_16x16_c
+
+void vpx_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_tm_predictor_32x32 vpx_tm_predictor_32x32_c
+
+void vpx_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_tm_predictor_4x4 vpx_tm_predictor_4x4_c
+
+void vpx_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_tm_predictor_8x8 vpx_tm_predictor_8x8_c
+
+void vpx_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_v_predictor_16x16 vpx_v_predictor_16x16_c
+
+void vpx_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_v_predictor_32x32 vpx_v_predictor_32x32_c
+
+void vpx_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_v_predictor_4x4 vpx_v_predictor_4x4_c
+
+void vpx_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_v_predictor_8x8 vpx_v_predictor_8x8_c
+
+unsigned int vpx_variance16x16_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance16x16 vpx_variance16x16_c
+
+unsigned int vpx_variance16x32_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance16x32 vpx_variance16x32_c
+
+unsigned int vpx_variance16x8_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance16x8 vpx_variance16x8_c
+
+unsigned int vpx_variance32x16_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance32x16 vpx_variance32x16_c
+
+unsigned int vpx_variance32x32_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance32x32 vpx_variance32x32_c
+
+unsigned int vpx_variance32x64_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance32x64 vpx_variance32x64_c
+
+unsigned int vpx_variance4x4_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance4x4 vpx_variance4x4_c
+
+unsigned int vpx_variance4x8_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance4x8 vpx_variance4x8_c
+
+unsigned int vpx_variance64x32_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance64x32 vpx_variance64x32_c
+
+unsigned int vpx_variance64x64_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance64x64 vpx_variance64x64_c
+
+unsigned int vpx_variance8x16_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance8x16 vpx_variance8x16_c
+
+unsigned int vpx_variance8x4_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance8x4 vpx_variance8x4_c
+
+unsigned int vpx_variance8x8_c(const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse);
+#define vpx_variance8x8 vpx_variance8x8_c
+
+uint32_t vpx_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, uint32_t *sse);
+#define vpx_variance_halfpixvar16x16_h vpx_variance_halfpixvar16x16_h_c
+
+uint32_t vpx_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, uint32_t *sse);
+#define vpx_variance_halfpixvar16x16_hv vpx_variance_halfpixvar16x16_hv_c
+
+uint32_t vpx_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int  ref_stride, uint32_t *sse);
+#define vpx_variance_halfpixvar16x16_v vpx_variance_halfpixvar16x16_v_c
+
+void vpx_ve_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
+#define vpx_ve_predictor_4x4 vpx_ve_predictor_4x4_c
+
+void vpx_dsp_rtcd(void);
+
+#ifdef RTCD_C
+#include "vpx_ports/x86.h"
+static void setup_rtcd_internal(void)
+{
+    int flags = x86_simd_caps();
+
+    (void)flags;
+
+}
+#endif
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif
diff --git a/src/third_party/libvpx/platforms/linux-x64/vpx_scale_rtcd.h b/src/third_party/libvpx/platforms/linux-x64/vpx_scale_rtcd.h
new file mode 100644
index 0000000..ddf7d01
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/vpx_scale_rtcd.h
@@ -0,0 +1,69 @@
+#ifndef VPX_SCALE_RTCD_H_
+#define VPX_SCALE_RTCD_H_
+
+#ifdef RTCD_C
+#define RTCD_EXTERN
+#else
+#define RTCD_EXTERN extern
+#endif
+
+struct yv12_buffer_config;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
+#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
+
+void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
+#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
+
+void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
+#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
+
+void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
+#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
+
+void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
+#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
+
+void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
+#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
+
+void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
+#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
+
+void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
+#define vp8_yv12_copy_frame vp8_yv12_copy_frame_c
+
+void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
+#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_c
+
+void vpx_extend_frame_borders_c(struct yv12_buffer_config *ybf);
+#define vpx_extend_frame_borders vpx_extend_frame_borders_c
+
+void vpx_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf);
+#define vpx_extend_frame_inner_borders vpx_extend_frame_inner_borders_c
+
+void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
+#define vpx_yv12_copy_y vpx_yv12_copy_y_c
+
+void vpx_scale_rtcd(void);
+
+#ifdef RTCD_C
+#include "vpx_ports/x86.h"
+static void setup_rtcd_internal(void)
+{
+    int flags = x86_simd_caps();
+
+    (void)flags;
+
+}
+#endif
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif
diff --git a/src/third_party/libvpx/platforms/linux-x64/vpx_version.h b/src/third_party/libvpx/platforms/linux-x64/vpx_version.h
new file mode 100644
index 0000000..e44cba1
--- /dev/null
+++ b/src/third_party/libvpx/platforms/linux-x64/vpx_version.h
@@ -0,0 +1,7 @@
+#define VERSION_MAJOR  0
+#define VERSION_MINOR  0
+#define VERSION_PATCH  0
+#define VERSION_EXTRA  ""
+#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
+#define VERSION_STRING_NOSP "Release"
+#define VERSION_STRING      " Release"
diff --git a/src/third_party/libvpx/vpx_ports/system_state.h b/src/third_party/libvpx/vpx_ports/system_state.h
index 086c646..cdbee91 100644
--- a/src/third_party/libvpx/vpx_ports/system_state.h
+++ b/src/third_party/libvpx/vpx_ports/system_state.h
@@ -13,7 +13,7 @@
 
 #include "./vpx_config.h"
 
-#if ARCH_X86 || ARCH_X86_64
+#if (ARCH_X86 || ARCH_X86_64) && HAVE_MMX
 void vpx_reset_mmx_state(void);
 #define vpx_clear_system_state() vpx_reset_mmx_state()
 #else
diff --git a/src/third_party/mozjs-45/js/src/shell/js.cpp b/src/third_party/mozjs-45/js/src/shell/js.cpp
index cc4e445..68dee55 100644
--- a/src/third_party/mozjs-45/js/src/shell/js.cpp
+++ b/src/third_party/mozjs-45/js/src/shell/js.cpp
@@ -108,6 +108,8 @@
 #define PATH_MAX (SB_FILE_MAX_PATH + 1)
 #endif
 
+#include "starboard/client_porting/poem/stdio_poem.h"
+#include "starboard/client_porting/poem/string_poem.h"
 #include "starboard/client_porting/wrap_main/wrap_main.h"
 #include "starboard/memory.h"
 
diff --git a/src/third_party/mozjs-45/js/src/vm/NativeObject.cpp b/src/third_party/mozjs-45/js/src/vm/NativeObject.cpp
index 88f3c2d..f0e5868 100644
--- a/src/third_party/mozjs-45/js/src/vm/NativeObject.cpp
+++ b/src/third_party/mozjs-45/js/src/vm/NativeObject.cpp
@@ -134,7 +134,7 @@
         for (int n = throttle; --n >= 0 && shape->parent; shape = shape->parent) {
             MOZ_ASSERT_IF(lastProperty() != shape, !shape->hasTable());
 
-            ShapeTable::Entry& entry = table.search(shape->propid(), false);
+            ShapeTable::Entry& entry = table.search(shape->propid());
             MOZ_ASSERT(entry.shape() == shape);
         }
 
@@ -155,7 +155,7 @@
                 ShapeTable& table = shape->table();
                 MOZ_ASSERT(shape->parent);
                 for (Shape::Range<NoGC> r(shape); !r.empty(); r.popFront()) {
-                    ShapeTable::Entry& entry = table.search(r.front().propid(), false);
+                    ShapeTable::Entry& entry = table.search(r.front().propid());
                     MOZ_ASSERT(entry.shape() == &r.front());
                 }
             }
diff --git a/src/third_party/mozjs-45/js/src/vm/ScopeObject.cpp b/src/third_party/mozjs-45/js/src/vm/ScopeObject.cpp
index 2b08a0f..19e13c0 100644
--- a/src/third_party/mozjs-45/js/src/vm/ScopeObject.cpp
+++ b/src/third_party/mozjs-45/js/src/vm/ScopeObject.cpp
@@ -1010,7 +1010,7 @@
 
     /* Inline NativeObject::addProperty in order to trap the redefinition case. */
     ShapeTable::Entry* entry;
-    if (Shape::search(cx, block->lastProperty(), id, &entry, true)) {
+    if (Shape::search<true>(cx, block->lastProperty(), id, &entry)) {
         *redeclared = true;
         return nullptr;
     }
diff --git a/src/third_party/mozjs-45/js/src/vm/Shape-inl.h b/src/third_party/mozjs-45/js/src/vm/Shape-inl.h
index dc3c1f5..dcd9b61 100644
--- a/src/third_party/mozjs-45/js/src/vm/Shape-inl.h
+++ b/src/third_party/mozjs-45/js/src/vm/Shape-inl.h
@@ -37,25 +37,27 @@
     return search(cx, this, id, &_);
 }
 
-/* static */ inline Shape*
-Shape::search(ExclusiveContext* cx, Shape* start, jsid id, ShapeTable::Entry** pentry, bool adding)
+/* static */
+template <bool adding>
+inline Shape*
+Shape::search(ExclusiveContext* cx, Shape* start, jsid id, ShapeTable::Entry** pentry)
 {
     if (start->inDictionary()) {
-        *pentry = &start->table().search(id, adding);
+        *pentry = &start->table().search<adding>(id);
         return (*pentry)->shape();
     }
 
     *pentry = nullptr;
 
     if (start->hasTable()) {
-        ShapeTable::Entry& entry = start->table().search(id, adding);
+        ShapeTable::Entry& entry = start->table().search<adding>(id);
         return entry.shape();
     }
 
     if (start->numLinearSearches() == LINEAR_SEARCHES_MAX) {
         if (start->isBigEnoughForAShapeTable()) {
             if (Shape::hashify(cx, start)) {
-                ShapeTable::Entry& entry = start->table().search(id, adding);
+                ShapeTable::Entry& entry = start->table().search<adding>(id);
                 return entry.shape();
             } else {
                 cx->recoverFromOutOfMemory();
@@ -97,6 +99,7 @@
     return shape;
 }
 
+
 template<class ObjectSubclass>
 /* static */ inline bool
 EmptyShape::ensureInitialCustomShape(ExclusiveContext* cx, Handle<ObjectSubclass*> obj)
diff --git a/src/third_party/mozjs-45/js/src/vm/Shape.cpp b/src/third_party/mozjs-45/js/src/vm/Shape.cpp
index 9c495a5..54a9cc3 100644
--- a/src/third_party/mozjs-45/js/src/vm/Shape.cpp
+++ b/src/third_party/mozjs-45/js/src/vm/Shape.cpp
@@ -60,7 +60,7 @@
 
     for (Shape::Range<NoGC> r(lastProp); !r.empty(); r.popFront()) {
         Shape& shape = r.front();
-        Entry& entry = search(shape.propid(), true);
+        Entry& entry = search<true>(shape.propid());
 
         /*
          * Beware duplicate args and arg vs. var conflicts: the youngest shape
@@ -186,8 +186,9 @@
     return ((hash0 << log2) >> shift) | 1;
 }
 
+template <bool adding>
 ShapeTable::Entry&
-ShapeTable::search(jsid id, bool adding)
+ShapeTable::search(jsid id)
 {
     MOZ_ASSERT(entries_);
     MOZ_ASSERT(!JSID_IS_EMPTY(id));
@@ -257,6 +258,9 @@
     MOZ_CRASH("Shape::search failed to find an expected entry.");
 }
 
+template ShapeTable::Entry& ShapeTable::search<false>(jsid id);
+template ShapeTable::Entry& ShapeTable::search<true>(jsid id);
+
 bool
 ShapeTable::change(int log2Delta, ExclusiveContext* cx)
 {
@@ -284,7 +288,7 @@
     /* Copy only live entries, leaving removed and free ones behind. */
     for (Entry* oldEntry = oldTable; oldSize != 0; oldEntry++) {
         if (Shape* shape = oldEntry->shape()) {
-            Entry& entry = search(shape->propid(), true);
+            Entry& entry = search<true>(shape->propid());
             MOZ_ASSERT(entry.isFree());
             entry.setShape(shape);
         }
@@ -495,7 +499,7 @@
 
     ShapeTable::Entry* entry = nullptr;
     if (obj->inDictionaryMode())
-        entry = &obj->lastProperty()->table().search(id, true);
+        entry = &obj->lastProperty()->table().search<true>(id);
 
     return addPropertyInternal(cx, obj, id, getter, setter, slot, attrs, flags, entry,
                                allowDictionary);
@@ -545,14 +549,14 @@
             if (!obj->toDictionaryMode(cx))
                 return nullptr;
             table = &obj->lastProperty()->table();
-            entry = &table->search(id, true);
+            entry = &table->search<true>(id);
         }
     } else {
         table = &obj->lastProperty()->table();
         if (table->needsToGrow()) {
             if (!table->grow(cx))
                 return nullptr;
-            entry = &table->search(id, true);
+            entry = &table->search<true>(id);
             MOZ_ASSERT(!entry->shape());
         }
     }
@@ -713,7 +717,7 @@
      * shape table.
      */
     ShapeTable::Entry* entry;
-    RootedShape shape(cx, Shape::search(cx, obj->lastProperty(), id, &entry, true));
+    RootedShape shape(cx, Shape::search<true>(cx, obj->lastProperty(), id, &entry));
     if (!shape) {
         /*
          * You can't add properties to a non-extensible object, but you can change
@@ -777,7 +781,7 @@
     if (shape != obj->lastProperty() && !obj->inDictionaryMode()) {
         if (!obj->toDictionaryMode(cx))
             return nullptr;
-        entry = &obj->lastProperty()->table().search(shape->propid(), false);
+        entry = &obj->lastProperty()->table().search(shape->propid());
         shape = entry->shape();
     }
 
@@ -925,7 +929,7 @@
     if (!self->inDictionaryMode() && (shape != self->lastProperty() || !self->canRemoveLastProperty())) {
         if (!self->toDictionaryMode(cx))
             return false;
-        entry = &self->lastProperty()->table().search(shape->propid(), false);
+        entry = &self->lastProperty()->table().search(shape->propid());
         shape = entry->shape();
     }
 
@@ -1108,7 +1112,7 @@
     ShapeTable& table = self->lastProperty()->table();
     ShapeTable::Entry* entry = oldShape->isEmptyShape()
                                ? nullptr
-                               : &table.search(oldShape->propidRef(), false);
+                               : &table.search(oldShape->propidRef());
 
     /*
      * Splice the new shape into the same position as the old shape, preserving
diff --git a/src/third_party/mozjs-45/js/src/vm/Shape.h b/src/third_party/mozjs-45/js/src/vm/Shape.h
index 5118589..d112175 100644
--- a/src/third_party/mozjs-45/js/src/vm/Shape.h
+++ b/src/third_party/mozjs-45/js/src/vm/Shape.h
@@ -223,7 +223,8 @@
      */
     bool init(ExclusiveContext* cx, Shape* lastProp);
     bool change(int log2Delta, ExclusiveContext* cx);
-    Entry& search(jsid id, bool adding);
+    template <bool adding = false>
+    Entry& search(jsid id);
 
   private:
     Entry& getEntry(uint32_t i) const {
@@ -580,8 +581,9 @@
                                    last, else to obj->shape_ */
     };
 
+    template <bool adding = false>
     static inline Shape* search(ExclusiveContext* cx, Shape* start, jsid id,
-                                ShapeTable::Entry** pentry, bool adding = false);
+                                ShapeTable::Entry** pentry);
     static inline Shape* searchNoHashify(Shape* start, jsid id);
 
     void removeFromDictionary(NativeObject* obj);
@@ -1369,7 +1371,7 @@
      * search. We never hashify into a table in parallel.
      */
     if (start->hasTable()) {
-        ShapeTable::Entry& entry = start->table().search(id, false);
+        ShapeTable::Entry& entry = start->table().search(id);
         return entry.shape();
     }
 
diff --git a/src/third_party/skia/src/gpu/GrDrawTarget.cpp b/src/third_party/skia/src/gpu/GrDrawTarget.cpp
index eb89915..b3e214b 100644
--- a/src/third_party/skia/src/gpu/GrDrawTarget.cpp
+++ b/src/third_party/skia/src/gpu/GrDrawTarget.cpp
@@ -6,9 +6,10 @@
  * found in the LICENSE file.
  */
 
-
-
 #include "GrDrawTarget.h"
+
+#include <cstddef>
+
 #include "GrContext.h"
 #include "GrDrawTargetCaps.h"
 #include "GrPath.h"
@@ -84,8 +85,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-#define DEBUG_INVAL_BUFFER 0xdeadcafe
-#define DEBUG_INVAL_START_IDX -1
+namespace {
+  const std::size_t DEBUG_INVAL_BUFFER = 0xdeadcafe;
+  const std::ptrdiff_t DEBUG_INVAL_START_IDX = -1;
+}
 
 GrDrawTarget::GrDrawTarget(GrContext* context)
     : fClip(NULL)
diff --git a/src/third_party/skia/src/gpu/GrGpu.cpp b/src/third_party/skia/src/gpu/GrGpu.cpp
index 1f01e12..fc27639 100644
--- a/src/third_party/skia/src/gpu/GrGpu.cpp
+++ b/src/third_party/skia/src/gpu/GrGpu.cpp
@@ -6,9 +6,10 @@
  * found in the LICENSE file.
  */
 
-
 #include "GrGpu.h"
 
+#include <cstddef>
+
 #include "GrBufferAllocPool.h"
 #include "GrContext.h"
 #include "GrDrawTargetCaps.h"
@@ -24,8 +25,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-#define DEBUG_INVAL_BUFFER    0xdeadcafe
-#define DEBUG_INVAL_START_IDX -1
+namespace {
+  const std::size_t DEBUG_INVAL_BUFFER = 0xdeadcafe;
+  const std::ptrdiff_t DEBUG_INVAL_START_IDX = -1;
+}
 
 GrGpu::GrGpu(GrContext* context)
     : GrDrawTarget(context)
diff --git a/src/third_party/sqlite/sqlite.gyp b/src/third_party/sqlite/sqlite.gyp
index d252418..6ebd66f 100644
--- a/src/third_party/sqlite/sqlite.gyp
+++ b/src/third_party/sqlite/sqlite.gyp
@@ -24,16 +24,6 @@
     {
       'target_name': 'sqlite',
       'conditions': [
-        [ 'chromeos==1' , {
-            'defines': [
-                # Despite obvious warnings about not using this flag
-                # in deployment, we are turning off sync in ChromeOS
-                # and relying on the underlying journaling filesystem
-                # to do error recovery properly.  It's much faster.
-                'SQLITE_NO_SYNC',
-                ],
-          },
-        ],
         ['use_system_sqlite', {
           'type': 'none',
           'direct_dependent_settings': {
diff --git a/src/tools/gyp/pylib/gyp/MSVSVersion.py b/src/tools/gyp/pylib/gyp/MSVSVersion.py
index 6c44bb4..8f80554 100644
--- a/src/tools/gyp/pylib/gyp/MSVSVersion.py
+++ b/src/tools/gyp/pylib/gyp/MSVSVersion.py
@@ -313,7 +313,7 @@
         path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE'
       path = _ConvertToCygpath(path)
       full_path = os.path.join(path, 'devenv.exe')
-      if os.path.exists(full_path):
+      if os.path.exists(full_path) and version in version_to_year:
         versions.append(_CreateVersion(version_to_year[version],
             os.path.join(path, '..', '..')))
       continue
@@ -332,12 +332,13 @@
       # Check for full.
       full_path = os.path.join(path, 'devenv.exe')
       express_path = os.path.join(path, 'vcexpress.exe')
-      if not force_express and os.path.exists(full_path):
+      if (not force_express and os.path.exists(full_path) and
+          version in version_to_year):
         # Add this one.
         versions.append(_CreateVersion(version_to_year[version],
             os.path.join(path, '..', '..')))
       # Check for express.
-      elif os.path.exists(express_path):
+      elif os.path.exists(express_path) and version in version_to_year:
         # Add this one.
         versions.append(_CreateVersion(version_to_year[version] + 'e',
             os.path.join(path, '..', '..')))
@@ -350,9 +351,9 @@
       if not path:
         continue
       path = _ConvertToCygpath(path)
-      versions.append(_CreateVersion(version_to_year[version] + 'e',
-          os.path.join(path, '..'), sdk_based=True))
-
+      if version in version_to_year:
+        versions.append(_CreateVersion(version_to_year[version] + 'e',
+            os.path.join(path, '..'), sdk_based=True))
   return versions
 
 
diff --git a/src/tools/gyp/pylib/gyp/generator/ninja.py b/src/tools/gyp/pylib/gyp/generator/ninja.py
index cd5a218..0a1887d 100755
--- a/src/tools/gyp/pylib/gyp/generator/ninja.py
+++ b/src/tools/gyp/pylib/gyp/generator/ninja.py
@@ -13,9 +13,7 @@
 import subprocess
 import sys
 
-_COBALT_SRC = os.path.abspath(os.path.join(*([__file__] + 6 * [os.pardir])))
-sys.path.append(os.path.join(_COBALT_SRC, 'cobalt', 'build', 'config'))
-from base import LoadPlatformConfig
+from cobalt.build import config
 
 import gyp
 import gyp.common
@@ -89,16 +87,9 @@
 sony_flavors = ['ps3', 'ps4']
 windows_host_flavors = microsoft_flavors + sony_flavors
 
-_platform_configs = {}
-
 
 def GetToolchainOrNone(flavor):
-  if not flavor in _platform_configs.keys():
-    _platform_configs[flavor] = LoadPlatformConfig(flavor)
-  toolchain = _platform_configs[flavor].GetToolchain()
-  if toolchain:
-    return toolchain
-  return None
+  return config.GetPlatformConfig(flavor).GetToolchain()
 
 
 def StripPrefix(arg, prefix):