OLD | NEW |
---|---|
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 "chrome/test/base/module_system_test.h" | 5 #include "chrome/test/base/module_system_test.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
10 #include "chrome/renderer/native_handler.h" | 10 #include "chrome/renderer/native_handler.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 source_map_->RegisterModule(name, code); | 102 source_map_->RegisterModule(name, code); |
103 } | 103 } |
104 | 104 |
105 void ModuleSystemTest::OverrideNativeHandler(const std::string& name, | 105 void ModuleSystemTest::OverrideNativeHandler(const std::string& name, |
106 const std::string& code) { | 106 const std::string& code) { |
107 RegisterModule(name, code); | 107 RegisterModule(name, code); |
108 module_system_->OverrideNativeHandler(name); | 108 module_system_->OverrideNativeHandler(name); |
109 } | 109 } |
110 | 110 |
111 void ModuleSystemTest::TearDown() { | 111 void ModuleSystemTest::TearDown() { |
112 if (try_catch_.HasCaught()) { | |
113 ModuleSystem::DumpException(try_catch_.Message()); | |
114 } | |
not at google - send to devlin
2012/05/18 04:57:20
nit: no braces
koz (OOO until 15th September)
2012/05/18 05:06:07
Done.
| |
112 EXPECT_FALSE(try_catch_.HasCaught()); | 115 EXPECT_FALSE(try_catch_.HasCaught()); |
113 // All tests must assert at least once unless otherwise specified. | 116 // All tests must assert at least once unless otherwise specified. |
114 EXPECT_EQ(should_assertions_be_made_, | 117 EXPECT_EQ(should_assertions_be_made_, |
115 assert_natives_->assertion_made()); | 118 assert_natives_->assertion_made()); |
116 EXPECT_FALSE(assert_natives_->failed()); | 119 EXPECT_FALSE(assert_natives_->failed()); |
117 } | 120 } |
118 | 121 |
119 void ModuleSystemTest::ExpectNoAssertionsMade() { | 122 void ModuleSystemTest::ExpectNoAssertionsMade() { |
120 should_assertions_be_made_ = false; | 123 should_assertions_be_made_ = false; |
121 } | 124 } |
122 | 125 |
123 v8::Handle<v8::Object> ModuleSystemTest::CreateGlobal(const std::string& name) { | 126 v8::Handle<v8::Object> ModuleSystemTest::CreateGlobal(const std::string& name) { |
124 v8::HandleScope handle_scope; | 127 v8::HandleScope handle_scope; |
125 v8::Handle<v8::Object> object = v8::Object::New(); | 128 v8::Handle<v8::Object> object = v8::Object::New(); |
126 v8::Context::GetCurrent()->Global()->Set(v8::String::New(name.c_str()), | 129 v8::Context::GetCurrent()->Global()->Set(v8::String::New(name.c_str()), |
127 object); | 130 object); |
128 return handle_scope.Close(object); | 131 return handle_scope.Close(object); |
129 } | 132 } |
OLD | NEW |