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

Side by Side Diff: content/browser/debugger/devtools_manager_unittest.cc

Issue 7744039: Switch ChromeTestSuite to the same convention as ContentTestSuite: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixing Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/test/base/testing_browser_process.h"
7 #include "content/browser/debugger/devtools_client_host.h" 9 #include "content/browser/debugger/devtools_client_host.h"
8 #include "content/browser/debugger/devtools_manager.h" 10 #include "content/browser/debugger/devtools_manager.h"
9 #include "content/browser/renderer_host/test_render_view_host.h" 11 #include "content/browser/renderer_host/test_render_view_host.h"
10 #include "content/browser/tab_contents/tab_contents_delegate.h" 12 #include "content/browser/tab_contents/tab_contents_delegate.h"
11 #include "content/browser/tab_contents/test_tab_contents.h" 13 #include "content/browser/tab_contents/test_tab_contents.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 using base::TimeDelta; 16 using base::TimeDelta;
15 17
16 namespace { 18 namespace {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 EXPECT_EQ(1, TestDevToolsClientHost::close_counter); 137 EXPECT_EQ(1, TestDevToolsClientHost::close_counter);
136 } 138 }
137 139
138 TEST_F(DevToolsManagerTest, NoUnresponsiveDialogInInspectedTab) { 140 TEST_F(DevToolsManagerTest, NoUnresponsiveDialogInInspectedTab) {
139 TestRenderViewHost* inspected_rvh = rvh(); 141 TestRenderViewHost* inspected_rvh = rvh();
140 inspected_rvh->set_render_view_created(true); 142 inspected_rvh->set_render_view_created(true);
141 EXPECT_FALSE(contents()->delegate()); 143 EXPECT_FALSE(contents()->delegate());
142 TestTabContentsDelegate delegate; 144 TestTabContentsDelegate delegate;
143 contents()->set_delegate(&delegate); 145 contents()->set_delegate(&delegate);
144 146
145 testing_browser_process_.get()->SetDevToolsManager(new DevToolsManager()); 147 static_cast<TestingBrowserProcess*>(g_browser_process)->
148 SetDevToolsManager(new DevToolsManager());
146 DevToolsManager* manager = DevToolsManager::GetInstance(); 149 DevToolsManager* manager = DevToolsManager::GetInstance();
147 ASSERT_TRUE(manager); 150 ASSERT_TRUE(manager);
148 151
149 TestDevToolsClientHost client_host; 152 TestDevToolsClientHost client_host;
150 manager->RegisterDevToolsClientHostFor(inspected_rvh, &client_host); 153 manager->RegisterDevToolsClientHostFor(inspected_rvh, &client_host);
151 154
152 // Start with a short timeout. 155 // Start with a short timeout.
153 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 156 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
154 // Wait long enough for first timeout and see if it fired. 157 // Wait long enough for first timeout and see if it fired.
155 MessageLoop::current()->PostDelayedTask(FROM_HERE, 158 MessageLoop::current()->PostDelayedTask(FROM_HERE,
156 new MessageLoop::QuitTask(), 10); 159 new MessageLoop::QuitTask(), 10);
157 MessageLoop::current()->Run(); 160 MessageLoop::current()->Run();
158 EXPECT_FALSE(delegate.renderer_unresponsive_received()); 161 EXPECT_FALSE(delegate.renderer_unresponsive_received());
159 162
160 // Now close devtools and check that the notification is delivered. 163 // Now close devtools and check that the notification is delivered.
161 client_host.Close(); 164 client_host.Close();
162 // Start with a short timeout. 165 // Start with a short timeout.
163 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 166 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
164 // Wait long enough for first timeout and see if it fired. 167 // Wait long enough for first timeout and see if it fired.
165 MessageLoop::current()->PostDelayedTask(FROM_HERE, 168 MessageLoop::current()->PostDelayedTask(FROM_HERE,
166 new MessageLoop::QuitTask(), 10); 169 new MessageLoop::QuitTask(), 10);
167 MessageLoop::current()->Run(); 170 MessageLoop::current()->Run();
168 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 171 EXPECT_TRUE(delegate.renderer_unresponsive_received());
169 172
170 contents()->set_delegate(NULL); 173 contents()->set_delegate(NULL);
171 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698