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