| 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 // This file tests the chrome.alarms extension API. | 5 // This file tests the chrome.alarms extension API. |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/api/discovery/discovery_api.h" | 9 #include "chrome/browser/extensions/api/discovery/discovery_api.h" |
| 10 #include "chrome/browser/extensions/api/discovery/suggested_link.h" | 10 #include "chrome/browser/extensions/api/discovery/suggested_link.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 suggest_details.score.reset(new double(score)); | 51 suggest_details.score.reset(new double(score)); |
| 52 suggest_details.link_url = link_url; | 52 suggest_details.link_url = link_url; |
| 53 suggest_details.link_text = link_text; | 53 suggest_details.link_text = link_text; |
| 54 return SuggestDetailsParamToJSON(suggest_details); | 54 return SuggestDetailsParamToJSON(suggest_details); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Converts the parameters to the API RemoveSuggestion method to JSON. | 57 // Converts the parameters to the API RemoveSuggestion method to JSON. |
| 58 std::string RemoveSuggestionParamsToJSON(const std::string& link_url) { | 58 std::string RemoveSuggestionParamsToJSON(const std::string& link_url) { |
| 59 std::string result; | 59 std::string result; |
| 60 base::ListValue params; | 60 base::ListValue params; |
| 61 params.Append(base::Value::CreateStringValue(link_url)); | 61 params.Append(new base::StringValue(link_url)); |
| 62 base::JSONWriter::Write(¶ms, &result); | 62 base::JSONWriter::Write(¶ms, &result); |
| 63 return result; | 63 return result; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace | 66 } // namespace |
| 67 | 67 |
| 68 namespace extensions { | 68 namespace extensions { |
| 69 | 69 |
| 70 class ExtensionDiscoveryTest : public BrowserWithTestWindowTest { | 70 class ExtensionDiscoveryTest : public BrowserWithTestWindowTest { |
| 71 public: | 71 public: |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 extensions::SuggestedLinksRegistry* registry = | 182 extensions::SuggestedLinksRegistry* registry = |
| 183 extensions::SuggestedLinksRegistryFactory::GetForProfile( | 183 extensions::SuggestedLinksRegistryFactory::GetForProfile( |
| 184 browser()->profile()); | 184 browser()->profile()); |
| 185 | 185 |
| 186 const SuggestedLinkList* links = registry->GetAll(GetExtensionId()); | 186 const SuggestedLinkList* links = registry->GetAll(GetExtensionId()); |
| 187 ASSERT_EQ(0u, links->size()); | 187 ASSERT_EQ(0u, links->size()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace extensions | 190 } // namespace extensions |
| OLD | NEW |