OLD | NEW |
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/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/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 using base::ASCIIToUTF16; | 15 using base::ASCIIToUTF16; |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class OmniboxViewTest : public PlatformTest { | 19 class OmniboxViewTest : public PlatformTest { |
20 public: | 20 public: |
21 virtual void TearDown() OVERRIDE { | 21 virtual void TearDown() override { |
22 ui::Clipboard::DestroyClipboardForCurrentThread(); | 22 ui::Clipboard::DestroyClipboardForCurrentThread(); |
23 } | 23 } |
24 | 24 |
25 private: | 25 private: |
26 // Windows requires a message loop for clipboard access. | 26 // Windows requires a message loop for clipboard access. |
27 base::MessageLoopForUI message_loop_; | 27 base::MessageLoopForUI message_loop_; |
28 }; | 28 }; |
29 | 29 |
30 TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) { | 30 TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) { |
31 const char* urls[] = { | 31 const char* urls[] = { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Do we get nothing if there is neither text nor a bookmark? | 115 // Do we get nothing if there is neither text nor a bookmark? |
116 { | 116 { |
117 const base::string16 kMarkup(ASCIIToUTF16("<strong>Hi!</string>")); | 117 const base::string16 kMarkup(ASCIIToUTF16("<strong>Hi!</string>")); |
118 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_COPY_PASTE); | 118 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_COPY_PASTE); |
119 clipboard_writer.WriteHTML(kMarkup, kURL); | 119 clipboard_writer.WriteHTML(kMarkup, kURL); |
120 } | 120 } |
121 EXPECT_TRUE(OmniboxView::GetClipboardText().empty()); | 121 EXPECT_TRUE(OmniboxView::GetClipboardText().empty()); |
122 } | 122 } |
123 | 123 |
124 } // namespace | 124 } // namespace |
OLD | NEW |