Chromium Code Reviews| Index: ios/web/web_state/js/crw_js_window_id_manager_unittest.mm |
| diff --git a/ios/web/public/web_state/js/crw_js_window_id_manager_unittest.mm b/ios/web/web_state/js/crw_js_window_id_manager_unittest.mm |
| similarity index 66% |
| rename from ios/web/public/web_state/js/crw_js_window_id_manager_unittest.mm |
| rename to ios/web/web_state/js/crw_js_window_id_manager_unittest.mm |
| index 4abc76abdda1b41e179327ff3ff3147262ec8a47..09b8ae880151a045530ebca1bcb8cdc1e10468d2 100644 |
| --- a/ios/web/public/web_state/js/crw_js_window_id_manager_unittest.mm |
| +++ b/ios/web/web_state/js/crw_js_window_id_manager_unittest.mm |
| @@ -33,19 +33,28 @@ class JSWindowIDManagerTest : public PlatformTest { |
| web::WebClient web_client_; |
| }; |
| -// TODO(jyquinn): enable this test (crbug.com/465898). |
| -TEST_F(JSWindowIDManagerTest, DISABLED_WindowID) { |
| +// Tests that reinjection of window ID JS results in a different window ID. |
| +// TODO(ios): This test only works for the current implementation using |
| +// UIWebView. CRWTestJSInjectionReceiver should be re-written to eliminate |
| +// web view specificity (crbug.com/486840). |
| +TEST_F(JSWindowIDManagerTest, WindowIDReinjection) { |
| EXPECT_TRUE(manager_.get()); |
| [manager_ inject]; |
| NSString* windowID = [manager_ windowId]; |
| EXPECT_EQ(32U, [windowID length]); |
| - // Inject a second time to check that the ID is different. |
| - [manager_ inject]; |
| - NSString* windowID2 = [manager_ windowId]; |
| - EXPECT_FALSE([windowID isEqualToString:windowID2]); |
| + // Reset the __gCrWeb object to enable reinjection. |
| + [receiver_ evaluateJavaScript:@"__gCrWeb = undefined;" |
|
Eugene But (OOO till 7-30)
2015/05/12 17:14:32
Please don't use async API in tests. If evaluation
Jackie Quinn
2015/05/12 17:50:01
Done.
|
| + stringResultHandler:^(NSString* result, NSError* error) { |
| + // Inject a second time to check that the ID is different. |
| + [manager_ inject]; |
| + NSString* windowID2 = [manager_ windowId]; |
| + EXPECT_FALSE([windowID isEqualToString:windowID2]); |
| + }]; |
| } |
| -TEST_F(JSWindowIDManagerTest, WindowIDDifferent) { |
| +// Tests that window ID injection by a second manager results in a different |
| +// window ID. |
| +TEST_F(JSWindowIDManagerTest, WindowIDDifferentManager) { |
| [manager_ inject]; |
| NSString* windowID = [manager_ windowId]; |
| base::scoped_nsobject<CRWTestJSInjectionReceiver> receiver2( |