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

Side by Side Diff: webkit/support/webkit_support.cc

Issue 7034047: Exporting ScopedTempDir so it can be used by webkit layout tests. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix for win build and chrome refactoring 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
« no previous file with comments | « webkit/support/webkit_support.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/support/webkit_support.h" 5 #include "webkit/support/webkit_support.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/i18n/icu_util.h" 13 #include "base/i18n/icu_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/process_util.h" 19 #include "base/process_util.h"
20 #include "base/scoped_temp_dir.h"
20 #include "base/string_piece.h" 21 #include "base/string_piece.h"
21 #include "base/string_util.h" 22 #include "base/string_util.h"
22 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
23 #include "base/sys_string_conversions.h" 24 #include "base/sys_string_conversions.h"
24 #include "base/time.h" 25 #include "base/time.h"
25 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
26 #include "grit/webkit_chromium_resources.h" 27 #include "grit/webkit_chromium_resources.h"
27 #include "media/base/filter_collection.h" 28 #include "media/base/filter_collection.h"
28 #include "media/base/message_loop_factory_impl.h" 29 #include "media/base/message_loop_factory_impl.h"
29 #include "net/base/escape.h" 30 #include "net/base/escape.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 return WebURL(); 480 return WebURL();
480 481
481 std::string contents_base64; 482 std::string contents_base64;
482 if (!base::Base64Encode(contents, &contents_base64)) 483 if (!base::Base64Encode(contents, &contents_base64))
483 return WebURL(); 484 return WebURL();
484 485
485 const char kDataUrlPrefix[] = "data:text/css;charset=utf-8;base64,"; 486 const char kDataUrlPrefix[] = "data:text/css;charset=utf-8;base64,";
486 return WebURL(GURL(kDataUrlPrefix + contents_base64)); 487 return WebURL(GURL(kDataUrlPrefix + contents_base64));
487 } 488 }
488 489
490 // A wrapper object for exporting ScopedTempDir to be used
491 // by webkit layout tests.
492 class ScopedTempDirectoryInternal : public ScopedTempDirectory {
493 public:
494 virtual bool CreateUniqueTempDir() {
495 return tempDirectory_.CreateUniqueTempDir();
496 }
497
498 virtual std::string path() const {
499 return tempDirectory_.path().MaybeAsASCII();
darin (slow to review) 2011/05/23 16:29:56 this probably isn't a big deal for developers, but
500 }
501
502 private:
503 ScopedTempDir tempDirectory_;
504 };
505
506 ScopedTempDirectory* CreateScopedTempDirectory() {
507 return new ScopedTempDirectoryInternal();
508 }
509
489 int64 GetCurrentTimeInMillisecond() { 510 int64 GetCurrentTimeInMillisecond() {
490 return base::TimeTicks::Now().ToInternalValue() 511 return base::TimeTicks::Now().ToInternalValue()
491 / base::Time::kMicrosecondsPerMillisecond; 512 / base::Time::kMicrosecondsPerMillisecond;
492 } 513 }
493 514
494 std::string EscapePath(const std::string& path) { 515 std::string EscapePath(const std::string& path) {
495 return ::EscapePath(path); 516 return ::EscapePath(path);
496 } 517 }
497 518
498 std::string MakeURLErrorDescription(const WebKit::WebURLError& error) { 519 std::string MakeURLErrorDescription(const WebKit::WebURLError& error) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 test_environment->webkit_client()->fileSystem()); 603 test_environment->webkit_client()->fileSystem());
583 fileSystem->OpenFileSystem(frame, type, size, create, callbacks); 604 fileSystem->OpenFileSystem(frame, type, size, create, callbacks);
584 } 605 }
585 606
586 // Timers 607 // Timers
587 double GetForegroundTabTimerInterval() { 608 double GetForegroundTabTimerInterval() {
588 return webkit_glue::kForegroundTabTimerInterval; 609 return webkit_glue::kForegroundTabTimerInterval;
589 } 610 }
590 611
591 } // namespace webkit_support 612 } // namespace webkit_support
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698