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" |
11 #include "components/translate/core/common/translate_switches.h" | 11 #include "components/translate/core/common/translate_switches.h" |
12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
13 #include "net/base/url_util.h" | 13 #include "net/base/url_util.h" |
14 #include "net/http/http_request_headers.h" | 14 #include "net/http/http_request_headers.h" |
15 #include "net/url_request/test_url_fetcher_factory.h" | 15 #include "net/url_request/test_url_fetcher_factory.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
| 19 namespace translate { |
| 20 |
19 class TranslateScriptTest : public testing::Test { | 21 class TranslateScriptTest : public testing::Test { |
20 public: | 22 public: |
21 TranslateScriptTest() : testing::Test() {} | 23 TranslateScriptTest() : testing::Test() {} |
22 | 24 |
23 protected: | 25 protected: |
24 virtual void SetUp() { | 26 virtual void SetUp() { |
25 script_.reset(new TranslateScript); | 27 script_.reset(new TranslateScript); |
26 DCHECK(script_.get()); | 28 DCHECK(script_.get()); |
27 TranslateDownloadManager::GetInstance()->set_application_locale("en"); | 29 TranslateDownloadManager::GetInstance()->set_application_locale("en"); |
28 } | 30 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 Request(); | 113 Request(); |
112 net::TestURLFetcher* fetcher = GetTestURLFetcher(); | 114 net::TestURLFetcher* fetcher = GetTestURLFetcher(); |
113 ASSERT_TRUE(fetcher); | 115 ASSERT_TRUE(fetcher); |
114 | 116 |
115 GURL expected_url(script_url); | 117 GURL expected_url(script_url); |
116 GURL url = fetcher->GetOriginalURL(); | 118 GURL url = fetcher->GetOriginalURL(); |
117 EXPECT_TRUE(url.is_valid()); | 119 EXPECT_TRUE(url.is_valid()); |
118 EXPECT_EQ(expected_url.GetOrigin().spec(), url.GetOrigin().spec()); | 120 EXPECT_EQ(expected_url.GetOrigin().spec(), url.GetOrigin().spec()); |
119 EXPECT_EQ(expected_url.path(), url.path()); | 121 EXPECT_EQ(expected_url.path(), url.path()); |
120 } | 122 } |
| 123 |
| 124 } // namespace translate |
OLD | NEW |