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

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

Issue 7511026: Fix some egregious bugs in Var. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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
« ppapi/cpp/var.h ('K') | « ppapi/cpp/var.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_var.h" 5 #include "ppapi/tests/test_var.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ASSERT_EQ(kStrLen, len); 57 ASSERT_EQ(kStrLen, len);
58 ASSERT_EQ(0, strncmp(kStr, result, kStrLen)); 58 ASSERT_EQ(0, strncmp(kStr, result, kStrLen));
59 59
60 // Destroy the string, readback should now fail. 60 // Destroy the string, readback should now fail.
61 var_interface_->Release(str); 61 var_interface_->Release(str);
62 result = var_interface_->VarToUtf8(str, &len); 62 result = var_interface_->VarToUtf8(str, &len);
63 ASSERT_EQ(0, len); 63 ASSERT_EQ(0, len);
64 ASSERT_EQ(NULL, result); 64 ASSERT_EQ(NULL, result);
65 } 65 }
66 66
67 // Make sure we can assign a C++ object to itself and it stays alive.
68 {
69 pp::Var a("test");
70 a = a;
71 ASSERT_TRUE(a.AsString() == "test");
72 }
73
67 // Make sure nothing leaked. 74 // Make sure nothing leaked.
68 ASSERT_TRUE(testing_interface_->GetLiveObjectsForInstance( 75 ASSERT_TRUE(testing_interface_->GetLiveObjectsForInstance(
69 instance_->pp_instance()) == before_object); 76 instance_->pp_instance()) == before_object);
70 77
71 PASS(); 78 PASS();
72 } 79 }
73 80
74 std::string TestVar::TestInvalidAndEmpty() { 81 std::string TestVar::TestInvalidAndEmpty() {
75 PP_Var invalid_string; 82 PP_Var invalid_string;
76 invalid_string.type = PP_VARTYPE_STRING; 83 invalid_string.type = PP_VARTYPE_STRING;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (length != 0) { 245 if (length != 0) {
239 return "Expected 0 on string conversion from Double var."; 246 return "Expected 0 on string conversion from Double var.";
240 } 247 }
241 if (result != NULL) { 248 if (result != NULL) {
242 return "Expected NULL on string conversion from Double var."; 249 return "Expected NULL on string conversion from Double var.";
243 } 250 }
244 251
245 PASS(); 252 PASS();
246 } 253 }
247 254
OLDNEW
« ppapi/cpp/var.h ('K') | « ppapi/cpp/var.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698