webview_test_helper.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
1a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora// Use of this source code is governed by a BSD-style license that can be
30406ce1417f76f2034833414dcecc9f56253640cVikas Arora// found in the LICENSE file.
40406ce1417f76f2034833414dcecc9f56253640cVikas Arora
50406ce1417f76f2034833414dcecc9f56253640cVikas Arora#include "ui/views/test/webview_test_helper.h"
60406ce1417f76f2034833414dcecc9f56253640cVikas Arora
70406ce1417f76f2034833414dcecc9f56253640cVikas Arora#include "base/message_loop.h"
8a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora#include "content/public/test/test_browser_thread.h"
9a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora#include "content/public/test/test_content_client_initializer.h"
10a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora#include "ui/views/controls/webview/webview.h"
11a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora
12a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Aroranamespace views {
13a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora
14a2415724fb3466168b2af5b08bd94ba732c0e753Vikas AroraWebViewTestHelper::WebViewTestHelper(base::MessageLoopForUI* ui_loop) {
15a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora  test_content_client_initializer_.reset(
16a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora      new content::TestContentClientInitializer);
17af51b94a435132e9014c324e25fb686b3d07a8c8Vikas Arora
18af51b94a435132e9014c324e25fb686b3d07a8c8Vikas Arora  // Setup to register a new RenderViewHost factory which manufactures
19af51b94a435132e9014c324e25fb686b3d07a8c8Vikas Arora  // mock render process hosts. This ensures that we never create a 'real'
20af51b94a435132e9014c324e25fb686b3d07a8c8Vikas Arora  // render view host since support for it doesn't exist in unit tests.
21a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora  test_content_client_initializer_->CreateTestRenderViewHosts();
22a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora
238b720228d581a84fd173b6dcb2fa295b59db489aVikas Arora  ui_thread_.reset(
24a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora      new content::TestBrowserThread(content::BrowserThread::UI, ui_loop));
25a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora}
26a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora
27a2415724fb3466168b2af5b08bd94ba732c0e753Vikas AroraWebViewTestHelper::~WebViewTestHelper() {
28a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora}
29a2415724fb3466168b2af5b08bd94ba732c0e753Vikas Arora
30af51b94a435132e9014c324e25fb686b3d07a8c8Vikas Arora}  // namespace views
31af51b94a435132e9014c324e25fb686b3d07a8c8Vikas Arora