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

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

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 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 | Annotate | Revision Log
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_tabstrip.h" 10 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 14 matching lines...) Expand all
25 const char* g_event = "TheEvent"; 25 const char* g_event = "TheEvent";
26 26
27 class TracingBrowserTest : public InProcessBrowserTest { 27 class TracingBrowserTest : public InProcessBrowserTest {
28 protected: 28 protected:
29 // Execute some no-op javascript on the current tab - this triggers a trace 29 // Execute some no-op javascript on the current tab - this triggers a trace
30 // event in RenderViewImpl::OnScriptEvalRequest (from the renderer process). 30 // event in RenderViewImpl::OnScriptEvalRequest (from the renderer process).
31 void ExecuteJavascriptOnCurrentTab() { 31 void ExecuteJavascriptOnCurrentTab() {
32 content::RenderViewHost* rvh = 32 content::RenderViewHost* rvh =
33 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 33 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
34 ASSERT_TRUE(rvh); 34 ASSERT_TRUE(rvh);
35 ASSERT_TRUE(content::ExecuteJavaScript(rvh, L"", L";")); 35 ASSERT_TRUE(content::ExecuteJavaScript(rvh, "", ";"));
36 } 36 }
37 }; 37 };
38 38
39 void AddEvents(int num) { 39 void AddEvents(int num) {
40 for (int i = 0; i < num; ++i) 40 for (int i = 0; i < num; ++i)
41 TRACE_EVENT_INSTANT0(g_category, g_event); 41 TRACE_EVENT_INSTANT0(g_category, g_event);
42 } 42 }
43 43
44 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) { 44 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) {
45 base::TimeDelta no_timeout; 45 base::TimeDelta no_timeout;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 95 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
96 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 96 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
97 ui_test_utils::NavigateToURLWithDisposition(browser(), url2, 97 ui_test_utils::NavigateToURLWithDisposition(browser(), url2,
98 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 98 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
99 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); 99 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab());
100 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); 100 EXPECT_TRUE(WaitForWatchEvent(no_timeout));
101 ASSERT_TRUE(EndTracing(&json_events)); 101 ASSERT_TRUE(EndTracing(&json_events));
102 } 102 }
103 103
104 } // namespace 104 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/preferences_browsertest.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698