 .../lib/Drupal/system/Tests/Ajax/FrameworkTest.php |   29 ++++++++++++--
 .../modules/ajax_forms_test/ajax_forms_test.module |   36 +++++++++++++++---
 .../tests/modules/ajax_test/ajax_test.module       |   40 +++++++++++++++-----
 3 files changed, 87 insertions(+), 18 deletions(-)

diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php
index e84a7d9..eced538 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php
@@ -47,14 +47,35 @@ public function testOrder() {
     // Expected commands, in a very specific order.
     $expected_commands[0] = new SettingsCommand(array('ajax' => 'test'), TRUE);
     drupal_static_reset('drupal_add_css');
-    drupal_add_css($path . '/css/system.admin.css');
-    drupal_add_css($path . '/css/system.maintenance.css');
+    $attached = array(
+      '#attached' => array(
+        'css' => array(
+          $path . '/css/system.admin.css' => array(),
+          $path . '/css/system.maintenance.css' => array()
+        ),
+      ),
+    );
+    drupal_render($attached);
     $expected_commands[1] = new AddCssCommand(drupal_get_css(drupal_add_css(), TRUE));
     drupal_static_reset('drupal_add_js');
-    drupal_add_js($path . '/system.js');
+    $attached = array(
+      '#attached' => array(
+        'js' => array(
+          $path . '/system.js' => array(),
+        ),
+      ),
+    );
+    drupal_render($attached);
     $expected_commands[2] = new PrependCommand('head', drupal_get_js('header', drupal_add_js(), TRUE));
     drupal_static_reset('drupal_add_js');
-    drupal_add_js($path . '/system.modules.js', array('scope' => 'footer'));
+    $attached = array(
+      '#attached' => array(
+        'js' => array(
+          $path . '/system.modules.js' => array('scope' => 'footer'),
+        ),
+      ),
+    );
+    drupal_render($attached);
     $expected_commands[3] = new AppendCommand('body', drupal_get_js('footer', drupal_add_js(), TRUE));
     $expected_commands[4] = new HtmlCommand('body', 'Hello, world!');
 
diff --git a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
index 31888d7..1521436 100644
--- a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
+++ b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
@@ -414,8 +414,21 @@ function ajax_forms_test_advanced_commands_add_css_callback($form, $form_state)
  * Ajax callback for 'settings' but with setting overrides.
  */
 function ajax_forms_test_advanced_commands_settings_with_merging_callback($form, $form_state) {
-  drupal_add_js(array('ajax_forms_test' => array('foo' => 42)), 'setting');
-  drupal_add_js(array('ajax_forms_test' => array('foo' => 9001)), 'setting');
+  $attached = array(
+    '#attached' => array(
+      'js' => array(
+        0 => array(
+          'type' => 'setting',
+          'data' => array('ajax_forms_test' => array('foo' => 42)),
+        ),
+        '1' => array(
+          'type' => 'setting',
+          'data' => array('ajax_forms_test' => array('foo' => 9001)),
+        ),
+      ),
+    ),
+  );
+  drupal_render($attached);
 
   $response = new AjaxResponse();
   return $response;
@@ -541,9 +554,22 @@ function ajax_forms_test_lazy_load_form($form, &$form_state) {
  */
 function ajax_forms_test_lazy_load_form_submit($form, &$form_state) {
   if ($form_state['values']['add_files']) {
-    drupal_add_js(array('ajax_forms_test_lazy_load_form_submit' => 'executed'), 'setting');
-    drupal_add_css(drupal_get_path('module', 'system') . '/css/system.admin.css');
-    drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
+    $path = drupal_get_path('module', 'system');
+    $attached = array(
+      '#attached' => array(
+        'css' => array(
+          $path . '/css/system.admin.css' => array(),
+        ),
+        'js' => array(
+          0 => array(
+            'type' => 'setting',
+            'data' => array('ajax_forms_test_lazy_load_form_submit' => 'executed'),
+          ),
+          $path . '/system.js' => array(),
+        ),
+      ),
+    );
+    drupal_render($attached);
   }
   $form_state['rebuild'] = TRUE;
 }
diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module
index ec2f239..f997473 100644
--- a/core/modules/system/tests/modules/ajax_test/ajax_test.module
+++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module
@@ -43,7 +43,17 @@ function ajax_test_system_theme_info() {
  * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::render()
  */
 function ajax_test_render() {
-  drupal_add_js(array('ajax' => 'test'), 'setting');
+  $attached = array(
+    '#attached' => array(
+      'js' => array(
+        0 => array(
+          'type' => 'setting',
+          'data' => array('ajax' => 'test'),
+        ),
+      ),
+    ),
+  );
+  drupal_render($attached);
   $response = new AjaxResponse();
   return $response;
 }
@@ -60,14 +70,26 @@ function ajax_test_order() {
   $path = drupal_get_path('module', 'system');
   // HTML insertion command.
   $response->addCommand(new HtmlCommand('body', 'Hello, world!'));
-  // Add two CSS files (order should remain the same).
-  drupal_add_css($path . '/css/system.admin.css');
-  drupal_add_css($path . '/css/system.maintenance.css');
-  // Add two JavaScript files (first to the footer, should appear last).
-  drupal_add_js($path . '/system.modules.js', array('scope' => 'footer'));
-  drupal_add_js($path . '/system.js');
-  // Finally, add a JavaScript setting.
-  drupal_add_js(array('ajax' => 'test'), 'setting');
+  $attached = array(
+    '#attached' => array(
+      'css' => array(
+        // Add two CSS files (order should remain the same).
+        $path . '/css/system.admin.css' => array(),
+        $path . '/css/system.maintenance.css' => array(),
+      ),
+      'js' => array(
+        // Add two JavaScript files (first to the footer, should appear last).
+        $path . '/system.modules.js' => array('scope' => 'footer'),
+        $path . '/system.js' => array(),
+        // Finally, add a JavaScript setting.
+        0 => array(
+          'type' => 'setting',
+          'data' => array('ajax' => 'test'),
+        ),
+      ),
+    ),
+  );
+  drupal_render($attached);
   return $response;
 }
 
