| OLD | NEW |
| 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/browser/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result)); | 506 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result)); |
| 507 LOG(INFO) << "Got V8 Heap Size " << result << " bytes"; | 507 LOG(INFO) << "Got V8 Heap Size " << result << " bytes"; |
| 508 EXPECT_GE(result, minimal_heap_size); | 508 EXPECT_GE(result, minimal_heap_size); |
| 509 | 509 |
| 510 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result)); | 510 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result)); |
| 511 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes"; | 511 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes"; |
| 512 EXPECT_GE(result, minimal_heap_size); | 512 EXPECT_GE(result, minimal_heap_size); |
| 513 } | 513 } |
| 514 | 514 |
| 515 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeInTabDevToolsWindow) { | 515 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeInTabDevToolsWindow) { |
| 516 DevToolsWindow* dev_tools = DevToolsWindow::ToggleDevToolsWindow( | 516 DevToolsWindow* dev_tools = DevToolsWindow::OpenDevToolsWindow( |
| 517 model()->GetResourceWebContents(1)->GetRenderViewHost(), | 517 model()->GetResourceWebContents(1)->GetRenderViewHost(), |
| 518 true, | |
| 519 DevToolsToggleAction::Inspect()); | 518 DevToolsToggleAction::Inspect()); |
| 520 // Dock side bottom should be the default. | 519 dev_tools->SetIsDockedForTest(true); |
| 521 ASSERT_EQ(DEVTOOLS_DOCK_SIDE_BOTTOM, dev_tools->dock_side()); | |
| 522 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 520 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 523 } | 521 } |
| 524 | 522 |
| 525 // This test differs from TaskManagerBrowserTest.NoticeInTabDevToolsWindow in | 523 // This test differs from TaskManagerBrowserTest.NoticeInTabDevToolsWindow in |
| 526 // the order in which the devtools window and task manager are created. | 524 // the order in which the devtools window and task manager are created. |
| 527 IN_PROC_BROWSER_TEST_F(TaskManagerNoShowBrowserTest, | 525 IN_PROC_BROWSER_TEST_F(TaskManagerNoShowBrowserTest, |
| 528 NoticeInTabDevToolsWindow) { | 526 NoticeInTabDevToolsWindow) { |
| 529 // First create the devtools window. | 527 // First create the devtools window. |
| 530 DevToolsWindow* dev_tools = DevToolsWindow::ToggleDevToolsWindow( | 528 DevToolsWindow* dev_tools = DevToolsWindow::OpenDevToolsWindow( |
| 531 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(), | 529 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(), |
| 532 true, | |
| 533 DevToolsToggleAction::Inspect()); | 530 DevToolsToggleAction::Inspect()); |
| 534 // Dock side bottom should be the default. | 531 dev_tools->SetIsDockedForTest(true); |
| 535 ASSERT_EQ(DEVTOOLS_DOCK_SIDE_BOTTOM, dev_tools->dock_side()); | |
| 536 // Make sure that the devtools window is loaded before starting the task | 532 // Make sure that the devtools window is loaded before starting the task |
| 537 // manager. | 533 // manager. |
| 538 content::RunAllPendingInMessageLoop(); | 534 content::RunAllPendingInMessageLoop(); |
| 539 | 535 |
| 540 // Now add showing the task manager to the queue, and watch for the right | 536 // Now add showing the task manager to the queue, and watch for the right |
| 541 // number of reources to show up. | 537 // number of reources to show up. |
| 542 base::MessageLoop::current()->PostTask( | 538 base::MessageLoop::current()->PostTask( |
| 543 FROM_HERE, | 539 FROM_HERE, |
| 544 base::Bind(&TaskManagerNoShowBrowserTest::ShowTaskManager, | 540 base::Bind(&TaskManagerNoShowBrowserTest::ShowTaskManager, |
| 545 base::Unretained(this))); | 541 base::Unretained(this))); |
| 546 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 542 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
| 547 } | 543 } |
| 548 | 544 |
| 549 #endif | 545 #endif |
| OLD | NEW |