Home | History | Annotate | Download | only in rendering
      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 "core/dom/Document.h"
      6 #include "core/frame/FrameView.h"
      7 #include "core/html/HTMLElement.h"
      8 #include "core/testing/DummyPageHolder.h"
      9 #include "wtf/OwnPtr.h"
     10 #include <gtest/gtest.h>
     11 
     12 namespace blink {
     13 
     14 class RenderingTest : public testing::Test {
     15 protected:
     16     virtual void SetUp()
     17     {
     18         m_pageHolder = DummyPageHolder::create(IntSize(800, 600));
     19 
     20         // This ensures that the minimal DOM tree gets attached
     21         // correctly for tests that don't call setBodyInnerHTML.
     22         document().view()->updateLayoutAndStyleIfNeededRecursive();
     23     }
     24 
     25     Document& document() const { return m_pageHolder->document(); }
     26 
     27     void setBodyInnerHTML(const char* htmlContent)
     28     {
     29         document().body()->setInnerHTML(String::fromUTF8(htmlContent), ASSERT_NO_EXCEPTION);
     30         document().view()->updateLayoutAndStyleIfNeededRecursive();
     31     }
     32 
     33 private:
     34     OwnPtr<DummyPageHolder> m_pageHolder;
     35 };
     36 
     37 } // namespace blink
     38