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

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

Issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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/test/base/browser_with_test_window_test.h" 5 #include "chrome/test/base/browser_with_test_window_test.h"
6 6
7 #include "base/synchronization/waitable_event.h"
7 #include "chrome/browser/tabs/tab_strip_model.h" 8 #include "chrome/browser/tabs/tab_strip_model.h"
8 #include "chrome/browser/ui/browser_navigator.h" 9 #include "chrome/browser/ui/browser_navigator.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
10 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
11 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
12 #include "content/public/browser/navigation_controller.h" 13 #include "content/public/browser/navigation_controller.h"
13 #include "content/public/browser/navigation_entry.h" 14 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/page_transition_types.h" 16 #include "content/public/common/page_transition_types.h"
16 #include "content/test/test_renderer_host.h" 17 #include "content/test/test_renderer_host.h"
(...skipping 12 matching lines...) Expand all
29 #endif 30 #endif
30 31
31 using content::BrowserThread; 32 using content::BrowserThread;
32 using content::NavigationController; 33 using content::NavigationController;
33 using content::RenderViewHost; 34 using content::RenderViewHost;
34 using content::RenderViewHostTester; 35 using content::RenderViewHostTester;
35 using content::WebContents; 36 using content::WebContents;
36 37
37 BrowserWithTestWindowTest::BrowserWithTestWindowTest() 38 BrowserWithTestWindowTest::BrowserWithTestWindowTest()
38 : ui_thread_(BrowserThread::UI, message_loop()), 39 : ui_thread_(BrowserThread::UI, message_loop()),
40 db_thread_(BrowserThread::DB),
39 file_thread_(BrowserThread::FILE, message_loop()), 41 file_thread_(BrowserThread::FILE, message_loop()),
40 file_user_blocking_thread_( 42 file_user_blocking_thread_(
41 BrowserThread::FILE_USER_BLOCKING, message_loop()) { 43 BrowserThread::FILE_USER_BLOCKING, message_loop()) {
44 db_thread_.Start();
42 } 45 }
43 46
44 void BrowserWithTestWindowTest::SetUp() { 47 void BrowserWithTestWindowTest::SetUp() {
45 testing::Test::SetUp(); 48 testing::Test::SetUp();
46 49
47 profile_.reset(CreateProfile()); 50 profile_.reset(CreateProfile());
48 browser_.reset(new Browser(Browser::TYPE_TABBED, profile())); 51 browser_.reset(new Browser(Browser::TYPE_TABBED, profile()));
49 window_.reset(new TestBrowserWindow(browser())); 52 window_.reset(new TestBrowserWindow(browser()));
50 browser_->SetWindowForTesting(window_.get()); 53 browser_->SetWindowForTesting(window_.get());
51 #if defined(USE_AURA) 54 #if defined(USE_AURA)
(...skipping 17 matching lines...) Expand all
69 root_window_.reset(); 72 root_window_.reset();
70 #endif 73 #endif
71 } 74 }
72 75
73 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { 76 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() {
74 // A Task is leaked if we don't destroy everything, then run the message 77 // A Task is leaked if we don't destroy everything, then run the message
75 // loop. 78 // loop.
76 DestroyBrowser(); 79 DestroyBrowser();
77 profile_.reset(NULL); 80 profile_.reset(NULL);
78 81
82 // Schedule another task on the DB thread to notify us that it's safe to
83 // carry on with the test.
84 base::WaitableEvent done(false, false);
85 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
86 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
87 done.Wait();
88 db_thread_.Stop();
79 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 89 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
80 MessageLoop::current()->Run(); 90 MessageLoop::current()->Run();
81 } 91 }
82 92
83 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { 93 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
84 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED); 94 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED);
85 params.tabstrip_index = 0; 95 params.tabstrip_index = 0;
86 params.disposition = NEW_FOREGROUND_TAB; 96 params.disposition = NEW_FOREGROUND_TAB;
87 browser::Navigate(&params); 97 browser::Navigate(&params);
88 CommitPendingLoad(&params.target_contents->web_contents()->GetController()); 98 CommitPendingLoad(&params.target_contents->web_contents()->GetController());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Make sure we close all tabs, otherwise Browser isn't happy in its 158 // Make sure we close all tabs, otherwise Browser isn't happy in its
149 // destructor. 159 // destructor.
150 browser()->CloseAllTabs(); 160 browser()->CloseAllTabs();
151 browser_.reset(NULL); 161 browser_.reset(NULL);
152 window_.reset(NULL); 162 window_.reset(NULL);
153 } 163 }
154 164
155 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { 165 TestingProfile* BrowserWithTestWindowTest::CreateProfile() {
156 return new TestingProfile(); 166 return new TestingProfile();
157 } 167 }
OLDNEW
« no previous file with comments | « chrome/test/base/browser_with_test_window_test.h ('k') | chrome/test/base/chrome_render_view_host_test_harness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698