diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 6d2dd8f..fcdddea 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -7,6 +7,8 @@
 use Drupal\Component\Utility\Timer;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Component\Utility\Url;
+use Drupal\Component\Utility\UrlValidator;
+use Drupal\Core\Bootstrap\Bootstrap;
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Database\Database;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
@@ -168,13 +170,6 @@
 const DRUPAL_AUTHENTICATED_RID = 'authenticated';
 
 /**
- * The number of bytes in a kilobyte.
- *
- * For more information, visit http://en.wikipedia.org/wiki/Kilobyte.
- */
-const DRUPAL_KILOBYTE = 1024;
-
-/**
  * The maximum number of characters in a module or theme name.
  */
 const DRUPAL_EXTENSION_NAME_MAX_LENGTH = 50;
@@ -435,27 +430,6 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) {
 /**
  * Sets appropriate server variables needed for command line scripts to work.
  *
- * This function can be called by command line scripts before bootstrapping
- * Drupal, to ensure that the page loads with the desired server parameters.
- * This is because many parts of Drupal assume that they are running in a web
- * browser and therefore use information from the global PHP $_SERVER variable
- * that does not get set when Drupal is run from the command line.
- *
- * In many cases, the default way in which this function populates the $_SERVER
- * variable is sufficient, and it can therefore be called without passing in
- * any input. However, command line scripts running on a multisite installation
- * (or on any installation that has settings.php stored somewhere other than
- * the sites/default folder) need to pass in the URL of the site to allow
- * Drupal to detect the correct location of the settings.php file. Passing in
- * the 'url' parameter is also required for functions like request_uri() to
- * return the expected values.
- *
- * Most other parameters do not need to be passed in, but may be necessary in
- * some cases; for example, if \Drupal::request()->getClientIP()
- * needs to return anything but the standard localhost value ('127.0.0.1'),
- * the command line script should pass in the desired value via the
- * 'REMOTE_ADDR' key.
- *
  * @param $variables
  *   (optional) An associative array of variables within $_SERVER that should
  *   be replaced. If the special element 'url' is provided in this array, it
@@ -466,33 +440,12 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) {
  * @see conf_path()
  * @see request_uri()
  * @see \Symfony\Component\HttpFoundation\Request::getClientIP()
+ *
+ * @deprecated as of Drupal 8.0. Use
+ *   Drupal\Core\Bootstrap\Bootstrap::overrideServerVariables() directly instead.
  */
 function drupal_override_server_variables($variables = array()) {
-  // Allow the provided URL to override any existing values in $_SERVER.
-  if (isset($variables['url'])) {
-    $url = parse_url($variables['url']);
-    if (isset($url['host'])) {
-      $_SERVER['HTTP_HOST'] = $url['host'];
-    }
-    if (isset($url['path'])) {
-      $_SERVER['SCRIPT_NAME'] = $url['path'];
-    }
-    unset($variables['url']);
-  }
-  // Define default values for $_SERVER keys. These will be used if $_SERVER
-  // does not already define them and no other values are passed in to this
-  // function.
-  $defaults = array(
-    'HTTP_HOST' => 'localhost',
-    'SCRIPT_NAME' => NULL,
-    'REMOTE_ADDR' => '127.0.0.1',
-    'REQUEST_METHOD' => 'GET',
-    'SERVER_NAME' => NULL,
-    'SERVER_SOFTWARE' => NULL,
-    'HTTP_USER_AGENT' => NULL,
-  );
-  // Replace elements of the $_SERVER array, as appropriate.
-  $_SERVER = $variables + $_SERVER + $defaults;
+  Bootstrap::overrideServerVariables($variables);
 }
 
 /**
@@ -3005,31 +2958,12 @@ function _drupal_shutdown_function() {
 /**
  * Compares the memory required for an operation to the available memory.
  *
- * @param $required
- *   The memory required for the operation, expressed as a number of bytes with
- *   optional SI or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G, 6GiB, 8bytes,
- *   9mbytes).
- * @param $memory_limit
- *   (optional) The memory limit for the operation, expressed as a number of
- *   bytes with optional SI or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G,
- *   6GiB, 8bytes, 9mbytes). If no value is passed, the current PHP
- *   memory_limit will be used. Defaults to NULL.
- *
- * @return
- *   TRUE if there is sufficient memory to allow the operation, or FALSE
- *   otherwise.
+ * @deprecated as of Drupal 8.0.
+ *   Use \Drupal\Core\Bootstrap\Bootstrap::checkMemoryLimit() directly
+ *   instead.
  */
 function drupal_check_memory_limit($required, $memory_limit = NULL) {
-  if (!isset($memory_limit)) {
-    $memory_limit = ini_get('memory_limit');
-  }
-
-  // There is sufficient memory if:
-  // - No memory limit is set.
-  // - The memory limit is set to unlimited (-1).
-  // - The memory limit is greater than or equal to the memory required for
-  //   the operation.
-  return ((!$memory_limit) || ($memory_limit == -1) || (parse_size($memory_limit) >= parse_size($required)));
+  return Bootstrap::checkMemoryLimit($required, $memory_limit);
 }
 
 /**
diff --git a/core/includes/common.inc b/core/includes/common.inc
index b339eb6..8e9a3ae 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1,5 +1,6 @@
 <?php
 
+use Drupal\Component\Utility\Bytes;
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Json;
 use Drupal\Component\Utility\Settings;
@@ -985,17 +986,12 @@ function format_plural($count, $singular, $plural, array $args = array(), array
  *
  * @return
  *   An integer representation of the size in bytes.
+ *
+ * @deprecated as of Drupal 8.0. Use
+ *   \Drupal\Component\Utility\Bytes::parseSize() directly instead.
  */
 function parse_size($size) {
-  $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
-  $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
-  if ($unit) {
-    // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
-    return round($size * pow(DRUPAL_KILOBYTE, stripos('bkmgtpezy', $unit[0])));
-  }
-  else {
-    return round($size);
-  }
+  return Bytes::parseSize($size);
 }
 
 /**
@@ -1011,11 +1007,11 @@ function parse_size($size) {
  *   A translated string representation of the size.
  */
 function format_size($size, $langcode = NULL) {
-  if ($size < DRUPAL_KILOBYTE) {
+  if ($size < Bytes::KILOBYTE) {
     return format_plural($size, '1 byte', '@count bytes', array(), array('langcode' => $langcode));
   }
   else {
-    $size = $size / DRUPAL_KILOBYTE; // Convert bytes to kilobytes.
+    $size = $size / Bytes::KILOBYTE; // Convert bytes to kilobytes.
     $units = array(
       t('@size KB', array(), array('langcode' => $langcode)),
       t('@size MB', array(), array('langcode' => $langcode)),
@@ -1027,8 +1023,8 @@ function format_size($size, $langcode = NULL) {
       t('@size YB', array(), array('langcode' => $langcode)),
     );
     foreach ($units as $unit) {
-      if (round($size, 2) >= DRUPAL_KILOBYTE) {
-        $size = $size / DRUPAL_KILOBYTE;
+      if (round($size, 2) >= Bytes::KILOBYTE) {
+        $size = $size / Bytes::KILOBYTE;
       }
       else {
         break;
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 6065dd4..7f232e3 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -9,6 +9,10 @@
 use Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage;
 use Drupal\Component\Utility\String;
 use Drupal\Core\StreamWrapper\PublicStream;
+use Drupal\Component\Utility\Bytes;
+use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\HttpFoundation\BinaryFileResponse;
 
 /**
  * Stream wrapper bit flags that are the basis for composite types.
@@ -1206,11 +1210,11 @@ function file_upload_max_size() {
 
   if ($max_size < 0) {
     // Start with post_max_size.
-    $max_size = parse_size(ini_get('post_max_size'));
+    $max_size = Bytes::parseSize(ini_get('post_max_size'));
 
     // If upload_max_size is less, then reduce. Except if upload_max_size is
     // zero, which indicates no limit.
-    $upload_max = parse_size(ini_get('upload_max_filesize'));
+    $upload_max = Bytes::parseSize(ini_get('upload_max_filesize'));
     if ($upload_max > 0 && $upload_max < $max_size) {
       $max_size = $upload_max;
     }
diff --git a/core/lib/Drupal/Component/Utility/Bytes.php b/core/lib/Drupal/Component/Utility/Bytes.php
new file mode 100644
index 0000000..0bc5aa9
--- /dev/null
+++ b/core/lib/Drupal/Component/Utility/Bytes.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Component\Bytes\Bytes.
+ */
+namespace Drupal\Component\Utility;
+
+/**
+ * Provides helper methods for manipulating byte conversions.
+ */
+class Bytes {
+
+  /**
+   * The number of bytes in a kilobyte.
+   *
+   * For more information, visit http://en.wikipedia.org/wiki/Kilobyte.
+   */
+  const KILOBYTE = 1024;
+
+  /**
+   * Parses a given byte count.
+   *
+   * @param mixed $size
+   *   An integer or string size expressed as a number of bytes with optional SI
+   *   or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G, 6GiB, 8 bytes, 9mbytes).
+   *
+   * @return integer
+   *   An integer representation of the size in bytes.
+   */
+  public static function parseSize($size) {
+    $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
+    $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
+    if ($unit) {
+      // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
+      return round($size * pow(self::KILOBYTE, stripos('bkmgtpezy', $unit[0])));
+    }
+    else {
+      return round($size);
+    }
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Bootstrap/Bootstrap.php b/core/lib/Drupal/Core/Bootstrap/Bootstrap.php
new file mode 100644
index 0000000..5c5f9db
--- /dev/null
+++ b/core/lib/Drupal/Core/Bootstrap/Bootstrap.php
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Bootstrap\Bootstrap.
+ */
+namespace Drupal\Core\Bootstrap;
+
+use Drupal\Component\Utility\Bytes;
+
+/**
+ * Provides helper methods for bootstrapping Drupal.
+ */
+class Bootstrap {
+
+  /**
+   * Compares the memory required for an operation to the available memory.
+   *
+   * @param string $required
+   *   The memory required for the operation, expressed as a number of bytes with
+   *   optional SI or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G, 6GiB, 8bytes,
+   *   9mbytes).
+   * @param $memory_limit
+   *   (optional) The memory limit for the operation, expressed as a number of
+   *   bytes with optional SI or IEC binary unit prefix (e.g. 2, 3K, 5MB, 10G,
+   *   6GiB, 8bytes, 9mbytes). If no value is passed, the current PHP
+   *   memory_limit will be used. Defaults to NULL.
+   *
+   * @return boolean
+   *   TRUE if there is sufficient memory to allow the operation, or FALSE
+   *   otherwise.
+   */
+  public static function checkMemoryLimit($required, $memory_limit = NULL) {
+    if (!isset($memory_limit)) {
+      $memory_limit = ini_get('memory_limit');
+    }
+
+    // There is sufficient memory if:
+    // - No memory limit is set.
+    // - The memory limit is set to unlimited (-1).
+    // - The memory limit is greater than or equal to the memory required for
+    //   the operation.
+    return ((!$memory_limit) || ($memory_limit == -1) || (Bytes::parseSize($memory_limit) >= Bytes::parseSize($required)));
+  }
+
+  /**
+   * Sets appropriate server variables needed for command line scripts to work.
+   *
+   * This function can be called by command line scripts before bootstrapping
+   * Drupal, to ensure that the page loads with the desired server parameters.
+   * This is because many parts of Drupal assume that they are running in a web
+   * browser and therefore use information from the global PHP $_SERVER variable
+   * that does not get set when Drupal is run from the command line.
+   *
+   * In many cases, the default way in which this function populates the $_SERVER
+   * variable is sufficient, and it can therefore be called without passing in
+   * any input. However, command line scripts running on a multisite installation
+   * (or on any installation that has settings.php stored somewhere other than
+   * the sites/default folder) need to pass in the URL of the site to allow
+   * Drupal to detect the correct location of the settings.php file. Passing in
+   * the 'url' parameter is also required for functions like request_uri() to
+   * return the expected values.
+   *
+   * Most other parameters do not need to be passed in, but may be necessary in
+   * some cases; for example, if \Drupal::request()->getClientIP()
+   * needs to return anything but the standard localhost value ('127.0.0.1'),
+   * the command line script should pass in the desired value via the
+   * 'REMOTE_ADDR' key.
+   *
+   * @param array $variables
+   *   (optional) An associative array of variables within $_SERVER that should
+   *   be replaced. If the special element 'url' is provided in this array, it
+   *   will be used to populate some of the server defaults; it should be set to
+   *   the URL of the current page request, excluding any $_GET request but
+   *   including the script name (e.g., http://www.example.com/mysite/index.php).
+   *
+   * @see conf_path()
+   * @see request_uri()
+   * @see \Symfony\Component\HttpFoundation\Request::getClientIP()
+   *
+   * @todo Replace use of `$_REQUEST` with a Symfony request object.
+   */
+  public static function overrideServerVariables($variables = array()) {
+    // Allow the provided URL to override any existing values in $_SERVER.
+    if (isset($variables['url'])) {
+      $url = parse_url($variables['url']);
+      if (isset($url['host'])) {
+        $_SERVER['HTTP_HOST'] = $url['host'];
+      }
+      if (isset($url['path'])) {
+        $_SERVER['SCRIPT_NAME'] = $url['path'];
+      }
+      unset($variables['url']);
+    }
+    // Define default values for $_SERVER keys. These will be used if $_SERVER
+    // does not already define them and no other values are passed in to this
+    // function.
+    $defaults = array(
+      'HTTP_HOST' => 'localhost',
+      'SCRIPT_NAME' => NULL,
+      'REMOTE_ADDR' => '127.0.0.1',
+      'REQUEST_METHOD' => 'GET',
+      'SERVER_NAME' => NULL,
+      'SERVER_SOFTWARE' => NULL,
+      'HTTP_USER_AGENT' => NULL,
+    );
+    // Replace elements of the $_SERVER array, as appropriate.
+    $_SERVER = $variables + $_SERVER + $defaults;
+  }
+
+}
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index e9710c2..00bc8f5 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -5,6 +5,7 @@
  */
 
 use Drupal\Core\Asset\CssOptimizer;
+use Drupal\Component\Utility\Bytes;
 
 /**
  * Implements hook_help().
@@ -309,7 +310,7 @@ function color_scheme_form_submit($form, &$form_state) {
   // scheme change based on a faulty memory calculation.
   $usage = memory_get_usage(TRUE);
   $memory_limit = ini_get('memory_limit');
-  $size = parse_size($memory_limit);
+  $size = Bytes::parseSize($memory_limit);
   if (!drupal_check_memory_limit($usage + $required, $memory_limit)) {
     drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $size), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
     return;
diff --git a/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php b/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php
index fb6090a..35718d0 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\file\Plugin\field\field_type;
 
+use Drupal\Component\Utility\Bytes;
 use Drupal\Core\Entity\Plugin\field\field_type\EntityReferenceItem;
 use Drupal\field\FieldInterface;
 use Drupal\field\Plugin\Type\FieldType\ConfigFieldItemInterface;
@@ -249,13 +250,13 @@ public static function validateExtensions($element, &$form_state) {
    * Form API callback.
    *
    * Ensures that a size has been entered and that it can be parsed by
-   * parse_size().
+   * \Drupal\Component\Utility\Bytes::parseSize().
    *
    * This function is assigned as an #element_validate callback in
    * instanceSettingsForm().
    */
   public static function validateMaxFilesize($element, &$form_state) {
-    if (!empty($element['#value']) && !is_numeric(parse_size($element['#value']))) {
+      if (!empty($element['#value']) && !is_numeric(Bytes::parseSize($element['#value']))) {
       form_error($element, t('The "!name" option must contain a valid value. You may either leave the text field empty or enter a string like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes).', array('!name' => t($element['title']))));
     }
   }
@@ -293,9 +294,9 @@ public function getUploadValidators() {
     $settings = $this->getFieldSettings();
 
     // Cap the upload size according to the PHP limit.
-    $max_filesize = parse_size(file_upload_max_size());
+    $max_filesize = Bytes::parseSize(file_upload_max_size());
     if (!empty($settings['max_filesize'])) {
-      $max_filesize = min($max_filesize, parse_size($settings['max_filesize']));
+      $max_filesize = min($max_filesize, Bytes::parseSize($settings['max_filesize']));
     }
 
     // There is always a file size limit due to the PHP server limit.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/MiscUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/MiscUnitTest.php
deleted file mode 100644
index f94c419..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/MiscUnitTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Bootstrap\MiscUnitTest.
- */
-
-namespace Drupal\system\Tests\Bootstrap;
-
-use Drupal\simpletest\UnitTestBase;
-
-/**
- * Tests miscellaneous functions in bootstrap.inc.
- */
-class MiscUnitTest extends UnitTestBase {
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Miscellaneous bootstrap unit tests',
-      'description' => 'Test miscellaneous functions in bootstrap.inc.',
-      'group' => 'Bootstrap',
-    );
-  }
-
-  /**
-   * Tests that the drupal_check_memory_limit() function works as expected.
-   */
-  function testCheckMemoryLimit() {
-    $memory_limit = ini_get('memory_limit');
-    // Test that a very reasonable amount of memory is available.
-    $this->assertTrue(drupal_check_memory_limit('30MB'), '30MB of memory tested available.');
-
-    // Get the available memory and multiply it by two to make it unreasonably
-    // high.
-    $twice_avail_memory = ($memory_limit * 2) . 'MB';
-    // The function should always return true if the memory limit is set to -1.
-    $this->assertTrue(drupal_check_memory_limit($twice_avail_memory, -1), 'drupal_check_memory_limit() returns TRUE when a limit of -1 (none) is supplied');
-
-    // Test that even though we have 30MB of memory available - the function
-    // returns FALSE when given an upper limit for how much memory can be used.
-    $this->assertFalse(drupal_check_memory_limit('30MB', '16MB'), 'drupal_check_memory_limit() returns FALSE with a 16MB upper limit on a 30MB requirement.');
-
-    // Test that an equal amount of memory to the amount requested returns TRUE.
-    $this->assertTrue(drupal_check_memory_limit('30MB', '30MB'), 'drupal_check_memory_limit() returns TRUE when requesting 30MB on a 30MB requirement.');
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/OverrideServerVariablesUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/OverrideServerVariablesUnitTest.php
deleted file mode 100644
index 0717b10..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/OverrideServerVariablesUnitTest.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Bootstrap\OverrideServerVariablesUnitTest.
- */
-
-namespace Drupal\system\Tests\Bootstrap;
-
-use Drupal\simpletest\UnitTestBase;
-
-/**
- * Tests for overriding server variables via the API.
- */
-class OverrideServerVariablesUnitTest extends UnitTestBase {
-  public static function getInfo() {
-    return array(
-      'name' => 'Overriding server variables',
-      'description' => 'Test that drupal_override_server_variables() works correctly.',
-      'group' => 'Bootstrap',
-    );
-  }
-
-  /**
-   * Tests providing a direct URL to to drupal_override_server_variables().
-   */
-  function testDrupalOverrideServerVariablesProvidedURL() {
-    $tests = array(
-      'http://example.com' => array(
-        'HTTP_HOST' => 'example.com',
-        'SCRIPT_NAME' => isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : NULL,
-      ),
-      'http://example.com/index.php' => array(
-        'HTTP_HOST' => 'example.com',
-        'SCRIPT_NAME' => '/index.php',
-      ),
-      'http://example.com/subdirectory/index.php' => array(
-        'HTTP_HOST' => 'example.com',
-        'SCRIPT_NAME' => '/subdirectory/index.php',
-      ),
-    );
-    foreach ($tests as $url => $expected_server_values) {
-      // Remember the original value of $_SERVER, since the function call below
-      // will modify it.
-      $original_server = $_SERVER;
-      // Call drupal_override_server_variables() and ensure that all expected
-      // $_SERVER variables were modified correctly.
-      drupal_override_server_variables(array('url' => $url));
-      foreach ($expected_server_values as $key => $value) {
-        $this->assertIdentical($_SERVER[$key], $value);
-      }
-      // Restore the original value of $_SERVER.
-      $_SERVER = $original_server;
-    }
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/SizeUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/SizeUnitTest.php
index a8a2662..64dd14f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/SizeUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/SizeUnitTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Common;
 
+use Drupal\Component\Utility\Bytes;
 use Drupal\simpletest\UnitTestBase;
 
 /**
@@ -25,7 +26,7 @@ public static function getInfo() {
   }
 
   function setUp() {
-    $kb = DRUPAL_KILOBYTE;
+    $kb = Bytes::KILOBYTE;
     $this->exact_test_cases = array(
       '1 byte' => 1,
       '1 KB'   => $kb,
@@ -63,12 +64,12 @@ function testCommonFormatSize() {
   }
 
   /**
-   * Checks that parse_size() returns the proper byte sizes.
+   * Checks that Bytes::parseSize() returns the proper byte sizes.
    */
   function testCommonParseSize() {
     foreach ($this->exact_test_cases as $string => $size) {
       $this->assertEqual(
-        $parsed_size = parse_size($string),
+        $parsed_size = Bytes::parseSize($string),
         $size,
         $size . ' == ' . $parsed_size . ' (' . $string . ')'
       );
@@ -77,32 +78,32 @@ function testCommonParseSize() {
     // Some custom parsing tests
     $string = '23476892 bytes';
     $this->assertEqual(
-      ($parsed_size = parse_size($string)),
+      ($parsed_size = Bytes::parseSize($string)),
       $size = 23476892,
       $string . ' == ' . $parsed_size . ' bytes'
     );
     $string = '76MRandomStringThatShouldBeIgnoredByParseSize.'; // 76 MB
     $this->assertEqual(
-      $parsed_size = parse_size($string),
+      $parsed_size = Bytes::parseSize($string),
       $size = 79691776,
       $string . ' == ' . $parsed_size . ' bytes'
     );
     $string = '76.24 Giggabyte'; // Misspeld text -> 76.24 GB
     $this->assertEqual(
-      $parsed_size = parse_size($string),
+      $parsed_size = Bytes::parseSize($string),
       $size = 81862076662,
       $string . ' == ' . $parsed_size . ' bytes'
     );
   }
 
   /**
-   * Cross-tests parse_size() and format_size().
+   * Cross-tests Bytes::parseSize() and format_size().
    */
   function testCommonParseSizeFormatSize() {
     foreach ($this->exact_test_cases as $size) {
       $this->assertEqual(
         $size,
-        ($parsed_size = parse_size($string = format_size($size, NULL))),
+        ($parsed_size = Bytes::parseSize($string = format_size($size, NULL))),
         $size . ' == ' . $parsed_size . ' (' . $string . ')'
       );
     }
diff --git a/core/tests/Drupal/Tests/Core/Bootstrap/BootstrapTest.php b/core/tests/Drupal/Tests/Core/Bootstrap/BootstrapTest.php
new file mode 100644
index 0000000..d1a0f9d
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Bootstrap/BootstrapTest.php
@@ -0,0 +1,138 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Tests\Bootstrap\BootstrapTest.
+ */
+
+namespace Drupal\Tests\Core\Bootstrap;
+
+use Drupal\Core\Bootstrap\Bootstrap;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Tests for various bootstrap operations.
+ *
+ * @see \Drupal\Core\Bootstrap\Bootstrap
+ */
+class BootstrapTest extends UnitTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Overriding server variables',
+      'description' => 'Test that drupal_override_server_variables() works correctly.',
+      'group' => 'Bootstrap',
+    );
+  }
+
+  /**
+   * Tests providing a direct URL to to drupal_override_server_variables().
+   *
+   * @param string $url
+   *   The url argument for Bootstrap::overrideServerVariables().
+   * @param array $expected_server_values
+   *   Expected values of the `$_SERVER` variable after calling
+   *   Bootstrap::overrideServerVariables().
+   *
+   * @dataProvider providerTestOverrideServerVariables
+   */
+  public function testOverrideServerVariables($url, $expected_server_values) {
+    // Remember the original value of $_SERVER, since the function call below
+    // will modify it.
+    $original_server = $_SERVER;
+    // Call drupal_override_server_variables() and ensure that all expected
+    // $_SERVER variables were modified correctly.
+    Bootstrap::overrideServerVariables(array('url' => $url));
+    foreach ($expected_server_values as $key => $value) {
+      $this->assertSame($_SERVER[$key], $value);
+    }
+    // Restore the original value of $_SERVER.
+    $_SERVER = $original_server;
+  }
+
+  /**
+   * Tests that the Bootstrap::checkMemoryLimit() method works as expected.
+   *
+   * @param string $required
+   *   The required memory limit argument for Bootstrap::checkMemoryLimit().
+   * @param string $memory_limit
+   *   The memory limit argument for Bootstrap::checkMemoryLimit().
+   * @param boolean $expected
+   *   The expected return value from Bootstrap::checkMemoryLimit().
+   * @param string $message
+   *   The message to print on test failure.
+   *
+   * @dataProvider providerTestCheckMemoryLimit
+   */
+  public function testCheckMemoryLimit($required, $memory_limit, $expected, $message) {
+    $return = Bootstrap::checkMemoryLimit($required, $memory_limit);
+    $this->assertEquals($return, $expected, $message);
+  }
+
+  /**
+   * Provide data for self::testDrupalOverrideServerVariablesProvideURL().
+   *
+   * @return array
+   *   An array of arrays, each containing:
+   *   - 'url' - The url argument for Bootstrap::overrideServerVariables().
+   *   - 'expected_server_values' - Expected values of the `$_SERVER` variable
+   *     after calling Bootstrap::overrideServerVariables().
+   */
+  public function providerTestOverrideServerVariables() {
+    return array(
+      // Array of the form array(uri, expected values).
+      array(
+        'http://example.com',
+        array(
+          'HTTP_HOST' => 'example.com',
+          'SCRIPT_NAME' => isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : NULL,
+        ),
+      ),
+      array(
+        'http://example.com/index.php',
+        array(
+          'HTTP_HOST' => 'example.com',
+          'SCRIPT_NAME' => '/index.php',
+        ),
+      ),
+      array(
+        'http://example.com/subdirectory/index.php',
+        array(
+          'HTTP_HOST' => 'example.com',
+          'SCRIPT_NAME' => '/subdirectory/index.php',
+        ),
+      ),
+    );
+  }
+
+  /**
+   * Data provider for self::testCheckMemoryLimit().
+   *
+   * @return array
+   *   An array of arrays, each containing:
+   *   - 'required' - The required memory limit argument for Bootstrap::checkMemoryLimit().
+   *   - 'memory_limit` - The memory limit argument for Bootstrap::checkMemoryLimit().
+   *   - 'expected' - The expected return value from Bootstrap::checkMemoryLimit().
+   *   - 'message' - The message to print on test failure.
+   */
+  public function providerTestCheckMemoryLimit() {
+    $memory_limit = ini_get('memory_limit');
+    $twice_avail_memory = ($memory_limit * 2) . 'MB';
+
+    return array(
+      // Test that a very reasonable amount of memory is available.
+      array('30MB', NULL, TRUE, '30MB of memory tested not available.'),
+
+      // Get the available memory and multiply it by two to make it unreasonably
+      // high.
+      array($twice_avail_memory, -1, TRUE, 'Bootstrap::checkMemoryLimit() failed to return TRUE when a limit of -1 (none) is supplied'),
+
+      // Test that even though we have 30MB of memory available - the function
+      // returns FALSE when given an upper limit for how much memory can be used.
+      array('30MB', '16MB', FALSE, 'Bootstrap::checkMemoryLimit() failed to return FALSE with a 16MB upper limit on a 30MB requirement.'),
+
+      // Test that an equal amount of memory to the amount requested returns TRUE.
+      array('30MB', '30MB', TRUE, 'Bootstrap::checkMemoryLimit() failed to return TRUE when requesting 30MB on a 30MB requirement.'),
+    );
+  }
+
+}
