| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include "base/base64.h" | 11 #include "base/base64.h" |
| 9 #include "base/bind.h" | 12 #include "base/bind.h" |
| 10 #include "base/callback.h" | 13 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 14 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 15 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 16 #include "base/strings/string_tokenizer.h" | 19 #include "base/strings/string_tokenizer.h" |
| 17 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "build/build_config.h" |
| 19 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 24 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 21 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 25 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 22 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 26 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
| 25 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/browser_tabstrip.h" | 30 #include "chrome/browser/ui/browser_tabstrip.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 31 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 32 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 content::BrowserThread::PostTask( | 484 content::BrowserThread::PostTask( |
| 481 content::BrowserThread::IO, FROM_HERE, | 485 content::BrowserThread::IO, FROM_HERE, |
| 482 base::Bind(&SdchResponseHandler::WaitAndGetRequestVector, | 486 base::Bind(&SdchResponseHandler::WaitAndGetRequestVector, |
| 483 base::Unretained(&response_handler_), | 487 base::Unretained(&response_handler_), |
| 484 num_requests, | 488 num_requests, |
| 485 run_loop.QuitClosure(), | 489 run_loop.QuitClosure(), |
| 486 result)); | 490 result)); |
| 487 run_loop.Run(); | 491 run_loop.Run(); |
| 488 } | 492 } |
| 489 | 493 |
| 490 uint16 test_server_port() { return test_server_.port(); } | 494 uint16_t test_server_port() { return test_server_.port(); } |
| 491 | 495 |
| 492 void SetSdchCacheability(bool cache_sdch_response) { | 496 void SetSdchCacheability(bool cache_sdch_response) { |
| 493 base::RunLoop run_loop; | 497 base::RunLoop run_loop; |
| 494 content::BrowserThread::PostTaskAndReply( | 498 content::BrowserThread::PostTaskAndReply( |
| 495 content::BrowserThread::IO, FROM_HERE, | 499 content::BrowserThread::IO, FROM_HERE, |
| 496 base::Bind(&SdchResponseHandler::set_cache_sdch_response, | 500 base::Bind(&SdchResponseHandler::set_cache_sdch_response, |
| 497 base::Unretained(&response_handler_), | 501 base::Unretained(&response_handler_), |
| 498 cache_sdch_response), | 502 cache_sdch_response), |
| 499 run_loop.QuitClosure()); | 503 run_loop.QuitClosure()); |
| 500 run_loop.Run(); | 504 run_loop.Run(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 ASSERT_TRUE(SetupIncognitoBrowser()); | 710 ASSERT_TRUE(SetupIncognitoBrowser()); |
| 707 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); | 711 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); |
| 708 | 712 |
| 709 // Data fetches on main browser should not be SDCH encoded. | 713 // Data fetches on main browser should not be SDCH encoded. |
| 710 bool sdch_encoding_used = true; | 714 bool sdch_encoding_used = true; |
| 711 ASSERT_TRUE(GetData(&sdch_encoding_used)); | 715 ASSERT_TRUE(GetData(&sdch_encoding_used)); |
| 712 EXPECT_FALSE(sdch_encoding_used); | 716 EXPECT_FALSE(sdch_encoding_used); |
| 713 } | 717 } |
| 714 | 718 |
| 715 } // namespace | 719 } // namespace |
| OLD | NEW |