OLD | NEW |
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 protected: | 98 protected: |
99 APIBindingUnittest() | 99 APIBindingUnittest() |
100 : type_refs_(APITypeReferenceMap::InitializeTypeCallback()) {} | 100 : type_refs_(APITypeReferenceMap::InitializeTypeCallback()) {} |
101 void SetUp() override { | 101 void SetUp() override { |
102 APIBindingTest::SetUp(); | 102 APIBindingTest::SetUp(); |
103 request_handler_ = base::MakeUnique<APIRequestHandler>( | 103 request_handler_ = base::MakeUnique<APIRequestHandler>( |
104 base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)), | 104 base::Bind(&APIBindingUnittest::OnFunctionCall, base::Unretained(this)), |
105 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), | 105 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), |
106 APILastError(APILastError::GetParent(), | 106 APILastError(APILastError::GetParent(), binding::AddConsoleError()), |
107 APILastError::AddConsoleError())); | 107 nullptr); |
108 } | 108 } |
109 | 109 |
110 void TearDown() override { | 110 void TearDown() override { |
111 DisposeAllContexts(); | 111 DisposeAllContexts(); |
112 access_checker_.reset(); | 112 access_checker_.reset(); |
113 request_handler_.reset(); | 113 request_handler_.reset(); |
114 event_handler_.reset(); | 114 event_handler_.reset(); |
115 binding_.reset(); | 115 binding_.reset(); |
116 APIBindingTest::TearDown(); | 116 APIBindingTest::TearDown(); |
117 } | 117 } |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 ASSERT_TRUE(request_arguments); | 1492 ASSERT_TRUE(request_arguments); |
1493 EXPECT_THAT( | 1493 EXPECT_THAT( |
1494 *request_arguments, | 1494 *request_arguments, |
1495 testing::ElementsAre("\"str\"", "42")); // 42 was added by the handler. | 1495 testing::ElementsAre("\"str\"", "42")); // 42 was added by the handler. |
1496 reset_last_request(); | 1496 reset_last_request(); |
1497 silent_request.reset(); | 1497 silent_request.reset(); |
1498 request_arguments.reset(); | 1498 request_arguments.reset(); |
1499 } | 1499 } |
1500 | 1500 |
1501 } // namespace extensions | 1501 } // namespace extensions |
OLD | NEW |