| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 #include <gtest/gtest.h> | 37 #include <gtest/gtest.h> |
| 38 | 38 |
| 39 using namespace WebKit; | 39 using namespace WebKit; |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 class RenderTableRowDeathTest : public testing::Test { | 45 class RenderTableRowDeathTest : public testing::Test { |
| 46 // It's unfortunate that we have to get the whole browser stack to test one
RenderObject | 46 protected: |
| 47 // but the code needs it. | 47 static void SetUpTestCase() |
| 48 static Frame* frame() | |
| 49 { | 48 { |
| 50 static WebView* webView; | 49 // It's unfortunate that we have to get the whole browser stack to test
one RenderObject |
| 50 // but the code needs it. |
| 51 s_webViewHelper = new FrameTestHelpers::WebViewHelper(); |
| 52 s_webViewHelper->initializeAndLoad("about:blank"); |
| 53 s_webViewHelper->webView()->setFocus(true); |
| 54 } |
| 51 | 55 |
| 52 if (webView) | 56 static void TearDownTestCase() |
| 53 return toWebFrameImpl(webView->mainFrame())->frame(); | 57 { |
| 54 | 58 delete s_webViewHelper; |
| 55 webView = FrameTestHelpers::createWebViewAndLoad("about:blank"); | |
| 56 webView->setFocus(true); | |
| 57 return toWebFrameImpl(webView->mainFrame())->frame(); | |
| 58 } | 59 } |
| 59 | 60 |
| 60 static Document* document() | 61 static Document* document() |
| 61 { | 62 { |
| 62 return frame()->document(); | 63 return toWebFrameImpl(s_webViewHelper->webView()->mainFrame())->frame()-
>document(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 virtual void SetUp() | 66 virtual void SetUp() |
| 66 { | 67 { |
| 67 m_row = RenderTableRow::createAnonymous(document()); | 68 m_row = RenderTableRow::createAnonymous(document()); |
| 68 } | 69 } |
| 69 | 70 |
| 70 virtual void TearDown() | 71 virtual void TearDown() |
| 71 { | 72 { |
| 72 m_row->destroy(); | 73 m_row->destroy(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 protected: | |
| 76 RenderTableRow* m_row; | 76 RenderTableRow* m_row; |
| 77 |
| 78 private: |
| 79 static FrameTestHelpers::WebViewHelper* s_webViewHelper; |
| 77 }; | 80 }; |
| 78 | 81 |
| 82 FrameTestHelpers::WebViewHelper* RenderTableRowDeathTest::s_webViewHelper = 0; |
| 83 |
| 79 TEST_F(RenderTableRowDeathTest, CanSetRow) | 84 TEST_F(RenderTableRowDeathTest, CanSetRow) |
| 80 { | 85 { |
| 81 static const unsigned rowIndex = 10; | 86 static const unsigned rowIndex = 10; |
| 82 m_row->setRowIndex(rowIndex); | 87 m_row->setRowIndex(rowIndex); |
| 83 EXPECT_EQ(rowIndex, m_row->rowIndex()); | 88 EXPECT_EQ(rowIndex, m_row->rowIndex()); |
| 84 } | 89 } |
| 85 | 90 |
| 86 TEST_F(RenderTableRowDeathTest, CanSetRowToMaxRowIndex) | 91 TEST_F(RenderTableRowDeathTest, CanSetRowToMaxRowIndex) |
| 87 { | 92 { |
| 88 m_row->setRowIndex(maxRowIndex); | 93 m_row->setRowIndex(maxRowIndex); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 101 TEST_F(RenderTableRowDeathTest, CrashIfSettingUnsetRowIndex) | 106 TEST_F(RenderTableRowDeathTest, CrashIfSettingUnsetRowIndex) |
| 102 { | 107 { |
| 103 ASSERT_DEATH(m_row->setRowIndex(unsetRowIndex), ""); | 108 ASSERT_DEATH(m_row->setRowIndex(unsetRowIndex), ""); |
| 104 } | 109 } |
| 105 | 110 |
| 106 #endif | 111 #endif |
| 107 | 112 |
| 108 } | 113 } |
| 109 | 114 |
| 110 } // namespace WebCore | 115 } // namespace WebCore |
| OLD | NEW |