| Index: mojo/dart/embedder/test/validation_unittest.cc
|
| diff --git a/mojo/dart/embedder/test/validation_unittest.cc b/mojo/dart/embedder/test/validation_unittest.cc
|
| deleted file mode 100644
|
| index 2092494df2bd88347d1a004d0fa1ef5665fc53cd..0000000000000000000000000000000000000000
|
| --- a/mojo/dart/embedder/test/validation_unittest.cc
|
| +++ /dev/null
|
| @@ -1,112 +0,0 @@
|
| -// Copyright 2015 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 <set>
|
| -#include <string>
|
| -#include <vector>
|
| -
|
| -#include "base/bind.h"
|
| -#include "base/files/file_enumerator.h"
|
| -#include "base/files/file_path.h"
|
| -#include "base/files/file_util.h"
|
| -#include "base/logging.h"
|
| -#include "base/path_service.h"
|
| -#include "base/rand_util.h"
|
| -#include "base/strings/string_util.h"
|
| -#include "mojo/dart/embedder/dart_controller.h"
|
| -#include "mojo/dart/embedder/test/dart_test.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
| -
|
| -namespace mojo {
|
| -namespace dart {
|
| -namespace {
|
| -
|
| -class DartValidationTest : public DartTest {
|
| - public:
|
| -
|
| - DartValidationTest() {}
|
| -
|
| - std::string GetPath() {
|
| - base::FilePath path;
|
| - PathService::Get(base::DIR_SOURCE_ROOT, &path);
|
| - path = path.AppendASCII("mojo")
|
| - .AppendASCII("public")
|
| - .AppendASCII("interfaces")
|
| - .AppendASCII("bindings")
|
| - .AppendASCII("tests")
|
| - .AppendASCII("data")
|
| - .AppendASCII("validation");
|
| -
|
| - return path.AsUTF8Unsafe();
|
| - }
|
| -
|
| - void RunTest(const std::string& test) {
|
| - base::FilePath path;
|
| - PathService::Get(base::DIR_SOURCE_ROOT, &path);
|
| - path = path.AppendASCII("mojo")
|
| - .AppendASCII("dart")
|
| - .AppendASCII("test")
|
| - .AppendASCII("validation_test.dart");
|
| - std::vector<std::string> script_arguments =
|
| - CollectTests(base::FilePath(test));
|
| -
|
| - RunDartTest(path, script_arguments, false, false, 0);
|
| - }
|
| -
|
| - private:
|
| - // Enumerates files inside |path| and collects all data needed to run
|
| - // conformance tests.
|
| - // For each test there are three entries in the returned vector.
|
| - // [0] -> test name.
|
| - // [1] -> contents of test's .data file.
|
| - // [2] -> contents of test's .expected file.
|
| - static std::vector<std::string> CollectTests(base::FilePath path) {
|
| - base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES);
|
| - std::set<std::string> tests;
|
| - while (true) {
|
| - base::FilePath file_path = enumerator.Next();
|
| - if (file_path.empty()) {
|
| - break;
|
| - }
|
| - file_path = file_path.RemoveExtension();
|
| - tests.insert(file_path.value());
|
| - }
|
| - std::vector<std::string> result;
|
| - for (auto it = tests.begin(); it != tests.end(); it++) {
|
| - const std::string& test_name = *it;
|
| - std::string source;
|
| - bool r;
|
| - std::string filename = base::FilePath(test_name).BaseName().value();
|
| - if (!StartsWithASCII(filename, "conformance_", true)) {
|
| - // Only include conformance tests.
|
| - continue;
|
| - }
|
| - base::FilePath data_path(test_name);
|
| - data_path = data_path.AddExtension(".data");
|
| - base::FilePath expected_path(test_name);
|
| - expected_path = expected_path.AddExtension(".expected");
|
| - // Test name.
|
| - result.push_back(test_name.c_str());
|
| - // Test's .data.
|
| - r = ReadFileToString(data_path, &source);
|
| - DCHECK(r);
|
| - result.push_back(source);
|
| - source.clear();
|
| - // Test's .expected.
|
| - r = ReadFileToString(expected_path, &source);
|
| - DCHECK(r);
|
| - result.push_back(source);
|
| - source.clear();
|
| - }
|
| - return result;
|
| - }
|
| -};
|
| -
|
| -TEST_F(DartValidationTest, validation) {
|
| - RunTest(GetPath());
|
| -}
|
| -
|
| -} // namespace
|
| -} // namespace dart
|
| -} // namespace mojo
|
|
|