| 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 #include "components/translate/core/browser/translate_script.h" | 5 #include "components/translate/core/browser/translate_script.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "components/translate/core/browser/translate_download_manager.h" | 10 #include "components/translate/core/browser/translate_download_manager.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 url, | 97 url, |
| 98 TranslateScript::kJavascriptLoaderCallbackQueryName, | 98 TranslateScript::kJavascriptLoaderCallbackQueryName, |
| 99 &javascript_loader_callback); | 99 &javascript_loader_callback); |
| 100 EXPECT_EQ(std::string(TranslateScript::kJavascriptLoaderCallbackQueryValue), | 100 EXPECT_EQ(std::string(TranslateScript::kJavascriptLoaderCallbackQueryValue), |
| 101 javascript_loader_callback); | 101 javascript_loader_callback); |
| 102 #endif // !defined(OS_IOS) | 102 #endif // !defined(OS_IOS) |
| 103 } | 103 } |
| 104 | 104 |
| 105 TEST_F(TranslateScriptTest, CheckScriptURL) { | 105 TEST_F(TranslateScriptTest, CheckScriptURL) { |
| 106 const std::string script_url("http://www.tamurayukari.com/mero-n.js"); | 106 const std::string script_url("http://www.tamurayukari.com/mero-n.js"); |
| 107 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 107 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 108 command_line->AppendSwitchASCII(translate::switches::kTranslateScriptURL, | 108 command_line->AppendSwitchASCII(translate::switches::kTranslateScriptURL, |
| 109 script_url); | 109 script_url); |
| 110 | 110 |
| 111 Request(); | 111 Request(); |
| 112 net::TestURLFetcher* fetcher = GetTestURLFetcher(); | 112 net::TestURLFetcher* fetcher = GetTestURLFetcher(); |
| 113 ASSERT_TRUE(fetcher); | 113 ASSERT_TRUE(fetcher); |
| 114 | 114 |
| 115 GURL expected_url(script_url); | 115 GURL expected_url(script_url); |
| 116 GURL url = fetcher->GetOriginalURL(); | 116 GURL url = fetcher->GetOriginalURL(); |
| 117 EXPECT_TRUE(url.is_valid()); | 117 EXPECT_TRUE(url.is_valid()); |
| 118 EXPECT_EQ(expected_url.GetOrigin().spec(), url.GetOrigin().spec()); | 118 EXPECT_EQ(expected_url.GetOrigin().spec(), url.GetOrigin().spec()); |
| 119 EXPECT_EQ(expected_url.path(), url.path()); | 119 EXPECT_EQ(expected_url.path(), url.path()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace translate | 122 } // namespace translate |
| OLD | NEW |