Преглед изворни кода

Stop encoding firefox profile when in binary mode

Daniel Gempesaw пре 9 година
родитељ
комит
27ac15dbe4
3 измењених фајлова са 22 додато и 1 уклоњено
  1. 1 0
      lib/Selenium/CanStartBinary.pm
  2. 2 1
      lib/Selenium/Remote/Driver.pm
  3. 19 0
      t/CanStartBinary.t

+ 1 - 0
lib/Selenium/CanStartBinary.pm

@@ -267,6 +267,7 @@ sub _build_binary_mode {
 
         if ($self->has_firefox_profile) {
             push @args, $self->firefox_profile;
+            $self->clear_firefox_profile;
         }
 
         setup_firefox_binary_env(@args);

+ 2 - 1
lib/Selenium/Remote/Driver.pm

@@ -485,7 +485,8 @@ has 'firefox_profile' => (
 
         return $profile;
     },
-    predicate => 'has_firefox_profile'
+    predicate => 'has_firefox_profile',
+    clearer => 1
 );
 
 has 'desired_capabilities' => (

+ 19 - 0
t/CanStartBinary.t

@@ -79,6 +79,25 @@ FIREFOX: {
         my $firefox = Selenium::Firefox->new;
         isnt( $firefox->port, 4444, 'firefox can start up its own binary');
         ok( Selenium::CanStartBinary::probe_port( $firefox->port ), 'the firefox binary is listening on its port');
+        $firefox->shutdown_binary;
+
+      PROFILE: {
+            my $encoded = 0;
+            {
+                package FFProfile;
+                use Moo;
+                extends 'Selenium::Firefox::Profile';
+
+                sub _encode { $encoded++ };
+                1;
+            }
+
+            my $p = FFProfile->new;
+            my $firefox_with_profile = Selenium::Firefox->new(firefox_profile => $p);
+            $firefox_with_profile->shutdown_binary;
+            is($encoded, 0, 'Binary firefox does not encode profile unnecessarily');
+        }
+
     }
 }