| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (C) 2012 Samsung Electronics. All rights reserved. | 2 Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| 3 | 3 |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 1. Redistributions of source code must retain the above copyright | 8 1. Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 2. Redistributions in binary form must reproduce the above copyright | 10 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 InspectorTest.pageReloaded = function() | 367 InspectorTest.pageReloaded = function() |
| 368 { | 368 { |
| 369 InspectorTest.log("Page reloaded."); | 369 InspectorTest.log("Page reloaded."); |
| 370 var callback = InspectorTest._pageLoadedCallback; | 370 var callback = InspectorTest._pageLoadedCallback; |
| 371 delete InspectorTest._pageLoadedCallback; | 371 delete InspectorTest._pageLoadedCallback; |
| 372 if (callback) | 372 if (callback) |
| 373 callback(); | 373 callback(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 InspectorTest.reloadProtocolTest = function(ignoreCache, callback) |
| 377 { |
| 378 InspectorTest._pageLoadedCallback = afterReload; |
| 379 // This will ensure we maintain logs after navigate. |
| 380 |
| 381 getLogs(getOldLogsCallback); |
| 382 |
| 383 function getLogs(getLogsCallback) |
| 384 { |
| 385 InspectorTest.evaluateInPage("outputElement.innerHTML", data => getLogsC
allback(data.split("<br>"))); |
| 386 } |
| 387 |
| 388 function clearLogs(clearLogsCallback) |
| 389 { |
| 390 InspectorTest.evaluateInPage("outputElement.textContent = \"\"", clearLo
gsCallback); |
| 391 } |
| 392 |
| 393 var oldLogs; |
| 394 |
| 395 function getOldLogsCallback(data) |
| 396 { |
| 397 oldLogs = data; |
| 398 prepareForReload(); |
| 399 } |
| 400 |
| 401 function prepareForReload() |
| 402 { |
| 403 InspectorTest.evaluateInPage("prepareForReload()", reload); |
| 404 } |
| 405 |
| 406 function reload() |
| 407 { |
| 408 InspectorTest.sendCommand("Page.reload", { "ignoreCache": ignoreCache })
; |
| 409 } |
| 410 |
| 411 function afterReload() |
| 412 { |
| 413 var currentLogs; |
| 414 getLogs(data => { |
| 415 currentLogs = data; |
| 416 clearLogs(addLogsBack); |
| 417 }); |
| 418 |
| 419 function addLogsBack() |
| 420 { |
| 421 for (var log of oldLogs) |
| 422 InspectorTest.log(log); |
| 423 for (var log of currentLogs) |
| 424 InspectorTest.log(log); |
| 425 callback(); |
| 426 } |
| 427 } |
| 428 } |
| 429 |
| 376 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); | 430 window.addEventListener("load", InspectorTest.readyForTest.bind(InspectorTest),
false); |
| 377 | 431 |
| 378 </script> | 432 </script> |
| 379 </head> | 433 </head> |
| 380 </html> | 434 </html> |
| OLD | NEW |