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

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

Issue 630883002: replace OVERRIDE and FINAL with override and final in ppapi/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 "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/proxy_lock.h" 8 #include "ppapi/shared_impl/proxy_lock.h"
9 #include "ppapi/shared_impl/resource.h" 9 #include "ppapi/shared_impl/resource.h"
10 #include "ppapi/shared_impl/resource_tracker.h" 10 #include "ppapi/shared_impl/resource_tracker.h"
11 #include "ppapi/shared_impl/test_globals.h" 11 #include "ppapi/shared_impl/test_globals.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 14
15 namespace { 15 namespace {
16 16
17 int mock_resource_alive_count = 0; 17 int mock_resource_alive_count = 0;
18 int last_plugin_ref_was_deleted_count = 0; 18 int last_plugin_ref_was_deleted_count = 0;
19 int instance_was_deleted_count = 0; 19 int instance_was_deleted_count = 0;
20 20
21 class MyMockResource : public Resource { 21 class MyMockResource : public Resource {
22 public: 22 public:
23 MyMockResource(PP_Instance instance) : Resource(OBJECT_IS_IMPL, instance) { 23 MyMockResource(PP_Instance instance) : Resource(OBJECT_IS_IMPL, instance) {
24 mock_resource_alive_count++; 24 mock_resource_alive_count++;
25 } 25 }
26 virtual ~MyMockResource() { mock_resource_alive_count--; } 26 virtual ~MyMockResource() { mock_resource_alive_count--; }
27 27
28 virtual void LastPluginRefWasDeleted() OVERRIDE { 28 virtual void LastPluginRefWasDeleted() override {
29 last_plugin_ref_was_deleted_count++; 29 last_plugin_ref_was_deleted_count++;
30 } 30 }
31 virtual void InstanceWasDeleted() OVERRIDE { instance_was_deleted_count++; } 31 virtual void InstanceWasDeleted() override { instance_was_deleted_count++; }
32 }; 32 };
33 33
34 } // namespace 34 } // namespace
35 35
36 class ResourceTrackerTest : public testing::Test { 36 class ResourceTrackerTest : public testing::Test {
37 public: 37 public:
38 ResourceTrackerTest() {} 38 ResourceTrackerTest() {}
39 39
40 // Test implementation. 40 // Test implementation.
41 virtual void SetUp() OVERRIDE { 41 virtual void SetUp() override {
42 ASSERT_EQ(0, mock_resource_alive_count); 42 ASSERT_EQ(0, mock_resource_alive_count);
43 last_plugin_ref_was_deleted_count = 0; 43 last_plugin_ref_was_deleted_count = 0;
44 instance_was_deleted_count = 0; 44 instance_was_deleted_count = 0;
45 } 45 }
46 virtual void TearDown() OVERRIDE {} 46 virtual void TearDown() override {}
47 47
48 ResourceTracker& resource_tracker() { return *globals_.GetResourceTracker(); } 48 ResourceTracker& resource_tracker() { return *globals_.GetResourceTracker(); }
49 49
50 private: 50 private:
51 TestGlobals globals_; 51 TestGlobals globals_;
52 }; 52 };
53 53
54 // Test that LastPluginRefWasDeleted is called when the last plugin ref was 54 // Test that LastPluginRefWasDeleted is called when the last plugin ref was
55 // deleted but the object lives on. 55 // deleted but the object lives on.
56 TEST_F(ResourceTrackerTest, LastPluginRef) { 56 TEST_F(ResourceTrackerTest, LastPluginRef) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 EXPECT_EQ(1, mock_resource_alive_count); 112 EXPECT_EQ(1, mock_resource_alive_count);
113 EXPECT_EQ(1, last_plugin_ref_was_deleted_count); 113 EXPECT_EQ(1, last_plugin_ref_was_deleted_count);
114 EXPECT_EQ(1, instance_was_deleted_count); 114 EXPECT_EQ(1, instance_was_deleted_count);
115 EXPECT_EQ(0, resource->pp_instance()); 115 EXPECT_EQ(0, resource->pp_instance());
116 116
117 resource = NULL; 117 resource = NULL;
118 EXPECT_EQ(0, mock_resource_alive_count); 118 EXPECT_EQ(0, mock_resource_alive_count);
119 } 119 }
120 120
121 } // namespace ppapi 121 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h ('k') | ppapi/shared_impl/resource_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698