diff options
author | skolb <none@none> | 2009-10-15 13:58:16 -0700 |
---|---|---|
committer | skolb <none@none> | 2009-10-15 13:58:16 -0700 |
commit | e9f7205ba9f4dfb3422759218609b62d61972722 (patch) | |
tree | e7859943f67b0ab2f8e132cd64c0effbb3462206 /indra/newview/tests | |
parent | 1b1550f284316b244a10a4a6604fedb5d6b18965 (diff) | |
parent | 050ae3cf5107140a58f6aeae865d254b74a23d44 (diff) |
Merge fix for DEV-39832
Diffstat (limited to 'indra/newview/tests')
-rw-r--r-- | indra/newview/tests/llmediadataclient_test.cpp | 68 |
1 files changed, 43 insertions, 25 deletions
diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp index a884ed0265..445ec7aa34 100644 --- a/indra/newview/tests/llmediadataclient_test.cpp +++ b/indra/newview/tests/llmediadataclient_test.cpp @@ -29,6 +29,8 @@ * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ + +#include "linden_common.h" #include "../llviewerprecompiledheaders.h" #include <iostream> @@ -46,7 +48,14 @@ #include "../../llprimitive/lltextureentry.cpp" #include "../../llmessage/tests/llcurl_stub.cpp" +#if LL_WINDOWS +#pragma warning (push) +#pragma warning (disable : 4702) // boost::lexical_cast generates this warning +#endif #include <boost/lexical_cast.hpp> +#if LL_WINDOWS +#pragma warning (pop) +#endif #define VALID_OBJECT_ID "3607d5c4-644b-4a8a-871a-8b78471af2a2" #define VALID_OBJECT_ID_1 "11111111-1111-1111-1111-111111111111" @@ -186,6 +195,15 @@ private: int mNumBounceBacks; }; +// This special timer delay should ensure that the timer will fire on the very +// next pump, no matter what (though this does make an assumption about the +// implementation of LLEventTimer::updateClass()): +const F32 NO_PERIOD = -1000.0f; + +static void pump_timers() +{ + LLEventTimer::updateClass(); +} namespace tut { @@ -194,9 +212,9 @@ namespace tut mediadataclient() { gPostRecords = &mLLSD; -// LLError::setDefaultLevel(LLError::LEVEL_DEBUG); -// LLError::setClassLevel("LLMediaDataClient", LLError::LEVEL_DEBUG); -// LLError::setTagLevel("MediaOnAPrim", LLError::LEVEL_DEBUG); + //LLError::setDefaultLevel(LLError::LEVEL_DEBUG); + //LLError::setClassLevel("LLMediaDataClient", LLError::LEVEL_DEBUG); + //LLError::setTagLevel("MediaOnAPrim", LLError::LEVEL_DEBUG); } LLSD mLLSD; }; @@ -256,14 +274,13 @@ namespace tut LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA); int num_refs_start = o->getNumRefs(); { - // queue time w/ no delay ensures that LLEventTimer::updateClass() will hit the tick() - LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(0,0,4); + LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD); mdc->fetchMedia(o); // Make sure no posts happened yet... ensure("post records", gPostRecords->size(), 0); - LLEventTimer::updateClass(); + ::pump_timers(); ensure("post records", gPostRecords->size(), 1); ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_CAP_URL); @@ -288,11 +305,11 @@ namespace tut LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA); { - // queue time w/ no delay ensures that LLEventTimer::updateClass() will hit the tick() - LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(0,0,4); + // queue time w/ no delay ensures that ::pump_timers() will hit the tick() + LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD); mdc->updateMedia(o); ensure("post records", gPostRecords->size(), 0); - LLEventTimer::updateClass(); + ::pump_timers(); ensure("post records", gPostRecords->size(), 1); ensure("post url", (*gPostRecords)[0]["url"], FAKE_OBJECT_MEDIA_CAP_URL); @@ -318,11 +335,11 @@ namespace tut LLMediaDataClientObject::ptr_t o = new LLMediaDataClientObjectTest(DATA); { - LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(0,0,4); + LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD); const char *TEST_URL = "http://example.com"; mdc->navigate(o, 0, TEST_URL); ensure("post records", gPostRecords->size(), 0); - LLEventTimer::updateClass(); + ::pump_timers(); // ensure no bounce back ensure("bounce back", dynamic_cast<LLMediaDataClientObjectTest*>(static_cast<LLMediaDataClientObject*>(o))->getNumBounceBacks(), 0); @@ -354,7 +371,7 @@ namespace tut LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest( _DATA(VALID_OBJECT_ID_3,"2.0","1.0")); { - LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(0,0,4); + LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD); const char *ORDERED_OBJECT_IDS[] = { VALID_OBJECT_ID_2, VALID_OBJECT_ID_3, VALID_OBJECT_ID_1 }; mdc->fetchMedia(o1); mdc->fetchMedia(o2); @@ -364,11 +381,11 @@ namespace tut ensure("post records", gPostRecords->size(), 0); // tick 3 times... - LLEventTimer::updateClass(); + ::pump_timers(); ensure("post records", gPostRecords->size(), 1); - LLEventTimer::updateClass(); + ::pump_timers(); ensure("post records", gPostRecords->size(), 2); - LLEventTimer::updateClass(); + ::pump_timers(); ensure("post records", gPostRecords->size(), 3); for( int i=0; i < 3; i++ ) @@ -405,7 +422,7 @@ namespace tut int num_refs_start = o->getNumRefs(); { const int NUM_RETRIES = 5; - LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(0,0,NUM_RETRIES); + LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD,NUM_RETRIES); // This should generate a retry mdc->fetchMedia(o); @@ -418,15 +435,16 @@ namespace tut // Third, fires queue timer again for (int i=0; i<NUM_RETRIES; ++i) { - LLEventTimer::updateClass(); - ensure("post records " + STR(i), gPostRecords->size(), i+1); - LLEventTimer::updateClass(); + ::pump_timers(); // Should pump (fire) the queue timer, causing a retry timer to be scheduled + // XXX This ensure is not guaranteed, because scheduling a timer might actually get it pumped in the same loop + //ensure("post records " + STR(i), gPostRecords->size(), i+1); + ::pump_timers(); // Should pump (fire) the retry timer, scheduling the queue timer } - // Do some extre pumps to make sure no other timer work occurs. - LLEventTimer::updateClass(); - LLEventTimer::updateClass(); - LLEventTimer::updateClass(); + // Do some extra pumps to make sure no other timer work occurs. + ::pump_timers(); + ::pump_timers(); + ::pump_timers(); // Make sure there were 2 posts ensure("post records after", gPostRecords->size(), NUM_RETRIES); @@ -458,11 +476,11 @@ namespace tut FAKE_OBJECT_MEDIA_CAP_URL, FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR)); { - LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(0,0,4); + LLPointer<LLObjectMediaNavigateClient> mdc = new LLObjectMediaNavigateClient(NO_PERIOD,NO_PERIOD); const char *TEST_URL = "http://example.com"; mdc->navigate(o, 0, TEST_URL); ensure("post records", gPostRecords->size(), 0); - LLEventTimer::updateClass(); + ::pump_timers(); // ensure bounce back ensure("bounce back", |