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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 " return true;\n" | 171 " return true;\n" |
172 " },\n" | 172 " },\n" |
173 " translatePage: function(sl, tl, cb) {\n" | 173 " translatePage: function(sl, tl, cb) {\n" |
174 " cb(1, true);\n" | 174 " cb(1, true);\n" |
175 " }\n" | 175 " }\n" |
176 "} } } };\n" | 176 "} } } };\n" |
177 "cr.googleTranslate.onTranslateElementLoad();\n"; | 177 "cr.googleTranslate.onTranslateElementLoad();\n"; |
178 net::TestURLFetcher* fetcher = | 178 net::TestURLFetcher* fetcher = |
179 factory.GetFetcherByID(translate::TranslateScript::kFetcherId); | 179 factory.GetFetcherByID(translate::TranslateScript::kFetcherId); |
180 ASSERT_TRUE(fetcher); | 180 ASSERT_TRUE(fetcher); |
181 net::URLRequestStatus status; | 181 fetcher->set_status(net::URLRequestStatus()); |
182 status.set_status(net::URLRequestStatus::SUCCESS); | |
183 fetcher->set_status(status); | |
184 fetcher->set_url(fetcher->GetOriginalURL()); | 182 fetcher->set_url(fetcher->GetOriginalURL()); |
185 fetcher->set_response_code(net::HTTP_OK); | 183 fetcher->set_response_code(net::HTTP_OK); |
186 fetcher->SetResponseString(element_js); | 184 fetcher->SetResponseString(element_js); |
187 fetcher->delegate()->OnURLFetchComplete(fetcher); | 185 fetcher->delegate()->OnURLFetchComplete(fetcher); |
188 | 186 |
189 // Wait for the page title is changed after the test finished. | 187 // Wait for the page title is changed after the test finished. |
190 const base::string16 result = watcher.WaitAndGetTitle(); | 188 const base::string16 result = watcher.WaitAndGetTitle(); |
191 EXPECT_EQ("PASS", base::UTF16ToASCII(result)); | 189 EXPECT_EQ("PASS", base::UTF16ToASCII(result)); |
192 } | 190 } |
193 | 191 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 GetNonSecureURL(kUpdateLocationAtOnloadTestPath)); | 347 GetNonSecureURL(kUpdateLocationAtOnloadTestPath)); |
350 | 348 |
351 // Wait for the page title is changed after the test finished. | 349 // Wait for the page title is changed after the test finished. |
352 const base::string16 result = watcher.WaitAndGetTitle(); | 350 const base::string16 result = watcher.WaitAndGetTitle(); |
353 EXPECT_EQ("PASS", base::UTF16ToASCII(result)); | 351 EXPECT_EQ("PASS", base::UTF16ToASCII(result)); |
354 | 352 |
355 // Check if there is no Translate infobar. | 353 // Check if there is no Translate infobar. |
356 translate = GetExistingTranslateInfoBarDelegate(); | 354 translate = GetExistingTranslateInfoBarDelegate(); |
357 EXPECT_FALSE(translate); | 355 EXPECT_FALSE(translate); |
358 } | 356 } |
OLD | NEW |