summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/init_proxy_resolver_unittest.cc77
-rw-r--r--net/proxy/proxy_resolver_v8_unittest.cc24
-rw-r--r--net/proxy/proxy_service_unittest.cc27
3 files changed, 63 insertions, 65 deletions
diff --git a/net/proxy/init_proxy_resolver_unittest.cc b/net/proxy/init_proxy_resolver_unittest.cc
index 16af01a..46b8b79 100644
--- a/net/proxy/init_proxy_resolver_unittest.cc
+++ b/net/proxy/init_proxy_resolver_unittest.cc
@@ -179,18 +179,17 @@ TEST(InitProxyResolverTest, CustomPacSucceeds) {
// Check the LoadLog was filled correctly.
EXPECT_EQ(9u, log->entries().size());
- ExpectLogContains(log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 8, LoadLog::TYPE_INIT_PROXY_RESOLVER,
- LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(*log, 8, LoadLog::TYPE_INIT_PROXY_RESOLVER));
}
// Fail downloading the custom PAC script.
@@ -212,14 +211,13 @@ TEST(InitProxyResolverTest, CustomPacFails1) {
// Check the LoadLog was filled correctly.
EXPECT_EQ(6u, log->entries().size());
- ExpectLogContains(log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER,
- LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(*log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER));
}
// Fail parsing the custom PAC script.
@@ -312,26 +310,25 @@ TEST(InitProxyResolverTest, AutodetectFailCustomSuccess2) {
// (Note that the Fetch and Set states are repeated since both WPAD and custom
// PAC scripts are tried).
EXPECT_EQ(17u, log->entries().size());
- ExpectLogContains(log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 9, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 12, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 13, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 15, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 16, LoadLog::TYPE_INIT_PROXY_RESOLVER,
- LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 9, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 12, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 13, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 15, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT));
+ EXPECT_TRUE(LogContainsEndEvent(*log, 16, LoadLog::TYPE_INIT_PROXY_RESOLVER));
}
// Fails at WPAD (downloading), and fails at custom PAC (downloading).
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc
index 4d1c1b8..ee536b0 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -435,18 +435,18 @@ TEST(ProxyResolverV8Test, LoadLog) {
// isInNet() and isResolvable().
EXPECT_EQ(6u, log->entries().size());
- ExpectLogContains(log, 0, LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 1, LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 2, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 3, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 4, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 5, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
- LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 0, LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 1, LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 2, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 3, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 4, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 5, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE));
}
// Try loading a PAC script that ends with a comment and has no terminal
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index 0178dbe..0a026a0 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -108,8 +108,8 @@ TEST(ProxyServiceTest, Direct) {
// Check the LoadLog was filled correctly.
EXPECT_EQ(5u, log->entries().size());
- ExpectLogContains(log, 0, LoadLog::TYPE_PROXY_SERVICE, LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_PROXY_SERVICE, LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_PROXY_SERVICE));
+ EXPECT_TRUE(LogContainsEndEvent(*log, 4, LoadLog::TYPE_PROXY_SERVICE));
}
TEST(ProxyServiceTest, PAC) {
@@ -147,12 +147,12 @@ TEST(ProxyServiceTest, PAC) {
// Check the LoadLog was filled correctly.
EXPECT_EQ(7u, log->entries().size());
- ExpectLogContains(log, 0, LoadLog::TYPE_PROXY_SERVICE, LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 3, LoadLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
- LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
- LoadLog::PHASE_END);
- ExpectLogContains(log, 6, LoadLog::TYPE_PROXY_SERVICE, LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_PROXY_SERVICE));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log, 3, LoadLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC));
+ EXPECT_TRUE(LogContainsEndEvent(
+ *log, 4, LoadLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC));
+ EXPECT_TRUE(LogContainsEndEvent(*log, 6, LoadLog::TYPE_PROXY_SERVICE));
}
// Test that the proxy resolver does not see the URL's username/password
@@ -1267,13 +1267,14 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) {
// Check the LoadLog for request 1 (which was cancelled) got filled properly.
EXPECT_EQ(6u, log1->entries().size());
- ExpectLogContains(log1, 0, LoadLog::TYPE_PROXY_SERVICE, LoadLog::PHASE_BEGIN);
- ExpectLogContains(log1, 3, LoadLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC,
- LoadLog::PHASE_BEGIN);
+ EXPECT_TRUE(LogContainsBeginEvent(*log1, 0, LoadLog::TYPE_PROXY_SERVICE));
+ EXPECT_TRUE(LogContainsBeginEvent(
+ *log1, 3, LoadLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC));
// Note that TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC is never completed before
// the cancellation occured.
- ExpectLogContains(log1, 4, LoadLog::TYPE_CANCELLED, LoadLog::PHASE_NONE);
- ExpectLogContains(log1, 5, LoadLog::TYPE_PROXY_SERVICE, LoadLog::PHASE_END);
+ EXPECT_TRUE(LogContainsEvent(
+ *log1, 4, LoadLog::TYPE_CANCELLED, LoadLog::PHASE_NONE));
+ EXPECT_TRUE(LogContainsEndEvent(*log1, 5, LoadLog::TYPE_PROXY_SERVICE));
}
// Test that if auto-detect fails, we fall-back to the custom pac.