| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/test/render_view_test.h" | 5 #include "chrome/test/render_view_test.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 8 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 9 #include "chrome/renderer/extensions/event_bindings.h" | 9 #include "chrome/renderer/extensions/event_bindings.h" |
| 10 #include "chrome/renderer/extensions/extension_process_bindings.h" | 10 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 void RenderViewTest::SetUp() { | 54 void RenderViewTest::SetUp() { |
| 55 WebKit::initialize(&webkitclient_); | 55 WebKit::initialize(&webkitclient_); |
| 56 WebKit::registerExtension(BaseJsV8Extension::Get()); | 56 WebKit::registerExtension(BaseJsV8Extension::Get()); |
| 57 WebKit::registerExtension(JsonJsV8Extension::Get()); | 57 WebKit::registerExtension(JsonJsV8Extension::Get()); |
| 58 WebKit::registerExtension(JsonSchemaJsV8Extension::Get()); | 58 WebKit::registerExtension(JsonSchemaJsV8Extension::Get()); |
| 59 WebKit::registerExtension(EventBindings::Get()); | 59 WebKit::registerExtension(EventBindings::Get()); |
| 60 WebKit::registerExtension(ExtensionProcessBindings::Get()); | 60 WebKit::registerExtension(ExtensionProcessBindings::Get()); |
| 61 WebKit::registerExtension(RendererExtensionBindings::Get(&render_thread_)); | 61 WebKit::registerExtension(RendererExtensionBindings::Get(&render_thread_)); |
| 62 EventBindings::SetRenderThread(&render_thread_); |
| 62 | 63 |
| 63 // TODO(aa): Should some of this go to some other inheriting class? | 64 // TODO(aa): Should some of this go to some other inheriting class? |
| 64 std::vector<std::string> names; | 65 std::vector<std::string> names; |
| 65 ExtensionFunctionDispatcher::GetAllFunctionNames(&names); | 66 ExtensionFunctionDispatcher::GetAllFunctionNames(&names); |
| 66 ExtensionProcessBindings::SetFunctionNames(names); | 67 ExtensionProcessBindings::SetFunctionNames(names); |
| 67 | 68 |
| 68 mock_process_.reset(new MockProcess()); | 69 mock_process_.reset(new MockProcess()); |
| 69 | 70 |
| 70 render_thread_.set_routing_id(kRouteId); | 71 render_thread_.set_routing_id(kRouteId); |
| 71 | 72 |
| 72 // This needs to pass the mock render thread to the view. | 73 // This needs to pass the mock render thread to the view. |
| 73 view_ = RenderView::Create(&render_thread_, NULL, NULL, kOpenerId, | 74 view_ = RenderView::Create(&render_thread_, NULL, NULL, kOpenerId, |
| 74 WebPreferences(), | 75 WebPreferences(), |
| 75 new SharedRenderViewCounter(0), kRouteId); | 76 new SharedRenderViewCounter(0), kRouteId); |
| 76 } | 77 } |
| 77 void RenderViewTest::TearDown() { | 78 void RenderViewTest::TearDown() { |
| 78 render_thread_.SendCloseMessage(); | 79 render_thread_.SendCloseMessage(); |
| 79 | 80 |
| 80 // Run the loop so the release task from the renderwidget executes. | 81 // Run the loop so the release task from the renderwidget executes. |
| 81 ProcessPendingMessages(); | 82 ProcessPendingMessages(); |
| 82 | 83 |
| 84 EventBindings::SetRenderThread(NULL); |
| 85 |
| 83 view_ = NULL; | 86 view_ = NULL; |
| 84 | 87 |
| 85 mock_process_.reset(); | 88 mock_process_.reset(); |
| 86 WebKit::shutdown(); | 89 WebKit::shutdown(); |
| 87 | 90 |
| 88 msg_loop_.RunAllPending(); | 91 msg_loop_.RunAllPending(); |
| 89 } | 92 } |
| OLD | NEW |