Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 1150953003: Remove IME API interface usage from Chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 // An error occurred. 2149 // An error occurred.
2150 view()->GetMainRenderFrame()->didFailProvisionalLoad( 2150 view()->GetMainRenderFrame()->didFailProvisionalLoad(
2151 web_frame, error, blink::WebStandardCommit); 2151 web_frame, error, blink::WebStandardCommit);
2152 // The error page itself is loaded asynchronously. 2152 // The error page itself is loaded asynchronously.
2153 FrameLoadWaiter(frame()).Wait(); 2153 FrameLoadWaiter(frame()).Wait();
2154 const int kMaxOutputCharacters = 22; 2154 const int kMaxOutputCharacters = 22;
2155 EXPECT_EQ("A suffusion of yellow.", 2155 EXPECT_EQ("A suffusion of yellow.",
2156 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); 2156 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters)));
2157 } 2157 }
2158 2158
2159 // Tests if IME API's candidatewindow* events sent from browser are handled
2160 // in renderer.
2161 TEST_F(RenderViewImplTest, SendCandidateWindowEvents) {
2162 // Sends an HTML with an <input> element and scripts to the renderer.
2163 // The script handles all 3 of candidatewindow* events for an
2164 // InputMethodContext object and once it received 'show', 'update', 'hide'
2165 // should appear in the result div.
2166 LoadHTML("<input id='test'>"
2167 "<div id='result'>Result: </div>"
2168 "<script>"
2169 "window.onload = function() {"
2170 " var result = document.getElementById('result');"
2171 " var test = document.getElementById('test');"
2172 " test.focus();"
2173 " var context = test.inputMethodContext;"
2174 " if (context) {"
2175 " context.oncandidatewindowshow = function() {"
2176 " result.innerText += 'show'; };"
2177 " context.oncandidatewindowupdate = function(){"
2178 " result.innerText += 'update'; };"
2179 " context.oncandidatewindowhide = function(){"
2180 " result.innerText += 'hide'; };"
2181 " }"
2182 "};"
2183 "</script>");
2184
2185 // Fire candidatewindow events.
2186 view()->OnCandidateWindowShown();
2187 view()->OnCandidateWindowUpdated();
2188 view()->OnCandidateWindowHidden();
2189
2190 // Retrieve the content and check if it is expected.
2191 const int kMaxOutputCharacters = 50;
2192 std::string output = base::UTF16ToUTF8(
2193 GetMainFrame()->contentAsText(kMaxOutputCharacters));
2194 EXPECT_EQ(output, "\nResult:showupdatehide");
2195 }
2196
2197 // Ensure the render view sends favicon url update events correctly. 2159 // Ensure the render view sends favicon url update events correctly.
2198 TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) { 2160 TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) {
2199 // An event should be sent when a favicon url exists. 2161 // An event should be sent when a favicon url exists.
2200 LoadHTML("<html>" 2162 LoadHTML("<html>"
2201 "<head>" 2163 "<head>"
2202 "<link rel='icon' href='http://www.google.com/favicon.ico'>" 2164 "<link rel='icon' href='http://www.google.com/favicon.ico'>"
2203 "</head>" 2165 "</head>"
2204 "</html>"); 2166 "</html>");
2205 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( 2167 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching(
2206 ViewHostMsg_UpdateFaviconURL::ID)); 2168 ViewHostMsg_UpdateFaviconURL::ID));
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 FROM_HERE, 2394 FROM_HERE,
2433 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2395 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2434 ExecuteJavaScript("debugger;"); 2396 ExecuteJavaScript("debugger;");
2435 2397
2436 // CloseWhilePaused should resume execution and continue here. 2398 // CloseWhilePaused should resume execution and continue here.
2437 EXPECT_FALSE(IsPaused()); 2399 EXPECT_FALSE(IsPaused());
2438 Detach(); 2400 Detach();
2439 } 2401 }
2440 2402
2441 } // namespace content 2403 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698