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

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

Issue 7016011: iwyu: Include stringprintf.h where appropriate, part 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix. Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_util.h" 5 #include "base/stringprintf.h"
6 #include "chrome/browser/background_contents_service.h" 6 #include "chrome/browser/background_contents_service.h"
7 #include "chrome/browser/background_contents_service_factory.h" 7 #include "chrome/browser/background_contents_service_factory.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/test/ui_test_utils.h" 14 #include "chrome/test/ui_test_utils.h"
15 #include "net/base/mock_host_resolver.h" 15 #include "net/base/mock_host_resolver.h"
(...skipping 26 matching lines...) Expand all
42 } 42 }
43 43
44 private: 44 private:
45 ScopedTempDir app_dir_; 45 ScopedTempDir app_dir_;
46 }; 46 };
47 47
48 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, Basic) { 48 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, Basic) {
49 host_resolver()->AddRule("a.com", "127.0.0.1"); 49 host_resolver()->AddRule("a.com", "127.0.0.1");
50 ASSERT_TRUE(StartTestServer()); 50 ASSERT_TRUE(StartTestServer());
51 51
52 std::string app_manifest = StringPrintf( 52 std::string app_manifest = base::StringPrintf(
53 "{" 53 "{"
54 " \"name\": \"App\"," 54 " \"name\": \"App\","
55 " \"version\": \"0.1\"," 55 " \"version\": \"0.1\","
56 " \"app\": {" 56 " \"app\": {"
57 " \"urls\": [" 57 " \"urls\": ["
58 " \"http://a.com/\"" 58 " \"http://a.com/\""
59 " ]," 59 " ],"
60 " \"launch\": {" 60 " \"launch\": {"
61 " \"web_url\": \"http://a.com:%d/\"" 61 " \"web_url\": \"http://a.com:%d/\""
62 " }" 62 " }"
63 " }," 63 " },"
64 " \"permissions\": [\"background\"]" 64 " \"permissions\": [\"background\"]"
65 "}", 65 "}",
66 test_server()->host_port_pair().port()); 66 test_server()->host_port_pair().port());
67 67
68 FilePath app_dir; 68 FilePath app_dir;
69 ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); 69 ASSERT_TRUE(CreateApp(app_manifest, &app_dir));
70 ASSERT_TRUE(LoadExtension(app_dir)); 70 ASSERT_TRUE(LoadExtension(app_dir));
71 ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_; 71 ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_;
72 } 72 }
73 73
74 // Crashy, http://crbug.com/49215. 74 // Crashy, http://crbug.com/49215.
75 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) { 75 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) {
76 host_resolver()->AddRule("a.com", "127.0.0.1"); 76 host_resolver()->AddRule("a.com", "127.0.0.1");
77 ASSERT_TRUE(StartTestServer()); 77 ASSERT_TRUE(StartTestServer());
78 78
79 std::string app_manifest = StringPrintf( 79 std::string app_manifest = base::StringPrintf(
80 "{" 80 "{"
81 " \"name\": \"App\"," 81 " \"name\": \"App\","
82 " \"version\": \"0.1\"," 82 " \"version\": \"0.1\","
83 " \"app\": {" 83 " \"app\": {"
84 " \"urls\": [" 84 " \"urls\": ["
85 " \"http://a.com/\"" 85 " \"http://a.com/\""
86 " ]," 86 " ],"
87 " \"launch\": {" 87 " \"launch\": {"
88 " \"web_url\": \"http://a.com:%d/\"" 88 " \"web_url\": \"http://a.com:%d/\""
89 " }" 89 " }"
90 " }" 90 " }"
91 "}", 91 "}",
92 test_server()->host_port_pair().port()); 92 test_server()->host_port_pair().port());
93 93
94 FilePath app_dir; 94 FilePath app_dir;
95 ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); 95 ASSERT_TRUE(CreateApp(app_manifest, &app_dir));
96 ASSERT_TRUE(LoadExtension(app_dir)); 96 ASSERT_TRUE(LoadExtension(app_dir));
97 ASSERT_TRUE(RunExtensionTest("app_background_page/lacks_permission")) 97 ASSERT_TRUE(RunExtensionTest("app_background_page/lacks_permission"))
98 << message_; 98 << message_;
99 } 99 }
100 100
101 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) { 101 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) {
102 host_resolver()->AddRule("a.com", "127.0.0.1"); 102 host_resolver()->AddRule("a.com", "127.0.0.1");
103 ASSERT_TRUE(StartTestServer()); 103 ASSERT_TRUE(StartTestServer());
104 104
105 std::string app_manifest = StringPrintf( 105 std::string app_manifest = base::StringPrintf(
106 "{" 106 "{"
107 " \"name\": \"App\"," 107 " \"name\": \"App\","
108 " \"version\": \"0.1\"," 108 " \"version\": \"0.1\","
109 " \"app\": {" 109 " \"app\": {"
110 " \"urls\": [" 110 " \"urls\": ["
111 " \"http://a.com/\"" 111 " \"http://a.com/\""
112 " ]," 112 " ],"
113 " \"launch\": {" 113 " \"launch\": {"
114 " \"web_url\": \"http://a.com:%d/\"" 114 " \"web_url\": \"http://a.com:%d/\""
115 " }" 115 " }"
116 " }," 116 " },"
117 " \"permissions\": [\"background\"]," 117 " \"permissions\": [\"background\"],"
118 " \"background_page\": \"http://a.com:%d/test.html\"" 118 " \"background_page\": \"http://a.com:%d/test.html\""
119 "}", 119 "}",
120 test_server()->host_port_pair().port(), 120 test_server()->host_port_pair().port(),
121 test_server()->host_port_pair().port()); 121 test_server()->host_port_pair().port());
122 122
123 FilePath app_dir; 123 FilePath app_dir;
124 ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); 124 ASSERT_TRUE(CreateApp(app_manifest, &app_dir));
125 ASSERT_TRUE(LoadExtension(app_dir)); 125 ASSERT_TRUE(LoadExtension(app_dir));
126 126
127 const Extension* extension = GetSingleLoadedExtension(); 127 const Extension* extension = GetSingleLoadedExtension();
128 ASSERT_TRUE( 128 ASSERT_TRUE(
129 BackgroundContentsServiceFactory::GetForProfile(browser()->profile())-> 129 BackgroundContentsServiceFactory::GetForProfile(browser()->profile())->
130 GetAppBackgroundContents(ASCIIToUTF16(extension->id()))); 130 GetAppBackgroundContents(ASCIIToUTF16(extension->id())));
131 } 131 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_sanity_unittest.cc ('k') | chrome/browser/geolocation/geolocation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698