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

Side by Side Diff: net/base/sdch_manager_unittest.cc

Issue 699233002: Revert disable of SDCH on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix HTTPS support test. Created 6 years, 1 month 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
« no previous file with comments | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <limits.h> 5 #include <limits.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/sdch_manager.h" 11 #include "net/base/sdch_manager.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 //------------------------------------------------------------------------------ 16 //------------------------------------------------------------------------------
17 // Workaround for http://crbug.com/418975; remove when fixed.
18 #if !defined(OS_IOS)
19
20 //------------------------------------------------------------------------------
21 // Provide sample data and compression results with a sample VCDIFF dictionary. 17 // Provide sample data and compression results with a sample VCDIFF dictionary.
22 // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary. 18 // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary.
23 static const char kTestVcdiffDictionary[] = "DictionaryFor" 19 static const char kTestVcdiffDictionary[] = "DictionaryFor"
24 "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n"; 20 "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n";
25 21
26 //------------------------------------------------------------------------------ 22 //------------------------------------------------------------------------------
27 23
28 class SdchManagerTest : public testing::Test { 24 class SdchManagerTest : public testing::Test {
29 protected: 25 protected:
30 SdchManagerTest() 26 SdchManagerTest()
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 server_hash_1, 510 server_hash_1,
515 GURL("http://" + dictionary_domain_1 + "/random_url"), 511 GURL("http://" + dictionary_domain_1 + "/random_url"),
516 &dictionary); 512 &dictionary);
517 EXPECT_FALSE(dictionary.get()); 513 EXPECT_FALSE(dictionary.get());
518 } 514 }
519 515
520 TEST_F(SdchManagerTest, HttpsCorrectlySupported) { 516 TEST_F(SdchManagerTest, HttpsCorrectlySupported) {
521 GURL url("http://www.google.com"); 517 GURL url("http://www.google.com");
522 GURL secure_url("https://www.google.com"); 518 GURL secure_url("https://www.google.com");
523 519
524 #if !defined(OS_IOS)
525 // Workaround for http://crbug.com/418975; remove when fixed.
526 bool expect_https_support = true; 520 bool expect_https_support = true;
527 #else
528 bool expect_https_support = false;
529 #endif
530 521
531 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); 522 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
532 EXPECT_EQ(expect_https_support, 523 EXPECT_EQ(expect_https_support,
533 sdch_manager()->IsInSupportedDomain(secure_url)); 524 sdch_manager()->IsInSupportedDomain(secure_url));
534 525
535 SdchManager::EnableSecureSchemeSupport(!expect_https_support); 526 SdchManager::EnableSecureSchemeSupport(!expect_https_support);
536 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); 527 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
537 EXPECT_NE(expect_https_support, 528 EXPECT_NE(expect_https_support,
538 sdch_manager()->IsInSupportedDomain(secure_url)); 529 sdch_manager()->IsInSupportedDomain(secure_url));
539 } 530 }
(...skipping 25 matching lines...) Expand all
565 556
566 dictionary = NULL; 557 dictionary = NULL;
567 sdch_manager()->GetVcdiffDictionary( 558 sdch_manager()->GetVcdiffDictionary(
568 server_hash, 559 server_hash,
569 GURL("http://" + dictionary_domain + "/random_url"), 560 GURL("http://" + dictionary_domain + "/random_url"),
570 &dictionary); 561 &dictionary);
571 EXPECT_FALSE(dictionary.get()); 562 EXPECT_FALSE(dictionary.get());
572 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url)); 563 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url));
573 } 564 }
574 565
575 #else
576
577 TEST(SdchManagerTest, SdchOffByDefault) {
578 GURL google_url("http://www.google.com");
579 SdchManager* sdch_manager(new SdchManager);
580
581 EXPECT_FALSE(sdch_manager->IsInSupportedDomain(google_url));
582 SdchManager::EnableSdchSupport(true);
583 EXPECT_TRUE(sdch_manager->IsInSupportedDomain(google_url));
584 }
585
586 #endif // !defined(OS_IOS)
587
588 } // namespace net 566 } // namespace net
OLDNEW
« no previous file with comments | « net/base/sdch_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698