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

Side by Side Diff: extensions/renderer/module_system_test.h

Issue 502893002: Fix some leaks and failures under valgrind in JS extensions unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetUp Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ 5 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_
6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ 6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_
7 7
8 #include "extensions/renderer/module_system.h" 8 #include "extensions/renderer/module_system.h"
9 #include "extensions/renderer/scoped_persistent.h" 9 #include "extensions/renderer/scoped_persistent.h"
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // module_system_->Require("test"); 74 // module_system_->Require("test");
75 // } 75 // }
76 // 76 //
77 // By default a test will fail if no method in the native module 'assert' is 77 // By default a test will fail if no method in the native module 'assert' is
78 // called. This behaviour can be overridden by calling ExpectNoAssertionsMade(). 78 // called. This behaviour can be overridden by calling ExpectNoAssertionsMade().
79 class ModuleSystemTest : public testing::Test { 79 class ModuleSystemTest : public testing::Test {
80 public: 80 public:
81 ModuleSystemTest(); 81 ModuleSystemTest();
82 virtual ~ModuleSystemTest(); 82 virtual ~ModuleSystemTest();
83 83
84 virtual void SetUp() OVERRIDE;
84 virtual void TearDown() OVERRIDE; 85 virtual void TearDown() OVERRIDE;
85 86
86 protected: 87 protected:
87 ModuleSystemTestEnvironment* env() { return env_.get(); } 88 ModuleSystemTestEnvironment* env() { return env_.get(); }
88 89
89 scoped_ptr<ModuleSystemTestEnvironment> CreateEnvironment(); 90 scoped_ptr<ModuleSystemTestEnvironment> CreateEnvironment();
90 91
91 // Make the test fail if any asserts are called. By default a test will fail 92 // Make the test fail if any asserts are called. By default a test will fail
92 // if no asserts are called. 93 // if no asserts are called.
93 void ExpectNoAssertionsMade(); 94 void ExpectNoAssertionsMade();
94 95
95 // Runs promises that have been resolved. Resolved promises will not run 96 // Runs promises that have been resolved. Resolved promises will not run
96 // until this is called. 97 // until this is called.
97 void RunResolvedPromises(); 98 void RunResolvedPromises();
98 99
99 private: 100 private:
100 v8::Isolate* isolate_; 101 v8::Isolate* isolate_;
101 scoped_ptr<ModuleSystemTestEnvironment> env_; 102 scoped_ptr<ModuleSystemTestEnvironment> env_;
102 bool should_assertions_be_made_; 103 bool should_assertions_be_made_;
103 104
104 private: 105 private:
105 DISALLOW_COPY_AND_ASSIGN(ModuleSystemTest); 106 DISALLOW_COPY_AND_ASSIGN(ModuleSystemTest);
106 }; 107 };
107 108
108 } // namespace extensions 109 } // namespace extensions
109 110
110 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ 111 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_
OLDNEW
« no previous file with comments | « extensions/renderer/api/serial/serial_api_unittest.cc ('k') | extensions/renderer/module_system_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698