Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "net/url_request/url_fetcher_delegate.h" | 24 #include "net/url_request/url_fetcher_delegate.h" |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const base::FilePath::CharType kTranslateRoot[] = | 28 const base::FilePath::CharType kTranslateRoot[] = |
| 29 FILE_PATH_LITERAL("chrome/test/data/translate"); | 29 FILE_PATH_LITERAL("chrome/test/data/translate"); |
| 30 const char kNonSecurePrefix[] = "files/translate/"; | 30 const char kNonSecurePrefix[] = "files/translate/"; |
| 31 const char kSecurePrefix[] = "files/"; | 31 const char kSecurePrefix[] = "files/"; |
| 32 const char kFrenchTestPath[] = "fr_test.html"; | 32 const char kFrenchTestPath[] = "fr_test.html"; |
| 33 const char kRefreshMetaTagTestPath[] = "refresh_meta_tag.html"; | 33 const char kRefreshMetaTagTestPath[] = "refresh_meta_tag.html"; |
| 34 const char kRefreshMetaTagCaseInsensitiveTestPath[] = | |
| 35 "refresh_meta_tag_casei.html"; | |
| 34 const char kRefreshMetaTagAtOnloadTestPath[] = | 36 const char kRefreshMetaTagAtOnloadTestPath[] = |
| 35 "refresh_meta_tag_at_onload.html"; | 37 "refresh_meta_tag_at_onload.html"; |
| 36 const char kUpdateLocationTestPath[] = "update_location.html"; | 38 const char kUpdateLocationTestPath[] = "update_location.html"; |
| 37 const char kUpdateLocationAtOnloadTestPath[] = "update_location_at_onload.html"; | 39 const char kUpdateLocationAtOnloadTestPath[] = "update_location_at_onload.html"; |
| 38 const char kMainScriptPath[] = "pseudo_main.js"; | 40 const char kMainScriptPath[] = "pseudo_main.js"; |
| 39 const char kElementMainScriptPath[] = "pseudo_element_main.js"; | 41 const char kElementMainScriptPath[] = "pseudo_element_main.js"; |
| 40 | 42 |
| 41 }; // namespace | 43 }; // namespace |
| 42 | 44 |
| 43 class TranslateBrowserTest : public InProcessBrowserTest { | 45 class TranslateBrowserTest : public InProcessBrowserTest { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 GetNonSecureURL(kRefreshMetaTagTestPath)); | 163 GetNonSecureURL(kRefreshMetaTagTestPath)); |
| 162 | 164 |
| 163 // Wait for the page title is changed after the test finished. | 165 // Wait for the page title is changed after the test finished. |
| 164 const string16 result = watcher.WaitAndGetTitle(); | 166 const string16 result = watcher.WaitAndGetTitle(); |
| 165 EXPECT_TRUE(EqualsASCII(result, "PASS")); | 167 EXPECT_TRUE(EqualsASCII(result, "PASS")); |
| 166 | 168 |
| 167 // Check there is not infobar. | 169 // Check there is not infobar. |
| 168 ASSERT_EQ(0U, infobar_service->infobar_count()); | 170 ASSERT_EQ(0U, infobar_service->infobar_count()); |
| 169 } | 171 } |
| 170 | 172 |
| 173 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, | |
| 174 IgnoreRefreshMetaTagInCaseInsensitive) { | |
| 175 ASSERT_TRUE(test_server()->Start()); | |
| 176 | |
| 177 content::WebContents* web_contents = | |
| 178 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 179 ASSERT_TRUE(web_contents); | |
| 180 | |
| 181 // Check infobar count. | |
| 182 InfoBarService* infobar_service = | |
| 183 InfoBarService::FromWebContents(web_contents); | |
| 184 ASSERT_TRUE(infobar_service); | |
| 185 ASSERT_EQ(0U, infobar_service->infobar_count()); | |
| 186 | |
| 187 // Setup page title observer. | |
| 188 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); | |
| 189 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | |
| 190 | |
| 191 // Visit a test page. | |
| 192 ui_test_utils::NavigateToURL( | |
| 193 browser(), | |
| 194 GetNonSecureURL(kRefreshMetaTagCaseInsensitiveTestPath)); | |
| 195 | |
| 196 // Wait for the page title is changed after the test finished. | |
| 197 const string16 result = watcher.WaitAndGetTitle(); | |
| 198 EXPECT_TRUE(EqualsASCII(result, "PASS")); | |
|
sky
2013/05/28 14:28:49
EXPECT_EQ("PASS", UTF16ToASCII(result))
typically
Takashi Toyoshima
2013/05/28 23:58:03
Done.
| |
| 199 | |
| 200 // Check there is not infobar. | |
| 201 ASSERT_EQ(0U, infobar_service->infobar_count()); | |
|
Takashi Toyoshima
2013/05/28 23:58:03
Also, this infobar_count() check should not be ASS
| |
| 202 } | |
| 203 | |
| 171 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagAtOnload) { | 204 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagAtOnload) { |
| 172 ASSERT_TRUE(test_server()->Start()); | 205 ASSERT_TRUE(test_server()->Start()); |
| 173 | 206 |
| 174 content::WebContents* web_contents = | 207 content::WebContents* web_contents = |
| 175 browser()->tab_strip_model()->GetActiveWebContents(); | 208 browser()->tab_strip_model()->GetActiveWebContents(); |
| 176 ASSERT_TRUE(web_contents); | 209 ASSERT_TRUE(web_contents); |
| 177 | 210 |
| 178 // Check infobar count. | 211 // Check infobar count. |
| 179 InfoBarService* infobar_service = | 212 InfoBarService* infobar_service = |
| 180 InfoBarService::FromWebContents(web_contents); | 213 InfoBarService::FromWebContents(web_contents); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 285 |
| 253 // Wait for the page title is changed after the test finished. | 286 // Wait for the page title is changed after the test finished. |
| 254 const string16 result = watcher.WaitAndGetTitle(); | 287 const string16 result = watcher.WaitAndGetTitle(); |
| 255 EXPECT_TRUE(EqualsASCII(result, "PASS")); | 288 EXPECT_TRUE(EqualsASCII(result, "PASS")); |
| 256 | 289 |
| 257 // Check there is not infobar. | 290 // Check there is not infobar. |
| 258 ASSERT_EQ(0U, infobar_service->infobar_count()); | 291 ASSERT_EQ(0U, infobar_service->infobar_count()); |
| 259 } | 292 } |
| 260 | 293 |
| 261 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_ | 294 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_ |
| OLD | NEW |