| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 // Write the values of its DOM 'dir' attribute and its CSS 'direction' | 1429 // Write the values of its DOM 'dir' attribute and its CSS 'direction' |
| 1430 // property to the <div> element. | 1430 // property to the <div> element. |
| 1431 ExecuteJavaScriptForTests( | 1431 ExecuteJavaScriptForTests( |
| 1432 "var result = document.getElementById('result');" | 1432 "var result = document.getElementById('result');" |
| 1433 "var node = document.getElementById('test');" | 1433 "var node = document.getElementById('test');" |
| 1434 "var style = getComputedStyle(node, null);" | 1434 "var style = getComputedStyle(node, null);" |
| 1435 "result.innerText =" | 1435 "result.innerText =" |
| 1436 " node.getAttribute('dir') + ',' +" | 1436 " node.getAttribute('dir') + ',' +" |
| 1437 " style.getPropertyValue('direction');"); | 1437 " style.getPropertyValue('direction');"); |
| 1438 | 1438 |
| 1439 // Required to see any updates in dumpFrameTreeAsText. |
| 1440 view()->GetWebView()->updateAllLifecyclePhases(); |
| 1441 |
| 1439 // Copy the document content to std::wstring and compare with the | 1442 // Copy the document content to std::wstring and compare with the |
| 1440 // expected result. | 1443 // expected result. |
| 1441 const int kMaxOutputCharacters = 16; | 1444 const int kMaxOutputCharacters = 16; |
| 1442 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( | 1445 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( |
| 1443 GetMainFrame(), kMaxOutputCharacters); | 1446 GetMainFrame(), kMaxOutputCharacters); |
| 1444 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output); | 1447 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output); |
| 1445 } | 1448 } |
| 1446 } | 1449 } |
| 1447 | 1450 |
| 1448 // Test that we can receive correct DOM events when we send input events | 1451 // Test that we can receive correct DOM events when we send input events |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 sizeof(expected_result), | 1572 sizeof(expected_result), |
| 1570 "\n" // texts in the <input> element | 1573 "\n" // texts in the <input> element |
| 1571 "%d,%s\n" // texts in the first <div> element | 1574 "%d,%s\n" // texts in the first <div> element |
| 1572 "%d,%s\n" // texts in the second <div> element | 1575 "%d,%s\n" // texts in the second <div> element |
| 1573 "%d,%s", // texts in the third <div> element | 1576 "%d,%s", // texts in the third <div> element |
| 1574 key_code, kModifierData[j].expected_result, | 1577 key_code, kModifierData[j].expected_result, |
| 1575 static_cast<int>(char_code[0]), | 1578 static_cast<int>(char_code[0]), |
| 1576 kModifierData[j].expected_result, | 1579 kModifierData[j].expected_result, |
| 1577 key_code, kModifierData[j].expected_result); | 1580 key_code, kModifierData[j].expected_result); |
| 1578 | 1581 |
| 1582 // Required to see any updates in dumpFrameTreeAsText. |
| 1583 view()->GetWebView()->updateAllLifecyclePhases(); |
| 1584 |
| 1579 // Retrieve the text in the test page and compare it with the expected | 1585 // Retrieve the text in the test page and compare it with the expected |
| 1580 // text created from a virtual-key code, a character code, and the | 1586 // text created from a virtual-key code, a character code, and the |
| 1581 // modifier-key status. | 1587 // modifier-key status. |
| 1582 const int kMaxOutputCharacters = 1024; | 1588 const int kMaxOutputCharacters = 1024; |
| 1583 std::string output = base::UTF16ToUTF8( | 1589 std::string output = base::UTF16ToUTF8( |
| 1584 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( | 1590 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( |
| 1585 GetMainFrame(), kMaxOutputCharacters))); | 1591 GetMainFrame(), kMaxOutputCharacters))); |
| 1586 EXPECT_EQ(expected_result, output); | 1592 EXPECT_EQ(expected_result, output); |
| 1587 } | 1593 } |
| 1588 } | 1594 } |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2793 FROM_HERE, | 2799 FROM_HERE, |
| 2794 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2800 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2795 ExecuteJavaScriptForTests("debugger;"); | 2801 ExecuteJavaScriptForTests("debugger;"); |
| 2796 | 2802 |
| 2797 // CloseWhilePaused should resume execution and continue here. | 2803 // CloseWhilePaused should resume execution and continue here. |
| 2798 EXPECT_FALSE(IsPaused()); | 2804 EXPECT_FALSE(IsPaused()); |
| 2799 Detach(); | 2805 Detach(); |
| 2800 } | 2806 } |
| 2801 | 2807 |
| 2802 } // namespace content | 2808 } // namespace content |
| OLD | NEW |