Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / task_manager / task_manager_browsertest.cc
blob578e791a859658f320c7bbb04efa14625f2b9fcb
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
3 // found in the LICENSE file.
5 #include "chrome/browser/task_manager/task_manager.h"
7 #include "base/files/file_path.h"
8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/devtools/devtools_window.h"
13 #include "chrome/browser/extensions/extension_browsertest.h"
14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/extension_system.h"
16 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
17 #include "chrome/browser/infobars/infobar.h"
18 #include "chrome/browser/infobars/infobar_service.h"
19 #include "chrome/browser/notifications/desktop_notification_service.h"
20 #include "chrome/browser/notifications/notification.h"
21 #include "chrome/browser/notifications/notification_test_util.h"
22 #include "chrome/browser/notifications/notification_ui_manager.h"
23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/task_manager/resource_provider.h"
25 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
26 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_dialogs.h"
28 #include "chrome/browser/ui/browser_navigator.h"
29 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/ui/panels/panel.h"
31 #include "chrome/browser/ui/panels/panel_manager.h"
32 #include "chrome/browser/ui/tabs/tab_strip_model.h"
33 #include "chrome/browser/web_applications/web_app.h"
34 #include "chrome/common/chrome_switches.h"
35 #include "chrome/test/base/in_process_browser_test.h"
36 #include "chrome/test/base/ui_test_utils.h"
37 #include "content/public/browser/notification_service.h"
38 #include "content/public/common/content_switches.h"
39 #include "content/public/common/page_transition_types.h"
40 #include "content/public/test/browser_test_utils.h"
41 #include "extensions/common/extension.h"
42 #include "grit/generated_resources.h"
43 #include "net/dns/mock_host_resolver.h"
44 #include "net/test/embedded_test_server/embedded_test_server.h"
45 #include "testing/gtest/include/gtest/gtest.h"
46 #include "ui/base/l10n/l10n_util.h"
48 using content::WebContents;
50 // On Linux this is crashing intermittently http://crbug/84719
51 // In some environments this test fails about 1/6 http://crbug/84850
52 #if defined(OS_LINUX)
53 #define MAYBE_KillExtension DISABLED_KillExtension
54 #else
55 #define MAYBE_KillExtension KillExtension
56 #endif
58 namespace {
60 const base::FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html");
62 } // namespace
64 class TaskManagerNoShowBrowserTest : public ExtensionBrowserTest {
65 public:
66 TaskManagerNoShowBrowserTest() {}
67 virtual ~TaskManagerNoShowBrowserTest() {}
69 TaskManagerModel* model() const {
70 return TaskManager::GetInstance()->model();
73 void ShowTaskManager() {
74 EXPECT_EQ(0, model()->ResourceCount());
76 // Show the task manager. This populates the model, and helps with debugging
77 // (you see the task manager).
78 chrome::ShowTaskManager(browser());
80 // New Tab Page.
81 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
84 void Refresh() {
85 model()->Refresh();
88 int GetUpdateTimeMs() {
89 return TaskManagerModel::kUpdateTimeMs;
92 protected:
93 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
94 ExtensionBrowserTest::SetUpCommandLine(command_line);
96 // Do not launch the GPU process as the GPU process will show up in task
97 // manager but whether it appears before or after the new tab renderer
98 // process is not well defined.
99 command_line->AppendSwitch(switches::kDisableGpu);
101 // Do not launch device discovery process.
102 command_line->AppendSwitch(switches::kDisableDeviceDiscoveryNotifications);
105 private:
106 DISALLOW_COPY_AND_ASSIGN(TaskManagerNoShowBrowserTest);
109 class TaskManagerBrowserTest : public TaskManagerNoShowBrowserTest {
110 public:
111 TaskManagerBrowserTest() {}
112 virtual ~TaskManagerBrowserTest() {}
114 virtual void SetUpOnMainThread() OVERRIDE {
115 TaskManagerNoShowBrowserTest::SetUpOnMainThread();
116 TaskManagerNoShowBrowserTest::ShowTaskManager();
119 private:
120 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserTest);
123 #if defined(OS_MACOSX) || defined(OS_LINUX)
124 #define MAYBE_ShutdownWhileOpen DISABLED_ShutdownWhileOpen
125 #else
126 #define MAYBE_ShutdownWhileOpen ShutdownWhileOpen
127 #endif
129 // Regression test for http://crbug.com/13361
130 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_ShutdownWhileOpen) {
131 // Showing task manager handled by SetUp.
134 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeTabContentsChanges) {
135 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
136 // Open a new tab and make sure we notice that.
137 GURL url(ui_test_utils::GetTestUrl(base::FilePath(
138 base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File)));
139 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED);
140 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
142 // Check that the last entry is a tab contents resource whose title starts
143 // starts with "Tab:".
144 ASSERT_TRUE(model()->GetResourceWebContents(resource_count) != NULL);
145 base::string16 prefix = l10n_util::GetStringFUTF16(
146 IDS_TASK_MANAGER_TAB_PREFIX, base::string16());
147 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count), prefix,
148 true));
150 // Close the tab and verify that we notice.
151 browser()->tab_strip_model()->CloseWebContentsAt(0,
152 TabStripModel::CLOSE_NONE);
153 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
156 #if defined(USE_ASH)
157 // This test fails on Ash because task manager treats view type
158 // Panels differently for Ash.
159 #define MAYBE_NoticePanelChanges DISABLED_NoticePanelChanges
160 #else
161 #define MAYBE_NoticePanelChanges NoticePanelChanges
162 #endif
163 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_NoticePanelChanges) {
164 ASSERT_TRUE(LoadExtension(
165 test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
166 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
167 .AppendASCII("1.0.0.0")));
169 // Browser, the New Tab Page and Extension background page.
170 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
172 // Open a new panel to an extension url and make sure we notice that.
173 GURL url(
174 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/french_sentence.html");
175 Panel* panel = PanelManager::GetInstance()->CreatePanel(
176 web_app::GenerateApplicationNameFromExtensionId(
177 last_loaded_extension_id()),
178 browser()->profile(),
179 url,
180 gfx::Rect(300, 400),
181 PanelManager::CREATE_AS_DOCKED);
182 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3);
184 // Check that the fourth entry is a resource with the panel's web contents
185 // and whose title starts with "Extension:".
186 ASSERT_EQ(panel->GetWebContents(), model()->GetResourceWebContents(3));
187 base::string16 prefix = l10n_util::GetStringFUTF16(
188 IDS_TASK_MANAGER_EXTENSION_PREFIX, base::string16());
189 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(3), prefix, true));
191 // Close the panel and verify that we notice.
192 panel->Close();
193 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
195 // Unload extension to avoid crash on Windows.
196 UnloadExtension(last_loaded_extension_id());
197 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
200 #if defined(USE_ASH) || defined(OS_WIN)
201 // This test fails on Ash because task manager treats view type
202 // Panels differently for Ash.
203 // This test also fails on Windows, win_rel trybot. http://crbug.com/166322
204 #define MAYBE_KillPanelExtension DISABLED_KillPanelExtension
205 #else
206 #define MAYBE_KillPanelExtension KillPanelExtension
207 #endif
208 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_KillPanelExtension) {
209 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
211 ASSERT_TRUE(LoadExtension(
212 test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
213 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
214 .AppendASCII("1.0.0.0")));
216 // Browser, the New Tab Page and Extension background page.
217 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
219 // Open a new panel to an extension url and make sure we notice that.
220 GURL url(
221 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/french_sentence.html");
222 PanelManager::GetInstance()->CreatePanel(
223 web_app::GenerateApplicationNameFromExtensionId(
224 last_loaded_extension_id()),
225 browser()->profile(),
226 url,
227 gfx::Rect(300, 400),
228 PanelManager::CREATE_AS_DOCKED);
229 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3);
231 // Kill the panel extension process and verify that it disappears from the
232 // model along with its panel.
233 ASSERT_TRUE(model()->IsBackgroundResource(resource_count));
234 TaskManager::GetInstance()->KillProcess(resource_count);
235 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
238 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeExtensionTabs) {
239 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
240 ASSERT_TRUE(LoadExtension(
241 test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
242 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
243 .AppendASCII("1.0.0.0")));
245 // Browser, Extension background page, and the New Tab Page.
246 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
248 // Open a new tab to an extension URL and make sure we notice that.
249 GURL url("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html");
250 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED);
251 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3);
253 // Check that the third entry (background) is an extension resource whose
254 // title starts with "Extension:".
255 ASSERT_EQ(task_manager::Resource::EXTENSION, model()->GetResourceType(
256 resource_count));
257 ASSERT_TRUE(model()->GetResourceWebContents(resource_count) == NULL);
258 ASSERT_TRUE(model()->GetResourceExtension(resource_count) != NULL);
259 base::string16 prefix = l10n_util::GetStringFUTF16(
260 IDS_TASK_MANAGER_EXTENSION_PREFIX, base::string16());
261 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count),
262 prefix, true));
264 // Check that the fourth entry (page.html) is of type extension and has both
265 // a tab contents and an extension. The title should start with "Extension:".
266 ASSERT_EQ(task_manager::Resource::EXTENSION, model()->GetResourceType(
267 resource_count + 1));
268 ASSERT_TRUE(model()->GetResourceWebContents(resource_count + 1) != NULL);
269 ASSERT_TRUE(model()->GetResourceExtension(resource_count + 1) != NULL);
270 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count + 1),
271 prefix, true));
273 // Unload extension to avoid crash on Windows.
274 UnloadExtension(last_loaded_extension_id());
275 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
278 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) {
279 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
280 ASSERT_TRUE(LoadExtension(
281 test_data_dir_.AppendASCII("packaged_app")));
282 ExtensionService* service = extensions::ExtensionSystem::Get(
283 browser()->profile())->extension_service();
284 const extensions::Extension* extension =
285 service->GetExtensionById(last_loaded_extension_id(), false);
287 // New Tab Page.
288 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
290 // Open a new tab to the app's launch URL and make sure we notice that.
291 GURL url(extension->GetResourceURL("main.html"));
292 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED);
293 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
295 // Check that the third entry (main.html) is of type extension and has both
296 // a tab contents and an extension. The title should start with "App:".
297 ASSERT_EQ(task_manager::Resource::EXTENSION, model()->GetResourceType(
298 resource_count));
299 ASSERT_TRUE(model()->GetResourceWebContents(resource_count) != NULL);
300 ASSERT_TRUE(model()->GetResourceExtension(resource_count) == extension);
301 base::string16 prefix = l10n_util::GetStringFUTF16(
302 IDS_TASK_MANAGER_APP_PREFIX, base::string16());
303 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count),
304 prefix, true));
306 // Unload extension to avoid crash on Windows.
307 UnloadExtension(last_loaded_extension_id());
308 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
311 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) {
312 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
314 // The app under test acts on URLs whose host is "localhost",
315 // so the URLs we navigate to must have host "localhost".
316 host_resolver()->AddRule("*", "127.0.0.1");
317 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
318 GURL::Replacements replace_host;
319 std::string host_str("localhost"); // must stay in scope with replace_host
320 replace_host.SetHostStr(host_str);
321 GURL base_url = embedded_test_server()->GetURL(
322 "/extensions/api_test/app_process/");
323 base_url = base_url.ReplaceComponents(replace_host);
325 // Open a new tab to an app URL before the app is loaded.
326 GURL url(base_url.Resolve("path1/empty.html"));
327 content::WindowedNotificationObserver observer(
328 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
329 content::NotificationService::AllSources());
330 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED);
331 observer.Wait();
333 // Force the TaskManager to query the title.
334 Refresh();
336 // Check that the third entry's title starts with "Tab:".
337 base::string16 tab_prefix = l10n_util::GetStringFUTF16(
338 IDS_TASK_MANAGER_TAB_PREFIX, base::string16());
339 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count),
340 tab_prefix, true));
342 // Load the hosted app and make sure it still starts with "Tab:",
343 // since it hasn't changed to an app process yet.
344 ASSERT_TRUE(LoadExtension(
345 test_data_dir_.AppendASCII("api_test").AppendASCII("app_process")));
346 // Force the TaskManager to query the title.
347 Refresh();
348 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count),
349 tab_prefix, true));
351 // Now reload and check that the last entry's title now starts with "App:".
352 ui_test_utils::NavigateToURL(browser(), url);
353 // Force the TaskManager to query the title.
354 Refresh();
355 base::string16 app_prefix = l10n_util::GetStringFUTF16(
356 IDS_TASK_MANAGER_APP_PREFIX, base::string16());
357 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count),
358 app_prefix, true));
360 // Disable extension and reload page.
361 DisableExtension(last_loaded_extension_id());
362 ui_test_utils::NavigateToURL(browser(), url);
364 // Force the TaskManager to query the title.
365 Refresh();
367 // The third entry's title should be back to a normal tab.
368 ASSERT_TRUE(StartsWith(model()->GetResourceTitle(resource_count),
369 tab_prefix, true));
372 // Disabled, http://crbug.com/66957.
373 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
374 DISABLED_KillExtensionAndReload) {
375 ASSERT_TRUE(LoadExtension(
376 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
378 // Wait until we see the loaded extension in the task manager (the three
379 // resources are: the browser process, New Tab Page, and the extension).
380 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3);
382 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL);
383 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL);
384 ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
386 // Kill the extension process and make sure we notice it.
387 TaskManager::GetInstance()->KillProcess(2);
388 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1);
390 // Reload the extension using the "crashed extension" infobar while the task
391 // manager is still visible. Make sure we don't crash and the extension
392 // gets reloaded and noticed in the task manager.
393 InfoBarService* infobar_service = InfoBarService::FromWebContents(
394 browser()->tab_strip_model()->GetActiveWebContents());
395 ASSERT_EQ(1U, infobar_service->infobar_count());
396 ConfirmInfoBarDelegate* delegate =
397 infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
398 ASSERT_TRUE(delegate);
399 delegate->Accept();
400 TaskManagerBrowserTestUtil::WaitForWebResourceChange(3);
403 #if defined(OS_WIN)
404 // http://crbug.com/93158.
405 #define MAYBE_ReloadExtension DISABLED_ReloadExtension
406 #else
407 #define MAYBE_ReloadExtension ReloadExtension
408 #endif
410 // Regression test for http://crbug.com/18693.
411 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_ReloadExtension) {
412 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
413 LOG(INFO) << "loading extension";
414 ASSERT_TRUE(LoadExtension(
415 test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
417 // Wait until we see the loaded extension in the task manager (the three
418 // resources are: the browser process, New Tab Page, and the extension).
419 LOG(INFO) << "waiting for resource change";
420 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
422 EXPECT_TRUE(model()->GetResourceExtension(0) == NULL);
423 EXPECT_TRUE(model()->GetResourceExtension(1) == NULL);
424 ASSERT_TRUE(model()->GetResourceExtension(resource_count) != NULL);
426 const extensions::Extension* extension = model()->GetResourceExtension(
427 resource_count);
428 ASSERT_TRUE(extension != NULL);
430 // Reload the extension a few times and make sure our resource count
431 // doesn't increase.
432 LOG(INFO) << "First extension reload";
433 ReloadExtension(extension->id());
434 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
435 extension = model()->GetResourceExtension(resource_count);
436 ASSERT_TRUE(extension != NULL);
438 LOG(INFO) << "Second extension reload";
439 ReloadExtension(extension->id());
440 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
441 extension = model()->GetResourceExtension(resource_count);
442 ASSERT_TRUE(extension != NULL);
444 LOG(INFO) << "Third extension reload";
445 ReloadExtension(extension->id());
446 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
449 // Crashy, http://crbug.com/42301.
450 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
451 DISABLED_PopulateWebCacheFields) {
452 int resource_count = TaskManager::GetInstance()->model()->ResourceCount();
454 // Open a new tab and make sure we notice that.
455 GURL url(ui_test_utils::GetTestUrl(base::FilePath(
456 base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File)));
457 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED);
458 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
460 // Check that we get some value for the cache columns.
461 DCHECK_NE(model()->GetResourceWebCoreImageCacheSize(resource_count),
462 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
463 DCHECK_NE(model()->GetResourceWebCoreScriptsCacheSize(resource_count),
464 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
465 DCHECK_NE(model()->GetResourceWebCoreCSSCacheSize(resource_count),
466 l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT));
469 // Checks that task manager counts a worker thread JS heap size.
470 // http://crbug.com/241066
471 // Flaky, http://crbug.com/259368
472 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, DISABLED_WebWorkerJSHeapMemory) {
473 GURL url(ui_test_utils::GetTestUrl(base::FilePath(
474 base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File)));
475 ui_test_utils::NavigateToURL(browser(), url);
476 const int extra_timeout_ms = 500;
477 size_t minimal_heap_size = 2 * 1024 * 1024 * sizeof(void*);
478 std::string test_js = base::StringPrintf(
479 "var blob = new Blob([\n"
480 " 'mem = new Array(%lu);',\n"
481 " 'for (var i = 0; i < mem.length; i += 16) mem[i] = i;',\n"
482 " 'postMessage();']);\n"
483 "blobURL = window.URL.createObjectURL(blob);\n"
484 "worker = new Worker(blobURL);\n"
485 "// Give the task manager few seconds to poll for JS heap sizes.\n"
486 "worker.onmessage = setTimeout.bind(\n"
487 " this,\n"
488 " function () { window.domAutomationController.send(true); },\n"
489 " %d);\n"
490 "worker.postMessage();\n",
491 static_cast<unsigned long>(minimal_heap_size),
492 GetUpdateTimeMs() + extra_timeout_ms);
493 bool ok;
494 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
495 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok));
496 ASSERT_TRUE(ok);
498 int resource_index = TaskManager::GetInstance()->model()->ResourceCount() - 1;
499 size_t result;
501 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result));
502 LOG(INFO) << "Got V8 Heap Size " << result << " bytes";
503 EXPECT_GE(result, minimal_heap_size);
505 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result));
506 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes";
507 EXPECT_GE(result, minimal_heap_size);
510 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeInTabDevToolsWindow) {
511 DevToolsWindow::OpenDevToolsWindowForTest(
512 model()->GetResourceWebContents(1)->GetRenderViewHost(), true);
513 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);
516 // This test differs from TaskManagerBrowserTest.NoticeInTabDevToolsWindow in
517 // the order in which the devtools window and task manager are created.
518 IN_PROC_BROWSER_TEST_F(TaskManagerNoShowBrowserTest,
519 NoticeInTabDevToolsWindow) {
520 // First create the devtools window.
521 DevToolsWindow::OpenDevToolsWindowForTest(
522 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
523 true);
524 // Make sure that the devtools window is loaded before starting the task
525 // manager.
526 content::RunAllPendingInMessageLoop();
528 // Now add showing the task manager to the queue, and watch for the right
529 // number of reources to show up.
530 base::MessageLoop::current()->PostTask(
531 FROM_HERE,
532 base::Bind(&TaskManagerNoShowBrowserTest::ShowTaskManager,
533 base::Unretained(this)));
534 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2);