Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: tests/fake_browser/fake_browser_test.cc

Issue 6452010: Remove the x-ppapi-nacl-srpc and x-nacl-srpc mime types in favor of the singl... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/earth/earth.html ('k') | tests/inbrowser_test_runner/test_runner.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved. 2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * TODO(mseaborn): It would be nice to be able to write this in C, but 8 * TODO(mseaborn): It would be nice to be able to write this in C, but
9 * third_party/npapi/bindings/npruntime.h depends on 9 * third_party/npapi/bindings/npruntime.h depends on
10 * base/basictypes.h, which depends on C++. 10 * base/basictypes.h, which depends on C++.
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 // TODO(mseaborn): Reduce the amount of boilerplate code duplicated 573 // TODO(mseaborn): Reduce the amount of boilerplate code duplicated
574 // between these test cases. For example, all the newp() (NPP_New()) 574 // between these test cases. For example, all the newp() (NPP_New())
575 // calls are pretty much the same. Also, we could use a C++ wrapper 575 // calls are pretty much the same. Also, we could use a C++ wrapper
576 // for NPObjects to make npruntime calls less verbose. Adding an 576 // for NPObjects to make npruntime calls less verbose. Adding an
577 // extra layer here would also make it easier to run these tests 577 // extra layer here would also make it easier to run these tests
578 // against PPAPI. 578 // against PPAPI.
579 579
580 void TestNewAndDestroy() { 580 void TestNewAndDestroy() {
581 printf("Test NPP_New() and NPP_Destroy()...\n"); 581 printf("Test NPP_New() and NPP_Destroy()...\n");
582 582
583 NPMIMEType mime_type = const_cast<char*>("application/x-nacl-srpc"); 583 NPMIMEType mime_type = const_cast<char*>("application/x-nacl");
584 NPP plugin_instance = new NPP_t; 584 NPP plugin_instance = new NPP_t;
585 int argc = 0; 585 int argc = 0;
586 char** arg_names = NULL; 586 char** arg_names = NULL;
587 char** arg_values = NULL; 587 char** arg_values = NULL;
588 NPSavedData* saved_data = NULL; 588 NPSavedData* saved_data = NULL;
589 // NPP_New 589 // NPP_New
590 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED, 590 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED,
591 argc, arg_names, arg_values, saved_data)); 591 argc, arg_names, arg_values, saved_data));
592 592
593 // This reproduced a double-free bug: 593 // This reproduced a double-free bug:
594 // http://code.google.com/p/nativeclient/issues/detail?id=653. 594 // http://code.google.com/p/nativeclient/issues/detail?id=653.
595 // It tests the case where the plugin NPObject is never reffed by 595 // It tests the case where the plugin NPObject is never reffed by
596 // the browser. 596 // the browser.
597 597
598 // NPP_Destroy 598 // NPP_Destroy
599 CheckRetval(plugin_funcs.destroy(plugin_instance, NULL)); 599 CheckRetval(plugin_funcs.destroy(plugin_instance, NULL));
600 600
601 ASSERT_EQ(all_objects.size(), 0); 601 ASSERT_EQ(all_objects.size(), 0);
602 delete plugin_instance; 602 delete plugin_instance;
603 } 603 }
604 604
605 void TestHelloWorldMethod(const char* nexe_url, bool reverse_deallocate) { 605 void TestHelloWorldMethod(const char* nexe_url, bool reverse_deallocate) {
606 NPMIMEType mime_type = const_cast<char*>("application/x-nacl-srpc"); 606 NPMIMEType mime_type = const_cast<char*>("application/x-nacl");
607 NPP plugin_instance = new NPP_t; 607 NPP plugin_instance = new NPP_t;
608 int argc = 0; 608 int argc = 0;
609 char** arg_names = NULL; 609 char** arg_names = NULL;
610 char** arg_values = NULL; 610 char** arg_values = NULL;
611 NPSavedData* saved_data = NULL; 611 NPSavedData* saved_data = NULL;
612 // NPP_New 612 // NPP_New
613 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED, 613 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED,
614 argc, arg_names, arg_values, saved_data)); 614 argc, arg_names, arg_values, saved_data));
615 615
616 NPObject* plugin_obj; 616 NPObject* plugin_obj;
(...skipping 25 matching lines...) Expand all
642 DestroyPluginInstance(plugin_instance, reverse_deallocate); 642 DestroyPluginInstance(plugin_instance, reverse_deallocate);
643 } 643 }
644 644
645 // This tests for a plugin bug that caused a crash, 645 // This tests for a plugin bug that caused a crash,
646 // http://code.google.com/p/nativeclient/issues/detail?id=672. 646 // http://code.google.com/p/nativeclient/issues/detail?id=672.
647 // Test running an executable that does not act as an SRPC server. 647 // Test running an executable that does not act as an SRPC server.
648 void TestMissingSrpcInit() { 648 void TestMissingSrpcInit() {
649 printf("Test failure to init SRPC...\n"); 649 printf("Test failure to init SRPC...\n");
650 const char* nexe_url = "http://localhost/hello_world.nexe"; 650 const char* nexe_url = "http://localhost/hello_world.nexe";
651 651
652 NPMIMEType mime_type = const_cast<char*>("application/x-nacl-srpc"); 652 NPMIMEType mime_type = const_cast<char*>("application/x-nacl");
653 NPP plugin_instance = new NPP_t; 653 NPP plugin_instance = new NPP_t;
654 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED, 654 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED,
655 0, NULL, NULL, NULL)); 655 0, NULL, NULL, NULL));
656 656
657 NPObject* plugin_obj; 657 NPObject* plugin_obj;
658 CheckRetval(plugin_funcs.getvalue(plugin_instance, 658 CheckRetval(plugin_funcs.getvalue(plugin_instance,
659 NPPVpluginScriptableNPObject, &plugin_obj)); 659 NPPVpluginScriptableNPObject, &plugin_obj));
660 NPVariant url; 660 NPVariant url;
661 STRINGZ_TO_NPVARIANT(nexe_url, url); 661 STRINGZ_TO_NPVARIANT(nexe_url, url);
662 bool is_ok = fb_NPN_SetProperty(plugin_instance, plugin_obj, 662 bool is_ok = fb_NPN_SetProperty(plugin_instance, plugin_obj,
(...skipping 13 matching lines...) Expand all
676 } 676 }
677 677
678 // This tests for a memory and thread leak. See: 678 // This tests for a memory and thread leak. See:
679 // http://code.google.com/p/nativeclient/issues/detail?id=791 679 // http://code.google.com/p/nativeclient/issues/detail?id=791
680 // The leak is detected by valgrind, using "--leak-check=full 680 // The leak is detected by valgrind, using "--leak-check=full
681 // --show-reachable=yes", but not by this test on its own. 681 // --show-reachable=yes", but not by this test on its own.
682 void TestOverlappingLaunch() { 682 void TestOverlappingLaunch() {
683 printf("Test assigning to src twice...\n"); 683 printf("Test assigning to src twice...\n");
684 const char* nexe_url = "http://localhost/spin.nexe"; 684 const char* nexe_url = "http://localhost/spin.nexe";
685 685
686 NPMIMEType mime_type = const_cast<char*>("application/x-nacl-srpc"); 686 NPMIMEType mime_type = const_cast<char*>("application/x-nacl");
687 NPP plugin_instance = new NPP_t; 687 NPP plugin_instance = new NPP_t;
688 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED, 688 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED,
689 0, NULL, NULL, NULL)); 689 0, NULL, NULL, NULL));
690 690
691 NPObject* plugin_obj; 691 NPObject* plugin_obj;
692 CheckRetval(plugin_funcs.getvalue(plugin_instance, 692 CheckRetval(plugin_funcs.getvalue(plugin_instance,
693 NPPVpluginScriptableNPObject, &plugin_obj)); 693 NPPVpluginScriptableNPObject, &plugin_obj));
694 NPVariant url; 694 NPVariant url;
695 STRINGZ_TO_NPVARIANT(nexe_url, url); 695 STRINGZ_TO_NPVARIANT(nexe_url, url);
696 // Assign to the "src" attribute twice. The second assignment is 696 // Assign to the "src" attribute twice. The second assignment is
697 // done before the download triggered by the first completes. 697 // done before the download triggered by the first completes.
698 CHECK(fb_NPN_SetProperty(plugin_instance, plugin_obj, 698 CHECK(fb_NPN_SetProperty(plugin_instance, plugin_obj,
699 fb_NPN_GetStringIdentifier("src"), &url)); 699 fb_NPN_GetStringIdentifier("src"), &url));
700 CHECK(fb_NPN_SetProperty(plugin_instance, plugin_obj, 700 CHECK(fb_NPN_SetProperty(plugin_instance, plugin_obj,
701 fb_NPN_GetStringIdentifier("src"), &url)); 701 fb_NPN_GetStringIdentifier("src"), &url));
702 fb_NPN_ReleaseObject(plugin_obj); 702 fb_NPN_ReleaseObject(plugin_obj);
703 // Now allow the download to complete. 703 // Now allow the download to complete.
704 RunQueuedCallbacks(plugin_instance); 704 RunQueuedCallbacks(plugin_instance);
705 705
706 DestroyPluginInstance(plugin_instance, false); 706 DestroyPluginInstance(plugin_instance, false);
707 } 707 }
708 708
709 void TestAsyncMessages() { 709 void TestAsyncMessages() {
710 printf("Test asynchronous messages...\n"); 710 printf("Test asynchronous messages...\n");
711 const char* nexe_url = "http://localhost/async_message_test.nexe"; 711 const char* nexe_url = "http://localhost/async_message_test.nexe";
712 712
713 NPMIMEType mime_type = const_cast<char*>("application/x-nacl-srpc"); 713 NPMIMEType mime_type = const_cast<char*>("application/x-nacl");
714 NPP plugin_instance = new NPP_t; 714 NPP plugin_instance = new NPP_t;
715 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED, 715 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED,
716 0, NULL, NULL, NULL)); 716 0, NULL, NULL, NULL));
717 717
718 NPObject* plugin_obj; 718 NPObject* plugin_obj;
719 CheckRetval(plugin_funcs.getvalue(plugin_instance, 719 CheckRetval(plugin_funcs.getvalue(plugin_instance,
720 NPPVpluginScriptableNPObject, &plugin_obj)); 720 NPPVpluginScriptableNPObject, &plugin_obj));
721 NPVariant url; 721 NPVariant url;
722 STRINGZ_TO_NPVARIANT(nexe_url, url); 722 STRINGZ_TO_NPVARIANT(nexe_url, url);
723 bool success = fb_NPN_SetProperty(plugin_instance, plugin_obj, 723 bool success = fb_NPN_SetProperty(plugin_instance, plugin_obj,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 814
815 fb_NPN_ReleaseObject(callback); 815 fb_NPN_ReleaseObject(callback);
816 816
817 DestroyPluginInstance(plugin_instance, /* reverse_deallocate= */ false); 817 DestroyPluginInstance(plugin_instance, /* reverse_deallocate= */ false);
818 } 818 }
819 819
820 void TestDeferredSrpcInit() { 820 void TestDeferredSrpcInit() {
821 printf("Test __startSrpcServices()...\n"); 821 printf("Test __startSrpcServices()...\n");
822 const char* nexe_url = "http://localhost/deferred_srpc_init.nexe"; 822 const char* nexe_url = "http://localhost/deferred_srpc_init.nexe";
823 823
824 NPMIMEType mime_type = const_cast<char*>("application/x-nacl-srpc"); 824 NPMIMEType mime_type = const_cast<char*>("application/x-nacl");
825 NPP plugin_instance = new NPP_t; 825 NPP plugin_instance = new NPP_t;
826 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED, 826 CheckRetval(plugin_funcs.newp(mime_type, plugin_instance, NP_EMBED,
827 0, NULL, NULL, NULL)); 827 0, NULL, NULL, NULL));
828 828
829 NPObject* plugin_obj; 829 NPObject* plugin_obj;
830 CheckRetval(plugin_funcs.getvalue(plugin_instance, 830 CheckRetval(plugin_funcs.getvalue(plugin_instance,
831 NPPVpluginScriptableNPObject, &plugin_obj)); 831 NPPVpluginScriptableNPObject, &plugin_obj));
832 NPVariant url; 832 NPVariant url;
833 STRINGZ_TO_NPVARIANT(nexe_url, url); 833 STRINGZ_TO_NPVARIANT(nexe_url, url);
834 CHECK(fb_NPN_SetProperty(plugin_instance, plugin_obj, 834 CHECK(fb_NPN_SetProperty(plugin_instance, plugin_obj,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 ++iter) { 948 ++iter) {
949 free(iter->second); 949 free(iter->second);
950 } 950 }
951 interned_strings.clear(); 951 interned_strings.clear();
952 952
953 NaClCondVarDtor(&callback_condvar); 953 NaClCondVarDtor(&callback_condvar);
954 NaClMutexDtor(&callback_mutex); 954 NaClMutexDtor(&callback_mutex);
955 955
956 return 0; 956 return 0;
957 } 957 }
OLDNEW
« no previous file with comments | « tests/earth/earth.html ('k') | tests/inbrowser_test_runner/test_runner.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698