Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: chrome/test/browser_with_test_window_test.cc

Issue 279004: Made sync code build and pass unit tests on OS X. (Closed)
Patch Set: Fixed uninitialized var error. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/test/browser_with_test_window_test.h" 5 #include "chrome/test/browser_with_test_window_test.h"
6 6
7 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
8 #include "chrome/browser/tab_contents/navigation_entry.h" 8 #include "chrome/browser/tab_contents/navigation_entry.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/test/testing_profile.h" 10 #include "chrome/test/testing_profile.h"
11 11
12 BrowserWithTestWindowTest::BrowserWithTestWindowTest() 12 BrowserWithTestWindowTest::BrowserWithTestWindowTest()
13 : rph_factory_(), 13 : rph_factory_(),
14 rvh_factory_(&rph_factory_) { 14 rvh_factory_(&rph_factory_) {
15 #if defined(OS_WIN)
15 OleInitialize(NULL); 16 OleInitialize(NULL);
17 #endif
16 } 18 }
17 19
18 void BrowserWithTestWindowTest::SetUp() { 20 void BrowserWithTestWindowTest::SetUp() {
19 // NOTE: I have a feeling we're going to want virtual methods for creating 21 // NOTE: I have a feeling we're going to want virtual methods for creating
20 // these, as such they're in SetUp instead of the constructor. 22 // these, as such they're in SetUp instead of the constructor.
21 profile_.reset(new TestingProfile()); 23 profile_.reset(new TestingProfile());
22 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile())); 24 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile()));
23 window_.reset(new TestBrowserWindow(browser())); 25 window_.reset(new TestBrowserWindow(browser()));
24 browser_->set_window(window_.get()); 26 browser_->set_window(window_.get());
25 } 27 }
26 28
27 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { 29 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() {
28 // Make sure we close all tabs, otherwise Browser isn't happy in its 30 // Make sure we close all tabs, otherwise Browser isn't happy in its
29 // destructor. 31 // destructor.
30 browser()->CloseAllTabs(); 32 browser()->CloseAllTabs();
31 33
32 // A Task is leaked if we don't destroy everything, then run the message 34 // A Task is leaked if we don't destroy everything, then run the message
33 // loop. 35 // loop.
34 browser_.reset(NULL); 36 browser_.reset(NULL);
35 window_.reset(NULL); 37 window_.reset(NULL);
36 profile_.reset(NULL); 38 profile_.reset(NULL);
37 39
38 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); 40 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask);
39 MessageLoop::current()->Run(); 41 MessageLoop::current()->Run();
40 42
43 #if defined(OS_WIN)
41 OleUninitialize(); 44 OleUninitialize();
45 #endif
42 } 46 }
43 47
44 TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab( 48 TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab(
45 TabContents* tab_contents) { 49 TabContents* tab_contents) {
46 return static_cast<TestRenderViewHost*>( 50 return static_cast<TestRenderViewHost*>(
47 tab_contents->render_view_host()); 51 tab_contents->render_view_host());
48 } 52 }
49 53
50 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { 54 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
51 TabContents* new_tab = browser->AddTabWithURL(url, GURL(), 55 TabContents* new_tab = browser->AddTabWithURL(url, GURL(),
(...skipping 28 matching lines...) Expand all
80 void BrowserWithTestWindowTest::NavigateAndCommit( 84 void BrowserWithTestWindowTest::NavigateAndCommit(
81 NavigationController* controller, 85 NavigationController* controller,
82 const GURL& url) { 86 const GURL& url) {
83 controller->LoadURL(url, GURL(), 0); 87 controller->LoadURL(url, GURL(), 0);
84 CommitPendingLoad(controller); 88 CommitPendingLoad(controller);
85 } 89 }
86 90
87 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { 91 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) {
88 NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url); 92 NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url);
89 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698