| 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/test/base/tracing.h" | 5 #include "chrome/test/base/tracing.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 54 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 55 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); | 55 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); |
| 56 | 56 |
| 57 // Begin tracing and watch for multiple periodic dump trace events. | 57 // Begin tracing and watch for multiple periodic dump trace events. |
| 58 std::string event_name = base::trace_event::MemoryDumpTypeToString( | 58 std::string event_name = base::trace_event::MemoryDumpTypeToString( |
| 59 MemoryDumpType::PERIODIC_INTERVAL); | 59 MemoryDumpType::PERIODIC_INTERVAL); |
| 60 ASSERT_TRUE(BeginTracingWithWatch(MemoryDumpManager::kTraceCategory, | 60 ASSERT_TRUE(BeginTracingWithWatch(MemoryDumpManager::kTraceCategory, |
| 61 MemoryDumpManager::kTraceCategory, | 61 MemoryDumpManager::kTraceCategory, |
| 62 event_name, 10)); | 62 event_name, 10)); |
| 63 | 63 |
| 64 // Create and destroy renderers while tracing is enabled. | 64 GURL url2("chrome://credits/"); |
| 65 GURL url2("chrome://credits"); | |
| 66 ui_test_utils::NavigateToURLWithDisposition( | 65 ui_test_utils::NavigateToURLWithDisposition( |
| 67 browser(), url2, NEW_FOREGROUND_TAB, | 66 browser(), url2, NEW_FOREGROUND_TAB, |
| 68 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 67 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 69 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); | 68 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); |
| 70 | 69 |
| 71 // Close the current tab. | |
| 72 browser()->tab_strip_model()->CloseSelectedTabs(); | |
| 73 | |
| 74 GURL url3("chrome://settings"); | |
| 75 ui_test_utils::NavigateToURLWithDisposition( | |
| 76 browser(), url3, CURRENT_TAB, | |
| 77 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
| 78 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); | |
| 79 | |
| 80 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); | 70 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); |
| 81 ASSERT_TRUE(EndTracing(&json_events)); | 71 ASSERT_TRUE(EndTracing(&json_events)); |
| 82 | 72 |
| 83 // Expect the basic memory dumps to be present in the trace. | 73 // Expect the basic memory dumps to be present in the trace. |
| 84 EXPECT_NE(std::string::npos, json_events.find("process_totals")); | 74 EXPECT_NE(std::string::npos, json_events.find("process_totals")); |
| 85 | 75 |
| 86 EXPECT_NE(std::string::npos, json_events.find("v8")); | 76 EXPECT_NE(std::string::npos, json_events.find("v8")); |
| 87 EXPECT_NE(std::string::npos, json_events.find("blink_gc")); | 77 EXPECT_NE(std::string::npos, json_events.find("blink_gc")); |
| 88 } | 78 } |
| 89 }; | 79 }; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { | 157 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { |
| 168 PerformDumpMemoryTestActions(); | 158 PerformDumpMemoryTestActions(); |
| 169 } | 159 } |
| 170 | 160 |
| 171 // Single-process mode. | 161 // Single-process mode. |
| 172 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { | 162 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { |
| 173 PerformDumpMemoryTestActions(); | 163 PerformDumpMemoryTestActions(); |
| 174 } | 164 } |
| 175 | 165 |
| 176 } // namespace | 166 } // namespace |
| OLD | NEW |