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

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc

Issue 141113003: Refactor base/safe_numerics.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 | « base/safe_numerics_unittest.cc ('k') | chrome/browser/extensions/convert_web_app.cc » ('j') | 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) 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/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/numerics/safe_conversions.h"
9 #include "base/path_service.h" 10 #include "base/path_service.h"
10 #include "base/safe_numerics.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/apps/app_browsertest_util.h" 14 #include "chrome/browser/apps/app_browsertest_util.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/extensions/extension_system.h" 16 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/media_galleries/media_file_system_registry.h" 17 #include "chrome/browser/media_galleries/media_file_system_registry.h"
18 #include "chrome/browser/media_galleries/media_galleries_preferences.h" 18 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
19 #include "chrome/browser/media_galleries/media_galleries_test_util.h" 19 #include "chrome/browser/media_galleries/media_galleries_test_util.h"
20 #include "chrome/browser/storage_monitor/storage_info.h" 20 #include "chrome/browser/storage_monitor/storage_info.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 MediaGalleriesPlatformAppBrowserTest() : test_jpg_size_(0) {} 55 MediaGalleriesPlatformAppBrowserTest() : test_jpg_size_(0) {}
56 virtual ~MediaGalleriesPlatformAppBrowserTest() {} 56 virtual ~MediaGalleriesPlatformAppBrowserTest() {}
57 57
58 virtual void SetUpOnMainThread() OVERRIDE { 58 virtual void SetUpOnMainThread() OVERRIDE {
59 PlatformAppBrowserTest::SetUpOnMainThread(); 59 PlatformAppBrowserTest::SetUpOnMainThread();
60 ensure_media_directories_exists_.reset(new EnsureMediaDirectoriesExists); 60 ensure_media_directories_exists_.reset(new EnsureMediaDirectoriesExists);
61 61
62 int64 file_size; 62 int64 file_size;
63 ASSERT_TRUE(base::GetFileSize(GetCommonDataDir().AppendASCII("test.jpg"), 63 ASSERT_TRUE(base::GetFileSize(GetCommonDataDir().AppendASCII("test.jpg"),
64 &file_size)); 64 &file_size));
65 test_jpg_size_ = base::checked_numeric_cast<int>(file_size); 65 test_jpg_size_ = base::checked_cast<int>(file_size);
66 } 66 }
67 67
68 virtual void TearDownOnMainThread() OVERRIDE { 68 virtual void TearDownOnMainThread() OVERRIDE {
69 ensure_media_directories_exists_.reset(); 69 ensure_media_directories_exists_.reset();
70 PlatformAppBrowserTest::TearDownOnMainThread(); 70 PlatformAppBrowserTest::TearDownOnMainThread();
71 } 71 }
72 72
73 bool RunMediaGalleriesTest(const std::string& extension_name) { 73 bool RunMediaGalleriesTest(const std::string& extension_name) {
74 base::ListValue empty_list_value; 74 base::ListValue empty_list_value;
75 return RunMediaGalleriesTestWithArg(extension_name, empty_list_value); 75 return RunMediaGalleriesTestWithArg(extension_name, empty_list_value);
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 PopulateIPhotoTestData( 439 PopulateIPhotoTestData(
440 ensure_media_directories_exists()->GetFakeIPhotoRootPath()); 440 ensure_media_directories_exists()->GetFakeIPhotoRootPath());
441 441
442 base::ListValue custom_args; 442 base::ListValue custom_args;
443 custom_args.AppendInteger(test_jpg_size()); 443 custom_args.AppendInteger(test_jpg_size());
444 ASSERT_TRUE(RunMediaGalleriesTestWithArg("iphoto", custom_args)) << message_; 444 ASSERT_TRUE(RunMediaGalleriesTestWithArg("iphoto", custom_args)) << message_;
445 445
446 iapps::SetMacPreferencesForTesting(NULL); 446 iapps::SetMacPreferencesForTesting(NULL);
447 } 447 }
448 #endif // defined(OS_MACOSX) 448 #endif // defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « base/safe_numerics_unittest.cc ('k') | chrome/browser/extensions/convert_web_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698