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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "chrome/browser/extensions/api/test/test_api.h" 9 #include "chrome/browser/extensions/api/test/test_api.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const content::NotificationDetails& details) { 73 const content::NotificationDetails& details) {
74 if (profile_restriction_ && 74 if (profile_restriction_ &&
75 content::Source<Profile>(source).ptr() != profile_restriction_) { 75 content::Source<Profile>(source).ptr() != profile_restriction_) {
76 return; 76 return;
77 } 77 }
78 78
79 switch (type) { 79 switch (type) {
80 case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: 80 case chrome::NOTIFICATION_EXTENSION_TEST_PASSED:
81 VLOG(1) << "Got EXTENSION_TEST_PASSED notification."; 81 VLOG(1) << "Got EXTENSION_TEST_PASSED notification.";
82 results_.push_back(true); 82 results_.push_back(true);
83 messages_.push_back(""); 83 messages_.push_back(std::string());
84 if (waiting_) 84 if (waiting_)
85 MessageLoopForUI::current()->Quit(); 85 MessageLoopForUI::current()->Quit();
86 break; 86 break;
87 87
88 case chrome::NOTIFICATION_EXTENSION_TEST_FAILED: 88 case chrome::NOTIFICATION_EXTENSION_TEST_FAILED:
89 VLOG(1) << "Got EXTENSION_TEST_FAILED notification."; 89 VLOG(1) << "Got EXTENSION_TEST_FAILED notification.";
90 results_.push_back(false); 90 results_.push_back(false);
91 messages_.push_back(*(content::Details<std::string>(details).ptr())); 91 messages_.push_back(*(content::Details<std::string>(details).ptr()));
92 if (waiting_) 92 if (waiting_)
93 MessageLoopForUI::current()->Quit(); 93 MessageLoopForUI::current()->Quit();
(...skipping 13 matching lines...) Expand all
107 extensions::TestGetConfigFunction::set_test_config_state( 107 extensions::TestGetConfigFunction::set_test_config_state(
108 test_config_.get()); 108 test_config_.get());
109 } 109 }
110 110
111 void ExtensionApiTest::TearDownInProcessBrowserTestFixture() { 111 void ExtensionApiTest::TearDownInProcessBrowserTestFixture() {
112 extensions::TestGetConfigFunction::set_test_config_state(NULL); 112 extensions::TestGetConfigFunction::set_test_config_state(NULL);
113 test_config_.reset(NULL); 113 test_config_.reset(NULL);
114 } 114 }
115 115
116 bool ExtensionApiTest::RunExtensionTest(const char* extension_name) { 116 bool ExtensionApiTest::RunExtensionTest(const char* extension_name) {
117 return RunExtensionTestImpl(extension_name, "", kFlagEnableFileAccess); 117 return RunExtensionTestImpl(
118 extension_name, std::string(), kFlagEnableFileAccess);
118 } 119 }
119 120
120 bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) { 121 bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) {
121 return RunExtensionTestImpl( 122 return RunExtensionTestImpl(extension_name,
122 extension_name, "", kFlagEnableIncognito | kFlagEnableFileAccess); 123 std::string(),
124 kFlagEnableIncognito | kFlagEnableFileAccess);
123 } 125 }
124 126
125 bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings( 127 bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings(
126 const char* extension_name) { 128 const char* extension_name) {
127 return RunExtensionTestImpl( 129 return RunExtensionTestImpl(
128 extension_name, "", kFlagIgnoreManifestWarnings); 130 extension_name, std::string(), kFlagIgnoreManifestWarnings);
129 } 131 }
130 132
131 bool ExtensionApiTest::RunExtensionTestAllowOldManifestVersion( 133 bool ExtensionApiTest::RunExtensionTestAllowOldManifestVersion(
132 const char* extension_name) { 134 const char* extension_name) {
133 return RunExtensionTestImpl( 135 return RunExtensionTestImpl(
134 extension_name, 136 extension_name,
135 "", 137 std::string(),
136 kFlagEnableFileAccess | kFlagAllowOldManifestVersions); 138 kFlagEnableFileAccess | kFlagAllowOldManifestVersions);
137 } 139 }
138 140
139 bool ExtensionApiTest::RunComponentExtensionTest(const char* extension_name) { 141 bool ExtensionApiTest::RunComponentExtensionTest(const char* extension_name) {
140 return RunExtensionTestImpl( 142 return RunExtensionTestImpl(extension_name,
141 extension_name, "", kFlagEnableFileAccess | kFlagLoadAsComponent); 143 std::string(),
144 kFlagEnableFileAccess | kFlagLoadAsComponent);
142 } 145 }
143 146
144 bool ExtensionApiTest::RunExtensionTestNoFileAccess( 147 bool ExtensionApiTest::RunExtensionTestNoFileAccess(
145 const char* extension_name) { 148 const char* extension_name) {
146 return RunExtensionTestImpl(extension_name, "", kFlagNone); 149 return RunExtensionTestImpl(extension_name, std::string(), kFlagNone);
147 } 150 }
148 151
149 bool ExtensionApiTest::RunExtensionTestIncognitoNoFileAccess( 152 bool ExtensionApiTest::RunExtensionTestIncognitoNoFileAccess(
150 const char* extension_name) { 153 const char* extension_name) {
151 return RunExtensionTestImpl(extension_name, "", kFlagEnableIncognito); 154 return RunExtensionTestImpl(
155 extension_name, std::string(), kFlagEnableIncognito);
152 } 156 }
153 157
154 bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name, 158 bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name,
155 const std::string& page_url) { 159 const std::string& page_url) {
156 return RunExtensionSubtest(extension_name, page_url, kFlagEnableFileAccess); 160 return RunExtensionSubtest(extension_name, page_url, kFlagEnableFileAccess);
157 } 161 }
158 162
159 bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name, 163 bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name,
160 const std::string& page_url, 164 const std::string& page_url,
161 int flags) { 165 int flags) {
162 DCHECK(!page_url.empty()) << "Argument page_url is required."; 166 DCHECK(!page_url.empty()) << "Argument page_url is required.";
163 return RunExtensionTestImpl(extension_name, page_url, flags); 167 return RunExtensionTestImpl(extension_name, page_url, flags);
164 } 168 }
165 169
166 170
167 bool ExtensionApiTest::RunPageTest(const std::string& page_url) { 171 bool ExtensionApiTest::RunPageTest(const std::string& page_url) {
168 return RunExtensionSubtest("", page_url); 172 return RunExtensionSubtest("", page_url);
169 } 173 }
170 174
171 bool ExtensionApiTest::RunPageTest(const std::string& page_url, 175 bool ExtensionApiTest::RunPageTest(const std::string& page_url,
172 int flags) { 176 int flags) {
173 return RunExtensionSubtest("", page_url, flags); 177 return RunExtensionSubtest("", page_url, flags);
174 } 178 }
175 179
176 bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { 180 bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) {
177 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); 181 return RunExtensionTestImpl(
182 extension_name, std::string(), kFlagLaunchPlatformApp);
178 } 183 }
179 184
180 // Load |extension_name| extension and/or |page_url| and wait for 185 // Load |extension_name| extension and/or |page_url| and wait for
181 // PASSED or FAILED notification. 186 // PASSED or FAILED notification.
182 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, 187 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name,
183 const std::string& page_url, 188 const std::string& page_url,
184 int flags) { 189 int flags) {
185 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; 190 bool load_as_component = (flags & kFlagLoadAsComponent) != 0;
186 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; 191 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0;
187 bool use_incognito = (flags & kFlagUseIncognito) != 0; 192 bool use_incognito = (flags & kFlagUseIncognito) != 0;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 test_config_->SetInteger(kTestWebSocketPort, 312 test_config_->SetInteger(kTestWebSocketPort,
308 websocket_server_->host_port_pair().port()); 313 websocket_server_->host_port_pair().port());
309 314
310 return true; 315 return true;
311 } 316 }
312 317
313 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { 318 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) {
314 ExtensionBrowserTest::SetUpCommandLine(command_line); 319 ExtensionBrowserTest::SetUpCommandLine(command_line);
315 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); 320 test_data_dir_ = test_data_dir_.AppendASCII("api_test");
316 } 321 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action_unittest.cc ('k') | chrome/browser/extensions/extension_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698