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

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

Issue 2798563003: [scheduler] Add TaskQueue::Observer (Closed)
Patch Set: add todo for test timings & wake_up -> wake-up in comments 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 #define MAYBE_VirtualTimeTest VirtualTimeTest 1323 #define MAYBE_VirtualTimeTest VirtualTimeTest
1324 #endif 1324 #endif
1325 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, MAYBE_VirtualTimeTest) { 1325 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, MAYBE_VirtualTimeTest) {
1326 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); 1326 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
1327 Attach(); 1327 Attach();
1328 1328
1329 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 1329 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
1330 params->SetString("policy", "pause"); 1330 params->SetString("policy", "pause");
1331 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); 1331 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
1332 1332
1333 // TODO(scheduler-dev): Revisit timing when we have strict ordering
Sami 2017/04/05 13:16:51 Can we now also enable this for Android?
altimin 2017/04/05 13:55:18 Let's ask Alex when he's back.
Sami 2017/04/05 14:38:15 I'm pretty sure we can -- this was the bug I was f
altimin 2017/04/05 15:10:22 I'll try it in a separate CL.
Sami 2017/04/05 15:16:55 Let's do it here since this is actually the patch
altimin 2017/04/05 15:23:33 Done.
1334 // guarantees.
1333 params.reset(new base::DictionaryValue()); 1335 params.reset(new base::DictionaryValue());
1334 params->SetString("expression", 1336 params->SetString("expression",
1335 "setTimeout(function(){console.log('before')}, 1000);" 1337 "setTimeout(function(){console.log('before')}, 1000);"
1336 "setTimeout(function(){console.log('after')}, 1001);"); 1338 "setTimeout(function(){console.log('after')}, 1002);");
1337 SendCommand("Runtime.evaluate", std::move(params), true); 1339 SendCommand("Runtime.evaluate", std::move(params), true);
1338 1340
1339 // Let virtual time advance for one second. 1341 // Let virtual time advance for one second.
1340 params.reset(new base::DictionaryValue()); 1342 params.reset(new base::DictionaryValue());
1341 params->SetString("policy", "advance"); 1343 params->SetString("policy", "advance");
1342 params->SetInteger("budget", 1000); 1344 params->SetInteger("budget", 1001);
1343 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); 1345 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
1344 1346
1345 WaitForNotification("Emulation.virtualTimeBudgetExpired"); 1347 WaitForNotification("Emulation.virtualTimeBudgetExpired");
1346 1348
1347 params.reset(new base::DictionaryValue()); 1349 params.reset(new base::DictionaryValue());
1348 params->SetString("expression", "console.log('done')"); 1350 params->SetString("expression", "console.log('done')");
1349 SendCommand("Runtime.evaluate", std::move(params), true); 1351 SendCommand("Runtime.evaluate", std::move(params), true);
1350 1352
1351 // The second timer shold not fire. 1353 // The second timer shold not fire.
1352 EXPECT_THAT(console_messages_, ElementsAre("before", "done")); 1354 EXPECT_THAT(console_messages_, ElementsAre("before", "done"));
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 EXPECT_EQ("polyglottal", value); 1766 EXPECT_EQ("polyglottal", value);
1765 found++; 1767 found++;
1766 } else { 1768 } else {
1767 FAIL(); 1769 FAIL();
1768 } 1770 }
1769 } 1771 }
1770 EXPECT_EQ(2u, found); 1772 EXPECT_EQ(2u, found);
1771 } 1773 }
1772 1774
1773 } // namespace content 1775 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698