mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
a2174af992
- Bug 1143038 - Use AppConstants in tabbrowser.xml (r=gavin) (7974d0be4) - Bug 1087726: Make JS callers of ios.newChannel call ios.newChannel2 in browser/ (r=gijs) (995267699) - Bug 1149037 - Make nsLayoutUtils::ComputeSizeForDrawing* take a CSSIntSize param instead of a unit-less nsIntSize. r=roc (34aebc313) - Bug 1149215 - Remove nsLayoutUtils::GetWholeImageDestination that use unitless nsIntSize. r=dholbert (dba5c0392) - Bug 1149222 part 1 - Make nsLayoutUtils::DrawBackgroundImage and SVGImageContext use CSSIntSize instead of unitless nsIntSize. r=dholbert (32052dcf6) - Bug 1149222 part 2 - Make nsSVGImageFrame::PaintSVG use LayoutDeviceSize & LayoutDevicePixel::ToAppUnits, when setting up its dest-rect. r=mats (d7505c2ab) - Bug 1102048 (Part 15, VectorImage) - Make image/src files comply with the Mozilla Coding Style Guide. r=seth (c38d91d61) - do not uselessly run the preprocessor (280c69776) - Bug 1130816 - Bad argument passed to newChannelFromURI2 in WindowsPreviewPerTab.jsm (r=gijs) (70cd2eec7) - AppConstants.jsm changes - Bug 1149334 - Remove preprocessing of nsUpdateService.js and use AppConstants.jsm. r=gavin.sharp (ab53e3bc2) - Bug 1153657 - Performance Monitoring is not ready to ride the trains. r=yoric (582aef2de) - Bug 1140672 - Remove app update file migration code for Windows. r=spohl (c7d6a39ab) - Bug 1137901 - Remove param from refreshUpdateStatus. r=spohl (4d6bfc4e0) - Remove FHR from app update Bug 1121018 - FHR data migration: org.mozilla.update. r=spohl (70db64336) - lost bits of 1. main patch - Bug 843497 - Update check says 'up to date' for out (0975d2954) - 1. File renames for Bug 1136358 - Preprocessing and file includes make it difficult to debug app update tests. r=spohl (c94361eee) - 2. Build changes for Bug 1136358 - Preprocessing and file includes make it difficult to debug app update tests. r=spohl, r=gps (d4f2581a1) - 3. Main patch for Bug 1136358 - Preprocessing and file includes make it difficult to debug app update tests. r=spohl (f4f7e68c6) - 4. Use XPCOMUtils for Bug 1136358 - Preprocessing and file includes make it difficult to debug app update tests. r=spohl (0f4a9df9e) - Bug 1137447 - New app update telemetry for patch type (complete or partial), extended error codes, and general cleanup. r=bbondy (12fb03ead) - Bug 1149590 - Update/Upgrade for application dowloaded and installed, setting to ask/prompt for action ignored. r=spohl (2be30a384) - changes for nsUpdateService.js - Bug 1149334 - Remove preprocessing of nsUpdateService.js and use AppConstants.jsm. r=spohl (e404305ee) - Bug 1139958 - Start using AppConstants.jsm in Toolkit r=mossop (3e39e1160) - Bug 1150688 - Update sections of GMPInstallManager.jsm, which were copied from nsUpdateService.js, to reflect the changes to nsUpdateService.js from bug 1149334. r=spohl (3fa552f68) - Followup patch to Bug 1139958 forgot to add a comment to AppConstants.jsm r=mossop (be2408473)
173 lines
5.4 KiB
C++
173 lines
5.4 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
/**
|
|
* This binary tests the updater's ReadStrings ini parser and should run in a
|
|
* directory with a Unicode character to test bug 473417.
|
|
*/
|
|
#ifdef XP_WIN
|
|
#include <windows.h>
|
|
#define NS_main wmain
|
|
#define NS_tstrrchr wcsrchr
|
|
#define NS_T(str) L ## str
|
|
#define PATH_SEPARATOR_CHAR L'\\'
|
|
// On Windows, argv[0] can also have forward slashes instead
|
|
#define ALT_PATH_SEPARATOR_CHAR L'/'
|
|
#else
|
|
#include <unistd.h>
|
|
#define NS_main main
|
|
#define NS_tstrrchr strrchr
|
|
#define NS_T(str) str
|
|
#define PATH_SEPARATOR_CHAR '/'
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
#include <string.h>
|
|
|
|
#include "updater/resource.h"
|
|
#include "updater/progressui.h"
|
|
#include "common/readstrings.h"
|
|
#include "common/errors.h"
|
|
#include "mozilla/ArrayUtils.h"
|
|
|
|
#ifndef MAXPATHLEN
|
|
# ifdef PATH_MAX
|
|
# define MAXPATHLEN PATH_MAX
|
|
# elif defined(MAX_PATH)
|
|
# define MAXPATHLEN MAX_PATH
|
|
# elif defined(_MAX_PATH)
|
|
# define MAXPATHLEN _MAX_PATH
|
|
# elif defined(CCHMAXPATH)
|
|
# define MAXPATHLEN CCHMAXPATH
|
|
# else
|
|
# define MAXPATHLEN 1024
|
|
# endif
|
|
#endif
|
|
|
|
#define TEST_NAME "Updater ReadStrings"
|
|
|
|
using namespace mozilla;
|
|
|
|
static int gFailCount = 0;
|
|
|
|
/**
|
|
* Prints the given failure message and arguments using printf, prepending
|
|
* "TEST-UNEXPECTED-FAIL " for the benefit of the test harness and
|
|
* appending "\n" to eliminate having to type it at each call site.
|
|
*/
|
|
void fail(const char* msg, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
printf("TEST-UNEXPECTED-FAIL | ");
|
|
|
|
va_start(ap, msg);
|
|
vprintf(msg, ap);
|
|
va_end(ap);
|
|
|
|
putchar('\n');
|
|
++gFailCount;
|
|
}
|
|
|
|
int NS_main(int argc, NS_tchar **argv)
|
|
{
|
|
printf("Running TestAUSReadStrings tests\n");
|
|
|
|
int rv = 0;
|
|
int retval;
|
|
NS_tchar inifile[MAXPATHLEN];
|
|
StringTable testStrings;
|
|
|
|
NS_tchar *slash = NS_tstrrchr(argv[0], PATH_SEPARATOR_CHAR);
|
|
#ifdef ALT_PATH_SEPARATOR_CHAR
|
|
NS_tchar *altslash = NS_tstrrchr(argv[0], ALT_PATH_SEPARATOR_CHAR);
|
|
slash = (slash > altslash) ? slash : altslash;
|
|
#endif // ALT_PATH_SEPARATOR_CHAR
|
|
|
|
if (!slash) {
|
|
fail("%s | unable to find platform specific path separator (check 1)", TEST_NAME);
|
|
return 20;
|
|
}
|
|
|
|
*(++slash) = '\0';
|
|
// Test success when the ini file exists with both Title and Info in the
|
|
// Strings section and the values for Title and Info.
|
|
NS_tsnprintf(inifile, ArrayLength(inifile), NS_T("%sTestAUSReadStrings1.ini"), argv[0]);
|
|
retval = ReadStrings(inifile, &testStrings);
|
|
if (retval == OK) {
|
|
if (strcmp(testStrings.title, "Title Test - \xD0\x98\xD1\x81\xD0\xBF\xD1\x8B" \
|
|
"\xD1\x82\xD0\xB0\xD0\xBD\xD0\xB8\xD0\xB5 " \
|
|
"\xCE\x94\xCE\xBF\xCE\xBA\xCE\xB9\xCE\xBC\xCE\xAE " \
|
|
"\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88 " \
|
|
"\xE6\xB8\xAC\xE8\xA9\xA6 " \
|
|
"\xE6\xB5\x8B\xE8\xAF\x95") != 0) {
|
|
rv = 21;
|
|
fail("%s | Title ini value incorrect (check 3)", TEST_NAME);
|
|
}
|
|
|
|
if (strcmp(testStrings.info, "Info Test - \xD0\x98\xD1\x81\xD0\xBF\xD1\x8B" \
|
|
"\xD1\x82\xD0\xB0\xD0\xBD\xD0\xB8\xD0\xB5 " \
|
|
"\xCE\x94\xCE\xBF\xCE\xBA\xCE\xB9\xCE\xBC\xCE\xAE " \
|
|
"\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88 " \
|
|
"\xE6\xB8\xAC\xE8\xA9\xA6 " \
|
|
"\xE6\xB5\x8B\xE8\xAF\x95\xE2\x80\xA6") != 0) {
|
|
rv = 22;
|
|
fail("%s | Info ini value incorrect (check 4)", TEST_NAME);
|
|
}
|
|
} else {
|
|
fail("%s | ReadStrings returned %i (check 2)", TEST_NAME, retval);
|
|
rv = 23;
|
|
}
|
|
|
|
// Test failure when the ini file exists without Title and with Info in the
|
|
// Strings section.
|
|
NS_tsnprintf(inifile, ArrayLength(inifile), NS_T("%sTestAUSReadStrings2.ini"), argv[0]);
|
|
retval = ReadStrings(inifile, &testStrings);
|
|
if (retval != PARSE_ERROR) {
|
|
rv = 24;
|
|
fail("%s | ReadStrings returned %i (check 5)", TEST_NAME, retval);
|
|
}
|
|
|
|
// Test failure when the ini file exists with Title and without Info in the
|
|
// Strings section.
|
|
NS_tsnprintf(inifile, ArrayLength(inifile), NS_T("%sTestAUSReadStrings3.ini"), argv[0]);
|
|
retval = ReadStrings(inifile, &testStrings);
|
|
if (retval != PARSE_ERROR) {
|
|
rv = 25;
|
|
fail("%s | ReadStrings returned %i (check 6)", TEST_NAME, retval);
|
|
}
|
|
|
|
// Test failure when the ini file doesn't exist
|
|
NS_tsnprintf(inifile, ArrayLength(inifile), NS_T("%sTestAUSReadStringsBogus.ini"), argv[0]);
|
|
retval = ReadStrings(inifile, &testStrings);
|
|
if (retval != READ_ERROR) {
|
|
rv = 26;
|
|
fail("%s | ini file doesn't exist (check 7)", TEST_NAME);
|
|
}
|
|
|
|
// Test reading a non-default section name
|
|
NS_tsnprintf(inifile, ArrayLength(inifile), NS_T("%sTestAUSReadStrings3.ini"), argv[0]);
|
|
retval = ReadStrings(inifile, "Title\0", 1, &testStrings.title, "BogusSection2");
|
|
if (retval == OK) {
|
|
if (strcmp(testStrings.title, "Bogus Title") != 0) {
|
|
rv = 27;
|
|
fail("%s | Title ini value incorrect (check 9)", TEST_NAME);
|
|
}
|
|
} else {
|
|
fail("%s | ReadStrings returned %i (check 8)", TEST_NAME, retval);
|
|
rv = 28;
|
|
}
|
|
|
|
|
|
if (rv == 0) {
|
|
printf("TEST-PASS | %s | all checks passed\n", TEST_NAME);
|
|
} else {
|
|
fail("%s | %i out of 9 checks failed", TEST_NAME, gFailCount);
|
|
}
|
|
|
|
return rv;
|
|
}
|