diff --git a/core/modules/field/tests/field_test.module b/core/modules/field/tests/field_test.module
index ef2fedb..a43a03a 100644
--- a/core/modules/field/tests/field_test.module
+++ b/core/modules/field/tests/field_test.module
@@ -250,3 +250,38 @@ function field_test_field_attach_view_alter(&$output, $context) {
     $output['test_field'][] = array('#markup' => 'field_test_field_attach_view_alter');
   }
 }
+
+/**
+ * Implements hook_field_widget_properties_alter().
+ */
+function field_test_field_widget_properties_alter(&$widget, $context) {
+  // Make the alter_test_text field 42 characters for nodes and comments.
+  if (in_array($context['entity_type'], array('node', 'comment')) && ($context['field']['field_name'] == 'alter_test_text')) {
+    $widget['settings']['size'] = 42;
+  }
+}
+
+/**
+ * Implements hook_field_widget_properties_ENTITY_TYPE_alter().
+ */
+function field_test_field_widget_properties_user_alter(&$widget, $context) {
+  // Always use buttons for the alter_test_options field on user forms.
+  if ($context['field']['field_name'] == 'alter_test_options') {
+    $widget['type'] = 'options_buttons';
+  }
+}
+
+/**
+ * Implements hook_field_widget_form_alter().
+ */
+function field_test_field_widget_form_alter(&$element, &$form_state, $context) {
+  switch ($context['field']['field_name']) {
+    case 'alter_test_text':
+      drupal_set_message('Field size: ' . $context['instance']['widget']['settings']['size']);
+      break;
+
+    case 'alter_test_options':
+      drupal_set_message('Widget type: ' . $context['instance']['widget']['type']);
+      break;
+  }
+}
diff --git a/core/modules/field_ui/field_ui.test b/core/modules/field_ui/field_ui.test
index 56bfbbe..b635c60 100644
--- a/core/modules/field_ui/field_ui.test
+++ b/core/modules/field_ui/field_ui.test
@@ -643,3 +643,73 @@ class FieldUIManageDisplayTestCase extends FieldUITestCase {
     return $return;
   }
 }
+
+/**
+ * Tests custom widget hooks and callbacks on the field administration pages.
+ */
+class FieldUIAlterTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Widget cutomization',
+      'description' => 'Test custom field widget hooks and callbacks on field aministration pages.',
+      'group' => 'Field UI',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('field_test'));
+
+    // Initialize field list.
+    $this->fields = array();
+
+    // Create test user.
+    $admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer users'));
+    $this->drupalLogin($admin_user);
+  }
+
+
+  function createFieldInstance($entity_type, $bundle, $widget_type, $field_name, $field_type = 'text') {
+    if (empty($this->fields[$field_name])) {
+      $this->fields[$field_name] = field_create_field(array('field_name' => $field_name, 'type' => $field_type));
+    }
+    $instance = array(
+      'field_name' => $field_name,
+      'entity_type' => $entity_type,
+      'bundle' => $bundle,
+      'label' => $this->randomName() . '_label',
+      'description' => $this->randomName() . '_description',
+      'weight' => mt_rand(0, 127),
+      'widget' => array(
+        'type' => $widget_type,
+        'label' => $this->randomName() . '_widget_label',
+      )
+    );
+    return field_create_instance($instance);
+  }
+
+  /**
+   * Tests hook_field_widget_properties_alter() on the default field widget.
+   *
+   * @see field_test_field_widget_properties_alter()
+   * @see field_test_field_widget_properties_user_alter()
+   * @see field_test_field_widget_form_alter()
+   */
+  function testDefaultWidgetPropertiesAlter() {
+
+    // Verify that the size of the alter_test_text field is altered to 42.
+    $text = $this->createFieldInstance('node', 'article', 'text_textfield', 'alter_test_text');
+    $this->drupalGet('admin/structure/types/manage/article/fields/alter_test_text');
+    $this->assertText('Field size: 42', 'Altered field size is found in hook_field_widget_form_alter().');
+
+    // Test that alter_test_options fields are altered on user entities.
+    $options_page = $this->createFieldInstance('user', 'user', 'options_select', 'alter_test_options');
+    $this->drupalGet('admin/config/people/accounts/fields/alter_test_options');
+    $this->assertText('Widget type: options_buttons', 'Widget type is altered for users in hook_field_widget_form_alter().');
+
+    // Test that alter_test_options fields are not altered on nodes.
+    $options_page = $this->createFieldInstance('node', 'page', 'options_select', 'alter_test_options', 'list_text');
+    $this->drupalGet('admin/structure/types/manage/page/fields/alter_test_options');
+    $this->assertText('Widget type: options_select', 'Widget type is not altered for pages in hook_field_widget_form_alter().');
+
+  }
+}
