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

Side by Side Diff: chrome/browser/intents/native_services_unittest.cc

Issue 11071005: Add native file picker impl using SelectFileDialog. (Closed) Base URL: http://git.chromium.org/chromium/src.git@filePicker
Patch Set: Don't use "DeleteService" as a method name since Windows munges it at compile time. Created 8 years, 2 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
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/intents/native_services.h" 10 #include "chrome/browser/intents/native_services.h"
11 #include "chrome/browser/intents/web_intents_util.h" 11 #include "chrome/browser/intents/web_intents_util.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/extensions/url_pattern.h" 13 #include "chrome/common/extensions/url_pattern.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/glue/web_intent_service_data.h" 16 #include "webkit/glue/web_intent_service_data.h"
17 17
18 namespace { 18 namespace {
19 19
20 TEST(NativeServiceRegistryTest, GetSupportedServices) { 20 TEST(NativeServiceRegistryTest, GetSupportedServices) {
21 #if defined(TOOLKIT_VIEWS) 21 #if !defined(ANDROID)
22
23 // enable native services feature, then check results again 22 // enable native services feature, then check results again
24 CommandLine::ForCurrentProcess()->AppendSwitch( 23 CommandLine::ForCurrentProcess()->AppendSwitch(
25 switches::kWebIntentsNativeServicesEnabled); 24 switches::kWebIntentsNativeServicesEnabled);
26 25
27 std::vector<webkit_glue::WebIntentServiceData> services; 26 std::vector<webkit_glue::WebIntentServiceData> services;
28 web_intents::NativeServiceRegistry registry; 27 web_intents::NativeServiceRegistry registry;
29 28
30 registry.GetSupportedServices(ASCIIToUTF16("dothedew"), &services); 29 registry.GetSupportedServices(ASCIIToUTF16("dothedew"), &services);
31 30
32 ASSERT_EQ(0U, services.size()); 31 ASSERT_EQ(0U, services.size());
33 32
34 registry.GetSupportedServices( 33 registry.GetSupportedServices(
35 ASCIIToUTF16(web_intents::kActionPick), &services); 34 ASCIIToUTF16(web_intents::kActionPick), &services);
36 35
37 ASSERT_EQ(1U, services.size()); 36 ASSERT_EQ(1U, services.size());
38 37
39 // verify the service returned is for "pick" 38 // verify the service returned is for "pick"
40 EXPECT_EQ(ASCIIToUTF16(web_intents::kActionPick), services[0].action); 39 EXPECT_EQ(ASCIIToUTF16(web_intents::kActionPick), services[0].action);
41 EXPECT_EQ(GURL(web_intents::kNativeFilePickerUrl), services[0].service_url); 40 EXPECT_EQ(GURL(web_intents::kNativeFilePickerUrl), services[0].service_url);
42
43 #endif 41 #endif
44 } 42 }
45 43
46 TEST(NativeServiceRegistryTest, GetSupportedServicesDisabled) { 44 TEST(NativeServiceRegistryTest, GetSupportedServicesDisabled) {
47 #if defined(TOOLKIT_VIEWS) 45 #if !defined(ANDROID)
48
49 std::vector<webkit_glue::WebIntentServiceData> services; 46 std::vector<webkit_glue::WebIntentServiceData> services;
50 web_intents::NativeServiceRegistry registry; 47 web_intents::NativeServiceRegistry registry;
51 48
52 registry.GetSupportedServices( 49 registry.GetSupportedServices(
53 ASCIIToUTF16(web_intents::kActionPick), &services); 50 ASCIIToUTF16(web_intents::kActionPick), &services);
54 51
55 ASSERT_EQ(0U, services.size()); 52 ASSERT_EQ(0U, services.size());
56
57 #endif 53 #endif
58 } 54 }
59 55
60 56
61 } // namespace 57 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/intents/native_services_browsertest.cc ('k') | chrome/browser/ui/intents/native_file_picker_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698