diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
index d9e2adb..d28ebff 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php
@@ -43,6 +43,12 @@ function setUp() {
    * Test the theme settings form.
    */
   function testThemeSettings() {
+    // Ensure invalid theme settings form URLs return a proper 404.
+    $this->drupalGet('admin/appearance/settings/bartik');
+    $this->assertResponse(404, 'The theme settings form URL for a disabled theme could not be found.');
+    $this->drupalGet('admin/appearance/settings/' . $this->randomName());
+    $this->assertResponse(404, 'The theme settings form URL for a non-existent theme could not be found.');
+
     // Specify a filesystem path to be used for the logo.
     $file = current($this->drupalGetTestFiles('image'));
     $file_relative = strtr($file->uri, array('public:/' => variable_get('file_public_path', conf_path() . '/files')));
