Reland r161256: Fix the crash that was happening on the buildbot (but not trybots, for a strange reason) because ResourceBundle was initialized twice for tests that use the RenderViewTest harness.
The one difference is to check if ResourceBundle is initialized before initializing it. This is needed because on content_browsertests it's not initialized while in browser_tests it is. We can't make the two browser test binaries behave the same because of differences in how chrome's browser_tests and unit_tests can share the same test suite while in content that's not possible. TBR=cpu Review URL: https://codereview.chromium.org/11091058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161361 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -150,7 +150,12 @@ void RenderViewTest::SetUp() {
|
||||
// since we are using a MockRenderThread.
|
||||
RenderThreadImpl::RegisterSchemes();
|
||||
|
||||
//ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
|
||||
// This check is needed because when run under content_browsertests,
|
||||
// ResourceBundle isn't initialized (since we have to use a diferent test
|
||||
// suite implementation than for content_unittests). For browser_tests, this
|
||||
// is already initialized.
|
||||
if (!ResourceBundle::HasSharedInstance())
|
||||
ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
|
||||
|
||||
mock_process_.reset(new MockRenderProcess);
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "content/renderer/browser_plugin/mock_browser_plugin_manager.h"
|
||||
#include "content/renderer/render_thread_impl.h"
|
||||
#include "content/renderer/renderer_webkitplatformsupport_impl.h"
|
||||
#include "content/shell/shell_main_delegate.h"
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
|
||||
@ -53,7 +52,6 @@ void BrowserPluginTest::SetUp() {
|
||||
GetContentClient()->set_renderer_for_testing(&content_renderer_client_);
|
||||
content::RenderViewTest::SetUp();
|
||||
browser_plugin_manager_.reset(new MockBrowserPluginManager());
|
||||
content::ShellMainDelegate::InitializeResourceBundle();
|
||||
}
|
||||
|
||||
void BrowserPluginTest::TearDown() {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "content/renderer/render_view_impl.h"
|
||||
#include "content/shell/shell_content_browser_client.h"
|
||||
#include "content/shell/shell_content_client.h"
|
||||
#include "content/shell/shell_main_delegate.h"
|
||||
#include "content/test/mock_keyboard.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -142,11 +141,6 @@ class RenderViewImplTest : public content::RenderViewTest {
|
||||
mock_keyboard_.reset(new MockKeyboard());
|
||||
}
|
||||
|
||||
virtual void SetUp() OVERRIDE {
|
||||
content::RenderViewTest::SetUp();
|
||||
content::ShellMainDelegate::InitializeResourceBundle();
|
||||
}
|
||||
|
||||
RenderViewImpl* view() {
|
||||
return static_cast<RenderViewImpl*>(view_);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/test/render_view_test.h"
|
||||
#include "content/renderer/render_view_impl.h"
|
||||
#include "content/shell/shell_main_delegate.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
@ -45,7 +44,6 @@ NSEvent* CmdDeadKeyEvent(NSEventType type, unsigned short code) {
|
||||
// Test that cmd-up/down scrolls the page exactly if it is not intercepted by
|
||||
// javascript.
|
||||
TEST_F(RenderViewTest, MacTestCmdUp) {
|
||||
content::ShellMainDelegate::InitializeResourceBundle();
|
||||
// Some preprocessor trickery so that we can have literal html in our source,
|
||||
// makes it easier to copy html to and from an html file for testing (the
|
||||
// preprocessor will remove the newlines at the line ends, turning this into
|
||||
|
@ -7,7 +7,7 @@
|
||||
namespace content {
|
||||
|
||||
TEST_F(RenderWidgetTest, OnMsgPaintAtSize) {
|
||||
//TestResizeAndPaint();
|
||||
TestResizeAndPaint();
|
||||
}
|
||||
|
||||
} // namespace content
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "content/common/view_messages.h"
|
||||
#include "content/renderer/render_view_impl.h"
|
||||
#include "content/public/test/render_view_test.h"
|
||||
#include "content/shell/shell_main_delegate.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
||||
@ -26,7 +25,6 @@ class RendererAccessibilityTest : public content::RenderViewTest {
|
||||
virtual void SetUp() {
|
||||
content::RenderViewTest::SetUp();
|
||||
sink_ = &render_thread_->sink();
|
||||
content::ShellMainDelegate::InitializeResourceBundle();
|
||||
}
|
||||
|
||||
void SetMode(AccessibilityMode mode) {
|
||||
|
@ -4,4 +4,5 @@ include_rules = [
|
||||
"+media/base", # For ChannelLayout in WebRTC tests.
|
||||
"+ui/aura/test/test_aura_initializer.h",
|
||||
"+ui/base/resource/data_pack.h",
|
||||
"+ui/base/resource/resource_bundle.h",
|
||||
]
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "content/public/test/test_content_client_initializer.h"
|
||||
#include "content/test/test_content_client.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "ui/aura/test/test_aura_initializer.h"
|
||||
@ -60,6 +61,10 @@ void ContentTestSuite::Initialize() {
|
||||
|
||||
ContentTestSuiteBase::Initialize();
|
||||
|
||||
// Force unittests to run using en-US so if we test against string
|
||||
// output, it'll pass regardless of the system language.
|
||||
ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
|
||||
|
||||
testing::TestEventListeners& listeners =
|
||||
testing::UnitTest::GetInstance()->listeners();
|
||||
listeners.Append(new TestInitializationListener);
|
||||
|
Reference in New Issue
Block a user