OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/instant_test_utils.h" | 5 #include "chrome/browser/ui/search/instant_test_utils.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 std::string WrapScript(const std::string& script) { | 29 std::string WrapScript(const std::string& script) { |
30 return "domAutomationController.send(" + script + ")"; | 30 return "domAutomationController.send(" + script + ")"; |
31 } | 31 } |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 // InstantTestBase ----------------------------------------------------------- | 35 // InstantTestBase ----------------------------------------------------------- |
36 | 36 |
37 InstantTestBase::InstantTestBase() | 37 InstantTestBase::InstantTestBase() |
38 : https_test_server_( | 38 : https_test_server_(net::EmbeddedTestServer::TYPE_HTTPS), |
39 net::SpawnedTestServer::TYPE_HTTPS, | |
40 net::BaseTestServer::SSLOptions(), | |
41 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))), | |
42 init_suggestions_url_(false) { | 39 init_suggestions_url_(false) { |
| 40 https_test_server_.ServeFilesFromSourceDirectory("chrome/test/data"); |
43 } | 41 } |
44 | 42 |
45 InstantTestBase::~InstantTestBase() {} | 43 InstantTestBase::~InstantTestBase() {} |
46 | 44 |
47 void InstantTestBase::SetupInstant(Browser* browser) { | 45 void InstantTestBase::SetupInstant(Browser* browser) { |
48 browser_ = browser; | 46 browser_ = browser; |
49 | 47 |
50 TemplateURLService* service = | 48 TemplateURLService* service = |
51 TemplateURLServiceFactory::GetForProfile(browser_->profile()); | 49 TemplateURLServiceFactory::GetForProfile(browser_->profile()); |
52 search_test_utils::WaitForTemplateURLServiceToLoad(service); | 50 search_test_utils::WaitForTemplateURLServiceToLoad(service); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return content::ExecuteScriptAndExtractBool(rvh, js_chrome, loaded); | 168 return content::ExecuteScriptAndExtractBool(rvh, js_chrome, loaded); |
171 } | 169 } |
172 | 170 |
173 base::string16 InstantTestBase::GetBlueText() { | 171 base::string16 InstantTestBase::GetBlueText() { |
174 size_t start = 0, end = 0; | 172 size_t start = 0, end = 0; |
175 omnibox()->GetSelectionBounds(&start, &end); | 173 omnibox()->GetSelectionBounds(&start, &end); |
176 if (start > end) | 174 if (start > end) |
177 std::swap(start, end); | 175 std::swap(start, end); |
178 return omnibox()->GetText().substr(start, end - start); | 176 return omnibox()->GetText().substr(start, end - start); |
179 } | 177 } |
OLD | NEW |