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

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 2786083005: scheduler: Maintain a constant enqueue order for every task (Closed)
Patch Set: Update VirtualTimeTest Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 } 1350 }
1351 1351
1352 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) { 1352 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) {
1353 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); 1353 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
1354 Attach(); 1354 Attach();
1355 1355
1356 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 1356 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
1357 params->SetString("policy", "pause"); 1357 params->SetString("policy", "pause");
1358 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); 1358 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
1359 1359
1360 // TODO(scheduler-dev): Revisit timing when we have strict ordering
1361 // guarantees.
1362 params.reset(new base::DictionaryValue()); 1360 params.reset(new base::DictionaryValue());
1363 params->SetString("expression", 1361 params->SetString("expression",
1364 "setTimeout(function(){console.log('before')}, 1000);" 1362 "setTimeout(function(){console.log('before')}, 1000);"
1365 "setTimeout(function(){console.log('after')}, 1002);"); 1363 "setTimeout(function(){console.log('after')}, 1001);");
1366 SendCommand("Runtime.evaluate", std::move(params), true); 1364 SendCommand("Runtime.evaluate", std::move(params), true);
1367 1365
1368 // Let virtual time advance for one second. 1366 // Let virtual time advance for one second.
1369 params.reset(new base::DictionaryValue()); 1367 params.reset(new base::DictionaryValue());
1370 params->SetString("policy", "advance"); 1368 params->SetString("policy", "advance");
1371 params->SetInteger("budget", 1001); 1369 params->SetInteger("budget", 1000);
1372 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); 1370 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
1373 1371
1374 WaitForNotification("Emulation.virtualTimeBudgetExpired"); 1372 WaitForNotification("Emulation.virtualTimeBudgetExpired");
1375 1373
1376 params.reset(new base::DictionaryValue()); 1374 params.reset(new base::DictionaryValue());
1377 params->SetString("expression", "console.log('done')"); 1375 params->SetString("expression", "console.log('done')");
1378 SendCommand("Runtime.evaluate", std::move(params), true); 1376 SendCommand("Runtime.evaluate", std::move(params), true);
1379 1377
1380 // The second timer shold not fire. 1378 // The second timer shold not fire.
1381 EXPECT_THAT(console_messages_, ElementsAre("before", "done")); 1379 EXPECT_THAT(console_messages_, ElementsAre("before", "done"));
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 EXPECT_EQ("polyglottal", value); 1791 EXPECT_EQ("polyglottal", value);
1794 found++; 1792 found++;
1795 } else { 1793 } else {
1796 FAIL(); 1794 FAIL();
1797 } 1795 }
1798 } 1796 }
1799 EXPECT_EQ(2u, found); 1797 EXPECT_EQ(2u, found);
1800 } 1798 }
1801 1799
1802 } // namespace content 1800 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698