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

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

Issue 12252058: Add a |scope| argument to TRACE_EVENT_INSTANT* and require its presence. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix builds 2 Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/thread_proxy.cc ('k') | chrome/test/perf/rendering/latency_tests.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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 21 matching lines...) Expand all
32 void ExecuteJavascriptOnCurrentTab() { 32 void ExecuteJavascriptOnCurrentTab() {
33 content::RenderViewHost* rvh = browser()->tab_strip_model()-> 33 content::RenderViewHost* rvh = browser()->tab_strip_model()->
34 GetActiveWebContents()->GetRenderViewHost(); 34 GetActiveWebContents()->GetRenderViewHost();
35 ASSERT_TRUE(rvh); 35 ASSERT_TRUE(rvh);
36 ASSERT_TRUE(content::ExecuteScript(rvh, ";")); 36 ASSERT_TRUE(content::ExecuteScript(rvh, ";"));
37 } 37 }
38 }; 38 };
39 39
40 void AddEvents(int num) { 40 void AddEvents(int num) {
41 for (int i = 0; i < num; ++i) 41 for (int i = 0; i < num; ++i)
42 TRACE_EVENT_INSTANT0(g_category, g_event); 42 TRACE_EVENT_INSTANT0(g_category, g_event, TRACE_EVENT_SCOPE_THREAD);
43 } 43 }
44 44
45 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) { 45 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) {
46 base::TimeDelta no_timeout; 46 base::TimeDelta no_timeout;
47 base::TimeDelta short_timeout = base::TimeDelta::FromMilliseconds(5); 47 base::TimeDelta short_timeout = base::TimeDelta::FromMilliseconds(5);
48 std::string json_events; 48 std::string json_events;
49 49
50 // One event before wait. 50 // One event before wait.
51 ASSERT_TRUE(BeginTracingWithWatch(g_category, g_category, g_event, 1)); 51 ASSERT_TRUE(BeginTracingWithWatch(g_category, g_category, g_event, 1));
52 AddEvents(1); 52 AddEvents(1);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 96 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
97 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 97 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
98 ui_test_utils::NavigateToURLWithDisposition(browser(), url2, 98 ui_test_utils::NavigateToURLWithDisposition(browser(), url2,
99 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 99 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
100 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 100 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
101 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); 101 EXPECT_TRUE(WaitForWatchEvent(no_timeout));
102 ASSERT_TRUE(EndTracing(&json_events)); 102 ASSERT_TRUE(EndTracing(&json_events));
103 } 103 }
104 104
105 } // namespace 105 } // namespace
OLDNEW
« no previous file with comments | « cc/trees/thread_proxy.cc ('k') | chrome/test/perf/rendering/latency_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698