From db530ec5e3f122b6590a0aad19de19b286d06f81 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 26 Jun 2013 22:18:30 +0000 Subject: [PATCH] Add additional V8 performance tests (issue #960). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1292 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef_paths2.gypi | 1 + tests/cefclient/cefclient.rc | 1 + tests/cefclient/performance_test.cpp | 50 +++ tests/cefclient/res/other_tests.html | 1 + tests/cefclient/res/performance2.html | 442 ++++++++++++++++++++++++++ tests/cefclient/resource.h | 1 + tests/cefclient/resource_util_win.cpp | 1 + 7 files changed, 497 insertions(+) create mode 100644 tests/cefclient/res/performance2.html diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 53ec1a402..7ff8bf356 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -88,6 +88,7 @@ 'tests/cefclient/res/logo.png', 'tests/cefclient/res/other_tests.html', 'tests/cefclient/res/performance.html', + 'tests/cefclient/res/performance2.html', 'tests/cefclient/res/transparency.html', 'tests/cefclient/res/window.html', 'tests/cefclient/res/xmlhttprequest.html', diff --git a/tests/cefclient/cefclient.rc b/tests/cefclient/cefclient.rc index 1a9b9dae2..bda4552d5 100644 --- a/tests/cefclient/cefclient.rc +++ b/tests/cefclient/cefclient.rc @@ -36,6 +36,7 @@ IDS_LOGO BINARY "res\\logo.png" IDS_OSRTEST BINARY "res\\osr_test.html" IDS_OTHER_TESTS BINARY "res\\other_tests.html" IDS_PERFORMANCE BINARY "res\\performance.html" +IDS_PERFORMANCE2 BINARY "res\\performance2.html" IDS_TRANSPARENCY BINARY "res\\transparency.html" IDS_WINDOW BINARY "res\\window.html" IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html" diff --git a/tests/cefclient/performance_test.cpp b/tests/cefclient/performance_test.cpp index 2108f770d..71c5d4f51 100644 --- a/tests/cefclient/performance_test.cpp +++ b/tests/cefclient/performance_test.cpp @@ -23,6 +23,7 @@ namespace { const char kGetPerfTests[] = "GetPerfTests"; const char kRunPerfTest[] = "RunPerfTest"; +const char kPerfTestReturnValue[] = "PerfTestReturnValue"; class V8Handler : public CefV8Handler { public: @@ -68,6 +69,52 @@ class V8Handler : public CefV8Handler { val->SetValue(1, CefV8Value::CreateUInt(kPerfTests[i].iterations)); retval->SetValue(i, val); } + } else if (name == kPerfTestReturnValue) { + if (arguments.size() == 0) { + retval = CefV8Value::CreateInt(1); + } else if (arguments.size() == 1 && arguments[0]->IsInt()) { + int32 type = arguments[0]->GetIntValue(); + CefTime date; + switch (type) { + case 0: + retval = CefV8Value::CreateUndefined(); + break; + case 1: + retval = CefV8Value::CreateNull(); + break; + case 2: + retval = CefV8Value::CreateBool(true); + break; + case 3: + retval = CefV8Value::CreateInt(1); + break; + case 4: + retval = CefV8Value::CreateUInt(1); + break; + case 5: + retval = CefV8Value::CreateDouble(1.234); + break; + case 6: + date.Now(); + retval = CefV8Value::CreateDate(date); + break; + case 7: + retval = CefV8Value::CreateString("Hello, world!"); + break; + case 8: + retval = CefV8Value::CreateObject(NULL); + break; + case 9: + retval = CefV8Value::CreateArray(8); + break; + case 10: + // retval = CefV8Value::CreateFunction(...); + exception = "Not implemented"; + break; + default: + exception = "Not supported"; + } + } } return true; @@ -98,6 +145,9 @@ class RenderDelegate : public ClientApp::RenderDelegate { object->SetValue(kRunPerfTest, CefV8Value::CreateFunction(kRunPerfTest, handler), V8_PROPERTY_ATTRIBUTE_READONLY); + object->SetValue(kPerfTestReturnValue, + CefV8Value::CreateFunction(kPerfTestReturnValue, handler), + V8_PROPERTY_ATTRIBUTE_READONLY); } private: diff --git a/tests/cefclient/res/other_tests.html b/tests/cefclient/res/other_tests.html index 44688d493..7b7afa460 100644 --- a/tests/cefclient/res/other_tests.html +++ b/tests/cefclient/res/other_tests.html @@ -17,6 +17,7 @@
  • HTML5 Video
  • JavaScript Binding
  • JavaScript Performance Tests
  • +
  • JavaScript Performance (2) Tests
  • JavaScript Window Manipulation
  • Local Storage
  • requestAnimationFrame
  • diff --git a/tests/cefclient/res/performance2.html b/tests/cefclient/res/performance2.html new file mode 100644 index 000000000..e54940b4d --- /dev/null +++ b/tests/cefclient/res/performance2.html @@ -0,0 +1,442 @@ + + + + Performance Tests (2) + + + +

    Performance Tests (2)

    + +
    + + + + + + + + + + + + + + + + + + + +
    Settings:
    Iterations:
    Samples:
    Mode:Asynchronous + Synchronous +
    +
    + + +
    + +
    + + + + + + + + + + + + + + + + + + + +
    EnabledNameSamples x IterationsMin, msAvg, msMax, msAverage calls/secMeasuring InacurracyMemory, MBMemory delta, MBDescription
    +
    + + + + + diff --git a/tests/cefclient/resource.h b/tests/cefclient/resource.h index 1baea58a7..70d62c7d8 100644 --- a/tests/cefclient/resource.h +++ b/tests/cefclient/resource.h @@ -50,6 +50,7 @@ #define IDS_TRANSPARENCY 1009 #define IDS_WINDOW 1010 #define IDS_XMLHTTPREQUEST 1011 +#define IDS_PERFORMANCE2 1012 // Avoid files associated with MacOS #define _X86_ diff --git a/tests/cefclient/resource_util_win.cpp b/tests/cefclient/resource_util_win.cpp index 5cc129428..114ca4bc3 100644 --- a/tests/cefclient/resource_util_win.cpp +++ b/tests/cefclient/resource_util_win.cpp @@ -41,6 +41,7 @@ int GetResourceId(const char* resource_name) { {"osr_test.html", IDS_OSRTEST}, {"other_tests.html", IDS_OTHER_TESTS}, {"performance.html", IDS_PERFORMANCE}, + {"performance2.html", IDS_PERFORMANCE2}, {"transparency.html", IDS_TRANSPARENCY}, {"window.html", IDS_WINDOW}, {"xmlhttprequest.html", IDS_XMLHTTPREQUEST},