Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: chrome/browser/extensions/extension_incognito_apitest.cc

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/browser_action_test_util.h" 5 #include "chrome/browser/extensions/browser_action_test_util.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_test_message_listener.h" 8 #include "chrome/browser/extensions/extension_test_message_listener.h"
9 #include "chrome/browser/extensions/user_script_master.h" 9 #include "chrome/browser/extensions/user_script_master.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 19 matching lines...) Expand all
30 // Open incognito window and navigate to test page. 30 // Open incognito window and navigate to test page.
31 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( 31 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord(
32 browser()->profile(), 32 browser()->profile(),
33 test_server()->GetURL("files/extensions/test_file.html")); 33 test_server()->GetURL("files/extensions/test_file.html"));
34 34
35 WebContents* tab = chrome::GetActiveWebContents(otr_browser); 35 WebContents* tab = chrome::GetActiveWebContents(otr_browser);
36 36
37 // Verify the script didn't run. 37 // Verify the script didn't run.
38 bool result = false; 38 bool result = false;
39 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 39 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
40 tab->GetRenderViewHost(), L"", 40 tab->GetRenderViewHost(),
41 L"window.domAutomationController.send(document.title == 'Unmodified')", 41 "",
42 "window.domAutomationController.send(document.title == 'Unmodified')",
42 &result)); 43 &result));
43 EXPECT_TRUE(result); 44 EXPECT_TRUE(result);
44 } 45 }
45 46
46 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoYesScript) { 47 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoYesScript) {
47 host_resolver()->AddRule("*", "127.0.0.1"); 48 host_resolver()->AddRule("*", "127.0.0.1");
48 ASSERT_TRUE(StartTestServer()); 49 ASSERT_TRUE(StartTestServer());
49 50
50 // Load a dummy extension. This just tests that we don't regress a 51 // Load a dummy extension. This just tests that we don't regress a
51 // crash fix when multiple incognito- and non-incognito-enabled extensions 52 // crash fix when multiple incognito- and non-incognito-enabled extensions
(...skipping 13 matching lines...) Expand all
65 // Open incognito window and navigate to test page. 66 // Open incognito window and navigate to test page.
66 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( 67 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord(
67 browser()->profile(), 68 browser()->profile(),
68 test_server()->GetURL("files/extensions/test_file.html")); 69 test_server()->GetURL("files/extensions/test_file.html"));
69 70
70 WebContents* tab = chrome::GetActiveWebContents(otr_browser); 71 WebContents* tab = chrome::GetActiveWebContents(otr_browser);
71 72
72 // Verify the script ran. 73 // Verify the script ran.
73 bool result = false; 74 bool result = false;
74 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 75 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
75 tab->GetRenderViewHost(), L"", 76 tab->GetRenderViewHost(),
76 L"window.domAutomationController.send(document.title == 'modified')", 77 "",
78 "window.domAutomationController.send(document.title == 'modified')",
77 &result)); 79 &result));
78 EXPECT_TRUE(result); 80 EXPECT_TRUE(result);
79 } 81 }
80 82
81 // Tests that an extension which is enabled for incognito mode doesn't 83 // Tests that an extension which is enabled for incognito mode doesn't
82 // accidentially create and incognito profile. 84 // accidentially create and incognito profile.
83 // Test disabled due to http://crbug.com/89054. 85 // Test disabled due to http://crbug.com/89054.
84 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_DontCreateIncognitoProfile) { 86 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_DontCreateIncognitoProfile) {
85 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile()); 87 ASSERT_FALSE(browser()->profile()->HasOffTheRecordProfile());
86 ASSERT_TRUE(RunExtensionTestIncognito( 88 ASSERT_TRUE(RunExtensionTestIncognito(
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Open incognito window and navigate to test page. 195 // Open incognito window and navigate to test page.
194 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord( 196 Browser* incognito_browser = ui_test_utils::OpenURLOffTheRecord(
195 browser()->profile(), 197 browser()->profile(),
196 test_server()->GetURL("files/extensions/test_file.html")); 198 test_server()->GetURL("files/extensions/test_file.html"));
197 199
198 // Simulate the incognito's browser action being clicked. 200 // Simulate the incognito's browser action being clicked.
199 BrowserActionTestUtil(incognito_browser).Press(0); 201 BrowserActionTestUtil(incognito_browser).Press(0);
200 202
201 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 203 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
202 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_source_apitest.cc ('k') | chrome/browser/extensions/extension_keybinding_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698