Skip to content

Commit

Permalink
Bug 968490: Add mozilla::pkix::der unit tests (r=cviecco)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Arentz committed Mar 26, 2014
1 parent 4da5363 commit a2a372b
Show file tree
Hide file tree
Showing 6 changed files with 1,293 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/mozpkix/lib/pkixder.h
Expand Up @@ -189,13 +189,14 @@ class Input

Mark GetMark() const { return Mark(input); }

void GetSECItem(SECItemType type, const Mark& mark, /*out*/ SECItem& item)
bool GetSECItem(SECItemType type, const Mark& mark, /*out*/ SECItem& item)
{
PR_ASSERT(mark.mMark < input);
item.type = type;
item.data = const_cast<uint8_t*>(mark.mMark);
// TODO: bounds check
// TODO: Return false if bounds check fails
item.len = input - mark.mMark;
return true;
}

private:
Expand Down
3 changes: 2 additions & 1 deletion lib/mozpkix/moz.build
Expand Up @@ -17,7 +17,8 @@ LOCAL_INCLUDES += [
'include',
]

DIRS += [
TEST_DIRS += [
'test/gtest',
'test/lib',
]

Expand Down
22 changes: 22 additions & 0 deletions lib/mozpkix/test/gtest/moz.build
@@ -0,0 +1,22 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

LIBRARY_NAME = 'mozillapkix_gtest'

SOURCES += [
'pkixder_input_tests.cpp',
'pkixder_pki_types_tests.cpp',
'pkixder_universal_types_tests.cpp',
]

LOCAL_INCLUDES += [
'../../include',
'../../lib',
]

FINAL_LIBRARY='xul-gtest'

include('/ipc/chromium/chromium-config.mozbuild')

0 comments on commit a2a372b

Please sign in to comment.