| OLD | NEW |
| 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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 14 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/histogram_samples.h" | 15 #include "base/metrics/histogram_samples.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/test/histogram_tester.h" | 17 #include "base/test/histogram_tester.h" |
| 18 #include "base/values.h" |
| 16 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 17 #include "chrome/renderer/searchbox/search_bouncer.h" | 20 #include "chrome/renderer/searchbox/search_bouncer.h" |
| 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| 19 #include "content/public/common/webplugininfo.h" | 22 #include "content/public/common/webplugininfo.h" |
| 20 #include "extensions/features/features.h" | 23 #include "extensions/features/features.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "third_party/WebKit/public/platform/WebString.h" | 25 #include "third_party/WebKit/public/platform/WebString.h" |
| 23 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 26 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 24 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 25 | 28 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 bool is_hosted_app, const std::string& app_url) { | 110 bool is_hosted_app, const std::string& app_url) { |
| 108 int flags = is_from_webstore ? | 111 int flags = is_from_webstore ? |
| 109 extensions::Extension::FROM_WEBSTORE: | 112 extensions::Extension::FROM_WEBSTORE: |
| 110 extensions::Extension::NO_FLAGS; | 113 extensions::Extension::NO_FLAGS; |
| 111 | 114 |
| 112 base::DictionaryValue manifest; | 115 base::DictionaryValue manifest; |
| 113 manifest.SetString("name", "NaCl Extension"); | 116 manifest.SetString("name", "NaCl Extension"); |
| 114 manifest.SetString("version", "1"); | 117 manifest.SetString("version", "1"); |
| 115 manifest.SetInteger("manifest_version", 2); | 118 manifest.SetInteger("manifest_version", 2); |
| 116 if (is_hosted_app) { | 119 if (is_hosted_app) { |
| 117 base::ListValue* url_list = new base::ListValue(); | 120 auto url_list = base::MakeUnique<base::ListValue>(); |
| 118 url_list->AppendString(app_url); | 121 url_list->AppendString(app_url); |
| 119 manifest.Set(extensions::manifest_keys::kWebURLs, url_list); | 122 manifest.Set(extensions::manifest_keys::kWebURLs, std::move(url_list)); |
| 120 manifest.SetString(extensions::manifest_keys::kLaunchWebURL, app_url); | 123 manifest.SetString(extensions::manifest_keys::kLaunchWebURL, app_url); |
| 121 } | 124 } |
| 122 std::string error; | 125 std::string error; |
| 123 return extensions::Extension::Create(base::FilePath(), location, manifest, | 126 return extensions::Extension::Create(base::FilePath(), location, manifest, |
| 124 flags, &error); | 127 flags, &error); |
| 125 } | 128 } |
| 126 | 129 |
| 127 scoped_refptr<const extensions::Extension> CreateExtension( | 130 scoped_refptr<const extensions::Extension> CreateExtension( |
| 128 bool is_from_webstore) { | 131 bool is_from_webstore) { |
| 129 return CreateTestExtension( | 132 return CreateTestExtension( |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 for (const auto& data : test_data) { | 714 for (const auto& data : test_data) { |
| 712 ++total_count; | 715 ++total_count; |
| 713 GURL gurl = GURL(data); | 716 GURL gurl = GURL(data); |
| 714 OverrideFlashEmbed(gurl); | 717 OverrideFlashEmbed(gurl); |
| 715 samples = GetHistogramSamples(); | 718 samples = GetHistogramSamples(); |
| 716 EXPECT_EQ(total_count, samples->GetCount(internal::FAILURE_ENABLEJSAPI)); | 719 EXPECT_EQ(total_count, samples->GetCount(internal::FAILURE_ENABLEJSAPI)); |
| 717 EXPECT_EQ(total_count, samples->TotalCount()); | 720 EXPECT_EQ(total_count, samples->TotalCount()); |
| 718 } | 721 } |
| 719 } | 722 } |
| 720 #endif | 723 #endif |
| OLD | NEW |