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

Side by Side Diff: net/proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc

Issue 2083463002: Replace //net TypeConverters with StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-converter-cleanup--gurl
Patch Set: rebase Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h" 5 #include "net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 void Alert(const mojo::String& message) { 26 void Alert(const mojo::String& message) {
27 alerts_.push_back(message.To<std::string>()); 27 alerts_.push_back(message.To<std::string>());
28 } 28 }
29 29
30 void OnError(int32_t line_number, const mojo::String& message) { 30 void OnError(int32_t line_number, const mojo::String& message) {
31 errors_.push_back(std::make_pair(line_number, message.To<std::string>())); 31 errors_.push_back(std::make_pair(line_number, message.To<std::string>()));
32 } 32 }
33 33
34 void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info, 34 void ResolveDns(std::unique_ptr<HostResolver::RequestInfo> request_info,
35 interfaces::HostResolverRequestClientPtr client) {} 35 interfaces::HostResolverRequestClientPtr client) {}
36 36
37 protected: 37 protected:
38 std::unique_ptr<MojoProxyResolverV8TracingBindings< 38 std::unique_ptr<MojoProxyResolverV8TracingBindings<
39 MojoProxyResolverV8TracingBindingsTest>> 39 MojoProxyResolverV8TracingBindingsTest>>
40 bindings_; 40 bindings_;
41 41
42 std::vector<std::string> alerts_; 42 std::vector<std::string> alerts_;
43 std::vector<std::pair<int, std::string>> errors_; 43 std::vector<std::pair<int, std::string>> errors_;
44 44
45 private: 45 private:
46 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverV8TracingBindingsTest); 46 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverV8TracingBindingsTest);
47 }; 47 };
48 48
49 TEST_F(MojoProxyResolverV8TracingBindingsTest, Basic) { 49 TEST_F(MojoProxyResolverV8TracingBindingsTest, Basic) {
50 bindings_->Alert(base::ASCIIToUTF16("alert")); 50 bindings_->Alert(base::ASCIIToUTF16("alert"));
51 bindings_->OnError(-1, base::ASCIIToUTF16("error")); 51 bindings_->OnError(-1, base::ASCIIToUTF16("error"));
52 52
53 EXPECT_TRUE(bindings_->GetHostResolver()); 53 EXPECT_TRUE(bindings_->GetHostResolver());
54 EXPECT_FALSE(bindings_->GetNetLogWithSource().net_log()); 54 EXPECT_FALSE(bindings_->GetNetLogWithSource().net_log());
55 55
56 ASSERT_EQ(1u, alerts_.size()); 56 ASSERT_EQ(1u, alerts_.size());
57 EXPECT_EQ("alert", alerts_[0]); 57 EXPECT_EQ("alert", alerts_[0]);
58 ASSERT_EQ(1u, errors_.size()); 58 ASSERT_EQ(1u, errors_.size());
59 EXPECT_EQ(-1, errors_[0].first); 59 EXPECT_EQ(-1, errors_[0].first);
60 EXPECT_EQ("error", errors_[0].second); 60 EXPECT_EQ("error", errors_[0].second);
61 } 61 }
62 62
63 } // namespace net 63 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698