| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 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, 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(BeginTracingWithWatch( | 60 ASSERT_TRUE(BeginTracingWithWatch(MemoryDumpManager::kTraceCategory, |
| 61 MemoryDumpManager::kTraceCategoryForTesting, | 61 MemoryDumpManager::kTraceCategory, |
| 62 MemoryDumpManager::kTraceCategoryForTesting, event_name, 10)); | 62 event_name, 10)); |
| 63 | 63 |
| 64 GURL url2("chrome://credits/"); | 64 GURL url2("chrome://credits/"); |
| 65 ui_test_utils::NavigateToURLWithDisposition( | 65 ui_test_utils::NavigateToURLWithDisposition( |
| 66 browser(), url2, NEW_FOREGROUND_TAB, | 66 browser(), url2, NEW_FOREGROUND_TAB, |
| 67 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 67 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 68 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); | 68 ASSERT_NO_FATAL_FAILURE(ExecuteJavascriptOnCurrentTab()); |
| 69 | 69 |
| 70 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); | 70 EXPECT_TRUE(WaitForWatchEvent(no_timeout)); |
| 71 ASSERT_TRUE(EndTracing(&json_events)); | 71 ASSERT_TRUE(EndTracing(&json_events)); |
| 72 | 72 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { | 157 IN_PROC_BROWSER_TEST_F(TracingBrowserTest, TestMemoryInfra) { |
| 158 PerformDumpMemoryTestActions(); | 158 PerformDumpMemoryTestActions(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Single-process mode. | 161 // Single-process mode. |
| 162 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { | 162 IN_PROC_BROWSER_TEST_F(SingleProcessTracingBrowserTest, TestMemoryInfra) { |
| 163 PerformDumpMemoryTestActions(); | 163 PerformDumpMemoryTestActions(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace | 166 } // namespace |
| OLD | NEW |