 Chromium Code Reviews
 Chromium Code Reviews Issue 8702002:
  Strip invalid characters (line breaks, tabs), javascript:schemes from the copied text while pasti...  (Closed) 
  Base URL: http://src.chromium.org/svn/trunk/src/
    
  
    Issue 8702002:
  Strip invalid characters (line breaks, tabs), javascript:schemes from the copied text while pasti...  (Closed) 
  Base URL: http://src.chromium.org/svn/trunk/src/| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdio.h> | 5 #include <stdio.h> | 
| 6 | 6 | 
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" | 
| 8 #include "base/string16.h" | 8 #include "base/string16.h" | 
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" | 
| 10 #include "base/time.h" | 10 #include "base/time.h" | 
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 750 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); | 750 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); | 
| 751 ASSERT_EQ(text, omnibox_view->model()->keyword()); | 751 ASSERT_EQ(text, omnibox_view->model()->keyword()); | 
| 752 ASSERT_TRUE(omnibox_view->GetText().empty()); | 752 ASSERT_TRUE(omnibox_view->GetText().empty()); | 
| 753 | 753 | 
| 754 // Revert to keyword hint mode. | 754 // Revert to keyword hint mode. | 
| 755 omnibox_view->model()->ClearKeyword(string16()); | 755 omnibox_view->model()->ClearKeyword(string16()); | 
| 756 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); | 756 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); | 
| 757 ASSERT_EQ(text, omnibox_view->model()->keyword()); | 757 ASSERT_EQ(text, omnibox_view->model()->keyword()); | 
| 758 ASSERT_EQ(text, omnibox_view->GetText()); | 758 ASSERT_EQ(text, omnibox_view->GetText()); | 
| 759 | 759 | 
| 760 // Keyword shouldn't be accepted by pasting. | 760 // Keyword shouldn't be accepted by pasting. | 
| 
Peter Kasting
2011/11/29 19:07:28
This block should be removed (since no platforms s
 
SanjoyPal
2011/11/30 06:49:26
Done.
 | |
| 761 // Simulate pasting a whitespace to the end of content. | 761 // Simulate pasting a whitespace to the end of content. | 
| 762 omnibox_view->OnBeforePossibleChange(); | 762 omnibox_view->OnBeforePossibleChange(); | 
| 763 omnibox_view->model()->on_paste(); | 763 omnibox_view->model()->on_paste(); | 
| 764 omnibox_view->SetWindowTextAndCaretPos( | 764 omnibox_view->SetWindowTextAndCaretPos( | 
| 765 text + char16(' '), text.length() + 1); | 765 text + char16(' '), text.length() + 1); | 
| 766 omnibox_view->OnAfterPossibleChange(); | 766 omnibox_view->OnAfterPossibleChange(); | 
| 767 // Should be still in keyword hint mode. | 767 // Should be still in keyword hint mode. | 
| 768 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); | 768 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); | 
| 769 ASSERT_EQ(text, omnibox_view->model()->keyword()); | 769 ASSERT_EQ(text, omnibox_view->model()->keyword()); | 
| 770 ASSERT_EQ(text + char16(' '), omnibox_view->GetText()); | 770 ASSERT_EQ(text + char16(' '), omnibox_view->GetText()); | 
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1377 } | 1377 } | 
| 1378 | 1378 | 
| 1379 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, EscapeToDefaultMatch) { | 1379 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, EscapeToDefaultMatch) { | 
| 1380 EscapeToDefaultMatchTest(); | 1380 EscapeToDefaultMatchTest(); | 
| 1381 } | 1381 } | 
| 1382 | 1382 | 
| 1383 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BasicTextOperations) { | 1383 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BasicTextOperations) { | 
| 1384 BasicTextOperationsTest(); | 1384 BasicTextOperationsTest(); | 
| 1385 } | 1385 } | 
| 1386 | 1386 | 
| 1387 // This test is DISABLED because of the behavioral modifications of omnibox. | |
| 
Peter Kasting
2011/11/29 19:07:28
It's wrong to disable the test.  If the test isn't
 
SanjoyPal
2011/11/30 06:49:26
Done.
 | |
| 1388 // Please refer http://crbug.com/82181. | |
| 1389 #if defined(OS_LINUX) | |
| 1390 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DISABLED_AcceptKeywordBySpace) { | |
| 1391 #else | |
| 1387 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, AcceptKeywordBySpace) { | 1392 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, AcceptKeywordBySpace) { | 
| 1393 #endif // OS_LINUX | |
| 1388 AcceptKeywordBySpaceTest(); | 1394 AcceptKeywordBySpaceTest(); | 
| 1389 } | 1395 } | 
| 1390 | 1396 | 
| 1391 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, | 1397 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, | 
| 1392 NonSubstitutingKeywordTest) { | 1398 NonSubstitutingKeywordTest) { | 
| 1393 NonSubstitutingKeywordTest(); | 1399 NonSubstitutingKeywordTest(); | 
| 1394 } | 1400 } | 
| 1395 | 1401 | 
| 1396 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DeleteItem) { | 1402 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DeleteItem) { | 
| 1397 DeleteItemTest(); | 1403 DeleteItemTest(); | 
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1408 PersistKeywordModeOnTabSwitch) { | 1414 PersistKeywordModeOnTabSwitch) { | 
| 1409 PersistKeywordModeOnTabSwitch(); | 1415 PersistKeywordModeOnTabSwitch(); | 
| 1410 } | 1416 } | 
| 1411 | 1417 | 
| 1412 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, | 1418 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, | 
| 1413 CtrlKeyPressedWithInlineAutocompleteTest) { | 1419 CtrlKeyPressedWithInlineAutocompleteTest) { | 
| 1414 CtrlKeyPressedWithInlineAutocompleteTest(); | 1420 CtrlKeyPressedWithInlineAutocompleteTest(); | 
| 1415 } | 1421 } | 
| 1416 | 1422 | 
| 1417 #endif | 1423 #endif | 
| OLD | NEW |