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. 4 5 #include <stddef.h> 6 7 #include "ui/base/resource/data_pack_literal.h" 8 #include "ui/base/resource/resource_bundle.h" 9 10 namespace ui { 11 12 const char kSamplePakContentsV4[] = { 13 0x04, 0x00, 0x00, 0x00, // header(version 14 0x04, 0x00, 0x00, 0x00, // no. entries 15 0x01, // encoding) 16 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 1 17 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 4 18 0x06, 0x00, 0x33, 0x00, 0x00, 0x00, // index entry 6 19 0x0a, 0x00, 0x3f, 0x00, 0x00, 0x00, // index entry 10 20 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // extra entry for the size of last 21 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4', 22 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'}; 23 24 const size_t kSamplePakSizeV4 = sizeof(kSamplePakContentsV4); 25 26 const char kSampleCompressPakContentsV5[] = { 27 0x05, 0x00, 0x00, 0x00, // version 28 0x01, 0x00, 0x00, 0x00, // encoding + padding 29 0x03, 0x00, 0x01, 0x00, // num_resources, num_aliases 30 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, // index entry 4 31 0x06, 0x00, 0x34, 0x00, 0x00, 0x00, // index entry 6 32 0x08, 0x00, 0x4c, 0x00, 0x00, 0x00, // index entry 8 33 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, // extra entry for the size of last 34 0x0a, 0x00, 0x00, 0x00, // alias table 35 36 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4', 37 // "this is id 6" brotli compressed with 38 // echo -n "this is id 6" |{brotli_executable_path}/brotli - -f| 39 // hexdump -C where brotli_executable_path is the directory of the brotli 40 // executable dependent on the build device. For example, on Android builds, 41 // the executable path is out/Build_name/clang_x64/brotli. Also added header 42 // with kBrotliConst and the length of the decompressed data. 43 ResourceBundle::kBrotliConst[0], ResourceBundle::kBrotliConst[1], 0x0c, 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x05, 0x80, 0x74, 0x68, 0x69, 0x73, 45 0x20, 0x69, 0x73, 0x20, 0x69, 0x64, 0x20, 0x36, 0x03, 46 // "this is id 8" gzipped with 47 // echo -n "this is id 8" | gzip -f -c | hexdump -C 48 0x1f, 0x8b, 0x08, 0x00, 0x53, 0x99, 0x1f, 0x5d, 0x00, 0x03, 0x2b, 0xc9, 49 0xc8, 0x2c, 0x56, 0x00, 0xa1, 0x14, 0x05, 0x0b, 0x00, 0x71, 0xa7, 0x0b, 50 0x4d, 0x0c, 0x00, 0x00, 0x00}; 51 52 const size_t kSampleCompressPakSizeV5 = sizeof(kSampleCompressPakContentsV5); 53 54 const char kSampleCompressScaledPakContents[] = { 55 0x05, 0x00, 0x00, 0x00, // version 56 0x01, 0x00, 0x00, 0x00, // encoding + padding 57 0x03, 0x00, 0x01, 0x00, // num_resources, num_aliases 58 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, // index entry 1 59 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, // index entry 4 60 0x06, 0x00, 0x34, 0x00, 0x00, 0x00, // index entry 6 61 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, // extra entry for the size of last 62 0x0a, 0x00, 0x01, 0x00, // alias table 63 64 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4', 65 // "this is id 6 x2" brotli compressed with 66 // echo -n "this is id 6 x2" |{brotli_executable_path}/brotli - -f| 67 // hexdump -C where brotli_executable_path is the directory of the brotli 68 // executable dependent on the build device. For example, on Android builds, 69 // the executable path is out/Build_name/clang_x64/brotli. Also added header 70 // with kBrotliConst and the length of the decompressed data. See 71 // tools/grit/grit/node/base.py for grit brotli compression. 72 ResourceBundle::kBrotliConst[0], ResourceBundle::kBrotliConst[1], 0x0f, 73 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x07, 0x80, 0x74, 0x68, 0x69, 0x73, 74 0x20, 0x69, 0x73, 0x20, 0x69, 0x64, 0x20, 0x36, 0x20, 0x78, 0x32, 0x03}; 75 76 const size_t kSampleCompressScaledPakSize = 77 sizeof(kSampleCompressScaledPakContents); 78 79 const char kSampleCorruptPakContents[] = { 80 0x04, 0x00, 0x00, 0x00, // header(version 81 0x04, 0x00, 0x00, 0x00, // no. entries 82 0x01, // encoding) 83 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 1 84 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // index entry 4 85 0x06, 0x00, 0x33, 0x00, 0x00, 0x00, // index entry 6 86 0x0a, 0x00, 0x3f, 0x00, 0x00, 0x00, // index entry 10 87 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // extra entry for the size of last, 88 // extends past END OF FILE. 89 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '4', 't', 'h', 'i', 90 's', ' ', 'i', 's', ' ', 'i', 'd', ' ', '6'}; 91 92 const size_t kSampleCorruptPakSize = sizeof(kSampleCorruptPakContents); 93 94 const char kSamplePakContents2x[] = { 95 0x04, 0x00, 0x00, 0x00, // header(version 96 0x01, 0x00, 0x00, 0x00, // no. entries 97 0x01, // encoding) 98 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, // index entry 4 99 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // extra entry for the size of last 100 't', 'h', 'i', 's', ' ', 'i', 's', ' ', 101 'i', 'd', ' ', '4', ' ', '2', 'x'}; 102 103 const size_t kSamplePakSize2x = sizeof(kSamplePakContents2x); 104 105 const char kEmptyPakContents[] = { 106 0x04, 0x00, 0x00, 0x00, // header(version 107 0x00, 0x00, 0x00, 0x00, // no. entries 108 0x01, // encoding) 109 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 // extra entry for the size of last 110 }; 111 112 const size_t kEmptyPakSize = sizeof(kEmptyPakContents); 113 114 } // namespace ui 115