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

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

Issue 2814773002: Move password-related methods from core.js to password_controller.js. (Closed)
Patch Set: Created 3 years, 8 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
Index: ios/web/web_state/js/core_js_unittest.mm
diff --git a/ios/web/web_state/js/core_js_unittest.mm b/ios/web/web_state/js/core_js_unittest.mm
index 4d7623ffca5e5fb0b638f4c064180a3d7213ff4e..23009fe4a77c05ecd5c45e85bc9fa8ceacb5bc23 100644
--- a/ios/web/web_state/js/core_js_unittest.mm
+++ b/ios/web/web_state/js/core_js_unittest.mm
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/strings/stringprintf.h"
-#import "base/strings/sys_string_conversions.h"
#import "ios/web/public/test/web_test_with_web_state.h"
#import "ios/web/public/web_state/ui/crw_web_view_proxy.h"
#import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h"
@@ -156,44 +155,6 @@ TEST_F(CoreJsTest, TextAreaStopsProximity) {
}
}
-struct TestDataForPasswordFormDetection {
- NSString* pageContent;
- NSNumber* containsPassword;
-};
-
-TEST_F(CoreJsTest, HasPasswordField) {
- TestDataForPasswordFormDetection testData[] = {
- // Form without a password field.
- {@"<form><input type='text' name='password'></form>", @NO},
- // Form with a password field.
- {@"<form><input type='password' name='password'></form>", @YES}};
- for (size_t i = 0; i < arraysize(testData); i++) {
- TestDataForPasswordFormDetection& data = testData[i];
- LoadHtml(data.pageContent);
- id result = ExecuteJavaScript(@"__gCrWeb.hasPasswordField()");
- EXPECT_NSEQ(data.containsPassword, result)
- << " in test " << i << ": "
- << base::SysNSStringToUTF8(data.pageContent);
- }
-}
-
-TEST_F(CoreJsTest, HasPasswordFieldinFrame) {
- TestDataForPasswordFormDetection data = {
- // Form with a password field in a nested iframe.
- @"<iframe name='pf'></iframe>"
- "<script>"
- " var doc = frames['pf'].document.open();"
- " doc.write('<form><input type=\\'password\\'></form>');"
- " doc.close();"
- "</script>",
- @YES
- };
- LoadHtml(data.pageContent);
- id result = ExecuteJavaScript(@"__gCrWeb.hasPasswordField()");
- EXPECT_NSEQ(data.containsPassword, result)
- << base::SysNSStringToUTF8(data.pageContent);
-}
-
// Tests the javascript of the url of the an image present in the DOM.
TEST_F(CoreJsTest, LinkOfImage) {
// A page with a large image surrounded by a link.

Powered by Google App Engine
This is Rietveld 408576698