This source file includes following definitions.
- PathProvider
- RegisterPathProvider
#include "cc/test/paths.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
namespace cc {
bool PathProvider(int key, base::FilePath* result) {
base::FilePath cur;
switch (key) {
case CCPaths::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 (!base::PathExists(cur))
return false;
break;
default:
return false;
}
*result = cur;
return true;
}
void CCPaths::RegisterPathProvider() {
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
}