| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "net/base/filename_util.h" | 9 #include "net/base/filename_util.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 OSExchangeData data; | 153 OSExchangeData data; |
| 154 data.SetPickledData(kTestFormat, saved_pickle); | 154 data.SetPickledData(kTestFormat, saved_pickle); |
| 155 | 155 |
| 156 OSExchangeData copy(data.provider().Clone()); | 156 OSExchangeData copy(data.provider().Clone()); |
| 157 EXPECT_TRUE(copy.HasCustomFormat(kTestFormat)); | 157 EXPECT_TRUE(copy.HasCustomFormat(kTestFormat)); |
| 158 | 158 |
| 159 Pickle restored_pickle; | 159 Pickle restored_pickle; |
| 160 EXPECT_TRUE(copy.GetPickledData(kTestFormat, &restored_pickle)); | 160 EXPECT_TRUE(copy.GetPickledData(kTestFormat, &restored_pickle)); |
| 161 PickleIterator iterator(restored_pickle); | 161 PickleIterator iterator(restored_pickle); |
| 162 int value; | 162 int value; |
| 163 EXPECT_TRUE(iterator.ReadInt(&value)); | 163 EXPECT_TRUE(restored_pickle.ReadInt(&iterator, &value)); |
| 164 EXPECT_EQ(1, value); | 164 EXPECT_EQ(1, value); |
| 165 EXPECT_TRUE(iterator.ReadInt(&value)); | 165 EXPECT_TRUE(restored_pickle.ReadInt(&iterator, &value)); |
| 166 EXPECT_EQ(2, value); | 166 EXPECT_EQ(2, value); |
| 167 } | 167 } |
| 168 | 168 |
| 169 #if defined(USE_AURA) | 169 #if defined(USE_AURA) |
| 170 TEST_F(OSExchangeDataTest, TestHTML) { | 170 TEST_F(OSExchangeDataTest, TestHTML) { |
| 171 OSExchangeData data; | 171 OSExchangeData data; |
| 172 GURL url("http://www.google.com/"); | 172 GURL url("http://www.google.com/"); |
| 173 base::string16 html = base::ASCIIToUTF16( | 173 base::string16 html = base::ASCIIToUTF16( |
| 174 "<HTML>\n<BODY>\n" | 174 "<HTML>\n<BODY>\n" |
| 175 "<b>bold.</b> <i><b>This is bold italic.</b></i>\n" | 175 "<b>bold.</b> <i><b>This is bold italic.</b></i>\n" |
| 176 "</BODY>\n</HTML>"); | 176 "</BODY>\n</HTML>"); |
| 177 data.SetHtml(html, url); | 177 data.SetHtml(html, url); |
| 178 | 178 |
| 179 OSExchangeData copy(data.provider().Clone()); | 179 OSExchangeData copy(data.provider().Clone()); |
| 180 base::string16 read_html; | 180 base::string16 read_html; |
| 181 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); | 181 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); |
| 182 EXPECT_EQ(html, read_html); | 182 EXPECT_EQ(html, read_html); |
| 183 } | 183 } |
| 184 #endif | 184 #endif |
| 185 | 185 |
| 186 } // namespace ui | 186 } // namespace ui |
| OLD | NEW |