The White House is testing smartphones from Samsung and LG Electronics for internal use, a person familiar with the matter said, threatening one of the last and most high-profile strongholds of BlackBerry. The devices are being tested by the White House’s internal technology team and the White House Communications Agency, a military unit in charge of President Barack Obama’s communications, the person said. The tests are in the early stages, the person said, and any implementation of Samsung or LG phones is still “months away.” There was no indication that Mr. Obama is switching from his modified BlackBerry. “We can confirm that the White House Communications Agency, consistent with the rest of the Department of Defense, is piloting and using a variety of mobile devices,” a Defense Department spokesman said. He declined to comment on the devices in the pilot test or in use at the White House.