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

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

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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
« no previous file with comments | « chrome/test/base/test_browser_window.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 content::RenderViewHost* rvh = browser()->tab_strip_model()-> 43 content::RenderViewHost* rvh = browser()->tab_strip_model()->
44 GetActiveWebContents()->GetRenderViewHost(); 44 GetActiveWebContents()->GetRenderViewHost();
45 ASSERT_TRUE(rvh); 45 ASSERT_TRUE(rvh);
46 ASSERT_TRUE(content::ExecuteScript(rvh, ";")); 46 ASSERT_TRUE(content::ExecuteScript(rvh, ";"));
47 } 47 }
48 48
49 void PerformDumpMemoryTestActions( 49 void PerformDumpMemoryTestActions(
50 const base::trace_event::TraceConfig& trace_config) { 50 const base::trace_event::TraceConfig& trace_config) {
51 GURL url1("about:blank"); 51 GURL url1("about:blank");
52 ui_test_utils::NavigateToURLWithDisposition( 52 ui_test_utils::NavigateToURLWithDisposition(
53 browser(), url1, NEW_FOREGROUND_TAB, 53 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB,
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(BeginTracingWithTraceConfig(trace_config)); 60 ASSERT_TRUE(BeginTracingWithTraceConfig(trace_config));
61 61
62 // Create and destroy renderers while tracing is enabled. 62 // Create and destroy renderers while tracing is enabled.
63 GURL url2("chrome://credits"); 63 GURL url2("chrome://credits");
64 ui_test_utils::NavigateToURLWithDisposition( 64 ui_test_utils::NavigateToURLWithDisposition(
65 browser(), url2, NEW_FOREGROUND_TAB, 65 browser(), url2, WindowOpenDisposition::NEW_FOREGROUND_TAB,
66 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 66 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
67 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 67 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
68 68
69 // Close the current tab. 69 // Close the current tab.
70 browser()->tab_strip_model()->CloseSelectedTabs(); 70 browser()->tab_strip_model()->CloseSelectedTabs();
71 71
72 GURL url3("chrome://settings"); 72 GURL url3("chrome://settings");
73 ui_test_utils::NavigateToURLWithDisposition( 73 ui_test_utils::NavigateToURLWithDisposition(
74 browser(), url3, CURRENT_TAB, 74 browser(), url3, WindowOpenDisposition::CURRENT_TAB,
75 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 75 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
76 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 76 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
77 77
78 std::string json_events; 78 std::string json_events;
79 ASSERT_TRUE(EndTracing(&json_events)); 79 ASSERT_TRUE(EndTracing(&json_events));
80 80
81 // Expect the basic memory dumps to be present in the trace. 81 // Expect the basic memory dumps to be present in the trace.
82 EXPECT_NE(std::string::npos, json_events.find("process_totals")); 82 EXPECT_NE(std::string::npos, json_events.find("process_totals"));
83 EXPECT_NE(std::string::npos, json_events.find("v8")); 83 EXPECT_NE(std::string::npos, json_events.find("v8"));
84 EXPECT_NE(std::string::npos, json_events.find("blink_gc")); 84 EXPECT_NE(std::string::npos, json_events.find("blink_gc"));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); 135 EXPECT_TRUE(WaitForWatchEvent(no_timeout));
136 ASSERT_TRUE(EndTracing(&json_events)); 136 ASSERT_TRUE(EndTracing(&json_events));
137 137
138 // Child process events from different processes. 138 // Child process events from different processes.
139 GURL url1("chrome://tracing/"); 139 GURL url1("chrome://tracing/");
140 GURL url2("chrome://credits/"); 140 GURL url2("chrome://credits/");
141 ASSERT_TRUE(BeginTracingWithWatch(g_category, g_category, 141 ASSERT_TRUE(BeginTracingWithWatch(g_category, g_category,
142 "OnJavaScriptExecuteRequestForTests", 2)); 142 "OnJavaScriptExecuteRequestForTests", 2));
143 // Open two tabs to different URLs to encourage two separate renderer 143 // Open two tabs to different URLs to encourage two separate renderer
144 // processes. Each will fire an event that will be counted towards the total. 144 // processes. Each will fire an event that will be counted towards the total.
145 ui_test_utils::NavigateToURLWithDisposition(browser(), url1, 145 ui_test_utils::NavigateToURLWithDisposition(
146 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 146 browser(), url1, WindowOpenDisposition::NEW_FOREGROUND_TAB,
147 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
147 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 148 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
148 ui_test_utils::NavigateToURLWithDisposition(browser(), url2, 149 ui_test_utils::NavigateToURLWithDisposition(
149 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 150 browser(), url2, WindowOpenDisposition::NEW_FOREGROUND_TAB,
151 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
150 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 152 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
151 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); 153 EXPECT_TRUE(WaitForWatchEvent(no_timeout));
152 ASSERT_TRUE(EndTracing(&json_events)); 154 ASSERT_TRUE(EndTracing(&json_events));
153 } 155 }
154 156
155 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { 157 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) {
156 PerformDumpMemoryTestActions(base::trace_event::TraceConfig( 158 PerformDumpMemoryTestActions(base::trace_event::TraceConfig(
157 base::trace_event::TraceConfigMemoryTestUtil:: 159 base::trace_event::TraceConfigMemoryTestUtil::
158 GetTraceConfig_PeriodicTriggers(250, 2000))); 160 GetTraceConfig_PeriodicTriggers(250, 2000)));
159 } 161 }
160 162
161 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestBackgroundMemoryInfra) { 163 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestBackgroundMemoryInfra) {
162 PerformDumpMemoryTestActions(base::trace_event::TraceConfig( 164 PerformDumpMemoryTestActions(base::trace_event::TraceConfig(
163 base::trace_event::TraceConfigMemoryTestUtil:: 165 base::trace_event::TraceConfigMemoryTestUtil::
164 GetTraceConfig_BackgroundTrigger(200))); 166 GetTraceConfig_BackgroundTrigger(200)));
165 } 167 }
166 168
167 } // namespace 169 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/base/test_browser_window.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698