OLD | NEW |
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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); | 1309 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
1310 params->SetInteger("width", new_size.width()); | 1310 params->SetInteger("width", new_size.width()); |
1311 params->SetInteger("height", new_size.height()); | 1311 params->SetInteger("height", new_size.height()); |
1312 SendCommand("Emulation.setVisibleSize", std::move(params), true); | 1312 SendCommand("Emulation.setVisibleSize", std::move(params), true); |
1313 EXPECT_SIZE_EQ(new_size, (shell()->web_contents()) | 1313 EXPECT_SIZE_EQ(new_size, (shell()->web_contents()) |
1314 ->GetRenderWidgetHostView() | 1314 ->GetRenderWidgetHostView() |
1315 ->GetViewBounds() | 1315 ->GetViewBounds() |
1316 .size()); | 1316 .size()); |
1317 } | 1317 } |
1318 | 1318 |
1319 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) { | 1319 // TODO(701223): Enable this on android. |
| 1320 #if defined(OS_ANDROID) |
| 1321 #define MAYBE_VirtualTimeTest DISABLED_VirtualTimeTest |
| 1322 #else |
| 1323 #define MAYBE_VirtualTimeTest VirtualTimeTest |
| 1324 #endif |
| 1325 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, MAYBE_VirtualTimeTest) { |
1320 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); | 1326 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
1321 Attach(); | 1327 Attach(); |
1322 | 1328 |
1323 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); | 1329 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
1324 params->SetString("policy", "pause"); | 1330 params->SetString("policy", "pause"); |
1325 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); | 1331 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); |
1326 | 1332 |
1327 // TODO(scheduler-dev): Revisit timing when we have strict ordering | |
1328 // guarantees. | |
1329 params.reset(new base::DictionaryValue()); | 1333 params.reset(new base::DictionaryValue()); |
1330 params->SetString("expression", | 1334 params->SetString("expression", |
1331 "setTimeout(function(){console.log('before')}, 1000);" | 1335 "setTimeout(function(){console.log('before')}, 1000);" |
1332 "setTimeout(function(){console.log('after')}, 1002);"); | 1336 "setTimeout(function(){console.log('after')}, 1001);"); |
1333 SendCommand("Runtime.evaluate", std::move(params), true); | 1337 SendCommand("Runtime.evaluate", std::move(params), true); |
1334 | 1338 |
1335 // Let virtual time advance for one second. | 1339 // Let virtual time advance for one second. |
1336 params.reset(new base::DictionaryValue()); | 1340 params.reset(new base::DictionaryValue()); |
1337 params->SetString("policy", "advance"); | 1341 params->SetString("policy", "advance"); |
1338 params->SetInteger("budget", 1001); | 1342 params->SetInteger("budget", 1000); |
1339 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); | 1343 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); |
1340 | 1344 |
1341 WaitForNotification("Emulation.virtualTimeBudgetExpired"); | 1345 WaitForNotification("Emulation.virtualTimeBudgetExpired"); |
1342 | 1346 |
1343 params.reset(new base::DictionaryValue()); | 1347 params.reset(new base::DictionaryValue()); |
1344 params->SetString("expression", "console.log('done')"); | 1348 params->SetString("expression", "console.log('done')"); |
1345 SendCommand("Runtime.evaluate", std::move(params), true); | 1349 SendCommand("Runtime.evaluate", std::move(params), true); |
1346 | 1350 |
1347 // The second timer shold not fire. | 1351 // The second timer shold not fire. |
1348 EXPECT_THAT(console_messages_, ElementsAre("before", "done")); | 1352 EXPECT_THAT(console_messages_, ElementsAre("before", "done")); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 EXPECT_EQ("polyglottal", value); | 1764 EXPECT_EQ("polyglottal", value); |
1761 found++; | 1765 found++; |
1762 } else { | 1766 } else { |
1763 FAIL(); | 1767 FAIL(); |
1764 } | 1768 } |
1765 } | 1769 } |
1766 EXPECT_EQ(2u, found); | 1770 EXPECT_EQ(2u, found); |
1767 } | 1771 } |
1768 | 1772 |
1769 } // namespace content | 1773 } // namespace content |
OLD | NEW |