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

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

Issue 10535077: TabContentsWrapper -> TabContents, part 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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 15 matching lines...) Expand all
26 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("incognito") 26 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("incognito")
27 .AppendASCII("content_scripts"))); 27 .AppendASCII("content_scripts")));
28 28
29 // Open incognito window and navigate to test page. 29 // Open incognito window and navigate to test page.
30 ui_test_utils::OpenURLOffTheRecord( 30 ui_test_utils::OpenURLOffTheRecord(
31 browser()->profile(), 31 browser()->profile(),
32 test_server()->GetURL("files/extensions/test_file.html")); 32 test_server()->GetURL("files/extensions/test_file.html"));
33 33
34 Browser* otr_browser = browser::FindTabbedBrowser( 34 Browser* otr_browser = browser::FindTabbedBrowser(
35 browser()->profile()->GetOffTheRecordProfile(), false); 35 browser()->profile()->GetOffTheRecordProfile(), false);
36 WebContents* tab = otr_browser->GetSelectedWebContents(); 36 WebContents* tab = otr_browser->GetActiveWebContents();
37 37
38 // Verify the script didn't run. 38 // Verify the script didn't run.
39 bool result = false; 39 bool result = false;
40 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 40 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
41 tab->GetRenderViewHost(), L"", 41 tab->GetRenderViewHost(), L"",
42 L"window.domAutomationController.send(document.title == 'Unmodified')", 42 L"window.domAutomationController.send(document.title == 'Unmodified')",
43 &result)); 43 &result));
44 EXPECT_TRUE(result); 44 EXPECT_TRUE(result);
45 } 45 }
46 46
(...skipping 16 matching lines...) Expand all
63 ASSERT_TRUE(LoadExtension(test_data_dir_ 63 ASSERT_TRUE(LoadExtension(test_data_dir_
64 .AppendASCII("content_scripts").AppendASCII("isolated_world1"))); 64 .AppendASCII("content_scripts").AppendASCII("isolated_world1")));
65 65
66 // Open incognito window and navigate to test page. 66 // Open incognito window and navigate to test page.
67 ui_test_utils::OpenURLOffTheRecord( 67 ui_test_utils::OpenURLOffTheRecord(
68 browser()->profile(), 68 browser()->profile(),
69 test_server()->GetURL("files/extensions/test_file.html")); 69 test_server()->GetURL("files/extensions/test_file.html"));
70 70
71 Browser* otr_browser = browser::FindTabbedBrowser( 71 Browser* otr_browser = browser::FindTabbedBrowser(
72 browser()->profile()->GetOffTheRecordProfile(), false); 72 browser()->profile()->GetOffTheRecordProfile(), false);
73 WebContents* tab = otr_browser->GetSelectedWebContents(); 73 WebContents* tab = otr_browser->GetActiveWebContents();
74 74
75 // Verify the script ran. 75 // Verify the script ran.
76 bool result = false; 76 bool result = false;
77 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 77 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
78 tab->GetRenderViewHost(), L"", 78 tab->GetRenderViewHost(), L"",
79 L"window.domAutomationController.send(document.title == 'modified')", 79 L"window.domAutomationController.send(document.title == 'modified')",
80 &result)); 80 &result));
81 EXPECT_TRUE(result); 81 EXPECT_TRUE(result);
82 } 82 }
83 83
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 test_server()->GetURL("files/extensions/test_file.html")); 199 test_server()->GetURL("files/extensions/test_file.html"));
200 200
201 Browser* incognito_browser = browser::FindTabbedBrowser( 201 Browser* incognito_browser = browser::FindTabbedBrowser(
202 browser()->profile()->GetOffTheRecordProfile(), false); 202 browser()->profile()->GetOffTheRecordProfile(), false);
203 203
204 // Simulate the incognito's browser action being clicked. 204 // Simulate the incognito's browser action being clicked.
205 BrowserActionTestUtil(incognito_browser).Press(0); 205 BrowserActionTestUtil(incognito_browser).Press(0);
206 206
207 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 207 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
208 } 208 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_source_apitest.cc ('k') | chrome/browser/extensions/extension_install_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698