OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/browser.h" |
6 #include "chrome/browser/browser_list.h" | 6 #include "chrome/browser/browser_list.h" |
7 #include "chrome/browser/browser_window.h" | 7 #include "chrome/browser/browser_window.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
12 #include "chrome/test/ui_test_utils.h" | 12 #include "chrome/test/ui_test_utils.h" |
| 13 #include "net/base/mock_host_resolver.h" |
13 | 14 |
14 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, IncognitoNoScript) { | 15 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, IncognitoNoScript) { |
15 host_resolver()->AddRule("*", "127.0.0.1"); | 16 host_resolver()->AddRule("*", "127.0.0.1"); |
16 StartHTTPServer(); | 17 StartHTTPServer(); |
17 | 18 |
18 // Loads a simple extension which attempts to change the title of every page | 19 // Loads a simple extension which attempts to change the title of every page |
19 // that loads to "modified". | 20 // that loads to "modified". |
20 FilePath extension_path = test_data_dir_.AppendASCII("api_test") | 21 FilePath extension_path = test_data_dir_.AppendASCII("api_test") |
21 .AppendASCII("incognito_no_script"); | 22 .AppendASCII("incognito_no_script"); |
22 ASSERT_TRUE(LoadExtension(extension_path)); | 23 ASSERT_TRUE(LoadExtension(extension_path)); |
23 | 24 |
24 // Open incognito window and navigate to test page. | 25 // Open incognito window and navigate to test page. |
25 Browser::OpenURLOffTheRecord(browser()->profile(), | 26 Browser::OpenURLOffTheRecord(browser()->profile(), |
26 GURL("http://www.foo.com:1337/files/extensions/test_file.html")); | 27 GURL("http://www.foo.com:1337/files/extensions/test_file.html")); |
27 Profile* off_the_record_profile = | 28 Profile* off_the_record_profile = |
28 browser()->profile()->GetOffTheRecordProfile(); | 29 browser()->profile()->GetOffTheRecordProfile(); |
29 Browser* otr_browser = Browser::Create(off_the_record_profile); | 30 Browser* otr_browser = Browser::Create(off_the_record_profile); |
30 otr_browser->AddTabWithURL( | 31 otr_browser->AddTabWithURL( |
31 GURL("http://www.foo.com:1337/files/extensions/test_file.html"), | 32 GURL("http://www.foo.com:1337/files/extensions/test_file.html"), |
32 GURL(), | 33 GURL(), |
33 PageTransition::LINK, | 34 PageTransition::LINK, |
34 true, | 35 true, |
35 -1, | 36 -1, |
36 false, | 37 false, |
37 NULL); | 38 NULL); |
38 otr_browser->window()->Show(); | 39 otr_browser->window()->Show(); |
39 ui_test_utils::WaitForNavigationInCurrentTab(otr_browser); | 40 ui_test_utils::WaitForNavigationInCurrentTab(otr_browser); |
40 | 41 |
41 string16 title; | 42 string16 title; |
42 ui_test_utils::GetCurrentTabTitle(otr_browser, &title); | 43 ui_test_utils::GetCurrentTabTitle(otr_browser, &title); |
43 ASSERT_EQ("Unmodified", UTF16ToASCII(title)); | 44 ASSERT_EQ("Unmodified", UTF16ToASCII(title)); |
44 } | 45 } |
OLD | NEW |