| 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 "chrome/browser/net/predictor.h" | 5 #include "chrome/browser/net/predictor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <sstream> | 11 #include <sstream> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/message_loop/message_loop.h" | |
| 18 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 19 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "base/values.h" | 21 #include "base/values.h" |
| 23 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 24 #include "chrome/browser/net/url_info.h" | 23 #include "chrome/browser/net/url_info.h" |
| 25 #include "content/public/test/test_browser_thread.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
| 26 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
| 27 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
| 28 #include "net/http/transport_security_state.h" | 27 #include "net/http/transport_security_state.h" |
| 29 #include "net/proxy/proxy_config_service_fixed.h" | 28 #include "net/proxy/proxy_config_service_fixed.h" |
| 30 #include "net/proxy/proxy_service.h" | 29 #include "net/proxy/proxy_service.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 33 | 32 |
| 34 using base::Time; | 33 using base::Time; |
| 35 using base::TimeDelta; | 34 using base::TimeDelta; |
| 36 using content::BrowserThread; | |
| 37 | |
| 38 namespace chrome_browser_net { | 35 namespace chrome_browser_net { |
| 39 | 36 |
| 40 class PredictorTest : public testing::Test { | 37 class PredictorTest : public testing::Test { |
| 41 public: | 38 public: |
| 42 PredictorTest() | 39 PredictorTest() = default; |
| 43 : ui_thread_(BrowserThread::UI, &loop_), | |
| 44 io_thread_(BrowserThread::IO, &loop_) {} | |
| 45 | 40 |
| 46 private: | 41 private: |
| 47 base::MessageLoopForUI loop_; | 42 content::TestBrowserThreadBundle test_browser_thread_bundle_; |
| 48 content::TestBrowserThread ui_thread_; | |
| 49 content::TestBrowserThread io_thread_; | |
| 50 }; | 43 }; |
| 51 | 44 |
| 52 //------------------------------------------------------------------------------ | 45 //------------------------------------------------------------------------------ |
| 53 // Functions to help synthesize and test serializations of subresource referrer | 46 // Functions to help synthesize and test serializations of subresource referrer |
| 54 // lists. | 47 // lists. |
| 55 | 48 |
| 56 // Return a motivation_list if we can find one for the given motivating_host (or | 49 // Return a motivation_list if we can find one for the given motivating_host (or |
| 57 // NULL if a match is not found). | 50 // NULL if a match is not found). |
| 58 static const base::ListValue* FindSerializationMotivation( | 51 static const base::ListValue* FindSerializationMotivation( |
| 59 const GURL& motivation, | 52 const GURL& motivation, |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); | 555 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); |
| 563 | 556 |
| 564 // Proxy may not be in use (the PAC script has not yet been evaluated), so the | 557 // Proxy may not be in use (the PAC script has not yet been evaluated), so the |
| 565 // name has been registered for pre-resolve. | 558 // name has been registered for pre-resolve. |
| 566 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); | 559 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); |
| 567 | 560 |
| 568 testing_master.Shutdown(); | 561 testing_master.Shutdown(); |
| 569 } | 562 } |
| 570 | 563 |
| 571 } // namespace chrome_browser_net | 564 } // namespace chrome_browser_net |
| OLD | NEW |