diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-01 00:16:34 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-01 00:16:34 +0000 |
commit | 4fb0e45f6b828529a1051750662de8ff4fb2afb5 (patch) | |
tree | 0d721651fe89a381922723cb4e60eb4c5fdec662 /chrome/browser | |
parent | 580c29748ccfad45271257fdf89b07884d4431fc (diff) | |
download | chromium_src-4fb0e45f6b828529a1051750662de8ff4fb2afb5.zip chromium_src-4fb0e45f6b828529a1051750662de8ff4fb2afb5.tar.gz chromium_src-4fb0e45f6b828529a1051750662de8ff4fb2afb5.tar.bz2 |
RenderViewHostTestHarness::DeleteContents() does SetContents(NULL); ensure that this doesn't crash (since TabContentsWrapper's constructor cannot take a NULL argument, and it doesn't make sense to have a wrapper in that case anyway).
Also ensure that TabContentsWrapperTestHarness::contents() doesn't crash when there's no wrapper.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7290027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc index 21144f9..924aa7e 100644 --- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc @@ -16,7 +16,8 @@ TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() { } TestTabContents* TabContentsWrapperTestHarness::contents() { - return static_cast<TestTabContents*>(contents_wrapper_->tab_contents()); + return contents_wrapper_.get() ? + static_cast<TestTabContents*>(contents_wrapper_->tab_contents()) : NULL; } TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { @@ -24,7 +25,7 @@ TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { } void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) { - contents_wrapper_.reset(new TabContentsWrapper(contents)); + contents_wrapper_.reset(contents ? new TabContentsWrapper(contents) : NULL); } void TabContentsWrapperTestHarness::SetUp() { |