Home | History | Annotate | Download | only in base
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/test/base/chrome_render_view_test.h"
      6 
      7 #include "chrome/browser/extensions/extension_function_dispatcher.h"
      8 #include "chrome/common/extensions/extension.h"
      9 #include "chrome/common/render_messages.h"
     10 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
     11 #include "chrome/renderer/extensions/chrome_v8_extension.h"
     12 #include "chrome/renderer/extensions/dispatcher.h"
     13 #include "chrome/renderer/extensions/event_bindings.h"
     14 #include "chrome/renderer/extensions/extension_custom_bindings.h"
     15 #include "chrome/renderer/spellchecker/spellcheck.h"
     16 #include "components/autofill/content/renderer/password_autofill_agent.h"
     17 #include "content/public/browser/native_web_keyboard_event.h"
     18 #include "content/public/common/renderer_preferences.h"
     19 #include "content/public/renderer/render_view.h"
     20 #include "grit/renderer_resources.h"
     21 #include "third_party/WebKit/public/web/WebFrame.h"
     22 #include "third_party/WebKit/public/web/WebInputEvent.h"
     23 #include "third_party/WebKit/public/web/WebKit.h"
     24 #include "third_party/WebKit/public/web/WebScriptController.h"
     25 #include "third_party/WebKit/public/web/WebScriptSource.h"
     26 #include "third_party/WebKit/public/web/WebView.h"
     27 #include "third_party/WebKit/public/platform/WebURLRequest.h"
     28 #include "webkit/glue/webkit_glue.h"
     29 
     30 #if defined(OS_LINUX) && !defined(USE_AURA)
     31 #include "ui/base/gtk/event_synthesis_gtk.h"
     32 #endif
     33 
     34 using extensions::ExtensionCustomBindings;
     35 using WebKit::WebFrame;
     36 using WebKit::WebInputEvent;
     37 using WebKit::WebMouseEvent;
     38 using WebKit::WebScriptController;
     39 using WebKit::WebScriptSource;
     40 using WebKit::WebString;
     41 using WebKit::WebURLRequest;
     42 using autofill::AutofillAgent;
     43 using autofill::PasswordAutofillAgent;
     44 
     45 ChromeRenderViewTest::ChromeRenderViewTest() : extension_dispatcher_(NULL) {
     46 }
     47 
     48 ChromeRenderViewTest::~ChromeRenderViewTest() {
     49 }
     50 
     51 void ChromeRenderViewTest::SetUp() {
     52   chrome_render_thread_ = new ChromeMockRenderThread();
     53   render_thread_.reset(chrome_render_thread_);
     54 
     55   content::SetRendererClientForTesting(&chrome_content_renderer_client_);
     56   extension_dispatcher_ = new extensions::Dispatcher();
     57   chrome_content_renderer_client_.SetExtensionDispatcher(extension_dispatcher_);
     58 #if defined(ENABLE_SPELLCHECK)
     59   chrome_content_renderer_client_.SetSpellcheck(new SpellCheck());
     60 #endif
     61 
     62   content::RenderViewTest::SetUp();
     63 
     64   // RenderView doesn't expose its PasswordAutofillAgent or AutofillAgent
     65   // objects, because it has no need to store them directly (they're stored as
     66   // RenderViewObserver*).  So just create another set.
     67   password_autofill_ = new PasswordAutofillAgent(view_);
     68   autofill_agent_ = new AutofillAgent(view_, password_autofill_);
     69 }
     70 
     71 void ChromeRenderViewTest::TearDown() {
     72   extension_dispatcher_->OnRenderProcessShutdown();
     73   extension_dispatcher_ = NULL;
     74 
     75   content::RenderViewTest::TearDown();
     76 }
     77