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

Side by Side Diff: chrome/test/base/tracing_browsertest.cc

Issue 1417003003: [tracing] Dump child processes' memory metrics in browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: primiano's comments Created 4 years, 11 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
OLDNEW
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
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 // Start new processes and stop a process while tracing is enabled.
Primiano Tucci (use gerrit) 2016/01/05 11:55:17 I think you have other leftover of rebase conflict
ssid 2016/01/06 20:26:33 Adding close tab to make sure renderer is recycled
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 GURL url3("chrome://settings");
72 ui_test_utils::NavigateToURLWithDisposition(
73 browser(), url3, CURRENT_TAB,
74 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
75 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
76
70 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); 77 EXPECT_TRUE(WaitForWatchEvent(no_timeout));
71 ASSERT_TRUE(EndTracing(&json_events)); 78 ASSERT_TRUE(EndTracing(&json_events));
72 79
73 // Expect the basic memory dumps to be present in the trace. 80 // Expect the basic memory dumps to be present in the trace.
74 EXPECT_NE(std::string::npos, json_events.find("process_totals")); 81 EXPECT_NE(std::string::npos, json_events.find("process_totals"));
75 82
76 EXPECT_NE(std::string::npos, json_events.find("v8")); 83 EXPECT_NE(std::string::npos, json_events.find("v8"));
77 EXPECT_NE(std::string::npos, json_events.find("blink_gc")); 84 EXPECT_NE(std::string::npos, json_events.find("blink_gc"));
78 } 85 }
79 }; 86 };
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { 164 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) {
158 PerformDumpMemoryTestActions(); 165 PerformDumpMemoryTestActions();
159 } 166 }
160 167
161 // Single-process mode. 168 // Single-process mode.
162 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { 169 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) {
163 PerformDumpMemoryTestActions(); 170 PerformDumpMemoryTestActions();
164 } 171 }
165 172
166 } // namespace 173 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698