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 GURL url2("chrome://credits/"); | 64 // Create and destroy renderers while tracing is enabled. |
| 65 GURL url2("chrome://credits"); |
65 ui_test_utils::NavigateToURLWithDisposition( | 66 ui_test_utils::NavigateToURLWithDisposition( |
66 browser(), url2, NEW_FOREGROUND_TAB, | 67 browser(), url2, NEW_FOREGROUND_TAB, |
67 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 68 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
68 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); | 69 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); |
69 | 70 |
| 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 |
70 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); | 80 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); |
71 ASSERT_TRUE(EndTracing(&json_events)); | 81 ASSERT_TRUE(EndTracing(&json_events)); |
72 | 82 |
73 // Expect the basic memory dumps to be present in the trace. | 83 // Expect the basic memory dumps to be present in the trace. |
74 EXPECT_NE(std::string::npos, json_events.find("process_totals")); | 84 EXPECT_NE(std::string::npos, json_events.find("process_totals")); |
75 | 85 |
76 EXPECT_NE(std::string::npos, json_events.find("v8")); | 86 EXPECT_NE(std::string::npos, json_events.find("v8")); |
77 EXPECT_NE(std::string::npos, json_events.find("blink_gc")); | 87 EXPECT_NE(std::string::npos, json_events.find("blink_gc")); |
78 } | 88 } |
79 }; | 89 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { | 167 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { |
158 PerformDumpMemoryTestActions(); | 168 PerformDumpMemoryTestActions(); |
159 } | 169 } |
160 | 170 |
161 // Single-process mode. | 171 // Single-process mode. |
162 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { | 172 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { |
163 PerformDumpMemoryTestActions(); | 173 PerformDumpMemoryTestActions(); |
164 } | 174 } |
165 | 175 |
166 } // namespace | 176 } // namespace |
OLD | NEW |