// See if we get a memory leak using 'AddFeature'. I doubt we'll even see
// an out of memory issue here (despite the environment). TEF will ignore
// errors (with the !OOM option).
TVerdict CFeatureAddFeatureOOMTestStep::doTestStepL()
    {
    // Try to add already existing feature.
    TBitFlags32 flags( 0 );
    flags.Set( EFeatureSupported );
    flags.Set( EFeatureModifiable );
    TFeatureEntry entry( KDefaultSupportedUid, flags, KDefaultData1 );
    TInt err = icontrol.AddFeature( entry );
    TESTDIAGNOSTICERROR(err == KErrAlreadyExists,
       _L("RFeatureControl::AddFeature - KErrAlreadyExists expected; error = %d"),err);
    
    // Add new feature. If test run sequentially, feature already exists 
    TFeatureEntry entry2( KNewUid, flags, KDefaultData1 );
    err = icontrol.AddFeature( entry2 );
    TESTDIAGNOSTICERROR(err == KErrNone || err == KErrAlreadyExists, 
      _L("RFeatureControl::AddFeature - KErrNone or KErrAlreadyExists expected; error = %d"),err);

    TBitFlags32 flags1( 0 );
    flags1.Set( EFeatureUninitialized );
    flags1.Set( EFeatureModifiable );
    TFeatureEntry entry3( KNewUid1, flags1, KDefaultData1 );
    err = icontrol.AddFeature( entry3 );
    TESTDIAGNOSTICERROR(err == KErrNone || err == KErrAlreadyExists, 
       _L("RFeatureControl::AddFeature - KErrNone or KErrAlreadyExists expected; error = %d"),err);
       
    return TestStepResult();
    }
Ejemplo n.º 2
0
TEST(OriginAccessEntryTest, PublicSuffixListTest)
{
    OriginAccessEntryTestPlatform platform;
    platform.setPublicSuffix("com");
    Platform::initialize(&platform);

    RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString("http://www.google.com");
    OriginAccessEntry entry1("http", "google.com", OriginAccessEntry::AllowSubdomains);
    OriginAccessEntry entry2("http", "hamster.com", OriginAccessEntry::AllowSubdomains);
    OriginAccessEntry entry3("http", "com", OriginAccessEntry::AllowSubdomains);
    EXPECT_EQ(OriginAccessEntry::MatchesOrigin, entry1.matchesOrigin(*origin));
    EXPECT_EQ(OriginAccessEntry::DoesNotMatchOrigin, entry2.matchesOrigin(*origin));
    EXPECT_EQ(OriginAccessEntry::MatchesOriginButIsPublicSuffix, entry3.matchesOrigin(*origin));

    Platform::shutdown();
}