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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_unittest.cc

Issue 10917196: Fix memory leak in BookmarkUtilsTest.CopyPaste. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with three other cases. Created 8 years, 3 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 | Annotate | Revision Log
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 "chrome/browser/ui/omnibox/omnibox_view.h" 5 #include "chrome/browser/ui/omnibox/omnibox_view.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 #include "ui/base/clipboard/clipboard.h" 12 #include "ui/base/clipboard/clipboard.h"
13 #include "ui/base/clipboard/scoped_clipboard_writer.h" 13 #include "ui/base/clipboard/scoped_clipboard_writer.h"
14 14
15 namespace { 15 namespace {
16 16
17 class OmniboxViewTest : public PlatformTest { 17 class OmniboxViewTest : public PlatformTest {
18 public:
19 virtual void TearDown() OVERRIDE {
20 ui::Clipboard::DestroyClipboardForCurrentThread();
21 }
22
18 private: 23 private:
19 // Windows requires a message loop for clipboard access. 24 // Windows requires a message loop for clipboard access.
20 MessageLoopForUI message_loop_; 25 MessageLoopForUI message_loop_;
21 }; 26 };
22 27
23 TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) { 28 TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) {
24 const char* urls[] = { 29 const char* urls[] = {
25 "http://www.google.com?q=javascript:alert(0)", // Safe URL. 30 "http://www.google.com?q=javascript:alert(0)", // Safe URL.
26 "javAscript:alert(0)", // Unsafe JS URL. 31 "javAscript:alert(0)", // Unsafe JS URL.
27 "jaVascript:\njavaScript: alert(0)" // Single strip unsafe. 32 "jaVascript:\njavaScript: alert(0)" // Single strip unsafe.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ui::Clipboard::BUFFER_STANDARD); 121 ui::Clipboard::BUFFER_STANDARD);
117 clipboard_writer.WriteText(kWrappedAddress); 122 clipboard_writer.WriteText(kWrappedAddress);
118 } 123 }
119 124
120 const string16 kFixedAddress(ASCIIToUTF16( 125 const string16 kFixedAddress(ASCIIToUTF16(
121 "1600 Amphitheatre Parkway Mountain View, CA")); 126 "1600 Amphitheatre Parkway Mountain View, CA"));
122 EXPECT_EQ(kFixedAddress, OmniboxView::GetClipboardText()); 127 EXPECT_EQ(kFixedAddress, OmniboxView::GetClipboardText());
123 } 128 }
124 129
125 } // namespace 130 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils_unittest.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698