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

Side by Side Diff: chrome/browser/extensions/extension_icon_source_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 "base/logging.h" 5 #include "base/logging.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/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_tabstrip.h" 10 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 17 matching lines...) Expand all
28 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_with_permission"))); 28 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_with_permission")));
29 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_no_permission"))); 29 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_no_permission")));
30 std::string result; 30 std::string result;
31 31
32 // Test that the icons are loaded and that the chrome://extension-icon 32 // Test that the icons are loaded and that the chrome://extension-icon
33 // parameters work correctly. 33 // parameters work correctly.
34 ui_test_utils::NavigateToURL( 34 ui_test_utils::NavigateToURL(
35 browser(), 35 browser(),
36 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html")); 36 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html"));
37 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 37 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
38 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", 38 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
39 L"window.domAutomationController.send(document.title)", 39 "",
40 "window.domAutomationController.send(document.title)",
40 &result)); 41 &result));
41 EXPECT_EQ(result, "Loaded"); 42 EXPECT_EQ(result, "Loaded");
42 43
43 // Verify that the an extension can't load chrome://extension-icon icons 44 // Verify that the an extension can't load chrome://extension-icon icons
44 // without the management permission. 45 // without the management permission.
45 ui_test_utils::NavigateToURL( 46 ui_test_utils::NavigateToURL(
46 browser(), 47 browser(),
47 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html")); 48 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html"));
48 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 49 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
49 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", 50 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
50 L"window.domAutomationController.send(document.title)", 51 "",
52 "window.domAutomationController.send(document.title)",
51 &result)); 53 &result));
52 EXPECT_EQ(result, "Not Loaded"); 54 EXPECT_EQ(result, "Not Loaded");
53 } 55 }
54 56
55 IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) { 57 IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) {
56 FilePath basedir = test_data_dir_.AppendASCII("icons"); 58 FilePath basedir = test_data_dir_.AppendASCII("icons");
57 ASSERT_TRUE(LoadExtensionIncognito( 59 ASSERT_TRUE(LoadExtensionIncognito(
58 basedir.AppendASCII("extension_with_permission"))); 60 basedir.AppendASCII("extension_with_permission")));
59 ASSERT_TRUE(LoadExtensionIncognito( 61 ASSERT_TRUE(LoadExtensionIncognito(
60 basedir.AppendASCII("extension_no_permission"))); 62 basedir.AppendASCII("extension_no_permission")));
61 std::string result; 63 std::string result;
62 64
63 // Test that the icons are loaded and that the chrome://extension-icon 65 // Test that the icons are loaded and that the chrome://extension-icon
64 // parameters work correctly. 66 // parameters work correctly.
65 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord( 67 Browser* otr_browser = ui_test_utils::OpenURLOffTheRecord(
66 browser()->profile(), 68 browser()->profile(),
67 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html")); 69 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html"));
68 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 70 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
69 chrome::GetActiveWebContents(otr_browser)->GetRenderViewHost(), L"", 71 chrome::GetActiveWebContents(otr_browser)->GetRenderViewHost(),
70 L"window.domAutomationController.send(document.title)", 72 "",
73 "window.domAutomationController.send(document.title)",
71 &result)); 74 &result));
72 EXPECT_EQ(result, "Loaded"); 75 EXPECT_EQ(result, "Loaded");
73 76
74 // Verify that the an extension can't load chrome://extension-icon icons 77 // Verify that the an extension can't load chrome://extension-icon icons
75 // without the management permission. 78 // without the management permission.
76 ui_test_utils::OpenURLOffTheRecord( 79 ui_test_utils::OpenURLOffTheRecord(
77 browser()->profile(), 80 browser()->profile(),
78 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html")); 81 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html"));
79 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 82 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
80 chrome::GetActiveWebContents(otr_browser)->GetRenderViewHost(), L"", 83 chrome::GetActiveWebContents(otr_browser)->GetRenderViewHost(),
81 L"window.domAutomationController.send(document.title)", 84 "",
85 "window.domAutomationController.send(document.title)",
82 &result)); 86 &result));
83 EXPECT_EQ(result, "Not Loaded"); 87 EXPECT_EQ(result, "Not Loaded");
84 } 88 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_dom_clipboard_apitest.cc ('k') | chrome/browser/extensions/extension_incognito_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698