~webapps/unity-chromium-extension/quantal

« back to all changes in this revision

Viewing changes to tests/unit/npapi/unity-webapps-permissions-is-integration-allowed-test.c

New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include <stdlib.h>
 
3
 
 
4
#include "unity-webapps-binding.h"
 
5
#include "unity-webapps-binding-test.h"
 
6
#include "test_common.h"
 
7
#include "wrapped-ptr-type.h"
 
8
 
 
9
static bool func_reached = false;
 
10
static void on_func_reached(void)
 
11
{
 
12
  func_reached = true;
 
13
}
 
14
 
 
15
int
 
16
unity_webapps_permissions_is_integration_allowed_test(void)
 
17
{
 
18
  unity_webapps_binding_test_set_test_mode_on (on_func_reached);
 
19
 
 
20
  // handle argument count
 
21
  
 
22
  {
 
23
    NPTestObject
 
24
      tobject = {0};
 
25
    NPVariant
 
26
      args[1];
 
27
    NULL_TO_NPVARIANT(args[0]);
 
28
    NPVariant result = 
 
29
      unity_webapps_binding_permissions_is_integration_allowed (NULL
 
30
                                              , (NPObject *) &tobject
 
31
                                              , &args[0]
 
32
                                              , sizeof(args)/sizeof(args[0]));
 
33
    
 
34
    if (!tobject.exceptioncalled || func_reached)
 
35
      {
 
36
        return 1;
 
37
      }
 
38
 
 
39
    func_reached = 0;
 
40
  }
 
41
 
 
42
 
 
43
  // check arg types
 
44
 
 
45
 
 
46
  // check that function is reached w/ proper args
 
47
  
 
48
  {
 
49
    wrapped_void_ptr_t
 
50
      tobject = {0};
 
51
    NPVariant
 
52
      args[0];
 
53
 
 
54
    
 
55
 
 
56
    NPVariant result = 
 
57
      unity_webapps_binding_permissions_is_integration_allowed (NULL
 
58
                                              , (NPObject *) &tobject
 
59
                                              , &args[0]
 
60
                                              , sizeof(args)/sizeof(args[0]));
 
61
    if (! func_reached)
 
62
      {
 
63
        return 1;
 
64
      }
 
65
 
 
66
    func_reached = 0;
 
67
  }
 
68
 
 
69
  return 0;
 
70
}
 
71
 
 
72
int main (int argc, char **argv)
 
73
{
 
74
  if (unity_webapps_permissions_is_integration_allowed_test())
 
75
    {
 
76
      return 1;
 
77
    }
 
78
 
 
79
  return 0;
 
80
}