Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 #include "public/web/WebAutofillClient.h" | 59 #include "public/web/WebAutofillClient.h" |
| 60 #include "public/web/WebContentDetectionResult.h" | 60 #include "public/web/WebContentDetectionResult.h" |
| 61 #include "public/web/WebDateTimeChooserCompletion.h" | 61 #include "public/web/WebDateTimeChooserCompletion.h" |
| 62 #include "public/web/WebDocument.h" | 62 #include "public/web/WebDocument.h" |
| 63 #include "public/web/WebDragOperation.h" | 63 #include "public/web/WebDragOperation.h" |
| 64 #include "public/web/WebElement.h" | 64 #include "public/web/WebElement.h" |
| 65 #include "public/web/WebFrame.h" | 65 #include "public/web/WebFrame.h" |
| 66 #include "public/web/WebFrameClient.h" | 66 #include "public/web/WebFrameClient.h" |
| 67 #include "public/web/WebHitTestResult.h" | 67 #include "public/web/WebHitTestResult.h" |
| 68 #include "public/web/WebInputEvent.h" | 68 #include "public/web/WebInputEvent.h" |
| 69 #include "public/web/WebScriptSource.h" | |
| 69 #include "public/web/WebSettings.h" | 70 #include "public/web/WebSettings.h" |
| 70 #include "public/web/WebViewClient.h" | 71 #include "public/web/WebViewClient.h" |
| 71 #include "public/web/WebWidget.h" | 72 #include "public/web/WebWidget.h" |
| 72 #include "public/web/WebWidgetClient.h" | 73 #include "public/web/WebWidgetClient.h" |
| 73 #include "third_party/skia/include/core/SkBitmap.h" | 74 #include "third_party/skia/include/core/SkBitmap.h" |
| 74 #include "third_party/skia/include/core/SkBitmapDevice.h" | 75 #include "third_party/skia/include/core/SkBitmapDevice.h" |
| 75 #include "third_party/skia/include/core/SkCanvas.h" | 76 #include "third_party/skia/include/core/SkCanvas.h" |
| 76 #include "web/WebLocalFrameImpl.h" | 77 #include "web/WebLocalFrameImpl.h" |
| 77 #include "web/WebSettingsImpl.h" | 78 #include "web/WebSettingsImpl.h" |
| 78 #include "web/WebViewImpl.h" | 79 #include "web/WebViewImpl.h" |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2130 webView->setInitialFocus(false); | 2131 webView->setInitialFocus(false); |
| 2131 | 2132 |
| 2132 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 2133 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
| 2133 | 2134 |
| 2134 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); | 2135 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); |
| 2135 | 2136 |
| 2136 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 2137 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
| 2137 webView->setAutofillClient(0); | 2138 webView->setAutofillClient(0); |
| 2138 } | 2139 } |
| 2139 | 2140 |
| 2141 TEST_F(WebViewTest, OnTTSUtteranceForNoSelection) | |
|
jamesr
2014/08/12 23:34:15
this test doesn't have anything to do with TTS. it
| |
| 2142 { | |
| 2143 // Note: This is a test to somewhat simulate a CL submitted for | |
| 2144 // crbug.com/248426. Follow https://codereview.chromium.org/342143004/. | |
| 2145 // As of now there is no good way to test a TTS session. Since the patch | |
| 2146 // uses contentAsText() to fetch fully rendered text from a web content | |
| 2147 // it is okay to check if text returned from SelectAll is same as | |
| 2148 // contentAsText(). | |
|
jamesr
2014/08/12 23:34:15
none of this comment has anything to do with what
| |
| 2149 // TODO(a.sarkar.arun@gmail.com): When Chromium has a better support for | |
| 2150 // testing TTS extensively, this test should be improved and moved to a | |
| 2151 // more appropriate place. | |
| 2152 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("longpress_selection.html")); | |
| 2153 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_ selection.html", true); | |
| 2154 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | |
| 2155 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)"))); | |
| 2156 | |
| 2157 std::string output1 = frame->selectionAsText().utf8(); | |
|
jamesr
2014/08/12 23:34:15
output1 isn't a very useful variable name. what do
| |
| 2158 | |
| 2159 const int kMaxOutputCharacters = 1024; | |
| 2160 std::string output = frame->contentAsText(kMaxOutputCharacters).utf8(); | |
| 2161 EXPECT_EQ(output1, output); | |
| 2162 | |
| 2163 } | |
| 2164 | |
| 2140 } // namespace | 2165 } // namespace |
| OLD | NEW |