OLD | NEW |
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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 base::Bind(&URLRequestMockCaptivePortalJobFactory:: | 439 base::Bind(&URLRequestMockCaptivePortalJobFactory:: |
439 SetBehindCaptivePortalOnIOThread, | 440 SetBehindCaptivePortalOnIOThread, |
440 base::Unretained(this), behind_captive_portal)); | 441 base::Unretained(this), behind_captive_portal)); |
441 } | 442 } |
442 | 443 |
443 scoped_ptr<net::URLRequestInterceptor> | 444 scoped_ptr<net::URLRequestInterceptor> |
444 URLRequestMockCaptivePortalJobFactory::CreateInterceptor() { | 445 URLRequestMockCaptivePortalJobFactory::CreateInterceptor() { |
445 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 446 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
446 scoped_ptr<Interceptor> interceptor(new Interceptor(behind_captive_portal_)); | 447 scoped_ptr<Interceptor> interceptor(new Interceptor(behind_captive_portal_)); |
447 interceptors_.push_back(interceptor.get()); | 448 interceptors_.push_back(interceptor.get()); |
448 return interceptor.Pass(); | 449 return std::move(interceptor); |
449 } | 450 } |
450 | 451 |
451 void URLRequestMockCaptivePortalJobFactory::AddUrlHandlersOnIOThread() { | 452 void URLRequestMockCaptivePortalJobFactory::AddUrlHandlersOnIOThread() { |
452 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 453 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
453 | 454 |
454 // Handle only exact matches, so any related requests, such as those for | 455 // Handle only exact matches, so any related requests, such as those for |
455 // favicons, are not handled by the factory. | 456 // favicons, are not handled by the factory. |
456 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 457 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
457 filter->AddUrlInterceptor(GURL(kMockCaptivePortalTestUrl), | 458 filter->AddUrlInterceptor(GURL(kMockCaptivePortalTestUrl), |
458 CreateInterceptor()); | 459 CreateInterceptor()); |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 | 2840 |
2840 EXPECT_EQ(CaptivePortalTabReloader::STATE_NEEDS_RELOAD, | 2841 EXPECT_EQ(CaptivePortalTabReloader::STATE_NEEDS_RELOAD, |
2841 GetStateOfTabReloaderAt(browser(), broken_tab_index)); | 2842 GetStateOfTabReloaderAt(browser(), broken_tab_index)); |
2842 | 2843 |
2843 WaitForInterstitialAttach(broken_tab_contents); | 2844 WaitForInterstitialAttach(broken_tab_contents); |
2844 portal_observer.WaitForResults(1); | 2845 portal_observer.WaitForResults(1); |
2845 | 2846 |
2846 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, | 2847 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, |
2847 GetInterstitialType(broken_tab_contents)); | 2848 GetInterstitialType(broken_tab_contents)); |
2848 } | 2849 } |
OLD | NEW |