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/ui/webui/net_internals/net_internals_ui_browsertest.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 //////////////////////////////////////////////////////////////////////////////// | 82 //////////////////////////////////////////////////////////////////////////////// |
83 // NetInternalsTest::MessageHandler | 83 // NetInternalsTest::MessageHandler |
84 //////////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
86 // Class to handle messages from the renderer needed by certain tests. | 86 // Class to handle messages from the renderer needed by certain tests. |
87 class NetInternalsTest::MessageHandler : public content::WebUIMessageHandler { | 87 class NetInternalsTest::MessageHandler : public content::WebUIMessageHandler { |
88 public: | 88 public: |
89 explicit MessageHandler(NetInternalsTest* net_internals_test); | 89 explicit MessageHandler(NetInternalsTest* net_internals_test); |
90 | 90 |
91 private: | 91 private: |
92 virtual void RegisterMessages() override; | 92 void RegisterMessages() override; |
93 | 93 |
94 // Runs NetInternalsTest.callback with the given value. | 94 // Runs NetInternalsTest.callback with the given value. |
95 void RunJavascriptCallback(base::Value* value); | 95 void RunJavascriptCallback(base::Value* value); |
96 | 96 |
97 // Takes a string and provides the corresponding URL from the test server, | 97 // Takes a string and provides the corresponding URL from the test server, |
98 // which must already have been started. | 98 // which must already have been started. |
99 void GetTestServerURL(const base::ListValue* list_value); | 99 void GetTestServerURL(const base::ListValue* list_value); |
100 | 100 |
101 // Called on UI thread. Adds an entry to the cache for the specified | 101 // Called on UI thread. Adds an entry to the cache for the specified |
102 // hostname by posting a task to the IO thread. Takes the host name, | 102 // hostname by posting a task to the IO thread. Takes the host name, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 GURL url_loader = test_server()->GetURL(replacement_path); | 345 GURL url_loader = test_server()->GetURL(replacement_path); |
346 return url_loader; | 346 return url_loader; |
347 } | 347 } |
348 | 348 |
349 bool NetInternalsTest::StartTestServer() { | 349 bool NetInternalsTest::StartTestServer() { |
350 if (test_server_started_) | 350 if (test_server_started_) |
351 return true; | 351 return true; |
352 test_server_started_ = test_server()->Start(); | 352 test_server_started_ = test_server()->Start(); |
353 return test_server_started_; | 353 return test_server_started_; |
354 } | 354 } |
OLD | NEW |