Chromium Code Reviews| Index: content/renderer/render_view_browsertest_mac.mm |
| diff --git a/content/renderer/render_view_browsertest_mac.mm b/content/renderer/render_view_browsertest_mac.mm |
| index b2473c6f40a1d443bd9c42ebe455600c6c24a897..a68e160aa67c363f3b5b62686acdc33025a66560 100644 |
| --- a/content/renderer/render_view_browsertest_mac.mm |
| +++ b/content/renderer/render_view_browsertest_mac.mm |
| @@ -140,4 +140,39 @@ TEST_F(RenderViewTest, MacTestCmdUp) { |
| EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output)); |
| } |
| +TEST_F(RenderViewTest, OnTtsForEmptySelection) { |
|
dcheng
2014/08/06 02:09:28
This test feels out of place in Chrome. contentAsT
|
| + #define HTML(s) #s |
|
dcheng
2014/08/06 02:09:28
Is this really a common idiom? I think it's better
|
| + const char* kRawHtml = HTML( |
| + <!DOCTYPE html> |
| + <style> |
| + /* Add a vertical scrollbar */ |
| + body { height: 10128px; } |
| + </style> |
| + <div id='text'> |
| + <p> A "Hello World" program has become the traditional first program that |
| + many people learn. In general it is simple enough so that people who |
| + experience with computer programming can easily understand it especially |
| + the guidance of a teacher a written guide. Using this simple program |
| + basis computer science principles elements of a specific programming |
| + language can be explained to novice programmers. Experienced programmers |
| + learning languages can also gain a lot of information about a given |
| + languages syntax structure from a hello world program. </p> |
| + </div> |
| + ); |
| + #undef HTML |
| + |
| + RenderViewImpl* view = static_cast<RenderViewImpl*>(view_); |
| + view->set_send_content_state_immediately(true); |
| + LoadHTML(kRawHtml); |
| + render_thread_->sink().ClearMessages(); |
| + |
| + // Execute a command to Select all text in DOM. |
| + ExecuteJavaScript("document.execCommand('SelectAll', false, null)"); |
| + |
| + const int kMaxOutputCharacters = 1024; |
| + base::string16 output = GetMainFrame()->contentAsText(kMaxOutputCharacters); |
| + base::string16 select_all_text = GetMainFrame()->selectionAsText(); |
| + EXPECT_EQ(output, select_all_text); |
| +} |
| + |
| } // namespace content |