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

Side by Side Diff: extensions/renderer/bindings/api_binding_unittest.cc

Issue 2961103002: [Extensions Bindings] Add an ExceptionHandler class (Closed)
Patch Set: jbroman's Created 3 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/ptr_util.h" 6 #include "base/memory/ptr_util.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "extensions/renderer/bindings/api_binding.h" 10 #include "extensions/renderer/bindings/api_binding.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 protected: 92 protected:
93 APIBindingUnittest() 93 APIBindingUnittest()
94 : type_refs_(APITypeReferenceMap::InitializeTypeCallback()) {} 94 : type_refs_(APITypeReferenceMap::InitializeTypeCallback()) {}
95 void SetUp() override { 95 void SetUp() override {
96 APIBindingTest::SetUp(); 96 APIBindingTest::SetUp();
97 request_handler_ = base::MakeUnique<APIRequestHandler>( 97 request_handler_ = base::MakeUnique<APIRequestHandler>(
98 base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)), 98 base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)),
99 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), 99 base::Bind(&RunFunctionOnGlobalAndIgnoreResult),
100 APILastError(APILastError::GetParent(), 100 APILastError(APILastError::GetParent(), binding::AddConsoleError()),
101 APILastError::AddConsoleError())); 101 nullptr);
102 } 102 }
103 103
104 void TearDown() override { 104 void TearDown() override {
105 DisposeAllContexts(); 105 DisposeAllContexts();
106 access_checker_.reset(); 106 access_checker_.reset();
107 request_handler_.reset(); 107 request_handler_.reset();
108 event_handler_.reset(); 108 event_handler_.reset();
109 binding_.reset(); 109 binding_.reset();
110 APIBindingTest::TearDown(); 110 APIBindingTest::TearDown();
111 } 111 }
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 1273
1274 // The extra property should be present on the binding object. 1274 // The extra property should be present on the binding object.
1275 EXPECT_EQ("42", GetStringPropertyFromObject(binding_object, context, 1275 EXPECT_EQ("42", GetStringPropertyFromObject(binding_object, context,
1276 "hookedProperty")); 1276 "hookedProperty"));
1277 // Sanity check: other values should still be there. 1277 // Sanity check: other values should still be there.
1278 EXPECT_EQ("function", 1278 EXPECT_EQ("function",
1279 GetStringPropertyFromObject(binding_object, context, "oneString")); 1279 GetStringPropertyFromObject(binding_object, context, "oneString"));
1280 } 1280 }
1281 1281
1282 } // namespace extensions 1282 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698