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

Side by Side Diff: chrome/browser/chromeos/customization_document_unittest.cc

Issue 2101021: Adding initial implementation of the PartnerCustomization classes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/customization_document.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace {
10
11 const char kGoodStartupManifest[] =
12 "{"
13 " \"version\": \"1.0\","
14 " \"product_sku\" : \"SKU\","
15 " \"initial_locale\" : \"en_US\","
16 " \"background_color\" : \"#880088\","
17 " \"registration_url\" : \"http://www.google.com\","
18 " \"setup_content\" : ["
19 " {"
20 " \"content_locale\" : \"en_US\","
21 " \"help_page\" : \"setup_content/en_US/help.html\","
22 " \"eula_page\" : \"setup_content/en_US/eula.html\","
23 " },"
24 " {"
25 " \"content_locale\" : \"ru\","
26 " \"help_page\" : \"setup_content/ru/help.html\","
27 " \"eula_page\" : \"setup_content/ru/eula.html\","
28 " },"
29 " ]"
30 "}";
31
32 const char kBadStartupManifest1[] = "{}";
33 const char kBadStartupManifest2[] = "{ \"version\" : \"1.0\" }";
34 const char kBadStartupManifest3[] = "{"
35 " \"version\" : \"0.0\","
36 " \"product_sku\" : \"SKU\","
37 "}";
38
39 const char kBadStartupManifest4[] = "{"
40 " \"version\" : \"1.0\","
41 " \"product_sku\" : \"SKU\","
42 " \"setup_content\" : ["
43 " {"
44 " \"help_page\" : \"setup_content/en_US/help.html\","
45 " \"eula_page\" : \"setup_content/en_US/eula.html\","
46 " },"
47 " ]"
48 "}";
49
50 const char kBadStartupManifest5[] = "{"
51 " \"version\" : \"1.0\","
52 " \"product_sku\" : \"SKU\","
53 " \"setup_content\" : ["
54 " {"
55 " \"content_locale\" : \"en_US\","
56 " \"eula_page\" : \"setup_content/en_US/eula.html\","
57 " },"
58 " ]"
59 "}";
60
61
62
63 } // anonymous namespace
64
65 class StartupCustomizationDocumentTest : public testing::Test {
66 public:
67 chromeos::StartupCustomizationDocument customization_;
68 };
69
70 TEST_F(StartupCustomizationDocumentTest, LoadBadStartupManifestFromString) {
71 bool result = false;
72 result = customization_.LoadManifestFromString(kBadStartupManifest1);
73 EXPECT_EQ(result, false);
74 result = customization_.LoadManifestFromString(kBadStartupManifest2);
75 EXPECT_EQ(result, false);
76 result = customization_.LoadManifestFromString(kBadStartupManifest3);
77 EXPECT_EQ(result, false);
78 result = customization_.LoadManifestFromString(kBadStartupManifest4);
79 EXPECT_EQ(result, false);
80 result = customization_.LoadManifestFromString(kBadStartupManifest5);
81 EXPECT_EQ(result, false);
82 }
83
84 TEST_F(StartupCustomizationDocumentTest, LoadGoodStartupManifestFromString) {
85 bool result = false;
86 result = customization_.LoadManifestFromString(kGoodStartupManifest);
87 EXPECT_EQ(result, true);
88 EXPECT_EQ(customization_.version(), "1.0");
89 EXPECT_EQ(customization_.product_sku(), "SKU");
90 EXPECT_EQ(customization_.initial_locale(), "en_US");
91 EXPECT_EQ(customization_.background_color(),
92 SkColorSetRGB(0x88, 0x00, 0x88));
93 EXPECT_EQ(customization_.registration_url(), "http://www.google.com");
94
95 EXPECT_EQ(customization_.GetSetupContent("en_US")->help_page_path,
96 "setup_content/en_US/help.html");
97 EXPECT_EQ(customization_.GetSetupContent("en_US")->eula_page_path,
98 "setup_content/en_US/eula.html");
99 EXPECT_EQ(customization_.GetSetupContent("ru")->help_page_path,
100 "setup_content/ru/help.html");
101 EXPECT_EQ(customization_.GetSetupContent("ru")->eula_page_path,
102 "setup_content/ru/eula.html");
103 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/customization_document.cc ('k') | chrome/browser/chromeos/login/wizard_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698