summaryrefslogtreecommitdiffstats
path: root/chrome/test/chrome_plugin/test_chrome_plugin.h
blob: b8e3f758995d6431ee448c05025061a95708b567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Shared by the plugin DLL and the unittest code.

#ifndef CHROME_TEST_CHROME_PLUGIN_TEST_CHROME_PLUGIN_H__
#define CHROME_TEST_CHROME_PLUGIN_TEST_CHROME_PLUGIN_H__

#include <string>

#include "base/basictypes.h"
#include "chrome/common/chrome_plugin_api.h"

class GURL;

struct TestResponsePayload {
  const char* url;
  bool async;
  int status;
  const char* mime_type;
  const char* body;
};

const char kChromeTestPluginProtocol[] = "cptest";

const TestResponsePayload kChromeTestPluginPayloads[] = {
  {
    "cptest:sync",
    false,
    200,
    "text/html",
    "<head><title>cptest:sync</title></head><body>SUCCESS</body>"
  },
  {
    "cptest:async",
    true,
    200,
    "text/plain",
    "<head><title>cptest:async</title></head><body>SUCCESS</body>"
  },
  {
    "cptest:blank",
    false,
    200,
    "text/plain",
    ""
  },
};

struct TestFuncParams {
  typedef void (STDCALL *CallbackFunc)(void* data);

  struct PluginFuncs {
    int (STDCALL *test_make_request)(const char* method, const GURL& url);
  };
  PluginFuncs pfuncs;

  struct BrowserFuncs {
    void (STDCALL *test_complete)(CPRequest* request, bool success,
                                  const std::string& raw_headers,
                                  const std::string& body);
    void (STDCALL *invoke_later)(CallbackFunc callback, void* callback_data,
                                 int delay_ms);
  };
  BrowserFuncs bfuncs;
};

const char kChromeTestPluginPostData[] = "Test Data";

#endif  // CHROME_TEST_CHROME_PLUGIN_TEST_CHROME_PLUGIN_H__