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

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

Issue 2819683002: [Extenisons Bindings] Don't throw unchecked errors; add console errors (Closed)
Patch Set: jbroman's Created 3 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
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/api_binding.h" 10 #include "extensions/renderer/api_binding.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 protected: 138 protected:
139 APIBindingUnittest() 139 APIBindingUnittest()
140 : type_refs_(APITypeReferenceMap::InitializeTypeCallback()) {} 140 : type_refs_(APITypeReferenceMap::InitializeTypeCallback()) {}
141 void SetUp() override { 141 void SetUp() override {
142 APIBindingTest::SetUp(); 142 APIBindingTest::SetUp();
143 request_handler_ = base::MakeUnique<APIRequestHandler>( 143 request_handler_ = base::MakeUnique<APIRequestHandler>(
144 base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)), 144 base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)),
145 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), 145 base::Bind(&RunFunctionOnGlobalAndIgnoreResult),
146 APILastError(APILastError::GetParent())); 146 APILastError(APILastError::GetParent(),
147 APILastError::AddConsoleError()));
147 } 148 }
148 149
149 void TearDown() override { 150 void TearDown() override {
150 request_handler_.reset(); 151 request_handler_.reset();
151 event_handler_.reset(); 152 event_handler_.reset();
152 binding_.reset(); 153 binding_.reset();
153 APIBindingTest::TearDown(); 154 APIBindingTest::TearDown();
154 } 155 }
155 156
156 void SetFunctions(const char* functions) { 157 void SetFunctions(const char* functions) {
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 1157
1157 blink::WebScopedUserGesture user_gesture(nullptr); 1158 blink::WebScopedUserGesture user_gesture(nullptr);
1158 RunFunction(function, context, arraysize(argv), argv); 1159 RunFunction(function, context, arraysize(argv), argv);
1159 ASSERT_TRUE(last_request()); 1160 ASSERT_TRUE(last_request());
1160 EXPECT_TRUE(last_request()->has_user_gesture); 1161 EXPECT_TRUE(last_request()->has_user_gesture);
1161 1162
1162 reset_last_request(); 1163 reset_last_request();
1163 } 1164 }
1164 1165
1165 } // namespace extensions 1166 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/native_bindings_apitest.cc ('k') | extensions/renderer/api_bindings_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698