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

Side by Side Diff: ppapi/shared_impl/resource_tracker_unittest.cc

Issue 9391013: Make a global enum to differentiate impl & proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "ppapi/shared_impl/resource.h" 8 #include "ppapi/shared_impl/resource.h"
9 #include "ppapi/shared_impl/resource_tracker.h" 9 #include "ppapi/shared_impl/resource_tracker.h"
10 #include "ppapi/shared_impl/test_globals.h" 10 #include "ppapi/shared_impl/test_globals.h"
11 11
12 namespace ppapi { 12 namespace ppapi {
13 13
14 namespace { 14 namespace {
15 15
16 int mock_resource_alive_count = 0; 16 int mock_resource_alive_count = 0;
17 int last_plugin_ref_was_deleted_count = 0; 17 int last_plugin_ref_was_deleted_count = 0;
18 int instance_was_deleted_count = 0; 18 int instance_was_deleted_count = 0;
19 19
20 class MyMockResource : public Resource { 20 class MyMockResource : public Resource {
21 public: 21 public:
22 MyMockResource(PP_Instance instance) : Resource(instance) { 22 MyMockResource(PP_Instance instance) : Resource(OBJECT_IS_IMPL, instance) {
23 mock_resource_alive_count++; 23 mock_resource_alive_count++;
24 } 24 }
25 virtual ~MyMockResource() { 25 virtual ~MyMockResource() {
26 mock_resource_alive_count--; 26 mock_resource_alive_count--;
27 } 27 }
28 28
29 virtual void LastPluginRefWasDeleted() OVERRIDE { 29 virtual void LastPluginRefWasDeleted() OVERRIDE {
30 Resource::LastPluginRefWasDeleted(); 30 Resource::LastPluginRefWasDeleted();
31 last_plugin_ref_was_deleted_count++; 31 last_plugin_ref_was_deleted_count++;
32 } 32 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 EXPECT_EQ(1, mock_resource_alive_count); 115 EXPECT_EQ(1, mock_resource_alive_count);
116 EXPECT_EQ(1, last_plugin_ref_was_deleted_count); 116 EXPECT_EQ(1, last_plugin_ref_was_deleted_count);
117 EXPECT_EQ(1, instance_was_deleted_count); 117 EXPECT_EQ(1, instance_was_deleted_count);
118 EXPECT_EQ(0, resource->pp_instance()); 118 EXPECT_EQ(0, resource->pp_instance());
119 119
120 resource = NULL; 120 resource = NULL;
121 EXPECT_EQ(0, mock_resource_alive_count); 121 EXPECT_EQ(0, mock_resource_alive_count);
122 } 122 }
123 123
124 } // namespace ppapi 124 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698