1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "config.h"
6#include "core/testing/NullExecutionContext.h"
7
8#include "core/dom/ExecutionContextTask.h"
9#include "core/events/Event.h"
10#include "core/frame/DOMTimer.h"
11
12namespace blink {
13
14namespace {
15
16class NullEventQueue FINAL : public EventQueue {
17public:
18    NullEventQueue() { }
19    virtual ~NullEventQueue() { }
20    virtual bool enqueueEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE { return true; }
21    virtual bool cancelEvent(Event*) OVERRIDE { return true; }
22    virtual void close() OVERRIDE { }
23};
24
25} // namespace
26
27NullExecutionContext::NullExecutionContext()
28    : m_tasksNeedSuspension(false)
29    , m_queue(adoptPtrWillBeNoop(new NullEventQueue()))
30{
31}
32
33void NullExecutionContext::postTask(PassOwnPtr<ExecutionContextTask>)
34{
35}
36
37double NullExecutionContext::timerAlignmentInterval() const
38{
39    return DOMTimer::visiblePageAlignmentInterval();
40}
41
42} // namespace blink
43