Rename sky::TestObserver to sky::TestHarness
This CL prepares us to add event dispatching to this interface, which is more than just observation. R=esprehn@chromium.org, ojan@chromium.org Review URL: https://codereview.chromium.org/715123002
This commit is contained in:
parent
fab3c90631
commit
865b81939b
@ -6,8 +6,8 @@ shared_library("tester") {
|
||||
output_name = "sky_tester"
|
||||
|
||||
sources = [
|
||||
"test_observer_impl.cc",
|
||||
"test_observer_impl.h",
|
||||
"test_harness_impl.cc",
|
||||
"test_harness_impl.h",
|
||||
"test_runner.cc",
|
||||
"test_runner.h",
|
||||
"tester.cc",
|
||||
|
5
engine/src/flutter/tools/tester/DEPS
Normal file
5
engine/src/flutter/tools/tester/DEPS
Normal file
@ -0,0 +1,5 @@
|
||||
include_rules = [
|
||||
"+mojo/public",
|
||||
"+mojo/application",
|
||||
"+mojo/services",
|
||||
]
|
@ -2,14 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "sky/tools/tester/test_observer_impl.h"
|
||||
#include "sky/tools/tester/test_harness_impl.h"
|
||||
|
||||
#include "sky/tools/tester/test_runner.h"
|
||||
|
||||
namespace sky {
|
||||
namespace tester {
|
||||
|
||||
TestObserverImpl::TestObserverImpl(TestRunner* test_runner)
|
||||
TestHarnessImpl::TestHarnessImpl(TestRunner* test_runner)
|
||||
: test_runner_(test_runner->GetWeakPtr()) {
|
||||
// FIXME: This is technically when the V8 context gets created and
|
||||
// not when the test is started. An error before we instantiated
|
||||
@ -17,10 +17,10 @@ TestObserverImpl::TestObserverImpl(TestRunner* test_runner)
|
||||
test_runner->OnTestStart();
|
||||
}
|
||||
|
||||
TestObserverImpl::~TestObserverImpl() {
|
||||
TestHarnessImpl::~TestHarnessImpl() {
|
||||
}
|
||||
|
||||
void TestObserverImpl::OnTestComplete(const mojo::String& test_result) {
|
||||
void TestHarnessImpl::OnTestComplete(const mojo::String& test_result) {
|
||||
if (test_runner_)
|
||||
test_runner_->OnTestComplete(test_result);
|
||||
}
|
37
engine/src/flutter/tools/tester/test_harness_impl.h
Normal file
37
engine/src/flutter/tools/tester/test_harness_impl.h
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#ifndef SKY_TOOLS_TESTER_TEST_HARNESS_IMPL_H_
|
||||
#define SKY_TOOLS_TESTER_TEST_HARNESS_IMPL_H_
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "mojo/public/cpp/application/interface_factory_impl.h"
|
||||
#include "mojo/public/cpp/system/core.h"
|
||||
#include "sky/viewer/services/test_harness.mojom.h"
|
||||
|
||||
namespace sky {
|
||||
namespace tester {
|
||||
class TestRunner;
|
||||
|
||||
class TestHarnessImpl : public mojo::InterfaceImpl<TestHarness> {
|
||||
public:
|
||||
explicit TestHarnessImpl(TestRunner*);
|
||||
virtual ~TestHarnessImpl();
|
||||
|
||||
private:
|
||||
// TestHarness implementation.
|
||||
void OnTestComplete(const mojo::String& test_result) override;
|
||||
|
||||
base::WeakPtr<TestRunner> test_runner_;
|
||||
|
||||
MOJO_DISALLOW_COPY_AND_ASSIGN(TestHarnessImpl);
|
||||
};
|
||||
|
||||
typedef mojo::InterfaceFactoryImplWithContext<
|
||||
TestHarnessImpl, TestRunner> TestHarnessFactory;
|
||||
|
||||
} // namespace tester
|
||||
} // namespace sky
|
||||
|
||||
#endif // SKY_TOOLS_TESTER_TEST_HARNESS_IMPL_H_
|
@ -1,37 +0,0 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#ifndef SKY_TOOLS_TESTER_TEST_OBSERVER_IMPL_H_
|
||||
#define SKY_TOOLS_TESTER_TEST_OBSERVER_IMPL_H_
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "mojo/public/cpp/application/interface_factory_impl.h"
|
||||
#include "mojo/public/cpp/system/core.h"
|
||||
#include "sky/viewer/test_observer.mojom.h"
|
||||
|
||||
namespace sky {
|
||||
namespace tester {
|
||||
class TestRunner;
|
||||
|
||||
class TestObserverImpl : public mojo::InterfaceImpl<TestObserver> {
|
||||
public:
|
||||
explicit TestObserverImpl(TestRunner*);
|
||||
virtual ~TestObserverImpl();
|
||||
|
||||
private:
|
||||
// TestObserver implementation.
|
||||
virtual void OnTestComplete(const mojo::String& test_result) override;
|
||||
|
||||
base::WeakPtr<TestRunner> test_runner_;
|
||||
|
||||
MOJO_DISALLOW_COPY_AND_ASSIGN(TestObserverImpl);
|
||||
};
|
||||
|
||||
typedef mojo::InterfaceFactoryImplWithContext<
|
||||
TestObserverImpl, TestRunner> TestObserverFactory;
|
||||
|
||||
} // namespace tester
|
||||
} // namespace sky
|
||||
|
||||
#endif // SKY_TOOLS_TESTER_TEST_OBSERVER_IMPL_H_
|
@ -15,14 +15,14 @@ namespace tester {
|
||||
|
||||
TestRunner::TestRunner(TestRunnerClient* client, mojo::View* container,
|
||||
const std::string& url)
|
||||
: test_observer_factory_(this),
|
||||
: test_harness_factory_(this),
|
||||
client_(client),
|
||||
weak_ptr_factory_(this) {
|
||||
CHECK(client);
|
||||
|
||||
scoped_ptr<mojo::ServiceProviderImpl> exported_services(
|
||||
new mojo::ServiceProviderImpl());
|
||||
exported_services->AddService(&test_observer_factory_);
|
||||
exported_services->AddService(&test_harness_factory_);
|
||||
|
||||
container->Embed(url, exported_services.Pass());
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define SKY_TOOLS_TESTER_TEST_RUNNER_H_
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "sky/tools/tester/test_observer_impl.h"
|
||||
#include "sky/tools/tester/test_harness_impl.h"
|
||||
|
||||
namespace mojo{
|
||||
class View;
|
||||
@ -31,7 +31,7 @@ class TestRunner {
|
||||
void OnTestComplete(const std::string& test_result);
|
||||
|
||||
private:
|
||||
TestObserverFactory test_observer_factory_;
|
||||
TestHarnessFactory test_harness_factory_;
|
||||
TestRunnerClient* client_;
|
||||
base::WeakPtrFactory<TestRunner> weak_ptr_factory_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user