| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "content/test/test_render_frame.h" | 52 #include "content/test/test_render_frame.h" |
| 53 #include "net/base/net_errors.h" | 53 #include "net/base/net_errors.h" |
| 54 #include "net/cert/cert_status_flags.h" | 54 #include "net/cert/cert_status_flags.h" |
| 55 #include "testing/gtest/include/gtest/gtest.h" | 55 #include "testing/gtest/include/gtest/gtest.h" |
| 56 #include "third_party/WebKit/public/platform/WebData.h" | 56 #include "third_party/WebKit/public/platform/WebData.h" |
| 57 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 57 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
| 58 #include "third_party/WebKit/public/platform/WebString.h" | 58 #include "third_party/WebKit/public/platform/WebString.h" |
| 59 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 59 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 60 #include "third_party/WebKit/public/web/WebDataSource.h" | 60 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 61 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" | 61 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
| 62 #include "third_party/WebKit/public/web/WebHeap.h" | |
| 63 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 62 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| 64 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 63 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 65 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 64 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 66 #include "third_party/WebKit/public/web/WebPerformance.h" | 65 #include "third_party/WebKit/public/web/WebPerformance.h" |
| 67 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 66 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 68 #include "third_party/WebKit/public/web/WebSettings.h" | 67 #include "third_party/WebKit/public/web/WebSettings.h" |
| 69 #include "third_party/WebKit/public/web/WebView.h" | 68 #include "third_party/WebKit/public/web/WebView.h" |
| 70 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 69 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
| 71 #include "ui/events/event.h" | 70 #include "ui/events/event.h" |
| 72 #include "ui/events/keycodes/keyboard_codes.h" | 71 #include "ui/events/keycodes/keyboard_codes.h" |
| 73 #include "ui/gfx/codec/jpeg_codec.h" | 72 #include "ui/gfx/codec/jpeg_codec.h" |
| 74 #include "ui/gfx/range/range.h" | 73 #include "ui/gfx/range/range.h" |
| 75 | 74 |
| 76 #if defined(USE_AURA) && defined(USE_X11) | 75 #if defined(USE_AURA) && defined(USE_X11) |
| 77 #include <X11/Xlib.h> | 76 #include <X11/Xlib.h> |
| 78 #include "ui/events/event_constants.h" | 77 #include "ui/events/event_constants.h" |
| 79 #include "ui/events/keycodes/keyboard_code_conversion.h" | 78 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 80 #include "ui/events/test/events_test_utils.h" | 79 #include "ui/events/test/events_test_utils.h" |
| 81 #include "ui/events/test/events_test_utils_x11.h" | 80 #include "ui/events/test/events_test_utils_x11.h" |
| 82 #endif | 81 #endif |
| 83 | 82 |
| 84 #if defined(USE_OZONE) | 83 #if defined(USE_OZONE) |
| 85 #include "ui/events/keycodes/keyboard_code_conversion.h" | 84 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 86 #endif | 85 #endif |
| 87 | 86 |
| 88 #include "url/url_constants.h" | 87 #include "url/url_constants.h" |
| 89 | 88 |
| 90 using blink::WebFrame; | 89 using blink::WebFrame; |
| 91 using blink::WebHeap; | |
| 92 using blink::WebInputEvent; | 90 using blink::WebInputEvent; |
| 93 using blink::WebLocalFrame; | 91 using blink::WebLocalFrame; |
| 94 using blink::WebMouseEvent; | 92 using blink::WebMouseEvent; |
| 95 using blink::WebRuntimeFeatures; | 93 using blink::WebRuntimeFeatures; |
| 96 using blink::WebString; | 94 using blink::WebString; |
| 97 using blink::WebTextDirection; | 95 using blink::WebTextDirection; |
| 98 using blink::WebURLError; | 96 using blink::WebURLError; |
| 99 | 97 |
| 100 namespace content { | 98 namespace content { |
| 101 | 99 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 ~RenderViewImplTest() override {} | 164 ~RenderViewImplTest() override {} |
| 167 | 165 |
| 168 void SetUp() override { | 166 void SetUp() override { |
| 169 // Enable Blink's experimental and test only features so that test code | 167 // Enable Blink's experimental and test only features so that test code |
| 170 // does not have to bother enabling each feature. | 168 // does not have to bother enabling each feature. |
| 171 WebRuntimeFeatures::enableExperimentalFeatures(true); | 169 WebRuntimeFeatures::enableExperimentalFeatures(true); |
| 172 WebRuntimeFeatures::enableTestOnlyFeatures(true); | 170 WebRuntimeFeatures::enableTestOnlyFeatures(true); |
| 173 RenderViewTest::SetUp(); | 171 RenderViewTest::SetUp(); |
| 174 } | 172 } |
| 175 | 173 |
| 176 // To avoid flaky leak reports, insist on GCing | |
| 177 // Blink upon shutdown to clear out garbage. | |
| 178 void TearDown() override { | |
| 179 WebHeap::collectGarbageForTesting(); | |
| 180 RenderViewTest::TearDown(); | |
| 181 } | |
| 182 | |
| 183 RenderViewImpl* view() { | 174 RenderViewImpl* view() { |
| 184 return static_cast<RenderViewImpl*>(view_); | 175 return static_cast<RenderViewImpl*>(view_); |
| 185 } | 176 } |
| 186 | 177 |
| 187 int view_page_id() { | 178 int view_page_id() { |
| 188 return view()->page_id_; | 179 return view()->page_id_; |
| 189 } | 180 } |
| 190 | 181 |
| 191 TestRenderFrame* frame() { | 182 TestRenderFrame* frame() { |
| 192 return static_cast<TestRenderFrame*>(view()->GetMainRenderFrame()); | 183 return static_cast<TestRenderFrame*>(view()->GetMainRenderFrame()); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 ExecuteJavaScriptForTests( | 494 ExecuteJavaScriptForTests( |
| 504 "document.getElementById('elt_text').value = 'foo';"); | 495 "document.getElementById('elt_text').value = 'foo';"); |
| 505 ProcessPendingMessages(); | 496 ProcessPendingMessages(); |
| 506 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 497 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 507 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 498 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
| 508 FrameHostMsg_UpdateState::ID)); | 499 FrameHostMsg_UpdateState::ID)); |
| 509 } else { | 500 } else { |
| 510 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 501 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
| 511 ViewHostMsg_UpdateState::ID)); | 502 ViewHostMsg_UpdateState::ID)); |
| 512 } | 503 } |
| 504 ProcessPendingMessages(); |
| 513 } | 505 } |
| 514 | 506 |
| 515 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { | 507 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { |
| 516 // An http url will trigger a resource load so cannot be used here. | 508 // An http url will trigger a resource load so cannot be used here. |
| 517 CommonNavigationParams common_params; | 509 CommonNavigationParams common_params; |
| 518 StartNavigationParams start_params; | 510 StartNavigationParams start_params; |
| 519 RequestNavigationParams request_params; | 511 RequestNavigationParams request_params; |
| 520 common_params.url = GURL("data:text/html,<div>Page</div>"); | 512 common_params.url = GURL("data:text/html,<div>Page</div>"); |
| 521 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 513 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 522 common_params.transition = ui::PAGE_TRANSITION_TYPED; | 514 common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| (...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 FROM_HERE, | 2734 FROM_HERE, |
| 2743 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2735 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2744 ExecuteJavaScriptForTests("debugger;"); | 2736 ExecuteJavaScriptForTests("debugger;"); |
| 2745 | 2737 |
| 2746 // CloseWhilePaused should resume execution and continue here. | 2738 // CloseWhilePaused should resume execution and continue here. |
| 2747 EXPECT_FALSE(IsPaused()); | 2739 EXPECT_FALSE(IsPaused()); |
| 2748 Detach(); | 2740 Detach(); |
| 2749 } | 2741 } |
| 2750 | 2742 |
| 2751 } // namespace content | 2743 } // namespace content |
| OLD | NEW |