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/file_util.h" | 5 #include "base/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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 { | 107 { |
108 EXPECT_FALSE(data.HasURL(OSExchangeData::DO_NOT_CONVERT_FILENAMES)); | 108 EXPECT_FALSE(data.HasURL(OSExchangeData::DO_NOT_CONVERT_FILENAMES)); |
109 GURL actual_url; | 109 GURL actual_url; |
110 base::string16 actual_title; | 110 base::string16 actual_title; |
111 EXPECT_FALSE(data.GetURLAndTitle( | 111 EXPECT_FALSE(data.GetURLAndTitle( |
112 OSExchangeData::DO_NOT_CONVERT_FILENAMES, &actual_url, &actual_title)); | 112 OSExchangeData::DO_NOT_CONVERT_FILENAMES, &actual_url, &actual_title)); |
113 EXPECT_EQ(GURL(), actual_url); | 113 EXPECT_EQ(GURL(), actual_url); |
114 EXPECT_EQ(base::string16(), actual_title); | 114 EXPECT_EQ(base::string16(), actual_title); |
115 } | 115 } |
116 { | 116 { |
117 // Filename to URL conversion is not implemented on ChromeOS. | 117 // Filename to URL conversion is not implemented on ChromeOS or on non-X11 Linux |
118 #if !defined(OS_CHROMEOS) | 118 // builds. |
| 119 #if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(USE_X11)) |
| 120 const bool expected_success = false; |
| 121 const GURL expected_url; |
| 122 #else |
119 const bool expected_success = true; | 123 const bool expected_success = true; |
120 const GURL expected_url(net::FilePathToFileURL(current_directory)); | 124 const GURL expected_url(net::FilePathToFileURL(current_directory)); |
121 #else | |
122 const bool expected_success = false; | |
123 const GURL expected_url; | |
124 #endif | 125 #endif |
125 EXPECT_EQ(expected_success, data.HasURL(OSExchangeData::CONVERT_FILENAMES)); | 126 EXPECT_EQ(expected_success, data.HasURL(OSExchangeData::CONVERT_FILENAMES)); |
126 GURL actual_url; | 127 GURL actual_url; |
127 base::string16 actual_title; | 128 base::string16 actual_title; |
128 EXPECT_EQ( | 129 EXPECT_EQ( |
129 expected_success, | 130 expected_success, |
130 data.GetURLAndTitle( | 131 data.GetURLAndTitle( |
131 OSExchangeData::CONVERT_FILENAMES, &actual_url, &actual_title)); | 132 OSExchangeData::CONVERT_FILENAMES, &actual_url, &actual_title)); |
132 EXPECT_EQ(expected_url, actual_url); | 133 EXPECT_EQ(expected_url, actual_url); |
133 EXPECT_EQ(base::string16(), actual_title); | 134 EXPECT_EQ(base::string16(), actual_title); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 data.SetHtml(html, url); | 173 data.SetHtml(html, url); |
173 | 174 |
174 OSExchangeData copy(data.provider().Clone()); | 175 OSExchangeData copy(data.provider().Clone()); |
175 base::string16 read_html; | 176 base::string16 read_html; |
176 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); | 177 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); |
177 EXPECT_EQ(html, read_html); | 178 EXPECT_EQ(html, read_html); |
178 } | 179 } |
179 #endif | 180 #endif |
180 | 181 |
181 } // namespace ui | 182 } // namespace ui |
OLD | NEW |