v8profiler: Actually submit data
authorKai Koehne <kai.koehne@nokia.com>
Fri, 17 Feb 2012 14:56:14 +0000 (15:56 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 21 Feb 2012 10:04:58 +0000 (11:04 +0100)
Fix regression introduced in 82dfecab3.

Change-Id: Icd90c483b9b2fde8d4cf522f3a35368cd395b120
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
src/declarative/debugger/qv8profilerservice.cpp
tests/auto/declarative/debugger/qv8profilerservice/data/console.qml [new file with mode: 0644]
tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp

index 4519fd6..5ae2d01 100644 (file)
@@ -185,6 +185,8 @@ void QV8ProfilerService::startProfiling(const QString &title)
     v8::HandleScope handle_scope;
     v8::Handle<v8::String> v8title = v8::String::New(reinterpret_cast<const uint16_t*>(title.data()), title.size());
     v8::CpuProfiler::StartProfiling(v8title);
+
+    d->m_ongoing.append(title);
 }
 
 void QV8ProfilerService::stopProfiling(const QString &title)
diff --git a/tests/auto/declarative/debugger/qv8profilerservice/data/console.qml b/tests/auto/declarative/debugger/qv8profilerservice/data/console.qml
new file mode 100644 (file)
index 0000000..c23c820
--- /dev/null
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+
+Item {
+    function f()
+    {
+    }
+
+    Component.onCompleted:  {
+        console.profile();
+        f();
+        console.profileEnd();
+    }
+}
index 3ec92f9..92b893a 100644 (file)
@@ -125,6 +125,7 @@ private slots:
     void nonBlockingConnect();
     void snapshot();
     void profileOnExit();
+    void console();
 };
 
 void QV8ProfilerClient::messageReceived(const QByteArray &message)
@@ -193,6 +194,9 @@ void tst_QV8ProfilerService::connect(bool block, const QString &testFile)
 
 void tst_QV8ProfilerService::cleanup()
 {
+    if (QTest::currentTestFailed())
+        qDebug() << "Application Output:" << m_process->output();
+
     delete m_process;
     delete m_connection;
     delete m_client;
@@ -205,11 +209,8 @@ void tst_QV8ProfilerService::blockingConnectWithTraceEnabled()
 
     m_client->startProfiling("");
     m_client->stopProfiling("");
-    if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()))) {
-        QString failMsg
-                = QString("No trace received in time. App output: %1\n\n").arg(m_process->output());
-        QFAIL(qPrintable(failMsg));
-    }
+    QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+             "No trace received in time.");
 }
 
 void tst_QV8ProfilerService::blockingConnectWithTraceDisabled()
@@ -225,11 +226,8 @@ void tst_QV8ProfilerService::blockingConnectWithTraceDisabled()
     }
     m_client->startProfiling("");
     m_client->stopProfiling("");
-    if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()))) {
-        QString failMsg
-                = QString("No trace received in time. App output: %1\n\n").arg(m_process->output());
-        QFAIL(qPrintable(failMsg));
-    }
+    QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+             "No trace received in time.");
 }
 
 void tst_QV8ProfilerService::nonBlockingConnect()
@@ -239,11 +237,8 @@ void tst_QV8ProfilerService::nonBlockingConnect()
 
     m_client->startProfiling("");
     m_client->stopProfiling("");
-    if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()))) {
-        QString failMsg
-                = QString("No trace received in time. App output: %1\n\n").arg(m_process->output());
-        QFAIL(qPrintable(failMsg));
-    }
+    QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+             "No trace received in time.");
 }
 
 void tst_QV8ProfilerService::snapshot()
@@ -252,11 +247,8 @@ void tst_QV8ProfilerService::snapshot()
     QTRY_COMPARE(m_client->state(), QDeclarativeDebugClient::Enabled);
 
     m_client->takeSnapshot();
-    if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(snapshot()))) {
-        QString failMsg
-                = QString("No snapshot received in time. App output: %1\n\n").arg(m_process->output());
-        QFAIL(qPrintable(failMsg));
-    }
+    QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(snapshot())),
+             "No trace received in time.");
 }
 
 void tst_QV8ProfilerService::profileOnExit()
@@ -266,11 +258,21 @@ void tst_QV8ProfilerService::profileOnExit()
 
     m_client->startProfiling("");
 
-    if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()))) {
-        QString failMsg
-                = QString("No trace received in time. App output: \n%1\n").arg(m_process->output());
-        QFAIL(qPrintable(failMsg));
-    }
+    QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+             "No trace received in time.");
+    //QVERIFY(!m_client->traceMessages.isEmpty());
+}
+
+void tst_QV8ProfilerService::console()
+{
+    connect(true, "console.qml");
+    QTRY_COMPARE(m_client->state(), QDeclarativeDebugClient::Enabled);
+
+    m_client->stopProfiling("");
+
+    QVERIFY2(QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+             "No trace received in time.");
+    QVERIFY(!m_client->traceMessages.isEmpty());
 }
 
 QTEST_MAIN(tst_QV8ProfilerService)