Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: ios/web/web_state/js/crw_js_window_id_manager_unittest.mm

Issue 1129763003: Re-enable JSWindowIDManagerTest.WindowID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting fix Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/public/web_state/js/crw_js_window_id_manager_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « ios/web/public/web_state/js/crw_js_window_id_manager_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698