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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/browser_tabstrip.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 #include "net/base/mock_host_resolver.h" 16 #include "net/base/mock_host_resolver.h"
16 17
17 class ExtensionIconSourceTest : public ExtensionApiTest { 18 class ExtensionIconSourceTest : public ExtensionApiTest {
18 protected: 19 protected:
19 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 20 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
20 ExtensionApiTest::SetUpCommandLine(command_line); 21 ExtensionApiTest::SetUpCommandLine(command_line);
21 command_line->AppendSwitch(switches::kAllowLegacyExtensionManifests); 22 command_line->AppendSwitch(switches::kAllowLegacyExtensionManifests);
22 } 23 }
23 }; 24 };
24 25
25 IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoaded) { 26 IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoaded) {
26 FilePath basedir = test_data_dir_.AppendASCII("icons"); 27 FilePath basedir = test_data_dir_.AppendASCII("icons");
27 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_with_permission"))); 28 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_with_permission")));
28 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_no_permission"))); 29 ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_no_permission")));
29 std::string result; 30 std::string result;
30 31
31 // 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
32 // parameters work correctly. 33 // parameters work correctly.
33 ui_test_utils::NavigateToURL( 34 ui_test_utils::NavigateToURL(
34 browser(), 35 browser(),
35 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html")); 36 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html"));
36 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 37 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
37 browser()->GetActiveWebContents()->GetRenderViewHost(), L"", 38 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
38 L"window.domAutomationController.send(document.title)", 39 L"window.domAutomationController.send(document.title)",
39 &result)); 40 &result));
40 EXPECT_EQ(result, "Loaded"); 41 EXPECT_EQ(result, "Loaded");
41 42
42 // Verify that the an extension can't load chrome://extension-icon icons 43 // Verify that the an extension can't load chrome://extension-icon icons
43 // without the management permission. 44 // without the management permission.
44 ui_test_utils::NavigateToURL( 45 ui_test_utils::NavigateToURL(
45 browser(), 46 browser(),
46 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html")); 47 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html"));
47 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 48 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
48 browser()->GetActiveWebContents()->GetRenderViewHost(), L"", 49 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
49 L"window.domAutomationController.send(document.title)", 50 L"window.domAutomationController.send(document.title)",
50 &result)); 51 &result));
51 EXPECT_EQ(result, "Not Loaded"); 52 EXPECT_EQ(result, "Not Loaded");
52 } 53 }
53 54
54 IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) { 55 IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) {
55 FilePath basedir = test_data_dir_.AppendASCII("icons"); 56 FilePath basedir = test_data_dir_.AppendASCII("icons");
56 ASSERT_TRUE(LoadExtensionIncognito( 57 ASSERT_TRUE(LoadExtensionIncognito(
57 basedir.AppendASCII("extension_with_permission"))); 58 basedir.AppendASCII("extension_with_permission")));
58 ASSERT_TRUE(LoadExtensionIncognito( 59 ASSERT_TRUE(LoadExtensionIncognito(
59 basedir.AppendASCII("extension_no_permission"))); 60 basedir.AppendASCII("extension_no_permission")));
60 std::string result; 61 std::string result;
61 62
62 // Test that the icons are loaded and that the chrome://extension-icon 63 // Test that the icons are loaded and that the chrome://extension-icon
63 // parameters work correctly. 64 // parameters work correctly.
64 ui_test_utils::OpenURLOffTheRecord( 65 ui_test_utils::OpenURLOffTheRecord(
65 browser()->profile(), 66 browser()->profile(),
66 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html")); 67 GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html"));
67 Browser* otr_browser = browser::FindTabbedBrowser( 68 Browser* otr_browser = browser::FindTabbedBrowser(
68 browser()->profile()->GetOffTheRecordProfile(), false); 69 browser()->profile()->GetOffTheRecordProfile(), false);
69 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 70 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
70 otr_browser->GetActiveWebContents()->GetRenderViewHost(), L"", 71 chrome::GetActiveWebContents(otr_browser)->GetRenderViewHost(), L"",
71 L"window.domAutomationController.send(document.title)", 72 L"window.domAutomationController.send(document.title)",
72 &result)); 73 &result));
73 EXPECT_EQ(result, "Loaded"); 74 EXPECT_EQ(result, "Loaded");
74 75
75 // Verify that the an extension can't load chrome://extension-icon icons 76 // Verify that the an extension can't load chrome://extension-icon icons
76 // without the management permission. 77 // without the management permission.
77 ui_test_utils::OpenURLOffTheRecord( 78 ui_test_utils::OpenURLOffTheRecord(
78 browser()->profile(), 79 browser()->profile(),
79 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html")); 80 GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html"));
80 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 81 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
81 otr_browser->GetActiveWebContents()->GetRenderViewHost(), L"", 82 chrome::GetActiveWebContents(otr_browser)->GetRenderViewHost(), L"",
82 L"window.domAutomationController.send(document.title)", 83 L"window.domAutomationController.send(document.title)",
83 &result)); 84 &result));
84 EXPECT_EQ(result, "Not Loaded"); 85 EXPECT_EQ(result, "Not Loaded");
85 } 86 }
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