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

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

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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: 18 public:
19 virtual void TearDown() OVERRIDE { 19 virtual void TearDown() OVERRIDE {
20 ui::Clipboard::DestroyClipboardForCurrentThread(); 20 ui::Clipboard::DestroyClipboardForCurrentThread();
21 } 21 }
22 22
23 private: 23 private:
24 // Windows requires a message loop for clipboard access. 24 // Windows requires a message loop for clipboard access.
25 MessageLoopForUI message_loop_; 25 base::MessageLoopForUI message_loop_;
26 }; 26 };
27 27
28 TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) { 28 TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) {
29 const char* urls[] = { 29 const char* urls[] = {
30 "http://www.google.com?q=javascript:alert(0)", // Safe URL. 30 "http://www.google.com?q=javascript:alert(0)", // Safe URL.
31 "javAscript:alert(0)", // Unsafe JS URL. 31 "javAscript:alert(0)", // Unsafe JS URL.
32 "jaVascript:\njavaScript: alert(0)" // Single strip unsafe. 32 "jaVascript:\njavaScript: alert(0)" // Single strip unsafe.
33 }; 33 };
34 34
35 const char* expecteds[] = { 35 const char* expecteds[] = {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ui::Clipboard::BUFFER_STANDARD); 132 ui::Clipboard::BUFFER_STANDARD);
133 clipboard_writer.WriteText(kWrappedAddress); 133 clipboard_writer.WriteText(kWrappedAddress);
134 } 134 }
135 135
136 const string16 kFixedAddress(ASCIIToUTF16( 136 const string16 kFixedAddress(ASCIIToUTF16(
137 "1600 Amphitheatre Parkway Mountain View, CA")); 137 "1600 Amphitheatre Parkway Mountain View, CA"));
138 EXPECT_EQ(kFixedAddress, OmniboxView::GetClipboardText()); 138 EXPECT_EQ(kFixedAddress, OmniboxView::GetClipboardText());
139 } 139 }
140 140
141 } // namespace 141 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | chrome/browser/ui/panels/base_panel_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698