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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_private_apitest.cc

Issue 2851103002: Update some host_resolver()->AddRules in chrome/browser. (Closed)
Patch Set: fix Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 5 #include <utility>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 public: 132 public:
133 StreamsPrivateApiTest() {} 133 StreamsPrivateApiTest() {}
134 134
135 ~StreamsPrivateApiTest() override {} 135 ~StreamsPrivateApiTest() override {}
136 136
137 void SetUpOnMainThread() override { 137 void SetUpOnMainThread() override {
138 // Init test server. 138 // Init test server.
139 test_server_.reset(new net::EmbeddedTestServer); 139 test_server_.reset(new net::EmbeddedTestServer);
140 test_server_->RegisterRequestHandler(base::Bind(&HandleRequest)); 140 test_server_->RegisterRequestHandler(base::Bind(&HandleRequest));
141 ASSERT_TRUE(test_server_->Start()); 141 ASSERT_TRUE(test_server_->Start());
142 142 host_resolver()->AddRule("*", "127.0.0.1");
143 ExtensionApiTest::SetUpOnMainThread(); 143 ExtensionApiTest::SetUpOnMainThread();
144 } 144 }
145 145
146 void TearDownOnMainThread() override { 146 void TearDownOnMainThread() override {
147 // Tear down the test server. 147 // Tear down the test server.
148 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete()); 148 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete());
149 test_server_.reset(); 149 test_server_.reset();
150 ExtensionApiTest::TearDownOnMainThread(); 150 ExtensionApiTest::TearDownOnMainThread();
151 } 151 }
152 152
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // an installed, white-listed extension invokes the extension's 290 // an installed, white-listed extension invokes the extension's
291 // onExecuteContentHandler event (and does not start a download). 291 // onExecuteContentHandler event (and does not start a download).
292 // Regression test for http://crbug.com/342999. 292 // Regression test for http://crbug.com/342999.
293 IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, NavigateCrossSite) { 293 IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, NavigateCrossSite) {
294 ASSERT_TRUE(LoadTestExtension()) << message_; 294 ASSERT_TRUE(LoadTestExtension()) << message_;
295 295
296 ResultCatcher catcher; 296 ResultCatcher catcher;
297 297
298 // Navigate to a URL on a different hostname. 298 // Navigate to a URL on a different hostname.
299 static const char kInitialHost[] = "www.example.com"; 299 static const char kInitialHost[] = "www.example.com";
300 host_resolver()->AddRule(kInitialHost, "127.0.0.1");
301 GURL::Replacements replacements; 300 GURL::Replacements replacements;
302 replacements.SetHostStr(kInitialHost); 301 replacements.SetHostStr(kInitialHost);
303 GURL initial_url = 302 GURL initial_url =
304 test_server_->GetURL("/index.html").ReplaceComponents(replacements); 303 test_server_->GetURL("/index.html").ReplaceComponents(replacements);
305 ui_test_utils::NavigateToURL(browser(), initial_url); 304 ui_test_utils::NavigateToURL(browser(), initial_url);
306 305
307 // Now navigate to the doc file; the extension should pick it up normally. 306 // Now navigate to the doc file; the extension should pick it up normally.
308 ui_test_utils::NavigateToURL(browser(), 307 ui_test_utils::NavigateToURL(browser(),
309 test_server_->GetURL("/doc_path.doc")); 308 test_server_->GetURL("/doc_path.doc"));
310 309
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 base::RunLoop().RunUntilIdle(); 446 base::RunLoop().RunUntilIdle();
448 EXPECT_TRUE(catcher.GetNextResult()); 447 EXPECT_TRUE(catcher.GetNextResult());
449 448
450 ui_test_utils::NavigateToURL(browser(), 449 ui_test_utils::NavigateToURL(browser(),
451 test_server_->GetURL("/abort.rtf")); 450 test_server_->GetURL("/abort.rtf"));
452 base::RunLoop().RunUntilIdle(); 451 base::RunLoop().RunUntilIdle();
453 EXPECT_TRUE(catcher.GetNextResult()); 452 EXPECT_TRUE(catcher.GetNextResult());
454 } 453 }
455 454
456 } // namespace 455 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698