diff --git a/modules/simpletest/tests/themes/test_theme/theme-settings.php b/modules/simpletest/tests/themes/test_theme/theme-settings.php
new file mode 100644
index 0000000..cb51d94
--- /dev/null
+++ b/modules/simpletest/tests/themes/test_theme/theme-settings.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Theme setting callbacks for the test_theme theme.
+ */
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function test_theme_form_system_theme_settings_alter(&$form, &$form_state) {
+  $form['test_theme_checkbox'] = array(
+    '#type' => 'checkbox',
+    '#title' => 'Test theme checkbox',
+    '#default_value' => theme_get_setting('test_theme_checkbox'),
+  );
+
+  // Force the form to be cached so we can test that this file is properly
+  // loaded and the custom submit handler is properly called even on a cached
+  // form build.
+  $form_state['cache'] = TRUE;
+  $form['#submit'][] = 'test_theme_form_system_theme_settings_submit';
+}
+
+/**
+ * Form submission handler for the test theme settings form.
+ *
+ * @see test_theme_form_system_theme_settings_alter()
+ */
+function test_theme_form_system_theme_settings_submit($form, &$form_state) {
+  drupal_set_message('The test theme setting was saved.');
+}
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index cdcc78f..a87e1af 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -572,9 +572,10 @@ function system_theme_settings($form, &$form_state, $key = '') {
     // Process the theme and all its base themes.
     foreach ($theme_keys as $theme) {
       // Include the theme-settings.php file.
-      $filename = DRUPAL_ROOT . '/' . str_replace("/$theme.info", '', $themes[$theme]->filename) . '/theme-settings.php';
-      if (file_exists($filename)) {
-        require_once $filename;
+      $theme_settings_path = drupal_get_path('theme', $theme) . '/theme-settings.php';
+      if (file_exists(DRUPAL_ROOT . '/' . $theme_settings_path)) {
+        require_once DRUPAL_ROOT . '/' . $theme_settings_path;
+        $form_state['build_info']['files'][] = $theme_settings_path;
       }
 
       // Call theme-specific settings.
diff --git a/modules/system/system.test b/modules/system/system.test
index 9eaf562..5ae3341 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -1944,6 +1944,30 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
     $this->assertEqual($elements[0]['src'], file_create_url($uploaded_filename));
   }
 
+
+  /**
+   * Test the individual per-theme settings form.
+   */
+  function testPerThemeSettings() {
+    // Enable the test theme and the module that controls it. Clear caches in
+    // between so that the module's hook_system_theme_info() implementation is
+    // correctly registered.
+    module_enable(array('theme_test'));
+    drupal_flush_all_caches();
+    theme_enable(array('test_theme'));
+
+    // Test that the theme-specific settings form can be saved and that the
+    // theme-specific checkbox is checked and unchecked as appropriate.
+    $this->drupalGet('admin/appearance/settings/test_theme');
+    $this->assertNoFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is unchecked.');
+    $this->drupalPost(NULL, array('test_theme_checkbox' => TRUE), t('Save configuration'));
+    $this->assertText('The test theme setting was saved.');
+    $this->assertFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is checked.');
+    $this->drupalPost(NULL, array('test_theme_checkbox' => FALSE), t('Save configuration'));
+    $this->assertText('The test theme setting was saved.');
+    $this->assertNoFieldChecked('edit-test-theme-checkbox', 'The test_theme_checkbox setting is unchecked.');
+  }
+
   /**
    * Test the administration theme functionality.
    */
