OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
6 | 6 |
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
9 #include "content/browser/tab_contents/test_tab_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 |
| 11 using content::WebContents; |
10 | 12 |
11 TabContentsWrapperTestHarness::TabContentsWrapperTestHarness() | 13 TabContentsWrapperTestHarness::TabContentsWrapperTestHarness() |
12 : ChromeRenderViewHostTestHarness() { | 14 : ChromeRenderViewHostTestHarness() { |
13 } | 15 } |
14 | 16 |
15 TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() { | 17 TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() { |
16 } | 18 } |
17 | 19 |
18 TestTabContents* TabContentsWrapperTestHarness::contents() { | 20 WebContents* TabContentsWrapperTestHarness::web_contents() { |
19 return contents_wrapper_.get() ? | 21 return contents_wrapper_.get() ? contents_wrapper_->web_contents() : NULL; |
20 static_cast<TestTabContents*>(contents_wrapper_->web_contents()) : NULL; | |
21 } | 22 } |
22 | 23 |
23 TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { | 24 TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { |
24 return contents_wrapper_.get(); | 25 return contents_wrapper_.get(); |
25 } | 26 } |
26 | 27 |
27 void TabContentsWrapperTestHarness::SetContents(TestTabContents* contents) { | 28 void TabContentsWrapperTestHarness::SetContents(WebContents* contents) { |
28 contents_wrapper_.reset(contents ? new TabContentsWrapper(contents) : NULL); | 29 contents_wrapper_.reset(contents ? new TabContentsWrapper(contents) : NULL); |
29 } | 30 } |
30 | 31 |
31 void TabContentsWrapperTestHarness::SetUp() { | 32 void TabContentsWrapperTestHarness::SetUp() { |
32 ChromeRenderViewHostTestHarness::SetUp(); | 33 ChromeRenderViewHostTestHarness::SetUp(); |
33 SetContents(CreateTestTabContents()); | 34 SetContents(CreateTestWebContents()); |
34 } | 35 } |
35 | 36 |
36 void TabContentsWrapperTestHarness::TearDown() { | 37 void TabContentsWrapperTestHarness::TearDown() { |
37 contents_wrapper_.reset(); | 38 contents_wrapper_.reset(); |
38 | 39 |
39 // Make sure that we flush any messages related to TabContents destruction | 40 // Make sure that we flush any messages related to TabContents destruction |
40 // before we destroy the browser context. | 41 // before we destroy the browser context. |
41 MessageLoop::current()->RunAllPending(); | 42 MessageLoop::current()->RunAllPending(); |
42 | 43 |
43 // Release the browser context on the UI thread. | 44 // Release the browser context on the UI thread. |
44 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 45 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
45 message_loop_.RunAllPending(); | 46 message_loop_.RunAllPending(); |
46 | 47 |
47 ChromeRenderViewHostTestHarness::TearDown(); | 48 ChromeRenderViewHostTestHarness::TearDown(); |
48 } | 49 } |
OLD | NEW |