1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromeos/network/onc/onc_utils.h"
9 #include "base/values.h"
10 #include "chromeos/network/onc/onc_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h"
16 TEST(ONCDecrypterTest
, BrokenEncryptionIterations
) {
17 scoped_ptr
<base::DictionaryValue
> encrypted_onc
=
18 test_utils::ReadTestDictionary("broken-encrypted-iterations.onc");
20 scoped_ptr
<base::DictionaryValue
> decrypted_onc
=
21 Decrypt("test0000", *encrypted_onc
);
23 EXPECT_EQ(NULL
, decrypted_onc
.get());
26 TEST(ONCDecrypterTest
, BrokenEncryptionZeroIterations
) {
27 scoped_ptr
<base::DictionaryValue
> encrypted_onc
=
28 test_utils::ReadTestDictionary("broken-encrypted-zero-iterations.onc");
31 scoped_ptr
<base::DictionaryValue
> decrypted_onc
=
32 Decrypt("test0000", *encrypted_onc
);
34 EXPECT_EQ(NULL
, decrypted_onc
.get());
37 TEST(ONCDecrypterTest
, LoadEncryptedOnc
) {
38 scoped_ptr
<base::DictionaryValue
> encrypted_onc
=
39 test_utils::ReadTestDictionary("encrypted.onc");
40 scoped_ptr
<base::DictionaryValue
> expected_decrypted_onc
=
41 test_utils::ReadTestDictionary("decrypted.onc");
44 scoped_ptr
<base::DictionaryValue
> actual_decrypted_onc
=
45 Decrypt("test0000", *encrypted_onc
);
47 base::DictionaryValue emptyDict
;
48 EXPECT_TRUE(test_utils::Equals(expected_decrypted_onc
.get(),
49 actual_decrypted_onc
.get()));
53 } // namespace chromeos