Skip to content

Instantly share code, notes, and snippets.

@KushalP
Created June 24, 2011 12:11
Show Gist options
  • Select an option

  • Save KushalP/1044655 to your computer and use it in GitHub Desktop.

Select an option

Save KushalP/1044655 to your computer and use it in GitHub Desktop.
File would be placed in src/chrome/browser/mac/ and is testing the file_metadata::_ functionality
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/file_path.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
#include "chrome/browser/mac/file_metadata.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(FileMetaDataTest, WritesMetaDataToTempFile) {
// Prepare a temp folder that will be automatically deleted along with
// our temporary test data.
ScopedTempDir temp_dir;
EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
// Create our metadata to be used
FilePath dest_path(temp_dir.path().Append(FILE_PATH_LITERAL("meta.jpg")));
GURL sourceURL("http://www.chromium.org/meta.jpg");
GURL referrerURL("http://www.chromium.org/");
// write the metadata to our temporary file
file_metadata::AddOriginMetadataToFile(dest_path, sourceURL, referrerURL);
// TODO:
// Read the metadata from the file
// Assert that sourceURL and referrerURL have both been set correctly
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment