summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/customization_document_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/customization_document_unittest.cc')
-rw-r--r--chrome/browser/chromeos/customization_document_unittest.cc72
1 files changed, 53 insertions, 19 deletions
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
index c57a0c9..620c16a 100644
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -58,40 +58,50 @@ const char kBadStartupManifest5[] = "{"
" ]"
"}";
-
+const char kGoodServicesManifest[] = "{"
+ " // Required.\n"
+ " \"version\": \"1.0\","
+ " \"app_menu\" : {"
+ " \"section_title\" : \"App menu title.\","
+ " \"web_apps\" : ["
+ " \"http://localhost/a/1\","
+ " \"http://localhost/a/2\","
+ " ],"
+ " \"support_page\": \"http://localhost/h\","
+ " \"extensions\": ["
+ " \"http://localhost/e/1\","
+ " \"http://localhost/e/2\","
+ " ],"
+ " },"
+ " // Optional.\n"
+ " \"initial_start_page\": \"http://localhost/s\","
+ "}";
} // anonymous namespace
+// StartupCustomizationDocumentTest implementation.
+
class StartupCustomizationDocumentTest : public testing::Test {
- public:
+ protected:
chromeos::StartupCustomizationDocument customization_;
};
-TEST_F(StartupCustomizationDocumentTest, LoadBadStartupManifestFromString) {
- bool result = false;
- result = customization_.LoadManifestFromString(kBadStartupManifest1);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest2);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest3);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest4);
- EXPECT_EQ(result, false);
- result = customization_.LoadManifestFromString(kBadStartupManifest5);
- EXPECT_EQ(result, false);
+TEST_F(StartupCustomizationDocumentTest, LoadBadManifestFromString) {
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest1));
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest2));
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest3));
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest4));
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest5));
}
-TEST_F(StartupCustomizationDocumentTest, LoadGoodStartupManifestFromString) {
- bool result = false;
- result = customization_.LoadManifestFromString(kGoodStartupManifest);
- EXPECT_EQ(result, true);
+TEST_F(StartupCustomizationDocumentTest, LoadGoodManifestFromString) {
+ EXPECT_TRUE(customization_.LoadManifestFromString(kGoodStartupManifest));
EXPECT_EQ(customization_.version(), "1.0");
EXPECT_EQ(customization_.product_sku(), "SKU");
EXPECT_EQ(customization_.initial_locale(), "en_US");
EXPECT_EQ(customization_.background_color(),
SkColorSetRGB(0x88, 0x00, 0x88));
EXPECT_EQ(customization_.registration_url(), "http://www.google.com");
-
EXPECT_EQ(customization_.GetSetupContent("en_US")->help_page_path,
"setup_content/en_US/help.html");
EXPECT_EQ(customization_.GetSetupContent("en_US")->eula_page_path,
@@ -101,3 +111,27 @@ TEST_F(StartupCustomizationDocumentTest, LoadGoodStartupManifestFromString) {
EXPECT_EQ(customization_.GetSetupContent("ru")->eula_page_path,
"setup_content/ru/eula.html");
}
+
+// ServicesCustomizationDocumentTest implementation.
+
+class ServicesCustomizationDocumentTest : public testing::Test {
+ protected:
+ chromeos::ServicesCustomizationDocument customization_;
+};
+
+TEST_F(ServicesCustomizationDocumentTest, LoadBadManifestFromString) {
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest1));
+ EXPECT_FALSE(customization_.LoadManifestFromString(kBadStartupManifest2));
+}
+
+TEST_F(ServicesCustomizationDocumentTest, LoadGoodManifestFromString) {
+ EXPECT_TRUE(customization_.LoadManifestFromString(kGoodServicesManifest));
+ EXPECT_EQ(customization_.version(), "1.0");
+ EXPECT_EQ(customization_.app_menu_section_title(), "App menu title.");
+ EXPECT_EQ(customization_.app_menu_support_page_url(), "http://localhost/h");
+ EXPECT_EQ(customization_.initial_start_page_url(), "http://localhost/s");
+ EXPECT_EQ(customization_.web_apps().front(), "http://localhost/a/1");
+ EXPECT_EQ(customization_.web_apps().back(), "http://localhost/a/2");
+ EXPECT_EQ(customization_.extensions().front(), "http://localhost/e/1");
+ EXPECT_EQ(customization_.extensions().back(), "http://localhost/e/2");
+}