OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // End-to-end SDCH tests. Uses the embedded test server to return SDCH | 5 // End-to-end SDCH tests. Uses the embedded test server to return SDCH |
6 // results | 6 // results |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 void UnsubscribeFromAllSdchNotifications() { | 603 void UnsubscribeFromAllSdchNotifications() { |
604 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 604 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
605 | 605 |
606 for (auto it = fetch_counts_.begin(); it != fetch_counts_.end(); ++it) | 606 for (auto it = fetch_counts_.begin(); it != fetch_counts_.end(); ++it) |
607 it->first->RemoveObserver(this); | 607 it->first->RemoveObserver(this); |
608 | 608 |
609 fetch_counts_.clear(); | 609 fetch_counts_.clear(); |
610 } | 610 } |
611 | 611 |
612 // SdchObserver | 612 // SdchObserver |
| 613 void OnDictionaryUsed(net::SdchManager* manager, |
| 614 const std::string& server_hash) override {} |
| 615 |
613 void OnGetDictionary(net::SdchManager* manager, | 616 void OnGetDictionary(net::SdchManager* manager, |
614 const GURL& request_url, | 617 const GURL& request_url, |
615 const GURL& dictionary_url) override { | 618 const GURL& dictionary_url) override { |
616 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 619 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
617 DLOG(ERROR) << "Retrieving count of notifications from manager " << manager; | 620 DLOG(ERROR) << "Retrieving count of notifications from manager " << manager; |
618 DCHECK(fetch_counts_.end() != fetch_counts_.find(manager)); | 621 DCHECK(fetch_counts_.end() != fetch_counts_.find(manager)); |
619 ++fetch_counts_[manager]; | 622 ++fetch_counts_[manager]; |
620 } | 623 } |
| 624 |
621 void OnClearDictionaries(net::SdchManager* manager) override {} | 625 void OnClearDictionaries(net::SdchManager* manager) override {} |
622 | 626 |
623 // URLFetcherDelegate | 627 // URLFetcherDelegate |
624 void OnURLFetchComplete(const net::URLFetcher* source) override { | 628 void OnURLFetchComplete(const net::URLFetcher* source) override { |
625 url_fetch_complete_ = true; | 629 url_fetch_complete_ = true; |
626 if (waiting_) | 630 if (waiting_) |
627 base::MessageLoopForUI::current()->Quit(); | 631 base::MessageLoopForUI::current()->Quit(); |
628 } | 632 } |
629 | 633 |
630 SdchResponseHandler response_handler_; | 634 SdchResponseHandler response_handler_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 ASSERT_TRUE(SetupIncognitoBrowser()); | 694 ASSERT_TRUE(SetupIncognitoBrowser()); |
691 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); | 695 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); |
692 | 696 |
693 // Data fetches on main browser should not be SDCH encoded. | 697 // Data fetches on main browser should not be SDCH encoded. |
694 bool sdch_encoding_used = true; | 698 bool sdch_encoding_used = true; |
695 ASSERT_TRUE(GetData(&sdch_encoding_used)); | 699 ASSERT_TRUE(GetData(&sdch_encoding_used)); |
696 EXPECT_FALSE(sdch_encoding_used); | 700 EXPECT_FALSE(sdch_encoding_used); |
697 } | 701 } |
698 | 702 |
699 } // namespace | 703 } // namespace |
OLD | NEW |