| 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..c33abed959fc7f49878098b9e96a73f4dd622b88 100644
|
| --- a/content/renderer/render_view_browsertest_mac.mm
|
| +++ b/content/renderer/render_view_browsertest_mac.mm
|
| @@ -140,4 +140,42 @@ TEST_F(RenderViewTest, MacTestCmdUp) {
|
| EXPECT_EQ(kArrowUpNoScroll, base::UTF16ToASCII(output));
|
| }
|
|
|
| +TEST_F(RenderViewTest, OnTtsForEmptySelection) {
|
| + #define HTML(s) #s
|
| + 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();
|
| + // contentAsText doesn't depend on scroll position or focussed frame location
|
| + // hence the returned value would be same throughout.
|
| + // Scroll down further.
|
| + ExecuteJavaScript("window.scrollTo(0, 9030)");
|
| + // 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
|
|
|