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

Side by Side Diff: ppapi/tests/test_post_message.cc

Issue 148213016: [PPAPI] Moving pp::VarResource_Dev API into pp::Var (now stable). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 "ppapi/tests/test_post_message.h" 5 #include "ppapi/tests/test_post_message.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <sstream> 10 #include <sstream>
11 11
12 #include "ppapi/c/pp_var.h" 12 #include "ppapi/c/pp_var.h"
13 #include "ppapi/c/ppb_file_io.h" 13 #include "ppapi/c/ppb_file_io.h"
14 #include "ppapi/cpp/dev/var_resource_dev.h"
15 #include "ppapi/cpp/file_io.h" 14 #include "ppapi/cpp/file_io.h"
16 #include "ppapi/cpp/file_ref.h" 15 #include "ppapi/cpp/file_ref.h"
17 #include "ppapi/cpp/file_system.h" 16 #include "ppapi/cpp/file_system.h"
18 #include "ppapi/cpp/instance.h" 17 #include "ppapi/cpp/instance.h"
19 #include "ppapi/cpp/var.h" 18 #include "ppapi/cpp/var.h"
20 #include "ppapi/cpp/var_array.h" 19 #include "ppapi/cpp/var_array.h"
21 #include "ppapi/cpp/var_array_buffer.h" 20 #include "ppapi/cpp/var_array_buffer.h"
22 #include "ppapi/cpp/var_dictionary.h" 21 #include "ppapi/cpp/var_dictionary.h"
22 #include "ppapi/cpp/var_resource.h"
23 #include "ppapi/tests/pp_thread.h" 23 #include "ppapi/tests/pp_thread.h"
24 #include "ppapi/tests/test_utils.h" 24 #include "ppapi/tests/test_utils.h"
25 #include "ppapi/tests/testing_instance.h" 25 #include "ppapi/tests/testing_instance.h"
26 26
27 // Windows defines 'PostMessage', so we have to undef it. 27 // Windows defines 'PostMessage', so we have to undef it.
28 #ifdef PostMessage 28 #ifdef PostMessage
29 #undef PostMessage 29 #undef PostMessage
30 #endif 30 #endif
31 31
32 REGISTER_TEST_CASE(PostMessage); 32 REGISTER_TEST_CASE(PostMessage);
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 js_code += kTestString; 592 js_code += kTestString;
593 js_code += "'], {'type': 'text/plain'});" 593 js_code += "'], {'type': 'text/plain'});"
594 " writer.write(blob);" 594 " writer.write(blob);"
595 " });" 595 " });"
596 " }, function() { callback(null); });" 596 " }, function() { callback(null); });"
597 " }, function() { callback(null); });" 597 " }, function() { callback(null); });"
598 "}"; 598 "}";
599 ASSERT_EQ(PostAsyncMessageFromJavaScriptAndWait(js_code), 1); 599 ASSERT_EQ(PostAsyncMessageFromJavaScriptAndWait(js_code), 1);
600 pp::Var var = message_data_.back(); 600 pp::Var var = message_data_.back();
601 ASSERT_TRUE(var.is_resource()); 601 ASSERT_TRUE(var.is_resource());
602 pp::VarResource_Dev var_resource(var); 602 pp::VarResource var_resource(var);
603 pp::Resource result = var_resource.AsResource(); 603 pp::Resource result = var_resource.AsResource();
604 ASSERT_TRUE(pp::FileSystem::IsFileSystem(result)); 604 ASSERT_TRUE(pp::FileSystem::IsFileSystem(result));
605 { 605 {
606 pp::FileSystem file_system(result); 606 pp::FileSystem file_system(result);
607 std::string file_path("/"); 607 std::string file_path("/");
608 file_path += kTestFilename; 608 file_path += kTestFilename;
609 pp::FileRef file_ref(file_system, file_path.c_str()); 609 pp::FileRef file_ref(file_system, file_path.c_str());
610 ASSERT_NE(0, file_ref.pp_resource()); 610 ASSERT_NE(0, file_ref.pp_resource());
611 611
612 // Ensure that the file can be queried. 612 // Ensure that the file can be queried.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 ASSERT_TRUE(received_value <= kThreadsToRun); 869 ASSERT_TRUE(received_value <= kThreadsToRun);
870 ++received_counts[received_value]; 870 ++received_counts[received_value];
871 } 871 }
872 ASSERT_EQ(expected_counts, received_counts); 872 ASSERT_EQ(expected_counts, received_counts);
873 873
874 message_data_.clear(); 874 message_data_.clear();
875 ASSERT_TRUE(ClearListeners()); 875 ASSERT_TRUE(ClearListeners());
876 876
877 PASS(); 877 PASS();
878 } 878 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698