add four cases to the test case and fix bugs of useragent app

I've added all four cases according to #802, and fix bugs of user agent app when run all tests