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

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

Issue 1097393007: Update {virtual,override} to follow C++11 style in ppapi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split off one file into separate review. Created 5 years, 8 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
« no previous file with comments | « ppapi/shared_impl/var.h ('k') | ppapi/tests/test_flash_fullscreen_for_browser_ui.h » ('j') | 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 "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/var.h" 9 #include "ppapi/shared_impl/var.h"
10 #include "ppapi/shared_impl/var_tracker.h" 10 #include "ppapi/shared_impl/var_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_var_alive_count = 0; 17 int mock_var_alive_count = 0;
18 18
19 class MockStringVar : public StringVar { 19 class MockStringVar : public StringVar {
20 public: 20 public:
21 MockStringVar(const std::string& str) : StringVar(str) { 21 MockStringVar(const std::string& str) : StringVar(str) {
22 mock_var_alive_count++; 22 mock_var_alive_count++;
23 } 23 }
24 virtual ~MockStringVar() { mock_var_alive_count--; } 24 ~MockStringVar() override { mock_var_alive_count--; }
25 bool HasValidVarID() { return GetExistingVarID() != 0; } 25 bool HasValidVarID() { return GetExistingVarID() != 0; }
26 }; 26 };
27 27
28 class MockObjectVar : public Var { 28 class MockObjectVar : public Var {
29 public: 29 public:
30 MockObjectVar() : Var() { mock_var_alive_count++; } 30 MockObjectVar() : Var() { mock_var_alive_count++; }
31 virtual ~MockObjectVar() { mock_var_alive_count--; } 31 ~MockObjectVar() override { mock_var_alive_count--; }
32 virtual PP_VarType GetType() const override { return PP_VARTYPE_OBJECT; } 32 PP_VarType GetType() const override { return PP_VARTYPE_OBJECT; }
33 bool HasValidVarID() { return GetExistingVarID() != 0; } 33 bool HasValidVarID() { return GetExistingVarID() != 0; }
34 }; 34 };
35 35
36 } // namespace 36 } // namespace
37 37
38 class VarTrackerTest : public testing::Test { 38 class VarTrackerTest : public testing::Test {
39 public: 39 public:
40 VarTrackerTest() {} 40 VarTrackerTest() {}
41 41
42 // Test implementation. 42 // Test implementation.
43 virtual void SetUp() override { 43 void SetUp() override {
44 ASSERT_EQ(0, mock_var_alive_count); 44 ASSERT_EQ(0, mock_var_alive_count);
45 } 45 }
46 virtual void TearDown() override {} 46 void TearDown() override {}
47 47
48 VarTracker& var_tracker() { return *globals_.GetVarTracker(); } 48 VarTracker& var_tracker() { return *globals_.GetVarTracker(); }
49 49
50 private: 50 private:
51 TestGlobals globals_; 51 TestGlobals globals_;
52 }; 52 };
53 53
54 // Test that ResetVarID is called when the last PP_Var ref was deleted but the 54 // Test that ResetVarID is called when the last PP_Var ref was deleted but the
55 // object lives on. 55 // object lives on.
56 TEST_F(VarTrackerTest, LastResourceRef) { 56 TEST_F(VarTrackerTest, LastResourceRef) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 another_var = NULL; 142 another_var = NULL;
143 EXPECT_TRUE(var_tracker().GetVar(pp_var)); 143 EXPECT_TRUE(var_tracker().GetVar(pp_var));
144 EXPECT_EQ(1, mock_var_alive_count); 144 EXPECT_EQ(1, mock_var_alive_count);
145 145
146 // Releasing plugin reference. 146 // Releasing plugin reference.
147 EXPECT_TRUE(var_tracker().ReleaseVar(pp_var)); 147 EXPECT_TRUE(var_tracker().ReleaseVar(pp_var));
148 EXPECT_EQ(0, mock_var_alive_count); 148 EXPECT_EQ(0, mock_var_alive_count);
149 } 149 }
150 150
151 } // namespace ppapi 151 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/var.h ('k') | ppapi/tests/test_flash_fullscreen_for_browser_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698