| 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 75%
|
| 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..bc4280d3310290fb30cc10484eb312d97cad8b07 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
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/mac/scoped_nsobject.h"
|
| #import "ios/web/public/test/crw_test_js_injection_receiver.h"
|
| +#import "ios/web/public/test/js_test_util.h"
|
| #include "ios/web/public/web_client.h"
|
| #import "testing/gtest_mac.h"
|
| #include "testing/platform_test.h"
|
| @@ -33,19 +34,26 @@ 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]);
|
| + // Reset the __gCrWeb object to enable reinjection.
|
| + web::EvaluateJavaScriptAsString(manager_, @"__gCrWeb = undefined;");
|
| // 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(
|
|
|