cpim-tester.cpp 17.1 KB
Newer Older
Ronan's avatar
Ronan committed
1
/*
Ronan's avatar
Ronan committed
2
 * cpim-tester.cpp
Ronan's avatar
Ronan committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 * Copyright (C) 2017  Belledonne Communications SARL
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

Sylvain Berfini's avatar
Sylvain Berfini committed
19
#include "address/address.h"
Ronan's avatar
Ronan committed
20
#include "chat/chat-message/chat-message.h"
21
#include "chat/chat-room/basic-chat-room.h"
22 23
#include "chat/cpim/cpim.h"
#include "content/content-type.h"
24
#include "content/content.h"
25 26 27 28
#include "core/core.h"

// TODO: Remove me later.
#include "private.h"
Ronan's avatar
Ronan committed
29 30

#include "liblinphone_tester.h"
Benjamin REIS's avatar
Benjamin REIS committed
31
#include "tester_utils.h"
Ronan's avatar
Ronan committed
32

Ronan's avatar
Ronan committed
33
// =============================================================================
Ronan's avatar
Ronan committed
34

Ronan's avatar
Ronan committed
35
using namespace std;
Ronan's avatar
Ronan committed
36

37
using namespace LinphonePrivate;
Ronan's avatar
Ronan committed
38

Ronan's avatar
Ronan committed
39
static void parse_minimal_message () {
Ronan's avatar
Ronan committed
40 41 42 43 44 45 46 47 48 49
	const string str = "Content-type: Message/CPIM\r\n"
		"\r\n"
		"Content-Type: text/plain; charset=utf-8\r\n"
		"\r\n";

	shared_ptr<const Cpim::Message> message = Cpim::Message::createFromString(str);
	if (!BC_ASSERT_PTR_NOT_NULL(message)) return;

	const string str2 = message->asString();
	BC_ASSERT_STRING_EQUAL(str2.c_str(), str.c_str());
50 51

	BC_ASSERT_STRING_EQUAL(message->getContent().c_str(), "");
Ronan's avatar
Ronan committed
52 53
}

Ronan's avatar
Ronan committed
54
static void set_generic_header_name () {
Ronan's avatar
Ronan committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
	const list<pair<string, bool> > entries = {
		{ "toto", true },
		{ "george.abitbol", true },
		{ "tata/titi", false },
		{ "hey ho", false },
		{ " fail", false },
		{ "fail2 ", false },

		// Reserved.
		{ "From", false },
		{ "To", false },
		{ "cc", false },
		{ "DateTime", false },
		{ "Subject", false },
		{ "NS", false },
		{ "Require", false },

		// Case sensitivity.
		{ "FROM", true },
		{ "to", true },
		{ "cC", true },
		{ "Datetime", true },
		{ "SuBject", true },
		{ "nS", true },
		{ "requirE", true }
	};

	for (const auto &entry : entries) {
		Cpim::GenericHeader genericHeader;

		const bool result = genericHeader.setName(entry.first);
		BC_ASSERT_EQUAL(result, entry.second, bool, "%d");

		const string name = genericHeader.getName();

		if (result)
			BC_ASSERT_STRING_EQUAL(name.c_str(), entry.first.c_str());
		else
			BC_ASSERT_STRING_EQUAL(name.c_str(), "");
	}
}

Ronan's avatar
Ronan committed
97
static void set_generic_header_value () {
Ronan's avatar
Ronan committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
	const list<pair<string, bool> > entries = {
		{ "MyFeatures <mid:MessageFeatures@id.foo.com>", true },
		{ "2000-12-13T13:40:00-08:00", true },
		{ "2000-12-13T13:40:00-08:00", true },
		{ "text/xml; charset=utf-8", true },
		{ "text/xml; charset=ut\r\nf-8", false }
	};

	for (const auto &entry : entries) {
		Cpim::GenericHeader genericHeader;

		const bool result = genericHeader.setValue(entry.first);
		BC_ASSERT_EQUAL(result, entry.second, bool, "%d");

		const string value = genericHeader.getValue();

		if (result)
			BC_ASSERT_STRING_EQUAL(value.c_str(), entry.first.c_str());
		else
			BC_ASSERT_STRING_EQUAL(value.c_str(), "");
	}
}

Ronan's avatar
Ronan committed
121
static void check_core_header_names () {
Ronan's avatar
Ronan committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
	const list<pair<shared_ptr<Cpim::CoreHeader>, string> > entries = {
		{ make_shared<Cpim::FromHeader>(), "From" },
		{ make_shared<Cpim::ToHeader>(), "To" },
		{ make_shared<Cpim::CcHeader>(), "cc" },
		{ make_shared<Cpim::DateTimeHeader>(), "DateTime" },
		{ make_shared<Cpim::SubjectHeader>(), "Subject" },
		{ make_shared<Cpim::NsHeader>(), "NS" },
		{ make_shared<Cpim::RequireHeader>(), "Require" }
	};

	for (const auto &entry : entries) {
		const string name = entry.first->getName();
		BC_ASSERT_STRING_EQUAL(name.c_str(), entry.second.c_str());
	}
}

Ronan's avatar
Ronan committed
138
static void set_core_header_values () {
Ronan's avatar
Ronan committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
	const list<pair<shared_ptr<Cpim::Header>, list<pair<string, bool> > > > entries = {
		{ make_shared<Cpim::FromHeader>(), {
				{ "Winnie the Pooh <im:pooh@100akerwood.com>", true },
				{ "<im:tigger@100akerwood.com>", true },
				{ "<im:tigger@100akerwood.com", false },
				{ "<im:tigger>", true },
				{ "toto", false }
			} },
		{ make_shared<Cpim::ToHeader>(), {
				{ "<im:tigger@100akerwood.com", false },
				{ "Winnie the Pooh <im:pooh@100akerwood.com>", true },
				{ "toto", false },
				{ "<im:tigger>", true },
				{ "<im:tigger@100akerwood.com>", true }
			} },
		{ make_shared<Cpim::CcHeader>(), {
				{ "<im:tigger@100akerwood.com>", true },
				{ "<im:tigger@100akerwood.com", false },
				{ "Winnie the Pooh <im:pooh@100akerwood.com>", true },
				{ "<im:tigger>", true },
				{ "toto", false }
			} },
		{ make_shared<Cpim::DateTimeHeader>(), {
				{ "abcd", false },
				{ "1985-04-12T23:20:50.52Z", true },
				{ "1996-12-19T16:39:57-08:00", true },
				{ "1990-12-31T23:59:60Z", true },
				{ "1990-12-31T15:59:60-08:00", true },
				{ "2001-02-29T10:10:10Z", false },
				{ "2000-02-29T10:10:10Z", true },
				{ "1937-01-01T12:00:27.87+00:20", true },
				{ "1937-01-01T12:00:27.87Z", true },
				{ "1956", false }
			} },
		{ make_shared<Cpim::SubjectHeader>(), {
				{ "Eeyore's feeling very depressed today", true },
				{ "🤣", true },
				{ "hello", true }
			} },
		{ make_shared<Cpim::NsHeader>(), {
				{ "MyAlias <mid:MessageFeatures@id.foo.com>", true },
				{ "What is this? - Barry Burton", false },
				{ "<mid:MessageFeatures@id.foo.com>", true },
				{ "<mid:MessageFeatures@id.foo.com", false }
			} },
		{ make_shared<Cpim::RequireHeader>(), {
				{ "MyAlias.VitalHeader", true },
				{ "MyAlias.VitalHeader,Test", true },
				{ "MyAlias.VitalHeader,🤣", false }
			} }
	};

	for (const auto &entry : entries) {
		const shared_ptr<Cpim::Header> header = entry.first;
		string previousValue;

		for (const auto &test : entry.second) {
			const bool result = header->setValue(test.first);
			BC_ASSERT_EQUAL(result, test.second, bool, "%d");

			const string value = header->getValue();

			if (result)
				BC_ASSERT_STRING_EQUAL(value.c_str(), test.first.c_str());
			else
				BC_ASSERT_STRING_EQUAL(value.c_str(), previousValue.c_str());

			previousValue = value;
		}
	}
}

Ronan's avatar
Ronan committed
211
static void check_subject_header_language () {
Ronan's avatar
Ronan committed
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
	Cpim::SubjectHeader subjectHeader;

	// Check for not defined language.
	{
		const string language = subjectHeader.getLanguage();
		BC_ASSERT_STRING_EQUAL(language.c_str(), "");
	}

	// Set valid language.
	{
		const string languageToSet = "fr";

		BC_ASSERT_TRUE(subjectHeader.setLanguage(languageToSet));
		BC_ASSERT_TRUE(languageToSet == subjectHeader.getLanguage());

		const string str = subjectHeader.asString();
		const string expected = "Subject:;lang=" + languageToSet + " \r\n";
		BC_ASSERT_STRING_EQUAL(str.c_str(), expected.c_str());
	}

	// Set invalid language.
	{
		const string languageToSet = "fr--";
		BC_ASSERT_FALSE(subjectHeader.setLanguage(languageToSet));
		BC_ASSERT_FALSE(languageToSet == subjectHeader.getLanguage());
		BC_ASSERT_FALSE(subjectHeader.isValid());
	}
}

Ronan's avatar
Ronan committed
241
static void parse_rfc_example () {
242 243 244 245
	const string body = "<body>"
		"Here is the text of my message."
		"</body>";

Ronan's avatar
Ronan committed
246 247 248 249 250 251 252 253 254 255 256 257
	const string str = "Content-type: Message/CPIM\r\n"
		"\r\n"
		"From: MR SANDERS <im:piglet@100akerwood.com>\r\n"
		"To: Depressed Donkey <im:eeyore@100akerwood.com>\r\n"
		"DateTime: 2000-12-13T13:40:00-08:00\r\n"
		"Subject: the weather will be fine today\r\n"
		"Subject:;lang=fr beau temps prevu pour aujourd'hui\r\n"
		"NS: MyFeatures <mid:MessageFeatures@id.foo.com>\r\n"
		"Require: MyFeatures.VitalMessageOption\r\n"
		"MyFeatures.VitalMessageOption: Confirmation-requested\r\n"
		"MyFeatures.WackyMessageOption: Use-silly-font\r\n"
		"\r\n"
258
		"Content-Type: text/xml; charset=utf-8\r\n"
Ronan's avatar
Ronan committed
259
		"Content-ID: <1234567890@foo.com>\r\n"
260
		"\r\n" + body;
Ronan's avatar
Ronan committed
261 262 263 264 265 266

	shared_ptr<const Cpim::Message> message = Cpim::Message::createFromString(str);
	if (!BC_ASSERT_PTR_NOT_NULL(message)) return;

	const string str2 = message->asString();
	BC_ASSERT_STRING_EQUAL(str2.c_str(), str.c_str());
267

268 269
	string content = message->getContent();
	BC_ASSERT_STRING_EQUAL(content.c_str(), body.c_str());
Ronan's avatar
Ronan committed
270 271
}

Ronan's avatar
Ronan committed
272
static void parse_message_with_generic_header_parameters () {
273 274 275 276
	const string body = "<body>"
		"Here is the text of my message."
		"</body>";

Ronan's avatar
Ronan committed
277 278 279 280 281 282 283
	const string str = "Content-type: Message/CPIM\r\n"
		"\r\n"
		"From: MR SANDERS <im:piglet@100akerwood.com>\r\n"
		"Test:;aaa=bbb;yes=no CheckMe\r\n"
		"yaya: coucou\r\n"
		"yepee:;good=bad ugly\r\n"
		"\r\n"
284
		"Content-Type: text/xml; charset=utf-8\r\n"
Ronan's avatar
Ronan committed
285
		"Content-ID: <1234567890@foo.com>\r\n"
286
		"\r\n" + body;
Ronan's avatar
Ronan committed
287 288 289 290 291 292

	shared_ptr<const Cpim::Message> message = Cpim::Message::createFromString(str);
	if (!BC_ASSERT_PTR_NOT_NULL(message)) return;

	const string str2 = message->asString();
	BC_ASSERT_STRING_EQUAL(str2.c_str(), str.c_str());
293

294 295
	string content = message->getContent();
	BC_ASSERT_STRING_EQUAL(content.c_str(), body.c_str());
Ronan's avatar
Ronan committed
296 297
}

Ronan's avatar
Ronan committed
298
static void build_message () {
Ronan's avatar
Ronan committed
299 300 301 302 303
	Cpim::Message message;
	if (!BC_ASSERT_FALSE(message.isValid()))
		return;

	// Set CPIM headers.
304 305 306
	Cpim::GenericHeader cpimContentTypeHeader;
	if (!BC_ASSERT_TRUE(cpimContentTypeHeader.setName("Content-Type"))) return;
	if (!BC_ASSERT_TRUE(cpimContentTypeHeader.setValue("Message/CPIM"))) return;
Ronan's avatar
Ronan committed
307

308
	if (!BC_ASSERT_TRUE(message.addCpimHeader(cpimContentTypeHeader))) return;
Ronan's avatar
Ronan committed
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350

	// Set message headers.
	Cpim::FromHeader fromHeader;
	if (!BC_ASSERT_TRUE(fromHeader.setValue("MR SANDERS <im:piglet@100akerwood.com>"))) return;

	Cpim::ToHeader toHeader;
	if (!BC_ASSERT_TRUE(toHeader.setValue("Depressed Donkey <im:eeyore@100akerwood.com>"))) return;

	Cpim::DateTimeHeader dateTimeHeader;
	if (!BC_ASSERT_TRUE(dateTimeHeader.setValue("2000-12-13T13:40:00-08:00"))) return;

	Cpim::SubjectHeader subjectHeader;
	if (!BC_ASSERT_TRUE(subjectHeader.setValue("the weather will be fine today"))) return;

	Cpim::SubjectHeader subjectWithLanguageHeader;
	if (!BC_ASSERT_TRUE(subjectWithLanguageHeader.setValue("beau temps prevu pour aujourd'hui"))) return;
	if (!BC_ASSERT_TRUE(subjectWithLanguageHeader.setLanguage("fr"))) return;

	Cpim::NsHeader nsHeader;
	if (!BC_ASSERT_TRUE(nsHeader.setValue("MyFeatures <mid:MessageFeatures@id.foo.com>"))) return;

	Cpim::RequireHeader requireHeader;
	if (!BC_ASSERT_TRUE(requireHeader.setValue("MyFeatures.VitalMessageOption"))) return;

	Cpim::GenericHeader vitalMessageHeader;
	if (!BC_ASSERT_TRUE(vitalMessageHeader.setName("MyFeatures.VitalMessageOption"))) return;
	if (!BC_ASSERT_TRUE(vitalMessageHeader.setValue("Confirmation-requested"))) return;

	Cpim::GenericHeader wackyMessageHeader;
	if (!BC_ASSERT_TRUE(wackyMessageHeader.setName("MyFeatures.WackyMessageOption"))) return;
	if (!BC_ASSERT_TRUE(wackyMessageHeader.setValue("Use-silly-font"))) return;

	if (!BC_ASSERT_TRUE(message.addMessageHeader(fromHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(toHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(dateTimeHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(subjectHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(subjectWithLanguageHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(nsHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(requireHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(vitalMessageHeader))) return;
	if (!BC_ASSERT_TRUE(message.addMessageHeader(wackyMessageHeader))) return;

351 352 353 354 355
	// Set Content headers.
    Cpim::GenericHeader contentTypeHeader;
	if (!BC_ASSERT_TRUE(contentTypeHeader.setName("Content-Type"))) return;
	if (!BC_ASSERT_TRUE( contentTypeHeader.setValue("text/xml; charset=utf-8"))) return;
	if (!BC_ASSERT_TRUE(message.addContentHeader(contentTypeHeader))) return;
356

357 358 359 360 361 362
    Cpim::GenericHeader contentIdHeader;
	if (!BC_ASSERT_TRUE(contentIdHeader.setName("Content-ID"))) return;
	if (!BC_ASSERT_TRUE( contentIdHeader.setValue("<1234567890@foo.com>"))) return;
    if (!BC_ASSERT_TRUE(message.addContentHeader(contentIdHeader))) return;

	const string content = "<body>"
Ronan's avatar
Ronan committed
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
		"Here is the text of my message."
		"</body>";

	if (!BC_ASSERT_TRUE(message.setContent(content))) return;
	if (!BC_ASSERT_TRUE(message.isValid())) return;

	const string strMessage = message.asString();
	const string expectedMessage = "Content-Type: Message/CPIM\r\n"
		"\r\n"
		"From: MR SANDERS <im:piglet@100akerwood.com>\r\n"
		"To: Depressed Donkey <im:eeyore@100akerwood.com>\r\n"
		"DateTime: 2000-12-13T13:40:00-08:00\r\n"
		"Subject: the weather will be fine today\r\n"
		"Subject:;lang=fr beau temps prevu pour aujourd'hui\r\n"
		"NS: MyFeatures <mid:MessageFeatures@id.foo.com>\r\n"
		"Require: MyFeatures.VitalMessageOption\r\n"
		"MyFeatures.VitalMessageOption: Confirmation-requested\r\n"
		"MyFeatures.WackyMessageOption: Use-silly-font\r\n"
		"\r\n"
382
		"Content-Type: text/xml; charset=utf-8\r\n"
Ronan's avatar
Ronan committed
383 384 385 386 387 388 389 390 391
		"Content-ID: <1234567890@foo.com>\r\n"
		"\r\n"
		"<body>"
		"Here is the text of my message."
		"</body>";

	BC_ASSERT_STRING_EQUAL(strMessage.c_str(), expectedMessage.c_str());
}

Sylvain Berfini's avatar
Sylvain Berfini committed
392 393 394 395 396 397 398 399 400 401
static int fake_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
	BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_content_type(msg), ContentType::Cpim.asString().c_str()); // Encryption is the first receiving step, so this message should be CPIM
	return -1;
}

static int fake_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
	BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_content_type(msg), ContentType::Cpim.asString().c_str()); // Encryption is the last sending step, so this message should be CPIM
	return -1;
}

402
static void cpim_chat_message_modifier_base(bool_t use_multipart) {
Sylvain Berfini's avatar
Sylvain Berfini committed
403 404 405
	LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
	LpConfig *config = linphone_core_get_config(marie->lc);
Sylvain Berfini's avatar
Sylvain Berfini committed
406 407 408 409 410 411 412 413 414 415 416

	// We use a fake encryption engine just to check the internal content type during the sending/receiving process
	LinphoneImEncryptionEngine *marie_imee = linphone_im_encryption_engine_new();
	LinphoneImEncryptionEngineCbs *marie_cbs = linphone_im_encryption_engine_get_callbacks(marie_imee);
	LinphoneImEncryptionEngine *pauline_imee = linphone_im_encryption_engine_new();
	LinphoneImEncryptionEngineCbs *pauline_cbs = linphone_im_encryption_engine_get_callbacks(pauline_imee);
	linphone_im_encryption_engine_cbs_set_process_outgoing_message(marie_cbs, fake_im_encryption_engine_process_outgoing_message_cb);
	linphone_im_encryption_engine_cbs_set_process_incoming_message(pauline_cbs, fake_im_encryption_engine_process_incoming_message_cb);
	linphone_core_set_im_encryption_engine(marie->lc, marie_imee);
	linphone_core_set_im_encryption_engine(pauline->lc, pauline_imee);

Sylvain Berfini's avatar
Sylvain Berfini committed
417 418
	lp_config_set_int(config, "sip", "use_cpim", 1);

419
	IdentityAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity));
420
	shared_ptr<AbstractChatRoom> marieRoom = marie->lc->cppPtr->getOrCreateBasicChatRoom(paulineAddress);
Sylvain Berfini's avatar
Sylvain Berfini committed
421
	marieRoom->allowCpim(true);
422

423
	shared_ptr<ChatMessage> marieMessage = marieRoom->createChatMessage("Hello CPIM");
424
	if (use_multipart) {
Sylvain Berfini's avatar
Sylvain Berfini committed
425
		marieRoom->allowMultipart(true);
426 427 428
		Content *content = new Content();
		content->setContentType(ContentType::PlainText);
		content->setBody("Hello Part 2");
429
		marieMessage->addContent(*content);
430
	}
431
	marieMessage->send();
Sylvain Berfini's avatar
Sylvain Berfini committed
432 433

	BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageReceived,1));
Sylvain Berfini's avatar
Sylvain Berfini committed
434
	BC_ASSERT_STRING_EQUAL(marieMessage->getInternalContent().getContentType().asString().c_str(), ""); // Internal content is cleaned after message is sent or received
435

Sylvain Berfini's avatar
Sylvain Berfini committed
436 437 438
	BC_ASSERT_PTR_NOT_NULL(pauline->stat.last_received_chat_message);
	if (pauline->stat.last_received_chat_message != NULL) {
		BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), "Hello CPIM");
Sylvain Berfini's avatar
Sylvain Berfini committed
439
		BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_content_type(pauline->stat.last_received_chat_message), ContentType::PlainText.asString().c_str());
Sylvain Berfini's avatar
Sylvain Berfini committed
440 441
	}

Sylvain Berfini's avatar
Sylvain Berfini committed
442 443 444
	linphone_im_encryption_engine_unref(marie_imee);
	linphone_im_encryption_engine_unref(pauline_imee);

Sylvain Berfini's avatar
Sylvain Berfini committed
445 446
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
447 448
}

449 450 451 452 453 454 455 456
static void cpim_chat_message_modifier(void) {
	cpim_chat_message_modifier_base(FALSE);
}

static void cpim_chat_message_modifier_with_multipart_body(void) {
	cpim_chat_message_modifier_base(TRUE);
}

Ronan's avatar
Ronan committed
457 458 459 460 461 462 463 464 465
test_t cpim_tests[] = {
	TEST_NO_TAG("Parse minimal CPIM message", parse_minimal_message),
	TEST_NO_TAG("Set generic header name", set_generic_header_name),
	TEST_NO_TAG("Set generic header value", set_generic_header_value),
	TEST_NO_TAG("Check core header names", check_core_header_names),
	TEST_NO_TAG("Set core header values", set_core_header_values),
	TEST_NO_TAG("Check Subject header language", check_subject_header_language),
	TEST_NO_TAG("Parse RFC example", parse_rfc_example),
	TEST_NO_TAG("Parse Message with generic header parameters", parse_message_with_generic_header_parameters),
466
	TEST_NO_TAG("Build Message", build_message),
467 468
	TEST_NO_TAG("CPIM chat message modifier", cpim_chat_message_modifier),
	TEST_NO_TAG("CPIM chat message modifier with multipart body", cpim_chat_message_modifier_with_multipart_body),
Ronan's avatar
Ronan committed
469 470 471 472 473 474
};

test_suite_t cpim_test_suite = {
	"Cpim", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
	sizeof(cpim_tests) / sizeof(cpim_tests[0]), cpim_tests
};