TEST_F(PasswordCredentialTest, CreateFromURLEncodedForm) { HTMLFormElement* form = populateForm("application/x-www-form-urlencoded", "<input type='text' name='theId' value='musterman' autocomplete='username'>" "<input type='text' name='thePassword' value='sekrit' autocomplete='current-password'>" "<input type='text' name='theIcon' value='https://example.com/photo' autocomplete='photo'>" "<input type='text' name='theExtraField' value='extra'>" "<input type='text' name='theName' value='friendly name' autocomplete='name'>"); PasswordCredential* credential = PasswordCredential::create(form, ASSERT_NO_EXCEPTION); ASSERT_NE(nullptr, credential); EXPECT_EQ("theId", credential->idName()); EXPECT_EQ("thePassword", credential->passwordName()); EXPECT_EQ("musterman", credential->id()); EXPECT_EQ("sekrit", credential->password()); EXPECT_EQ(KURL(ParsedURLString, "https://example.com/photo"), credential->iconURL()); EXPECT_EQ("friendly name", credential->name()); EXPECT_EQ("password", credential->type()); FormDataOrURLSearchParams additionalData; credential->additionalData(additionalData); ASSERT_TRUE(additionalData.isURLSearchParams()); EXPECT_TRUE(additionalData.getAsURLSearchParams()->has("theId")); EXPECT_TRUE(additionalData.getAsURLSearchParams()->has("thePassword")); EXPECT_TRUE(additionalData.getAsURLSearchParams()->has("theIcon")); EXPECT_TRUE(additionalData.getAsURLSearchParams()->has("theName")); EXPECT_TRUE(additionalData.getAsURLSearchParams()->has("theExtraField")); }
TEST_F(PasswordCredentialTest, CreateFromFormNoId) { HTMLFormElement* form = populateForm("multipart/form-data", "<!-- No username field. -->" "<input type='text' name='thePassword' value='sekrit' autocomplete='current-password'>" "<input type='text' name='theIcon' value='https://example.com/photo' autocomplete='photo'>" "<input type='text' name='theName' value='friendly name' autocomplete='name'>"); TrackExceptionState exceptionState; PasswordCredential* credential = PasswordCredential::create(form, exceptionState); EXPECT_EQ(nullptr, credential); EXPECT_TRUE(exceptionState.hadException()); EXPECT_EQ(V8TypeError, exceptionState.code()); EXPECT_EQ("'id' must not be empty.", exceptionState.message()); }
/* * A constructor */ MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName) : Pages() { setupUi(this); pgInitialize(tr("Media Info"), parentWidget); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge-edit.png"))); m_mediaName = mediaName; connect(pbPrune, SIGNAL(clicked()), this, SLOT(pruneVol())); connect(pbPurge, SIGNAL(clicked()), this, SLOT(purgeVol())); connect(pbDelete, SIGNAL(clicked()), this, SLOT(deleteVol())); connect(pbEdit, SIGNAL(clicked()), this, SLOT(editVol())); connect(tableJob, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(showInfoForJob(QTableWidgetItem *))); dockPage(); setCurrent(); populateForm(); }