diff options
Diffstat (limited to 'indra/newview/tests')
-rw-r--r-- | indra/newview/tests/llmediadataclient_test.cpp | 109 | ||||
-rw-r--r-- | indra/newview/tests/llsecapi_test.cpp | 92 | ||||
-rw-r--r-- | indra/newview/tests/llslurl_test.cpp | 5 | ||||
-rw-r--r-- | indra/newview/tests/llviewernetwork_test.cpp | 5 |
4 files changed, 112 insertions, 99 deletions
diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp index 05e178653b..33d413bd21 100644 --- a/indra/newview/tests/llmediadataclient_test.cpp +++ b/indra/newview/tests/llmediadataclient_test.cpp @@ -70,8 +70,8 @@ #define MEDIA_DATA "\ <array> \ -<string>http://foo.example.com</string> \ -<string>http://bar.example.com</string> \ +<string>foo</string> \ +<string>bar</string> \ <string>baz</string> \ </array>" @@ -167,8 +167,6 @@ public: { return mRep["media_data"].size(); } virtual LLSD getMediaDataLLSD(U8 index) const { return mRep["media_data"][(LLSD::Integer)index]; } - virtual bool isCurrentMediaUrl(U8 index, const std::string &url) const - { return (mRep["media_data"][(LLSD::Integer)index].asString() == url); } virtual LLUUID getID() const { return mRep["uuid"]; } virtual void mediaNavigateBounceBack(U8 index) @@ -569,39 +567,38 @@ namespace tut mdc->fetchMedia(o2); mdc->fetchMedia(o3); mdc->fetchMedia(o4); - - ensure("is in queue 1", mdc->isInQueue(o1)); - ensure("is in queue 2", mdc->isInQueue(o2)); - ensure("is in queue 3", mdc->isInQueue(o3)); - ensure("is in queue 4", mdc->isInQueue(o4)); - ensure("post records", gPostRecords->size(), 0); - // and mark the second and fourth ones dead. Call removeFromQueue when marking dead, since this is what LLVOVolume will do. + // and mark the second and fourth ones dead. dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o2))->markDead(); - mdc->removeFromQueue(o2); dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o4))->markDead(); - mdc->removeFromQueue(o4); - // The removeFromQueue calls should remove the second and fourth ones ensure("is in queue 1", mdc->isInQueue(o1)); - ensure("is not in queue 2", !mdc->isInQueue(o2)); + ensure("is in queue 2", mdc->isInQueue(o2)); ensure("is in queue 3", mdc->isInQueue(o3)); - ensure("is not in queue 4", !mdc->isInQueue(o4)); + ensure("is in queue 4", mdc->isInQueue(o4)); ensure("post records", gPostRecords->size(), 0); ::pump_timers(); - // The first tick should process the first item + // The first tick should remove the first one ensure("is not in queue 1", !mdc->isInQueue(o1)); - ensure("is not in queue 2", !mdc->isInQueue(o2)); + ensure("is in queue 2", mdc->isInQueue(o2)); ensure("is in queue 3", mdc->isInQueue(o3)); - ensure("is not in queue 4", !mdc->isInQueue(o4)); + ensure("is in queue 4", mdc->isInQueue(o4)); ensure("post records", gPostRecords->size(), 1); ::pump_timers(); - // The second tick should process the third, emptying the queue + // The second tick should skip the second and remove the third + ensure("is not in queue 2", !mdc->isInQueue(o2)); ensure("is not in queue 3", !mdc->isInQueue(o3)); + ensure("is in queue 4", mdc->isInQueue(o4)); + ensure("post records", gPostRecords->size(), 2); + + ::pump_timers(); + + // The third tick should skip the fourth one and empty the queue. + ensure("is not in queue 4", !mdc->isInQueue(o4)); ensure("post records", gPostRecords->size(), 2); ensure("queue empty", mdc->isEmpty()); @@ -712,7 +709,7 @@ namespace tut // queue up all 4 objects. The first two should be in the sorted // queue [2 1], the second in the round-robin queue. The queues // are serviced interleaved, so we should expect: - // 2, 3, 1, 4 + // 2, 4, 1, 3 mdc->fetchMedia(o1); mdc->fetchMedia(o2); mdc->fetchMedia(o3); @@ -731,8 +728,8 @@ namespace tut ++tick_num; // 1 The first tick should remove object 2 - ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1)); ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2)); + ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1)); ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3)); ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4)); ensure(STR(tick_num) + ". post records", gPostRecords->size(), 1); @@ -741,21 +738,22 @@ namespace tut ::pump_timers(); ++tick_num; - // 2 The second tick should send object 3 - ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1)); + // 2 The second tick should send object 4, but it will still be + // "in the queue" ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2)); - ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3)); + ensure(STR(tick_num) + ". is in queue 1", mdc->isInQueue(o1)); + ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3)); ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4)); ensure(STR(tick_num) + ". post records", gPostRecords->size(), 2); - ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3)); + ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4)); ::pump_timers(); ++tick_num; // 3 The third tick should remove object 1 - ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1)); ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2)); - ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3)); + ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1)); + ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3)); ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4)); ensure(STR(tick_num) + ". post records", gPostRecords->size(), 3); ensure(STR(tick_num) + ". post object id", (*gPostRecords)[2]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_1)); @@ -763,20 +761,22 @@ namespace tut ::pump_timers(); ++tick_num; - // 4 The fourth tick should send object 4 - ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1)); + // 4 The fourth tick should send object 3, but it will still be + // "in the queue" ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2)); - ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3)); - ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4)); + ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1)); + ensure(STR(tick_num) + ". is in queue 3", mdc->isInQueue(o3)); + ensure(STR(tick_num) + ". is in queue 4", mdc->isInQueue(o4)); ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4); - ensure(STR(tick_num) + ". post object id", (*gPostRecords)[3]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4)); + ensure(STR(tick_num) + ". post object id", (*gPostRecords)[3]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3)); ::pump_timers(); ++tick_num; - // 5 The fifth tick should not change the state of anything. - ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1)); + // 5 The fifth tick should now identify objects 3 and 4 as no longer + // needing "updating", and remove them from the queue ensure(STR(tick_num) + ". is not in queue 2", !mdc->isInQueue(o2)); + ensure(STR(tick_num) + ". is not in queue 1", !mdc->isInQueue(o1)); ensure(STR(tick_num) + ". is not in queue 3", !mdc->isInQueue(o3)); ensure(STR(tick_num) + ". is not in queue 4", !mdc->isInQueue(o4)); ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4); @@ -926,7 +926,7 @@ namespace tut // But, we need to clear the queue, or else we won't destroy MDC... // this is a strange interplay between the queue timer and the MDC - mdc->removeFromQueue(o2); + ensure("o2 couldn't be removed from queue", mdc->removeFromQueue(o2)); // tick ::pump_timers(); } @@ -935,41 +935,4 @@ namespace tut ensure("refcount of o3", o3->getNumRefs(), 1); ensure("refcount of o4", o4->getNumRefs(), 1); } - - template<> template<> - void mediadataclient_object_t::test<13>() - { - // - // Test supression of redundant navigates. - // - LOG_TEST(13); - - LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"1.0","true")); - { - LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD); - const char *TEST_URL = "http://foo.example.com"; - const char *TEST_URL_2 = "http://example.com"; - mdc->navigate(o1, 0, TEST_URL); - mdc->navigate(o1, 1, TEST_URL); - mdc->navigate(o1, 0, TEST_URL_2); - mdc->navigate(o1, 1, TEST_URL_2); - - // This should add two requests to the queue, one for face 0 of the object and one for face 1. - - ensure("before pump: 1 is in queue", mdc->isInQueue(o1)); - - ::pump_timers(); - - ensure("after first pump: 1 is in queue", mdc->isInQueue(o1)); - - ::pump_timers(); - - ensure("after second pump: 1 is not in queue", !mdc->isInQueue(o1)); - - ensure("first post has correct url", (*gPostRecords)[0]["body"][LLMediaEntry::CURRENT_URL_KEY].asString(), std::string(TEST_URL_2)); - ensure("second post has correct url", (*gPostRecords)[1]["body"][LLMediaEntry::CURRENT_URL_KEY].asString(), std::string(TEST_URL_2)); - - } - } - } diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index 8f2f299fc4..caa1461987 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -35,7 +35,6 @@ #include "../llviewernetwork.h" #include "../test/lltut.h" #include "../llsecapi.h" -#include "../llsechandler_basic.h" #include "../../llxml/llcontrol.h" @@ -57,21 +56,82 @@ std::string LLControlGroup::getString(const std::string& name) LLControlGroup gSavedSettings("test"); - -LLSecAPIBasicHandler::LLSecAPIBasicHandler() {} -void LLSecAPIBasicHandler::init() {} -LLSecAPIBasicHandler::~LLSecAPIBasicHandler() {} -LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert) { return NULL; } -LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert) { return NULL; } -LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(const X509_STORE_CTX* chain) { return NULL; } -LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id) { return NULL; } -void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type, const std::string& data_id, const LLSD& data) {} -LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type, const std::string& data_id) { return LLSD(); } -void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type, const std::string& data_id) {} -LLPointer<LLCredential> LLSecAPIBasicHandler::createCredential(const std::string& grid, const LLSD& identifier, const LLSD& authenticator) { return NULL; } -LLPointer<LLCredential> LLSecAPIBasicHandler::loadCredential(const std::string& grid) { return NULL; } -void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool save_authenticator) {} -void LLSecAPIBasicHandler::deleteCredential(LLPointer<LLCredential> cred) {} +class LLSecAPIBasicHandler : public LLSecAPIHandler +{ +protected: + LLPointer<LLCertificateChain> mCertChain; + LLPointer<LLCertificate> mCert; + LLPointer<LLCertificateStore> mCertStore; + LLSD mLLSD; + +public: + LLSecAPIBasicHandler() {} + + virtual ~LLSecAPIBasicHandler() {} + + // instantiate a certificate from a pem string + virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert) + { + return mCert; + } + + + // instiate a certificate from an openssl X509 structure + virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert) + { + return mCert; + } + + + // instantiate a chain from an X509_STORE_CTX + virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain) + { + return mCertChain; + } + + // instantiate a cert store given it's id. if a persisted version + // exists, it'll be loaded. If not, one will be created (but not + // persisted) + virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id) + { + return mCertStore; + } + + // persist data in a protected store + virtual void setProtectedData(const std::string& data_type, + const std::string& data_id, + const LLSD& data) {} + + // retrieve protected data + virtual LLSD getProtectedData(const std::string& data_type, + const std::string& data_id) + { + return mLLSD; + } + + virtual void deleteProtectedData(const std::string& data_type, + const std::string& data_id) + { + } + + virtual LLPointer<LLCredential> createCredential(const std::string& grid, + const LLSD& identifier, + const LLSD& authenticator) + { + LLPointer<LLCredential> cred = NULL; + return cred; + } + + virtual LLPointer<LLCredential> loadCredential(const std::string& grid) + { + LLPointer<LLCredential> cred = NULL; + return cred; + } + + virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator) {} + + virtual void deleteCredential(LLPointer<LLCredential> cred) {} +}; // ------------------------------------------------------------------------------------------- // TUT diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index 4db7efa090..803020dc7a 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -79,11 +79,6 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) -{ - ctrl_name_table_t::iterator iter = mNameTable.find(name); - return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; -} LLControlGroup gSavedSettings("test"); diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index 98e4c994b0..5fba5eb69c 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -79,11 +79,6 @@ LLSD LLControlGroup::getLLSD(const std::string& name) return LLSD(); } -LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) -{ - ctrl_name_table_t::iterator iter = mNameTable.find(name); - return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; -} LLControlGroup gSavedSettings("test"); |