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

Side by Side Diff: chrome/browser/task_management/task_manager_browsertest.cc

Issue 2178733002: Task manager should support Idle Wakeups on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handling missing results in OnRefreshDone. Created 4 years, 4 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
OLDNEW
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
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) {
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"
863 " setTimeout(function() { myWait(); }, 1)\n"
864 "}\n"
865 "myWait();\n"
866 "window.domAutomationController.send(\"okay\");\n";
867
868 std::string ok;
869 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
870 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok));
871 ASSERT_EQ("okay", ok);
872
873 // The script above should trigger a lot of idle wakeups - up to 1000 per
874 // second. Let's make sure we get at least 100 (in case the test runs slow).
875 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed(
876 MatchTab("title1.html"), ColumnSpecifier::IDLE_WAKEUPS, 100));
877 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
878 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html")));
879 }
880
853 // Checks that task manager counts utility process JS heap size. 881 // Checks that task manager counts utility process JS heap size.
854 IN_PROC_BROWSER_TEST_F(TaskManagerUtilityProcessBrowserTest, 882 IN_PROC_BROWSER_TEST_F(TaskManagerUtilityProcessBrowserTest,
855 UtilityJSHeapMemory) { 883 UtilityJSHeapMemory) {
856 ShowTaskManager(); 884 ShowTaskManager();
857 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY); 885 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY);
858 886
859 auto proxy_resolver_name = 887 auto proxy_resolver_name =
860 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); 888 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
861 ui_test_utils::NavigateToURL(browser(), GetTestURL()); 889 ui_test_utils::NavigateToURL(browser(), GetTestURL());
862 // The PAC script is trivial, so don't expect a large heap. 890 // The PAC script is trivial, so don't expect a large heap.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 1281
1254 // Because the subframes for tab 2 are nested, their order is deterministic. 1282 // Because the subframes for tab 2 are nested, their order is deterministic.
1255 EXPECT_EQ("Subframe: http://a.com/", 1283 EXPECT_EQ("Subframe: http://a.com/",
1256 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); 1284 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1)));
1257 EXPECT_EQ("Subframe: http://c.com/", 1285 EXPECT_EQ("Subframe: http://c.com/",
1258 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); 1286 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2)));
1259 EXPECT_EQ("Subframe: http://b.com/", 1287 EXPECT_EQ("Subframe: http://b.com/",
1260 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); 1288 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3)));
1261 } 1289 }
1262 } 1290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698