Esempio n. 1
0
TEST_F(PlistTests, test_parse_plist) {
  std::string path = "/System/Library/LaunchDaemons/com.apple.kextd.plist";
  boost::property_tree::ptree tree;
  auto s = parsePlist(path, tree);
  EXPECT_TRUE(s.ok());
  EXPECT_EQ(s.toString(), "OK");
}
Esempio n. 2
0
TEST_F(PlistTests, test_parse_plist_array) {
  // Now read the plist from a file and parse.
  boost::property_tree::ptree tree;
  auto s = parsePlist(kTestDataPath + "test_array.plist", tree);

  EXPECT_TRUE(s.ok());
  EXPECT_EQ(s.toString(), "OK");
}
Esempio n. 3
0
bool Bundle::extractInfo()
{
    QString plistLocation = QString("%1Info.plist").arg(path());
    QString configXml = QString("%1config.xml").arg(path());
    if (QFile::exists(plistLocation)) {
        //qDebug() << "doing plist";
        return parsePlist(plistLocation);
    } else if (QFile::exists(configXml)) {
        return parseConfigXml(configXml);
    }

    return false;
}
Esempio n. 4
0
TEST_F(PlistTests, test_parse_plist_from_file) {
  // Now read the plist from a file and parse.
  boost::property_tree::ptree tree;
  auto s = parsePlist(kTestDataPath + "test.plist", tree);

  EXPECT_TRUE(s.ok());
  EXPECT_EQ(s.toString(), "OK");

  // The tree has a key with ".", the plist level delimiter.
  EXPECT_EQ(tree.size(), 8U);
  EXPECT_EQ(tree.count("com"), 0U);

  // Make sure "." iteration still works.
  EXPECT_EQ(tree.get("inetdCompatibility.Wait", ""), "0");
}
Esempio n. 5
0
TEST_F(PlistTests, test_parse_plist_content_with_blobs) {
  pt::ptree tree;
  fs::path test_root(kTestDataPath);

  auto s = parsePlist((test_root / "test_binary.plist").string(), tree);
  EXPECT_TRUE(s.ok());
  EXPECT_EQ(s.toString(), "OK");
  EXPECT_THROW(tree.get<bool>("foobar"), pt::ptree_bad_path);
  EXPECT_EQ(tree.get<std::string>("SessionItems.Controller"),
            "CustomListItems");
  auto first_element =
      tree.get_child("SessionItems.CustomListItems").begin()->second;
  EXPECT_EQ(first_element.get<std::string>("Name"), "Flux");
  std::string alias = base64Decode(first_element.get<std::string>("Alias"));

  // Verify we parsed the binary blob correctly
  EXPECT_NE(alias.find("Applications/Flux.app"), std::string::npos);
}
Esempio n. 6
0
static void PLIST_parse_file(benchmark::State& state) {
  while (state.KeepRunning()) {
    pt::ptree tree;
    auto status = parsePlist(kTestDataPath + "test.plist", tree);
  }
}