Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 // Wait for the heap stats to reflect this. | 843 // Wait for the heap stats to reflect this. |
| 844 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | 844 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( |
| 845 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY, minimal_heap_size)); | 845 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY, minimal_heap_size)); |
| 846 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | 846 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( |
| 847 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED, | 847 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED, |
| 848 minimal_heap_size)); | 848 minimal_heap_size)); |
| 849 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 849 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 850 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); | 850 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); |
| 851 } | 851 } |
| 852 | 852 |
| 853 // Checks that task manager counts idle wakeups. | |
| 854 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, | |
| 855 IdleWakeups) { | |
|
ncarter (slow)
2016/07/28 21:37:27
I think this test is a good start. By its nature i
stanisc
2016/08/01 22:34:27
OK. I've implemented changes suggested below.
| |
| 856 ShowTaskManager(); | |
| 857 model()->ToggleColumnVisibility(ColumnSpecifier::IDLE_WAKEUPS); | |
| 858 | |
| 859 ui_test_utils::NavigateToURL(browser(), GetTestURL()); | |
| 860 | |
| 861 std::string test_js = | |
| 862 "function myWait(n) {\n" | |
|
ncarter (slow)
2016/07/28 21:37:27
I would probably make this an infinite setTimeout
stanisc
2016/08/01 22:34:27
Done.
| |
| 863 " if (n < 1000) {\n" | |
| 864 " setTimeout(function() { myWait(n + 1); }, 1)\n" | |
| 865 " } else {\n" | |
| 866 " window.domAutomationController.send(\"okay\");\n" | |
| 867 " }\n" | |
| 868 "}\n" | |
| 869 "myWait(0);\n"; | |
| 870 | |
| 871 std::string ok; | |
| 872 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | |
| 873 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok)); | |
|
ncarter (slow)
2016/07/28 21:37:27
ExecuteScriptAndExtractString will block until win
stanisc
2016/08/01 22:34:27
Done.
| |
| 874 ASSERT_EQ("okay", ok); | |
| 875 | |
| 876 // The script above should trigger a lot of idle wakeups - up to 1000 per | |
| 877 // second. Let's make sure we get at least 100 (in case the test runs slow). | |
| 878 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | |
| 879 MatchTab("title1.html"), ColumnSpecifier::IDLE_WAKEUPS, 100)); | |
| 880 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | |
| 881 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); | |
| 882 } | |
| 883 | |
| 853 // Checks that task manager counts utility process JS heap size. | 884 // Checks that task manager counts utility process JS heap size. |
| 854 IN_PROC_BROWSER_TEST_F(TaskManagerUtilityProcessBrowserTest, | 885 IN_PROC_BROWSER_TEST_F(TaskManagerUtilityProcessBrowserTest, |
| 855 UtilityJSHeapMemory) { | 886 UtilityJSHeapMemory) { |
| 856 ShowTaskManager(); | 887 ShowTaskManager(); |
| 857 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY); | 888 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY); |
| 858 | 889 |
| 859 auto proxy_resolver_name = | 890 auto proxy_resolver_name = |
| 860 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); | 891 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); |
| 861 ui_test_utils::NavigateToURL(browser(), GetTestURL()); | 892 ui_test_utils::NavigateToURL(browser(), GetTestURL()); |
| 862 // The PAC script is trivial, so don't expect a large heap. | 893 // The PAC script is trivial, so don't expect a large heap. |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1253 | 1284 |
| 1254 // Because the subframes for tab 2 are nested, their order is deterministic. | 1285 // Because the subframes for tab 2 are nested, their order is deterministic. |
| 1255 EXPECT_EQ("Subframe: http://a.com/", | 1286 EXPECT_EQ("Subframe: http://a.com/", |
| 1256 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); | 1287 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); |
| 1257 EXPECT_EQ("Subframe: http://c.com/", | 1288 EXPECT_EQ("Subframe: http://c.com/", |
| 1258 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); | 1289 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); |
| 1259 EXPECT_EQ("Subframe: http://b.com/", | 1290 EXPECT_EQ("Subframe: http://b.com/", |
| 1260 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); | 1291 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); |
| 1261 } | 1292 } |
| 1262 } | 1293 } |
| OLD | NEW |