This source file includes following definitions.
- RunTest
- TEST
- TEST
#include "base/file_util.h"
#include "base/path_service.h"
#include "gin/modules/console.h"
#include "gin/modules/module_registry.h"
#include "gin/modules/timer.h"
#include "gin/test/file_runner.h"
#include "gin/test/gtest.h"
#include "mojo/bindings/js/core.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace js {
namespace {
class TestRunnerDelegate : public gin::FileRunnerDelegate {
public:
TestRunnerDelegate() {
AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
AddBuiltinModule(Core::kModuleName, Core::GetModule);
}
private:
DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
};
void RunTest(std::string test, bool run_until_idle) {
base::FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path);
path = path.AppendASCII("mojo")
.AppendASCII("bindings")
.AppendASCII("js")
.AppendASCII(test);
TestRunnerDelegate delegate;
gin::RunTestFromFile(path, &delegate, run_until_idle);
}
TEST(JSTest, core) {
RunTest("core_unittests.js", true);
}
#if defined(OS_POSIX)
#define MAYBE_codec DISABLED_codec
#else
#define MAYBE_codec codec
#endif
TEST(JSTest, MAYBE_codec) {
RunTest("codec_unittests.js", true);
}
}
}
}