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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 330613002: Copying text closes the keyboard and the text input gets unfocused, forcing virtual keyboard is get… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed FrameSelection changes and making use of existing APIs for serving the requirement. Created 6 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 | « Source/web/WebRemoteFrameImpl.cpp ('k') | Source/web/tests/data/selection_collapse_to_end.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 4259 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 frame->removeSpellingMarkers(); 4270 frame->removeSpellingMarkers();
4271 4271
4272 const int allTextBeginOffset = 0; 4272 const int allTextBeginOffset = 0;
4273 const int allTextLength = 11; 4273 const int allTextLength = 11;
4274 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al lTextLength)); 4274 frame->selectRange(WebRange::fromDocumentRange(frame, allTextBeginOffset, al lTextLength));
4275 RefPtrWillBeRawPtr<Range> selectionRange = frame->frame()->selection().toNor malizedRange(); 4275 RefPtrWillBeRawPtr<Range> selectionRange = frame->frame()->selection().toNor malizedRange();
4276 4276
4277 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), Docum entMarker::Spelling).size()); 4277 EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), Docum entMarker::Spelling).size());
4278 } 4278 }
4279 4279
4280 #if OS(ANDROID)
4281 TEST_F(WebFrameTest, selectionCollapseToEnd)
4282 {
4283 registerMockedHttpURLLoad("select_collapse_to_end.html");
4284 FrameTestHelpers::WebViewHelper webViewHelper;
4285
4286 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main Frame());
4287 Document* document = frame->frame()->document();
4288 Element* element = document->getElementById("target");
4289 element->focus();
4290 document->execCommand("InsertText", false, "This is a sample text");
4291 const int selectionBeginOffset = 0;
4292 const int selectionEndOffset = 5;
4293 frame->selectRange(WebRange::fromDocumentRange(frame, selectionBeginOffset, selectionEndOffset));
4294 frame->executeCommand(WebString::fromUTF8("Copy"), frame->document().focused Element());
4295 if (frame->setCaretSelectionFromRangeSelection()) {
4296 WebRange range = frame->selectionRange();
4297 EXPECT_EQ(5, range.startOffset());
4298 EXPECT_EQ(5, range.endOffset());
4299 }
4300 }
4301 #endif
4302
4280 TEST_F(WebFrameTest, MarkerHashIdentifiers) { 4303 TEST_F(WebFrameTest, MarkerHashIdentifiers) {
4281 registerMockedHttpURLLoad("spell.html"); 4304 registerMockedHttpURLLoad("spell.html");
4282 FrameTestHelpers::WebViewHelper webViewHelper; 4305 FrameTestHelpers::WebViewHelper webViewHelper;
4283 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); 4306 webViewHelper.initializeAndLoad(m_baseURL + "spell.html");
4284 4307
4285 static const uint32_t kHash = 42; 4308 static const uint32_t kHash = 42;
4286 SpellCheckClient spellcheck(kHash); 4309 SpellCheckClient spellcheck(kHash);
4287 webViewHelper.webView()->setSpellCheckClient(&spellcheck); 4310 webViewHelper.webView()->setSpellCheckClient(&spellcheck);
4288 4311
4289 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main Frame()); 4312 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main Frame());
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
5577 { 5600 {
5578 registerMockedHttpURLLoad("brand_color_test.html"); 5601 registerMockedHttpURLLoad("brand_color_test.html");
5579 FrameTestHelpers::WebViewHelper webViewHelper; 5602 FrameTestHelpers::WebViewHelper webViewHelper;
5580 BrandColorTestWebFrameClient client; 5603 BrandColorTestWebFrameClient client;
5581 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client); 5604 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client);
5582 EXPECT_TRUE(client.didNotify()); 5605 EXPECT_TRUE(client.didNotify());
5583 EXPECT_EQ(0xff0000ff, client.brandColor()); 5606 EXPECT_EQ(0xff0000ff, client.brandColor());
5584 } 5607 }
5585 5608
5586 } // namespace 5609 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebRemoteFrameImpl.cpp ('k') | Source/web/tests/data/selection_collapse_to_end.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698