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

Side by Side Diff: chrome/browser/extensions/api/record/record_api_test.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/api/record/record_api.h" 5 #include "chrome/browser/extensions/api/record/record_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted.h"
10 #include "base/file_path.h" 9 #include "base/file_path.h"
11 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_split.h" 14 #include "base/string_split.h"
15 #include "base/string_util.h"
15 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
16 #include "base/string_util.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/extensions/extension_function_test_utils.h" 19 #include "chrome/browser/extensions/extension_function_test_utils.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/extensions/api/experimental_record.h" 24 #include "chrome/common/extensions/api/experimental_record.h"
25 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
26 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 && strategy.GetVisitedURLs()[1].compare(goodURL3) == 0); 263 && strategy.GetVisitedURLs()[1].compare(goodURL3) == 0);
264 */ 264 */
265 265
266 return true; 266 return true;
267 } 267 }
268 268
269 protected: 269 protected:
270 std::vector<FilePath> temp_files_; 270 std::vector<FilePath> temp_files_;
271 271
272 private: 272 private:
273 ScopedTempDir scoped_temp_user_data_dir_; 273 base::ScopedTempDir scoped_temp_user_data_dir_;
274 274
275 DISALLOW_COPY_AND_ASSIGN(RecordApiTest); 275 DISALLOW_COPY_AND_ASSIGN(RecordApiTest);
276 }; 276 };
277 277
278 278
279 IN_PROC_BROWSER_TEST_F(RecordApiTest, CheckCapture) { 279 IN_PROC_BROWSER_TEST_F(RecordApiTest, CheckCapture) {
280 ScopedTempDir user_data_dir; 280 base::ScopedTempDir user_data_dir;
281 scoped_ptr<base::ListValue> result; 281 scoped_ptr<base::ListValue> result;
282 282
283 EXPECT_TRUE(user_data_dir.CreateUniqueTempDir()); 283 EXPECT_TRUE(user_data_dir.CreateUniqueTempDir());
284 scoped_refptr<CaptureURLsFunction> capture_URLs_function = 284 scoped_refptr<CaptureURLsFunction> capture_URLs_function =
285 RunCapture(user_data_dir.path(), &result); 285 RunCapture(user_data_dir.path(), &result);
286 286
287 // Check that user-data-dir switch has been properly overridden. 287 // Check that user-data-dir switch has been properly overridden.
288 const TestProcessStrategy &strategy = 288 const TestProcessStrategy &strategy =
289 static_cast<const TestProcessStrategy &>( 289 static_cast<const TestProcessStrategy &>(
290 capture_URLs_function->GetProcessStrategy()); 290 capture_URLs_function->GetProcessStrategy());
291 const CommandLine& command_line = strategy.GetCommandLine(); 291 const CommandLine& command_line = strategy.GetCommandLine();
292 292
293 EXPECT_TRUE(command_line.HasSwitch(switches::kUserDataDir)); 293 EXPECT_TRUE(command_line.HasSwitch(switches::kUserDataDir));
294 EXPECT_TRUE(command_line.GetSwitchValuePath(switches::kUserDataDir) != 294 EXPECT_TRUE(command_line.GetSwitchValuePath(switches::kUserDataDir) !=
295 FilePath(kDummyDirName)); 295 FilePath(kDummyDirName));
296 296
297 EXPECT_TRUE(VerifyURLHandling(result.get(), strategy)); 297 EXPECT_TRUE(VerifyURLHandling(result.get(), strategy));
298 } 298 }
299 299
300 #if defined(ADDRESS_SANITIZER) 300 #if defined(ADDRESS_SANITIZER)
301 // Times out under ASan, see http://crbug.com/130267. 301 // Times out under ASan, see http://crbug.com/130267.
302 #define MAYBE_CheckPlayback DISABLED_CheckPlayback 302 #define MAYBE_CheckPlayback DISABLED_CheckPlayback
303 #else 303 #else
304 #define MAYBE_CheckPlayback CheckPlayback 304 #define MAYBE_CheckPlayback CheckPlayback
305 #endif 305 #endif
306 IN_PROC_BROWSER_TEST_F(RecordApiTest, MAYBE_CheckPlayback) { 306 IN_PROC_BROWSER_TEST_F(RecordApiTest, MAYBE_CheckPlayback) {
307 ScopedTempDir user_data_dir; 307 base::ScopedTempDir user_data_dir;
308 308
309 EXPECT_TRUE(user_data_dir.CreateUniqueTempDir()); 309 EXPECT_TRUE(user_data_dir.CreateUniqueTempDir());
310 310
311 // Assume this RunCapture operates w/o error, since it's tested 311 // Assume this RunCapture operates w/o error, since it's tested
312 // elsewhere. 312 // elsewhere.
313 scoped_ptr<base::ListValue> capture_result; 313 scoped_ptr<base::ListValue> capture_result;
314 RunCapture(user_data_dir.path(), &capture_result); 314 RunCapture(user_data_dir.path(), &capture_result);
315 315
316 std::string escaped_user_data_dir; 316 std::string escaped_user_data_dir;
317 ReplaceChars(user_data_dir.path().AsUTF8Unsafe(), "\\", "\\\\", 317 ReplaceChars(user_data_dir.path().AsUTF8Unsafe(), "\\", "\\\\",
(...skipping 25 matching lines...) Expand all
343 343
344 // Check for return value with proper stats. 344 // Check for return value with proper stats.
345 EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey)); 345 EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey));
346 346
347 ListValue* errors = NULL; 347 ListValue* errors = NULL;
348 EXPECT_TRUE(result->GetList(kErrorsKey, &errors)); 348 EXPECT_TRUE(result->GetList(kErrorsKey, &errors));
349 EXPECT_TRUE(VerifyURLHandling(errors, strategy)); 349 EXPECT_TRUE(VerifyURLHandling(errors, strategy));
350 } 350 }
351 351
352 } // namespace extensions 352 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698