From 9baec8ce2ddd2e7a8e5c2d19c0a72eab04059392 Mon Sep 17 00:00:00 2001 From: "jamesr@chromium.org" <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Thu, 6 Dec 2012 18:47:48 +0000 Subject: Basic pixel tests for cc BUG= Review URL: https://chromiumcodereview.appspot.com/11412289 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171544 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/test/paths.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cc/test/paths.cc (limited to 'cc/test/paths.cc') diff --git a/cc/test/paths.cc b/cc/test/paths.cc new file mode 100644 index 0000000..3551afb --- /dev/null +++ b/cc/test/paths.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2012 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 "cc/test/paths.h" + +#include "base/file_path.h" +#include "base/file_util.h" +#include "base/path_service.h" + +namespace cc { +namespace test { + +bool PathProvider(int key, FilePath* result) { + FilePath cur; + switch (key) { + // The following are only valid in the development environment, and + // will fail if executed from an installed executable (because the + // generated path won't exist). + case DIR_TEST_DATA: + if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) + return false; + cur = cur.Append(FILE_PATH_LITERAL("cc")); + cur = cur.Append(FILE_PATH_LITERAL("test")); + cur = cur.Append(FILE_PATH_LITERAL("data")); + if (!file_util::PathExists(cur)) // we don't want to create this + return false; + break; + default: + return false; + } + + *result = cur; + return true; +} + +// This cannot be done as a static initializer sadly since Visual Studio will +// eliminate this object file if there is no direct entry point into it. +void RegisterPathProvider() { + PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); +} + +} // namespace test +} // namespace cc -- cgit v1.1