| 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 "ppapi/tests/test_flash_clipboard.h" | 5 #include "ppapi/tests/test_flash_clipboard.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ppapi/cpp/instance.h" | 10 #include "ppapi/cpp/instance.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ASSERT_TRUE(IsFormatAvailableMatches(invalid_format, false)); | 246 ASSERT_TRUE(IsFormatAvailableMatches(invalid_format, false)); |
| 247 std::string unused; | 247 std::string unused; |
| 248 ASSERT_FALSE(ReadStringVar(invalid_format, &unused)); | 248 ASSERT_FALSE(ReadStringVar(invalid_format, &unused)); |
| 249 | 249 |
| 250 PASS(); | 250 PASS(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 std::string TestFlashClipboard::TestRegisterCustomFormat() { | 253 std::string TestFlashClipboard::TestRegisterCustomFormat() { |
| 254 // Test an empty name is rejected. | 254 // Test an empty name is rejected. |
| 255 uint32_t format_id = | 255 uint32_t format_id = |
| 256 pp::flash::Clipboard::RegisterCustomFormat(instance_, ""); | 256 pp::flash::Clipboard::RegisterCustomFormat(instance_, std::string()); |
| 257 ASSERT_EQ(format_id, PP_FLASH_CLIPBOARD_FORMAT_INVALID); | 257 ASSERT_EQ(format_id, PP_FLASH_CLIPBOARD_FORMAT_INVALID); |
| 258 | 258 |
| 259 // Test a valid format name. | 259 // Test a valid format name. |
| 260 format_id = pp::flash::Clipboard::RegisterCustomFormat(instance_, "a-b"); | 260 format_id = pp::flash::Clipboard::RegisterCustomFormat(instance_, "a-b"); |
| 261 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_INVALID); | 261 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_INVALID); |
| 262 // Make sure the format doesn't collide with predefined formats. | 262 // Make sure the format doesn't collide with predefined formats. |
| 263 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT); | 263 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT); |
| 264 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_HTML); | 264 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_HTML); |
| 265 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_RTF); | 265 ASSERT_NE(format_id, PP_FLASH_CLIPBOARD_FORMAT_RTF); |
| 266 | 266 |
| 267 // Check that if the same name is registered, the same id comes out. | 267 // Check that if the same name is registered, the same id comes out. |
| 268 uint32_t format_id2 = | 268 uint32_t format_id2 = |
| 269 pp::flash::Clipboard::RegisterCustomFormat(instance_, "a-b"); | 269 pp::flash::Clipboard::RegisterCustomFormat(instance_, "a-b"); |
| 270 ASSERT_EQ(format_id, format_id2); | 270 ASSERT_EQ(format_id, format_id2); |
| 271 | 271 |
| 272 // Check that the second format registered has a different id. | 272 // Check that the second format registered has a different id. |
| 273 uint32_t format_id3 = | 273 uint32_t format_id3 = |
| 274 pp::flash::Clipboard::RegisterCustomFormat(instance_, "a-b-c"); | 274 pp::flash::Clipboard::RegisterCustomFormat(instance_, "a-b-c"); |
| 275 ASSERT_NE(format_id, format_id3); | 275 ASSERT_NE(format_id, format_id3); |
| 276 | 276 |
| 277 PASS(); | 277 PASS(); |
| 278 } | 278 } |
| OLD | NEW |