mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 22:28:36 +00:00
3ea1cc0dd0
- Bug 1165515 - Part 1: Convert PR_LOG to MOZ_LOG. r=froydnj (034b6056f) - Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj (38739377e) - Bug 1165515 - Part 5: Convert instances of PR_LOG_ALWAYS. r=froydnj (867725f77) - Bug 1165515 - Part 7: Convert PR_LOG_DEBUG + 1 to PR_LOG_VERBOSE. rs=froydnj (afe55d0b8) - Bug 1165515 - Part 8: Convert log level 6 to PR_LOG_VERBOSE. r=jesup (d01127f2c) - Bug 1165515 - Part 9: Remove instances of using numeric log levels 15. rs=froydnj (2ff8b0056) - Bug 1165515 - Part 10: Convert mtransport/logging.h to use PR_LOG levels. r=ekr (a0334c607) - Bug 1165515 - Part 11: Align CSFLogLevel with PR_LOG levels. r=jesup (ca57ae88a) - Bug 1165515 - Part 12: Convert nsPluginLogging to use PR_LOG levels. r=bsmedberg (1f3226ca8) - Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj (96db7f2e9) - Bug 1165515 - Part 14: Undef PR_LOG macros when using mozilla/Logging.h. r=froydnj (81d9dc8e5) - fix some bustage after Bug 1165515 - Part 14, stuff missed in part 13 (80c83c78d) - Bug 1165515 - Part 15: Reduce log level of WebRTC during testing. r=jesup (dda33e173)
76 lines
1.7 KiB
C++
76 lines
1.7 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "TestCommon.h"
|
|
#include "nsXPCOM.h"
|
|
#include "nsIServiceManager.h"
|
|
#include "nsServiceManagerUtils.h"
|
|
#include "nsIEventTarget.h"
|
|
#include "nsCOMPtr.h"
|
|
#include "nsNetCID.h"
|
|
#include "mozilla/Logging.h"
|
|
|
|
//
|
|
// set NSPR_LOG_MODULES=Test:5
|
|
//
|
|
static PRLogModuleInfo *gTestLog = nullptr;
|
|
#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args)
|
|
|
|
class nsIOEvent : public nsIRunnable {
|
|
public:
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
nsIOEvent(int i) : mIndex(i) {}
|
|
|
|
NS_IMETHOD Run() {
|
|
LOG(("Run [%d]\n", mIndex));
|
|
return NS_OK;
|
|
}
|
|
|
|
private:
|
|
int mIndex;
|
|
};
|
|
NS_IMPL_ISUPPORTS(nsIOEvent, nsIRunnable)
|
|
|
|
static nsresult RunTest()
|
|
{
|
|
nsresult rv;
|
|
nsCOMPtr<nsIEventTarget> target =
|
|
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
for (int i=0; i<10; ++i) {
|
|
nsCOMPtr<nsIRunnable> event = new nsIOEvent(i);
|
|
LOG(("Dispatch %d\n", i));
|
|
target->Dispatch(event, NS_DISPATCH_NORMAL);
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (test_common_init(&argc, &argv) != 0)
|
|
return -1;
|
|
|
|
nsresult rv;
|
|
|
|
gTestLog = PR_NewLogModule("Test");
|
|
|
|
rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
rv = RunTest();
|
|
if (NS_FAILED(rv))
|
|
LOG(("RunTest failed [rv=%x]\n", rv));
|
|
|
|
LOG(("sleeping main thread for 2 seconds...\n"));
|
|
PR_Sleep(PR_SecondsToInterval(2));
|
|
|
|
NS_ShutdownXPCOM(nullptr);
|
|
return 0;
|
|
}
|