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

Unified Diff: components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc

Issue 1890203002: Implement Web Restrictions in WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix final nits Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc
diff --git a/components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc b/components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc
index f3e7342f0f2d57d3b6ae2517a8bff0570af59943..d3b54b882fb633d3c90bf08853b06322b60db6a4 100644
--- a/components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc
+++ b/components/web_restrictions/browser/web_restrictions_resource_throttle_unittest.cc
@@ -60,8 +60,12 @@ class WebRestrictionsResourceThrottleTest : public testing::Test {
throttle_.set_controller_for_testing(&controller_);
}
+ void SetAuthority(std::string authority) {
+ provider_.SetAuthorityTask(authority);
+ }
+
void StartProvider() {
- provider_.SetAuthority("Good");
+ SetAuthority("Good");
bool defer;
throttle_.WillStartRequest(&defer);
run_loop_.Run();
@@ -89,7 +93,7 @@ TEST_F(WebRestrictionsResourceThrottleTest, WillStartRequest_NoAuthority) {
TEST_F(WebRestrictionsResourceThrottleTest, WillStartRequest_DeferredAllow) {
// Test deferring with a resource provider, and that the correct results
// are received.
- provider_.SetAuthority("Good");
+ SetAuthority("Good");
bool defer;
throttle_.WillStartRequest(&defer);
EXPECT_TRUE(defer);
@@ -99,7 +103,7 @@ TEST_F(WebRestrictionsResourceThrottleTest, WillStartRequest_DeferredAllow) {
}
TEST_F(WebRestrictionsResourceThrottleTest, WillStartRequest_DeferredForbid) {
- provider_.SetAuthority("Bad");
+ SetAuthority("Bad");
bool defer;
throttle_.WillStartRequest(&defer);
EXPECT_TRUE(defer);
@@ -123,7 +127,7 @@ TEST_F(WebRestrictionsResourceThrottleTest, WillStartRequest_Subresource) {
throttle.set_controller_for_testing(&test_controller);
bool defer;
throttle.WillStartRequest(&defer);
- EXPECT_FALSE(defer);
+ ASSERT_FALSE(defer);
}
TEST_F(WebRestrictionsResourceThrottleTest, WillRedirectRequest_KnownUrl) {
@@ -134,7 +138,7 @@ TEST_F(WebRestrictionsResourceThrottleTest, WillRedirectRequest_KnownUrl) {
redirect.new_url = GURL("http://example.com");
bool defer;
throttle_.WillRedirectRequest(redirect, &defer);
- EXPECT_FALSE(defer);
+ ASSERT_FALSE(defer);
}
TEST_F(WebRestrictionsResourceThrottleTest, WillRedirectRequest_NewUrl) {
@@ -148,7 +152,7 @@ TEST_F(WebRestrictionsResourceThrottleTest, WillRedirectRequest_NewUrl) {
throttle_.set_controller_for_testing(&test_controller);
bool defer;
throttle_.WillRedirectRequest(redirect, &defer);
- EXPECT_TRUE(defer);
+ ASSERT_TRUE(defer);
// If we don't wait for the callback it may happen after the exit, which
// results in accesses the redirect_url after the stack frame is freed.
test_run_loop.Run();

Powered by Google App Engine
This is Rietveld 408576698