| Index: ui/views/test/scoped_views_test_helper.h
|
| diff --git a/ui/views/test/scoped_views_test_helper.h b/ui/views/test/scoped_views_test_helper.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f2693ab7c149aee7709355da4d7966ea8b516ee2
|
| --- /dev/null
|
| +++ b/ui/views/test/scoped_views_test_helper.h
|
| @@ -0,0 +1,48 @@
|
| +// 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.
|
| +
|
| +#ifndef UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_
|
| +#define UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "ui/gfx/native_widget_types.h"
|
| +
|
| +namespace views {
|
| +
|
| +class TestViewsDelegate;
|
| +class ViewsTestHelper;
|
| +
|
| +// Creates a ViewsTestHelper that is released automatically. Acts like
|
| +// ViewsTestBase but allows a test harness to use a different base class, or
|
| +// make use of a TestBrowserThreadBundle, rather than the MessageLoop provided
|
| +// by ViewsTestBase.
|
| +class ScopedViewsTestHelper {
|
| + public:
|
| + // Initialize with the default TestViewsDelegate, MessageLoopForUI::current()
|
| + // and the default test ContextFactory.
|
| + ScopedViewsTestHelper();
|
| +
|
| + // Initialize with the given TestViewsDelegate instance, after setting the
|
| + // ContextFactory.
|
| + explicit ScopedViewsTestHelper(scoped_ptr<TestViewsDelegate> views_delegate);
|
| +
|
| + ~ScopedViewsTestHelper();
|
| +
|
| + // Returns the context for creating new windows. In Aura builds, this will be
|
| + // the RootWindow. Everywhere else, null.
|
| + gfx::NativeWindow GetContext();
|
| +
|
| + TestViewsDelegate* views_delegate() { return views_delegate_.get(); };
|
| +
|
| + private:
|
| + scoped_ptr<TestViewsDelegate> views_delegate_;
|
| + scoped_ptr<ViewsTestHelper> test_helper_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedViewsTestHelper);
|
| +};
|
| +
|
| +} // namespace views
|
| +
|
| +#endif // UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_
|
|
|