forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browser Plugin: fix aura crash on reloading browser plugin crash.
Remove calling RenderWidgetHostViewAura::WasShown/WasHidden, make it RWHost::WasShown/WasHidden as it used to be before. The platform_view_ doesn't physically render in a window, calling WasShown/WasHidden on them leads to crash as GetCompositor() returns NULL in RenderWidgetHostViewAura::WasShown(). BUG=174709 TEST=Tested on gtk+aura+win7+mac: with browser app, reloading page after clicking on terminate button + resizing app. Review URL: https://chromiumcodereview.appspot.com/12207046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181576 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
lazyboy@chromium.org
committed
Feb 9, 2013
1 parent
853b32f
commit d00e126
Showing
4 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
content/browser/renderer_host/render_widget_host_view_guest_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright (c) 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/browser/renderer_host/render_widget_host_view_guest.h" | ||
|
||
#include "base/basictypes.h" | ||
#include "base/message_loop.h" | ||
#include "content/browser/renderer_host/render_widget_host_delegate.h" | ||
#include "content/browser/renderer_host/render_widget_host_impl.h" | ||
#include "content/browser/renderer_host/test_render_view_host.h" | ||
#include "content/common/view_messages.h" | ||
#include "content/public/browser/render_widget_host_view.h" | ||
#include "content/public/test/mock_render_process_host.h" | ||
#include "content/public/test/test_browser_context.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace content { | ||
namespace { | ||
class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { | ||
public: | ||
MockRenderWidgetHostDelegate() {} | ||
virtual ~MockRenderWidgetHostDelegate() {} | ||
}; | ||
|
||
class RenderWidgetHostViewGuestTest : public testing::Test { | ||
public: | ||
RenderWidgetHostViewGuestTest() {} | ||
|
||
virtual void SetUp() { | ||
browser_context_.reset(new TestBrowserContext); | ||
MockRenderProcessHost* process_host = | ||
new MockRenderProcessHost(browser_context_.get()); | ||
widget_host_ = new RenderWidgetHostImpl( | ||
&delegate_, process_host, MSG_ROUTING_NONE); | ||
test_platform_view_.reset(new TestRenderWidgetHostView(widget_host_)); | ||
view_ = static_cast<RenderWidgetHostViewGuest*>( | ||
new RenderWidgetHostViewGuest( | ||
widget_host_, NULL, false, test_platform_view_.get())); | ||
} | ||
|
||
virtual void TearDown() { | ||
if (view_) | ||
view_->Destroy(); | ||
delete widget_host_; | ||
|
||
browser_context_.reset(); | ||
|
||
message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | ||
message_loop_.RunUntilIdle(); | ||
} | ||
|
||
protected: | ||
MessageLoopForUI message_loop_; | ||
scoped_ptr<BrowserContext> browser_context_; | ||
MockRenderWidgetHostDelegate delegate_; | ||
|
||
// Tests should set these to NULL if they've already triggered their | ||
// destruction. | ||
RenderWidgetHostImpl* widget_host_; | ||
RenderWidgetHostViewGuest* view_; | ||
|
||
scoped_ptr<TestRenderWidgetHostView> test_platform_view_; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestTest); | ||
}; | ||
|
||
} // namespace | ||
|
||
TEST_F(RenderWidgetHostViewGuestTest, VisibilityTest) { | ||
view_->Show(); | ||
ASSERT_TRUE(view_->IsShowing()); | ||
|
||
view_->Hide(); | ||
ASSERT_FALSE(view_->IsShowing()); | ||
|
||
view_->WasShown(); | ||
ASSERT_TRUE(view_->IsShowing()); | ||
|
||
view_->WasHidden(); | ||
ASSERT_FALSE(view_->IsShowing()); | ||
} | ||
|
||
} // namespace content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters