This source file includes following definitions.
- SetUpTestCase
- TearDownTestCase
- document
- SetUp
- TearDown
- TEST_F
- TEST_F
- TEST_F
- TEST_F
#include "config.h"
#include "core/rendering/RenderTableCell.h"
#include "FrameTestHelpers.h"
#include "WebFrame.h"
#include "WebFrameImpl.h"
#include "WebView.h"
#include "core/dom/Document.h"
#include "core/frame/LocalFrame.h"
#include <gtest/gtest.h>
using namespace blink;
namespace WebCore {
namespace {
class RenderTableCellDeathTest : public testing::Test {
protected:
static void SetUpTestCase()
{
s_webViewHelper = new FrameTestHelpers::WebViewHelper();
s_webViewHelper->initializeAndLoad("about:blank");
s_webViewHelper->webView()->setFocus(true);
}
static void TearDownTestCase()
{
delete s_webViewHelper;
}
static Document* document()
{
return toWebFrameImpl(s_webViewHelper->webView()->mainFrame())->frame()->document();
}
virtual void SetUp()
{
m_cell = RenderTableCell::createAnonymous(document());
}
virtual void TearDown()
{
m_cell->destroy();
}
RenderTableCell* m_cell;
private:
static FrameTestHelpers::WebViewHelper* s_webViewHelper;
};
FrameTestHelpers::WebViewHelper* RenderTableCellDeathTest::s_webViewHelper = 0;
TEST_F(RenderTableCellDeathTest, CanSetColumn)
{
static const unsigned columnIndex = 10;
m_cell->setCol(columnIndex);
EXPECT_EQ(columnIndex, m_cell->col());
}
TEST_F(RenderTableCellDeathTest, CanSetColumnToMaxColumnIndex)
{
m_cell->setCol(maxColumnIndex);
EXPECT_EQ(maxColumnIndex, m_cell->col());
}
#if !OS(ANDROID)
TEST_F(RenderTableCellDeathTest, CrashIfColumnOverflowOnSetting)
{
ASSERT_DEATH(m_cell->setCol(maxColumnIndex + 1), "");
}
TEST_F(RenderTableCellDeathTest, CrashIfSettingUnsetColumnIndex)
{
ASSERT_DEATH(m_cell->setCol(unsetColumnIndex), "");
}
#endif
}
}