diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-24 18:37:53 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-24 18:37:53 +0100 |
commit | 6ba23344c95157793af9e4154933ae8df61630e8 (patch) | |
tree | e12956cbe7a0082bbaaa545cb80d9e86b13f88e8 /indra/newview/tests | |
parent | 01d06a3572c533f810f8f42e7ae9c55051f34aaf (diff) | |
parent | 46e6135eef90b7ff0f08b12384a9aafc1a3e91e1 (diff) |
merge heads. whew.
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, 99 insertions, 112 deletions
diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp index 495073cf67..5f3dc5b162 100644 --- a/indra/newview/tests/llmediadataclient_test.cpp +++ b/indra/newview/tests/llmediadataclient_test.cpp @@ -64,8 +64,8 @@ #define MEDIA_DATA "\ <array> \ -<string>foo</string> \ -<string>bar</string> \ +<string>http://foo.example.com</string> \ +<string>http://bar.example.com</string> \ <string>baz</string> \ </array>" @@ -161,6 +161,8 @@ 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) @@ -561,38 +563,39 @@ 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. + // and mark the second and fourth ones dead. Call removeFromQueue when marking dead, since this is what LLVOVolume will do. 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 in queue 2", mdc->isInQueue(o2)); + ensure("is not in queue 2", !mdc->isInQueue(o2)); ensure("is in queue 3", mdc->isInQueue(o3)); - ensure("is in queue 4", mdc->isInQueue(o4)); + ensure("is not in queue 4", !mdc->isInQueue(o4)); ensure("post records", gPostRecords->size(), 0); ::pump_timers(); - // The first tick should remove the first one + // The first tick should process the first item ensure("is not in queue 1", !mdc->isInQueue(o1)); - ensure("is in queue 2", mdc->isInQueue(o2)); + ensure("is not in queue 2", !mdc->isInQueue(o2)); ensure("is in queue 3", mdc->isInQueue(o3)); - ensure("is in queue 4", mdc->isInQueue(o4)); + ensure("is not in queue 4", !mdc->isInQueue(o4)); ensure("post records", gPostRecords->size(), 1); ::pump_timers(); - // The second tick should skip the second and remove the third - ensure("is not in queue 2", !mdc->isInQueue(o2)); + // The second tick should process the third, emptying the queue 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()); @@ -703,7 +706,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, 4, 1, 3 + // 2, 3, 1, 4 mdc->fetchMedia(o1); mdc->fetchMedia(o2); mdc->fetchMedia(o3); @@ -722,8 +725,8 @@ namespace tut ++tick_num; // 1 The first tick should remove object 2 - 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 not in queue 2", !mdc->isInQueue(o2)); 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); @@ -732,22 +735,21 @@ namespace tut ::pump_timers(); ++tick_num; - // 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)); + // 2 The second tick should send object 3 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 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 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_4)); + ensure(STR(tick_num) + ". post object id", (*gPostRecords)[1]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3)); ::pump_timers(); ++tick_num; // 3 The third tick should remove object 1 - 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 in queue 3", mdc->isInQueue(o3)); + 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 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)); @@ -755,22 +757,20 @@ namespace tut ::pump_timers(); ++tick_num; - // 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)); + // 4 The fourth tick should send object 4 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) + ". 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) + ". post records", gPostRecords->size(), 4); - ensure(STR(tick_num) + ". post object id", (*gPostRecords)[3]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_3)); + ensure(STR(tick_num) + ". post object id", (*gPostRecords)[3]["body"][LLTextureEntry::OBJECT_ID_KEY].asUUID(), LLUUID(VALID_OBJECT_ID_4)); ::pump_timers(); ++tick_num; - // 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)); + // 5 The fifth tick should not change the state of anything. 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 4", !mdc->isInQueue(o4)); ensure(STR(tick_num) + ". post records", gPostRecords->size(), 4); @@ -920,7 +920,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 - ensure("o2 couldn't be removed from queue", mdc->removeFromQueue(o2)); + mdc->removeFromQueue(o2); // tick ::pump_timers(); } @@ -929,4 +929,41 @@ 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 d5b6555b6e..90cacfe3c9 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -29,6 +29,7 @@ #include "../llviewernetwork.h" #include "../test/lltut.h" #include "../llsecapi.h" +#include "../llsechandler_basic.h" #include "../../llxml/llcontrol.h" @@ -50,82 +51,21 @@ std::string LLControlGroup::getString(const std::string& name) LLControlGroup gSavedSettings("test"); -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) {} -}; + +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) {} // ------------------------------------------------------------------------------------------- // TUT diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index 753151bdd8..b5adb217fd 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -73,6 +73,11 @@ 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 2320201ee8..d5d6ca671d 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -73,6 +73,11 @@ 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"); |