blob: 12c9363d7a0762bcbd2c3d886be54e16882214bc [file] [log] [blame]
Greg Kerr019d59c2016-11-17 14:28:49 -08001// Copyright 2016 The Chromium OS 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.
4
Ben Chand1bd67a2019-02-28 23:11:38 -08005#ifndef IMAGELOADER_TEST_UTILITIES_H_
6#define IMAGELOADER_TEST_UTILITIES_H_
7
Greg Kerr019d59c2016-11-17 14:28:49 -08008#include <stdint.h>
9
10#include <list>
11#include <string>
12
13#include <base/files/file_path.h>
14#include <base/files/scoped_temp_dir.h>
15
16namespace imageloader {
17
18// Test data always uses the dev key.
19constexpr uint8_t kDevPublicKey[] = {
20 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
21 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
22 0x42, 0x00, 0x04, 0x7a, 0xaa, 0x2b, 0xf9, 0x3d, 0x7a, 0xbe, 0x35, 0x9a,
23 0xfc, 0x9f, 0x39, 0x2d, 0x2d, 0x37, 0x07, 0xd4, 0x19, 0x67, 0x67, 0x30,
24 0xbb, 0x5c, 0x74, 0x22, 0xd5, 0x02, 0x07, 0xaf, 0x6b, 0x12, 0x9d, 0x12,
25 0xf0, 0x34, 0xfd, 0x1a, 0x7f, 0x02, 0xd8, 0x46, 0x2b, 0x25, 0xca, 0xa0,
26 0x6e, 0x2b, 0x54, 0x41, 0xee, 0x92, 0xa2, 0x0f, 0xa2, 0x2a, 0xc0, 0x30,
27 0xa6, 0x8c, 0xd1, 0x16, 0x0a, 0x48, 0xca};
28// This is the name of the component used in the test data.
29constexpr char kTestComponentName[] = "PepperFlashPlayer";
30// This is the version of flash player used in the test data.
31constexpr char kTestDataVersion[] = "22.0.0.158";
32// This is the version of the updated flash player in the test data.
33constexpr char kTestUpdatedVersion[] = "22.0.0.256";
34
35// Get the path of the test component in the test data folder.
Xiaochu Liuc2264342017-08-14 16:37:42 -070036base::FilePath GetTestDataPath(const std::string& subdir);
Greg Kerr019d59c2016-11-17 14:28:49 -080037base::FilePath GetTestComponentPath();
38base::FilePath GetTestComponentPath(const std::string& version);
39
Eric Caruso0b79bc82017-03-21 13:44:34 -070040// Second test key.
41constexpr uint8_t kOciDevPublicKey[] = {
42 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
43 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
44 0x42, 0x00, 0x04, 0xcc, 0x33, 0xa2, 0xef, 0x3d, 0xa5, 0xb4, 0x04, 0xc5,
45 0x9c, 0x99, 0xc1, 0x53, 0xe4, 0xdb, 0xed, 0x34, 0xa4, 0x75, 0x35, 0x44,
46 0x5f, 0x67, 0x35, 0xda, 0x30, 0xd4, 0xce, 0xf8, 0x40, 0x03, 0x81, 0x15,
47 0xb5, 0xc6, 0xe3, 0xe2, 0x3a, 0x61, 0xd3, 0x66, 0x2b, 0xcd, 0x42, 0xf3,
48 0x1f, 0x30, 0xa6, 0xa3, 0xc1, 0x63, 0x47, 0x4a, 0x6e, 0x62, 0xa9, 0x9b,
49 0x38, 0x49, 0x10, 0x03, 0xe2, 0x4b, 0xcc};
50constexpr char kTestOciComponentName[] = "adb";
51constexpr char kTestOciComponentVersion[] = "5.1.1.13";
52
Eric Caruso26a91442017-10-25 16:05:40 -070053// Equivalent component but with metadata in the manifest.
54constexpr char kMetadataComponentName[] = "adb-with-metadata";
55constexpr char kBadMetadataComponentName[] = "adb-with-bad-metadata";
56constexpr char kNonDictMetadataComponentName[] = "adb-with-non-dict-metadata";
57
Eric Caruso0b79bc82017-03-21 13:44:34 -070058// Get the path of the test OCI component in the test data folder.
59base::FilePath GetTestOciComponentPath();
Eric Caruso26a91442017-10-25 16:05:40 -070060base::FilePath GetMetadataComponentPath();
61base::FilePath GetBadMetadataComponentPath();
62base::FilePath GetNonDictMetadataComponentPath();
Eric Caruso0b79bc82017-03-21 13:44:34 -070063
Greg Kerr019d59c2016-11-17 14:28:49 -080064// Enumerate all files in a directory and return them as a list of filenames.
65void GetFilesInDir(const base::FilePath& dir, std::list<std::string>* files);
66
67} // namespace imageloader
Ben Chand1bd67a2019-02-28 23:11:38 -080068
69#endif // IMAGELOADER_TEST_UTILITIES_H_